@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
@@ -1,8 +1,9 @@
1
1
  import { ReactNode } from 'react';
2
+ import { WrapperElmProps } from './utils.js';
2
3
  export type RowBlockColumnProps = {
3
4
  background?: boolean | 'primary';
4
5
  narrow?: boolean;
5
6
  children: ReactNode;
6
- };
7
+ } & WrapperElmProps;
7
8
  export declare const RowBlockColumn: (props: RowBlockColumnProps) => JSX.Element;
8
9
  export default RowBlockColumn;
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { modifiedClass } from '@hugsmidjan/qj/classUtils';
3
3
  export const RowBlockColumn = (props) => {
4
- const { background, narrow, children } = props;
5
- return (React.createElement("div", { className: modifiedClass('RowBlockColumn', [
4
+ const { background, narrow, children, wrapperProps } = props;
5
+ return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('RowBlockColumn', [
6
6
  narrow && 'narrow',
7
7
  background && 'background',
8
8
  background === 'primary' && 'background--primary',
9
- ]) }, children));
9
+ ], (wrapperProps || {}).className) }), children));
10
10
  };
11
11
  export default RowBlockColumn;
@@ -1,18 +1,12 @@
1
1
  import { RefObject } from 'react';
2
2
  import { FormFieldWrappingProps } from './FormField.js';
3
- type InputElmProps = JSX.IntrinsicElements['input'];
4
- type BaseProps<Type extends {
5
- type?: string;
6
- }, InputProps extends object> = {
3
+ export type SearchInputProps = FormFieldWrappingProps & {
7
4
  small?: boolean;
8
- children?: never;
5
+ type?: string;
9
6
  onButtonClick?: () => void;
10
7
  buttonText?: string;
11
8
  inputRef?: RefObject<HTMLInputElement>;
12
9
  buttonRef?: RefObject<HTMLButtonElement>;
13
- } & Type & FormFieldWrappingProps & InputProps;
14
- export type SearchInputProps = BaseProps<{
15
- type?: 'text';
16
- }, InputElmProps>;
10
+ } & JSX.IntrinsicElements['input'];
17
11
  export declare const SearchInput: (props: SearchInputProps) => JSX.Element;
18
12
  export default SearchInput;
@@ -1,10 +1,9 @@
1
1
  import { __rest } from "tslib";
2
2
  import React, { useState } from 'react';
3
- import { modifiedClass } from '@hugsmidjan/qj/classUtils';
4
- import FormField from './FormField.js';
3
+ import FormField, { groupFormFieldWrapperProps, } from './FormField.js';
5
4
  export const SearchInput = (props) => {
6
5
  var _a;
7
- const { className, label, assistText, hideLabel, disabled, readOnly, invalid, errorMessage, required, reqText, id, onChange, small, onButtonClick, buttonText = 'Leita', ssr } = props, inputElementProps = __rest(props, ["className", "label", "assistText", "hideLabel", "disabled", "readOnly", "invalid", "errorMessage", "required", "reqText", "id", "onChange", "small", "onButtonClick", "buttonText", "ssr"]);
6
+ const _b = groupFormFieldWrapperProps(props), { onChange, onButtonClick, buttonText = 'Leita', fieldWrapperProps } = _b, inputElementProps = __rest(_b, ["onChange", "onButtonClick", "buttonText", "fieldWrapperProps"]);
8
7
  const { value, defaultValue, placeholder } = inputElementProps;
9
8
  const [hasValue, setHasValue] = useState(undefined);
10
9
  const filled = !!((_a = value !== null && value !== void 0 ? value : hasValue) !== null && _a !== void 0 ? _a : !!defaultValue);
@@ -15,9 +14,9 @@ export const SearchInput = (props) => {
15
14
  setHasValue(!!e.target.value);
16
15
  onChange && onChange(e);
17
16
  };
18
- return (React.createElement(FormField, { className: modifiedClass('SearchInput', [], className), ssr: ssr, small: small, label: label, empty: empty, filled: filled, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps, addFocusProps) => (React.createElement("div", Object.assign({ className: className.input }, addFocusProps()),
17
+ return (React.createElement(FormField, Object.assign({ extraClassName: "SearchInput", empty: empty, filled: filled }, fieldWrapperProps, { renderInput: (className, inputProps, addFocusProps) => (React.createElement("div", Object.assign({ className: className.input }, addFocusProps()),
19
18
  React.createElement("input", Object.assign({ className: "SearchInput__input", onChange: _onChange }, inputProps, inputElementProps, { ref: props.inputRef })),
20
19
  ' ',
21
- onButtonClick && (React.createElement("button", { className: "SearchInput__button", type: "button", onClick: onButtonClick, title: buttonText, ref: props.buttonRef, disabled: disabled || readOnly }, buttonText)))) }));
20
+ onButtonClick && (React.createElement("button", { className: "SearchInput__button", type: "button", onClick: onButtonClick, title: buttonText, ref: props.buttonRef, disabled: props.disabled || props.readOnly }, buttonText)))) })));
22
21
  };
