@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
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import Autosuggest, { RenderSuggestion } from 'react-autosuggest';
3
3
  import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
4
4
  import { BemProps } from './utils/types.js';
5
+ import { WrapperElmProps } from './utils.js';
5
6
  export type SiteSearchACI18n = {
6
7
  lang?: string;
7
8
  /** Label for the autocomplete's combobox container div */
@@ -35,6 +36,6 @@ export type SiteSearchAutocompleteProps<T> = {
35
36
  texts?: SiteSearchACI18n;
36
37
  /** @deprecated Use `text` prop instead (will be removed in v0.11) */
37
38
  label?: string;
38
- } & BemProps;
39
+ } & BemProps & WrapperElmProps;
39
40
  export declare const SiteSearchAutocomplete: <T>(props: SiteSearchAutocompleteProps<T>) => JSX.Element;
40
41
  export default SiteSearchAutocomplete;
@@ -23,7 +23,7 @@ exports.defaultSiteSearchACTexts = {
23
23
  },
24
24
  };
25
25
  const SiteSearchAutocomplete = (props) => {
26
- const { suggestions, setSuggestions, renderSuggestion, getSuggestionValue, onSuggestionsFetchRequested, onSuggestionSelected, onSuggestionHighlighted, onSubmit, onButtonClick = onSubmit, bem = 'SiteSearchAutocomplete', } = props;
26
+ const { suggestions, setSuggestions, renderSuggestion, getSuggestionValue, onSuggestionsFetchRequested, onSuggestionSelected, onSuggestionHighlighted, onSubmit, onButtonClick = onSubmit, bem = 'SiteSearchAutocomplete', wrapperProps, } = props;
27
27
  const [value, setValue] = (0, react_1.useState)('');
28
28
  const inputRef = (0, react_1.createRef)();
29
29
  const txt = (0, i18n_1.getTexts)(props, exports.defaultSiteSearchACTexts);
@@ -43,9 +43,9 @@ const SiteSearchAutocomplete = (props) => {
43
43
  },
44
44
  }, renderInputComponent: (inputProps) => {
45
45
  /* prettier-ignore */
46
- const { className, type, disabled, readOnly, required, children } = inputProps, //eslint-disable-line @typescript-eslint/no-unused-vars
47
- siteSearchProps = tslib_1.__rest(inputProps, ["className", "type", "disabled", "readOnly", "required", "children"]);
48
- return (react_1.default.createElement(SiteSearchInput_js_1.default, Object.assign({}, siteSearchProps, { label: props.label || txt.inputLabel, placeholder: txt.placeholder, onSubmit: onSubmit && (() => onSubmit(value)), onButtonClick: onButtonClick && (() => onButtonClick(value)) })));
46
+ const { className, type, disabled, readOnly, required, children } = inputProps, siteSearchProps = tslib_1.__rest(inputProps, ["className", "type", "disabled", "readOnly", "required", "children"]);
47
+ return (react_1.default.createElement(SiteSearchInput_js_1.default, Object.assign({}, siteSearchProps, { wrapperProps: wrapperProps, label: props.label || // eslint-disable-line deprecation/deprecation
48
+ txt.inputLabel, placeholder: txt.placeholder, onSubmit: onSubmit && (() => onSubmit(value)), onButtonClick: onButtonClick && (() => onButtonClick(value)) })));
49
49
  } }));
50
50
  };
51
51
  exports.SiteSearchAutocomplete = SiteSearchAutocomplete;
@@ -6,6 +6,8 @@ const react_1 = tslib_1.__importStar(require("react"));
6
6
  const classUtils_1 = require("@hugsmidjan/qj/classUtils");
7
7
  const hooks_1 = require("@hugsmidjan/react/hooks");
8
8
  const env_js_1 = require("./utils/env.js");
