@ndla/ui 30.2.0 → 30.2.2

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 (327) hide show
  1. package/es/Article/ArticleHeaderWrapper.js +75 -112
  2. package/es/Footer/FooterLinks.js +13 -10
  3. package/es/Frontpage/FrontpageFilm.js +11 -8
  4. package/es/Frontpage/FrontpageMultidisciplinarySubject.js +13 -10
  5. package/es/Frontpage/FrontpageToolbox.js +11 -8
  6. package/es/LearningPaths/LearningPathLastStepNavigation.js +11 -8
  7. package/es/LearningPaths/LearningPathMenuAside.js +13 -10
  8. package/es/LearningPaths/LearningPathMobileHeader.js +8 -6
  9. package/es/LearningPaths/LearningPathMobileStepInfo.js +8 -5
  10. package/es/Masthead/MastheadSearchModal.js +10 -7
  11. package/es/Messages/MessageBox.js +11 -12
  12. package/es/NDLAFilm/CategorySelect.js +106 -146
  13. package/es/Resource/ListResource.js +20 -20
  14. package/es/Resource/resourceComponents.js +11 -11
  15. package/es/SearchTypeResult/ActiveFilterContent.js +9 -6
  16. package/es/SearchTypeResult/SearchHeader.js +14 -12
  17. package/es/SearchTypeResult/SearchNotionsResult.js +5 -6
  18. package/es/SearchTypeResult/SearchTypeHeader.js +17 -15
  19. package/es/Subject/SubjectCarousel.js +11 -8
  20. package/es/ToolboxPage/ToolboxInfo.js +9 -6
  21. package/es/User/UserInfo.js +23 -2
  22. package/es/User/parseUserObject.js +22 -12
  23. package/es/locale/messages-en.js +5 -1
  24. package/es/locale/messages-nb.js +5 -1
  25. package/es/locale/messages-nn.js +5 -1
  26. package/es/locale/messages-se.js +33 -29
  27. package/es/locale/messages-sma.js +5 -1
  28. package/es/utils/createUniversalPortal.js +1 -1
  29. package/lib/Animation/DisplayOnPageYOffset.d.ts +2 -2
  30. package/lib/Animation/Fade.d.ts +2 -2
  31. package/lib/Article/Article.d.ts +3 -3
  32. package/lib/Article/ArticleAccessMessage.d.ts +1 -1
  33. package/lib/Article/ArticleByline.d.ts +1 -1
  34. package/lib/Article/ArticleContent.d.ts +1 -1
  35. package/lib/Article/ArticleFootNotes.d.ts +1 -1
  36. package/lib/Article/ArticleHeaderWrapper.d.ts +4 -5
  37. package/lib/Article/ArticleHeaderWrapper.js +73 -108
  38. package/lib/Article/ArticleNotions.d.ts +1 -1
  39. package/lib/Article/ArticleSideBar.d.ts +1 -1
  40. package/lib/Aside/Aside.d.ts +1 -1
  41. package/lib/AudioPlayer/AudioPlayer.d.ts +1 -1
  42. package/lib/AudioPlayer/Controls.d.ts +1 -1
  43. package/lib/AudioPlayer/SpeechControl.d.ts +1 -1
  44. package/lib/AuthorInfo/AuthorInfo.d.ts +1 -1
  45. package/lib/BannerCard/BannerCard.d.ts +1 -1
  46. package/lib/BlogPosts/BlogPost.d.ts +1 -1
  47. package/lib/BlogPosts/BlogPostWrapper.d.ts +1 -1
  48. package/lib/Breadcrumb/ActionBreadcrumb.d.ts +1 -1
  49. package/lib/Breadcrumb/Breadcrumb.d.ts +1 -1
  50. package/lib/Breadcrumb/HeaderBreadcrumb.d.ts +1 -1
  51. package/lib/Breadcrumb/HomeBreadcrumb.d.ts +1 -1
  52. package/lib/Breadcrumblist/Breadcrumblist.d.ts +1 -1
  53. package/lib/CompetenceGoalTab/CompetenceGoalItem.d.ts +1 -1
  54. package/lib/CompetenceGoalTab/CompetenceGoalTab.d.ts +1 -1
  55. package/lib/CompetenceGoalTab/CompetenceItem.d.ts +1 -1
  56. package/lib/CompetenceGoalTab/SearchButton.d.ts +1 -1
  57. package/lib/CompetenceGoals/CompetenceGoalsDialog.d.ts +1 -1
  58. package/lib/ComponentCursor/ComponentCursor.d.ts +1 -1
  59. package/lib/ContentCard/ContentCard.d.ts +1 -1
  60. package/lib/ContentLoader/index.d.ts +1 -1
  61. package/lib/ContentPlaceholder/ContentPlaceholder.d.ts +1 -1
  62. package/lib/ContentTypeBadge/ContentTypeBadge.d.ts +9 -9
  63. package/lib/CopyParagraphButton/CopyParagraphButton.d.ts +1 -1
  64. package/lib/CreatedBy/CreatedBy.d.ts +1 -1
  65. package/lib/Dialog/Dialog.d.ts +1 -1
  66. package/lib/ErrorMessage/ErrorMessage.d.ts +1 -1
  67. package/lib/ErrorMessage/ErrorResourceAccessDenied.d.ts +1 -1
  68. package/lib/FactBox/FactBox.d.ts +1 -1
  69. package/lib/Figure/Figure.d.ts +2 -2
  70. package/lib/Figure/FigureBylineExpandButton.d.ts +1 -1
  71. package/lib/Figure/FigureExpandButton.d.ts +1 -1
  72. package/lib/Figure/FigureLicense.d.ts +2 -2
  73. package/lib/Figure/FigureLicenseDialog.d.ts +1 -1
  74. package/lib/Figure/FigureOpenDialogButton.d.ts +1 -1
  75. package/lib/FileList/File.d.ts +1 -1
  76. package/lib/FileList/FileList.d.ts +1 -1
  77. package/lib/Filter/FilterButtons.d.ts +1 -1
  78. package/lib/Filter/FilterCarousel.d.ts +1 -1
  79. package/lib/Filter/FilterList.d.ts +1 -1
  80. package/lib/Filter/FilterListPhone.d.ts +1 -1
  81. package/lib/Filter/ToggleItem.d.ts +1 -1
  82. package/lib/Footer/EditorName.d.ts +1 -1
  83. package/lib/Footer/Footer.d.ts +1 -1
  84. package/lib/Footer/FooterAuth.d.ts +1 -1
  85. package/lib/Footer/FooterLinks.d.ts +3 -4
  86. package/lib/Footer/FooterLinks.js +12 -10
  87. package/lib/Footer/FooterPrivacy.d.ts +1 -1
  88. package/lib/Footer/FooterText.d.ts +1 -1
  89. package/lib/Footer/privacy_en.d.ts +1 -1
  90. package/lib/Footer/privacy_nb.d.ts +1 -1
  91. package/lib/Footer/privacy_nn.d.ts +1 -1
  92. package/lib/Frontpage/FrontpageAllSubjects.d.ts +1 -1
  93. package/lib/Frontpage/FrontpageFilm.d.ts +2 -4
  94. package/lib/Frontpage/FrontpageFilm.js +10 -8
  95. package/lib/Frontpage/FrontpageHeader.d.ts +1 -1
  96. package/lib/Frontpage/FrontpageInfo.d.ts +1 -1
  97. package/lib/Frontpage/FrontpageMultidisciplinarySubject.d.ts +7 -8
  98. package/lib/Frontpage/FrontpageMultidisciplinarySubject.js +12 -10
  99. package/lib/Frontpage/FrontpageProgramMenu.d.ts +1 -1
  100. package/lib/Frontpage/FrontpageSearch.d.ts +1 -1
  101. package/lib/Frontpage/FrontpageToolbox.d.ts +2 -4
  102. package/lib/Frontpage/FrontpageToolbox.js +10 -8
  103. package/lib/Frontpage/illustrations/Fellesfag.d.ts +1 -1
  104. package/lib/Frontpage/illustrations/FrontpageHeaderIllustration.d.ts +1 -1
  105. package/lib/Frontpage/illustrations/FrontpageIllustrations.d.ts +2 -2
  106. package/lib/Frontpage/illustrations/FrontpageSubjectIllustration.d.ts +1 -1
  107. package/lib/Frontpage/illustrations/MenuFellesfag.d.ts +1 -1
  108. package/lib/Frontpage/illustrations/MenuStudiespesialiserende.d.ts +1 -1
  109. package/lib/Frontpage/illustrations/MenuYrkesfag.d.ts +1 -1
  110. package/lib/Frontpage/illustrations/Studiespesialiserende.d.ts +1 -1
  111. package/lib/Frontpage/illustrations/Yrkesfag.d.ts +1 -1
  112. package/lib/Frontpage/illustrations/index.d.ts +6 -6
  113. package/lib/Hero/Hero.d.ts +8 -8
  114. package/lib/Image/Image.d.ts +2 -2
  115. package/lib/Image/ImageLink.d.ts +1 -1
  116. package/lib/Image/LazyLoadImage.d.ts +1 -1
  117. package/lib/InfoBlock/InfoBlock.d.ts +1 -1
  118. package/lib/InfoBox/InfoBox.d.ts +1 -1
  119. package/lib/InfoWidget/InfoWidget.d.ts +1 -1
  120. package/lib/LanguageSelector/LanguageSelector.d.ts +1 -1
  121. package/lib/LanguageSelector/LanguageSelectorContent.d.ts +1 -1
  122. package/lib/Layout/Content.d.ts +2 -2
  123. package/lib/Layout/LayoutItem.d.ts +1 -1
  124. package/lib/Layout/OneColumn.d.ts +1 -1
  125. package/lib/Layout/PageContainer.d.ts +1 -1
  126. package/lib/LearningPaths/LearningPathContent.d.ts +1 -1
  127. package/lib/LearningPaths/LearningPathInformation.d.ts +1 -1
  128. package/lib/LearningPaths/LearningPathLastStepNavigation.d.ts +3 -4
  129. package/lib/LearningPaths/LearningPathLastStepNavigation.js +10 -8
  130. package/lib/LearningPaths/LearningPathMenu.d.ts +1 -1
  131. package/lib/LearningPaths/LearningPathMenuAside.d.ts +2 -4
  132. package/lib/LearningPaths/LearningPathMenuAside.js +12 -10
  133. package/lib/LearningPaths/LearningPathMenuAsideCopyright.d.ts +1 -1
  134. package/lib/LearningPaths/LearningPathMenuContent.d.ts +1 -1
  135. package/lib/LearningPaths/LearningPathMenuIntro.d.ts +1 -1
  136. package/lib/LearningPaths/LearningPathMenuModalWrapper.d.ts +1 -1
  137. package/lib/LearningPaths/LearningPathMobileHeader.d.ts +2 -4
  138. package/lib/LearningPaths/LearningPathMobileHeader.js +7 -6
  139. package/lib/LearningPaths/LearningPathMobileStepInfo.d.ts +2 -4
  140. package/lib/LearningPaths/LearningPathMobileStepInfo.js +7 -5
  141. package/lib/LearningPaths/LearningPathSticky.d.ts +3 -3
  142. package/lib/LearningPaths/LearningPathWrapper.d.ts +1 -1
  143. package/lib/Logo/Logo.d.ts +1 -1
  144. package/lib/Logo/SvgLogo.d.ts +1 -1
  145. package/lib/Masthead/Masthead.d.ts +2 -2
  146. package/lib/Masthead/MastheadAuthModal.d.ts +1 -1
  147. package/lib/Masthead/MastheadSearchModal.d.ts +3 -4
  148. package/lib/Masthead/MastheadSearchModal.js +9 -7
  149. package/lib/Masthead/SkipToMainContent.d.ts +1 -1
  150. package/lib/MediaList/MediaList.d.ts +8 -8
  151. package/lib/Messages/MessageBanner.d.ts +1 -1
  152. package/lib/Messages/MessageBox.d.ts +2 -5
  153. package/lib/Messages/MessageBox.js +10 -14
  154. package/lib/Messages/MessageBoxTag.d.ts +1 -1
  155. package/lib/MultidisciplinarySubject/Illustrations.d.ts +7 -7
  156. package/lib/MultidisciplinarySubject/List.d.ts +1 -1
  157. package/lib/MultidisciplinarySubject/ListItem.d.ts +1 -1
  158. package/lib/MultidisciplinarySubject/MultidisciplinarySubject.d.ts +1 -1
  159. package/lib/MultidisciplinarySubject/MultidisciplinarySubjectHeader.d.ts +1 -1
  160. package/lib/MyNdla/Resource/Folder.d.ts +1 -1
  161. package/lib/MyNdla/Resource/FolderInput.d.ts +1 -1
  162. package/lib/NDLAFilm/AboutNdlaFilm.d.ts +1 -1
  163. package/lib/NDLAFilm/AllMoviesAlphabetically.d.ts +1 -1
  164. package/lib/NDLAFilm/CategorySelect.d.ts +10 -5
  165. package/lib/NDLAFilm/CategorySelect.js +99 -145
  166. package/lib/NDLAFilm/FilmContentCard.d.ts +1 -1
  167. package/lib/NDLAFilm/FilmContentCardTags.d.ts +1 -1
  168. package/lib/NDLAFilm/FilmMovieList.d.ts +1 -1
  169. package/lib/NDLAFilm/FilmMovieSearch.d.ts +1 -1
  170. package/lib/NDLAFilm/FilmSlideshow.d.ts +1 -1
  171. package/lib/NDLAFilm/MovieGrid.d.ts +1 -1
  172. package/lib/NDLAFilm/NavigationArrow.d.ts +2 -2
  173. package/lib/NDLAFilm/SlideshowIndicator.d.ts +1 -1
  174. package/lib/NDLAFilm/VisualElement.d.ts +1 -1
  175. package/lib/NDLAFilm/filmStyles.d.ts +2 -2
  176. package/lib/Navigation/NavigationBox.d.ts +1 -1
  177. package/lib/Navigation/NavigationHeading.d.ts +1 -1
  178. package/lib/Navigation/NavigationTopicAbout.d.ts +1 -1
  179. package/lib/NoContentBox/NoContentBox.d.ts +1 -1
  180. package/lib/Notion/ConceptNotion.d.ts +1 -1
  181. package/lib/Notion/FigureNotion.d.ts +1 -1
  182. package/lib/Notion/Notion.d.ts +1 -1
  183. package/lib/Notion/NotionImage.d.ts +1 -1
  184. package/lib/Notion/NotionVisualElement.d.ts +1 -1
  185. package/lib/Portrait/Portrait.d.ts +1 -1
  186. package/lib/Programme/Programme.d.ts +1 -1
  187. package/lib/Programme/ProgrammeSubjects.d.ts +1 -1
  188. package/lib/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  189. package/lib/RelatedArticleList/RelatedArticleList.d.ts +2 -2
  190. package/lib/Resource/BlockResource.d.ts +1 -1
  191. package/lib/Resource/ListResource.d.ts +1 -1
  192. package/lib/Resource/ListResource.js +20 -19
  193. package/lib/Resource/resourceComponents.d.ts +7 -7
  194. package/lib/Resource/resourceComponents.js +11 -11
  195. package/lib/ResourceBox/ResourceBox.d.ts +1 -1
  196. package/lib/ResourceGroup/ResourceGroup.d.ts +1 -1
  197. package/lib/ResourceGroup/ResourceItem.d.ts +1 -1
  198. package/lib/ResourceGroup/ResourceList.d.ts +1 -1
  199. package/lib/ResourcesWrapper/ResourcesTitle.d.ts +1 -1
  200. package/lib/ResourcesWrapper/ResourcesTopicTitle.d.ts +1 -1
  201. package/lib/ResourcesWrapper/ResourcesWrapper.d.ts +1 -1
  202. package/lib/Search/ActiveFilterContent.d.ts +2 -2
  203. package/lib/Search/ActiveFilters.d.ts +1 -1
  204. package/lib/Search/ContentTypeResult.d.ts +1 -1
  205. package/lib/Search/ContentTypeResultStyles.d.ts +6 -6
  206. package/lib/Search/LoadingWrapper.d.ts +1 -1
  207. package/lib/Search/SearchField.d.ts +1 -1
  208. package/lib/Search/SearchFieldForm.d.ts +1 -1
  209. package/lib/Search/SearchResult.d.ts +2 -2
  210. package/lib/Search/SearchResultSleeve.d.ts +1 -1
  211. package/lib/Search/ToggleSearchButton.d.ts +1 -1
  212. package/lib/SearchTypeResult/ActiveFilterContent.d.ts +3 -4
  213. package/lib/SearchTypeResult/ActiveFilterContent.js +8 -6
  214. package/lib/SearchTypeResult/ActiveFilters.d.ts +1 -1
  215. package/lib/SearchTypeResult/PopupFilter.d.ts +1 -1
  216. package/lib/SearchTypeResult/ResultNavigation.d.ts +1 -1
  217. package/lib/SearchTypeResult/SearchFieldHeader.d.ts +1 -1
  218. package/lib/SearchTypeResult/SearchFilterContent.d.ts +1 -1
  219. package/lib/SearchTypeResult/SearchHeader.d.ts +3 -4
  220. package/lib/SearchTypeResult/SearchHeader.js +13 -12
  221. package/lib/SearchTypeResult/SearchItem.d.ts +1 -1
  222. package/lib/SearchTypeResult/SearchItemList.d.ts +1 -1
  223. package/lib/SearchTypeResult/SearchItems.d.ts +1 -1
  224. package/lib/SearchTypeResult/SearchNotionItem.d.ts +1 -1
  225. package/lib/SearchTypeResult/SearchNotionsResult.d.ts +3 -4
  226. package/lib/SearchTypeResult/SearchNotionsResult.js +5 -6
  227. package/lib/SearchTypeResult/SearchSubjectItem.d.ts +1 -1
  228. package/lib/SearchTypeResult/SearchSubjectResult.d.ts +1 -1
  229. package/lib/SearchTypeResult/SearchTypeHeader.d.ts +1 -2
  230. package/lib/SearchTypeResult/SearchTypeHeader.js +15 -12
  231. package/lib/SearchTypeResult/SearchTypeResult.d.ts +1 -1
  232. package/lib/SearchTypeResult/SearchViewType.d.ts +1 -1
  233. package/lib/SearchTypeResult/components/ItemContexts.d.ts +1 -1
  234. package/lib/SearchTypeResult/components/ItemResourceHeader.d.ts +1 -1
  235. package/lib/SearchTypeResult/components/ItemTopicHeader.d.ts +1 -1
  236. package/lib/SearchTypeResult/components/SubjectFilters.d.ts +1 -1
  237. package/lib/SectionHeading/SectionHeading.d.ts +1 -1
  238. package/lib/SnackBar/DefaultSnackbar.d.ts +1 -1
  239. package/lib/SnackBar/SnackbarProvider.d.ts +2 -2
  240. package/lib/Subject/Subject.d.ts +8 -8
  241. package/lib/Subject/SubjectAbout.d.ts +1 -1
  242. package/lib/Subject/SubjectArchive.d.ts +1 -1
  243. package/lib/Subject/SubjectBanner.d.ts +1 -1
  244. package/lib/Subject/SubjectCarousel.d.ts +2 -4
  245. package/lib/Subject/SubjectCarousel.js +10 -8
  246. package/lib/Subject/SubjectHeader.d.ts +1 -1
  247. package/lib/Subject/SubjectLinks.d.ts +1 -1
  248. package/lib/Subject/SubjectNewContent.d.ts +1 -1
  249. package/lib/Subject/SubjectShortcuts.d.ts +1 -1
  250. package/lib/Subject/SubjectSocial.d.ts +2 -2
  251. package/lib/Table/Table.d.ts +1 -1
  252. package/lib/TagSelector/Control.d.ts +1 -1
  253. package/lib/TagSelector/DropdownIndicator.d.ts +1 -1
  254. package/lib/TagSelector/Input.d.ts +1 -1
  255. package/lib/TagSelector/Menu.d.ts +1 -1
  256. package/lib/TagSelector/MenuList.d.ts +2 -2
  257. package/lib/TagSelector/Option.d.ts +1 -1
  258. package/lib/TagSelector/SelectContainer.d.ts +1 -1
  259. package/lib/TagSelector/TagSelector.d.ts +1 -1
  260. package/lib/TagSelector/ValueButton.d.ts +2 -2
  261. package/lib/ToolboxPage/ToolboxInfo.d.ts +3 -4
  262. package/lib/ToolboxPage/ToolboxInfo.js +8 -6
  263. package/lib/Topic/Loader.d.ts +1 -1
  264. package/lib/Topic/Topic.d.ts +1 -1
  265. package/lib/TopicIntroductionList/TopicIntroduction.d.ts +1 -1
  266. package/lib/TopicIntroductionList/TopicIntroductionList.d.ts +1 -1
  267. package/lib/TopicIntroductionList/TopicIntroductionShortcuts.d.ts +1 -1
  268. package/lib/TopicIntroductionList/TopicShortcutItem.d.ts +1 -1
  269. package/lib/Translation/Translation.d.ts +1 -1
  270. package/lib/Translation/TranslationBox.d.ts +1 -1
  271. package/lib/Translation/TranslationLine.d.ts +1 -1
  272. package/lib/TreeStructure/AddFolderButton.d.ts +1 -1
  273. package/lib/TreeStructure/FolderItem.d.ts +1 -1
  274. package/lib/TreeStructure/FolderItems.d.ts +1 -1
  275. package/lib/TreeStructure/NavigationLink.d.ts +1 -1
  276. package/lib/TreeStructure/TreeStructure.d.ts +1 -1
  277. package/lib/TreeStructure/helperFunctions.d.ts +1 -1
  278. package/lib/User/AuthModal.d.ts +1 -1
  279. package/lib/User/UserInfo.d.ts +1 -1
  280. package/lib/User/UserInfo.js +23 -2
  281. package/lib/User/apiTypes.d.ts +10 -2
  282. package/lib/User/parseUserObject.d.ts +2 -1
  283. package/lib/User/parseUserObject.js +22 -12
  284. package/lib/locale/LocaleProvider.d.ts +1 -1
  285. package/lib/locale/messages-en.d.ts +4 -0
  286. package/lib/locale/messages-en.js +5 -1
  287. package/lib/locale/messages-nb.d.ts +4 -0
  288. package/lib/locale/messages-nb.js +5 -1
  289. package/lib/locale/messages-nn.d.ts +4 -0
  290. package/lib/locale/messages-nn.js +5 -1
  291. package/lib/locale/messages-se.d.ts +4 -0
  292. package/lib/locale/messages-se.js +33 -29
  293. package/lib/locale/messages-sma.d.ts +4 -0
  294. package/lib/locale/messages-sma.js +5 -1
  295. package/lib/utils/createUniversalPortal.d.ts +1 -1
  296. package/lib/utils/createUniversalPortal.js +1 -1
  297. package/package.json +10 -10
  298. package/src/Article/ArticleHeaderWrapper.tsx +53 -66
  299. package/src/Footer/FooterLinks.tsx +43 -40
  300. package/src/Frontpage/FrontpageFilm.tsx +20 -17
  301. package/src/Frontpage/FrontpageMultidisciplinarySubject.tsx +33 -30
  302. package/src/Frontpage/FrontpageToolbox.tsx +21 -18
  303. package/src/LearningPaths/LearningPathLastStepNavigation.tsx +32 -29
  304. package/src/LearningPaths/LearningPathMenuAside.tsx +25 -29
  305. package/src/LearningPaths/LearningPathMobileHeader.tsx +11 -8
  306. package/src/LearningPaths/LearningPathMobileStepInfo.tsx +13 -10
  307. package/src/Masthead/MastheadSearchModal.tsx +36 -35
  308. package/src/Messages/MessageBox.tsx +2 -3
  309. package/src/NDLAFilm/CategorySelect.tsx +77 -97
  310. package/src/Resource/ListResource.tsx +11 -16
  311. package/src/Resource/resourceComponents.tsx +0 -4
  312. package/src/SearchTypeResult/ActiveFilterContent.tsx +18 -15
  313. package/src/SearchTypeResult/SearchHeader.tsx +4 -4
  314. package/src/SearchTypeResult/SearchNotionsResult.tsx +2 -3
  315. package/src/SearchTypeResult/SearchTypeHeader.tsx +48 -45
  316. package/src/Subject/SubjectCarousel.tsx +93 -96
  317. package/src/ToolboxPage/ToolboxInfo.tsx +19 -16
  318. package/src/User/UserInfo.tsx +22 -0
  319. package/src/User/__tests__/parseUserObject-test.ts +1 -0
  320. package/src/User/apiTypes.ts +11 -2
  321. package/src/User/parseUserObject.ts +17 -11
  322. package/src/locale/messages-en.ts +4 -0
  323. package/src/locale/messages-nb.ts +4 -0
  324. package/src/locale/messages-nn.ts +4 -0
  325. package/src/locale/messages-se.ts +32 -28
  326. package/src/locale/messages-sma.ts +4 -0
  327. package/src/utils/createUniversalPortal.tsx +1 -6