23
22
  export default SearchInput;
@@ -9,6 +9,6 @@ export const SearchResultsItem = (props) => {
9
9
  React.createElement(Link, { className: bem + '__link', href: href },
10
10
  React.createElement("h3", { className: bem + '__title' }, title),
11
11
  metaArr.length > 0 && (React.createElement("span", { className: bem + '__meta' }, metaArr.map((item, i) => typeof item === 'function' ? item() : item && React.createElement("span", { key: i }, item)))),
12
- highlight && image && React.createElement(Image, { className: bem + '__image', src: image }),
12
+ highlight && image && React.createElement(Image, { bem: bem + '__image', src: image }),
13
13
  React.createElement("div", { className: bem + '__summary', dangerouslySetInnerHTML: { __html: summary } }))));
14
14
  };
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { SearchResultsItemProps } from './SearchResults/_SearchResultsItem.js';
3
+ import { WrapperElmProps } from './utils.js';
3
4
  export type SearchReesultI18n = {
4
5
  lang: string;
5
6
  loadQueryTitle: string;
@@ -32,6 +33,6 @@ export type SearchResultsProps = {
32
33
  loadMore?: () => void;
33
34
  texts?: SearchReesultI18n;
34
35
  lang?: string;
35
- };
36
+ } & WrapperElmProps;
36
37
  export declare const SearchResults: (props: SearchResultsProps) => JSX.Element;
37
38
  export default SearchResults;
@@ -94,10 +94,10 @@ const renderLoadMore = (props, texts) => {
94
94
  };
95
95
  // TODO: add plural translation thingy for result string
