@ndla/ui 56.0.172-alpha.0 → 56.0.174-alpha.0

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 (267) hide show
  1. package/es/AnchorHeading/AnchorHeading.mjs +1 -1
  2. package/es/AnchorHeading/AnchorHeading.mjs.map +1 -1
  3. package/es/Article/Article.mjs +1 -8
  4. package/es/Article/Article.mjs.map +1 -1
  5. package/es/Article/ArticleByline.mjs +1 -1
  6. package/es/Article/ArticleByline.mjs.map +1 -1
  7. package/es/AudioPlayer/AudioPlayer.mjs +1 -1
  8. package/es/AudioPlayer/AudioPlayer.mjs.map +1 -1
  9. package/es/AudioPlayer/Controls.mjs +1 -1
  10. package/es/AudioPlayer/Controls.mjs.map +1 -1
  11. package/es/AudioPlayer/SpeechControl.mjs +1 -1
  12. package/es/AudioPlayer/SpeechControl.mjs.map +1 -1
  13. package/es/Breadcrumb/Breadcrumb.mjs +8 -1
  14. package/es/Breadcrumb/Breadcrumb.mjs.map +1 -1
  15. package/es/Breadcrumb/BreadcrumbItem.mjs +8 -1
  16. package/es/Breadcrumb/BreadcrumbItem.mjs.map +1 -1
  17. package/es/Breadcrumb/HomeBreadcrumb.mjs.map +1 -1
  18. package/es/CampaignBlock/CampaignBlock.mjs +1 -8
  19. package/es/CampaignBlock/CampaignBlock.mjs.map +1 -1
  20. package/es/CodeBlock/CodeBlock.mjs +1 -8
  21. package/es/CodeBlock/CodeBlock.mjs.map +1 -1
  22. package/es/Concept/Concept.mjs +1 -8
  23. package/es/Concept/Concept.mjs.map +1 -1
  24. package/es/ContactBlock/ContactBlock.mjs +0 -7
  25. package/es/ContactBlock/ContactBlock.mjs.map +1 -1
  26. package/es/Embed/AudioEmbed.mjs +1 -8
  27. package/es/Embed/AudioEmbed.mjs.map +1 -1
  28. package/es/Embed/BrightcoveEmbed.mjs +2 -9
  29. package/es/Embed/BrightcoveEmbed.mjs.map +1 -1
  30. package/es/Embed/CodeEmbed.mjs +1 -8
  31. package/es/Embed/CodeEmbed.mjs.map +1 -1
  32. package/es/Embed/ConceptEmbed.mjs +1 -8
  33. package/es/Embed/ConceptEmbed.mjs.map +1 -1
  34. package/es/Embed/ContentLinkEmbed.mjs.map +1 -1
  35. package/es/Embed/CopyrightEmbed.mjs.map +1 -1
  36. package/es/Embed/EmbedErrorPlaceholder.mjs +8 -1
  37. package/es/Embed/EmbedErrorPlaceholder.mjs.map +1 -1
  38. package/es/Embed/EmbedWrapper.mjs +1 -8
  39. package/es/Embed/EmbedWrapper.mjs.map +1 -1
  40. package/es/Embed/ExternalEmbed.mjs +1 -8
  41. package/es/Embed/ExternalEmbed.mjs.map +1 -1
  42. package/es/Embed/FootnoteEmbed.mjs +0 -7
  43. package/es/Embed/FootnoteEmbed.mjs.map +1 -1
  44. package/es/Embed/GlossEmbed.mjs +1 -8
  45. package/es/Embed/GlossEmbed.mjs.map +1 -1
  46. package/es/Embed/H5pEmbed.mjs +0 -7
  47. package/es/Embed/H5pEmbed.mjs.map +1 -1
  48. package/es/Embed/IframeEmbed.mjs +2 -9
  49. package/es/Embed/IframeEmbed.mjs.map +1 -1
  50. package/es/Embed/ImageEmbed.mjs +2 -9
  51. package/es/Embed/ImageEmbed.mjs.map +1 -1
  52. package/es/Embed/InlineTriggerButton.mjs +1 -1
  53. package/es/Embed/InlineTriggerButton.mjs.map +1 -1
  54. package/es/Embed/RelatedContentEmbed.mjs +0 -7
  55. package/es/Embed/RelatedContentEmbed.mjs.map +1 -1
  56. package/es/Embed/UnknownEmbed.mjs +0 -7
  57. package/es/Embed/UnknownEmbed.mjs.map +1 -1
  58. package/es/Embed/UuDisclaimerEmbed.mjs +1 -1
  59. package/es/Embed/UuDisclaimerEmbed.mjs.map +1 -1
  60. package/es/FactBox/FactBox.mjs +1 -1
  61. package/es/FactBox/FactBox.mjs.map +1 -1
  62. package/es/FileList/File.mjs +1 -1
  63. package/es/FileList/File.mjs.map +1 -1
  64. package/es/FileList/FileList.mjs +8 -1
  65. package/es/FileList/FileList.mjs.map +1 -1
  66. package/es/Gloss/Gloss.mjs +1 -8
  67. package/es/Gloss/Gloss.mjs.map +1 -1
  68. package/es/Gloss/GlossExample.mjs +1 -8
  69. package/es/Gloss/GlossExample.mjs.map +1 -1
  70. package/es/Grid/Grid.mjs +1 -1
  71. package/es/Grid/Grid.mjs.map +1 -1
  72. package/es/KeyFigure/KeyFigure.mjs.map +1 -1
  73. package/es/LicenseByline/EmbedByline.mjs +1 -8
  74. package/es/LicenseByline/EmbedByline.mjs.map +1 -1
  75. package/es/LicenseByline/LicenseLink.mjs +1 -8
  76. package/es/LicenseByline/LicenseLink.mjs.map +1 -1
  77. package/es/LinkBlock/LinkBlock.mjs +1 -8
  78. package/es/LinkBlock/LinkBlock.mjs.map +1 -1
  79. package/es/LinkBlock/LinkBlockSection.mjs +1 -1
  80. package/es/LinkBlock/LinkBlockSection.mjs.map +1 -1
  81. package/es/Pitch/Pitch.mjs.map +1 -1
  82. package/es/RelatedArticleList/RelatedArticleList.mjs +1 -1
  83. package/es/RelatedArticleList/RelatedArticleList.mjs.map +1 -1
  84. package/es/TagSelector/TagSelector.mjs +1 -1
  85. package/es/TagSelector/TagSelector.mjs.map +1 -1
  86. package/es/ZendeskButton/ZendeskButton.mjs +1 -1
  87. package/es/ZendeskButton/ZendeskButton.mjs.map +1 -1
  88. package/es/i18n/useComponentTranslations.mjs +0 -7
  89. package/es/i18n/useComponentTranslations.mjs.map +1 -1
  90. package/es/model/ContentType.mjs +8 -1
  91. package/es/model/ContentType.mjs.map +1 -1
  92. package/lib/AnchorHeading/AnchorHeading.js +1 -1
  93. package/lib/AnchorHeading/AnchorHeading.js.map +1 -1
  94. package/lib/Article/Article.d.ts +1 -1
  95. package/lib/Article/Article.js +1 -8
  96. package/lib/Article/Article.js.map +1 -1
  97. package/lib/Article/ArticleByline.d.ts +1 -1
  98. package/lib/Article/ArticleByline.js +1 -1
  99. package/lib/Article/ArticleByline.js.map +1 -1
  100. package/lib/AudioPlayer/AudioPlayer.js +1 -1
  101. package/lib/AudioPlayer/AudioPlayer.js.map +1 -1
  102. package/lib/AudioPlayer/Controls.js +1 -1
  103. package/lib/AudioPlayer/Controls.js.map +1 -1
  104. package/lib/AudioPlayer/SpeechControl.js +1 -1
  105. package/lib/AudioPlayer/SpeechControl.js.map +1 -1
  106. package/lib/Breadcrumb/Breadcrumb.js +1 -1
  107. package/lib/Breadcrumb/Breadcrumb.js.map +1 -1
  108. package/lib/Breadcrumb/BreadcrumbItem.js +1 -1
  109. package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -1
  110. package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -1
  111. package/lib/CampaignBlock/CampaignBlock.js +1 -8
  112. package/lib/CampaignBlock/CampaignBlock.js.map +1 -1
  113. package/lib/CodeBlock/CodeBlock.d.ts +1 -1
  114. package/lib/CodeBlock/CodeBlock.js +1 -8
  115. package/lib/CodeBlock/CodeBlock.js.map +1 -1
  116. package/lib/Concept/Concept.d.ts +1 -1
  117. package/lib/Concept/Concept.js +1 -8
  118. package/lib/Concept/Concept.js.map +1 -1
  119. package/lib/ContactBlock/ContactBlock.js +0 -7
  120. package/lib/ContactBlock/ContactBlock.js.map +1 -1
  121. package/lib/Embed/AudioEmbed.js +1 -8
  122. package/lib/Embed/AudioEmbed.js.map +1 -1
  123. package/lib/Embed/BrightcoveEmbed.js +2 -9
  124. package/lib/Embed/BrightcoveEmbed.js.map +1 -1
  125. package/lib/Embed/CodeEmbed.js +1 -8
  126. package/lib/Embed/CodeEmbed.js.map +1 -1
  127. package/lib/Embed/ConceptEmbed.d.ts +1 -1
  128. package/lib/Embed/ConceptEmbed.js +1 -8
  129. package/lib/Embed/ConceptEmbed.js.map +1 -1
  130. package/lib/Embed/ContentLinkEmbed.d.ts +1 -1
  131. package/lib/Embed/ContentLinkEmbed.js.map +1 -1
  132. package/lib/Embed/CopyrightEmbed.d.ts +1 -1
  133. package/lib/Embed/CopyrightEmbed.js.map +1 -1
  134. package/lib/Embed/EmbedErrorPlaceholder.d.ts +1 -1
  135. package/lib/Embed/EmbedErrorPlaceholder.js +1 -1
  136. package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -1
  137. package/lib/Embed/EmbedWrapper.d.ts +1 -1
  138. package/lib/Embed/EmbedWrapper.js +1 -8
  139. package/lib/Embed/EmbedWrapper.js.map +1 -1
  140. package/lib/Embed/ExternalEmbed.js +1 -8
  141. package/lib/Embed/ExternalEmbed.js.map +1 -1
  142. package/lib/Embed/FootnoteEmbed.js +0 -7
  143. package/lib/Embed/FootnoteEmbed.js.map +1 -1
  144. package/lib/Embed/GlossEmbed.d.ts +1 -1
  145. package/lib/Embed/GlossEmbed.js +1 -8
  146. package/lib/Embed/GlossEmbed.js.map +1 -1
  147. package/lib/Embed/H5pEmbed.js +0 -7
  148. package/lib/Embed/H5pEmbed.js.map +1 -1
  149. package/lib/Embed/IframeEmbed.js +2 -9
  150. package/lib/Embed/IframeEmbed.js.map +1 -1
  151. package/lib/Embed/ImageEmbed.d.ts +1 -1
  152. package/lib/Embed/ImageEmbed.js +2 -9
  153. package/lib/Embed/ImageEmbed.js.map +1 -1
  154. package/lib/Embed/InlineTriggerButton.js +1 -1
  155. package/lib/Embed/InlineTriggerButton.js.map +1 -1
  156. package/lib/Embed/RelatedContentEmbed.js +0 -7
  157. package/lib/Embed/RelatedContentEmbed.js.map +1 -1
  158. package/lib/Embed/UnknownEmbed.js +0 -7
  159. package/lib/Embed/UnknownEmbed.js.map +1 -1
  160. package/lib/Embed/UuDisclaimerEmbed.d.ts +1 -1
  161. package/lib/Embed/UuDisclaimerEmbed.js +1 -8
  162. package/lib/Embed/UuDisclaimerEmbed.js.map +1 -1
  163. package/lib/Embed/types.d.ts +1 -1
  164. package/lib/FactBox/FactBox.js +2 -2
  165. package/lib/FactBox/FactBox.js.map +1 -1
  166. package/lib/FileList/File.js +1 -1
  167. package/lib/FileList/File.js.map +1 -1
  168. package/lib/FileList/FileList.js +1 -1
  169. package/lib/FileList/FileList.js.map +1 -1
  170. package/lib/Gloss/Gloss.js +1 -8
  171. package/lib/Gloss/Gloss.js.map +1 -1
  172. package/lib/Gloss/GlossExample.js +1 -8
  173. package/lib/Gloss/GlossExample.js.map +1 -1
  174. package/lib/Grid/Grid.d.ts +1 -1
  175. package/lib/Grid/Grid.js +1 -8
  176. package/lib/Grid/Grid.js.map +1 -1
  177. package/lib/KeyFigure/KeyFigure.js.map +1 -1
  178. package/lib/LicenseByline/EmbedByline.d.ts +1 -1
  179. package/lib/LicenseByline/EmbedByline.js +1 -8
  180. package/lib/LicenseByline/EmbedByline.js.map +1 -1
  181. package/lib/LicenseByline/LicenseLink.js +1 -8
  182. package/lib/LicenseByline/LicenseLink.js.map +1 -1
  183. package/lib/LinkBlock/LinkBlock.js +1 -8
  184. package/lib/LinkBlock/LinkBlock.js.map +1 -1
  185. package/lib/LinkBlock/LinkBlockSection.js +1 -1
  186. package/lib/LinkBlock/LinkBlockSection.js.map +1 -1
  187. package/lib/Pitch/Pitch.js.map +1 -1
  188. package/lib/RelatedArticleList/RelatedArticleList.js +1 -1
  189. package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -1
  190. package/lib/TagSelector/TagSelector.js +1 -1
  191. package/lib/TagSelector/TagSelector.js.map +1 -1
  192. package/lib/ZendeskButton/ZendeskButton.js +1 -1
  193. package/lib/ZendeskButton/ZendeskButton.js.map +1 -1
  194. package/lib/i18n/useComponentTranslations.js +0 -7
  195. package/lib/i18n/useComponentTranslations.js.map +1 -1
  196. package/lib/model/ContentType.d.ts +5 -0
  197. package/lib/model/ContentType.js +8 -1
  198. package/lib/model/ContentType.js.map +1 -1
  199. package/lib/model/index.d.ts +2 -0
  200. package/package.json +9 -9
  201. package/src/AnchorHeading/AnchorHeading.tsx +1 -1
  202. package/src/Article/Article.tsx +2 -2
  203. package/src/Article/ArticleByline.stories.tsx +0 -1
  204. package/src/Article/ArticleByline.tsx +3 -3
  205. package/src/AudioPlayer/AudioPlayer.tsx +2 -2
  206. package/src/AudioPlayer/Controls.tsx +2 -2
  207. package/src/AudioPlayer/SpeechControl.tsx +2 -2
  208. package/src/Breadcrumb/Breadcrumb.tsx +1 -1
  209. package/src/Breadcrumb/BreadcrumbItem.tsx +1 -1
  210. package/src/Breadcrumb/HomeBreadcrumb.tsx +1 -1
  211. package/src/CampaignBlock/CampaignBlock.tsx +3 -3
  212. package/src/CodeBlock/CodeBlock.tsx +2 -2
  213. package/src/Concept/Concept.stories.tsx +1 -1
  214. package/src/Concept/Concept.tsx +3 -3
  215. package/src/ContactBlock/ContactBlock.tsx +3 -3
  216. package/src/Embed/AudioEmbed.stories.tsx +2 -2
  217. package/src/Embed/AudioEmbed.tsx +2 -2
  218. package/src/Embed/BrightcoveEmbed.stories.tsx +2 -2
  219. package/src/Embed/BrightcoveEmbed.tsx +4 -4
  220. package/src/Embed/CodeEmbed.stories.tsx +1 -1
  221. package/src/Embed/CodeEmbed.tsx +4 -4
  222. package/src/Embed/ConceptEmbed.stories.tsx +2 -2
  223. package/src/Embed/ConceptEmbed.tsx +5 -5
  224. package/src/Embed/ContentLinkEmbed.tsx +2 -2
  225. package/src/Embed/CopyrightEmbed.tsx +1 -1
  226. package/src/Embed/EmbedErrorPlaceholder.tsx +1 -1
  227. package/src/Embed/EmbedWrapper.tsx +2 -2
  228. package/src/Embed/ExternalEmbed.stories.tsx +2 -2
  229. package/src/Embed/ExternalEmbed.tsx +4 -4
  230. package/src/Embed/FootnoteEmbed.stories.tsx +2 -2
  231. package/src/Embed/FootnoteEmbed.tsx +2 -2
  232. package/src/Embed/GlossEmbed.stories.tsx +2 -2
  233. package/src/Embed/GlossEmbed.tsx +3 -3
  234. package/src/Embed/H5pEmbed.stories.tsx +2 -2
  235. package/src/Embed/H5pEmbed.tsx +2 -2
  236. package/src/Embed/IframeEmbed.stories.tsx +2 -2
  237. package/src/Embed/IframeEmbed.tsx +5 -5
  238. package/src/Embed/ImageEmbed.stories.tsx +4 -4
  239. package/src/Embed/ImageEmbed.tsx +5 -5
  240. package/src/Embed/InlineTriggerButton.tsx +1 -1
  241. package/src/Embed/RelatedContentEmbed.stories.tsx +2 -2
  242. package/src/Embed/RelatedContentEmbed.tsx +1 -1
  243. package/src/Embed/UnknownEmbed.tsx +2 -2
  244. package/src/Embed/UuDisclaimerEmbed.stories.tsx +4 -4
  245. package/src/Embed/UuDisclaimerEmbed.tsx +3 -3
  246. package/src/Embed/types.ts +1 -1
  247. package/src/FactBox/FactBox.tsx +3 -3
  248. package/src/FileList/File.tsx +2 -2
  249. package/src/FileList/FileList.tsx +1 -1
  250. package/src/Gloss/Gloss.stories.tsx +1 -1
  251. package/src/Gloss/Gloss.tsx +6 -6
  252. package/src/Gloss/GlossExample.tsx +2 -2
  253. package/src/Grid/Grid.stories.tsx +1 -1
  254. package/src/Grid/Grid.tsx +2 -2
  255. package/src/KeyFigure/KeyFigure.tsx +1 -1
  256. package/src/LicenseByline/EmbedByline.tsx +6 -6
  257. package/src/LicenseByline/LicenseLink.tsx +1 -1
  258. package/src/LinkBlock/LinkBlock.tsx +3 -3
  259. package/src/LinkBlock/LinkBlockSection.tsx +1 -1
  260. package/src/Pitch/Pitch.stories.tsx +1 -1
  261. package/src/Pitch/Pitch.tsx +1 -1
  262. package/src/RelatedArticleList/RelatedArticleList.tsx +2 -2
  263. package/src/TagSelector/TagSelector.stories.tsx +3 -4
  264. package/src/TagSelector/TagSelector.tsx +1 -1
  265. package/src/ZendeskButton/ZendeskButton.tsx +1 -1
  266. package/src/i18n/useComponentTranslations.ts +2 -2
  267. package/src/model/ContentType.ts +7 -0
