@reykjavik/hanna-react 0.10.99 → 0.10.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (344) hide show
  1. package/AccordionList.d.ts +2 -2
  2. package/AccordionList.js +2 -2
  3. package/ActionCards.d.ts +2 -1
  4. package/ActionCards.js +1 -1
  5. package/Alert.d.ts +2 -2
  6. package/Alert.js +20 -12
  7. package/ArticleCards.d.ts +4 -1
  8. package/ArticleCards.js +1 -1
  9. package/ArticleCarousel/_ArticleCarouselCard.js +1 -2
  10. package/ArticleCarousel.d.ts +2 -2
  11. package/ArticleCarousel.js +1 -1
  12. package/ArticleMeta.d.ts +2 -1
  13. package/ArticleMeta.js +2 -2
  14. package/Attention.d.ts +2 -1
  15. package/Attention.js +4 -1
  16. package/BasicTable.d.ts +2 -1
  17. package/BgBox.d.ts +2 -1
  18. package/BgBox.js +4 -2
  19. package/Bling.d.ts +2 -1
  20. package/Bling.js +5 -3
  21. package/BlockBreak.js +1 -0
  22. package/BreadCrumbs.d.ts +2 -1
  23. package/BreadCrumbs.js +3 -2
  24. package/ButtonBack.js +2 -0
  25. package/ButtonBar.d.ts +4 -3
  26. package/ButtonBar.js +3 -3
  27. package/ButtonPrimary.js +2 -0
  28. package/ButtonSecondary.js +2 -0
  29. package/ButtonTertiary.js +2 -0
  30. package/CHANGELOG.md +14 -1
  31. package/CarouselStepper.d.ts +2 -1
  32. package/CenterColumn.d.ts +2 -1
  33. package/CenterColumn.js +4 -2
  34. package/CheckboxButton.d.ts +4 -2
  35. package/CheckboxButtonsGroup.js +2 -2
  36. package/CityBlock.d.ts +2 -1
  37. package/CityBlock.js +1 -1
  38. package/ContactBubble.d.ts +2 -2
  39. package/ContactBubble.js +5 -4
  40. package/ContentArticle.d.ts +2 -1
  41. package/ContentArticle.js +3 -2
  42. package/ContentImage.d.ts +2 -1
  43. package/ContentImage.js +4 -3
  44. package/Datepicker.js +6 -6
  45. package/ExtraLinks.d.ts +2 -1
  46. package/ExtraLinks.js +4 -2
  47. package/FeatureList.d.ts +2 -1
  48. package/FeatureList.js +3 -2
  49. package/FieldGroup.d.ts +2 -1
  50. package/FieldGroup.js +4 -2
  51. package/FileInput.d.ts +2 -2
  52. package/FileInput.js +10 -5
  53. package/Foonote.js +3 -4
  54. package/Footnote.d.ts +2 -1
  55. package/Footnote.js +2 -1
  56. package/Form.js +4 -5
  57. package/FormField.d.ts +25 -5
  58. package/FormField.js +32 -7
  59. package/Gallery/_GalleryItem.js +2 -2
  60. package/Gallery/_GalleryModalItem.js +1 -1
  61. package/Gallery.d.ts +2 -2
  62. package/Gallery.js +5 -4
  63. package/GridBlocks.d.ts +2 -5
  64. package/GridBlocks.js +3 -3
  65. package/Heading.d.ts +2 -1
  66. package/Heading.js +3 -3
  67. package/HeroBlock.d.ts +2 -1
  68. package/HeroBlock.js +4 -3
  69. package/IframeBlock.d.ts +9 -4
  70. package/IframeBlock.js +13 -12
  71. package/Illustration.d.ts +2 -1
  72. package/Illustration.js +1 -1
  73. package/ImageCards.d.ts +2 -1
  74. package/ImageCards.js +2 -2
  75. package/InfoBlock.d.ts +2 -1
  76. package/InfoBlock.js +3 -2
  77. package/InfoHero.d.ts +2 -1
  78. package/InfoHero.js +3 -3
  79. package/IslandBlock.d.ts +2 -1
  80. package/IslandBlock.js +2 -2
  81. package/IslandPageBlock.d.ts +2 -1
  82. package/IslandPageBlock.js +2 -2
  83. package/LabeledTextBlock.d.ts +2 -1
  84. package/LabeledTextBlock.js +2 -2
  85. package/Layout.d.ts +2 -2
  86. package/Layout.js +3 -3
  87. package/MainMenu.d.ts +2 -2
  88. package/MainMenu.js +4 -3
  89. package/MiniMetrics.d.ts +2 -1
  90. package/MiniMetrics.js +3 -2
  91. package/Modal.d.ts +2 -1
  92. package/Multiselect.d.ts +11 -6
  93. package/Multiselect.js +15 -11
  94. package/NameCard.d.ts +2 -1
  95. package/NameCard.js +10 -6
  96. package/NameCards.d.ts +3 -2
  97. package/NameCards.js +3 -2
  98. package/NewsHero.d.ts +2 -1
  99. package/NewsHero.js +3 -3
  100. package/PageFilter.d.ts +2 -1
  101. package/PageFilter.js +2 -2
  102. package/PageHeading.d.ts +2 -1
  103. package/PageHeading.js +2 -5
  104. package/Picture.d.ts +2 -1
  105. package/Picture.js +1 -5
  106. package/ProcessOverview.d.ts +2 -1
  107. package/ProcessOverview.js +2 -5
  108. package/RadioButtonsGroup.js +2 -2
  109. package/RadioGroup.js +1 -1
  110. package/ReadSpeakerPlayer.d.ts +1 -1
  111. package/ReadSpeakerPlayer.js +2 -2
  112. package/RelatedLinks.d.ts +2 -1
  113. package/RelatedLinks.js +3 -2
  114. package/RowBlock.d.ts +2 -1
  115. package/RowBlock.js +2 -2
  116. package/RowBlockColumn.d.ts +2 -1
  117. package/RowBlockColumn.js +3 -3
  118. package/SearchInput.d.ts +3 -9
  119. package/SearchInput.js +4 -5
  120. package/SearchResults/_SearchResultsItem.js +1 -1
  121. package/SearchResults.d.ts +2 -1
  122. package/SearchResults.js +2 -2
  123. package/SeenEffect.js +2 -0
  124. package/Selectbox.js +3 -4
  125. package/ShareButtons.d.ts +2 -2
  126. package/ShareButtons.js +5 -3
  127. package/Sharpie.d.ts +2 -1
  128. package/Sharpie.js +2 -2
  129. package/SiteSearchAutocomplete.d.ts +2 -1
  130. package/SiteSearchAutocomplete.js +4 -4
  131. package/SiteSearchCurtain.js +2 -0
  132. package/SiteSearchInput.d.ts +3 -6
  133. package/SiteSearchInput.js +4 -4
  134. package/Skeleton.d.ts +4 -1
  135. package/Skeleton.js +15 -18
  136. package/SubHeading.d.ts +2 -1
  137. package/SubHeading.js +3 -3
  138. package/Tabs.d.ts +2 -2
  139. package/Tabs.js +5 -5
  140. package/TagPill.js +2 -0
  141. package/TextBlock.d.ts +2 -1
  142. package/TextBlock.js +3 -3
  143. package/TextButton.js +2 -0
  144. package/TextInput.d.ts +2 -2
  145. package/TextInput.js +3 -4
  146. package/Tooltip.d.ts +2 -1
  147. package/Tooltip.js +28 -15
  148. package/VSpacer.d.ts +2 -1
  149. package/VSpacer.js +3 -7
  150. package/VerticalTabsTOC.d.ts +1 -1
  151. package/VerticalTabsTOC.js +1 -1
  152. package/WizardLayout.d.ts +2 -2
  153. package/WizardLayout.js +4 -3
  154. package/WizardLayoutClose.js +2 -0
  155. package/WizardStepper.d.ts +2 -1
  156. package/WizardStepper.js +2 -2
  157. package/_abstract/_AbstractCarousel.d.ts +2 -2
  158. package/_abstract/_AbstractCarousel.js +6 -3
  159. package/_abstract/_Block.d.ts +2 -1
  160. package/_abstract/_Block.js +3 -3
  161. package/_abstract/_Button.js +4 -1
  162. package/_abstract/_CardList.d.ts +3 -1
  163. package/_abstract/_CardList.js +6 -3
  164. package/_abstract/_Image.d.ts +6 -3
  165. package/_abstract/_Image.js +11 -4
  166. package/_abstract/_Quote.d.ts +2 -1
  167. package/_abstract/_Quote.js +3 -2
  168. package/_abstract/_TogglerGroup.js +1 -1
  169. package/_abstract/_TogglerGroupField.js +5 -5
  170. package/_abstract/_TogglerInput.d.ts +2 -2
  171. package/_abstract/_TogglerInput.js +4 -2
  172. package/esm/AccordionList.d.ts +2 -2
  173. package/esm/AccordionList.js +3 -3
  174. package/esm/ActionCards.d.ts +2 -1
  175. package/esm/ActionCards.js +1 -1
  176. package/esm/Alert.d.ts +2 -2
  177. package/esm/Alert.js +21 -13
  178. package/esm/ArticleCards.d.ts +4 -1
  179. package/esm/ArticleCards.js +1 -1
  180. package/esm/ArticleCarousel/_ArticleCarouselCard.js +1 -2
  181. package/esm/ArticleCarousel.d.ts +2 -2
  182. package/esm/ArticleCarousel.js +1 -1
  183. package/esm/ArticleMeta.d.ts +2 -1
  184. package/esm/ArticleMeta.js +2 -2
  185. package/esm/Attention.d.ts +2 -1
  186. package/esm/Attention.js +4 -1
  187. package/esm/BasicTable.d.ts +2 -1
  188. package/esm/BgBox.d.ts +2 -1
  189. package/esm/BgBox.js +4 -2
  190. package/esm/Bling.d.ts +2 -1
  191. package/esm/Bling.js +5 -3
  192. package/esm/BlockBreak.js +1 -0
  193. package/esm/BreadCrumbs.d.ts +2 -1
  194. package/esm/BreadCrumbs.js +3 -2
  195. package/esm/ButtonBack.js +2 -0
  196. package/esm/ButtonBar.d.ts +4 -3
  197. package/esm/ButtonBar.js +3 -3
  198. package/esm/ButtonPrimary.js +2 -0
  199. package/esm/ButtonSecondary.js +2 -0
  200. package/esm/ButtonTertiary.js +2 -0
  201. package/esm/CarouselStepper.d.ts +2 -1
  202. package/esm/CenterColumn.d.ts +2 -1
  203. package/esm/CenterColumn.js +4 -2
  204. package/esm/CheckboxButton.d.ts +4 -2
  205. package/esm/CheckboxButtonsGroup.js +2 -2
  206. package/esm/CityBlock.d.ts +2 -1
  207. package/esm/CityBlock.js +1 -1
  208. package/esm/ContactBubble.d.ts +2 -2
  209. package/esm/ContactBubble.js +5 -4
  210. package/esm/ContentArticle.d.ts +2 -1
  211. package/esm/ContentArticle.js +3 -2
  212. package/esm/ContentImage.d.ts +2 -1
  213. package/esm/ContentImage.js +4 -3
  214. package/esm/Datepicker.js +7 -7
  215. package/esm/ExtraLinks.d.ts +2 -1
  216. package/esm/ExtraLinks.js +4 -2
  217. package/esm/FeatureList.d.ts +2 -1
  218. package/esm/FeatureList.js +3 -2
  219. package/esm/FieldGroup.d.ts +2 -1
  220. package/esm/FieldGroup.js +4 -2
  221. package/esm/FileInput.d.ts +2 -2
  222. package/esm/FileInput.js +10 -5
  223. package/esm/Foonote.js +2 -2
  224. package/esm/Footnote.d.ts +2 -1
  225. package/esm/Footnote.js +2 -1
  226. package/esm/Form.js +5 -5
  227. package/esm/FormField.d.ts +25 -5
  228. package/esm/FormField.js +30 -6
  229. package/esm/Gallery/_GalleryItem.js +2 -2
  230. package/esm/Gallery/_GalleryModalItem.js +1 -1
  231. package/esm/Gallery.d.ts +2 -2
  232. package/esm/Gallery.js +6 -5
  233. package/esm/GridBlocks.d.ts +2 -5
  234. package/esm/GridBlocks.js +3 -3
  235. package/esm/Heading.d.ts +2 -1
  236. package/esm/Heading.js +3 -3
  237. package/esm/HeroBlock.d.ts +2 -1
  238. package/esm/HeroBlock.js +4 -3
  239. package/esm/IframeBlock.d.ts +9 -4
  240. package/esm/IframeBlock.js +13 -12
  241. package/esm/Illustration.d.ts +2 -1
  242. package/esm/Illustration.js +1 -1
  243. package/esm/ImageCards.d.ts +2 -1
  244. package/esm/ImageCards.js +2 -2
  245. package/esm/InfoBlock.d.ts +2 -1
  246. package/esm/InfoBlock.js +3 -2
  247. package/esm/InfoHero.d.ts +2 -1
  248. package/esm/InfoHero.js +3 -3
  249. package/esm/IslandBlock.d.ts +2 -1
  250. package/esm/IslandBlock.js +2 -2
  251. package/esm/IslandPageBlock.d.ts +2 -1
  252. package/esm/IslandPageBlock.js +2 -2
  253. package/esm/LabeledTextBlock.d.ts +2 -1
  254. package/esm/LabeledTextBlock.js +2 -2
  255. package/esm/Layout.d.ts +2 -2
  256. package/esm/Layout.js +3 -3
  257. package/esm/MainMenu.d.ts +2 -2
  258. package/esm/MainMenu.js +4 -3
  259. package/esm/MiniMetrics.d.ts +2 -1
  260. package/esm/MiniMetrics.js +3 -2
  261. package/esm/Modal.d.ts +2 -1
  262. package/esm/Multiselect.d.ts +11 -6
  263. package/esm/Multiselect.js +15 -11
  264. package/esm/NameCard.d.ts +2 -1
  265. package/esm/NameCard.js +10 -6
  266. package/esm/NameCards.d.ts +3 -2
  267. package/esm/NameCards.js +3 -2
  268. package/esm/NewsHero.d.ts +2 -1
  269. package/esm/NewsHero.js +3 -3
  270. package/esm/PageFilter.d.ts +2 -1
  271. package/esm/PageFilter.js +2 -2
  272. package/esm/PageHeading.d.ts +2 -1
  273. package/esm/PageHeading.js +2 -5
  274. package/esm/Picture.d.ts +2 -1
  275. package/esm/Picture.js +1 -5
  276. package/esm/ProcessOverview.d.ts +2 -1
  277. package/esm/ProcessOverview.js +2 -5
  278. package/esm/RadioButtonsGroup.js +2 -2
  279. package/esm/RadioGroup.js +1 -1
  280. package/esm/ReadSpeakerPlayer.d.ts +1 -1
  281. package/esm/ReadSpeakerPlayer.js +2 -2
  282. package/esm/RelatedLinks.d.ts +2 -1
  283. package/esm/RelatedLinks.js +3 -2
  284. package/esm/RowBlock.d.ts +2 -1
  285. package/esm/RowBlock.js +2 -2
  286. package/esm/RowBlockColumn.d.ts +2 -1
  287. package/esm/RowBlockColumn.js +3 -3
  288. package/esm/SearchInput.d.ts +3 -9
  289. package/esm/SearchInput.js +4 -5
  290. package/esm/SearchResults/_SearchResultsItem.js +1 -1
  291. package/esm/SearchResults.d.ts +2 -1
  292. package/esm/SearchResults.js +2 -2
  293. package/esm/SeenEffect.js +2 -0
  294. package/esm/Selectbox.js +3 -4
  295. package/esm/ShareButtons.d.ts +2 -2
  296. package/esm/ShareButtons.js +5 -3
  297. package/esm/Sharpie.d.ts +2 -1
  298. package/esm/Sharpie.js +2 -2
  299. package/esm/SiteSearchAutocomplete.d.ts +2 -1
  300. package/esm/SiteSearchAutocomplete.js +4 -4
  301. package/esm/SiteSearchCurtain.js +2 -0
  302. package/esm/SiteSearchInput.d.ts +3 -6
  303. package/esm/SiteSearchInput.js +4 -4
  304. package/esm/Skeleton.d.ts +4 -1
  305. package/esm/Skeleton.js +15 -18
  306. package/esm/SubHeading.d.ts +2 -1
  307. package/esm/SubHeading.js +3 -3
  308. package/esm/Tabs.d.ts +2 -2
  309. package/esm/Tabs.js +5 -5
  310. package/esm/TagPill.js +2 -0
  311. package/esm/TextBlock.d.ts +2 -1
  312. package/esm/TextBlock.js +3 -3
  313. package/esm/TextButton.js +2 -0
  314. package/esm/TextInput.d.ts +2 -2
  315. package/esm/TextInput.js +3 -4
  316. package/esm/Tooltip.d.ts +2 -1
  317. package/esm/Tooltip.js +28 -15
  318. package/esm/VSpacer.d.ts +2 -1
  319. package/esm/VSpacer.js +3 -7
  320. package/esm/VerticalTabsTOC.d.ts +1 -1
  321. package/esm/VerticalTabsTOC.js +1 -1
  322. package/esm/WizardLayout.d.ts +2 -2
  323. package/esm/WizardLayout.js +4 -3
  324. package/esm/WizardLayoutClose.js +2 -0
  325. package/esm/WizardStepper.d.ts +2 -1
  326. package/esm/WizardStepper.js +2 -2
  327. package/esm/_abstract/_AbstractCarousel.d.ts +2 -2
  328. package/esm/_abstract/_AbstractCarousel.js +6 -3
  329. package/esm/_abstract/_Block.d.ts +2 -1
  330. package/esm/_abstract/_Block.js +3 -3
  331. package/esm/_abstract/_Button.js +4 -1
  332. package/esm/_abstract/_CardList.d.ts +3 -1
  333. package/esm/_abstract/_CardList.js +6 -3
  334. package/esm/_abstract/_Image.d.ts +6 -3
  335. package/esm/_abstract/_Image.js +12 -5
  336. package/esm/_abstract/_Quote.d.ts +2 -1
  337. package/esm/_abstract/_Quote.js +3 -2
  338. package/esm/_abstract/_TogglerGroup.js +1 -1
  339. package/esm/_abstract/_TogglerGroupField.js +5 -5
  340. package/esm/_abstract/_TogglerInput.d.ts +2 -2
  341. package/esm/_abstract/_TogglerInput.js +4 -2
  342. package/esm/utils.d.ts +25 -2
  343. package/package.json +1 -1
  344. package/utils.d.ts +25 -2