96
96
  export const SearchResults = (props) => {
97
- const { filters, activeFilterIdx, setFilter, status, errorText } = props;
97
+ const { filters, activeFilterIdx, setFilter, status, errorText, wrapperProps } = props;
98
98
  const texts = getTexts(props, defaultTexts);
99
99
  const domid = useDomid();
100
- return (React.createElement("div", { className: modifiedClass('SearchResults', status !== 'results' && status) },
100
+ return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('SearchResults', status !== 'results' && status, (wrapperProps || {}).className) }),
101
101
  renderTitle(props, texts),
102
102
  React.createElement(SearchResults_Tabs, { domid: domid, filters: filters, activeIdx: activeFilterIdx, setFilter: setFilter, lang: texts.lang }),
103
103
  React.createElement("div", { className: "SearchResults__results", id: domid },
package/esm/SeenEffect.js CHANGED
@@ -6,6 +6,8 @@ const _SeenEffect = (props) => {
6
6
  const [ref] = useSeenEffect();
7
7
  return React.createElement(Tag, Object.assign({}, tagProps, { ref: ref }, getEffectAttr(effectType)));
8
8
  };
9
+ // NOTE: As this component already accepts all `<div/>` props directly,
10
+ // it makes little sense to add support for `wrapperProps` on top.
9
11
  export const SeenEffect = (props) => {
10
12
  const _a = props, { Tag = 'div', effectType, startSeen } = _a, tagProps = __rest(_a, ["Tag", "effectType", "startSeen"]);
11
13
  const addEffects = (effectType || '') !== 'none' || startSeen !== true;
package/esm/Selectbox.js CHANGED
@@ -1,14 +1,13 @@
1
1
  import { __rest } from "tslib";
2
2
  import React, { useEffect, useRef, useState } from 'react';
3
- import { modifiedClass } from '@hugsmidjan/qj/classUtils';
4
3
  import _Selectbox from '@hugsmidjan/react/Selectbox';
5
- import FormField from './FormField.js';
4
+ import FormField, { groupFormFieldWrapperProps, } from './FormField.js';
6
5
  const getValue = (opt) => {
7
6
  const val = typeof opt === 'object' ? opt.value : opt;
8
7
  return typeof val === 'number' ? String(val) : val;
9
8
  };
10
9
  export const Selectbox = (props) => {
11
- const { className, label, assistText, hideLabel, disabled, readOnly, reqText, invalid, errorMessage, required, id, ssr, onChange, small } = props, selectProps = __rest(props, ["className", "label", "assistText", "hideLabel", "disabled", "readOnly", "reqText", "invalid", "errorMessage", "required", "id", "ssr", "onChange", "small"]);
10
+ const _a = groupFormFieldWrapperProps(props), { onChange, fieldWrapperProps } = _a, selectProps = __rest(_a, ["onChange", "fieldWrapperProps"]);
12
11
  const { value, defaultValue, placeholder, options } = selectProps;
13
12
  const _selectRef = useRef(null);
14
13
  const selectRef = selectProps.selectRef || _selectRef;
@@ -32,7 +31,7 @@ export const Selectbox = (props) => {
32
31
  setIsEmpty(!((_a = selectElm.selectedOptions[0]) === null || _a === void 0 ? void 0 : _a.text));
33
32
  onChange && onChange(e);
34
33
  };
35
- return (React.createElement(FormField, { className: modifiedClass('Selectbox', null, className), ssr: ssr, small: small, label: label, empty: isEmpty, filled: isFilled, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps, addFocusProps) => (React.createElement(_Selectbox, Object.assign({ bem: className.input, ssr: ssr, onChange: _onChange }, inputProps, addFocusProps(selectProps), { selectRef: selectRef }))) }));
34
+ return (React.createElement(FormField, Object.assign({ extraClassName: "Selectbox", empty: isEmpty, filled: isFilled }, fieldWrapperProps, { renderInput: (className, inputProps, addFocusProps) => (React.createElement(_Selectbox, Object.assign({ bem: className.input, ssr: props.ssr, onChange: _onChange }, inputProps, addFocusProps(selectProps), { selectRef: selectRef }))) })));
36
35
  };
37
36
  // /** @deprecated Use named export instead (The default export will be removed in v0.11+) */
38
37
  // const SelectboxDefault = Selectbox;
@@ -1,8 +1,8 @@
1
1
  import { ShareButtonI18n, ShareButtonPlatforms } from '@reykjavik/hanna-utils/shareButtonsUtils';
2
- import { SSRSupportProps } from './utils.js';
2
+ import { SSRSupportProps, WrapperElmProps } from './utils.js';
3
3
  export type ShareButtonsProps = {
4
4
  texts?: Readonly<ShareButtonI18n>;
5
5
  lang?: string;
6
- } & SSRSupportProps & Partial<Record<ShareButtonPlatforms, boolean>>;
6
+ } & SSRSupportProps & WrapperElmProps<null, 'aria-label'> & Partial<Record<ShareButtonPlatforms, boolean>>;
7
7
  export declare const ShareButtons: (props: ShareButtonsProps) => JSX.Element | null;
8
8
  export default ShareButtons;
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
+ import { modifiedClass } from '@hugsmidjan/qj/classUtils';
2
3
  import { DEFAULT_LANG } from '@reykjavik/hanna-utils/i18n';
3
4
  import { getDocMeta, getShareButtonLabel, openInPopup, shareButtonTexts, shareButtonTypes, } from '@reykjavik/hanna-utils/shareButtonsUtils';
4
5
  import { Link } from './_abstract/_Link.js';
@@ -20,7 +21,7 @@ const ShareButtons__item = (props) => {
20
21
  React.createElement(Link, { className: 'ShareButtons__link ShareButtons__link--' + type, href: href, title: buttonText, rel: "noopener noreferrer", target: popup ? '_blank' : undefined, onClick: popup ? openInPopup : undefined }, buttonText)));