@@ -6,7 +6,7 @@ import { isFunction } from '@ndla/util';
6
6
  import styled from '@emotion/styled';
7
7
  import { css } from '@emotion/react';
8
8
  import { spacing, mq, breakpoints, colors, shadows } from '@ndla/core';
9
- import { WithTranslation, withTranslation } from 'react-i18next';
9
+ import { useTranslation } from 'react-i18next';
10
10
  import ToggleSearchButton from '../Search/ToggleSearchButton';
11
11
 
12
12
  interface Props {
@@ -91,38 +91,39 @@ const extraBackdrop = css`
91
91
  box-shadow: ${shadows.searchHeader};
92
92
  `;
93
93
 
94
- const MastheadSearchModal = ({
95
- onClose: onSearchClose,
96
- children,
97
- hideOnNarrowScreen,
98
- ndlaFilm,
99
- t,
100
- }: Props & WithTranslation) => (
101
- <Modal
102
- label={t('searchPage.searchFieldPlaceholder')}
103
- backgroundColor="grey"
104
- animation="slide-down"
105
- animationDuration={200}
106
- size="full-width"
107
- onClose={onSearchClose}
108
- css={modalStyles}
109
- activateButton={
110
- <ToggleSearchButton hideOnNarrowScreen={hideOnNarrowScreen} ndlaFilm={ndlaFilm}>
111
- {t('masthead.menu.search')}
112
- </ToggleSearchButton>
113
- }>
114
- {(closeModal: VoidFunction) => (
115
- <>
116
- <div css={extraBackdrop} />
117
- <StyledHeader>
118
- {isFunction(children) ? children(closeModal) : children}
119
- <IconButton aria-label={t('welcomePage.closeSearch')} variant="ghost" colorTheme="light" onClick={closeModal}>
120
- <Cross className="c-icon--medium" />
121
- </IconButton>
122
- </StyledHeader>
123
- </>
124
- )}
125
- </Modal>
126
- );
94
+ const MastheadSearchModal = ({ onClose: onSearchClose, children, hideOnNarrowScreen, ndlaFilm }: Props) => {
95
+ const { t } = useTranslation();
96
+ return (
97
+ <Modal
98
+ label={t('searchPage.searchFieldPlaceholder')}
99
+ backgroundColor="grey"
100
+ animation="slide-down"
101
+ animationDuration={200}
102
+ size="full-width"
103
+ onClose={onSearchClose}
104
+ css={modalStyles}
105
+ activateButton={
106
+ <ToggleSearchButton hideOnNarrowScreen={hideOnNarrowScreen} ndlaFilm={ndlaFilm}>
107
+ {t('masthead.menu.search')}
108
+ </ToggleSearchButton>
109
+ }>
110
+ {(closeModal: VoidFunction) => (
111
+ <>
112
+ <div css={extraBackdrop} />
113
+ <StyledHeader>
114
+ {isFunction(children) ? children(closeModal) : children}
115
+ <IconButton
116
+ aria-label={t('welcomePage.closeSearch')}
117
+ variant="ghost"
118
+ colorTheme="light"
119
+ onClick={closeModal}>
120
+ <Cross className="c-icon--medium" />
121
+ </IconButton>
122
+ </StyledHeader>
123
+ </>
124
+ )}
125
+ </Modal>
126
+ );
127
+ };
127
128
 
128
- export default withTranslation()(MastheadSearchModal);
129
+ export default MastheadSearchModal;
@@ -10,7 +10,6 @@ import React from 'react';
10
10
  import styled from '@emotion/styled';
11
11
  import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
12
12
  import { InformationOutline, HumanMaleBoard, Forward, WarningOutline } from '@ndla/icons/common';
13
- import { WithTranslation, withTranslation } from 'react-i18next';
14
13
 
15
14
  // @ts-ignore
16
15
  import { Remarkable } from 'remarkable';
@@ -127,7 +126,7 @@ const Icon = ({ type }: StyledProps) => {
127
126
  return <InformationOutline />;
128
127
  };
129
128
 
130
- export const MessageBox = ({ type, children = '', links, showCloseButton, onClose }: Props & WithTranslation) => {
129
+ export const MessageBox = ({ type, children = '', links, showCloseButton, onClose }: Props) => {
131
130
  return (
132
131
  <MessageBoxWrapper type={type}>
133
132
  <InfoWrapper>
@@ -153,4 +152,4 @@ export const MessageBox = ({ type, children = '', links, showCloseButton, onClos
153
152
  );
154
153
  };
155
154
 
156
- export default withTranslation()(MessageBox);
155
+ export default MessageBox;
@@ -1,10 +1,18 @@
1
- import React, { Component } from 'react';
1
+ /**
2
+ * Copyright (c) 2019-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import React, { useEffect, useRef, useState } from 'react';
2
10
  import FocusTrapReact from 'focus-trap-react';
3
11
  import styled from '@emotion/styled';
4
12
  import { keyframes } from '@emotion/react';
5
13
  import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
6
14
  import { ChevronDown } from '@ndla/icons/common';
7
- import { WithTranslation, withTranslation } from 'react-i18next';
15
+ import { useTranslation } from 'react-i18next';
8
16
  import { MovieResourceType } from './types';
9
17
 
10
18
  const zoomInSelect = keyframes`
@@ -70,7 +78,7 @@ const DropdownWrapper = styled.div<DropdownWrapperProps>`
70
78
  top: -${(props) => props.offsetDropdown * 52 + 13}px;
71
79
  ${DropdownButton} {
72
80
  border-radius: 0;
73
- text-transform: 0;
81
+ text-transform: none;
74
82
  letter-spacing: 0;
75
83
  }
76
84
  display: flex;
@@ -105,110 +113,82 @@ const DropdownWrapper = styled.div<DropdownWrapperProps>`
105
113
  }
106
114
  `;
107
115
 
108
- interface Props extends WithTranslation {
116
+ interface Props {
109
117
  resourceTypes: MovieResourceType[];
110
118
  resourceTypeSelected?: MovieResourceType;
111
119
  ariaControlId?: string;
112
120
  onChangeResourceType: (resourceId?: string) => void;
113
121
  }
114
122
 
115
- interface State {
116
- resourceTypesIsOpen: boolean;
117
- }
118
- class CategorySelect extends Component<Props, State> {
119
- references: Record<string, HTMLButtonElement | null>;
120
- constructor(props: Props) {
121
- super(props);
122
- this.state = {
123
- resourceTypesIsOpen: false,
124
- };
125
- this.references = {};
126
- this.createRef = this.createRef.bind(this);
127
- this.openSelect = this.openSelect.bind(this);
128
- this.onSelect = this.onSelect.bind(this);
129
- }
123
+ const CategorySelect = ({ resourceTypes, resourceTypeSelected, ariaControlId, onChangeResourceType }: Props) => {
124
+ const { t } = useTranslation();
125
+ const refs = useRef<Record<string, HTMLButtonElement | null>>({});
130
126
 
131
- createRef(el: HTMLButtonElement | null, name: string) {
132
- this.references[name] = el;
133
- }
127
+ const [resourceTypesIsOpen, setResourceTypesIsOpen] = useState<boolean>(false);
134
128
 
135
- openSelect() {
136
- const { resourceTypeSelected } = this.props;
137
- this.setState(
138
- {
139
- resourceTypesIsOpen: true,
140
- },
141
- () => {
142
- if (resourceTypeSelected && this.references[resourceTypeSelected.id]) {
143
- this.references[resourceTypeSelected.id]?.focus();
144
- }
145
- },
146
- );
147
- }
129
+ const updateRef = (el: HTMLButtonElement | null, name: string) => {
130
+ refs.current[name] = el;
131
+ };
148
132
 
149
- onSelect(val?: string) {
150
- this.props.onChangeResourceType(val);
151
- this.setState({
152
- resourceTypesIsOpen: false,
153
- });
154
- }
133
+ useEffect(() => {
134
+ if (resourceTypeSelected && refs.current[resourceTypeSelected.id]) {
135
+ refs.current[resourceTypeSelected.id]?.focus();
136
+ }
137
+ }, [resourceTypesIsOpen, resourceTypeSelected]);
138
+
139
+ const onSelect = (val?: string) => {
140
+ onChangeResourceType(val);
141
+ setResourceTypesIsOpen(false);
142
+ };
155
143
 
156
- render() {
157
- const { resourceTypes, resourceTypeSelected, ariaControlId, t } = this.props;
158
- const { resourceTypesIsOpen } = this.state;
159
- const offsetDropDown = resourceTypeSelected
160
- ? resourceTypes.findIndex((resource) => resource.id === resourceTypeSelected.id) + 1
161
- : 0;
144
+ const offsetDropDown = resourceTypeSelected
145
+ ? resourceTypes.findIndex((resource) => resource.id === resourceTypeSelected.id) + 1
146
+ : 0;
162
147
 
163
- return (
164
- <DropdownContainer className="u-12/12">
165
- <DropdownButton
166
- aria-expanded={!resourceTypesIsOpen}
167
- aria-controls="selectCategory"
168
- type="button"
169
- tabIndex={resourceTypesIsOpen ? -1 : 0}
170
- onClick={this.openSelect}>
171
- <div>
172
- <span>{t('ndlaFilm.search.chooseCategory')}</span>
173
- <small>
174
- {(resourceTypeSelected && resourceTypeSelected.name) || t('ndlaFilm.search.categoryFromNdla')}
175
- </small>
176
- </div>
177
- <div>
178
- <ChevronDown className="c-icon--22" />
179
- </div>
180
- </DropdownButton>
181
- {resourceTypesIsOpen && (
182
- <FocusTrapReact
183
- active={resourceTypesIsOpen}
184
- focusTrapOptions={{
185
- onDeactivate: () => {
186
- this.setState({ resourceTypesIsOpen: false });
187
- },
188
- clickOutsideDeactivates: true,
189
- escapeDeactivates: true,
190
- }}>
191
- <DropdownWrapper id="selectCategory" offsetDropdown={offsetDropDown}>
192
- <DropdownButton aria-controls={ariaControlId} type="button" onClick={() => this.onSelect()}>
193
- <span>{t('ndlaFilm.search.categoryFromNdla')}</span>
148
+ return (
149
+ <DropdownContainer className="u-12/12">
150
+ <DropdownButton
151
+ aria-expanded={!resourceTypesIsOpen}
152
+ aria-controls="selectCategory"
153
+ type="button"
154
+ tabIndex={resourceTypesIsOpen ? -1 : 0}
155
+ onClick={() => setResourceTypesIsOpen(true)}>
156
+ <div>
157
+ <span>{t('ndlaFilm.search.chooseCategory')}</span>
158
+ <small>{(resourceTypeSelected && resourceTypeSelected.name) || t('ndlaFilm.search.categoryFromNdla')}</small>
159
+ </div>
160
+ <div>
161
+ <ChevronDown className="c-icon--22" />
162
+ </div>
163
+ </DropdownButton>
164
+ {resourceTypesIsOpen && (
165
+ <FocusTrapReact
166
+ active={resourceTypesIsOpen}
167
+ focusTrapOptions={{
168
+ onDeactivate: () => setResourceTypesIsOpen(false),
169
+ clickOutsideDeactivates: true,
170
+ escapeDeactivates: true,
171
+ }}>
172
+ <DropdownWrapper id="selectCategory" offsetDropdown={offsetDropDown}>
173
+ <DropdownButton aria-controls={ariaControlId} type="button" onClick={() => onSelect()}>
174
+ <span>{t('ndlaFilm.search.categoryFromNdla')}</span>
175
+ </DropdownButton>
176
+ {resourceTypes.map((resourceType) => (
177
+ <DropdownButton
178
+ aria-controls={ariaControlId}
179
+ type="button"
180
+ ref={(el) => updateRef(el, resourceType.id)}
181
+ onClick={() => onSelect(resourceType.id)}
182
+ data-id={resourceType.id}
183
+ key={resourceType.id}>
184
+ <span>{resourceType.name}</span>
194
185
  </DropdownButton>
195
- {resourceTypes.map((resourceType) => (
196
- <DropdownButton
197
- aria-controls={ariaControlId}
198
- type="button"
199
- ref={(el) => this.createRef(el, resourceType.id)}
200
- onClick={() => this.onSelect(resourceType.id)}
201
- data-id={resourceType.id}
202
- key={resourceType.id}>
203
- <span>{resourceType.name}</span>
204
- </DropdownButton>
205
- ))}
206
- </DropdownWrapper>
207
- </FocusTrapReact>
208
- )}
209
- </DropdownContainer>
210
- );
211
- }
212
- }
186
+ ))}
187
+ </DropdownWrapper>
188
+ </FocusTrapReact>
189
+ )}
190
+ </DropdownContainer>
191
+ );
192
+ };
213
193
 
214
- export default withTranslation()(CategorySelect);
194
+ export default CategorySelect;
@@ -95,19 +95,20 @@ const StyledResourceDescription = styled.p`
95
95
  -webkit-box-orient: vertical;
96
96
  `;
97
97
 
98
- const TagsandActionMenu = styled.div`
98
+ interface TagsAndActionProps {
99
+ hasMenuButton: boolean;
100
+ }
101
+
102
+ const TagsandActionMenu = styled.div<TagsAndActionProps>`
99
103
  box-sizing: content-box;
100
104
  grid-area: tags;
101
- display: flex;
105
+ display: grid;
106
+ grid-template-columns: 1fr auto auto;
102
107
  align-items: center;
103
- width: 100%;
104
- overflow: hidden;
105
108
  align-self: flex-start;
106
- justify-self: flex-end;
107
- justify-content: flex-end;
108
- margin: -${spacing.small} -${spacing.small} 0 0;
109
+ margin: -${spacing.small} -${(props) => (props.hasMenuButton ? spacing.small : 0)} 0 0;
109
110
  ${mq.range({ until: breakpoints.mobileWide })} {
110
- margin: 0 -${spacing.small} -${spacing.small} 0;
111
+ margin: 0 -${(props) => (props.hasMenuButton ? spacing.small : 0)} -${spacing.small} 0;
111
112
  }
112
113
  `;
113
114
 
@@ -115,12 +116,6 @@ const TopicAndTitleWrapper = styled.div`
115
116
  grid-area: topicAndTitle;
116
117
  `;
117
118
 
118
- const StyledMenuButton = styled(MenuButton)`
119
- :only-child {
120
- margin-left: ${spacing.small};
121
- }
122
- `;
123
-
124
119
  interface ListResourceImageProps {
125
120
  resourceImage: ResourceImageProps;
126
121
  loading?: boolean;
@@ -245,9 +240,9 @@ const ListResource = ({
245
240
  </TypeAndTitleLoader>
246
241
  </TopicAndTitleWrapper>
247
242
  {showDescription && <Description description={description} loading={isLoading} />}
248
- <TagsandActionMenu>
243
+ <TagsandActionMenu hasMenuButton={!!(tags && tags.length > 3) || !!(menuItems && menuItems.length)}>
249
244
  {tags && tags.length > 0 && <CompressedTagList tagLinkPrefix={tagLinkPrefix} tags={tags} />}
250
- {menuItems && menuItems.length > 0 && <StyledMenuButton alignRight size="small" menuItems={menuItems} />}
245
+ {menuItems && menuItems.length > 0 && <MenuButton alignRight size="small" menuItems={menuItems} />}
251
246
  </TagsandActionMenu>
252
247
  </ListResourceWrapper>
253
248
  );
@@ -48,10 +48,6 @@ const StyledTagList = styled.ul`
48
48
  padding: 2px;
49
49
  gap: ${spacing.xsmall};
50
50
  overflow: hidden;
51
- padding-right: 14px;
52
- :only-child {
53
- margin-right: ${spacing.small};
54
- }
55
51
  `;
56
52
 
57
53
  const StyledTagListElement = styled.li`
@@ -11,7 +11,7 @@ import styled from '@emotion/styled';
11
11
  import { Cross } from '@ndla/icons/action';
12
12
  import { spacing, fonts } from '@ndla/core';
13
13
  import Button from '@ndla/button';
14
- import { WithTranslation, withTranslation } from 'react-i18next';
14
+ import { useTranslation } from 'react-i18next';
15
15
 
16
16
  export const StyledActiveFilterTitle = styled.span`
17
17
  white-space: nowrap;
@@ -35,18 +35,21 @@ type Props = {
35
35
  onFilterRemove: (value: string, name: string) => void;
36
36
  };
37
37
 
38
- const ActiveFilterContent = ({ filter, onFilterRemove, t }: Props & WithTranslation) => (
39
- <StyledButton
40
- aria-label={t('searchPage.searchFilterMessages.removeFilter', {
41
- filterName: filter.title,
42
- })}
43
- type="button"
44
- size="normal"
45
- borderShape="rounded"
46
- onClick={() => onFilterRemove(filter.value, filter.name)}>
47
- <StyledActiveFilterTitle>{filter.title}</StyledActiveFilterTitle>
48
- <Cross />
49
- </StyledButton>
50
- );
38
+ const ActiveFilterContent = ({ filter, onFilterRemove }: Props) => {
39
+ const { t } = useTranslation();
40
+ return (
41
+ <StyledButton
42
+ aria-label={t('searchPage.searchFilterMessages.removeFilter', {
43
+ filterName: filter.title,
44
+ })}
45
+ type="button"
46
+ size="normal"
47
+ borderShape="rounded"
48
+ onClick={() => onFilterRemove(filter.value, filter.name)}>
49
+ <StyledActiveFilterTitle>{filter.title}</StyledActiveFilterTitle>
50
+ <Cross />
51
+ </StyledButton>
52
+ );
53
+ };
51
54
 
52
- export default withTranslation()(ActiveFilterContent);
55
+ export default ActiveFilterContent;
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
  import React, { FormEvent, useEffect, useState } from 'react';
9
- import { WithTranslation, withTranslation } from 'react-i18next';
9
+ import { useTranslation } from 'react-i18next';
10
10
  import styled from '@emotion/styled';
11
11
  import { breakpoints, fonts, mq, spacing } from '@ndla/core';
12
12
  import Button from '@ndla/button';
@@ -84,8 +84,8 @@ const SearchHeader = ({
84
84
  filters,
85
85
  competenceGoals,
86
86
  noResults,
87
- t,
88
- }: Props & WithTranslation) => {
87
+ }: Props) => {
88
+ const { t } = useTranslation();
89
89
  const [isNarrowScreen, setIsNarrowScreen] = useState<boolean | undefined>();
90
90
 
91
91
  useEffect(() => {
@@ -158,4 +158,4 @@ const SearchHeader = ({
158
158
  );
159
159
  };
160
160
 
161
- export default withTranslation()(SearchHeader);
161
+ export default SearchHeader;
@@ -11,7 +11,6 @@ import { useTranslation } from 'react-i18next';
11
11
  import styled from '@emotion/styled';
12
12
  import { fonts, mq, breakpoints, spacing, colors } from '@ndla/core';
13
13
  import { ModalCloseButton } from '@ndla/modal';
14
- import { withTranslation, WithTranslation } from 'react-i18next';
15
14
 
16
15
  const Wrapper = styled.div`
17
16
  display: flex;
@@ -59,7 +58,7 @@ type Props = {
59
58
  children: ReactNode;
60
59
  };
61
60
 
62
- const SearchNotionsResult = ({ totalCount, onRemove, children }: Props & WithTranslation) => {
61
+ const SearchNotionsResult = ({ totalCount, onRemove, children }: Props) => {
63
62
  const { t } = useTranslation();
64
63
  return (
65
64
  <Wrapper>
@@ -75,4 +74,4 @@ const SearchNotionsResult = ({ totalCount, onRemove, children }: Props & WithTra
75
74
  );
76
75
  };
77
76
 
78
- export default withTranslation()(SearchNotionsResult);
77
+ export default SearchNotionsResult;
@@ -6,11 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
- import React, { MouseEvent, memo } from 'react'; // useMemo , { Children }
9
+ import React, { MouseEvent, memo } from 'react';
10
10
  import styled from '@emotion/styled';
11
11
  import Button from '@ndla/button';
12
12
  import { breakpoints, fonts, mq, spacing } from '@ndla/core';
13
- import { withTranslation, WithTranslation } from 'react-i18next';
13
+ import { useTranslation } from 'react-i18next';
14
14
  import { Cross } from '@ndla/icons/action';
15
15
  import ContentTypeBadge from '../ContentTypeBadge';
16
16
  import { ContentType } from './SearchTypeResult';
@@ -85,47 +85,50 @@ type Props = {
85
85
  totalCount: number;
86
86
  type?: ContentType;
87
87
  };
88
- const SearchTypeHeader = ({ filters = [], onFilterClick, totalCount, type, t }: Props & WithTranslation) => (
89
- <Wrapper>
90
- <HeaderWrapper>
91
- <TypeWrapper>
92
- {type && (
93
- <BadgeWrapper>
94
- <ContentTypeBadge type={type} title={t(`contentTypes.${type}`)} background border={false} size="large" />
95
- </BadgeWrapper>
96
- )}
97
- <SubjectName>
98
- <b>{type ? t(`contentTypes.${type}`) : t(`searchPage.resultType.allContentTypes`)}</b>{' '}
99
- {totalCount && <Count>{t(`searchPage.resultType.hits`, { count: totalCount })}</Count>}
100
- </SubjectName>
101
- </TypeWrapper>
102
- </HeaderWrapper>
103
- {filters.length > 0 && (
104
- <CategoryItems>
105
- {filters.map((option: FilterOptionsType) => (
106
- <CategoryTypeButtonWrapper key={option.id}>
107
- <Button
108
- size="xsmall"
109
- borderShape="rounded"
110
- greyLighter={!option.active}
111
- onClick={(e: MouseEvent<HTMLButtonElement>) => {
112
- if (e.currentTarget && option.active) {
113
- e.currentTarget.blur();
114
- }
115
- onFilterClick?.(option.id);
116
- }}>
117
- {option.name}
118
- {option.active && (
119
- <CategoryTypeCrossWrapper>
120
- <Cross />
121
- </CategoryTypeCrossWrapper>
122
- )}
123
- </Button>
124
- </CategoryTypeButtonWrapper>
125
- ))}
126
- </CategoryItems>
127
- )}
128
- </Wrapper>
129
- );
88
+ const SearchTypeHeader = ({ filters = [], onFilterClick, totalCount, type }: Props) => {
89
+ const { t } = useTranslation();
90
+ return (
91
+ <Wrapper>
92
+ <HeaderWrapper>
93
+ <TypeWrapper>
94
+ {type && (
95
+ <BadgeWrapper>
96
+ <ContentTypeBadge type={type} title={t(`contentTypes.${type}`)} background border={false} size="large" />
97
+ </BadgeWrapper>
98
+ )}
99
+ <SubjectName>
100
+ <b>{type ? t(`contentTypes.${type}`) : t(`searchPage.resultType.allContentTypes`)}</b>{' '}
101
+ {totalCount && <Count>{t(`searchPage.resultType.hits`, { count: totalCount })}</Count>}
102
+ </SubjectName>
103
+ </TypeWrapper>
104
+ </HeaderWrapper>
105
+ {filters.length > 0 && (
106
+ <CategoryItems>
107
+ {filters.map((option: FilterOptionsType) => (
108
+ <CategoryTypeButtonWrapper key={option.id}>
109
+ <Button
110
+ size="xsmall"
111
+ borderShape="rounded"
112
+ greyLighter={!option.active}
113
+ onClick={(e: MouseEvent<HTMLButtonElement>) => {
114
+ if (e.currentTarget && option.active) {
115
+ e.currentTarget.blur();
116
+ }
117
+ onFilterClick?.(option.id);
118
+ }}>
119
+ {option.name}
120
+ {option.active && (
121
+ <CategoryTypeCrossWrapper>
122
+ <Cross />
123
+ </CategoryTypeCrossWrapper>
124
+ )}
125
+ </Button>
126
+ </CategoryTypeButtonWrapper>
127
+ ))}
128
+ </CategoryItems>
129
+ )}
130
+ </Wrapper>
131
+ );
132
+ };
130
133
 
131
- export default memo(withTranslation()(SearchTypeHeader));
134
+ export default memo(SearchTypeHeader);