package/ContactBubble.js CHANGED
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ContactBubble = exports.ensureIcon = exports.defaultTexts = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
+ const classUtils_1 = require("@hugsmidjan/qj/classUtils");
6
7
  const focusElm_1 = require("@hugsmidjan/qj/focusElm");
7
8
  const hooks_1 = require("@hugsmidjan/react/hooks");
8
- const classUtils_1 = require("@hugsmidjan/qj/classUtils");
9
9
  const i18n_1 = require("@reykjavik/hanna-utils/i18n");
10
10
  const _Link_js_1 = require("./_abstract/_Link.js");
11
11
  const breakOnNL_js_1 = require("./_abstract/breakOnNL.js");
@@ -37,14 +37,15 @@ const ensureIcon = (maybeIcon) => maybeIcon && icons[maybeIcon]
37
37
  : undefined;
38
38
  exports.ensureIcon = ensureIcon;
39
39
  const ContactBubble = (props) => {
40
- const { title, links, onToggle, alwaysShow } = props;
40
+ const { title, links, onToggle, alwaysShow, wrapperProps = {} } = props;
41
41
  const txt = (0, i18n_1.getTexts)(props, exports.defaultTexts);
42
42
  const useLocalState = props.open == null;
43
43
  const [localOpen, setLocalOpen] = (0, react_1.useState)(false);
44
44
  const open = useLocalState ? localOpen : props.open;
45
45
  const isBrowser = (0, utils_js_1.useIsBrowserSide)(props.ssr);
46
46
  const domid = (0, hooks_1.useDomid)();
47
- const wrapperRef = (0, react_1.useRef)(null);
47
+ const _wrapperRef = (0, react_1.useRef)(null);
48
+ const wrapperRef = wrapperProps.ref || _wrapperRef;
48
49
  const { openBubble, closeBubble } = (0, react_1.useMemo)(() => ({
49
50
  openBubble: () => {
50
51
  useLocalState && setLocalOpen(true);
@@ -121,7 +122,7 @@ const ContactBubble = (props) => {
121
122
  if (links.length === 0) {
122
123
  return null;
123
124
  }
124
- const menu = (react_1.default.createElement("div", { className: "ContactBubble", id: isBrowser && domid, hidden: isBrowser && !open, "data-always-show": alwaysShow || undefined, "data-sprinkled": isBrowser },
125
+ const menu = (react_1.default.createElement("div", Object.assign({}, props.wrapperProps, { className: (0, classUtils_1.modifiedClass)('ContactBubble', null, wrapperProps.className), id: isBrowser && domid, hidden: isBrowser && !open, "data-always-show": alwaysShow || undefined, "data-sprinkled": isBrowser }),
125
126
  react_1.default.createElement("h2", { className: "ContactBubble__title" }, title || txt.openBtn),
126
127
  react_1.default.createElement("ul", { className: "ContactBubble__list" }, links.map((linkInfo, i) => {
127
128
  const { href, label, extraLabel, target, onClick } = linkInfo;
@@ -3,6 +3,7 @@ import { SeenProp } from './utils/seenEffect.js';
3
3
  import { ArticleMetaProps } from './ArticleMeta.js';
4
4
  import { ContentImageProps } from './ContentImage.js';
5
5
  import { RelatedLinksProps } from './RelatedLinks.js';
6
+ import { WrapperElmProps } from './utils.js';
6
7
  export type ContentArticleProps = {
7
8
  /** Date, author, etc. */
8
9
  meta?: ArticleMetaProps['items'];
@@ -11,6 +12,6 @@ export type ContentArticleProps = {
11
12
  topImage?: ContentImageProps;
12
13
  body: ReactNode;
13
14
  relatedLinks?: RelatedLinksProps;
14
- } & SeenProp;
15
+ } & SeenProp & WrapperElmProps;
15
16
  export declare const ContentArticle: (props: ContentArticleProps) => JSX.Element;
16
17
  export default ContentArticle;
package/ContentArticle.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ContentArticle = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
+ const classUtils_1 = require("@hugsmidjan/qj/classUtils");
6
7
  const seenEffect_js_1 = require("./utils/seenEffect.js");
7
8
  const ArticleMeta_js_1 = tslib_1.__importDefault(require("./ArticleMeta.js"));
8
9
  const ContentImage_js_1 = tslib_1.__importDefault(require("./ContentImage.js"));
@@ -11,10 +12,10 @@ const RelatedLinks_js_1 = tslib_1.__importDefault(require("./RelatedLinks.js"));
11
12
  const TextBlock_js_1 = tslib_1.__importDefault(require("./TextBlock.js"));
12
13
  const VSpacer_js_1 = tslib_1.__importDefault(require("./VSpacer.js"));
13
14
  const ContentArticle = (props) => {
14
- const { relatedLinks } = props;
15
+ const { relatedLinks, wrapperProps } = props;
15
16
  const [ref] = (0, seenEffect_js_1.useSeenEffect)(props.startSeen);
16
17
  const headingElm = (react_1.default.createElement(Heading_js_1.default, { forceH1: props.headlineTag === 'h1' }, props.headline));
17
- return (react_1.default.createElement("div", { className: "ContentArticle", ref: ref },
18
+ return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('ContentArticle', null, (wrapperProps || {}).className), ref: ref }),
18
19
  props.meta ? (react_1.default.createElement("div", { className: "ContentArticle__header" },
19
20
  headingElm,
20
21
  react_1.default.createElement(ArticleMeta_js_1.default, { items: props.meta }))) : (headingElm),
package/ContentImage.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { ImageProps } from './_abstract/_Image.js';
2
+ import { WrapperElmProps } from './utils.js';
2
3
  export type ContentImageProps = {
3
4
  image?: ImageProps;
4
5
  caption?: string | JSX.Element;
5
6
  credit?: string | JSX.Element;
6
- };
7
+ } & WrapperElmProps;
7
8
  export declare const ContentImage: (props: ContentImageProps) => JSX.Element;
8
9
  export default ContentImage;
package/ContentImage.js CHANGED
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ContentImage = 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 _Image_js_1 = require("./_abstract/_Image.js");
7
8
  const ContentImage = (props) => {
8
- const { image, caption, credit } = props;
9
- return (react_1.default.createElement("figure", { className: "ContentImage" },
9
+ const { image, caption, credit, wrapperProps } = props;
10
+ return (react_1.default.createElement("figure", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('ContentImage', null, (wrapperProps || {}).className) }),
10
11
  (caption || credit) && (react_1.default.createElement("figcaption", { className: "ContentImage__caption" },
11
12
  caption && react_1.default.createElement("span", { className: "ContentImage__text" },
12
13
  " ",
@@ -17,7 +18,7 @@ const ContentImage = (props) => {
17
18
  " ",
18
19
  credit,
19
20
  " "))),
20
- react_1.default.createElement(_Image_js_1.Image, Object.assign({ className: "ContentImage__image" }, image))));
21
+ react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "ContentImage__image" }, image))));
21
22
  };
22
23
  exports.ContentImage = ContentImage;
23
24
  exports.default = exports.ContentImage;
package/Datepicker.js CHANGED
@@ -4,7 +4,6 @@ exports.Datepicker = exports.getDateDiff = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const hooks_1 = require("@hugsmidjan/react/hooks");
7
- const classUtils_1 = require("@hugsmidjan/qj/classUtils");
8
7
  // For more info on localization see: https://stackoverflow.com/questions/54399084/change-locale-in-react-datepicker/58306958#58306958
9
8
  const index_js_1 = tslib_1.__importDefault(require("date-fns/locale/is/index.js"));
10
9
  const index_js_2 = tslib_1.__importDefault(require("date-fns/locale/pl/index.js"));
@@ -63,18 +62,19 @@ const i18n = {
63
62
  * Internally, this component uses the [`react-datepicker`](https://reactdatepicker.com/) component.
64
63
  */
65
64
  const Datepicker = (props) => {
66
- const { className, id, label, hideLabel, assistText, disabled, readOnly, invalid, errorMessage, required, reqText, placeholder, small, localeCode = 'is', dateFormat = 'd.M.yyyy', name, startDate, endDate, minDate, maxDate, isStartDate = false, isEndDate = false, onChange, datepickerExtraProps, ssr, inputRef, isoMode, } = props;
67
- const [value, setValue] = utils_js_1.useMixedControlState.raw(props.value || props.initialDate, props.defaultValue, 'value');
65
+ const { placeholder, localeCode = 'is', dateFormat = 'd.M.yyyy', name, startDate, endDate, minDate, maxDate, isStartDate = false, isEndDate = false, onChange, datepickerExtraProps, inputRef, isoMode, fieldWrapperProps, } = (0, FormField_js_1.groupFormFieldWrapperProps)(props);
66
+ const [value, setValue] = utils_js_1.useMixedControlState.raw(props.value || props.initialDate, // eslint-disable-line deprecation/deprecation
67
+ props.defaultValue, 'value');
68
68
  /*
69
69
  TODO: Revert to this simpler pattern once we hit v0.11
70
70
  and `props.initialDate` is removed:
71
71
  */
72
72
  // const [value, setValue] = useMixedControlState(props, 'value');
73
- const domid = (0, hooks_1.useDomid)(id);
73
+ const domid = (0, hooks_1.useDomid)(props.id);
74
74
  const txts = i18n[localeCode] || {};
75
75
  const filled = !!value;
76
76
  const empty = !filled && !placeholder;
77
- return (react_1.default.createElement(FormField_js_1.FormField, { className: (0, classUtils_1.modifiedClass)('Datepicker', [], className), ssr: ssr, label: label, small: small, assistText: assistText, hideLabel: hideLabel, invalid: invalid, required: required, reqText: reqText, disabled: disabled, readOnly: readOnly, filled: filled, empty: empty, errorMessage: errorMessage, renderInput: (className, inputProps, addFocusProps) => {
77
+ return (react_1.default.createElement(FormField_js_1.FormField, Object.assign({ extraClassName: "Datepicker", filled: filled, empty: empty }, fieldWrapperProps, { renderInput: (className, inputProps, addFocusProps) => {
78
78
  return (react_1.default.createElement("div", Object.assign({ className: className.input, onClick: ({ target, currentTarget }) => { var _a; return target === currentTarget && ((_a = currentTarget.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus()); }, ref: inputRef &&
79
79
  ((elm) => {
80
80
  inputRef.current =
@@ -104,7 +104,7 @@ const Datepicker = (props) => {
104
104
  // TODO: Implement this
105
105
  // selectsRange
106
106
  minDate: minDate, maxDate: maxDate, startDate: startDate, endDate: endDate, selectsStart: isStartDate, selectsEnd: isEndDate, formatWeekDay: (weekday) => weekday.charAt(0).toUpperCase(), showYearDropdown: true, scrollableYearDropdown: true, yearDropdownItemNumber: 15, showMonthDropdown: true }, inputProps, txts, datepickerExtraProps))));
107
- } }));
107
+ } })));
108
108
  };
109
109
  exports.Datepicker = Datepicker;
110
110
  exports.default = exports.Datepicker;
package/ExtraLinks.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { CardListProps, TextCardProps } from './_abstract/_CardList.js';
2
2
  import { SeenProp } from './utils/seenEffect.js';
3
+ import { WrapperElmProps } from './utils.js';
3
4
  export type RelatedLink = {
4
5
  href: string;
5
6
  label: string;
@@ -13,6 +14,6 @@ type RelatedProps = {
13
14
  export type ExtraLinksCardProps = Omit<TextCardProps, 'meta'>;
14
15
  export type ExtraLinksProps = CardListProps<ExtraLinksCardProps> & RelatedProps & {
15
16
  className?: string;
16
- } & SeenProp;
17
+ } & WrapperElmProps & SeenProp;
17
18
  export declare const ExtraLinks: (props: ExtraLinksProps) => JSX.Element;
18
19
  export default ExtraLinks;
package/ExtraLinks.js CHANGED
@@ -16,10 +16,12 @@ const ExtraLinks__related = (props) => {
16
16
  react_1.default.createElement(_Link_js_1.Link, { className: (0, classUtils_1.modifiedClass)('ExtraLinks__related__link', type), href: href, target: blank ? '_blank' : '', rel: blank ? 'noreferrer noopener' : '' }, label)))))));
17
17
  };
18
18
  const ExtraLinks = (props) => {
19
- const { relatedTitle, relatedLinks, className, startSeen } = props, cardListProps = tslib_1.__rest(props, ["relatedTitle", "relatedLinks", "className", "startSeen"]);
19
+ const { relatedTitle, relatedLinks, className, startSeen, wrapperProps } = props, cardListProps = tslib_1.__rest(props, ["relatedTitle", "relatedLinks", "className", "startSeen", "wrapperProps"]);
20
20
  const hasRelated = !!(relatedLinks && relatedLinks.length);
21
21
  const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
22
- return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('ExtraLinks', hasRelated && 'related', className), ref: ref },
22
+ return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('ExtraLinks', hasRelated && 'related',
23
+ // Prefer `className` over `wrapperProps.className`
24
+ className || (wrapperProps || {}).className), ref: ref }),
23
25
  react_1.default.createElement("div", { className: "ExtraLinks__main" },
24
26
  react_1.default.createElement(_CardList_js_1.CardList, Object.assign({}, cardListProps, { bemPrefix: "ExtraLinks" }))),
25
27
  hasRelated && (react_1.default.createElement(ExtraLinks__related, { relatedTitle: relatedTitle, relatedLinks: relatedLinks }))));
package/FeatureList.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Efnistakn } from '@reykjavik/hanna-utils/assets';
2
2
  import { SeenProp } from './utils/seenEffect.js';
3
+ import { WrapperElmProps } from './utils.js';
3
4
  export type FeatureListProps = {
4
5
  title: string;
5
6
  features: Array<{
@@ -7,6 +8,6 @@ export type FeatureListProps = {
7
8
  iconUrl?: string;
8
9
  name: string;
9
10
  }>;
10
- } & SeenProp;
11
+ } & WrapperElmProps & SeenProp;
11
12
  export declare const FeatureList: (props: FeatureListProps) => JSX.Element;
12
13
  export default FeatureList;
package/FeatureList.js CHANGED
@@ -3,15 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FeatureList = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
+ const classUtils_1 = require("@hugsmidjan/qj/classUtils");
6
7
  const seenEffect_js_1 = require("./utils/seenEffect.js");
7
8
  const Bling_js_1 = tslib_1.__importDefault(require("./Bling.js"));
8
9
  const FeatureList = (props) => {
9
- const { title, features, startSeen } = props;
10
+ const { title, features, startSeen, wrapperProps } = props;
10
11
  const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
11
12
  const _features = features.length ? features : [{ name: '...' }];
12
13
  return (react_1.default.createElement(react_1.default.Fragment, null,
13
14
  react_1.default.createElement(Bling_js_1.default, { type: "snake-large", align: "left", vertical: "down-ish" }),
14
- react_1.default.createElement("div", { className: "FeatureList", ref: ref },
15
+ react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('FeatureList', null, (wrapperProps || {}).className), ref: ref }),
15
16
  react_1.default.createElement("h2", { className: "FeatureList__title" }, title),
16
17
  react_1.default.createElement("ul", { className: "FeatureList__list" }, _features.map(({ name, icon, iconUrl }, i) => (react_1.default.createElement("li", { key: i, className: "FeatureList__feature", style: iconUrl
17
18
  ? { '--efnistakn': `url("${iconUrl}")` }
package/FieldGroup.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { ReactNode } from 'react';
2
+ import { WrapperElmProps } from './utils.js';
2
3
  export type FieldGroupProps = {
3
4
  legend: string;
4
5
  disabled?: boolean;
5
6
  small?: boolean;
6
7
  className?: string;
7
8
  children: ReactNode;
8
- };
9
+ } & WrapperElmProps<'fieldset'>;
9
10
  export declare const FieldGroup: (props: FieldGroupProps) => JSX.Element;
10
11
  export default FieldGroup;
package/FieldGroup.js CHANGED
@@ -5,8 +5,10 @@ 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 FieldGroup = (props) => {
8
- const { legend, children, className, disabled, small } = props;
9
- return (react_1.default.createElement("fieldset", { className: (0, classUtils_1.modifiedClass)('FieldGroup', small && 'small', className), disabled: disabled },
8
+ const { legend, children, className, disabled, small, wrapperProps } = props;
9
+ return (react_1.default.createElement("fieldset", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('FieldGroup', small && 'small',
10
+ // Prefer `className` over `wrapperProps.className`
11
+ className || (wrapperProps || {}).className), disabled: disabled }),
10
12
  react_1.default.createElement("legend", { className: "FieldGroup__legend" }, legend),
11
13
  children));
12
14
  };
package/FileInput.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { FileListProps } from './FileInput/_FileInputFileList.js';
2
2
  import { FormFieldWrappingProps } from './FormField.js';
3
- export type FileInputProps = {
3
+ export type FileInputProps = FormFieldWrappingProps & {
4
4
  /**
5
5
  * Flags if the input should accept multiple, or just a single file at a time.
6
6
  *
@@ -43,6 +43,6 @@ export type FileInputProps = {
43
43
  accept?: string;
44
44
  multiple?: boolean;
45
45
  };
46
- } & FormFieldWrappingProps;
46
+ };
47
47
  export declare const FileInput: (props: FileInputProps) => JSX.Element;
48
48
  export default FileInput;
package/FileInput.js CHANGED
@@ -9,7 +9,7 @@ const i18n_1 = require("@reykjavik/hanna-utils/i18n");
9
9
  const ReactDropzone_js_1 = require("./_mixed_export_resolution_/ReactDropzone.js");
10
10
  const _FileInput_utils_js_1 = require("./FileInput/_FileInput.utils.js");
11
11
  const _FileInputFileList_js_1 = require("./FileInput/_FileInputFileList.js");
12
- const FormField_js_1 = tslib_1.__importDefault(require("./FormField.js"));
12
+ const FormField_js_1 = tslib_1.__importStar(require("./FormField.js"));
13
13
  const defaultRemoveFileText = {
14
14
  is: 'Fjarlægja',
15
15
  en: 'Remove',
@@ -31,8 +31,13 @@ const arrayToFileList = (arr) => {
31
31
  return fileList.files;
32
32
  };
33
33
  const FileInput = (props) => {
34
- const { className, id, label, hideLabel, dropzoneProps = { multiple: true }, multiple = dropzoneProps.multiple, accept, dropzoneText, lang = i18n_1.DEFAULT_LANG, removeFileText = defaultRemoveFileText[lang] || defaultRemoveFileText[i18n_1.DEFAULT_LANG], assistText, disabled, invalid, errorMessage, required, reqText, FileList = _FileInputFileList_js_1.DefaultFileList, onFilesUpdated = () => undefined, onFilesRejected, showFileSize, showImagePreviews, value = [] } = props, inputElementProps = tslib_1.__rest(props, ["className", "id", "label", "hideLabel", "dropzoneProps", "multiple", "accept", "dropzoneText", "lang", "removeFileText", "assistText", "disabled", "invalid", "errorMessage", "required", "reqText", "FileList", "onFilesUpdated", "onFilesRejected", "showFileSize", "showImagePreviews", "value"]);
35
- const domid = (0, hooks_1.useDomid)(id);
34
+ var _a, _b, _c;
35
+ const lang = props.lang || i18n_1.DEFAULT_LANG;
36
+ const _d = (0, FormField_js_1.groupFormFieldWrapperProps)(props), { dropzoneProps, // eslint-disable-line deprecation/deprecation
37
+ multiple = (_b = (_a = props.dropzoneProps) === null || _a === void 0 ? void 0 : _a.multiple) !== null && _b !== void 0 ? _b : true, // eslint-disable-line deprecation/deprecation
38
+ accept = (_c = props.dropzoneProps) === null || _c === void 0 ? void 0 : _c.accept, // eslint-disable-line deprecation/deprecation
39
+ dropzoneText, removeFileText = defaultRemoveFileText[lang] || defaultRemoveFileText[i18n_1.DEFAULT_LANG], FileList = _FileInputFileList_js_1.DefaultFileList, onFilesUpdated = () => undefined, onFilesRejected, showFileSize, showImagePreviews, value = [], fieldWrapperProps } = _d, inputElementProps = tslib_1.__rest(_d, ["dropzoneProps", "multiple", "accept", "dropzoneText", "removeFileText", "FileList", "onFilesUpdated", "onFilesRejected", "showFileSize", "showImagePreviews", "value", "fieldWrapperProps"]);
40
+ const domid = (0, hooks_1.useDomid)(props.id);
36
41
  const fileInputWrapper = (0, react_1.useRef)(null);
37
42
  const fileInput = (0, react_1.useRef)(null);
38
43
  const files = value;
@@ -104,7 +109,7 @@ const FileInput = (props) => {
104
109
  }
105
110
  onFilesUpdated(fileList, diff);
106
111
  };
107
- return (react_1.default.createElement(FormField_js_1.default, { className: (0, classUtils_1.modifiedClass)('FileInput', [multiple && 'multi'], className), label: label, id: domid + '-fake', LabelTag: "h4", assistText: assistText, hideLabel: hideLabel, disabled: disabled, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, renderInput: (className, inputProps /* , addFocusProps */) => {
112
+ return (react_1.default.createElement(FormField_js_1.default, Object.assign({ extraClassName: (0, classUtils_1.modifiedClass)('FileInput', [multiple && 'multi']) }, fieldWrapperProps, { id: domid + '-fake', LabelTag: "h4", renderInput: (className, inputProps /* , addFocusProps */) => {
108
113
  return (react_1.default.createElement("div", { className: className.control, ref: fileInputWrapper },
109
114
  // Explicitly skip rendering of input element if no
110
115
  // name prop is provided. This is implicitly what the
@@ -128,7 +133,7 @@ const FileInput = (props) => {
128
133
  removeFile,
129
134
  formatBytes: _FileInput_utils_js_1.formatBytes,
130
135
  })))));
131
- } }));
136
+ } })));
132
137
  };
133
138
  exports.FileInput = FileInput;
134
139
  exports.default = exports.FileInput;
package/Foonote.js CHANGED
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Footnote = void 0;
4
- const tslib_1 = require("tslib");
5
- const Footnote_js_1 = tslib_1.__importDefault(require("./Footnote.js"));
4
+ const Footnote_js_1 = require("./Footnote.js");
6
5
  /** @deprecated (Will be removed in v0.11)
7
6
  *
8
7
  * This module file is a typo. import from `Footnote` instead
9
8
  */
10
- exports.Footnote = Footnote_js_1.default;
11
- exports.default = exports.Footnote;
9
+ exports.Footnote = Footnote_js_1.Footnote;
10
+ exports.default = exports.Footnote; // eslint-disable-line deprecation/deprecation
package/Footnote.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
+ import { WrapperElmProps } from './utils.js';
2
3
  export type FootnoteProps = {
3
4
  children: ReactNode;
4
- };
5
+ } & WrapperElmProps;
5
6
  export declare const Footnote: (props: FootnoteProps) => JSX.Element;
6
7
  export default Footnote;
package/Footnote.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Footnote = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
- const Footnote = (props) => (react_1.default.createElement("div", { className: "Footnote" }, props.children));
6
+ const classUtils_1 = require("@hugsmidjan/qj/classUtils");
7
+ const Footnote = (props) => (react_1.default.createElement("div", Object.assign({}, props.wrapperProps, { className: (0, classUtils_1.modifiedClass)('Footnote', null, (props.wrapperProps || {}).className) }), props.children));
7
8
  exports.Footnote = Footnote;
8
9
  exports.default = exports.Footnote;
package/Form.js CHANGED
@@ -4,12 +4,11 @@ exports.Form = void 0;
4
4
  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
+ // NOTE: As this component already accepts all `<form/>` props directly,
8
+ // it makes little sense to add support for `wrapperProps` on top.
7
9
  const Form = (props) => {
8
- const { children, align, wide } = props;
9
- return (react_1.default.createElement("form", Object.assign({}, props, { className: (0, classUtils_1.modifiedClass)('Form', [
10
- align === 'right' && 'align--' + align,
11
- !align && wide && 'wide',
12
- ]) }), children));
10
+ const { children, align, wide, className } = props, formProps = tslib_1.__rest(props, ["children", "align", "wide", "className"]);
11
+ return (react_1.default.createElement("form", Object.assign({}, formProps, { className: (0, classUtils_1.modifiedClass)('Form', [align === 'right' && 'align--' + align, !align && wide && 'wide'], className) }), children));
13
12
  };
14
13
  exports.Form = Form;
15
14
  exports.default = exports.Form;
package/FormField.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { RefObject } from 'react';
2
- import { SSRSupportProps } from './utils.js';
2
+ import { RequireExplicitUndefined } from '@reykjavik/hanna-utils';
3
+ import { TogglerGroupFieldProps } from './_abstract/_TogglerGroupField.js';
4
+ import { SSRSupportProps, WrapperElmProps } from './utils.js';
3
5
  type InputClassNames = {
4
6
  /** Basic/raw FormField BEM name */
5
7
  bem: string;
@@ -49,9 +51,13 @@ export type FormFieldWrappingProps = {
49
51
  reqText?: string | false;
50
52
  /** Optional pre-determinted id="" for the __input */
51
53
  id?: string;
52
- /** Ref object pointing to the outermost `.FormField` element */
54
+ /**
55
+ * @deprecated Use `*Props.wrapperProps.ref` instead (Will be removed in v0.11)
56
+ *
57
+ * Ref object pointing to the outermost `.FormField` element
58
+ */
53
59
  wrapperRef?: RefObject<HTMLElement>;
54
- } & SSRSupportProps;
60
+ } & WrapperElmProps & SSRSupportProps;
55
61
  /**
56
62
  * Mixin base props type for components using `FormField` to contain
57
63
  * more complex multi-element, grouped choices, that require a Heading
@@ -61,8 +67,12 @@ export type FormFieldGroupWrappingProps = FormFieldWrappingProps & {
61
67
  LabelTag?: 'h3' | 'h4' | 'h5';
62
68
  };
63
69
  type FormFieldProps = FormFieldGroupWrappingProps & {
64
- /** Container className - alongside "FormField" */
65
- className: string;
70
+ /** Container className - alongside "FormField" and `props.className`/
71
+ * `props.wrapperProps.className`. \
72
+ * Ideal to use if your wrapping compoent accepts its own `className`
73
+ * prop, so you don't have to merge/join them yourself.
74
+ */
75
+ extraClassName?: string;
66
76
  small?: boolean;
67
77
  group?: boolean | 'inputlike';
68
78
  empty?: boolean;
@@ -71,3 +81,13 @@ type FormFieldProps = FormFieldGroupWrappingProps & {
71
81
  };
72
82
  export declare const FormField: (props: FormFieldProps) => JSX.Element;
73
83
  export default FormField;
84
+ export declare const getFormFieldWrapperProps: (props: (FormFieldGroupWrappingProps | Pick<TogglerGroupFieldProps, keyof FormFieldGroupWrappingProps>) & {
85
+ small?: boolean;
86
+ }) => RequireExplicitUndefined<FormFieldGroupWrappingProps> & {
87
+ small: boolean | undefined;
88
+ };
89
+ export declare const groupFormFieldWrapperProps: <T extends (FormFieldGroupWrappingProps | Pick<TogglerGroupFieldProps<"default">, "label" | "className" | "id" | "wrapperProps" | "disabled" | "ssr" | "invalid" | "readOnly" | "required" | "errorMessage" | "reqText" | "assistText" | "hideLabel" | "wrapperRef" | "LabelTag">) & {
90
+ small?: boolean | undefined;
91
+ }>(props: T) => Omit<T, "label" | "small" | "className" | "id" | "wrapperProps" | "disabled" | "ssr" | "invalid" | "readOnly" | "required" | "errorMessage" | "reqText" | "assistText" | "hideLabel" | "wrapperRef" | "LabelTag"> & {
92
+ fieldWrapperProps: ReturnType<typeof getFormFieldWrapperProps>;
93
+ };
package/FormField.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormField = void 0;
3
+ exports.groupFormFieldWrapperProps = exports.getFormFieldWrapperProps = exports.FormField = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
- const hooks_1 = require("@hugsmidjan/react/hooks");
7
6
  const classUtils_1 = require("@hugsmidjan/qj/classUtils");
7
+ const hooks_1 = require("@hugsmidjan/react/hooks");
8
8
  const env_js_1 = require("./utils/env.js");
9
9
  const utils_js_1 = require("./utils.js");
10
10
  const inputClassNames = {
@@ -16,8 +16,8 @@ const inputClassNames = {
16
16
  // ---------------------------------------------------------------------------
17
17
  // eslint-disable-next-line complexity
18
18
  const FormField = (props) => {
19
- const { className, small, group, LabelTag = group ? 'h4' : undefined, label, assistText, hideLabel, empty, filled, readOnly, disabled, invalid, errorMessage, required, reqText, // i18n
20
- renderInput, id, ssr, } = props;
19
+ const { extraClassName, className, small, group, LabelTag = group ? 'h4' : undefined, label, assistText, hideLabel, empty, filled, readOnly, disabled, invalid, errorMessage, required, reqText, // TODO: i18n
20
+ renderInput, id, ssr, wrapperProps, } = props;
21
21
  const isBrowser = (0, utils_js_1.useIsBrowserSide)(ssr);
22
22
  const isInvalid = invalid || !!errorMessage || undefined;
23
23
  const domid = (0, hooks_1.useDomid)(id);
@@ -56,7 +56,7 @@ const FormField = (props) => {
56
56
  const assistTextId = assistText ? `assist:${domid}` : undefined;
57
57
  const labelId = LabelTag ? `label:${domid}` : undefined;
58
58
  const reqStar = required && reqText !== false && (react_1.default.createElement("abbr", { className: "FormField__label__reqstar",
59
- // TODO: add mo-better i18n thinking
59
+ // FIXME: add mo-better i18n thinking
60
60
  title: `${reqText || 'Þarf að fylla út'}: ` }, "*"));
61
61
  const inputProps = {
62
62
  id: domid,
@@ -67,7 +67,7 @@ const FormField = (props) => {
67
67
  'aria-describedby': assistTextId && errorId ? assistTextId + ' ' + errorId : assistTextId || errorId,
68
68
  'aria-labelledby': labelId, // undefined if normalLabel
69
69
  };
70
- return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('FormField', [
70
+ return (react_1.default.createElement("div", Object.assign({ ref: props.wrapperRef }, wrapperProps, { className: (0, classUtils_1.modifiedClass)('FormField', [
71
71
  small && 'small',
72
72
  hideLabel && 'nolabel',
73
73
  isInvalid && 'invalid',
@@ -76,7 +76,10 @@ const FormField = (props) => {
76
76
  isBrowser && empty && 'empty',
77
77
  isBrowser && filled && 'filled',
78
78
  isBrowser && focused && 'focused',
79
- ], className), ref: props.wrapperRef },
79
+ ],
80
+ // Prefer `className` over `wrapperProps.className`
81
+ (className || (wrapperProps || {}).className || '') +
82
+ (extraClassName ? ` ${extraClassName}` : '')) }),
80
83
  LabelTag ? (react_1.default.createElement(LabelTag, { className: "FormField__label", "data-inputlabel": group === 'inputlike' || undefined, id: labelId },
81
84
  ' ',
82
85
  reqStar,
@@ -95,3 +98,25 @@ const FormField = (props) => {
95
98
  };
96
99
  exports.FormField = FormField;
97
100
  exports.default = exports.FormField;
101
+ // ---------------------------------------------------------------------------
102
+ const getFormFieldWrapperProps = (props) => {
103
+ /* prettier-ignore */
104
+ const { wrapperProps, label, hideLabel, LabelTag, required, reqText, disabled, readOnly, assistText, invalid, errorMessage, id, small, ssr, className, wrapperRef, // eslint-disable-line deprecation/deprecation
105
+ } = props;
106
+ /* prettier-ignore */
107
+ return {
108
+ wrapperProps, label, LabelTag, hideLabel, required, reqText,
109
+ disabled: disabled === true,
110
+ readOnly, assistText, invalid, errorMessage, id,
111
+ small, ssr, className,
112
+ wrapperRef,
113
+ };
114
+ };
115
+ exports.getFormFieldWrapperProps = getFormFieldWrapperProps;
116
+ const groupFormFieldWrapperProps = (props) => {
117
+ /* prettier-ignore */
118
+ const { wrapperProps, label, hideLabel, LabelTag, required, reqText, disabled, readOnly, assistText, invalid, errorMessage, id, small, ssr, className, wrapperRef } = props, // eslint-disable-line deprecation/deprecation
119
+ rest = tslib_1.__rest(props, ["wrapperProps", "label", "hideLabel", "LabelTag", "required", "reqText", "disabled", "readOnly", "assistText", "invalid", "errorMessage", "id", "small", "ssr", "className", "wrapperRef"]);
120
+ return Object.assign({ fieldWrapperProps: (0, exports.getFormFieldWrapperProps)(props) }, rest);
121
+ };
122
+ exports.groupFormFieldWrapperProps = groupFormFieldWrapperProps;
@@ -16,8 +16,8 @@ const GalleryItem = (props) => {
16
16
  setCurrentImage(Object.assign(Object.assign({}, image), { caption, description, largeImageSrc }));
17
17
  } },
18
18
  ' ',
19
- react_1.default.createElement(_Image_js_1.Image, Object.assign({ className: "GalleryItem__image" }, image)),
20
- ' ')) : (react_1.default.createElement(_Image_js_1.Image, Object.assign({ className: "GalleryItem__image" }, image))),
19
+ react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "GalleryItem__image" }, image)),
20
+ ' ')) : (react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "GalleryItem__image" }, image))),
21
21
  description && react_1.default.createElement("div", { className: "GalleryItem__description" }, description)));