21
22
  };
22
23
  export const ShareButtons = (props) => {
23
- const { texts, lang, ssr, facebook = true, twitter = true, linkedin, email, } = props;
24
+ const { texts, lang, ssr, facebook = true, twitter = true, linkedin, email, wrapperProps, } = props;
24
25
  const [docMeta, setDocMeta] = useState();
25
26
  const href = docLoc.href; // assign to local variable to silence `react-hooks/exhaustive-deps`
26
27
  useEffect(() => {
@@ -39,9 +40,10 @@ export const ShareButtons = (props) => {
39
40
  (docMeta && (shareButtonTexts[docMeta.lang] || shareButtonTexts[DEFAULT_LANG])) ||
40
41
  {};
41
42
  const { label, buttonLabel, emailSubject } = txt;
43
+ const className = modifiedClass('ShareButtons', null, (wrapperProps || {}).className);
42
44
  if (!docMeta || ssr === 'ssr-only') {
43
45
  // Generate SSR markup for hanna-sprinkles to pick up on.
44
- return (React.createElement("div", { className: "ShareButtons", "data-button-types": generateTypeList(facebook, twitter, linkedin, email), "data-label": label, "data-buttonlabel": buttonLabel, "data-emailsubject": emailSubject || undefined }));
46
+ return (React.createElement("div", Object.assign({}, wrapperProps, { className: className, "data-button-types": generateTypeList(facebook, twitter, linkedin, email), "data-label": label, "data-buttonlabel": buttonLabel, "data-emailsubject": emailSubject || undefined })));
45
47
  }
46
48
  const showTypes = {
47
49
  facebook,
@@ -49,7 +51,7 @@ export const ShareButtons = (props) => {
49
51
  linkedin,
50
52
  email,
51
53
  };
52
- return (React.createElement("div", { className: "ShareButtons", "aria-label": label, "data-sprinkled": "true" },
54
+ return (React.createElement("div", Object.assign({}, wrapperProps, { className: className, "aria-label": label, "data-sprinkled": "true" }),
53
55
  label && React.createElement("strong", { className: "ShareButtons__label" }, label),
54
56
  React.createElement("ul", { className: "ShareButtons__list" }, shareButtonTypes.map((type) => showTypes[type] && (React.createElement(ShareButtons__item, { key: type, type: type, label: buttonLabel || '', href: docMeta.hrefs[type] }))))));
55
57
  };
package/esm/Sharpie.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { WrapperElmProps } from './utils.js';
2
3
  declare const colors: {
3
4
  green: number;
4
5
  red: number;
@@ -18,6 +19,6 @@ export type SharpieProps = {
18
19
  color: SharpieColor;
19
20
  tag?: SharpieTag;
20
21
  children: ReactNode;
21
- };
22
+ } & WrapperElmProps;
22
23
  export declare const Sharpie: (props: SharpieProps) => JSX.Element;
23
24
  export default Sharpie;
package/esm/Sharpie.js CHANGED
@@ -14,9 +14,9 @@ const tags = {
14
14
  s: 1,
15
15
  };
16
16
  export const Sharpie = (props) => {
17
- const { color, tag, children } = props;
17
+ const { color, tag, children, wrapperProps } = props;
18
18
  const colorModifier = colors[color] ? color : 'green';
19
19
  const Tag = tag && tags[tag] ? tag : 'span';
20
- return React.createElement(Tag, { className: modifiedClass('Sharpie', colorModifier) }, children);
20
+ return (React.createElement(Tag, Object.assign({}, wrapperProps, { className: modifiedClass('Sharpie', colorModifier, (wrapperProps || {}).className) }), children));
21
21
  };
22
22
  export default Sharpie;
@@ -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;
@@ -20,7 +20,7 @@ export const defaultSiteSearchACTexts = {
20
20
  },
21
21
  };
22
22
  export const SiteSearchAutocomplete = (props) => {
23
- const { suggestions, setSuggestions, renderSuggestion, getSuggestionValue, onSuggestionsFetchRequested, onSuggestionSelected, onSuggestionHighlighted, onSubmit, onButtonClick = onSubmit, bem = 'SiteSearchAutocomplete', } = props;
23
+ const { suggestions, setSuggestions, renderSuggestion, getSuggestionValue, onSuggestionsFetchRequested, onSuggestionSelected, onSuggestionHighlighted, onSubmit, onButtonClick = onSubmit, bem = 'SiteSearchAutocomplete', wrapperProps, } = props;
24
24
  const [value, setValue] = useState('');
25
25
  const inputRef = createRef();
26
26
  const txt = getTexts(props, defaultSiteSearchACTexts);
@@ -40,9 +40,9 @@ export const SiteSearchAutocomplete = (props) => {
40
40
  },
41
41
  }, renderInputComponent: (inputProps) => {
42
42
  /* prettier-ignore */
43
- const { className, type, disabled, readOnly, required, children } = inputProps, //eslint-disable-line @typescript-eslint/no-unused-vars
44
- siteSearchProps = __rest(inputProps, ["className", "type", "disabled", "readOnly", "required", "children"]);
45
- return (React.createElement(SiteSearchInput, Object.assign({}, siteSearchProps, { label: props.label || txt.inputLabel, placeholder: txt.placeholder, onSubmit: onSubmit && (() => onSubmit(value)), onButtonClick: onButtonClick && (() => onButtonClick(value)) })));
43
+ const { className, type, disabled, readOnly, required, children } = inputProps, siteSearchProps = __rest(inputProps, ["className", "type", "disabled", "readOnly", "required", "children"]);
44
+ return (React.createElement(SiteSearchInput, Object.assign({}, siteSearchProps, { wrapperProps: wrapperProps, label: props.label || // eslint-disable-line deprecation/deprecation
45
+ txt.inputLabel, placeholder: txt.placeholder, onSubmit: onSubmit && (() => onSubmit(value)), onButtonClick: onButtonClick && (() => onButtonClick(value)) })));
46
46
  } }));
47
47
  };
48
48
  export default SiteSearchAutocomplete;
@@ -2,6 +2,8 @@ import React, { useEffect } from 'react';
2
2
  import { modifiedClass } from '@hugsmidjan/qj/classUtils';
3
3
  import { useLaggedState } from '@hugsmidjan/react/hooks';
4
4
  import { isPreact } from './utils/env.js';
5
+ // NOTE: This component is too low-level (and too esoteric and rarely used)
6
+ // to justify `wrapperProps`
5
7
  export const SiteSearchCurtain = (props) => {
6
8
  const [focused, setFocused] = useLaggedState(false);
7
9
  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;
@@ -1,10 +1,10 @@
1
1
  import { __rest } from "tslib";
2
2
  import React, { useState } from 'react';
3
- import FormField from './FormField.js';
3
+ import FormField, { groupFormFieldWrapperProps, } from './FormField.js';
4
4
  // ---------------------------------------------------------------------------
5
5
  export const SiteSearchInput = React.forwardRef((props, ref) => {
6
6
  var _a;
7
- const { label, id, onChange, placeholder = typeof label === 'string' ? label : undefined, buttonText = 'Leita', onSubmit, onButtonClick = onSubmit, onKeyDown, ssr } = props, inputElementProps = __rest(props, ["label", "id", "onChange", "placeholder", "buttonText", "onSubmit", "onButtonClick", "onKeyDown", "ssr"]);
7
+ const _b = groupFormFieldWrapperProps(props), { onChange, buttonText = 'Leita', onSubmit, onButtonClick = props.onSubmit, onKeyDown, placeholder = typeof props.label === 'string' ? props.label : undefined, fieldWrapperProps } = _b, inputElementProps = __rest(_b, ["onChange", "buttonText", "onSubmit", "onButtonClick", "onKeyDown", "placeholder", "fieldWrapperProps"]);
8
8
  const { value, defaultValue } = inputElementProps;
9
9
  const [hasValue, setHasValue] = useState(undefined);
10
10
  const filled = !!((_a = value !== null && value !== void 0 ? value : hasValue) !== null && _a !== void 0 ? _a : !!defaultValue);
@@ -15,7 +15,7 @@ export const SiteSearchInput = React.forwardRef((props, ref) => {
15
15
  setHasValue(!!e.target.value);
16
16
  onChange && onChange(e);
17
17
  };
18
- return (React.createElement(FormField, { className: "SiteSearchInput", ssr: ssr, label: label, empty: empty, filled: filled, id: id, renderInput: (className, inputProps, addFocusProps) => (React.createElement("div", Object.assign({ className: className.input }, addFocusProps()),
18
+ return (React.createElement(FormField, Object.assign({ extraClassName: "SiteSearchInput", empty: empty, filled: filled }, fieldWrapperProps, { renderInput: (className, inputProps, addFocusProps) => (React.createElement("div", Object.assign({ className: className.input }, addFocusProps()),
19
19
  React.createElement("input", Object.assign({ className: "SiteSearchInput__input", onChange: _onChange }, inputProps, { placeholder: placeholder, onKeyDown: onSubmit
20
20
  ? (e) => {
21
21
  if (e.key === 'Enter' && onSubmit() !== true) {
@@ -25,6 +25,6 @@ export const SiteSearchInput = React.forwardRef((props, ref) => {
25
25
  }
26
26
  : onKeyDown }, inputElementProps, { ref: ref })),
27
27
  ' ',
28
- React.createElement("button", { className: "SiteSearchInput__button", type: "submit", onClick: onButtonClick && ((e) => !onButtonClick() && e.preventDefault()), title: buttonText }, buttonText))) }));
28
+ React.createElement("button", { className: "SiteSearchInput__button", type: "submit", onClick: onButtonClick && ((e) => !onButtonClick() && e.preventDefault()), title: buttonText }, buttonText))) })));
29
29
  });
30
30
  export default SiteSearchInput;
package/esm/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/esm/Skeleton.js CHANGED
@@ -1,27 +1,24 @@
1
1
  import React from 'react';
2
2
  import { modifiedClass } from '@hugsmidjan/qj/classUtils';
3
3
  import range from '@hugsmidjan/qj/range';
4
- const makeRenderSkeleton = (props) => (key) => (React.createElement("span", { key: key, className: modifiedClass('Skeleton', [
5
- props.text && 'text',
6
- props.height && 'height--' + props.height,
7
- props.gap && 'gap--' + props.gap,
8
- ]) }));
9
- const minmax = (num = 0, max = 100, min = 1) => {
10
- num = Math.min(Math.max(Math.round(num), min), max);
11
- return num > min ? num : undefined;
4
+ /** Rounds the input number, caps it at max. If it's below min, returns undefined */
5
+ const minmax = (num, max, min) => {
6
+ if (num == null || isNaN(num)) {
7
+ return;
8
+ }
9
+ num = Math.round(num);
10
+ return num > max ? max : num >= min ? num : undefined;
12
11
  };
13
12
  export const Skeleton = (props) => {
14
- const height = minmax(props.height, 40);
15
- const renderSkeleton = makeRenderSkeleton({
16
- height,
17
- text: props.text,
18
- gap: minmax(props.gap, 5, 0),
19
- });
20
- const items = minmax(props.items, 20) || 1;
21
- if (items > 1) {
22
- return React.createElement(React.Fragment, null, range(1, items).map(renderSkeleton));
13
+ const height = minmax(props.height, 20, 2);
14
+ const gap = minmax(props.gap, 5, 1);
15
+ const items = minmax(props.items, 20, 2) || 1;
16
+ const { wrapperProps } = props;
17
+ const className = modifiedClass('Skeleton', [props.text && 'text', height && 'height--' + height, gap && 'gap--' + gap], (wrapperProps || {}).className);
18
+ if (items) {
19
+ return (React.createElement(React.Fragment, null, range(1, items).map((key) => (React.createElement("span", { key: key, className: className })))));
23
20
  }
24
- return renderSkeleton();
21
+ return React.createElement("span", Object.assign({}, wrapperProps, { className: className }));
25
22
  };
26
23
  export default Skeleton;
27
24
  /** Returns a single `<Skeleton height={X}/>` element of branded type `SkeletonBlock` */
@@ -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/esm/SubHeading.js CHANGED
@@ -2,12 +2,12 @@ import React from 'react';
2
2
  import { modifiedClass } from '@hugsmidjan/qj/classUtils';
3
3
  import { useSeenEffect } from './utils/seenEffect.js';
4
4
  export const SubHeading = (props) => {
5
- const { small, Tag = 'h2', children, align, wide, startSeen } = props;
5
+ const { small, Tag = 'h2', children, align, wide, startSeen, wrapperProps } = props;
6
6
  const [ref] = useSeenEffect(startSeen);
7
- return (React.createElement(Tag, { className: modifiedClass('SubHeading', [
7
+ return (React.createElement(Tag, Object.assign({}, wrapperProps, { className: modifiedClass('SubHeading', [
8
8
  small && 'small',
9
9
  align === 'right' && 'align--' + align,
10
10
  !align && wide && 'wide',
11
- ]), ref: ref }, children));
11
+ ], (wrapperProps || {}).className), ref: ref }), children));
12
12
  };
13
13
  export default SubHeading;
package/esm/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/esm/Tabs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
- import { getFrag } from '@hugsmidjan/qj/frag';
3
2
  import { modifiedClass } from '@hugsmidjan/qj/classUtils';
3
+ import { getFrag } from '@hugsmidjan/qj/frag';
4
4
  import { useSeenEffect } from './utils/seenEffect.js';
5
5
  import { useIsBrowserSide } from './utils.js';
6
6
  const navKeyEffects = {
@@ -9,7 +9,6 @@ const navKeyEffects = {
9
9
  ArrowDown: 1,
10
10
  ArrowRight: 1,
11
11
  };
12
- // eslint-disable-next-line complexity
13
12
  const renderTab = (tabProps, index, listProps) => {
14
13
  const { label, badge, href, type, longLabel } = tabProps;
15
14
  const { activeIdx, activateTab, focusedIdx, setFocusedIdx, tabRole, listAriaControls, isBrowser, } = listProps;
@@ -46,7 +45,7 @@ const renderTab = (tabProps, index, listProps) => {
46
45
  // https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-2/tabs.html
47
46
  export const Tabs = (props) => {
48
47
  var _a, _b;
49
- const { tabs, role, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-controls': listAriaControls, id, activeIdx, onSetActive, activateOnFocus, ssr, startSeen, vertical, subTabs, } = props;
48
+ const { tabs, role, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-controls': listAriaControls, wrapperProps = {}, id = wrapperProps.id, activeIdx, onSetActive, activateOnFocus, ssr, startSeen, vertical, subTabs, } = props;
50
49
  const isBrowser = useIsBrowserSide(ssr);
51
50
  const [focusedIdx, setFocusedIdx] = useState(activeIdx || 0);
52
51
  const tabRole = isBrowser && role === 'tablist' ? 'tab' : undefined;
@@ -62,7 +61,7 @@ export const Tabs = (props) => {
62
61
  };
63
62
  const handleKeydown = tabRole &&
64
63
  ((e) => {
65
- var _a;
64
+ var _a, _b;
66
65
  const delta = navKeyEffects[e.key];
67
66
  if (delta) {
68
67
  // prevent scolling +
@@ -73,6 +72,7 @@ export const Tabs = (props) => {
73
72
  nextIdx = nextIdx < 0 ? maxIdx : nextIdx > maxIdx ? 0 : nextIdx;
74
73
  (_a = e.currentTarget.querySelectorAll('.Tabs__tab')[nextIdx]) === null || _a === void 0 ? void 0 : _a.focus();
75
74
  activateOnFocus && activateTab(nextIdx);
75
+ (_b = wrapperProps.onKeyDown) === null || _b === void 0 ? void 0 : _b.call(wrapperProps, e);
76
76
  }
77
77
  });
78
78
  const [ref] = useSeenEffect(startSeen);
@@ -85,7 +85,7 @@ export const Tabs = (props) => {
85
85
  listAriaControls,
86
86
  isBrowser,
87
87
  };
88
- return (React.createElement("div", { className: modifiedClass('Tabs', vertical && 'vertical'), role: tabRole && role, id: id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onKeyDown: handleKeydown, "data-sprinkled": isBrowser, ref: ref },
88
+ return (React.createElement("div", Object.assign({}, props.wrapperProps, { className: modifiedClass('Tabs', vertical && 'vertical', wrapperProps.className), role: tabRole && role, id: id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onKeyDown: handleKeydown, "data-sprinkled": isBrowser, ref: ref }),
89
89
  tabs.map((tabProps, index) => renderTab(tabProps, index, listProps)),
90
90
  subTabs && (React.createElement(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,
91
91
  // just to be sure
package/esm/TagPill.js CHANGED
@@ -9,6 +9,8 @@ const colors = {
9
9
  orange: 'color--orange',
10
10
  red: 'color--red',
11
11
  };
12
+ // NOTE: As a `_abstract/_Button.tsx`-derived component, all `<button/>` and
13
+ // `<a/>` props are allowed directly, so adding `wrapperProps` makes no sense.
12
14
  export const TagPill = (props) => {
13
15
  const { modifier, large, removable, onRemove, children, color = 'normal', label = children, removeLabel = 'x', removeLabelLong = removeLabel } = props, buttonProps = __rest(props, ["modifier", "large", "removable", "onRemove", "children", "color", "label", "removeLabel", "removeLabelLong"]);
14
16
  const isStatic = !('href' in props || 'type' in props || props.onClick);
@@ -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/esm/TextBlock.js CHANGED
@@ -2,14 +2,14 @@ import React from 'react';
2
2
  import { modifiedClass } from '@hugsmidjan/qj/classUtils';
3
3
  import { useSeenEffect } from './utils/seenEffect.js';
4
4
  export const TextBlock = (props) => {
5
- const { children, align, labelled, wide, small, startSeen } = props;
5
+ const { children, align, labelled, wide, small, startSeen, wrapperProps } = props;
6
6
  const rightAligned = align === 'right' || labelled;
7
7
  const [ref] = useSeenEffect(startSeen);
8
- return (React.createElement("div", { className: modifiedClass('TextBlock', [
8
+ return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('TextBlock', [
9
9
  labelled && 'labelled',
10
10
  rightAligned && 'align--right',
11
11
  wide && !rightAligned && 'wide',
12
12
  small && !labelled && 'small',
13
- ]), ref: ref }, children));
13
+ ], (wrapperProps || {}).className), ref: ref }), children));
14
14
  };
15
15
  export default TextBlock;
package/esm/TextButton.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Button } from './_abstract/_Button.js';
3
+ // NOTE: As a `_abstract/_Button.tsx`-derived component, all `<button/>` and
4
+ // `<a/>` props are allowed directly, so adding `wrapperProps` makes no sense.
3
5
  export const TextButton = (props) => {
4
6
  if ('disabled' in props) {
5
7
  props = Object.assign(Object.assign({}, props), { disabled: undefined });
@@ -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) | ({