@@ -1 +1 @@
1
- {"version":3,"file":"useComponentTranslations.js","names":[],"sources":["../../src/i18n/useComponentTranslations.ts"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { useTranslation } from \"react-i18next\";\nimport type { CollectionItem } from \"@ark-ui/react\";\nimport type { ComboboxRootProps, PaginationRootProps, TagsInputRootProps, DatePickerRootProps } from \"@ndla/primitives\";\nimport { type TagSelectorRootProps } from \"../TagSelector/TagSelector\";\nimport { useMemo } from \"react\";\n\ntype DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\nexport const useTagsInputTranslations = (\n translations?: Partial<TagsInputRootProps[\"translations\"]>,\n): TagsInputRootProps[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.tagsInput\" });\n\n return useMemo(\n () => ({\n clearTriggerLabel: t(\"clearTriggerLabel\"),\n deleteTagTriggerLabel: (tag) => t(\"deleteTagTriggerLabel\", { tag }),\n tagAdded: (tag) => t(\"tagAdded\", { tag }),\n tagsPasted: (tag) => t(\"tagsPasted\", { length: tag.length }),\n tagEdited: (tag) => t(\"tagEdited\", { tag }),\n tagUpdated: (tag) => t(\"tagUpdated\", { tag }),\n tagDeleted: (tag) => t(\"tagDeleted\", { tag }),\n tagSelected: (tag) => t(\"tagSelected\", { tag }),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useComboboxTranslations = <T extends CollectionItem>(\n translations?: Partial<ComboboxRootProps<T>[\"translations\"]>,\n): ComboboxRootProps<T>[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.combobox\" });\n\n return useMemo(\n () => ({\n triggerLabel: t(\"triggerLabel\"),\n clearTriggerLabel: t(\"clearTriggerLabel\"),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useTagSelectorTranslations = <T extends CollectionItem>(\n translations?: Partial<TagSelectorRootProps<T>[\"translations\"]>,\n): TagSelectorRootProps<T>[\"translations\"] => {\n const tagsInputTranslations = useTagsInputTranslations();\n const comboboxTranslations = useComboboxTranslations();\n\n return useMemo(\n () =>\n ({\n ...comboboxTranslations,\n ...tagsInputTranslations,\n ...translations,\n }) as TagSelectorRootProps<T>[\"translations\"],\n [comboboxTranslations, tagsInputTranslations, translations],\n );\n};\n\nexport const usePaginationTranslations = (\n translations?: Partial<PaginationRootProps[\"translations\"]>,\n): PaginationRootProps[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.pagination\" });\n\n return useMemo(\n () => ({\n rootLabel: t(\"rootLabel\"),\n prevTriggerLabel: t(\"prevTriggerLabel\"),\n nextTriggerLabel: t(\"nextTriggerLabel\"),\n itemLabel: (details) => {\n const lastPage = details.totalPages > 1 && details.page === details.totalPages;\n return lastPage ? t(\"lastPage\", { page: details.page }) : t(\"page\", { page: details.page });\n },\n ...translations,\n }),\n [translations, t],\n );\n};\n\n// TODO: Deduplicate this and place it somewhere smart. Maybe core?\ninterface AudioSearchTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n useAudio: string;\n noResults: string;\n paginationTranslations: PaginationRootProps[\"translations\"];\n}\n\ninterface VideoTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n loadMoreVideos: string;\n noResults: string;\n is360Video: string;\n previewVideo: string;\n addVideo: string;\n close: string;\n}\ninterface PreviewTranslations {\n creatorsLabel: string;\n license: string;\n caption: string;\n altText: string;\n modelRelease: string;\n tags: string;\n close: string;\n checkboxLabel?: string;\n missingTitleFallback?: string;\n useImageTitle: string;\n}\n\ninterface ImageSearchTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n imagePreview: PreviewTranslations;\n paginationTranslations: PaginationRootProps[\"translations\"];\n}\n\nexport const useImageSearchTranslations = (\n translations: DeepPartial<ImageSearchTranslations> = {},\n): ImageSearchTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.imageSearch\" });\n const paginationTranslations = usePaginationTranslations();\n\n const { imagePreview, paginationTranslations: fallbackPaginationTranslations, ...remaining } = translations;\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n imagePreview: {\n creatorsLabel: t(\"imagePreview.creatorsLabel\"),\n license: t(\"imagePreview.license\"),\n caption: t(\"imagePreview.caption\"),\n altText: t(\"imagePreview.altText\"),\n modelRelease: t(\"imagePreview.modelRelease\"),\n tags: t(\"imagePreview.tags\"),\n close: t(\"close\"),\n checkboxLabel: t(\"imagePreview.checkboxLabel\"),\n useImageTitle: t(\"imagePreview.useImageTitle\"),\n ...imagePreview,\n },\n paginationTranslations: { ...paginationTranslations, ...fallbackPaginationTranslations },\n ...remaining,\n }),\n [t, paginationTranslations, imagePreview, fallbackPaginationTranslations, remaining],\n );\n};\n\nexport const useAudioSearchTranslations = (\n translations: DeepPartial<AudioSearchTranslations> = {},\n): AudioSearchTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.audioSearch\" });\n const paginationTranslations = usePaginationTranslations();\n\n const { paginationTranslations: fallbackPaginationTranslations, ...remaining } = translations;\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n useAudio: t(\"useAudio\"),\n noResults: t(\"noResults\"),\n paginationTranslations: { ...paginationTranslations, ...fallbackPaginationTranslations },\n ...remaining,\n }),\n [t, paginationTranslations, fallbackPaginationTranslations, remaining],\n );\n};\n\nexport const useVideoSearchTranslations = (translations?: Partial<VideoTranslations>): VideoTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.videoSearch\" });\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n loadMoreVideos: t(\"loadMoreVideos\"),\n noResults: t(\"noResults\"),\n is360Video: t(\"is360Video\"),\n previewVideo: t(\"previewVideo\"),\n addVideo: t(\"addVideo\"),\n close: t(\"close\"),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useDatePickerTranslations = (\n translations?: Partial<DatePickerRootProps[\"translations\"]>,\n): NonNullable<DatePickerRootProps[\"translations\"]> => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.datePicker\" });\n\n return useMemo(\n () => ({\n dayCell: (state) => {\n if (state.unavailable) {\n return t(\"dayCell.unavailable\", { date: state.formattedDate });\n } else if (state.selected) {\n return t(\"dayCell.selected\", { date: state.formattedDate });\n } else return t(\"dayCell.select\", { date: state.formattedDate });\n },\n nextTrigger: (view) => t(`nextTrigger.${view}`),\n prevTrigger: (view) => t(`prevTrigger.${view}`),\n monthSelect: t(\"monthSelect\"),\n yearSelect: t(\"yearSelect\"),\n viewTrigger: (view) => t(`viewTrigger.${view}`),\n presetTrigger: (value) => {\n if (Array.isArray(value)) {\n return t(\"presetTrigger.range\", { start: value[0], end: value[1] });\n } else return t(\"presetTrigger.single\", { date: value });\n },\n clearTrigger: t(\"clearTrigger\"),\n trigger: (open) => t(`trigger.${open ? \"close\" : \"open\"}`),\n content: t(\"content\"),\n placeholder: (_locale) => {\n return { day: \"dd\", month: \"mm\", year: \"yyyy\" };\n },\n ...translations,\n }),\n [t, translations],\n );\n};\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAa,4BACX,iBACuC;CACvC,MAAM,EAAE,wCAAqB,eAAe,EAAE,WAAW,uBAAuB,CAAC;AAEjF,kCACS;EACL,mBAAmB,EAAE,oBAAoB;EACzC,wBAAwB,QAAQ,EAAE,yBAAyB,EAAE,KAAK,CAAC;EACnE,WAAW,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC;EACzC,aAAa,QAAQ,EAAE,cAAc,EAAE,QAAQ,IAAI,QAAQ,CAAC;EAC5D,YAAY,QAAQ,EAAE,aAAa,EAAE,KAAK,CAAC;EAC3C,aAAa,QAAQ,EAAE,cAAc,EAAE,KAAK,CAAC;EAC7C,aAAa,QAAQ,EAAE,cAAc,EAAE,KAAK,CAAC;EAC7C,cAAc,QAAQ,EAAE,eAAe,EAAE,KAAK,CAAC;EAC/C,GAAG;EACJ,GACD,CAAC,GAAG,aAAa,CAClB;;AAGH,MAAa,2BACX,iBACyC;CACzC,MAAM,EAAE,wCAAqB,eAAe,EAAE,WAAW,sBAAsB,CAAC;AAEhF,kCACS;EACL,cAAc,EAAE,e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E,cAAc;EAC7B,YAAY,EAAE,aAAa;EAC3B,cAAc,SAAS,EAAE,eAAe,OAAO;EAC/C,gBAAgB,UAAU;AACxB,OAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,EAAE,uBAAuB;IAAE,OAAO,MAAM;IAAI,KAAK,MAAM;IAAI,CAAC;OAC9D,QAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;;EAE1D,cAAc,EAAE,eAAe;EAC/B,UAAU,SAAS,EAAE,WAAW,OAAO,UAAU,SAAS;EAC1D,SAAS,EAAE,UAAU;EACrB,cAAc,YAAY;AACxB,UAAO;IAAE,KAAK;IAAM,OAAO;IAAM,MAAM;IAAQ;;EAEjD,GAAG;EACJ,GACD,CAAC,GAAG,aAAa,CAClB"}
1
+ {"version":3,"file":"useComponentTranslations.js","names":[],"sources":["../../src/i18n/useComponentTranslations.ts"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { CollectionItem } from \"@ark-ui/react\";\nimport type { ComboboxRootProps, PaginationRootProps, TagsInputRootProps, DatePickerRootProps } from \"@ndla/primitives\";\nimport { useMemo } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { type TagSelectorRootProps } from \"../TagSelector/TagSelector\";\n\ntype DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\nexport const useTagsInputTranslations = (\n translations?: Partial<TagsInputRootProps[\"translations\"]>,\n): TagsInputRootProps[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.tagsInput\" });\n\n return useMemo(\n () => ({\n clearTriggerLabel: t(\"clearTriggerLabel\"),\n deleteTagTriggerLabel: (tag) => t(\"deleteTagTriggerLabel\", { tag }),\n tagAdded: (tag) => t(\"tagAdded\", { tag }),\n tagsPasted: (tag) => t(\"tagsPasted\", { length: tag.length }),\n tagEdited: (tag) => t(\"tagEdited\", { tag }),\n tagUpdated: (tag) => t(\"tagUpdated\", { tag }),\n tagDeleted: (tag) => t(\"tagDeleted\", { tag }),\n tagSelected: (tag) => t(\"tagSelected\", { tag }),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useComboboxTranslations = <T extends CollectionItem>(\n translations?: Partial<ComboboxRootProps<T>[\"translations\"]>,\n): ComboboxRootProps<T>[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.combobox\" });\n\n return useMemo(\n () => ({\n triggerLabel: t(\"triggerLabel\"),\n clearTriggerLabel: t(\"clearTriggerLabel\"),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useTagSelectorTranslations = <T extends CollectionItem>(\n translations?: Partial<TagSelectorRootProps<T>[\"translations\"]>,\n): TagSelectorRootProps<T>[\"translations\"] => {\n const tagsInputTranslations = useTagsInputTranslations();\n const comboboxTranslations = useComboboxTranslations();\n\n return useMemo(\n () =>\n ({\n ...comboboxTranslations,\n ...tagsInputTranslations,\n ...translations,\n }) as TagSelectorRootProps<T>[\"translations\"],\n [comboboxTranslations, tagsInputTranslations, translations],\n );\n};\n\nexport const usePaginationTranslations = (\n translations?: Partial<PaginationRootProps[\"translations\"]>,\n): PaginationRootProps[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.pagination\" });\n\n return useMemo(\n () => ({\n rootLabel: t(\"rootLabel\"),\n prevTriggerLabel: t(\"prevTriggerLabel\"),\n nextTriggerLabel: t(\"nextTriggerLabel\"),\n itemLabel: (details) => {\n const lastPage = details.totalPages > 1 && details.page === details.totalPages;\n return lastPage ? t(\"lastPage\", { page: details.page }) : t(\"page\", { page: details.page });\n },\n ...translations,\n }),\n [translations, t],\n );\n};\n\n// TODO: Deduplicate this and place it somewhere smart. Maybe core?\ninterface AudioSearchTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n useAudio: string;\n noResults: string;\n paginationTranslations: PaginationRootProps[\"translations\"];\n}\n\ninterface VideoTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n loadMoreVideos: string;\n noResults: string;\n is360Video: string;\n previewVideo: string;\n addVideo: string;\n close: string;\n}\ninterface PreviewTranslations {\n creatorsLabel: string;\n license: string;\n caption: string;\n altText: string;\n modelRelease: string;\n tags: string;\n close: string;\n checkboxLabel?: string;\n missingTitleFallback?: string;\n useImageTitle: string;\n}\n\ninterface ImageSearchTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n imagePreview: PreviewTranslations;\n paginationTranslations: PaginationRootProps[\"translations\"];\n}\n\nexport const useImageSearchTranslations = (\n translations: DeepPartial<ImageSearchTranslations> = {},\n): ImageSearchTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.imageSearch\" });\n const paginationTranslations = usePaginationTranslations();\n\n const { imagePreview, paginationTranslations: fallbackPaginationTranslations, ...remaining } = translations;\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n imagePreview: {\n creatorsLabel: t(\"imagePreview.creatorsLabel\"),\n license: t(\"imagePreview.license\"),\n caption: t(\"imagePreview.caption\"),\n altText: t(\"imagePreview.altText\"),\n modelRelease: t(\"imagePreview.modelRelease\"),\n tags: t(\"imagePreview.tags\"),\n close: t(\"close\"),\n checkboxLabel: t(\"imagePreview.checkboxLabel\"),\n useImageTitle: t(\"imagePreview.useImageTitle\"),\n ...imagePreview,\n },\n paginationTranslations: { ...paginationTranslations, ...fallbackPaginationTranslations },\n ...remaining,\n }),\n [t, paginationTranslations, imagePreview, fallbackPaginationTranslations, remaining],\n );\n};\n\nexport const useAudioSearchTranslations = (\n translations: DeepPartial<AudioSearchTranslations> = {},\n): AudioSearchTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.audioSearch\" });\n const paginationTranslations = usePaginationTranslations();\n\n const { paginationTranslations: fallbackPaginationTranslations, ...remaining } = translations;\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n useAudio: t(\"useAudio\"),\n noResults: t(\"noResults\"),\n paginationTranslations: { ...paginationTranslations, ...fallbackPaginationTranslations },\n ...remaining,\n }),\n [t, paginationTranslations, fallbackPaginationTranslations, remaining],\n );\n};\n\nexport const useVideoSearchTranslations = (translations?: Partial<VideoTranslations>): VideoTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.videoSearch\" });\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n loadMoreVideos: t(\"loadMoreVideos\"),\n noResults: t(\"noResults\"),\n is360Video: t(\"is360Video\"),\n previewVideo: t(\"previewVideo\"),\n addVideo: t(\"addVideo\"),\n close: t(\"close\"),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useDatePickerTranslations = (\n translations?: Partial<DatePickerRootProps[\"translations\"]>,\n): NonNullable<DatePickerRootProps[\"translations\"]> => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.datePicker\" });\n\n return useMemo(\n () => ({\n dayCell: (state) => {\n if (state.unavailable) {\n return t(\"dayCell.unavailable\", { date: state.formattedDate });\n } else if (state.selected) {\n return t(\"dayCell.selected\", { date: state.formattedDate });\n } else return t(\"dayCell.select\", { date: state.formattedDate });\n },\n nextTrigger: (view) => t(`nextTrigger.${view}`),\n prevTrigger: (view) => t(`prevTrigger.${view}`),\n monthSelect: t(\"monthSelect\"),\n yearSelect: t(\"yearSelect\"),\n viewTrigger: (view) => t(`viewTrigger.${view}`),\n presetTrigger: (value) => {\n if (Array.isArray(value)) {\n return t(\"presetTrigger.range\", { start: value[0], end: value[1] });\n } else return t(\"presetTrigger.single\", { date: value });\n },\n clearTrigger: t(\"clearTrigger\"),\n trigger: (open) => t(`trigger.${open ? \"close\" : \"open\"}`),\n content: t(\"content\"),\n placeholder: (_locale) => {\n return { day: \"dd\", month: \"mm\", year: \"yyy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
24
  export declare const PROGRAMME = "programme";
25
25
  export declare const PODCAST_SERIES = "podcast-series";
26
26
  export declare const FRONTPAGE_ARTICLE = "frontpage-article";
27
+ export declare const GAME = "game";
28
+ export declare const CASE = "case";
27
29
  export declare const contentTypes: {
28
30
  SUBJECT_MATERIAL: string;
29
31
  TASKS_AND_ACTIVITIES: string;
@@ -38,6 +40,8 @@ export declare const contentTypes: {
38
40
  MISSING: string;
39
41
  PROGRAMME: string;
40
42
  PODCAST_SERIES: string;
43
+ GAME: string;
44
+ CASE: string;
41
45
  };
42
46
  export declare const RESOURCE_TYPE_LEARNING_PATH = "urn:resourcetype:learningPath";
43
47
  export declare const RESOURCE_TYPE_SUBJECT_MATERIAL = "urn:resourcetype:subjectMaterial";
@@ -45,5 +49,6 @@ export declare const RESOURCE_TYPE_TASKS_AND_ACTIVITIES = "urn:resourcetype:task
45
49
  export declare const RESOURCE_TYPE_ASSESSMENT_RESOURCES = "urn:resourcetype:reviewResource";
46
50
  export declare const RESOURCE_TYPE_SOURCE_MATERIAL = "urn:resourcetype:SourceMaterial";
47
51
  export declare const RESOURCE_TYPE_CONCEPT = "urn:resourcetype:concept";
52
+ export declare const RESOURCE_TYPE_GAME = "urn:resourcetype:game";
48
53
  export declare const contentTypeMapping: Record<string, string>;
49
54
  export declare const resourceEmbedTypeMapping: Record<string, string>;
@@ -21,6 +21,8 @@ const MISSING = "missing";
21
21
  const PROGRAMME = "programme";
22
22
  const PODCAST_SERIES = "podcast-series";
23
23
  const FRONTPAGE_ARTICLE = "frontpage-article";
24
+ const GAME = "game";
25
+ const CASE = "case";
24
26
  const contentTypes = {
25
27
  SUBJECT_MATERIAL,
26
28
  TASKS_AND_ACTIVITIES,
@@ -34,7 +36,9 @@ const contentTypes = {
34
36
  EXTERNAL,
35
37
  MISSING,
36
38
  PROGRAMME,
37
- PODCAST_SERIES
39
+ PODCAST_SERIES,
40
+ GAME,
41
+ CASE
38
42
  };
39
43
  const RESOURCE_TYPE_LEARNING_PATH = "urn:resourcetype:learningPath";
40
44
  const RESOURCE_TYPE_SUBJECT_MATERIAL = "urn:resourcetype:subjectMaterial";
@@ -42,6 +46,7 @@ const RESOURCE_TYPE_TASKS_AND_ACTIVITIES = "urn:resourcetype:tasksAndActivities"
42
46
  const RESOURCE_TYPE_ASSESSMENT_RESOURCES = "urn:resourcetype:reviewResource";
43
47
  const RESOURCE_TYPE_SOURCE_MATERIAL = "urn:resourcetype:SourceMaterial";
44
48
  const RESOURCE_TYPE_CONCEPT = "urn:resourcetype:concept";
49
+ const RESOURCE_TYPE_GAME = "urn:resourcetype:game";
45
50
  const contentTypeMapping = {
46
51
  [RESOURCE_TYPE_LEARNING_PATH]: LEARNING_PATH,
47
52
  [RESOURCE_TYPE_SUBJECT_MATERIAL]: SUBJECT_MATERIAL,
@@ -49,7 +54,9 @@ const contentTypeMapping = {
49
54
  [RESOURCE_TYPE_ASSESSMENT_RESOURCES]: ASSESSMENT_RESOURCES,
50
55
  [RESOURCE_TYPE_SOURCE_MATERIAL]: SOURCE_MATERIAL,
51
56
  [RESOURCE_TYPE_CONCEPT]: CONCEPT,
57
+ [RESOURCE_TYPE_GAME]: GAME,
52
58
  [MULTIDISCIPLINARY]: MULTIDISCIPLINARY,
59
+ [CASE]: CASE,
53
60
  [TOPIC]: TOPIC,
54
61
  [FRONTPAGE_ARTICLE]: FRONTPAGE_ARTICLE,
55
62
  default: SUBJECT_MATERIAL
@@ -1 +1 @@
1
- {"version":3,"file":"ContentType.js","names":[],"sources":["../../src/model/ContentType.ts"],"sourcesContent":["/**\n * Copyright (c) 2017-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nexport const SUBJECT_MATERIAL = \"subject-material\";\nexport const TASKS_AND_ACTIVITIES = \"tasks-and-activities\";\nexport const ASSESSMENT_RESOURCES = \"assessment-resources\";\nexport const SUBJECT = \"subject\";\nexport const SOURCE_MATERIAL = \"source-material\";\nexport const LEARNING_PATH = \"learning-path\";\nexport const TOPIC = \"topic\";\nexport const MULTIDISCIPLINARY = \"multidisciplinary\";\nexport const CONCEPT = \"concept\";\nexport const EXTERNAL = \"external\";\nexport const MISSING = \"missing\";\nexport const IMAGE = \"image\";\nexport const VIDEO = \"video\";\nexport const AUDIO = \"audio\";\nexport const PODCAST = \"podcast\";\nexport const GLOSS = \"gloss\";\nexport const PROGRAMME = \"programme\";\nexport const PODCAST_SERIES = \"podcast-series\";\nexport const FRONTPAGE_ARTICLE = \"frontpage-article\";\n\nexport const contentTypes = {\n SUBJECT_MATERIAL,\n TASKS_AND_ACTIVITIES,\n ASSESSMENT_RESOURCES,\n SUBJECT,\n SOURCE_MATERIAL,\n LEARNING_PATH,\n TOPIC,\n MULTIDISCIPLINARY,\n CONCEPT,\n EXTERNAL,\n MISSING,\n PROGRAMME,\n PODCAST_SERIES,\n};\n\nexport const RESOURCE_TYPE_LEARNING_PATH = \"urn:resourcetype:learningPath\";\nexport const RESOURCE_TYPE_SUBJECT_MATERIAL = \"urn:resourcetype:subjectMaterial\";\nexport const RESOURCE_TYPE_TASKS_AND_ACTIVITIES = \"urn:resourcetype:tasksAndActivities\";\nexport const RESOURCE_TYPE_ASSESSMENT_RESOURCES = \"urn:resourcetype:reviewResource\";\nexport const RESOURCE_TYPE_SOURCE_MATERIAL = \"urn:resourcetype:SourceMaterial\";\nexport const RESOURCE_TYPE_CONCEPT = \"urn:resourcetype:concept\";\n\nexport const contentTypeMapping: Record<string, string> = {\n [RESOURCE_TYPE_LEARNING_PATH]: LEARNING_PATH,\n [RESOURCE_TYPE_SUBJECT_MATERIAL]: SUBJECT_MATERIAL,\n [RESOURCE_TYPE_TASKS_AND_ACTIVITIES]: TASKS_AND_ACTIVITIES,\n [RESOURCE_TYPE_ASSESSMENT_RESOURCES]: ASSESSMENT_RESOURCES,\n [RESOURCE_TYPE_SOURCE_MATERIAL]: SOURCE_MATERIAL,\n [RESOURCE_TYPE_CONCEPT]: CONCEPT,\n [MULTIDISCIPLINARY]: MULTIDISCIPLINARY,\n [TOPIC]: TOPIC,\n [FRONTPAGE_ARTICLE]: FRONTPAGE_ARTICLE,\n default: SUBJECT_MATERIAL,\n};\n\nexport const resourceEmbedTypeMapping: Record<string, string> = {\n image: \"image\",\n video: \"video\",\n concept: \"concept\",\n audio: \"audio\",\n podcast: \"podcast\",\n gloss: \"gloss\",\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,mBAAmB;AAChC,MAAa,uBAAuB;AACpC,MAAa,uBAAuB;AACpC,MAAa,UAAU;AACvB,MAAa,kBAAkB;AAC/B,MAAa,gBAAgB;AAC7B,MAAa,QAAQ;AACrB,MAAa,oBAAoB;AACjC,MAAa,UAAU;AACvB,MAAa,WAAW;AACxB,MAAa,UAAU;AAMvB,MAAa,YAAY;AACzB,MAAa,iBAAiB;AAC9B,MAAa,oBAAoB;AAEjC,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,8BAA8B;AAC3C,MAAa,iCAAiC;AAC9C,MAAa,qCAAqC;AAClD,MAAa,qCAAqC;AAClD,MAAa,gCAAgC;AAC7C,MAAa,wBAAwB;AAErC,MAAa,qBAA6C;EACvD,8BAA8B;EAC9B,iCAAiC;EACjC,qCAAqC;EACrC,qCAAqC;EACrC,gCAAgC;EAChC,wBAAwB;EACxB,oBAAoB;EACpB,QAAQ;EACR,oBAAoB;CACrB,SAAS;CACV;AAED,MAAa,2BAAmD;CAC9D,OAAO;CACP,OAAO;CACP,SAAS;CACT,OAAO;CACP,SAAS;CACT,OAAO;CACR"}
1
+ {"version":3,"file":"ContentType.js","names":[],"sources":["../../src/model/ContentType.ts"],"sourcesContent":["/**\n * Copyright (c) 2017-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nexport const SUBJECT_MATERIAL = \"subject-material\";\nexport const TASKS_AND_ACTIVITIES = \"tasks-and-activities\";\nexport const ASSESSMENT_RESOURCES = \"assessment-resources\";\nexport const SUBJECT = \"subject\";\nexport const SOURCE_MATERIAL = \"source-material\";\nexport const LEARNING_PATH = \"learning-path\";\nexport const TOPIC = \"topic\";\nexport const MULTIDISCIPLINARY = \"multidisciplinary\";\nexport const CONCEPT = \"concept\";\nexport const EXTERNAL = \"external\";\nexport const MISSING = \"missing\";\nexport const IMAGE = \"image\";\nexport const VIDEO = \"video\";\nexport const AUDIO = \"audio\";\nexport const PODCAST = \"podcast\";\nexport const GLOSS = \"gloss\";\nexport const PROGRAMME = \"programme\";\nexport const PODCAST_SERIES = \"podcast-series\";\nexport const FRONTPAGE_ARTICLE = \"frontpage-article\";\nexport const GAME = \"game\";\nexport const CASE = \"case\";\n\nexport const contentTypes = {\n SUBJECT_MATERIAL,\n TASKS_AND_ACTIVITIES,\n ASSESSMENT_RESOURCES,\n SUBJECT,\n SOURCE_MATERIAL,\n LEARNING_PATH,\n TOPIC,\n MULTIDISCIPLINARY,\n CONCEPT,\n EXTERNAL,\n MISSING,\n PROGRAMME,\n PODCAST_SERIES,\n GAME,\n CASE,\n};\n\nexport const RESOURCE_TYPE_LEARNING_PATH = \"urn:resourcetype:learningPath\";\nexport const RESOURCE_TYPE_SUBJECT_MATERIAL = \"urn:resourcetype:subjectMaterial\";\nexport const RESOURCE_TYPE_TASKS_AND_ACTIVITIES = \"urn:resourcetype:tasksAndActivities\";\nexport const RESOURCE_TYPE_ASSESSMENT_RESOURCES = \"urn:resourcetype:reviewResource\";\nexport const RESOURCE_TYPE_SOURCE_MATERIAL = \"urn:resourcetype:SourceMaterial\";\nexport const RESOURCE_TYPE_CONCEPT = \"urn:resourcetype:concept\";\nexport const RESOURCE_TYPE_GAME = \"urn:resourcetype:game\";\n\nexport const contentTypeMapping: Record<string, string> = {\n [RESOURCE_TYPE_LEARNING_PATH]: LEARNING_PATH,\n [RESOURCE_TYPE_SUBJECT_MATERIAL]: SUBJECT_MATERIAL,\n [RESOURCE_TYPE_TASKS_AND_ACTIVITIES]: TASKS_AND_ACTIVITIES,\n [RESOURCE_TYPE_ASSESSMENT_RESOURCES]: ASSESSMENT_RESOURCES,\n [RESOURCE_TYPE_SOURCE_MATERIAL]: SOURCE_MATERIAL,\n [RESOURCE_TYPE_CONCEPT]: CONCEPT,\n [RESOURCE_TYPE_GAME]: GAME,\n [MULTIDISCIPLINARY]: MULTIDISCIPLINARY,\n [CASE]: CASE,\n [TOPIC]: TOPIC,\n [FRONTPAGE_ARTICLE]: FRONTPAGE_ARTICLE,\n default: SUBJECT_MATERIAL,\n};\n\nexport const resourceEmbedTypeMapping: Record<string, string> = {\n image: \"image\",\n video: \"video\",\n concept: \"concept\",\n audio: \"audio\",\n podcast: \"podcast\",\n gloss: \"gloss\",\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,mBAAmB;AAChC,MAAa,uBAAuB;AACpC,MAAa,uBAAuB;AACpC,MAAa,UAAU;AACvB,MAAa,kBAAkB;AAC/B,MAAa,gBAAgB;AAC7B,MAAa,QAAQ;AACrB,MAAa,oBAAoB;AACjC,MAAa,UAAU;AACvB,MAAa,WAAW;AACxB,MAAa,UAAU;AAMvB,MAAa,YAAY;AACzB,MAAa,iBAAiB;AAC9B,MAAa,oBAAoB;AACjC,MAAa,OAAO;AACpB,MAAa,OAAO;AAEpB,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,8BAA8B;AAC3C,MAAa,iCAAiC;AAC9C,MAAa,qCAAqC;AAClD,MAAa,qCAAqC;AAClD,MAAa,gCAAgC;AAC7C,MAAa,wBAAwB;AACrC,MAAa,qBAAqB;AAElC,MAAa,qBAA6C;EACvD,8BAA8B;EAC9B,iCAAiC;EACjC,qCAAqC;EACrC,qCAAqC;EACrC,gCAAgC;EAChC,wBAAwB;EACxB,qBAAqB;EACrB,oBAAoB;EACpB,OAAO;EACP,QAAQ;EACR,oBAAoB;CACrB,SAAS;CACV;AAED,MAAa,2BAAmD;CAC9D,OAAO;CACP,OAAO;CACP,SAAS;CACT,OAAO;CACP,SAAS;CACT,OAAO;CACR"}
@@ -23,6 +23,8 @@ export declare const constants: {
23
23
  MISSING: string;
24
24
  PROGRAMME: string;
25
25
  PODCAST_SERIES: string;
26
+ GAME: string;
27
+ CASE: string;
26
28
  };
27
29
  subjectCategories: typeof subjectCategories;
28
30
  subjectTypes: typeof subjectTypes;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
3
  "type": "module",
4
- "version": "56.0.172-alpha.0",
4
+ "version": "56.0.174-alpha.0",
5
5
  "description": "UI component library for NDLA",
6
6
  "license": "GPL-3.0",
7
7
  "exports": {
@@ -38,11 +38,11 @@
38
38
  "dependencies": {
39
39
  "@ark-ui/react": "^5.30.0",
40
40
  "@ndla/core": "^6.0.7-alpha.0",
41
- "@ndla/icons": "^8.0.77-alpha.0",
42
- "@ndla/licenses": "^10.0.9-alpha.0",
43
- "@ndla/locales": "^0.0.1",
44
- "@ndla/primitives": "^1.0.119-alpha.0",
45
- "@ndla/safelink": "^7.0.122-alpha.0",
41
+ "@ndla/icons": "^8.0.79-alpha.0",
42
+ "@ndla/licenses": "^10.0.10-alpha.0",
43
+ "@ndla/locales": "^0.0.2",
44
+ "@ndla/primitives": "^1.0.120-alpha.0",
45
+ "@ndla/safelink": "^7.0.123-alpha.0",
46
46
  "@ndla/styled-system": "^0.0.46",
47
47
  "@ndla/util": "^5.0.18-alpha.0",
48
48
  "html-react-parser": "^5.2.8"
@@ -55,13 +55,13 @@
55
55
  "react-router": ">= 7.0.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@ndla/preset-panda": "^0.0.70",
58
+ "@ndla/preset-panda": "^0.0.71",
59
59
  "@ndla/types-backend": "^1.0.89",
60
- "@ndla/types-embed": "^5.0.20-alpha.0",
60
+ "@ndla/types-embed": "^5.0.21-alpha.0",
61
61
  "@pandacss/dev": "^1.7.0"
62
62
  },
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "36c5e7334db527a79bf6c0b498e21b72c643ebf2"
66
+ "gitHead": "04d83d133eb6a3f2f0944fe217cf407f05716d4c"
67
67
  }
@@ -6,9 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
- import { type ReactNode, useMemo } from "react";
10
9
  import { SafeLink } from "@ndla/safelink";
11
10
  import { styled } from "@ndla/styled-system/jsx";
11
+ import { type ReactNode, useMemo } from "react";
12
12
 
13
13
  const StyledAnchor = styled(SafeLink, {
14
14
  base: {
@@ -6,12 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- import { type ComponentPropsWithRef, type ReactNode, forwardRef } from "react";
9
+ import type { StyledProps } from "@ndla/styled-system/types";
10
10
  import { ark, type HTMLArkProps } from "@ark-ui/react";
11
11
  import { Heading, Text } from "@ndla/primitives";
12
12
  import { cx } from "@ndla/styled-system/css";
13
13
  import { styled } from "@ndla/styled-system/jsx";
14
- import type { StyledProps } from "@ndla/styled-system/types";
14
+ import { type ComponentPropsWithRef, type ReactNode, forwardRef } from "react";
15
15
  import { BadgesContainer } from "./BadgesContainer";
16
16
 
17
17
  const StyledArticleContent = styled(ark.section, {}, { baseComponent: true });
@@ -7,7 +7,6 @@
7
7
  */
8
8
 
9
9
  import type { Meta, StoryFn, StoryObj } from "@storybook/react";
10
-
11
10
  import { ArticleByline } from "./ArticleByline";
12
11
 
13
12
  /**
@@ -6,8 +6,6 @@
6
6
  *
7
7
  */
8
8
 
9
- import { type ReactNode, forwardRef, useCallback, useEffect, useRef } from "react";
10
- import { useTranslation } from "react-i18next";
11
9
  import { useAccordionContext } from "@ark-ui/react";
12
10
  import { ArrowDownShortLine } from "@ndla/icons";
13
11
  import {
@@ -21,8 +19,10 @@ import {
21
19
  } from "@ndla/primitives";
22
20
  import { SafeLink } from "@ndla/safelink";
23
21
  import { styled } from "@ndla/styled-system/jsx";
24
- import { ArticleFootNotes } from "./ArticleFootNotes";
22
+ import { type ReactNode, forwardRef, useCallback, useEffect, useRef } from "react";
23
+ import { useTranslation } from "react-i18next";
25
24
  import type { FootNote } from "../types";
25
+ import { ArticleFootNotes } from "./ArticleFootNotes";
26
26
 
27
27
  const Wrapper = styled("div", {
28
28
  base: {
@@ -6,11 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
- import { type ReactNode, useId, useMemo, useState } from "react";
10
- import { useTranslation } from "react-i18next";
11
9
  import { Heading, Text, Button } from "@ndla/primitives";
12
10
  import { SafeLink } from "@ndla/safelink";
13
11
  import { styled } from "@ndla/styled-system/jsx";
12
+ import { type ReactNode, useId, useMemo, useState } from "react";
13
+ import { useTranslation } from "react-i18next";
14
14
  import { Controls } from "./Controls";
15
15
  import { SpeechControl } from "./SpeechControl";
16
16
 
@@ -6,8 +6,6 @@
6
6
  *
7
7
  */
8
8
 
9
- import { useEffect, useRef, useState } from "react";
10
- import { useTranslation } from "react-i18next";
11
9
  import { type SliderValueChangeDetails, createListCollection } from "@ark-ui/react";
12
10
  import { Replay15Line, Forward15Line, PlayFill, PauseLine, VolumeUpFill, CheckLine } from "@ndla/icons";
13
11
  import {
@@ -35,6 +33,8 @@ import {
35
33
  Text,
36
34
  } from "@ndla/primitives";
37
35
  import { styled } from "@ndla/styled-system/jsx";
36
+ import { useEffect, useRef, useState } from "react";
37
+ import { useTranslation } from "react-i18next";
38
38
 
39
39
  const ControlsWrapper = styled("div", {
40
40
  base: {
@@ -6,10 +6,10 @@
6
6
  *
7
7
  */
8
8
 
9
- import { useRef } from "react";
10
- import { useTranslation } from "react-i18next";
11
9
  import { VolumeUpFill } from "@ndla/icons";
12
10
  import { IconButton } from "@ndla/primitives";
11
+ import { useRef } from "react";
12
+ import { useTranslation } from "react-i18next";
13
13
 
14
14
  type Props = {
15
15
  src: string;
@@ -6,9 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
+ import { styled } from "@ndla/styled-system/jsx";
9
10
  import { type ReactNode } from "react";
10
11
  import { useTranslation } from "react-i18next";
11
- import { styled } from "@ndla/styled-system/jsx";
12
12
  import { BreadcrumbItem, type IndexedBreadcrumbItem, type SimpleBreadcrumbItem } from "./BreadcrumbItem";
13
13
 
14
14
  interface Props {
@@ -6,8 +6,8 @@
6
6
  *
7
7
  */
8
8
 
9
- import { type ReactNode } from "react";
10
9
  import { styled } from "@ndla/styled-system/jsx";
10
+ import { type ReactNode } from "react";
11
11
 
12
12
  export interface SimpleBreadcrumbItem {
13
13
  to: string | Partial<Location>;
@@ -9,8 +9,8 @@
9
9
  import { ArrowRightShortLine, HomeLine } from "@ndla/icons";
10
10
  import { SafeLink } from "@ndla/safelink";
11
11
  import { styled } from "@ndla/styled-system/jsx";
12
- import { Breadcrumb } from "./Breadcrumb";
13
12
  import type { IndexedBreadcrumbItem, SimpleBreadcrumbItem } from "./BreadcrumbItem";
13
+ import { Breadcrumb } from "./Breadcrumb";
14
14
 
15
15
  const StyledSafeLink = styled(SafeLink, {
16
16
  base: {
@@ -6,13 +6,13 @@
6
6
  *
7
7
  */
8
8
 
9
- import parse from "html-react-parser";
10
- import { type ReactNode } from "react";
9
+ import type { CampaignBlockEmbedData } from "@ndla/types-embed";
11
10
  import { ArrowRightLine } from "@ndla/icons";
12
11
  import { Text } from "@ndla/primitives";
13
12
  import { SafeLinkButton } from "@ndla/safelink";
14
13
  import { styled } from "@ndla/styled-system/jsx";
15
- import type { CampaignBlockEmbedData } from "@ndla/types-embed";
14
+ import parse from "html-react-parser";
15
+ import { type ReactNode } from "react";
16
16
  import type { HeadingLevel } from "../types";
17
17
  import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
18
18
 
@@ -6,10 +6,10 @@
6
6
  *
7
7
  */
8
8
 
9
- import { type ComponentPropsWithRef, forwardRef, useMemo } from "react";
9
+ import type { StyledProps } from "@ndla/styled-system/types";
10
10
  import { cx } from "@ndla/styled-system/css";
11
11
  import { styled } from "@ndla/styled-system/jsx";
12
- import type { StyledProps } from "@ndla/styled-system/types";
12
+ import { type ComponentPropsWithRef, forwardRef, useMemo } from "react";
13
13
 
14
14
  interface Props extends StyledProps, ComponentPropsWithRef<"pre"> {
15
15
  highlightedCode: string;
@@ -6,8 +6,8 @@
6
6
  *
7
7
  */
8
8
 
9
- import type { Meta, StoryObj } from "@storybook/react";
10
9
  import type { ConceptData } from "@ndla/types-embed";
10
+ import type { Meta, StoryObj } from "@storybook/react";
11
11
  import { Concept } from "./Concept";
12
12
 
13
13
  const visualElementData: ConceptData["visualElement"] = {
@@ -6,11 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
- import { type ComponentPropsWithRef, type ReactNode, forwardRef } from "react";
10
- import { Figure } from "@ndla/primitives";
11
- import { styled } from "@ndla/styled-system/jsx";
12
9
  import type { DraftCopyrightDTO as ConceptCopyright } from "@ndla/types-backend/concept-api";
13
10
  import type { ConceptVisualElementMeta } from "@ndla/types-embed";
11
+ import { Figure } from "@ndla/primitives";
12
+ import { styled } from "@ndla/styled-system/jsx";
13
+ import { type ComponentPropsWithRef, type ReactNode, forwardRef } from "react";
14
14
  import { BrightcoveEmbed } from "../Embed/BrightcoveEmbed";
15
15
  import { ExternalEmbed } from "../Embed/ExternalEmbed";
16
16
  import { H5pEmbed } from "../Embed/H5pEmbed";
@@ -6,11 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
- import { useTranslation } from "react-i18next";
10
- import { Text } from "@ndla/primitives";
11
- import { styled } from "@ndla/styled-system/jsx";
12
9
  import type { SystemStyleObject } from "@ndla/styled-system/types";
13
10
  import type { ImageMetaInformationV3DTO } from "@ndla/types-backend/image-api";
11
+ import { Text } from "@ndla/primitives";
12
+ import { styled } from "@ndla/styled-system/jsx";
13
+ import { useTranslation } from "react-i18next";
14
14
  import { LicenseContainerContent } from "../LicenseByline/EmbedByline";
15
15
 
16
16
  export type ContactBlockBackground = "strong" | "moderate" | "subtle";
@@ -6,11 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
+ import type { AudioEmbedData, AudioMeta } from "@ndla/types-embed";
9
10
  import type { Meta, StoryObj } from "@storybook/react";
10
11
  import { PageContent } from "@ndla/primitives";
11
- import type { AudioEmbedData, AudioMeta } from "@ndla/types-embed";
12
- import { AudioEmbed } from "./AudioEmbed";
13
12
  import { ArticleContent, ArticleWrapper } from "../Article/Article";
13
+ import { AudioEmbed } from "./AudioEmbed";
14
14
 
15
15
  const embedData: AudioEmbedData = {
16
16
  resource: "audio",
@@ -6,14 +6,14 @@
6
6
  *
7
7
  */
8
8
 
9
+ import type { AudioMetaData } from "@ndla/types-embed";
9
10
  import { Figure } from "@ndla/primitives";
10
11
  import { styled } from "@ndla/styled-system/jsx";
11
- import type { AudioMetaData } from "@ndla/types-embed";
12
- import { EmbedErrorPlaceholder } from "./EmbedErrorPlaceholder";
13
12
  import type { Author } from "./ImageEmbed";
14
13
  import { AudioPlayer } from "../AudioPlayer/AudioPlayer";
15
14
  import { EmbedByline } from "../LicenseByline/EmbedByline";
16
15
  import { licenseAttributes } from "../utils/licenseAttributes";
16
+ import { EmbedErrorPlaceholder } from "./EmbedErrorPlaceholder";
17
17
 
18
18
  const StyledFigure = styled(Figure, {
19
19
  base: {
@@ -6,11 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
+ import type { BrightcoveData, BrightcoveEmbedData, BrightcoveMetaData } from "@ndla/types-embed";
9
10
  import type { Meta, StoryObj } from "@storybook/react";
10
11
  import { PageContent } from "@ndla/primitives";
11
- import type { BrightcoveData, BrightcoveEmbedData, BrightcoveMetaData } from "@ndla/types-embed";
12
- import { BrightcoveEmbed } from "./BrightcoveEmbed";
13
12
  import { ArticleContent, ArticleWrapper } from "../Article/Article";
13
+ import { BrightcoveEmbed } from "./BrightcoveEmbed";
14
14
 
15
15
  const embedData: BrightcoveEmbedData = {
16
16
  resource: "brightcove",
@@ -6,16 +6,16 @@
6
6
  *
7
7
  */
8
8
 
9
+ import type { BrightcoveEmbedData, BrightcoveMetaData, BrightcoveVideoSource } from "@ndla/types-embed";
10
+ import { Button, Figure } from "@ndla/primitives";
11
+ import { styled } from "@ndla/styled-system/jsx";
9
12
  import parse from "html-react-parser";
10
13
  import { useEffect, useMemo, useRef, useState } from "react";
11
14
  import { useTranslation } from "react-i18next";
12
- import { Button, Figure } from "@ndla/primitives";
13
- import { styled } from "@ndla/styled-system/jsx";
14
- import type { BrightcoveEmbedData, BrightcoveMetaData, BrightcoveVideoSource } from "@ndla/types-embed";
15
- import { EmbedErrorPlaceholder } from "./EmbedErrorPlaceholder";
16
15
  import type { RenderContext } from "./types";
17
16
  import { EmbedByline } from "../LicenseByline/EmbedByline";
18
17
  import { licenseAttributes } from "../utils/licenseAttributes";
18
+ import { EmbedErrorPlaceholder } from "./EmbedErrorPlaceholder";
19
19
 
20
20
  interface Props {
21
21
  embed: BrightcoveMetaData;
@@ -6,8 +6,8 @@
6
6
  *
7
7
  */
8
8
 
9
- import type { Meta, StoryObj } from "@storybook/react";
10
9
  import type { CodeEmbedData, CodeMetaData } from "@ndla/types-embed";
10
+ import type { Meta, StoryObj } from "@storybook/react";
11
11
  import { CodeEmbed } from "./CodeEmbed";
12
12
 
13
13
  const codeEmbedData: CodeEmbedData = {
@@ -6,15 +6,15 @@
6
6
  *
7
7
  */
8
8
 
9
- import { useEffect, useState } from "react";
10
- import { useTranslation } from "react-i18next";
9
+ import type { CodeMetaData } from "@ndla/types-embed";
11
10
  import { FileCopyLine, CheckLine } from "@ndla/icons";
12
11
  import { Button, Figure } from "@ndla/primitives";
13
12
  import { styled } from "@ndla/styled-system/jsx";
14
- import type { CodeMetaData } from "@ndla/types-embed";
15
- import { EmbedErrorPlaceholder } from "./EmbedErrorPlaceholder";
13
+ import { useEffect, useState } from "react";
14
+ import { useTranslation } from "react-i18next";
16
15
  import { CodeBlock } from "../CodeBlock/CodeBlock";
17
16
  import { codeLanguageOptions, type ICodeLangugeOption } from "../CodeBlock/codeLanguageOptions";
17
+ import { EmbedErrorPlaceholder } from "./EmbedErrorPlaceholder";
18
18
 
19
19
  interface Props {
20
20
  embed: CodeMetaData;
@@ -6,11 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
+ import type { ConceptData, ConceptEmbedData } from "@ndla/types-embed";
9
10
  import type { Meta, StoryObj } from "@storybook/react";
10
11
  import { PageContent } from "@ndla/primitives";
11
- import type { ConceptData, ConceptEmbedData } from "@ndla/types-embed";
12
- import { ConceptEmbed } from "./ConceptEmbed";
13
12
  import { ArticleContent, ArticleWrapper } from "../Article/Article";
13
+ import { ConceptEmbed } from "./ConceptEmbed";
14
14
 
15
15
  const blockEmbedData: ConceptEmbedData = {
16
16
  contentId: "35",
@@ -6,17 +6,17 @@
6
6
  *
7
7
  */
8
8
 
9
- import parse from "html-react-parser";
10
- import { forwardRef, useMemo, useRef, type ReactNode } from "react";
9
+ import type { ConceptMetaData } from "@ndla/types-embed";
11
10
  import { Portal } from "@ark-ui/react";
12
11
  import { PopoverContent, PopoverRoot, PopoverTrigger } from "@ndla/primitives";
13
12
  import { styled } from "@ndla/styled-system/jsx";
14
- import type { ConceptMetaData } from "@ndla/types-embed";
13
+ import parse from "html-react-parser";
14
+ import { forwardRef, useMemo, useRef, type ReactNode } from "react";
15
+ import type { RenderContext } from "./types";
16
+ import { Concept, type ConceptProps } from "../Concept/Concept";
15
17
  import { ConceptInlineTriggerButton } from "./ConceptInlineTriggerButton";
16
18
  import { EmbedErrorPlaceholder } from "./EmbedErrorPlaceholder";
17
19
  import { GlossEmbed } from "./GlossEmbed";
18
- import type { RenderContext } from "./types";
19
- import { Concept, type ConceptProps } from "../Concept/Concept";
20
20
 
21
21
  interface BaseProps {
22
22
  renderContext?: RenderContext;
@@ -6,10 +6,10 @@
6
6
  *
7
7
  */
8
8
 
9
+ import type { ContentLinkMetaData } from "@ndla/types-embed";
9
10
  import type { ReactNode } from "react";
10
- import { useTranslation } from "react-i18next";
11
11
  import { Text } from "@ndla/primitives";
12
- import type { ContentLinkMetaData } from "@ndla/types-embed";
12
+ import { useTranslation } from "react-i18next";
13
13
 
14
14
  interface Props {
15
15
  embed: ContentLinkMetaData;
@@ -6,9 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
+ import type { CopyrightMetaData } from "@ndla/types-embed";
9
10
  import type { ReactNode } from "react";
10
11
  import { styled } from "@ndla/styled-system/jsx";
11
- import type { CopyrightMetaData } from "@ndla/types-embed";
12
12
  import { EmbedByline } from "../LicenseByline/EmbedByline";
13
13
 
14
14
  interface Props {
@@ -6,10 +6,10 @@
6
6
  *
7
7
  */
8
8
 
9
- import { type ReactNode } from "react";
10
9
  import { ErrorWarningLine } from "@ndla/icons";
11
10
  import { Figure, type FigureFloat, type FigureSize } from "@ndla/primitives";
12
11
  import { styled } from "@ndla/styled-system/jsx";
12
+ import { type ReactNode } from "react";
13
13
  import { EmbedByline, type EmbedBylineErrorProps } from "../LicenseByline/EmbedByline";
14
14
 
15
15
  interface Props {
@@ -6,11 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
- import { forwardRef } from "react";
9
+ import type { StyledProps, RecipeVariantProps } from "@ndla/styled-system/types";
10
10
  import { ark, type HTMLArkProps } from "@ark-ui/react";
11
11
  import { css, cva } from "@ndla/styled-system/css";
12
12
  import { styled } from "@ndla/styled-system/jsx";
13
- import type { StyledProps, RecipeVariantProps } from "@ndla/styled-system/types";
13
+ import { forwardRef } from "react";
14
14
 
15
15
  const embedWrapperRecipe = cva({
16
16
  base: {
@@ -6,11 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
+ import type { OembedEmbedData, OembedData } from "@ndla/types-embed";
9
10
  import type { Meta, StoryObj } from "@storybook/react";
10
11
  import { PageContent } from "@ndla/primitives";
11
- import type { OembedEmbedData, OembedData } from "@ndla/types-embed";
12
- import { ExternalEmbed } from "./ExternalEmbed";
13
12
  import { ArticleWrapper, ArticleContent } from "../Article/Article";
13
+ import { ExternalEmbed } from "./ExternalEmbed";
14
14
 
15
15
  const embedData: OembedEmbedData = {
16
16
  resource: "external",