22
22
  };
23
23
  exports.GalleryItem = GalleryItem;
@@ -10,6 +10,6 @@ const GalleryModalItem = (props) => {
10
10
  (caption || description) && (react_1.default.createElement("div", { className: "GalleryModalItem__text" },
11
11
  react_1.default.createElement("div", { className: "GalleryModalItem__caption" }, caption),
12
12
  react_1.default.createElement("div", { className: "GalleryModalItem__description" }, description))),
13
- react_1.default.createElement(_Image_js_1.Image, { className: "GalleryModalItem__image", src: image.largeImageSrc || image.src })));
13
+ react_1.default.createElement(_Image_js_1.Image, { bem: "GalleryModalItem__image", src: image.largeImageSrc || image.src })));
14
14
  };
15
15
  exports.GalleryModalItem = GalleryModalItem;
package/Gallery.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { GalleryItemProps } from './Gallery/_GalleryItem.js';
2
2
  import { SeenProp } from './utils/seenEffect.js';
3
- import { SSRSupportProps } from './utils.js';
3
+ import { SSRSupportProps, WrapperElmProps } from './utils.js';
4
4
  export type { GalleryItemProps } from './Gallery/_GalleryItem.js';
5
5
  export type GalleryI18n = {
6
6
  modalNextLabel: string;
@@ -11,6 +11,6 @@ export type GalleryProps = {
11
11
  items: Array<GalleryItemProps>;
12
12
  texts?: GalleryI18n;
13
13
  lang?: string;
14
- } & SSRSupportProps & SeenProp;
14
+ } & SSRSupportProps & WrapperElmProps & SeenProp;
15
15
  export declare const Gallery: (props: GalleryProps) => JSX.Element;