9
+ // NOTE: This component is too low-level (and too esoteric and rarely used)
10
+ // to justify `wrapperProps`
9
11
  const SiteSearchCurtain = (props) => {
10
12
  const [focused, setFocused] = (0, hooks_1.useLaggedState)(false);
11
13
  (0, react_1.useEffect)(() => {
@@ -1,9 +1,7 @@
1
1
  import React from 'react';
2
2
  import { FormFieldWrappingProps } from './FormField.js';
3
- import { SSRSupportProps } from './utils.js';
4
3
  type InputElmProps = Omit<JSX.IntrinsicElements['input'], 'className' | 'type' | 'disabled' | 'readOnly' | 'required' | 'onSubmit'>;
5
- type WrappingProps = Pick<FormFieldWrappingProps, 'id' | 'label'>;
6
- export type SiteSearchInputProps = {
4
+ export type SiteSearchInputProps = Pick<FormFieldWrappingProps, 'id' | 'label' | 'ssr' | 'wrapperProps'> & {
7
5
  /** Triggered when user hits ENTER key with the focus inside the input field
8
6
  *
9
7
  * Return `true` to **allow** the browser's default submit hehavior
@@ -17,7 +15,6 @@ export type SiteSearchInputProps = {
17
15
  */
18
16
  onButtonClick?: () => boolean | void;
19
17
  buttonText?: string;
20
- children?: never;
21
- } & SSRSupportProps & WrappingProps & InputElmProps;
22
- export declare const SiteSearchInput: React.ForwardRefExoticComponent<Pick<SiteSearchInputProps, "form" | "label" | "slot" | "style" | "title" | "key" | "list" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "step" | "value" | "pattern" | "name" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "size" | "src" | "multiple" | "alt" | "ssr" | "accept" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "height" | "max" | "maxLength" | "min" | "minLength" | "width" | "onButtonClick" | "buttonText"> & React.RefAttributes<HTMLInputElement>>;
18
+ } & InputElmProps;
19
+ export declare const SiteSearchInput: React.ForwardRefExoticComponent<Pick<SiteSearchInputProps, "form" | "label" | "slot" | "style" | "title" | "key" | "list" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "step" | "value" | "pattern" | "name" | "wrapperProps" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "size" | "src" | "multiple" | "alt" | "ssr" | "accept" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "height" | "max" | "maxLength" | "min" | "minLength" | "width" | "onButtonClick" | "buttonText"> & React.RefAttributes<HTMLInputElement>>;
23
20
  export default SiteSearchInput;
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SiteSearchInput = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
- const FormField_js_1 = tslib_1.__importDefault(require("./FormField.js"));
6
+ const FormField_js_1 = tslib_1.__importStar(require("./FormField.js"));
7
7
  // ---------------------------------------------------------------------------
8
8
  exports.SiteSearchInput = react_1.default.forwardRef((props, ref) => {
9
9
  var _a;
10
- const { label, id, onChange, placeholder = typeof label === 'string' ? label : undefined, buttonText = 'Leita', onSubmit, onButtonClick = onSubmit, onKeyDown, ssr } = props, inputElementProps = tslib_1.__rest(props, ["label", "id", "onChange", "placeholder", "buttonText", "onSubmit", "onButtonClick", "onKeyDown", "ssr"]);
10
+ const _b = (0, FormField_js_1.groupFormFieldWrapperProps)(props), { onChange, buttonText = 'Leita', onSubmit, onButtonClick = props.onSubmit, onKeyDown, placeholder = typeof props.label === 'string' ? props.label : undefined, fieldWrapperProps } = _b, inputElementProps = tslib_1.__rest(_b, ["onChange", "buttonText", "onSubmit", "onButtonClick", "onKeyDown", "placeholder", "fieldWrapperProps"]);
11
11
  const { value, defaultValue } = inputElementProps;
12
12
  const [hasValue, setHasValue] = (0, react_1.useState)(undefined);
13
13
  const filled = !!((_a = value !== null && value !== void 0 ? value : hasValue) !== null && _a !== void 0 ? _a : !!defaultValue);
@@ -18,7 +18,7 @@ exports.SiteSearchInput = react_1.default.forwardRef((props, ref) => {
18
18
  setHasValue(!!e.target.value);
19
19
  onChange && onChange(e);
20
20
  };
21
- return (react_1.default.createElement(FormField_js_1.default, { className: "SiteSearchInput", ssr: ssr, label: label, empty: empty, filled: filled, id: id, renderInput: (className, inputProps, addFocusProps) => (react_1.default.createElement("div", Object.assign({ className: className.input }, addFocusProps()),
21
+ return (react_1.default.createElement(FormField_js_1.default, Object.assign({ extraClassName: "SiteSearchInput", empty: empty, filled: filled }, fieldWrapperProps, { renderInput: (className, inputProps, addFocusProps) => (react_1.default.createElement("div", Object.assign({ className: className.input }, addFocusProps()),
22
22
  react_1.default.createElement("input", Object.assign({ className: "SiteSearchInput__input", onChange: _onChange }, inputProps, { placeholder: placeholder, onKeyDown: onSubmit
23
23
  ? (e) => {
24
24
  if (e.key === 'Enter' && onSubmit() !== true) {
@@ -28,6 +28,6 @@ exports.SiteSearchInput = react_1.default.forwardRef((props, ref) => {
28
28
  }
29
29
  : onKeyDown }, inputElementProps, { ref: ref })),
30
30
  ' ',
31
- react_1.default.createElement("button", { className: "SiteSearchInput__button", type: "submit", onClick: onButtonClick && ((e) => !onButtonClick() && e.preventDefault()), title: buttonText }, buttonText))) }));
31
+ react_1.default.createElement("button", { className: "SiteSearchInput__button", type: "submit", onClick: onButtonClick && ((e) => !onButtonClick() && e.preventDefault()), title: buttonText }, buttonText))) })));
32
32
  });
33
33
  exports.default = exports.SiteSearchInput;
package/Skeleton.d.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  import { ReactElement } from 'react';
2
+ import { EitherObj } from '@reykjavik/hanna-utils';
3
+ import { WrapperElmProps } from './utils.js';
2
4
  export type SkeletonProps = {
3
5
  text?: boolean;
4
6
  height?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
7
+ } & EitherObj<{
5
8
  items?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
6
9
  gap?: 1 | 2 | 3 | 4 | 5;
7
- };
10
+ }, WrapperElmProps>;
8
11
  export declare const Skeleton: {
9
12
  (props: SkeletonProps): JSX.Element;
10
13
  /** Returns a single `<Skeleton height={X}/>` element of branded type `SkeletonBlock` */
package/Skeleton.js CHANGED
@@ -5,27 +5,24 @@ const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const classUtils_1 = require("@hugsmidjan/qj/classUtils");
7
7
  const range_1 = tslib_1.__importDefault(require("@hugsmidjan/qj/range"));
8
- const makeRenderSkeleton = (props) => (key) => (react_1.default.createElement("span", { key: key, className: (0, classUtils_1.modifiedClass)('Skeleton', [
9
- props.text && 'text',
10
- props.height && 'height--' + props.height,
11
- props.gap && 'gap--' + props.gap,
12
- ]) }));
13
- const minmax = (num = 0, max = 100, min = 1) => {
14
- num = Math.min(Math.max(Math.round(num), min), max);
15
- return num > min ? num : undefined;
8
+ /** Rounds the input number, caps it at max. If it's below min, returns undefined */
9
+ const minmax = (num, max, min) => {
10
+ if (num == null || isNaN(num)) {
11
+ return;
12
+ }
13
+ num = Math.round(num);
14
+ return num > max ? max : num >= min ? num : undefined;
16
15
  };
17
16
  const Skeleton = (props) => {
18
- const height = minmax(props.height, 40);
19
- const renderSkeleton = makeRenderSkeleton({
20
- height,
21
- text: props.text,
22
- gap: minmax(props.gap, 5, 0),
23
- });
24
- const items = minmax(props.items, 20) || 1;
25
- if (items > 1) {
26
- return react_1.default.createElement(react_1.default.Fragment, null, (0, range_1.default)(1, items).map(renderSkeleton));
17
+ const height = minmax(props.height, 20, 2);
18
+ const gap = minmax(props.gap, 5, 1);
19
+ const items = minmax(props.items, 20, 2) || 1;
20
+ const { wrapperProps } = props;
21
+ const className = (0, classUtils_1.modifiedClass)('Skeleton', [props.text && 'text', height && 'height--' + height, gap && 'gap--' + gap], (wrapperProps || {}).className);
22
+ if (items) {
23
+ return (react_1.default.createElement(react_1.default.Fragment, null, (0, range_1.default)(1, items).map((key) => (react_1.default.createElement("span", { key: key, className: className })))));
27
24
  }
28
- return renderSkeleton();
25
+ return react_1.default.createElement("span", Object.assign({}, wrapperProps, { className: className }));
29
26
  };
30
27
  exports.Skeleton = Skeleton;
31
28
  exports.default = exports.Skeleton;
package/SubHeading.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { SeenProp } from './utils/seenEffect.js';
3
3
  import { ComponentLayoutProps } from './constants.js';
4
+ import { WrapperElmProps } from './utils.js';
4
5
  export type SubHeadingProps = {
5
6
  Tag?: 'h2' | 'h3';
6
7
  small?: boolean;
7
8
  children: ReactNode;
8
- } & ComponentLayoutProps & SeenProp;
9
+ } & ComponentLayoutProps & WrapperElmProps & SeenProp;
9
10
  export declare const SubHeading: (props: SubHeadingProps) => JSX.Element;
10
11
  export default SubHeading;
package/SubHeading.js CHANGED
@@ -6,13 +6,13 @@ const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const classUtils_1 = require("@hugsmidjan/qj/classUtils");
7
7
  const seenEffect_js_1 = require("./utils/seenEffect.js");
8
8
  const SubHeading = (props) => {
9
- const { small, Tag = 'h2', children, align, wide, startSeen } = props;
9
+ const { small, Tag = 'h2', children, align, wide, startSeen, wrapperProps } = props;
10
10
  const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
11
- return (react_1.default.createElement(Tag, { className: (0, classUtils_1.modifiedClass)('SubHeading', [
11
+ return (react_1.default.createElement(Tag, Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('SubHeading', [
12
12
  small && 'small',
13
13
  align === 'right' && 'align--' + align,
14
14
  !align && wide && 'wide',
15
- ]), ref: ref }, children));
15
+ ], (wrapperProps || {}).className), ref: ref }), children));
16
16
  };
17
17
  exports.SubHeading = SubHeading;
18
18
  exports.default = exports.SubHeading;
package/Tabs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SeenProp } from './utils/seenEffect.js';
2
- import { SSRSupportProps } from './utils.js';
2
+ import { SSRSupportProps, WrapperElmProps } from './utils.js';
3
3
  export type TabItemProps = {
4
4
  label: string;
5
5
  badge?: string | number;
@@ -27,7 +27,7 @@ export type TabsProps<T extends TabItemProps = TabItemProps> = BaseTabsProps<T>
27
27
  vertical?: boolean;
28
28
  /** Optional <Tabs/> block connected to the currently active tab */
29
29
  subTabs?: BaseTabsProps;
30
- } & SeenProp;
30
+ } & WrapperElmProps<null, 'role' | 'aria-label' | 'aria-labelledby'> & SeenProp;
31
31
  /** @deprecated Use `TabsProps` instead (Will be removed in v0.11) */
32
32
  export type TablistProps<T extends TabItemProps = TabItemProps> = TabsProps<T>;
33
33
  export declare const Tabs: (props: TabsProps) => JSX.Element;
package/Tabs.js CHANGED
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Tabs = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
- const frag_1 = require("@hugsmidjan/qj/frag");
7
6
  const classUtils_1 = require("@hugsmidjan/qj/classUtils");
7
+ const frag_1 = require("@hugsmidjan/qj/frag");
8
8
  const seenEffect_js_1 = require("./utils/seenEffect.js");
9
9
  const utils_js_1 = require("./utils.js");
10
10
  const navKeyEffects = {
@@ -13,7 +13,6 @@ const navKeyEffects = {
13
13
  ArrowDown: 1,
14
14
  ArrowRight: 1,
15
15
  };
16
- // eslint-disable-next-line complexity
17
16
  const renderTab = (tabProps, index, listProps) => {
18
17
  const { label, badge, href, type, longLabel } = tabProps;
19
18
  const { activeIdx, activateTab, focusedIdx, setFocusedIdx, tabRole, listAriaControls, isBrowser, } = listProps;
@@ -50,7 +49,7 @@ const renderTab = (tabProps, index, listProps) => {
50
49
  // https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-2/tabs.html
51
50
  const Tabs = (props) => {
52
51
  var _a, _b;
53
- const { tabs, role, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-controls': listAriaControls, id, activeIdx, onSetActive, activateOnFocus, ssr, startSeen, vertical, subTabs, } = props;
52
+ const { tabs, role, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-controls': listAriaControls, wrapperProps = {}, id = wrapperProps.id, activeIdx, onSetActive, activateOnFocus, ssr, startSeen, vertical, subTabs, } = props;
54
53
  const isBrowser = (0, utils_js_1.useIsBrowserSide)(ssr);
55
54
  const [focusedIdx, setFocusedIdx] = (0, react_1.useState)(activeIdx || 0);
56
55
  const tabRole = isBrowser && role === 'tablist' ? 'tab' : undefined;
@@ -66,7 +65,7 @@ const Tabs = (props) => {
66
65
  };
67
66
  const handleKeydown = tabRole &&
68
67
  ((e) => {
69
- var _a;
68
+ var _a, _b;
70
69
  const delta = navKeyEffects[e.key];
71
70
  if (delta) {
72
71
  // prevent scolling +
@@ -77,6 +76,7 @@ const Tabs = (props) => {
77
76
  nextIdx = nextIdx < 0 ? maxIdx : nextIdx > maxIdx ? 0 : nextIdx;
78
77
  (_a = e.currentTarget.querySelectorAll('.Tabs__tab')[nextIdx]) === null || _a === void 0 ? void 0 : _a.focus();
79
78
  activateOnFocus && activateTab(nextIdx);
79
+ (_b = wrapperProps.onKeyDown) === null || _b === void 0 ? void 0 : _b.call(wrapperProps, e);
80
80
  }
81
81
  });
82
82
  const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
@@ -89,7 +89,7 @@ const Tabs = (props) => {
89
89
  listAriaControls,
90
90
  isBrowser,
91
91
  };
92
- return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('Tabs', vertical && 'vertical'), role: tabRole && role, id: id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onKeyDown: handleKeydown, "data-sprinkled": isBrowser, ref: ref },
92
+ return (react_1.default.createElement("div", Object.assign({}, props.wrapperProps, { className: (0, classUtils_1.modifiedClass)('Tabs', vertical && 'vertical', wrapperProps.className), role: tabRole && role, id: id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onKeyDown: handleKeydown, "data-sprinkled": isBrowser, ref: ref }),
93
93
  tabs.map((tabProps, index) => renderTab(tabProps, index, listProps)),
94
94
  subTabs && (react_1.default.createElement(exports.Tabs, Object.assign({}, subTabs, { role: 'role' in subTabs ? subTabs.role : role, activateOnFocus: (_a = subTabs.activateOnFocus) !== null && _a !== void 0 ? _a : activateOnFocus, ssr: (_b = subTabs.ssr) !== null && _b !== void 0 ? _b : ssr, startSeen: true,
95
95
  // just to be sure
package/TagPill.js CHANGED
@@ -12,6 +12,8 @@ const colors = {
12
12
  orange: 'color--orange',
13
13
  red: 'color--red',
14
14
  };
15
+ // NOTE: As a `_abstract/_Button.tsx`-derived component, all `<button/>` and
16
+ // `<a/>` props are allowed directly, so adding `wrapperProps` makes no sense.
15
17
  const TagPill = (props) => {
16
18
  const { modifier, large, removable, onRemove, children, color = 'normal', label = children, removeLabel = 'x', removeLabelLong = removeLabel } = props, buttonProps = tslib_1.__rest(props, ["modifier", "large", "removable", "onRemove", "children", "color", "label", "removeLabel", "removeLabelLong"]);
17
19
  const isStatic = !('href' in props || 'type' in props || props.onClick);
package/TextBlock.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { SeenProp } from './utils/seenEffect.js';
3
3
  import { ComponentLayoutProps } from './constants.js';
4
+ import { WrapperElmProps } from './utils.js';
4
5
  export type TextBlockProps = ComponentLayoutProps & {
5
6
  /** Make H2 headings float to the left
6
7
  *
@@ -10,6 +11,6 @@ export type TextBlockProps = ComponentLayoutProps & {
10
11
  /** Sets a smaller text-size */
11
12
  small?: boolean;
12
13
  children: ReactNode;
13
- } & SeenProp;
14
+ } & WrapperElmProps & SeenProp;
14
15
  export declare const TextBlock: (props: TextBlockProps) => JSX.Element;
15
16
  export default TextBlock;
package/TextBlock.js CHANGED
@@ -6,15 +6,15 @@ const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const classUtils_1 = require("@hugsmidjan/qj/classUtils");
7
7
  const seenEffect_js_1 = require("./utils/seenEffect.js");
8
8
  const TextBlock = (props) => {
9
- const { children, align, labelled, wide, small, startSeen } = props;
9
+ const { children, align, labelled, wide, small, startSeen, wrapperProps } = props;
10
10
  const rightAligned = align === 'right' || labelled;
11
11
  const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
12
- return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('TextBlock', [
12
+ return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('TextBlock', [
13
13
  labelled && 'labelled',
14
14
  rightAligned && 'align--right',
15
15
  wide && !rightAligned && 'wide',
16
16
  small && !labelled && 'small',
17
- ]), ref: ref }, children));
17
+ ], (wrapperProps || {}).className), ref: ref }), children));
18
18
  };
19
19
  exports.TextBlock = TextBlock;
20
20
  exports.default = exports.TextBlock;
package/TextButton.js CHANGED
@@ -4,6 +4,8 @@ exports.TextButton = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const _Button_js_1 = require("./_abstract/_Button.js");
7
+ // NOTE: As a `_abstract/_Button.tsx`-derived component, all `<button/>` and
8
+ // `<a/>` props are allowed directly, so adding `wrapperProps` makes no sense.
7
9
  const TextButton = (props) => {
8
10
  if ('disabled' in props) {
9
11
  props = Object.assign(Object.assign({}, props), { disabled: undefined });
package/TextInput.d.ts CHANGED
@@ -2,9 +2,9 @@ import { RefObject } from 'react';
2
2
  import { FormFieldWrappingProps } from './FormField.js';
3
3
  type InputElmProps = JSX.IntrinsicElements['input'];
4
4
  type TextareaElmProps = JSX.IntrinsicElements['textarea'];
5
- export type TextInputProps = {
5
+ export type TextInputProps = FormFieldWrappingProps & {
6
6
  small?: boolean;
7
- } & FormFieldWrappingProps & (({
7
+ } & (({
8
8
  type?: 'text' | 'email' | 'tel' | 'number' | 'date' | 'url' | 'password' | 'search';
9
9
  inputRef?: RefObject<HTMLInputElement>;
10
10
  } & InputElmProps) | ({
package/TextInput.js CHANGED
@@ -4,17 +4,16 @@ exports.TextInput = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const classUtils_1 = require("@hugsmidjan/qj/classUtils");
7
- const FormField_js_1 = tslib_1.__importDefault(require("./FormField.js"));
7
+ const FormField_js_1 = tslib_1.__importStar(require("./FormField.js"));
8
8
  const TextInput = (props) => {
9
9
  var _a;
10
10
  const _inputRef = (0, react_1.useRef)(null);
11
- const { className, label, assistText, hideLabel, disabled, readOnly, invalid, errorMessage, required, reqText, id, onChange, small, type, ssr, inputRef = _inputRef } = props, inputElementProps = tslib_1.__rest(props, ["className", "label", "assistText", "hideLabel", "disabled", "readOnly", "invalid", "errorMessage", "required", "reqText", "id", "onChange", "small", "type", "ssr", "inputRef"]);
11
+ const _b = (0, FormField_js_1.groupFormFieldWrapperProps)(props), { onChange, type, inputRef = _inputRef, fieldWrapperProps } = _b, inputElementProps = tslib_1.__rest(_b, ["onChange", "type", "inputRef", "fieldWrapperProps"]);
12
12
  const { value, defaultValue, placeholder } = inputElementProps;
13
13
  const [hasValue, setHasValue] = (0, react_1.useState)(undefined);
14
14
  const filled = !!((_a = value !== null && value !== void 0 ? value : hasValue) !== null && _a !== void 0 ? _a : !!defaultValue);
15
15
  const empty = !filled && !placeholder;
16
16
  const multiline = type === 'textarea';
17
- const modifiers = [multiline && 'multiline'];
18
17
  const _onChange = value != null
19
18
  ? onChange
20
19
  : (e) => {
@@ -30,7 +29,7 @@ const TextInput = (props) => {
30
29
  setHasValue(true);
31
30
  }
32
31
  }, []);
33
- return (react_1.default.createElement(FormField_js_1.default, { className: (0, classUtils_1.modifiedClass)('TextInput', modifiers, className), ssr: ssr, small: small, label: label, empty: empty, filled: filled, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps, addFocusProps) => multiline ? (react_1.default.createElement("textarea", Object.assign({ className: className.input, onChange: _onChange }, inputProps, addFocusProps(inputElementProps), { ref: inputRef }))) : (react_1.default.createElement("input", Object.assign({ className: className.input, onChange: _onChange, type: type }, inputProps, addFocusProps(inputElementProps), { ref: inputRef }))) }));
32
+ return (react_1.default.createElement(FormField_js_1.default, Object.assign({ extraClassName: (0, classUtils_1.modifiedClass)('TextInput', [multiline && 'multiline']), empty: empty, filled: filled }, fieldWrapperProps, { renderInput: (className, inputProps, addFocusProps) => multiline ? (react_1.default.createElement("textarea", Object.assign({ className: className.input, onChange: _onChange }, inputProps, addFocusProps(inputElementProps), { ref: inputRef }))) : (react_1.default.createElement("input", Object.assign({ className: className.input, onChange: _onChange, type: type }, inputProps, addFocusProps(inputElementProps), { ref: inputRef }))) })));
34
33
  };
35
34
  exports.TextInput = TextInput;
36
35
  exports.default = exports.TextInput;
package/Tooltip.d.ts CHANGED
@@ -1,7 +1,8 @@
1
+ import { WrapperElmProps } from './utils.js';
1
2
  export type TooltipProps = {
2
3
  label: string;
3
4
  text: string | JSX.Element;
4
5
  iconOnly?: boolean;
5
- };
6
+ } & WrapperElmProps<'details', 'open'>;
6
7
  export declare const Tooltip: (props: TooltipProps) => JSX.Element;
7
8
  export default Tooltip;
package/Tooltip.js CHANGED
@@ -4,14 +4,14 @@ exports.Tooltip = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const react_2 = require("@floating-ui/react");
7
- const hooks_1 = require("@hugsmidjan/react/hooks");
8
7
  const classUtils_1 = require("@hugsmidjan/qj/classUtils");
8
+ const hooks_1 = require("@hugsmidjan/react/hooks");
9
9
  const getSide = (placement) => placement.split('-')[0];
10
10
  const Tooltip = (props) => {
11
- const { text, label, iconOnly } = props;
11
+ const { text, label, iconOnly, wrapperProps = {} } = props;
12
12
  const arrowRef = (0, react_1.useRef)(null);
13
13
  const [isOpen, setIsOpen] = (0, hooks_1.useLaggedState)(false, 300);
14
- const { x, y, reference, floating, middlewareData, placement } = (0, react_2.useFloating)({
14
+ const { x, y, refs, middlewareData, placement } = (0, react_2.useFloating)({
15
15
  placement: 'top',
16
16
  middleware: [(0, react_2.offset)(10), (0, react_2.flip)(), (0, react_2.shift)(), (0, react_2.arrow)({ element: arrowRef })],
17
17
  whileElementsMounted: react_2.autoUpdate,
@@ -22,40 +22,53 @@ const Tooltip = (props) => {
22
22
  (0, hooks_1.useCallbackOnEsc)(() => {
23
23
  setIsOpen(false);
24
24
  });
25
- return (react_1.default.createElement("details", { className: `Tooltip Tooltip--${getSide(placement)}`, open: isOpen, onMouseEnter: () => setIsOpen(true, 100), onFocus: () => {
25
+ return (react_1.default.createElement("details", Object.assign({}, props.wrapperProps, { className: (0, classUtils_1.modifiedClass)('Tooltip', getSide(placement), wrapperProps.className), open: isOpen, onMouseEnter: (e) => {
26
+ var _a;
27
+ setIsOpen(true, 100);
28
+ (_a = wrapperProps.onMouseEnter) === null || _a === void 0 ? void 0 : _a.call(wrapperProps, e);
29
+ }, onFocus: (e) => {
30
+ var _a;
26
31
  if (isOpen) {
27
32
  setIsOpen(true, 0);
28
33
  }
29
- }, onBlur: () => setIsOpen(false), onClick: (e) => {
34
+ (_a = wrapperProps.onFocus) === null || _a === void 0 ? void 0 : _a.call(wrapperProps, e);
35
+ }, onBlur: (e) => {
36
+ var _a;
37
+ setIsOpen(false);
38
+ (_a = wrapperProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(wrapperProps, e);
39
+ }, onClick: (e) => {
40
+ var _a;
30
41
  e.preventDefault();
31
42
  setIsOpen(!isOpen, 0);
32
- }, onMouseDown: () => {
43
+ (_a = wrapperProps.onClick) === null || _a === void 0 ? void 0 : _a.call(wrapperProps, e);
44
+ }, onMouseDown: (e) => {
45
+ var _a;
33
46
  if (isOpen) {
34
47
  setTimeout(() => {
35
48
  setIsOpen(true, 0);
36
49
  }, 100);
37
50
  }
51
+ (_a = wrapperProps.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(wrapperProps, e);
38
52
  }, onMouseLeave: (e) => {
53
+ var _a;
39
54
  if (e.currentTarget.$contextClicked_firefox_fix) {
40
55
  return;
41
56
  }
42
57
  setIsOpen(false);
58
+ (_a = wrapperProps.onMouseLeave) === null || _a === void 0 ? void 0 : _a.call(wrapperProps, e);
43
59
  }, onContextMenu: (e) => {
60
+ var _a;
44
61
  const elm = e.currentTarget;
45
62
  clearTimeout(elm.$contextClicked_firefox_fix);
46
63
  elm.$contextClicked_firefox_fix = setTimeout(() => {
47
64
  delete elm.$contextClicked_firefox_fix;
48
65
  }, 300);
66
+ (_a = wrapperProps.onContextMenu) === null || _a === void 0 ? void 0 : _a.call(wrapperProps, e);
49
67
  }, style: x == null
50
- ? undefined
51
- : {
52
- '--tooltip-content-pos-y': `${y}px`,
53
- '--tooltip-content-pos-x': `${x}px`,
54
- '--tooltip-arrow-pos-x': `${arrowX}px`,
55
- '--tooltip-arrow-pos-y': `${arrowY}px`,
56
- } },
57
- react_1.default.createElement("summary", { className: (0, classUtils_1.modifiedClass)('Tooltip__trigger', iconOnly && 'icononly'), ref: reference }, label),
58
- react_1.default.createElement("div", { className: "Tooltip__content", onClick: (e) => e.stopPropagation(), ref: floating },
68
+ ? wrapperProps.style
69
+ : Object.assign(Object.assign({}, wrapperProps.style), { '--tooltip-content-pos-y': `${y}px`, '--tooltip-content-pos-x': `${x}px`, '--tooltip-arrow-pos-x': `${arrowX}px`, '--tooltip-arrow-pos-y': `${arrowY}px` }) }),
70
+ react_1.default.createElement("summary", { className: (0, classUtils_1.modifiedClass)('Tooltip__trigger', iconOnly && 'icononly'), ref: refs.setReference }, label),
71
+ react_1.default.createElement("div", { className: "Tooltip__content", onClick: (e) => e.stopPropagation(), ref: refs.setFloating },
59
72
  x !== null && (react_1.default.createElement("div", { "data-floating-ui-hack-plz-ignore": "", style: { position: 'absolute', display: 'none' }, ref: arrowRef })),
60
73
  text)));
61
74
  };
package/VSpacer.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { EitherObj } from '@reykjavik/hanna-utils';
3
+ import { WrapperElmProps } from './utils.js';
3
4
  declare const sizes: {
4
5
  readonly none: "none";
5
6
  readonly small: "small";
@@ -17,6 +18,6 @@ export type VSpacerProps = EitherObj<{
17
18
  size?: VSpacerSizePos;
18
19
  top?: VSpacerSize;
19
20
  bottom?: VSpacerSize;
20
- }>;
21
+ }> & WrapperElmProps;
21
22
  export declare const VSpacer: (props: VSpacerProps) => JSX.Element;
22
23
  export default VSpacer;
package/VSpacer.js CHANGED
@@ -15,7 +15,7 @@ const sizes = {
15
15
  const hasChildren = (children) => (children && !(Array.isArray(children) && !children.length)) || undefined;
16
16
  const normalizeProp = (value, exclude) => value && value !== exclude ? sizes[value] : undefined;
17
17
  const VSpacer = (props) => {
18
- const { size, top, bottom, children } = props;
18
+ const { size, top, bottom, children, wrapperProps } = props;
19
19
  const isWrapper = hasChildren(children);
20
20
  let topVal = normalizeProp(isWrapper && top);
21
21
  let bottomVal = normalizeProp(isWrapper && bottom);
@@ -35,12 +35,8 @@ const VSpacer = (props) => {
35
35
  bottomVal = undefined;
36
36
  }
37
37
  }
38
- const className = (0, classUtils_1.modifiedClass)('VSpacer', [
39
- sizeVal,
40
- topVal && 'top--' + topVal,
41
- bottomVal && 'bottom--' + bottomVal,
42
- ]);
43
- return isWrapper ? (react_1.default.createElement("div", { className: className }, children)) : (react_1.default.createElement("hr", { className: className }));
38
+ const className = (0, classUtils_1.modifiedClass)('VSpacer', [sizeVal, topVal && 'top--' + topVal, bottomVal && 'bottom--' + bottomVal], (wrapperProps || {}).className);
39
+ return isWrapper ? (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: className }), children)) : (react_1.default.createElement("hr", Object.assign({}, wrapperProps, { className: className })));
44
40
  };
45
41
  exports.VSpacer = VSpacer;
46
42
  exports.default = exports.VSpacer;
@@ -9,6 +9,6 @@ export type VerticalTabsTOCSubItem = TabItemProps & {
9
9
  export type VerticalTabsTOCProps = {
10
10
  items: Array<VerticalTabsTOCItem>;
11
11
  onItemSelect: (itemId: string) => void;
12
- } & Pick<TabsProps, 'aria-label' | 'ssr' | 'activateOnFocus' | 'id' | 'startSeen'>;
12
+ } & Pick<TabsProps, 'aria-label' | 'ssr' | 'activateOnFocus' | 'id' | 'startSeen' | 'wrapperProps'>;
13
13
  export declare const VerticalTabsTOC: (props: VerticalTabsTOCProps) => JSX.Element;
14
14
  export default VerticalTabsTOC;
@@ -62,7 +62,7 @@ const VerticalTabsTOC = (props) => {
62
62
  window.addEventListener('hashchange', handleHash);
63
63
  return () => window.removeEventListener('hashchange', handleHash);
64
64
  }, [itemsById, onItemSelect]);
65
- return (react_1.default.createElement(Tabs_js_1.default, { id: domid, vertical: true, "aria-label": props['aria-label'], onSetActive: (_, item) => {
65
+ return (react_1.default.createElement(Tabs_js_1.default, { wrapperProps: props.wrapperProps, id: domid, vertical: true, "aria-label": props['aria-label'], onSetActive: (_, item) => {
66
66
  var _a;
67
67
  const itemId = getItemId(item);
68
68
  const newId = itemId || getItemId((_a = itemsById[itemId].subTabs) === null || _a === void 0 ? void 0 : _a.tabs[0]);
package/WizardLayout.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import type { HannaColorTheme } from '@reykjavik/hanna-css';
3
- import { SSRSupportProps } from './utils.js';
3
+ import { SSRSupportProps, WrapperElmProps } from './utils.js';
4
4
  type WizardLayoutProps = {
5
5
  wizardStepper?: ReactNode | false;
6
6
  wizardFooter?: ReactNode | false;
@@ -9,6 +9,6 @@ type WizardLayoutProps = {
9
9
  logoLink?: string;
10
10
  globalAlerts?: ReactNode;
11
11
  children?: ReactNode;
12
- } & SSRSupportProps;
12
+ } & SSRSupportProps & WrapperElmProps;
13
13
  export declare const WizardLayout: (props: WizardLayoutProps) => JSX.Element;
14
14
  export default WizardLayout;
package/WizardLayout.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WizardLayout = 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 _Link_js_1 = require("./_abstract/_Link.js");
@@ -12,15 +13,15 @@ const WizardLayout = (props) => {
12
13
  (0, useScrollbarWidthCSSVar_js_1.useScrollbarWidthCSSVar)();
13
14
  const {
14
15
  // ssr,
15
- wizardStepper, wizardFooter, children, colorTheme, logoLink = '/', siteName = '', globalAlerts, } = props;
16
+ wizardStepper, wizardFooter, children, colorTheme, logoLink = '/', siteName = '', globalAlerts, wrapperProps, } = props;
16
17
  const isBrowser = (0, utils_js_1.useIsBrowserSide)( /* ssr */);
17
- return (react_1.default.createElement("div", { className: "WizardLayout", "data-sprinkled": isBrowser, "data-color-theme": colorTheme },
18
+ return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('WizardLayout', null, (wrapperProps || {}).className), "data-sprinkled": isBrowser, "data-color-theme": colorTheme }),
18
19
  globalAlerts && (react_1.default.createElement("div", { className: "WizardLayout__alerts", role: "alert" }, globalAlerts)),
19
20
  react_1.default.createElement("div", { className: "WizardLayout__content" },
20
21
  react_1.default.createElement("div", { className: "WizardLayout__header", role: "banner" },
21
22
  react_1.default.createElement(_Link_js_1.Link, { className: "WizardLayout__header__logo", href: logoLink },
22
23
  ' ',
23
- react_1.default.createElement(_Image_js_1.Image, { className: undefined, inline: true, src: (0, assets_1.getAssetUrl)('reykjavik-logo.svg'), altText: "Reykjav\u00EDk" }),
24
+ react_1.default.createElement(_Image_js_1.Image, { bem: undefined, inline: true, src: (0, assets_1.getAssetUrl)('reykjavik-logo.svg'), altText: "Reykjav\u00EDk" }),
24
25
  ' ',
25
26
  siteName,
26
27
  ' '),