16
16
  export default Gallery;
package/Gallery.js CHANGED
@@ -23,10 +23,11 @@ const defaultTexts = {
23
23
  const Gallery = (props) => {
24
24
  const { items, ssr, startSeen } = props;
25
25
  const texts = (0, i18n_1.getTexts)(props, defaultTexts);
26
- const [modalImage, setModalImage] = (0, react_1.useState)(undefined);
27
- return (react_1.default.createElement(_GalleryModalContext_js_1.GalleryModalContext.Provider, { value: { items, setCurrentImage: setModalImage, currentImage: modalImage } },
28
- react_1.default.createElement(_AbstractCarousel_js_1.AbstractCarousel, { bem: "Gallery", items: items, Component: _GalleryItem_js_1.GalleryItem, ssr: ssr, startSeen: startSeen }),
29
- react_1.default.createElement(_GalleryModal_js_1.GalleryModal, Object.assign({}, modalImage, { texts: texts }))));
26
+ const [currentImage, setCurrentImage] = (0, react_1.useState)(undefined);
27
+ const galleryState = (0, react_1.useMemo)(() => ({ items, setCurrentImage, currentImage }), [items, currentImage]);
28
+ return (react_1.default.createElement(_GalleryModalContext_js_1.GalleryModalContext.Provider, { value: galleryState },
29
+ react_1.default.createElement(_AbstractCarousel_js_1.AbstractCarousel, { bem: "Gallery", items: items, Component: _GalleryItem_js_1.GalleryItem, ssr: ssr, startSeen: startSeen, wrapperProps: props.wrapperProps }),
30
+ react_1.default.createElement(_GalleryModal_js_1.GalleryModal, Object.assign({}, currentImage, { texts: texts }))));
30
31
  };
31
32
  exports.Gallery = Gallery;
32
33
  exports.default = exports.Gallery;
package/GridBlocks.d.ts CHANGED
@@ -2,6 +2,7 @@ import { Efnistakn } from '@reykjavik/hanna-utils/assets';
2
2
  import { ButtonProps } from './_abstract/_Button.js';
3
3
  import { ImageProps } from './_abstract/_Image.js';
4
4
  import { SeenProp } from './utils/seenEffect.js';
5
+ import { WrapperElmProps } from './utils.js';
5
6
  export type GridBlockItem = {
6
7
  title: string;
7
8
  summary: string | JSX.Element;
@@ -17,10 +18,6 @@ export type GridBlockItem = {
17
18
  export type GridBlocksProps = {
18
19
  blocks: Array<GridBlockItem>;
19
20
  twocol?: boolean;
20
- } & SeenProp;
21
- export type GridBlocksProp1s = {
22
- blocks: Array<GridBlockItem>;
23
- twocol?: boolean;
24
- };
21
+ } & WrapperElmProps & SeenProp;
25
22
  export declare const GridBlocks: (props: GridBlocksProps) => JSX.Element;
26
23
  export default GridBlocks;
package/GridBlocks.js CHANGED
@@ -10,12 +10,12 @@ const _Link_js_1 = require("./_abstract/_Link.js");
10
10
  const seenEffect_js_1 = require("./utils/seenEffect.js");
11
11
  const ButtonTertiary_js_1 = tslib_1.__importDefault(require("./ButtonTertiary.js"));
12
12
  const GridBlocks = (props) => {
13
- const { blocks, twocol, startSeen } = props;
13
+ const { blocks, twocol, startSeen, wrapperProps } = props;
14
14
  const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
15
- return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('GridBlocks', [twocol && 'twocol']), ref: ref }, blocks.map(({ title, summary, href, links = [], icon, image }, i) => {
15
+ return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('GridBlocks', [twocol && 'twocol'], (wrapperProps || {}).className), ref: ref }), blocks.map(({ title, summary, href, links = [], icon, image }, i) => {
16
16
  const imageProps = icon ? { src: (0, assets_1.getEfnistaknUrl)(icon) } : image;
17
17
  return (react_1.default.createElement("div", { key: i, className: "GridBlocks__item" },
18
- imageProps && react_1.default.createElement(_Image_js_1.Image, Object.assign({ className: "GridBlocks__illustration" }, imageProps)),
18
+ imageProps && react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "GridBlocks__illustration" }, imageProps)),
19
19
  react_1.default.createElement("div", { className: "GridBlocks__textwrap" },
20
20
  react_1.default.createElement("h3", { className: "GridBlocks__item__title" }, href != null ? (react_1.default.createElement(_Link_js_1.Link, { className: "GridBlocks__item__titlelink", href: href }, title)) : (title)),
21
21
  react_1.default.createElement("div", { className: "GridBlocks__item__summary" }, summary),
package/Heading.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { ComponentLayoutProps } from './constants.js';
3
+ import { WrapperElmProps } from './utils.js';
3
4
  declare const sizes: {
4
5
  readonly small: "small";
5
6
  /** Default value */
@@ -17,6 +18,6 @@ export type HeadingProps = {
17
18
  * This prop is ignore if the `Tag` prop is defined.
18
19
  */
19
20
  forceH1?: boolean;
20
- } & ComponentLayoutProps;
21
+ } & ComponentLayoutProps & WrapperElmProps;
21
22
  export declare const Heading: (props: HeadingProps) => JSX.Element;
22
23
  export default Heading;