@ndla/ui 56.0.141-alpha.0 → 56.0.143-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 (366) hide show
  1. package/dist/panda.buildinfo.json +2 -10
  2. package/dist/styles.css +5 -35
  3. package/es/Article/Article.mjs +10 -12
  4. package/es/Article/Article.mjs.map +1 -1
  5. package/es/Article/ArticleByline.mjs.map +1 -1
  6. package/es/Article/ArticleFootNotes.mjs.map +1 -1
  7. package/es/AudioPlayer/AudioPlayer.mjs +3 -3
  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 +9 -11
  12. package/es/AudioPlayer/SpeechControl.mjs.map +1 -1
  13. package/es/Breadcrumb/Breadcrumb.mjs +2 -2
  14. package/es/Breadcrumb/Breadcrumb.mjs.map +1 -1
  15. package/es/Breadcrumb/BreadcrumbItem.mjs +1 -1
  16. package/es/Breadcrumb/BreadcrumbItem.mjs.map +1 -1
  17. package/es/Breadcrumb/HomeBreadcrumb.mjs +2 -2
  18. package/es/Breadcrumb/HomeBreadcrumb.mjs.map +1 -1
  19. package/es/CampaignBlock/CampaignBlock.mjs +1 -1
  20. package/es/CampaignBlock/CampaignBlock.mjs.map +1 -1
  21. package/es/CodeBlock/CodeBlock.mjs +1 -1
  22. package/es/CodeBlock/CodeBlock.mjs.map +1 -1
  23. package/es/CodeBlock/codeLanguageOptions.mjs.map +1 -1
  24. package/es/Concept/Concept.mjs +5 -5
  25. package/es/Concept/Concept.mjs.map +1 -1
  26. package/es/ContactBlock/ContactBlock.mjs.map +1 -1
  27. package/es/ContentTypeBadge/ContentTypeBadge.mjs.map +1 -1
  28. package/es/CopyParagraphButton/CopyParagraphButton.mjs +1 -1
  29. package/es/CopyParagraphButton/CopyParagraphButton.mjs.map +1 -1
  30. package/es/Embed/AudioEmbed.mjs +3 -3
  31. package/es/Embed/AudioEmbed.mjs.map +1 -1
  32. package/es/Embed/BrightcoveEmbed.mjs +2 -2
  33. package/es/Embed/BrightcoveEmbed.mjs.map +1 -1
  34. package/es/Embed/CodeEmbed.mjs +3 -4
  35. package/es/Embed/CodeEmbed.mjs.map +1 -1
  36. package/es/Embed/ConceptEmbed.mjs +2 -2
  37. package/es/Embed/ConceptEmbed.mjs.map +1 -1
  38. package/es/Embed/ConceptInlineTriggerButton.mjs.map +1 -1
  39. package/es/Embed/ContentLinkEmbed.mjs +1 -1
  40. package/es/Embed/ContentLinkEmbed.mjs.map +1 -1
  41. package/es/Embed/CopyrightEmbed.mjs +1 -1
  42. package/es/Embed/CopyrightEmbed.mjs.map +1 -1
  43. package/es/Embed/EmbedErrorPlaceholder.mjs +1 -1
  44. package/es/Embed/EmbedErrorPlaceholder.mjs.map +1 -1
  45. package/es/Embed/EmbedWrapper.mjs.map +1 -1
  46. package/es/Embed/ExternalEmbed.mjs +3 -3
  47. package/es/Embed/ExternalEmbed.mjs.map +1 -1
  48. package/es/Embed/FootnoteEmbed.mjs +1 -1
  49. package/es/Embed/FootnoteEmbed.mjs.map +1 -1
  50. package/es/Embed/GlossEmbed.mjs +2 -2
  51. package/es/Embed/GlossEmbed.mjs.map +1 -1
  52. package/es/Embed/H5pEmbed.mjs +2 -2
  53. package/es/Embed/H5pEmbed.mjs.map +1 -1
  54. package/es/Embed/IframeEmbed.mjs +3 -3
  55. package/es/Embed/IframeEmbed.mjs.map +1 -1
  56. package/es/Embed/ImageEmbed.mjs +2 -4
  57. package/es/Embed/ImageEmbed.mjs.map +1 -1
  58. package/es/Embed/InlineTriggerButton.mjs.map +1 -1
  59. package/es/Embed/RelatedContentEmbed.mjs +2 -3
  60. package/es/Embed/RelatedContentEmbed.mjs.map +1 -1
  61. package/es/Embed/UnknownEmbed.mjs +1 -1
  62. package/es/Embed/UnknownEmbed.mjs.map +1 -1
  63. package/es/Embed/UuDisclaimerEmbed.mjs +1 -1
  64. package/es/Embed/UuDisclaimerEmbed.mjs.map +1 -1
  65. package/es/FactBox/FactBox.mjs +1 -1
  66. package/es/FactBox/FactBox.mjs.map +1 -1
  67. package/es/FileList/File.mjs +34 -30
  68. package/es/FileList/File.mjs.map +1 -1
  69. package/es/FileList/FileList.mjs.map +1 -1
  70. package/es/FileList/PdfFile.mjs.map +1 -1
  71. package/es/Gloss/Gloss.mjs +5 -7
  72. package/es/Gloss/Gloss.mjs.map +1 -1
  73. package/es/Gloss/GlossExample.mjs +1 -1
  74. package/es/Gloss/GlossExample.mjs.map +1 -1
  75. package/es/Grid/Grid.mjs.map +1 -1
  76. package/es/Grid/GridParallaxItem.mjs.map +1 -1
  77. package/es/KeyFigure/KeyFigure.mjs +1 -1
  78. package/es/KeyFigure/KeyFigure.mjs.map +1 -1
  79. package/es/LicenseByline/EmbedByline.mjs +1 -2
  80. package/es/LicenseByline/EmbedByline.mjs.map +1 -1
  81. package/es/LicenseByline/LicenseLink.mjs.map +1 -1
  82. package/es/LinkBlock/LinkBlock.mjs +1 -1
  83. package/es/LinkBlock/LinkBlock.mjs.map +1 -1
  84. package/es/LinkBlock/LinkBlockSection.mjs +1 -1
  85. package/es/LinkBlock/LinkBlockSection.mjs.map +1 -1
  86. package/es/Pitch/Pitch.mjs.map +1 -1
  87. package/es/RelatedArticleList/RelatedArticleList.mjs.map +1 -1
  88. package/es/ResourceBox/ResourceBox.mjs +1 -1
  89. package/es/ResourceBox/ResourceBox.mjs.map +1 -1
  90. package/es/TagSelector/TagSelector.mjs.map +1 -1
  91. package/es/ZendeskButton/ZendeskButton.mjs.map +1 -1
  92. package/es/_virtual/rolldown_runtime.mjs +3 -1
  93. package/es/i18n/formatNestedMessages.mjs.map +1 -1
  94. package/es/i18n/useComponentTranslations.mjs +1 -2
  95. package/es/i18n/useComponentTranslations.mjs.map +1 -1
  96. package/es/index.mjs +34 -39
  97. package/es/locale/messages-en.mjs +2 -2
  98. package/es/locale/messages-en.mjs.map +1 -1
  99. package/es/locale/messages-nb.mjs +2 -2
  100. package/es/locale/messages-nb.mjs.map +1 -1
  101. package/es/locale/messages-nn.mjs +2 -2
  102. package/es/locale/messages-nn.mjs.map +1 -1
  103. package/es/locale/messages-se.mjs +2 -2
  104. package/es/locale/messages-se.mjs.map +1 -1
  105. package/es/model/ContentType.mjs.map +1 -1
  106. package/es/model/SubjectCategories.mjs +1 -2
  107. package/es/model/SubjectCategories.mjs.map +1 -1
  108. package/es/model/SubjectTypes.mjs +1 -2
  109. package/es/model/SubjectTypes.mjs.map +1 -1
  110. package/es/model/WordClass.mjs +1 -2
  111. package/es/model/WordClass.mjs.map +1 -1
  112. package/es/model/index.mjs +1 -1
  113. package/es/model/index.mjs.map +1 -1
  114. package/es/utils/licenseAttributes.mjs +1 -2
  115. package/es/utils/licenseAttributes.mjs.map +1 -1
  116. package/es/utils/relativeUrl.mjs.map +1 -1
  117. package/lib/Article/Article.js +24 -20
  118. package/lib/Article/Article.js.map +1 -1
  119. package/lib/Article/ArticleByline.js +18 -10
  120. package/lib/Article/ArticleByline.js.map +1 -1
  121. package/lib/Article/ArticleFootNotes.js +6 -3
  122. package/lib/Article/ArticleFootNotes.js.map +1 -1
  123. package/lib/AudioPlayer/AudioPlayer.js +17 -11
  124. package/lib/AudioPlayer/AudioPlayer.js.map +1 -1
  125. package/lib/AudioPlayer/Controls.js +15 -8
  126. package/lib/AudioPlayer/Controls.js.map +1 -1
  127. package/lib/AudioPlayer/SpeechControl.js +18 -15
  128. package/lib/AudioPlayer/SpeechControl.js.map +1 -1
  129. package/lib/Breadcrumb/Breadcrumb.js +11 -7
  130. package/lib/Breadcrumb/Breadcrumb.js.map +1 -1
  131. package/lib/Breadcrumb/BreadcrumbItem.js +11 -6
  132. package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -1
  133. package/lib/Breadcrumb/HomeBreadcrumb.js +11 -7
  134. package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -1
  135. package/lib/CampaignBlock/CampaignBlock.js +17 -10
  136. package/lib/CampaignBlock/CampaignBlock.js.map +1 -1
  137. package/lib/CodeBlock/CodeBlock.js +9 -5
  138. package/lib/CodeBlock/CodeBlock.js.map +1 -1
  139. package/lib/CodeBlock/codeLanguageOptions.js.map +1 -1
  140. package/lib/Concept/Concept.js +19 -15
  141. package/lib/Concept/Concept.js.map +1 -1
  142. package/lib/ContactBlock/ContactBlock.js +10 -6
  143. package/lib/ContactBlock/ContactBlock.js.map +1 -1
  144. package/lib/ContentTypeBadge/ContentTypeBadge.js +28 -24
  145. package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -1
  146. package/lib/CopyParagraphButton/CopyParagraphButton.js +13 -7
  147. package/lib/CopyParagraphButton/CopyParagraphButton.js.map +1 -1
  148. package/lib/Embed/AudioEmbed.js +16 -13
  149. package/lib/Embed/AudioEmbed.js.map +1 -1
  150. package/lib/Embed/BrightcoveEmbed.js +19 -13
  151. package/lib/Embed/BrightcoveEmbed.js.map +1 -1
  152. package/lib/Embed/CodeEmbed.js +19 -14
  153. package/lib/Embed/CodeEmbed.js.map +1 -1
  154. package/lib/Embed/ConceptEmbed.js +21 -15
  155. package/lib/Embed/ConceptEmbed.js.map +1 -1
  156. package/lib/Embed/ConceptInlineTriggerButton.js +4 -3
  157. package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -1
  158. package/lib/Embed/ContentLinkEmbed.js +7 -4
  159. package/lib/Embed/ContentLinkEmbed.js.map +1 -1
  160. package/lib/Embed/CopyrightEmbed.js +7 -5
  161. package/lib/Embed/CopyrightEmbed.js.map +1 -1
  162. package/lib/Embed/EmbedErrorPlaceholder.js +13 -8
  163. package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -1
  164. package/lib/Embed/EmbedWrapper.js +10 -5
  165. package/lib/Embed/EmbedWrapper.js.map +1 -1
  166. package/lib/Embed/ExternalEmbed.js +15 -10
  167. package/lib/Embed/ExternalEmbed.js.map +1 -1
  168. package/lib/Embed/FootnoteEmbed.js +7 -4
  169. package/lib/Embed/FootnoteEmbed.js.map +1 -1
  170. package/lib/Embed/GlossEmbed.js +17 -12
  171. package/lib/Embed/GlossEmbed.js.map +1 -1
  172. package/lib/Embed/H5pEmbed.js +11 -7
  173. package/lib/Embed/H5pEmbed.js.map +1 -1
  174. package/lib/Embed/IframeEmbed.js +15 -10
  175. package/lib/Embed/IframeEmbed.js.map +1 -1
  176. package/lib/Embed/ImageEmbed.js +21 -16
  177. package/lib/Embed/ImageEmbed.js.map +1 -1
  178. package/lib/Embed/InlineTriggerButton.js +8 -4
  179. package/lib/Embed/InlineTriggerButton.js.map +1 -1
  180. package/lib/Embed/RelatedContentEmbed.js +12 -11
  181. package/lib/Embed/RelatedContentEmbed.js.map +1 -1
  182. package/lib/Embed/UnknownEmbed.js +7 -4
  183. package/lib/Embed/UnknownEmbed.js.map +1 -1
  184. package/lib/Embed/UuDisclaimerEmbed.js +15 -8
  185. package/lib/Embed/UuDisclaimerEmbed.js.map +1 -1
  186. package/lib/FactBox/FactBox.js +13 -7
  187. package/lib/FactBox/FactBox.js.map +1 -1
  188. package/lib/FileList/File.js +51 -39
  189. package/lib/FileList/File.js.map +1 -1
  190. package/lib/FileList/FileList.js +8 -4
  191. package/lib/FileList/FileList.js.map +1 -1
  192. package/lib/FileList/PdfFile.js +6 -3
  193. package/lib/FileList/PdfFile.js.map +1 -1
  194. package/lib/Gloss/Gloss.js +23 -17
  195. package/lib/Gloss/Gloss.js.map +1 -1
  196. package/lib/Gloss/GlossExample.js +9 -5
  197. package/lib/Gloss/GlossExample.js.map +1 -1
  198. package/lib/Grid/Grid.js +6 -3
  199. package/lib/Grid/Grid.js.map +1 -1
  200. package/lib/Grid/GridParallaxItem.js +6 -3
  201. package/lib/Grid/GridParallaxItem.js.map +1 -1
  202. package/lib/KeyFigure/KeyFigure.js +7 -4
  203. package/lib/KeyFigure/KeyFigure.js.map +1 -1
  204. package/lib/LicenseByline/EmbedByline.js +17 -11
  205. package/lib/LicenseByline/EmbedByline.js.map +1 -1
  206. package/lib/LicenseByline/LicenseLink.js +8 -4
  207. package/lib/LicenseByline/LicenseLink.js.map +1 -1
  208. package/lib/LinkBlock/LinkBlock.js +17 -10
  209. package/lib/LinkBlock/LinkBlock.js.map +1 -1
  210. package/lib/LinkBlock/LinkBlockSection.js +7 -4
  211. package/lib/LinkBlock/LinkBlockSection.js.map +1 -1
  212. package/lib/Pitch/Pitch.js +14 -8
  213. package/lib/Pitch/Pitch.js.map +1 -1
  214. package/lib/RelatedArticleList/RelatedArticleList.js +20 -12
  215. package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -1
  216. package/lib/ResourceBox/ResourceBox.js +14 -7
  217. package/lib/ResourceBox/ResourceBox.js.map +1 -1
  218. package/lib/TagSelector/TagSelector.js +12 -6
  219. package/lib/TagSelector/TagSelector.js.map +1 -1
  220. package/lib/ZendeskButton/ZendeskButton.js +6 -3
  221. package/lib/ZendeskButton/ZendeskButton.js.map +1 -1
  222. package/lib/_virtual/rolldown_runtime.js +5 -13
  223. package/lib/i18n/formatNestedMessages.js.map +1 -1
  224. package/lib/i18n/useComponentTranslations.js +5 -4
  225. package/lib/i18n/useComponentTranslations.js.map +1 -1
  226. package/lib/index.d.ts +51 -31
  227. package/lib/index.js +145 -154
  228. package/lib/locale/messages-en.js +5 -4
  229. package/lib/locale/messages-en.js.map +1 -1
  230. package/lib/locale/messages-nb.js +5 -4
  231. package/lib/locale/messages-nb.js.map +1 -1
  232. package/lib/locale/messages-nn.js +5 -4
  233. package/lib/locale/messages-nn.js.map +1 -1
  234. package/lib/locale/messages-se.js +5 -4
  235. package/lib/locale/messages-se.js.map +1 -1
  236. package/lib/model/ContentType.js.map +1 -1
  237. package/lib/model/SubjectCategories.js +1 -2
  238. package/lib/model/SubjectCategories.js.map +1 -1
  239. package/lib/model/SubjectTypes.js +1 -2
  240. package/lib/model/SubjectTypes.js.map +1 -1
  241. package/lib/model/WordClass.js +1 -2
  242. package/lib/model/WordClass.js.map +1 -1
  243. package/lib/model/index.js +11 -11
  244. package/lib/model/index.js.map +1 -1
  245. package/lib/utils/licenseAttributes.js +3 -3
  246. package/lib/utils/licenseAttributes.js.map +1 -1
  247. package/lib/utils/relativeUrl.js.map +1 -1
  248. package/package.json +8 -8
  249. package/src/Article/Article.tsx +8 -4
  250. package/src/AudioPlayer/SpeechControl.tsx +4 -9
  251. package/src/Concept/Concept.tsx +5 -1
  252. package/src/Embed/AudioEmbed.stories.tsx +1 -1
  253. package/src/Embed/AudioEmbed.tsx +2 -2
  254. package/src/Embed/BrightcoveEmbed.stories.tsx +1 -1
  255. package/src/Embed/BrightcoveEmbed.tsx +1 -1
  256. package/src/Embed/CodeEmbed.tsx +2 -2
  257. package/src/Embed/ConceptEmbed.stories.tsx +1 -1
  258. package/src/Embed/CopyrightEmbed.tsx +1 -1
  259. package/src/Embed/EmbedErrorPlaceholder.tsx +1 -2
  260. package/src/Embed/ExternalEmbed.stories.tsx +1 -1
  261. package/src/Embed/ExternalEmbed.tsx +1 -1
  262. package/src/Embed/FootnoteEmbed.stories.tsx +1 -1
  263. package/src/Embed/GlossEmbed.tsx +1 -1
  264. package/src/Embed/H5pEmbed.stories.tsx +1 -1
  265. package/src/Embed/IframeEmbed.stories.tsx +1 -1
  266. package/src/Embed/IframeEmbed.tsx +1 -1
  267. package/src/Embed/ImageEmbed.stories.tsx +2 -2
  268. package/src/Embed/ImageEmbed.tsx +1 -1
  269. package/src/Embed/RelatedContentEmbed.stories.tsx +2 -2
  270. package/src/Embed/UuDisclaimerEmbed.stories.tsx +3 -3
  271. package/src/FileList/File.tsx +18 -7
  272. package/src/LinkBlock/LinkBlock.stories.tsx +1 -1
  273. package/src/Pitch/Pitch.stories.tsx +2 -2
  274. package/src/index.ts +53 -63
  275. package/es/AudioPlayer/index.mjs +0 -8
  276. package/es/AudioPlayer/index.mjs.map +0 -1
  277. package/es/Breadcrumb/index.mjs +0 -9
  278. package/es/Breadcrumb/index.mjs.map +0 -1
  279. package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.mjs +0 -25
  280. package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.mjs.map +0 -1
  281. package/es/ContentTypeFramedContent/ContentTypeFramedContent.mjs +0 -25
  282. package/es/ContentTypeFramedContent/ContentTypeFramedContent.mjs.map +0 -1
  283. package/es/ContentTypeHero/ContentTypeHero.mjs +0 -39
  284. package/es/ContentTypeHero/ContentTypeHero.mjs.map +0 -1
  285. package/es/CopyParagraphButton/index.mjs +0 -8
  286. package/es/CopyParagraphButton/index.mjs.map +0 -1
  287. package/es/ErrorMessage/ErrorMessage.mjs +0 -54
  288. package/es/ErrorMessage/ErrorMessage.mjs.map +0 -1
  289. package/es/ErrorMessage/index.mjs +0 -8
  290. package/es/ErrorMessage/index.mjs.map +0 -1
  291. package/es/FactBox/index.mjs +0 -8
  292. package/es/FactBox/index.mjs.map +0 -1
  293. package/es/RelatedArticleList/index.mjs +0 -8
  294. package/es/RelatedArticleList/index.mjs.map +0 -1
  295. package/lib/Article/index.d.ts +0 -10
  296. package/lib/AudioPlayer/index.d.ts +0 -9
  297. package/lib/AudioPlayer/index.js +0 -8
  298. package/lib/AudioPlayer/index.js.map +0 -1
  299. package/lib/Breadcrumb/index.d.ts +0 -11
  300. package/lib/Breadcrumb/index.js +0 -9
  301. package/lib/Breadcrumb/index.js.map +0 -1
  302. package/lib/CampaignBlock/index.d.ts +0 -8
  303. package/lib/CodeBlock/index.d.ts +0 -9
  304. package/lib/ContactBlock/index.d.ts +0 -9
  305. package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.d.ts +0 -16
  306. package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +0 -26
  307. package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +0 -1
  308. package/lib/ContentTypeFramedContent/ContentTypeFramedContent.d.ts +0 -16
  309. package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +0 -26
  310. package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js.map +0 -1
  311. package/lib/ContentTypeHero/ContentTypeHero.d.ts +0 -14
  312. package/lib/ContentTypeHero/ContentTypeHero.js +0 -40
  313. package/lib/ContentTypeHero/ContentTypeHero.js.map +0 -1
  314. package/lib/ContentTypeHero/index.d.ts +0 -9
  315. package/lib/CopyParagraphButton/index.d.ts +0 -10
  316. package/lib/CopyParagraphButton/index.js +0 -8
  317. package/lib/CopyParagraphButton/index.js.map +0 -1
  318. package/lib/Embed/index.d.ts +0 -27
  319. package/lib/ErrorMessage/ErrorMessage.d.ts +0 -27
  320. package/lib/ErrorMessage/ErrorMessage.js +0 -55
  321. package/lib/ErrorMessage/ErrorMessage.js.map +0 -1
  322. package/lib/ErrorMessage/index.d.ts +0 -9
  323. package/lib/ErrorMessage/index.js +0 -8
  324. package/lib/ErrorMessage/index.js.map +0 -1
  325. package/lib/FactBox/index.d.ts +0 -9
  326. package/lib/FactBox/index.js +0 -8
  327. package/lib/FactBox/index.js.map +0 -1
  328. package/lib/FileList/index.d.ts +0 -10
  329. package/lib/Gloss/index.d.ts +0 -9
  330. package/lib/Grid/index.d.ts +0 -10
  331. package/lib/KeyFigure/index.d.ts +0 -8
  332. package/lib/LicenseByline/index.d.ts +0 -9
  333. package/lib/LinkBlock/index.d.ts +0 -9
  334. package/lib/Pitch/index.d.ts +0 -8
  335. package/lib/RelatedArticleList/index.d.ts +0 -10
  336. package/lib/RelatedArticleList/index.js +0 -8
  337. package/lib/RelatedArticleList/index.js.map +0 -1
  338. package/lib/ResourceBox/index.d.ts +0 -9
  339. package/lib/i18n/index.d.ts +0 -9
  340. package/src/Article/index.ts +0 -20
  341. package/src/AudioPlayer/index.ts +0 -11
  342. package/src/Breadcrumb/index.ts +0 -15
  343. package/src/CampaignBlock/index.ts +0 -9
  344. package/src/CodeBlock/index.ts +0 -10
  345. package/src/ContactBlock/index.ts +0 -10
  346. package/src/ContentTypeBlockQuote/ContentTypeBlockQuote.tsx +0 -32
  347. package/src/ContentTypeFramedContent/ContentTypeFramedContent.tsx +0 -34
  348. package/src/ContentTypeHero/ContentTypeHero.stories.tsx +0 -75
  349. package/src/ContentTypeHero/ContentTypeHero.tsx +0 -56
  350. package/src/ContentTypeHero/index.ts +0 -10
  351. package/src/CopyParagraphButton/index.tsx +0 -12
  352. package/src/Embed/index.ts +0 -28
  353. package/src/ErrorMessage/ErrorMessage.stories.tsx +0 -57
  354. package/src/ErrorMessage/ErrorMessage.tsx +0 -108
  355. package/src/ErrorMessage/index.ts +0 -11
  356. package/src/FactBox/index.ts +0 -11
  357. package/src/FileList/index.ts +0 -11
  358. package/src/Gloss/index.tsx +0 -10
  359. package/src/Grid/index.ts +0 -12
  360. package/src/KeyFigure/index.ts +0 -9
  361. package/src/LicenseByline/index.tsx +0 -10
  362. package/src/LinkBlock/index.ts +0 -10
  363. package/src/Pitch/index.ts +0 -9
  364. package/src/RelatedArticleList/index.ts +0 -13
  365. package/src/ResourceBox/index.ts +0 -11
  366. package/src/i18n/index.ts +0 -19
@@ -1,15 +1,19 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_LicenseByline_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_utils_licenseAttributes = require('../utils/licenseAttributes.js');
4
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_ImageEmbed = require('../Embed/ImageEmbed.js');
5
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_H5pEmbed = require('../Embed/H5pEmbed.js');
6
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_ExternalEmbed = require('../Embed/ExternalEmbed.js');
7
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_IframeEmbed = require('../Embed/IframeEmbed.js');
8
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_BrightcoveEmbed = require('../Embed/BrightcoveEmbed.js');
9
- const react = require_rolldown_runtime.__toESM(require("react"));
10
- const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
11
- const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
12
- const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
2
+ const require_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
+ const require_licenseAttributes = require('../utils/licenseAttributes.js');
4
+ const require_BrightcoveEmbed = require('../Embed/BrightcoveEmbed.js');
5
+ const require_ExternalEmbed = require('../Embed/ExternalEmbed.js');
6
+ const require_H5pEmbed = require('../Embed/H5pEmbed.js');
7
+ const require_IframeEmbed = require('../Embed/IframeEmbed.js');
8
+ const require_ImageEmbed = require('../Embed/ImageEmbed.js');
9
+ let react = require("react");
10
+ react = require_rolldown_runtime.__toESM(react);
11
+ let __ndla_primitives = require("@ndla/primitives");
12
+ __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
13
+ let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
14
+ __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
15
+ let react_jsx_runtime = require("react/jsx-runtime");
16
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
13
17
 
14
18
  //#region src/Concept/Concept.tsx
15
19
  const StyledFigure = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Figure, { base: {
@@ -23,7 +27,7 @@ const ContentWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
23
27
  "& p": { display: "inline" }
24
28
  } });
25
29
  const Concept = (0, react.forwardRef)(({ copyright, visualElement, lang, children, title, source, previewAlt,...rest }, ref) => {
26
- const licenseProps = require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_utils_licenseAttributes.licenseAttributes(copyright?.license?.license, lang, source);
30
+ const licenseProps = require_licenseAttributes.licenseAttributes(copyright?.license?.license, lang, source);
27
31
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledFigure, {
28
32
  ref,
29
33
  ...rest,
@@ -33,12 +37,12 @@ const Concept = (0, react.forwardRef)(({ copyright, visualElement, lang, childre
33
37
  lang,
34
38
  children: [!!title && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: title }), ` – `] }), children]
35
39
  }),
36
- visualElement?.resource === "image" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_ImageEmbed.ImageEmbed_default, {
40
+ visualElement?.resource === "image" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ImageEmbed.default, {
37
41
  embed: visualElement,
38
42
  lang,
39
43
  previewAlt
40
- }) : visualElement?.resource === "brightcove" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_BrightcoveEmbed.BrightcoveEmbed_default, { embed: visualElement }) : visualElement?.resource === "h5p" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_H5pEmbed.H5pEmbed_default, { embed: visualElement }) : visualElement?.resource === "iframe" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_IframeEmbed.IframeEmbed_default, { embed: visualElement }) : visualElement?.resource === "external" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_ExternalEmbed.ExternalEmbed_default, { embed: visualElement }) : null,
41
- !!copyright && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_LicenseByline_EmbedByline.EmbedByline, {
44
+ }) : visualElement?.resource === "brightcove" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BrightcoveEmbed.default, { embed: visualElement }) : visualElement?.resource === "h5p" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_H5pEmbed.default, { embed: visualElement }) : visualElement?.resource === "iframe" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_IframeEmbed.default, { embed: visualElement }) : visualElement?.resource === "external" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ExternalEmbed.default, { embed: visualElement }) : null,
45
+ !!copyright && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedByline.EmbedByline, {
42
46
  copyright,
43
47
  type: "concept"
44
48
  })
@@ -1 +1 @@
1
- {"version":3,"file":"Concept.js","names":["Figure","ImageEmbed","BrightcoveEmbed","H5pEmbed","IframeEmbed","ExternalEmbed","EmbedByline"],"sources":["../../src/Concept/Concept.tsx"],"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 ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { IDraftCopyrightDTO as ConceptCopyright } from \"@ndla/types-backend/concept-api\";\nimport type { ConceptVisualElementMeta } from \"@ndla/types-embed\";\nimport { BrightcoveEmbed, ExternalEmbed, H5pEmbed, IframeEmbed, ImageEmbed } from \"../Embed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nexport interface ConceptProps extends Omit<ComponentPropsWithRef<\"figure\">, \"title\"> {\n copyright?: ConceptCopyright;\n visualElement?: ConceptVisualElementMeta;\n lang?: string;\n title?: ReactNode;\n children?: ReactNode;\n source?: string;\n previewAlt?: boolean;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n textStyle: \"body.large\",\n display: \"inline\",\n \"& p\": {\n display: \"inline\",\n },\n },\n});\n\nexport const Concept = forwardRef<HTMLElement, ConceptProps>(\n ({ copyright, visualElement, lang, children, title, source, previewAlt, ...rest }, ref) => {\n const licenseProps = licenseAttributes(copyright?.license?.license, lang, source);\n\n return (\n <StyledFigure ref={ref} {...rest} {...licenseProps}>\n <ContentWrapper lang={lang}>\n {!!title && (\n <>\n <b>{title}</b>\n {` – `}\n </>\n )}\n {children}\n </ContentWrapper>\n {visualElement?.resource === \"image\" ? (\n <ImageEmbed embed={visualElement} lang={lang} previewAlt={previewAlt} />\n ) : visualElement?.resource === \"brightcove\" ? (\n <BrightcoveEmbed embed={visualElement} />\n ) : visualElement?.resource === \"h5p\" ? (\n <H5pEmbed embed={visualElement} />\n ) : visualElement?.resource === \"iframe\" ? (\n <IframeEmbed embed={visualElement} />\n ) : visualElement?.resource === \"external\" ? (\n <ExternalEmbed embed={visualElement} />\n ) : null}\n {!!copyright && <EmbedByline copyright={copyright} type=\"concept\" />}\n </StyledFigure>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;AA2BA,MAAM,eAAe,qCAAOA,0BAAQ,EAClC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;AACN,EACF,EAAC;AAEF,MAAM,iBAAiB,qCAAO,OAAO,EACnC,MAAM;CACJ,WAAW;CACX,SAAS;CACT,OAAO,EACL,SAAS,SACV;AACF,EACF,EAAC;AAEF,MAAa,UAAU,sBACrB,CAAC,EAAE,WAAW,eAAe,MAAM,UAAU,OAAO,QAAQ,WAAY,GAAG,MAAM,EAAE,QAAQ;CACzF,MAAM,eAAe,8GAAkB,WAAW,SAAS,SAAS,MAAM,OAAO;AAEjF,wBACE,4BAAC;EAAkB;EAAK,GAAI;EAAM,GAAI;;mBACpC,4BAAC;IAAqB;iBACjB,yBACD,qFACE,2BAAC,iBAAG,QAAU,GACZ,QACD,EAEJ;KACc;GAChB,eAAe,aAAa,0BAC3B,2BAACC;IAAW,OAAO;IAAqB;IAAkB;KAAc,GACtE,eAAe,aAAa,+BAC9B,2BAACC,qHAAgB,OAAO,gBAAiB,GACvC,eAAe,aAAa,wBAC9B,2BAACC,uGAAS,OAAO,gBAAiB,GAChC,eAAe,aAAa,2BAC9B,2BAACC,6GAAY,OAAO,gBAAiB,GACnC,eAAe,aAAa,6BAC9B,2BAACC,iHAAc,OAAO,gBAAiB,GACrC;KACD,6BAAa,2BAACC;IAAuB;IAAW,MAAK;KAAY;;GACvD;AAElB,EACF"}
1
+ {"version":3,"file":"Concept.js","names":["Figure","licenseAttributes","ImageEmbed","BrightcoveEmbed","H5pEmbed","IframeEmbed","ExternalEmbed","EmbedByline"],"sources":["../../src/Concept/Concept.tsx"],"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 ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { IDraftCopyrightDTO as ConceptCopyright } from \"@ndla/types-backend/concept-api\";\nimport type { ConceptVisualElementMeta } from \"@ndla/types-embed\";\nimport BrightcoveEmbed from \"../Embed/BrightcoveEmbed\";\nimport ExternalEmbed from \"../Embed/ExternalEmbed\";\nimport H5pEmbed from \"../Embed/H5pEmbed\";\nimport IframeEmbed from \"../Embed/IframeEmbed\";\nimport ImageEmbed from \"../Embed/ImageEmbed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nexport interface ConceptProps extends Omit<ComponentPropsWithRef<\"figure\">, \"title\"> {\n copyright?: ConceptCopyright;\n visualElement?: ConceptVisualElementMeta;\n lang?: string;\n title?: ReactNode;\n children?: ReactNode;\n source?: string;\n previewAlt?: boolean;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n textStyle: \"body.large\",\n display: \"inline\",\n \"& p\": {\n display: \"inline\",\n },\n },\n});\n\nexport const Concept = forwardRef<HTMLElement, ConceptProps>(\n ({ copyright, visualElement, lang, children, title, source, previewAlt, ...rest }, ref) => {\n const licenseProps = licenseAttributes(copyright?.license?.license, lang, source);\n\n return (\n <StyledFigure ref={ref} {...rest} {...licenseProps}>\n <ContentWrapper lang={lang}>\n {!!title && (\n <>\n <b>{title}</b>\n {` – `}\n </>\n )}\n {children}\n </ContentWrapper>\n {visualElement?.resource === \"image\" ? (\n <ImageEmbed embed={visualElement} lang={lang} previewAlt={previewAlt} />\n ) : visualElement?.resource === \"brightcove\" ? (\n <BrightcoveEmbed embed={visualElement} />\n ) : visualElement?.resource === \"h5p\" ? (\n <H5pEmbed embed={visualElement} />\n ) : visualElement?.resource === \"iframe\" ? (\n <IframeEmbed embed={visualElement} />\n ) : visualElement?.resource === \"external\" ? (\n <ExternalEmbed embed={visualElement} />\n ) : null}\n {!!copyright && <EmbedByline copyright={copyright} type=\"concept\" />}\n </StyledFigure>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;AA+BA,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACN,EACF,CAAC;AAEF,MAAM,sDAAwB,OAAO,EACnC,MAAM;CACJ,WAAW;CACX,SAAS;CACT,OAAO,EACL,SAAS,UACV;CACF,EACF,CAAC;AAEF,MAAa,iCACV,EAAE,WAAW,eAAe,MAAM,UAAU,OAAO,QAAQ,WAAY,GAAG,QAAQ,QAAQ;CACzF,MAAM,eAAeC,4CAAkB,WAAW,SAAS,SAAS,MAAM,OAAO;AAEjF,QACE,4CAAC;EAAkB;EAAK,GAAI;EAAM,GAAI;;GACpC,4CAAC;IAAqB;eACnB,CAAC,CAAC,SACD,qFACE,2CAAC,iBAAG,QAAU,EACb,SACA,EAEJ;KACc;GAChB,eAAe,aAAa,UAC3B,2CAACC;IAAW,OAAO;IAAqB;IAAkB;KAAc,GACtE,eAAe,aAAa,eAC9B,2CAACC,mCAAgB,OAAO,gBAAiB,GACvC,eAAe,aAAa,QAC9B,2CAACC,4BAAS,OAAO,gBAAiB,GAChC,eAAe,aAAa,WAC9B,2CAACC,+BAAY,OAAO,gBAAiB,GACnC,eAAe,aAAa,aAC9B,2CAACC,iCAAc,OAAO,gBAAiB,GACrC;GACH,CAAC,CAAC,aAAa,2CAACC;IAAuB;IAAW,MAAK;KAAY;;GACvD;EAGpB"}
@@ -1,9 +1,13 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_LicenseByline_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
- const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
4
- const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
5
- const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
6
- const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
2
+ const require_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
+ let __ndla_primitives = require("@ndla/primitives");
4
+ __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
5
+ let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
6
+ __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
7
+ let react_i18next = require("react-i18next");
8
+ react_i18next = require_rolldown_runtime.__toESM(react_i18next);
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
7
11
 
8
12
  //#region src/ContactBlock/ContactBlock.tsx
9
13
  const BackgroundVariant = {
@@ -133,7 +137,7 @@ const ContactBlock = ({ image, jobTitle, description, name, email, embedAlt, lan
133
137
  src: image.image.imageUrl,
134
138
  width: 300,
135
139
  height: 300
136
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_LicenseByline_EmbedByline.LicenseContainerContent, {
140
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedByline.LicenseContainerContent, {
137
141
  type: "image",
138
142
  copyright: image.copyright
139
143
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"ContactBlock.js","names":["BackgroundVariant: Record<ContactBlockBackground, SystemStyleObject>","Text","LicenseContainerContent"],"sources":["../../src/ContactBlock/ContactBlock.tsx"],"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 { Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { SystemStyleObject } from \"@ndla/styled-system/types\";\nimport type { IImageMetaInformationV3DTO } from \"@ndla/types-backend/image-api\";\nimport { LicenseContainerContent } from \"../LicenseByline/EmbedByline\";\n\nexport type ContactBlockBackground = \"strong\" | \"moderate\" | \"subtle\";\n\nconst BackgroundVariant: Record<ContactBlockBackground, SystemStyleObject> = {\n strong: { _before: { backgroundColor: \"surface.brand.3\" } },\n moderate: { _before: { backgroundColor: \"surface.brand.3.moderate\" } },\n subtle: { _before: { backgroundColor: \"surface.brand.3.subtle\" } },\n};\n\nexport const contactBlockBackgrounds = Object.keys(BackgroundVariant) as ContactBlockBackground[];\n\nconst StyledWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n minWidth: \"surface.xxsmall\",\n padding: \"medium\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n boxShadow: \"full\",\n border: \"1px solid\",\n gap: \"medium\",\n position: \"relative\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n overflow: \"hidden\",\n background: \"surface.default\",\n flexDirection: \"column-reverse\",\n tablet: {\n alignItems: \"unset\",\n flexDirection: \"row\",\n },\n },\n});\n\nconst EmailLink = styled(\"a\", {\n base: {\n color: \"text.default\",\n textDecoration: \"underline\",\n _hover: { textDecoration: \"none\" },\n _focusVisible: { textDecoration: \"none\" },\n },\n});\n\nconst HeaderWrapper = styled(\"div\", {\n base: {\n position: \"relative\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n zIndex: \"base\",\n _before: {\n content: '\"\"',\n position: \"absolute\",\n top: \"-60px\",\n left: \"-50px\",\n right: \"0\",\n bottom: \"0\",\n height: \"calc(100% + 50px)\",\n width: \"surface.3xlarge\",\n transform: \"rotate(-4deg)\",\n zIndex: \"hide\",\n },\n },\n variants: {\n variant: BackgroundVariant,\n imageExists: {\n true: {\n tabletDown: {\n _before: {\n display: \"none\",\n },\n },\n },\n },\n },\n});\n\nconst ImageWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"xxsmall\",\n alignItems: \"flex-start\",\n justifyContent: \"flex-start\",\n flexDirection: \"column\",\n zIndex: \"base\",\n tabletDown: {\n _before: {\n content: '\"\"',\n position: \"absolute\",\n top: \"-50px\",\n left: \"-50px\",\n right: \"0\",\n bottom: \"0\",\n height: \"surface.xxsmall\",\n width: \"surface.3xlarge\",\n transform: \"rotate(-4deg)\",\n zIndex: \"hide\",\n },\n },\n },\n variants: {\n variant: BackgroundVariant,\n },\n});\n\nconst StyledImage = styled(\"img\", {\n base: {\n borderRadius: \"xsmall\",\n width: \"surface.xsmall\",\n height: \"surface.xsmall\",\n objectFit: \"cover\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n flex: \"1\",\n width: \"100%\",\n },\n});\n\nconst StyledDescription = styled(Text, {\n base: {\n fontFamily: \"serif\",\n },\n});\n\ninterface Props {\n image?: IImageMetaInformationV3DTO;\n jobTitle: string;\n description: string;\n backgroundColor?: ContactBlockBackground;\n imageWidth?: number;\n name: string;\n email: string;\n embedAlt?: string;\n lang?: string;\n}\n\nexport const ContactBlock = ({\n image,\n jobTitle,\n description,\n name,\n email,\n embedAlt,\n lang,\n backgroundColor = \"strong\",\n}: Props) => {\n const { t } = useTranslation();\n return (\n <StyledWrapper data-embed-type=\"contact-block\">\n <ContentWrapper>\n <HeaderWrapper variant={backgroundColor} imageExists={!!image}>\n <Text lang={lang} fontWeight=\"bold\" textStyle=\"heading.small\">\n {name}\n </Text>\n <Text lang={lang}>{jobTitle}</Text>\n <Text>\n {`${t(\"email\")}: `}\n <EmailLink href={`mailto:${email}`}>{email}</EmailLink>\n </Text>\n </HeaderWrapper>\n <StyledDescription textStyle=\"body.large\">{description}</StyledDescription>\n </ContentWrapper>\n {!!image && (\n <ImageWrapper variant={backgroundColor}>\n <StyledImage\n alt={embedAlt !== undefined ? embedAlt : image.alttext.alttext}\n src={image.image.imageUrl}\n width={300}\n height={300}\n />\n <LicenseContainerContent type=\"image\" copyright={image.copyright} />\n </ImageWrapper>\n )}\n </StyledWrapper>\n );\n};\n"],"mappings":";;;;;;;;AAiBA,MAAMA,oBAAuE;CAC3E,QAAQ,EAAE,SAAS,EAAE,iBAAiB,kBAAmB,EAAE;CAC3D,UAAU,EAAE,SAAS,EAAE,iBAAiB,2BAA4B,EAAE;CACtE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,yBAA0B,EAAE;AACnE;AAED,MAAa,0BAA0B,OAAO,KAAK,kBAAkB;AAErE,MAAM,gBAAgB,qCAAO,OAAO,EAClC,MAAM;CACJ,SAAS;CACT,UAAU;CACV,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,WAAW;CACX,QAAQ;CACR,KAAK;CACL,UAAU;CACV,aAAa;CACb,cAAc;CACd,UAAU;CACV,YAAY;CACZ,eAAe;CACf,QAAQ;EACN,YAAY;EACZ,eAAe;CAChB;AACF,EACF,EAAC;AAEF,MAAM,YAAY,qCAAO,KAAK,EAC5B,MAAM;CACJ,OAAO;CACP,gBAAgB;CAChB,QAAQ,EAAE,gBAAgB,OAAQ;CAClC,eAAe,EAAE,gBAAgB,OAAQ;AAC1C,EACF,EAAC;AAEF,MAAM,gBAAgB,qCAAO,OAAO;CAClC,MAAM;EACJ,UAAU;EACV,SAAS;EACT,eAAe;EACf,KAAK;EACL,QAAQ;EACR,SAAS;GACP,SAAS;GACT,UAAU;GACV,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,QAAQ;GACR,OAAO;GACP,WAAW;GACX,QAAQ;EACT;CACF;CACD,UAAU;EACR,SAAS;EACT,aAAa,EACX,MAAM,EACJ,YAAY,EACV,SAAS,EACP,SAAS,OACV,EACF,EACF,EACF;CACF;AACF,EAAC;AAEF,MAAM,eAAe,qCAAO,OAAO;CACjC,MAAM;EACJ,SAAS;EACT,KAAK;EACL,YAAY;EACZ,gBAAgB;EAChB,eAAe;EACf,QAAQ;EACR,YAAY,EACV,SAAS;GACP,SAAS;GACT,UAAU;GACV,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,QAAQ;GACR,OAAO;GACP,WAAW;GACX,QAAQ;EACT,EACF;CACF;CACD,UAAU,EACR,SAAS,kBACV;AACF,EAAC;AAEF,MAAM,cAAc,qCAAO,OAAO,EAChC,MAAM;CACJ,cAAc;CACd,OAAO;CACP,QAAQ;CACR,WAAW;AACZ,EACF,EAAC;AAEF,MAAM,iBAAiB,qCAAO,OAAO,EACnC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,MAAM;CACN,OAAO;AACR,EACF,EAAC;AAEF,MAAM,oBAAoB,qCAAOC,wBAAM,EACrC,MAAM,EACJ,YAAY,QACb,EACF,EAAC;AAcF,MAAa,eAAe,CAAC,EAC3B,OACA,UACA,aACA,MACA,OACA,UACA,MACA,kBAAkB,UACZ,KAAK;CACX,MAAM,EAAE,GAAG,GAAG,mCAAgB;AAC9B,wBACE,4BAAC;EAAc,mBAAgB;6BAC7B,4BAAC,6CACC,4BAAC;GAAc,SAAS;GAAiB,eAAe;;oBACtD,2BAACA;KAAW;KAAM,YAAW;KAAO,WAAU;eAC3C;MACI;oBACP,2BAACA;KAAW;eAAO;MAAgB;oBACnC,4BAACA,sCACG,EAAE,EAAE,QAAQ,CAAC,qBACf,2BAAC;KAAU,OAAO,SAAS,MAAM;eAAI;MAAkB,IAClD;;IACO,kBAChB,2BAAC;GAAkB,WAAU;aAAc;IAAgC,IAC5D,IACd,yBACD,4BAAC;GAAa,SAAS;8BACrB,2BAAC;IACC,KAAK,sBAAyB,WAAW,MAAM,QAAQ;IACvD,KAAK,MAAM,MAAM;IACjB,OAAO;IACP,QAAQ;KACR,kBACF,2BAACC;IAAwB,MAAK;IAAQ,WAAW,MAAM;KAAa;IACvD;GAEH;AAEnB"}
1
+ {"version":3,"file":"ContactBlock.js","names":["BackgroundVariant: Record<ContactBlockBackground, SystemStyleObject>","Text","LicenseContainerContent"],"sources":["../../src/ContactBlock/ContactBlock.tsx"],"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 { Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { SystemStyleObject } from \"@ndla/styled-system/types\";\nimport type { IImageMetaInformationV3DTO } from \"@ndla/types-backend/image-api\";\nimport { LicenseContainerContent } from \"../LicenseByline/EmbedByline\";\n\nexport type ContactBlockBackground = \"strong\" | \"moderate\" | \"subtle\";\n\nconst BackgroundVariant: Record<ContactBlockBackground, SystemStyleObject> = {\n strong: { _before: { backgroundColor: \"surface.brand.3\" } },\n moderate: { _before: { backgroundColor: \"surface.brand.3.moderate\" } },\n subtle: { _before: { backgroundColor: \"surface.brand.3.subtle\" } },\n};\n\nexport const contactBlockBackgrounds = Object.keys(BackgroundVariant) as ContactBlockBackground[];\n\nconst StyledWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n minWidth: \"surface.xxsmall\",\n padding: \"medium\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n boxShadow: \"full\",\n border: \"1px solid\",\n gap: \"medium\",\n position: \"relative\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n overflow: \"hidden\",\n background: \"surface.default\",\n flexDirection: \"column-reverse\",\n tablet: {\n alignItems: \"unset\",\n flexDirection: \"row\",\n },\n },\n});\n\nconst EmailLink = styled(\"a\", {\n base: {\n color: \"text.default\",\n textDecoration: \"underline\",\n _hover: { textDecoration: \"none\" },\n _focusVisible: { textDecoration: \"none\" },\n },\n});\n\nconst HeaderWrapper = styled(\"div\", {\n base: {\n position: \"relative\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n zIndex: \"base\",\n _before: {\n content: '\"\"',\n position: \"absolute\",\n top: \"-60px\",\n left: \"-50px\",\n right: \"0\",\n bottom: \"0\",\n height: \"calc(100% + 50px)\",\n width: \"surface.3xlarge\",\n transform: \"rotate(-4deg)\",\n zIndex: \"hide\",\n },\n },\n variants: {\n variant: BackgroundVariant,\n imageExists: {\n true: {\n tabletDown: {\n _before: {\n display: \"none\",\n },\n },\n },\n },\n },\n});\n\nconst ImageWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"xxsmall\",\n alignItems: \"flex-start\",\n justifyContent: \"flex-start\",\n flexDirection: \"column\",\n zIndex: \"base\",\n tabletDown: {\n _before: {\n content: '\"\"',\n position: \"absolute\",\n top: \"-50px\",\n left: \"-50px\",\n right: \"0\",\n bottom: \"0\",\n height: \"surface.xxsmall\",\n width: \"surface.3xlarge\",\n transform: \"rotate(-4deg)\",\n zIndex: \"hide\",\n },\n },\n },\n variants: {\n variant: BackgroundVariant,\n },\n});\n\nconst StyledImage = styled(\"img\", {\n base: {\n borderRadius: \"xsmall\",\n width: \"surface.xsmall\",\n height: \"surface.xsmall\",\n objectFit: \"cover\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n flex: \"1\",\n width: \"100%\",\n },\n});\n\nconst StyledDescription = styled(Text, {\n base: {\n fontFamily: \"serif\",\n },\n});\n\ninterface Props {\n image?: IImageMetaInformationV3DTO;\n jobTitle: string;\n description: string;\n backgroundColor?: ContactBlockBackground;\n imageWidth?: number;\n name: string;\n email: string;\n embedAlt?: string;\n lang?: string;\n}\n\nexport const ContactBlock = ({\n image,\n jobTitle,\n description,\n name,\n email,\n embedAlt,\n lang,\n backgroundColor = \"strong\",\n}: Props) => {\n const { t } = useTranslation();\n return (\n <StyledWrapper data-embed-type=\"contact-block\">\n <ContentWrapper>\n <HeaderWrapper variant={backgroundColor} imageExists={!!image}>\n <Text lang={lang} fontWeight=\"bold\" textStyle=\"heading.small\">\n {name}\n </Text>\n <Text lang={lang}>{jobTitle}</Text>\n <Text>\n {`${t(\"email\")}: `}\n <EmailLink href={`mailto:${email}`}>{email}</EmailLink>\n </Text>\n </HeaderWrapper>\n <StyledDescription textStyle=\"body.large\">{description}</StyledDescription>\n </ContentWrapper>\n {!!image && (\n <ImageWrapper variant={backgroundColor}>\n <StyledImage\n alt={embedAlt !== undefined ? embedAlt : image.alttext.alttext}\n src={image.image.imageUrl}\n width={300}\n height={300}\n />\n <LicenseContainerContent type=\"image\" copyright={image.copyright} />\n </ImageWrapper>\n )}\n </StyledWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAMA,oBAAuE;CAC3E,QAAQ,EAAE,SAAS,EAAE,iBAAiB,mBAAmB,EAAE;CAC3D,UAAU,EAAE,SAAS,EAAE,iBAAiB,4BAA4B,EAAE;CACtE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,0BAA0B,EAAE;CACnE;AAED,MAAa,0BAA0B,OAAO,KAAK,kBAAkB;AAErE,MAAM,qDAAuB,OAAO,EAClC,MAAM;CACJ,SAAS;CACT,UAAU;CACV,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,WAAW;CACX,QAAQ;CACR,KAAK;CACL,UAAU;CACV,aAAa;CACb,cAAc;CACd,UAAU;CACV,YAAY;CACZ,eAAe;CACf,QAAQ;EACN,YAAY;EACZ,eAAe;EAChB;CACF,EACF,CAAC;AAEF,MAAM,iDAAmB,KAAK,EAC5B,MAAM;CACJ,OAAO;CACP,gBAAgB;CAChB,QAAQ,EAAE,gBAAgB,QAAQ;CAClC,eAAe,EAAE,gBAAgB,QAAQ;CAC1C,EACF,CAAC;AAEF,MAAM,qDAAuB,OAAO;CAClC,MAAM;EACJ,UAAU;EACV,SAAS;EACT,eAAe;EACf,KAAK;EACL,QAAQ;EACR,SAAS;GACP,SAAS;GACT,UAAU;GACV,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,QAAQ;GACR,OAAO;GACP,WAAW;GACX,QAAQ;GACT;EACF;CACD,UAAU;EACR,SAAS;EACT,aAAa,EACX,MAAM,EACJ,YAAY,EACV,SAAS,EACP,SAAS,QACV,EACF,EACF,EACF;EACF;CACF,CAAC;AAEF,MAAM,oDAAsB,OAAO;CACjC,MAAM;EACJ,SAAS;EACT,KAAK;EACL,YAAY;EACZ,gBAAgB;EAChB,eAAe;EACf,QAAQ;EACR,YAAY,EACV,SAAS;GACP,SAAS;GACT,UAAU;GACV,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,QAAQ;GACR,OAAO;GACP,WAAW;GACX,QAAQ;GACT,EACF;EACF;CACD,UAAU,EACR,SAAS,mBACV;CACF,CAAC;AAEF,MAAM,mDAAqB,OAAO,EAChC,MAAM;CACJ,cAAc;CACd,OAAO;CACP,QAAQ;CACR,WAAW;CACZ,EACF,CAAC;AAEF,MAAM,sDAAwB,OAAO,EACnC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,MAAM;CACN,OAAO;CACR,EACF,CAAC;AAEF,MAAM,yDAA2BC,wBAAM,EACrC,MAAM,EACJ,YAAY,SACb,EACF,CAAC;AAcF,MAAa,gBAAgB,EAC3B,OACA,UACA,aACA,MACA,OACA,UACA,MACA,kBAAkB,eACP;CACX,MAAM,EAAE,yCAAsB;AAC9B,QACE,4CAAC;EAAc,mBAAgB;aAC7B,4CAAC,6BACC,4CAAC;GAAc,SAAS;GAAiB,aAAa,CAAC,CAAC;;IACtD,2CAACA;KAAW;KAAM,YAAW;KAAO,WAAU;eAC3C;MACI;IACP,2CAACA;KAAW;eAAO;MAAgB;IACnC,4CAACA,qCACE,GAAG,EAAE,QAAQ,CAAC,KACf,2CAAC;KAAU,MAAM,UAAU;eAAU;MAAkB,IAClD;;IACO,EAChB,2CAAC;GAAkB,WAAU;aAAc;IAAgC,IAC5D,EAChB,CAAC,CAAC,SACD,4CAAC;GAAa,SAAS;cACrB,2CAAC;IACC,KAAK,aAAa,SAAY,WAAW,MAAM,QAAQ;IACvD,KAAK,MAAM,MAAM;IACjB,OAAO;IACP,QAAQ;KACR,EACF,2CAACC;IAAwB,MAAK;IAAQ,WAAW,MAAM;KAAa;IACvD;GAEH"}
@@ -1,31 +1,35 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType = require('../model/ContentType.js');
3
- const react = require_rolldown_runtime.__toESM(require("react"));
4
- const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
5
- const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
6
- const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
2
+ const require_ContentType = require('../model/ContentType.js');
3
+ let react = require("react");
4
+ react = require_rolldown_runtime.__toESM(react);
5
+ let __ndla_primitives = require("@ndla/primitives");
6
+ __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
7
+ let react_i18next = require("react-i18next");
8
+ react_i18next = require_rolldown_runtime.__toESM(react_i18next);
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
7
11
 
8
12
  //#region src/ContentTypeBadge/ContentTypeBadge.tsx
9
13
  const contentTypeToBadgeVariantMap = {
10
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.SUBJECT_MATERIAL]: "brand1",
11
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.TASKS_AND_ACTIVITIES]: "brand2",
12
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.ASSESSMENT_RESOURCES]: "brand2",
13
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.SUBJECT]: "neutral",
14
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.SOURCE_MATERIAL]: "brand1",
15
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.LEARNING_PATH]: "brand3",
16
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.TOPIC]: "neutral",
17
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.MULTIDISCIPLINARY]: "neutral",
18
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.CONCEPT]: "brand1",
19
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.EXTERNAL]: "brand2",
20
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.IMAGE]: "brand1",
21
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.AUDIO]: "brand1",
22
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.PODCAST]: "brand1",
23
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.VIDEO]: "brand1",
24
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.MISSING]: "neutral",
25
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.PODCAST_SERIES]: "brand1",
26
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.GLOSS]: "brand1",
27
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.PROGRAMME]: "neutral",
28
- [require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.FRONTPAGE_ARTICLE]: "brand2"
14
+ [require_ContentType.SUBJECT_MATERIAL]: "brand1",
15
+ [require_ContentType.TASKS_AND_ACTIVITIES]: "brand2",
16
+ [require_ContentType.ASSESSMENT_RESOURCES]: "brand2",
17
+ [require_ContentType.SUBJECT]: "neutral",
18
+ [require_ContentType.SOURCE_MATERIAL]: "brand1",
19
+ [require_ContentType.LEARNING_PATH]: "brand3",
20
+ [require_ContentType.TOPIC]: "neutral",
21
+ [require_ContentType.MULTIDISCIPLINARY]: "neutral",
22
+ [require_ContentType.CONCEPT]: "brand1",
23
+ [require_ContentType.EXTERNAL]: "brand2",
24
+ [require_ContentType.IMAGE]: "brand1",
25
+ [require_ContentType.AUDIO]: "brand1",
26
+ [require_ContentType.PODCAST]: "brand1",
27
+ [require_ContentType.VIDEO]: "brand1",
28
+ [require_ContentType.MISSING]: "neutral",
29
+ [require_ContentType.PODCAST_SERIES]: "brand1",
30
+ [require_ContentType.GLOSS]: "brand1",
31
+ [require_ContentType.PROGRAMME]: "neutral",
32
+ [require_ContentType.FRONTPAGE_ARTICLE]: "brand2"
29
33
  };
30
34
  const ContentTypeBadge = (0, react.forwardRef)(({ contentType, children,...props }, ref) => {
31
35
  const { t } = (0, react_i18next.useTranslation)();
@@ -1 +1 @@
1
- {"version":3,"file":"ContentTypeBadge.js","names":["contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant>","Badge"],"sources":["../../src/ContentTypeBadge/ContentTypeBadge.tsx"],"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 { forwardRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Badge, type BadgeProps, type BadgeVariant } from \"@ndla/primitives\";\nimport * as contentTypes from \"../model/ContentType\";\n\nexport interface ContentTypeBadgeProps extends Omit<BadgeProps, \"colorTheme\"> {\n contentType: ContentType | undefined;\n}\n\nexport type StrictContentType =\n | typeof contentTypes.SUBJECT_MATERIAL\n | typeof contentTypes.TASKS_AND_ACTIVITIES\n | typeof contentTypes.ASSESSMENT_RESOURCES\n | typeof contentTypes.SUBJECT\n | typeof contentTypes.SOURCE_MATERIAL\n | typeof contentTypes.LEARNING_PATH\n | typeof contentTypes.TOPIC\n | typeof contentTypes.MULTIDISCIPLINARY\n | typeof contentTypes.CONCEPT\n | typeof contentTypes.EXTERNAL\n | typeof contentTypes.IMAGE\n | typeof contentTypes.AUDIO\n | typeof contentTypes.VIDEO\n | typeof contentTypes.MISSING\n | typeof contentTypes.PODCAST\n | typeof contentTypes.GLOSS\n | typeof contentTypes.PROGRAMME\n | typeof contentTypes.PODCAST_SERIES\n | typeof contentTypes.FRONTPAGE_ARTICLE;\n\nexport type ContentType =\n | StrictContentType\n // This allows for us to fallback to string without getting a ts error, while still keeping intellisense\n | (string & {});\n\nexport const contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant> = {\n [contentTypes.SUBJECT_MATERIAL]: \"brand1\",\n [contentTypes.TASKS_AND_ACTIVITIES]: \"brand2\",\n [contentTypes.ASSESSMENT_RESOURCES]: \"brand2\",\n [contentTypes.SUBJECT]: \"neutral\",\n [contentTypes.SOURCE_MATERIAL]: \"brand1\",\n [contentTypes.LEARNING_PATH]: \"brand3\",\n [contentTypes.TOPIC]: \"neutral\",\n [contentTypes.MULTIDISCIPLINARY]: \"neutral\",\n [contentTypes.CONCEPT]: \"brand1\",\n [contentTypes.EXTERNAL]: \"brand2\",\n [contentTypes.IMAGE]: \"brand1\",\n [contentTypes.AUDIO]: \"brand1\",\n [contentTypes.PODCAST]: \"brand1\",\n [contentTypes.VIDEO]: \"brand1\",\n [contentTypes.MISSING]: \"neutral\",\n [contentTypes.PODCAST_SERIES]: \"brand1\",\n [contentTypes.GLOSS]: \"brand1\",\n [contentTypes.PROGRAMME]: \"neutral\",\n [contentTypes.FRONTPAGE_ARTICLE]: \"brand2\",\n};\n\nexport const ContentTypeBadge = forwardRef<HTMLDivElement, ContentTypeBadgeProps>(\n ({ contentType, children, ...props }, ref) => {\n const { t } = useTranslation();\n return (\n <Badge\n colorTheme={contentTypeToBadgeVariantMap[contentType ?? \"missing\"] ?? contentTypeToBadgeVariantMap[\"missing\"]}\n {...props}\n ref={ref}\n >\n {children ?? t(`contentTypes.${contentType}`)}\n </Badge>\n );\n },\n);\n"],"mappings":";;;;;;;;AA2CA,MAAaA,+BAAkE;2GAC5C;+GACI;+GACA;kGACb;0GACQ;wGACF;gGACR;4GACY;kGACV;mGACC;gGACH;gGACA;kGACE;gGACF;kGACE;yGACO;gGACT;oGACI;4GACQ;AACnC;AAED,MAAa,mBAAmB,sBAC9B,CAAC,EAAE,aAAa,SAAU,GAAG,OAAO,EAAE,QAAQ;CAC5C,MAAM,EAAE,GAAG,GAAG,mCAAgB;AAC9B,wBACE,2BAACC;EACC,YAAY,6BAA6B,eAAe,cAAc,6BAA6B;EACnG,GAAI;EACC;YAEJ,YAAY,GAAG,eAAe,YAAY,EAAE;GACvC;AAEX,EACF"}
1
+ {"version":3,"file":"ContentTypeBadge.js","names":["contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant>","Badge"],"sources":["../../src/ContentTypeBadge/ContentTypeBadge.tsx"],"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 { forwardRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Badge, type BadgeProps, type BadgeVariant } from \"@ndla/primitives\";\nimport * as contentTypes from \"../model/ContentType\";\n\nexport interface ContentTypeBadgeProps extends Omit<BadgeProps, \"colorTheme\"> {\n contentType: ContentType | undefined;\n}\n\nexport type StrictContentType =\n | typeof contentTypes.SUBJECT_MATERIAL\n | typeof contentTypes.TASKS_AND_ACTIVITIES\n | typeof contentTypes.ASSESSMENT_RESOURCES\n | typeof contentTypes.SUBJECT\n | typeof contentTypes.SOURCE_MATERIAL\n | typeof contentTypes.LEARNING_PATH\n | typeof contentTypes.TOPIC\n | typeof contentTypes.MULTIDISCIPLINARY\n | typeof contentTypes.CONCEPT\n | typeof contentTypes.EXTERNAL\n | typeof contentTypes.IMAGE\n | typeof contentTypes.AUDIO\n | typeof contentTypes.VIDEO\n | typeof contentTypes.MISSING\n | typeof contentTypes.PODCAST\n | typeof contentTypes.GLOSS\n | typeof contentTypes.PROGRAMME\n | typeof contentTypes.PODCAST_SERIES\n | typeof contentTypes.FRONTPAGE_ARTICLE;\n\nexport type ContentType =\n | StrictContentType\n // This allows for us to fallback to string without getting a ts error, while still keeping intellisense\n | (string & {});\n\nexport const contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant> = {\n [contentTypes.SUBJECT_MATERIAL]: \"brand1\",\n [contentTypes.TASKS_AND_ACTIVITIES]: \"brand2\",\n [contentTypes.ASSESSMENT_RESOURCES]: \"brand2\",\n [contentTypes.SUBJECT]: \"neutral\",\n [contentTypes.SOURCE_MATERIAL]: \"brand1\",\n [contentTypes.LEARNING_PATH]: \"brand3\",\n [contentTypes.TOPIC]: \"neutral\",\n [contentTypes.MULTIDISCIPLINARY]: \"neutral\",\n [contentTypes.CONCEPT]: \"brand1\",\n [contentTypes.EXTERNAL]: \"brand2\",\n [contentTypes.IMAGE]: \"brand1\",\n [contentTypes.AUDIO]: \"brand1\",\n [contentTypes.PODCAST]: \"brand1\",\n [contentTypes.VIDEO]: \"brand1\",\n [contentTypes.MISSING]: \"neutral\",\n [contentTypes.PODCAST_SERIES]: \"brand1\",\n [contentTypes.GLOSS]: \"brand1\",\n [contentTypes.PROGRAMME]: \"neutral\",\n [contentTypes.FRONTPAGE_ARTICLE]: \"brand2\",\n};\n\nexport const ContentTypeBadge = forwardRef<HTMLDivElement, ContentTypeBadgeProps>(\n ({ contentType, children, ...props }, ref) => {\n const { t } = useTranslation();\n return (\n <Badge\n colorTheme={contentTypeToBadgeVariantMap[contentType ?? \"missing\"] ?? contentTypeToBadgeVariantMap[\"missing\"]}\n {...props}\n ref={ref}\n >\n {children ?? t(`contentTypes.${contentType}`)}\n </Badge>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;AA2CA,MAAaA,+BAAkE;yCAC5C;6CACI;6CACA;gCACb;wCACQ;sCACF;8BACR;0CACY;gCACV;iCACC;8BACH;8BACA;gCACE;8BACF;gCACE;uCACO;8BACT;kCACI;0CACQ;CACnC;AAED,MAAa,0CACV,EAAE,aAAa,SAAU,GAAG,SAAS,QAAQ;CAC5C,MAAM,EAAE,yCAAsB;AAC9B,QACE,2CAACC;EACC,YAAY,6BAA6B,eAAe,cAAc,6BAA6B;EACnG,GAAI;EACC;YAEJ,YAAY,EAAE,gBAAgB,cAAc;GACvC;EAGb"}
@@ -1,10 +1,16 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
- const react = require_rolldown_runtime.__toESM(require("react"));
3
- const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
4
- const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
5
- const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
6
- const __ndla_icons = require_rolldown_runtime.__toESM(require("@ndla/icons"));
7
- const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
2
+ let react = require("react");
3
+ react = require_rolldown_runtime.__toESM(react);
4
+ let __ndla_primitives = require("@ndla/primitives");
5
+ __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
6
+ let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
7
+ __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
8
+ let react_i18next = require("react-i18next");
9
+ react_i18next = require_rolldown_runtime.__toESM(react_i18next);
10
+ let __ndla_icons = require("@ndla/icons");
11
+ __ndla_icons = require_rolldown_runtime.__toESM(__ndla_icons);
12
+ let react_jsx_runtime = require("react/jsx-runtime");
13
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
8
14
 
9
15
  //#region src/CopyParagraphButton/CopyParagraphButton.tsx
10
16
  const ContainerDiv = (0, __ndla_styled_system_jsx.styled)("div", { base: {
@@ -60,5 +66,5 @@ const CopyParagraphButton = ({ children, copyText, lang }) => {
60
66
  var CopyParagraphButton_default = CopyParagraphButton;
61
67
 
62
68
  //#endregion
63
- exports.CopyParagraphButton_default$1 = CopyParagraphButton_default;
69
+ exports.default = CopyParagraphButton_default;
64
70
  //# sourceMappingURL=CopyParagraphButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyParagraphButton.js","names":["IconButton","LinkMedium"],"sources":["../../src/CopyParagraphButton/CopyParagraphButton.tsx"],"sourcesContent":["/**\n * Copyright (c) 2021-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 ReactNode, useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { LinkMedium } from \"@ndla/icons\";\nimport { IconButton } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst ContainerDiv = styled(\"div\", {\n base: {\n position: \"relative\",\n _hover: {\n \"& [data-copy-button]\": {\n opacity: \"1\",\n cursor: \"pointer\",\n },\n },\n },\n});\n\nconst StyledIconButton = styled(IconButton, {\n base: {\n position: \"absolute\",\n left: \"-xxlarge\",\n top: \"-4xsmall\",\n opacity: \"0\",\n cursor: \"pointer\",\n \"&:focus, &:focus-visible, &:active\": {\n opacity: \"1\",\n },\n },\n});\n\ninterface Props {\n // What to render within the h2\n children: ReactNode;\n copyText: string;\n lang?: string;\n}\nconst CopyParagraphButton = ({ children, copyText, lang }: Props) => {\n const [hasCopied, setHasCopied] = useState(false);\n const { t } = useTranslation();\n const sanitizedTitle = useMemo(() => encodeURIComponent(copyText.replace(/ /g, \"-\")), [copyText]);\n\n useEffect(() => {\n if (hasCopied) {\n setTimeout(() => setHasCopied(false), 3000);\n }\n }, [hasCopied]);\n\n const onCopyClick = useCallback(async () => {\n const { location } = window;\n const newHash = `#${sanitizedTitle}`;\n const port = location.port ? `:${location.port}` : \"\";\n const urlToCopy = `${location.protocol}//${location.hostname}${port}${location.pathname}${location.search}${newHash}`;\n try {\n await navigator.clipboard.writeText(urlToCopy);\n setHasCopied(true);\n } catch {\n // do nothing\n }\n }, [sanitizedTitle]);\n\n const tooltip = hasCopied ? t(\"article.copyPageLinkCopied\") : t(\"article.copyHeaderLink\");\n return (\n <ContainerDiv data-embed-type=\"copy-heading\">\n <StyledIconButton\n variant=\"clear\"\n data-copy-button=\"\"\n onClick={onCopyClick}\n title={tooltip}\n aria-label={`${tooltip}: ${copyText}`}\n >\n <LinkMedium />\n </StyledIconButton>\n <h2 id={sanitizedTitle} tabIndex={-1} lang={lang}>\n {children}\n </h2>\n </ContainerDiv>\n );\n};\n\nexport default CopyParagraphButton;\n"],"mappings":";;;;;;;;;AAcA,MAAM,eAAe,qCAAO,OAAO,EACjC,MAAM;CACJ,UAAU;CACV,QAAQ,EACN,wBAAwB;EACtB,SAAS;EACT,QAAQ;CACT,EACF;AACF,EACF,EAAC;AAEF,MAAM,mBAAmB,qCAAOA,8BAAY,EAC1C,MAAM;CACJ,UAAU;CACV,MAAM;CACN,KAAK;CACL,SAAS;CACT,QAAQ;CACR,sCAAsC,EACpC,SAAS,IACV;AACF,EACF,EAAC;AAQF,MAAM,sBAAsB,CAAC,EAAE,UAAU,UAAU,MAAa,KAAK;CACnE,MAAM,CAAC,WAAW,aAAa,GAAG,oBAAS,MAAM;CACjD,MAAM,EAAE,GAAG,GAAG,mCAAgB;CAC9B,MAAM,iBAAiB,mBAAQ,MAAM,mBAAmB,SAAS,QAAQ,MAAM,IAAI,CAAC,EAAE,CAAC,QAAS,EAAC;AAEjG,sBAAU,MAAM;AACd,MAAI,UACF,YAAW,MAAM,aAAa,MAAM,EAAE,IAAK;CAE9C,GAAE,CAAC,SAAU,EAAC;CAEf,MAAM,cAAc,uBAAY,YAAY;EAC1C,MAAM,EAAE,UAAU,GAAG;EACrB,MAAM,WAAW,GAAG,eAAe;EACnC,MAAM,OAAO,SAAS,QAAQ,GAAG,SAAS,KAAK,IAAI;EACnD,MAAM,aAAa,EAAE,SAAS,SAAS,IAAI,SAAS,SAAS,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,SAAS,OAAO,EAAE,QAAQ;AACpH,MAAI;AACF,SAAM,UAAU,UAAU,UAAU,UAAU;AAC9C,gBAAa,KAAK;EACnB,QAAO,CAEP;CACF,GAAE,CAAC,cAAe,EAAC;CAEpB,MAAM,UAAU,YAAY,EAAE,6BAA6B,GAAG,EAAE,yBAAyB;AACzF,wBACE,4BAAC;EAAa,mBAAgB;6BAC5B,2BAAC;GACC,SAAQ;GACR,oBAAiB;GACjB,SAAS;GACT,OAAO;GACP,eAAa,EAAE,QAAQ,IAAI,SAAS;6BAEpC,2BAACC,4BAAa;IACG,kBACnB,2BAAC;GAAG,IAAI;GAAgB,UAAU;GAAU;GACzC;IACE;GACQ;AAElB;AAED,kCAAe"}
1
+ {"version":3,"file":"CopyParagraphButton.js","names":["IconButton","LinkMedium"],"sources":["../../src/CopyParagraphButton/CopyParagraphButton.tsx"],"sourcesContent":["/**\n * Copyright (c) 2021-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 ReactNode, useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { LinkMedium } from \"@ndla/icons\";\nimport { IconButton } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst ContainerDiv = styled(\"div\", {\n base: {\n position: \"relative\",\n _hover: {\n \"& [data-copy-button]\": {\n opacity: \"1\",\n cursor: \"pointer\",\n },\n },\n },\n});\n\nconst StyledIconButton = styled(IconButton, {\n base: {\n position: \"absolute\",\n left: \"-xxlarge\",\n top: \"-4xsmall\",\n opacity: \"0\",\n cursor: \"pointer\",\n \"&:focus, &:focus-visible, &:active\": {\n opacity: \"1\",\n },\n },\n});\n\ninterface Props {\n // What to render within the h2\n children: ReactNode;\n copyText: string;\n lang?: string;\n}\nconst CopyParagraphButton = ({ children, copyText, lang }: Props) => {\n const [hasCopied, setHasCopied] = useState(false);\n const { t } = useTranslation();\n const sanitizedTitle = useMemo(() => encodeURIComponent(copyText.replace(/ /g, \"-\")), [copyText]);\n\n useEffect(() => {\n if (hasCopied) {\n setTimeout(() => setHasCopied(false), 3000);\n }\n }, [hasCopied]);\n\n const onCopyClick = useCallback(async () => {\n const { location } = window;\n const newHash = `#${sanitizedTitle}`;\n const port = location.port ? `:${location.port}` : \"\";\n const urlToCopy = `${location.protocol}//${location.hostname}${port}${location.pathname}${location.search}${newHash}`;\n try {\n await navigator.clipboard.writeText(urlToCopy);\n setHasCopied(true);\n } catch {\n // do nothing\n }\n }, [sanitizedTitle]);\n\n const tooltip = hasCopied ? t(\"article.copyPageLinkCopied\") : t(\"article.copyHeaderLink\");\n return (\n <ContainerDiv data-embed-type=\"copy-heading\">\n <StyledIconButton\n variant=\"clear\"\n data-copy-button=\"\"\n onClick={onCopyClick}\n title={tooltip}\n aria-label={`${tooltip}: ${copyText}`}\n >\n <LinkMedium />\n </StyledIconButton>\n <h2 id={sanitizedTitle} tabIndex={-1} lang={lang}>\n {children}\n </h2>\n </ContainerDiv>\n );\n};\n\nexport default CopyParagraphButton;\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,oDAAsB,OAAO,EACjC,MAAM;CACJ,UAAU;CACV,QAAQ,EACN,wBAAwB;EACtB,SAAS;EACT,QAAQ;EACT,EACF;CACF,EACF,CAAC;AAEF,MAAM,wDAA0BA,8BAAY,EAC1C,MAAM;CACJ,UAAU;CACV,MAAM;CACN,KAAK;CACL,SAAS;CACT,QAAQ;CACR,sCAAsC,EACpC,SAAS,KACV;CACF,EACF,CAAC;AAQF,MAAM,uBAAuB,EAAE,UAAU,UAAU,WAAkB;CACnE,MAAM,CAAC,WAAW,oCAAyB,MAAM;CACjD,MAAM,EAAE,yCAAsB;CAC9B,MAAM,0CAA+B,mBAAmB,SAAS,QAAQ,MAAM,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC;AAEjG,4BAAgB;AACd,MAAI,UACF,kBAAiB,aAAa,MAAM,EAAE,IAAK;IAE5C,CAAC,UAAU,CAAC;CAEf,MAAM,qCAA0B,YAAY;EAC1C,MAAM,EAAE,aAAa;EACrB,MAAM,UAAU,IAAI;EACpB,MAAM,OAAO,SAAS,OAAO,IAAI,SAAS,SAAS;EACnD,MAAM,YAAY,GAAG,SAAS,SAAS,IAAI,SAAS,WAAW,OAAO,SAAS,WAAW,SAAS,SAAS;AAC5G,MAAI;AACF,SAAM,UAAU,UAAU,UAAU,UAAU;AAC9C,gBAAa,KAAK;UACZ;IAGP,CAAC,eAAe,CAAC;CAEpB,MAAM,UAAU,YAAY,EAAE,6BAA6B,GAAG,EAAE,yBAAyB;AACzF,QACE,4CAAC;EAAa,mBAAgB;aAC5B,2CAAC;GACC,SAAQ;GACR,oBAAiB;GACjB,SAAS;GACT,OAAO;GACP,cAAY,GAAG,QAAQ,IAAI;aAE3B,2CAACC,4BAAa;IACG,EACnB,2CAAC;GAAG,IAAI;GAAgB,UAAU;GAAU;GACzC;IACE;GACQ;;AAInB,kCAAe"}
@@ -1,19 +1,22 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_LicenseByline_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
4
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_utils_licenseAttributes = require('../utils/licenseAttributes.js');
5
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_AudioPlayer_index = require('../AudioPlayer/index.js');
6
- const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
7
- const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
8
- const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
2
+ const require_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
+ const require_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
4
+ const require_licenseAttributes = require('../utils/licenseAttributes.js');
5
+ const require_AudioPlayer = require('../AudioPlayer/AudioPlayer.js');
6
+ let __ndla_primitives = require("@ndla/primitives");
7
+ __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
8
+ let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
9
+ __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
10
+ let react_jsx_runtime = require("react/jsx-runtime");
11
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
9
12
 
10
13
  //#region src/Embed/AudioEmbed.tsx
11
14
  const StyledFigure = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Figure, { base: { clear: "both" } });
12
15
  const AudioEmbed = ({ embed, lang }) => {
13
16
  const type = embed.embedData.type === "standard" ? "audio" : "podcast";
14
- if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_EmbedErrorPlaceholder.EmbedErrorPlaceholder_default, { type });
17
+ if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedErrorPlaceholder.default, { type });
15
18
  const { data, embedData } = embed;
16
- if (embedData.type === "minimal") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_AudioPlayer_index.AudioPlayer_default, {
19
+ if (embedData.type === "minimal") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AudioPlayer.default, {
17
20
  speech: true,
18
21
  src: data.audioFile.url,
19
22
  title: data.title.title
@@ -27,19 +30,19 @@ const AudioEmbed = ({ embed, lang }) => {
27
30
  url: coverPhoto.url,
28
31
  alt: coverPhoto.altText
29
32
  };
30
- const licenseProps = require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_utils_licenseAttributes.licenseAttributes(data.copyright.license.license, lang, embedData.url);
33
+ const licenseProps = require_licenseAttributes.licenseAttributes(data.copyright.license.license, lang, embedData.url);
31
34
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledFigure, {
32
35
  lang,
33
36
  "data-embed-type": type,
34
37
  ...licenseProps,
35
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_AudioPlayer_index.AudioPlayer_default, {
38
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AudioPlayer.default, {
36
39
  description: data.podcastMeta?.introduction ?? "",
37
40
  img,
38
41
  src: data.audioFile.url,
39
42
  textVersion: data.manuscript?.manuscript.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { dangerouslySetInnerHTML: { __html: data.manuscript.manuscript } }) : void 0,
40
43
  title: data.title.title,
41
44
  subtitle
42
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_LicenseByline_EmbedByline.EmbedByline, {
45
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedByline.EmbedByline, {
43
46
  error: false,
44
47
  type: data.audioType === "standard" ? "audio" : "podcast",
45
48
  copyright: embed.data.copyright
@@ -49,5 +52,5 @@ const AudioEmbed = ({ embed, lang }) => {
49
52
  var AudioEmbed_default = AudioEmbed;
50
53
 
51
54
  //#endregion
52
- exports.AudioEmbed_default = AudioEmbed_default;
55
+ exports.default = AudioEmbed_default;
53
56
  //# sourceMappingURL=AudioEmbed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AudioEmbed.js","names":["Figure","EmbedErrorPlaceholder","AudioPlayer","EmbedByline"],"sources":["../../src/Embed/AudioEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-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 { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { AudioMetaData } from \"@ndla/types-embed\";\nimport EmbedErrorPlaceholder from \"./EmbedErrorPlaceholder\";\nimport type { Author } from \"./ImageEmbed\";\nimport AudioPlayer from \"../AudioPlayer\";\nimport { EmbedByline } from \"../LicenseByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nconst StyledFigure = styled(Figure, {\n base: {\n clear: \"both\",\n },\n});\n\ninterface Props {\n embed: AudioMetaData;\n lang?: string;\n}\n\nexport const getFirstNonEmptyLicenseCredits = (authors: {\n creators: Author[];\n rightsholders: Author[];\n processors: Author[];\n}) => Object.values(authors).find((i) => i.length > 0) ?? [];\n\nconst AudioEmbed = ({ embed, lang }: Props) => {\n const type = embed.embedData.type === \"standard\" ? \"audio\" : \"podcast\";\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type={type} />;\n }\n\n const { data, embedData } = embed;\n\n if (embedData.type === \"minimal\") {\n return <AudioPlayer speech src={data.audioFile.url} title={data.title.title} />;\n }\n\n const subtitle = data.series ? { title: data.series.title.title, url: `/podkast/${data.series.id}` } : undefined;\n\n const coverPhoto = data.podcastMeta?.coverPhoto;\n\n const img = coverPhoto && { url: coverPhoto.url, alt: coverPhoto.altText };\n\n const licenseProps = licenseAttributes(data.copyright.license.license, lang, embedData.url);\n\n return (\n <StyledFigure lang={lang} data-embed-type={type} {...licenseProps}>\n <AudioPlayer\n description={data.podcastMeta?.introduction ?? \"\"}\n img={img}\n src={data.audioFile.url}\n textVersion={\n data.manuscript?.manuscript.length ? (\n <div dangerouslySetInnerHTML={{ __html: data.manuscript.manuscript }} />\n ) : undefined\n }\n title={data.title.title}\n subtitle={subtitle}\n />\n <EmbedByline\n error={false}\n type={data.audioType === \"standard\" ? \"audio\" : \"podcast\"}\n copyright={embed.data.copyright}\n />\n </StyledFigure>\n );\n};\n\nexport default AudioEmbed;\n"],"mappings":";;;;;;;;;;AAiBA,MAAM,eAAe,qCAAOA,0BAAQ,EAClC,MAAM,EACJ,OAAO,OACR,EACF,EAAC;AAaF,MAAM,aAAa,CAAC,EAAE,OAAO,MAAa,KAAK;CAC7C,MAAM,OAAO,MAAM,UAAU,SAAS,aAAa,UAAU;AAC7D,KAAI,MAAM,WAAW,QACnB,wBAAO,2BAACC,iIAA4B,OAAQ;CAG9C,MAAM,EAAE,MAAM,WAAW,GAAG;AAE5B,KAAI,UAAU,SAAS,UACrB,wBAAO,2BAACC;EAAY;EAAO,KAAK,KAAK,UAAU;EAAK,OAAO,KAAK,MAAM;GAAS;CAGjF,MAAM,WAAW,KAAK,SAAS;EAAE,OAAO,KAAK,OAAO,MAAM;EAAO,MAAM,WAAW,KAAK,OAAO,GAAG;CAAG;CAEpG,MAAM,aAAa,KAAK,aAAa;CAErC,MAAM,MAAM,cAAc;EAAE,KAAK,WAAW;EAAK,KAAK,WAAW;CAAS;CAE1E,MAAM,eAAe,8GAAkB,KAAK,UAAU,QAAQ,SAAS,MAAM,UAAU,IAAI;AAE3F,wBACE,4BAAC;EAAmB;EAAM,mBAAiB;EAAM,GAAI;6BACnD,2BAACA;GACC,aAAa,KAAK,aAAa,gBAAgB;GAC1C;GACL,KAAK,KAAK,UAAU;GACpB,aACE,KAAK,YAAY,WAAW,yBAC1B,2BAAC,SAAI,yBAAyB,EAAE,QAAQ,KAAK,WAAW,WAAY,IAAI;GAG5E,OAAO,KAAK,MAAM;GACR;IACV,kBACF,2BAACC;GACC,OAAO;GACP,MAAM,KAAK,cAAc,aAAa,UAAU;GAChD,WAAW,MAAM,KAAK;IACtB;GACW;AAElB;AAED,yBAAe"}
1
+ {"version":3,"file":"AudioEmbed.js","names":["Figure","EmbedErrorPlaceholder","AudioPlayer","licenseAttributes","EmbedByline"],"sources":["../../src/Embed/AudioEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-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 { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { AudioMetaData } from \"@ndla/types-embed\";\nimport EmbedErrorPlaceholder from \"./EmbedErrorPlaceholder\";\nimport type { Author } from \"./ImageEmbed\";\nimport AudioPlayer from \"../AudioPlayer/AudioPlayer\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nconst StyledFigure = styled(Figure, {\n base: {\n clear: \"both\",\n },\n});\n\ninterface Props {\n embed: AudioMetaData;\n lang?: string;\n}\n\nexport const getFirstNonEmptyLicenseCredits = (authors: {\n creators: Author[];\n rightsholders: Author[];\n processors: Author[];\n}) => Object.values(authors).find((i) => i.length > 0) ?? [];\n\nconst AudioEmbed = ({ embed, lang }: Props) => {\n const type = embed.embedData.type === \"standard\" ? \"audio\" : \"podcast\";\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type={type} />;\n }\n\n const { data, embedData } = embed;\n\n if (embedData.type === \"minimal\") {\n return <AudioPlayer speech src={data.audioFile.url} title={data.title.title} />;\n }\n\n const subtitle = data.series ? { title: data.series.title.title, url: `/podkast/${data.series.id}` } : undefined;\n\n const coverPhoto = data.podcastMeta?.coverPhoto;\n\n const img = coverPhoto && { url: coverPhoto.url, alt: coverPhoto.altText };\n\n const licenseProps = licenseAttributes(data.copyright.license.license, lang, embedData.url);\n\n return (\n <StyledFigure lang={lang} data-embed-type={type} {...licenseProps}>\n <AudioPlayer\n description={data.podcastMeta?.introduction ?? \"\"}\n img={img}\n src={data.audioFile.url}\n textVersion={\n data.manuscript?.manuscript.length ? (\n <div dangerouslySetInnerHTML={{ __html: data.manuscript.manuscript }} />\n ) : undefined\n }\n title={data.title.title}\n subtitle={subtitle}\n />\n <EmbedByline\n error={false}\n type={data.audioType === \"standard\" ? \"audio\" : \"podcast\"}\n copyright={embed.data.copyright}\n />\n </StyledFigure>\n );\n};\n\nexport default AudioEmbed;\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM,EACJ,OAAO,QACR,EACF,CAAC;AAaF,MAAM,cAAc,EAAE,OAAO,WAAkB;CAC7C,MAAM,OAAO,MAAM,UAAU,SAAS,aAAa,UAAU;AAC7D,KAAI,MAAM,WAAW,QACnB,QAAO,2CAACC,yCAA4B,OAAQ;CAG9C,MAAM,EAAE,MAAM,cAAc;AAE5B,KAAI,UAAU,SAAS,UACrB,QAAO,2CAACC;EAAY;EAAO,KAAK,KAAK,UAAU;EAAK,OAAO,KAAK,MAAM;GAAS;CAGjF,MAAM,WAAW,KAAK,SAAS;EAAE,OAAO,KAAK,OAAO,MAAM;EAAO,KAAK,YAAY,KAAK,OAAO;EAAM,GAAG;CAEvG,MAAM,aAAa,KAAK,aAAa;CAErC,MAAM,MAAM,cAAc;EAAE,KAAK,WAAW;EAAK,KAAK,WAAW;EAAS;CAE1E,MAAM,eAAeC,4CAAkB,KAAK,UAAU,QAAQ,SAAS,MAAM,UAAU,IAAI;AAE3F,QACE,4CAAC;EAAmB;EAAM,mBAAiB;EAAM,GAAI;aACnD,2CAACD;GACC,aAAa,KAAK,aAAa,gBAAgB;GAC1C;GACL,KAAK,KAAK,UAAU;GACpB,aACE,KAAK,YAAY,WAAW,SAC1B,2CAAC,SAAI,yBAAyB,EAAE,QAAQ,KAAK,WAAW,YAAY,GAAI,GACtE;GAEN,OAAO,KAAK,MAAM;GACR;IACV,EACF,2CAACE;GACC,OAAO;GACP,MAAM,KAAK,cAAc,aAAa,UAAU;GAChD,WAAW,MAAM,KAAK;IACtB;GACW;;AAInB,yBAAe"}
@@ -1,13 +1,19 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_LicenseByline_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
4
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_utils_licenseAttributes = require('../utils/licenseAttributes.js');
5
- const react = require_rolldown_runtime.__toESM(require("react"));
6
- const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
7
- const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
8
- const html_react_parser = require_rolldown_runtime.__toESM(require("html-react-parser"));
9
- const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
10
- const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
2
+ const require_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
+ const require_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
4
+ const require_licenseAttributes = require('../utils/licenseAttributes.js');
5
+ let react = require("react");
6
+ react = require_rolldown_runtime.__toESM(react);
7
+ let __ndla_primitives = require("@ndla/primitives");
8
+ __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
9
+ let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
10
+ __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
11
+ let html_react_parser = require("html-react-parser");
12
+ html_react_parser = require_rolldown_runtime.__toESM(html_react_parser);
13
+ let react_i18next = require("react-i18next");
14
+ react_i18next = require_rolldown_runtime.__toESM(react_i18next);
15
+ let react_jsx_runtime = require("react/jsx-runtime");
16
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
11
17
 
12
18
  //#region src/Embed/BrightcoveEmbed.tsx
13
19
  const LinkedVideoButton = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Button, { base: { marginBlockStart: "3xsmall" } });
@@ -45,7 +51,7 @@ const BrightcoveEmbed = ({ embed, renderContext = "article", lang }) => {
45
51
  iframe.height = "";
46
52
  }
47
53
  }, []);
48
- if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_EmbedErrorPlaceholder.EmbedErrorPlaceholder_default, {
54
+ if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedErrorPlaceholder.default, {
49
55
  type: "video",
50
56
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BrightcoveIframe, {
51
57
  ref: iframeRef,
@@ -62,7 +68,7 @@ const BrightcoveEmbed = ({ embed, renderContext = "article", lang }) => {
62
68
  ...embedData,
63
69
  videoid: linkedVideoId
64
70
  }, data.sources) : void 0;
65
- const licenseProps = require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_utils_licenseAttributes.licenseAttributes(data?.copyright?.license.license, lang, embedData.pageUrl);
71
+ const licenseProps = require_licenseAttributes.licenseAttributes(data?.copyright?.license.license, lang, embedData.pageUrl);
66
72
  const title = data.name?.trim() ? `${t("embed.type.video")}: ${data.name}` : fallbackTitle;
67
73
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__ndla_primitives.Figure, {
68
74
  "data-embed-type": "brightcove",
@@ -77,7 +83,7 @@ const BrightcoveEmbed = ({ embed, renderContext = "article", lang }) => {
77
83
  ...alternativeVideoProps && !showOriginalVideo ? alternativeVideoProps : originalVideoProps,
78
84
  allow: "fullscreen; encrypted-media"
79
85
  })
80
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_LicenseByline_EmbedByline.EmbedByline, {
86
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedByline.EmbedByline, {
81
87
  type: "video",
82
88
  copyright: data.copyright,
83
89
  description: parsedDescription,
@@ -93,5 +99,5 @@ const BrightcoveEmbed = ({ embed, renderContext = "article", lang }) => {
93
99
  var BrightcoveEmbed_default = BrightcoveEmbed;
94
100
 
95
101
  //#endregion
96
- exports.BrightcoveEmbed_default = BrightcoveEmbed_default;
102
+ exports.default = BrightcoveEmbed_default;
97
103
  //# sourceMappingURL=BrightcoveEmbed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BrightcoveEmbed.js","names":["Button","value: any","data: BrightcoveEmbedData","sources: BrightcoveVideoSource[]","EmbedErrorPlaceholder","Figure","EmbedByline"],"sources":["../../src/Embed/BrightcoveEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-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 parse from \"html-react-parser\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Button, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { BrightcoveEmbedData, BrightcoveMetaData, BrightcoveVideoSource } from \"@ndla/types-embed\";\nimport EmbedErrorPlaceholder from \"./EmbedErrorPlaceholder\";\nimport type { RenderContext } from \"./types\";\nimport { EmbedByline } from \"../LicenseByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\ninterface Props {\n embed: BrightcoveMetaData;\n renderContext?: RenderContext;\n lang?: string;\n}\n\nconst LinkedVideoButton = styled(Button, {\n base: {\n marginBlockStart: \"3xsmall\",\n },\n});\n\nconst BrightcoveIframe = styled(\"iframe\", {\n base: {\n border: 0,\n height: \"auto\",\n width: \"100%\",\n },\n});\n\nexport const makeIframeString = (url: string, width: string | number, height: string | number, title = \"\") => {\n const strippedWidth = typeof width === \"number\" ? width : width.replace(/\\s*px/, \"\");\n const strippedHeight = typeof height === \"number\" ? height : height.replace(/\\s*px/, \"\");\n const urlOrTitle = title || url;\n return `<iframe title=\"${urlOrTitle}\" aria-label=\"${urlOrTitle}\" src=\"${url}\" width=\"${strippedWidth}\" height=\"${strippedHeight}\" allowfullscreen scrolling=\"no\" frameborder=\"0\" loading=\"lazy\"></iframe>`;\n};\n\nexport const isNumeric = (value: any) => !Number.isNaN(value - Number.parseFloat(value));\n\nconst getIframeProps = (data: BrightcoveEmbedData, sources: BrightcoveVideoSource[]) => {\n const { account, videoid, player = \"default\" } = data;\n\n const source = sources.filter((s) => s.width && s.height).toSorted((a, b) => a!.height! - b.height!)[0];\n\n return {\n src: `https://players.brightcove.net/${account}/${player}_default/index.html?videoId=${videoid}`,\n height: source?.height ?? \"480\",\n width: source?.width ?? \"640\",\n };\n};\nconst BrightcoveEmbed = ({ embed, renderContext = \"article\", lang }: Props) => {\n const [showOriginalVideo, setShowOriginalVideo] = useState(true);\n const { t } = useTranslation();\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const { embedData } = embed;\n const fallbackTitle = `${t(\"embed.type.video\")}: ${embedData.videoid}`;\n const parsedDescription = useMemo(() => {\n if (embed.embedData.caption || renderContext === \"article\") {\n return embed.embedData.caption ? parse(embed.embedData.caption) : undefined;\n } else if (embed.status === \"success\" && embed.data.description) {\n return parse(embed.data.description);\n }\n }, [embed, renderContext]);\n\n useEffect(() => {\n const iframe = iframeRef.current;\n if (iframe) {\n const [width, height] = [parseInt(iframe.width), parseInt(iframe.height)];\n iframe.style.aspectRatio = `${width}/${height}`;\n iframe.width = \"\";\n iframe.height = \"\";\n }\n }, []);\n if (embed.status === \"error\") {\n return (\n <EmbedErrorPlaceholder type=\"video\">\n <BrightcoveIframe\n ref={iframeRef}\n title={embedData.alt || fallbackTitle}\n aria-label={embedData.alt || fallbackTitle}\n {...getIframeProps(embedData, [])}\n allow=\"fullscreen; encrypted-media\"\n />\n </EmbedErrorPlaceholder>\n );\n }\n const { data } = embed;\n\n const linkedVideoId = isNumeric(data.link?.text) ? data.link?.text : undefined;\n\n const originalVideoProps = getIframeProps(embedData, data.sources);\n const alternativeVideoProps = linkedVideoId\n ? getIframeProps({ ...embedData, videoid: linkedVideoId }, data.sources)\n : undefined;\n\n const licenseProps = licenseAttributes(data?.copyright?.license.license, lang, embedData.pageUrl);\n\n const title = data.name?.trim() ? `${t(\"embed.type.video\")}: ${data.name}` : fallbackTitle;\n\n return (\n <Figure data-embed-type=\"brightcove\" {...licenseProps}>\n <div className=\"brightcove-video\">\n <BrightcoveIframe\n ref={iframeRef}\n className=\"original\"\n title={title}\n aria-label={title}\n {...(alternativeVideoProps && !showOriginalVideo ? alternativeVideoProps : originalVideoProps)}\n allow=\"fullscreen; encrypted-media\"\n />\n </div>\n <EmbedByline type=\"video\" copyright={data.copyright!} description={parsedDescription}>\n <div>\n {!!linkedVideoId && (\n <LinkedVideoButton size=\"small\" variant=\"secondary\" onClick={() => setShowOriginalVideo((p) => !p)}>\n {t(`figure.button.${!showOriginalVideo ? \"original\" : \"alternative\"}`)}\n </LinkedVideoButton>\n )}\n </div>\n </EmbedByline>\n </Figure>\n );\n};\n\nexport default BrightcoveEmbed;\n"],"mappings":";;;;;;;;;;;;AAyBA,MAAM,oBAAoB,qCAAOA,0BAAQ,EACvC,MAAM,EACJ,kBAAkB,UACnB,EACF,EAAC;AAEF,MAAM,mBAAmB,qCAAO,UAAU,EACxC,MAAM;CACJ,QAAQ;CACR,QAAQ;CACR,OAAO;AACR,EACF,EAAC;AASF,MAAa,YAAY,CAACC,WAAgB,OAAO,MAAM,QAAQ,OAAO,WAAW,MAAM,CAAC;AAExF,MAAM,iBAAiB,CAACC,MAA2BC,YAAqC;CACtF,MAAM,EAAE,SAAS,SAAS,SAAS,WAAW,GAAG;CAEjD,MAAM,SAAS,QAAQ,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,MAAM,EAAG,SAAU,EAAE,OAAQ,CAAC;AAErG,QAAO;EACL,MAAM,iCAAiC,QAAQ,GAAG,OAAO,8BAA8B,QAAQ;EAC/F,QAAQ,QAAQ,UAAU;EAC1B,OAAO,QAAQ,SAAS;CACzB;AACF;AACD,MAAM,kBAAkB,CAAC,EAAE,OAAO,gBAAgB,WAAW,MAAa,KAAK;CAC7E,MAAM,CAAC,mBAAmB,qBAAqB,GAAG,oBAAS,KAAK;CAChE,MAAM,EAAE,GAAG,GAAG,mCAAgB;CAC9B,MAAM,YAAY,kBAA0B,KAAK;CACjD,MAAM,EAAE,WAAW,GAAG;CACtB,MAAM,iBAAiB,EAAE,EAAE,mBAAmB,CAAC,IAAI,UAAU,QAAQ;CACrE,MAAM,oBAAoB,mBAAQ,MAAM;AACtC,MAAI,MAAM,UAAU,WAAW,kBAAkB,UAC/C,QAAO,MAAM,UAAU,UAAU,+BAAM,MAAM,UAAU,QAAQ;WACtD,MAAM,WAAW,aAAa,MAAM,KAAK,YAClD,QAAO,+BAAM,MAAM,KAAK,YAAY;CAEvC,GAAE,CAAC,OAAO,aAAc,EAAC;AAE1B,sBAAU,MAAM;EACd,MAAM,SAAS,UAAU;AACzB,MAAI,QAAQ;GACV,MAAM,CAAC,OAAO,OAAO,GAAG,CAAC,SAAS,OAAO,MAAM,EAAE,SAAS,OAAO,OAAO,AAAC;AACzE,UAAO,MAAM,eAAe,EAAE,MAAM,GAAG,OAAO;AAC9C,UAAO,QAAQ;AACf,UAAO,SAAS;EACjB;CACF,GAAE,CAAE,EAAC;AACN,KAAI,MAAM,WAAW,QACnB,wBACE,2BAACC;EAAsB,MAAK;4BAC1B,2BAAC;GACC,KAAK;GACL,OAAO,UAAU,OAAO;GACxB,cAAY,UAAU,OAAO;GAC7B,GAAI,eAAe,WAAW,CAAE,EAAC;GACjC,OAAM;IACN;GACoB;CAG5B,MAAM,EAAE,MAAM,GAAG;CAEjB,MAAM,gBAAgB,UAAU,KAAK,MAAM,KAAK,GAAG,KAAK,MAAM;CAE9D,MAAM,qBAAqB,eAAe,WAAW,KAAK,QAAQ;CAClE,MAAM,wBAAwB,gBAC1B,eAAe;EAAE,GAAG;EAAW,SAAS;CAAe,GAAE,KAAK,QAAQ;CAG1E,MAAM,eAAe,8GAAkB,MAAM,WAAW,QAAQ,SAAS,MAAM,UAAU,QAAQ;CAEjG,MAAM,QAAQ,KAAK,MAAM,MAAM,IAAI,EAAE,EAAE,mBAAmB,CAAC,IAAI,KAAK,KAAK,IAAI;AAE7E,wBACE,4BAACC;EAAO,mBAAgB;EAAa,GAAI;6BACvC,2BAAC;GAAI,WAAU;6BACb,2BAAC;IACC,KAAK;IACL,WAAU;IACH;IACP,cAAY;IACZ,GAAK,0BAA0B,oBAAoB,wBAAwB;IAC3E,OAAM;KACN;IACE,kBACN,2BAACC;GAAY,MAAK;GAAQ,WAAW,KAAK;GAAY,aAAa;6BACjE,2BAAC,qBACI,iCACD,2BAAC;IAAkB,MAAK;IAAQ,SAAQ;IAAY,SAAS,MAAM,qBAAqB,CAAC,OAAO,EAAE;cAC/F,GAAG,iBAAiB,oBAAoB,aAAa,cAAc,EAAE;KACpD,GAElB;IACM;GACP;AAEZ;AAED,8BAAe"}
1
+ {"version":3,"file":"BrightcoveEmbed.js","names":["Button","EmbedErrorPlaceholder","licenseAttributes","Figure","EmbedByline"],"sources":["../../src/Embed/BrightcoveEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-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 parse from \"html-react-parser\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Button, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { BrightcoveEmbedData, BrightcoveMetaData, BrightcoveVideoSource } from \"@ndla/types-embed\";\nimport EmbedErrorPlaceholder from \"./EmbedErrorPlaceholder\";\nimport type { RenderContext } from \"./types\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\ninterface Props {\n embed: BrightcoveMetaData;\n renderContext?: RenderContext;\n lang?: string;\n}\n\nconst LinkedVideoButton = styled(Button, {\n base: {\n marginBlockStart: \"3xsmall\",\n },\n});\n\nconst BrightcoveIframe = styled(\"iframe\", {\n base: {\n border: 0,\n height: \"auto\",\n width: \"100%\",\n },\n});\n\nexport const makeIframeString = (url: string, width: string | number, height: string | number, title = \"\") => {\n const strippedWidth = typeof width === \"number\" ? width : width.replace(/\\s*px/, \"\");\n const strippedHeight = typeof height === \"number\" ? height : height.replace(/\\s*px/, \"\");\n const urlOrTitle = title || url;\n return `<iframe title=\"${urlOrTitle}\" aria-label=\"${urlOrTitle}\" src=\"${url}\" width=\"${strippedWidth}\" height=\"${strippedHeight}\" allowfullscreen scrolling=\"no\" frameborder=\"0\" loading=\"lazy\"></iframe>`;\n};\n\nexport const isNumeric = (value: any) => !Number.isNaN(value - Number.parseFloat(value));\n\nconst getIframeProps = (data: BrightcoveEmbedData, sources: BrightcoveVideoSource[]) => {\n const { account, videoid, player = \"default\" } = data;\n\n const source = sources.filter((s) => s.width && s.height).toSorted((a, b) => a!.height! - b.height!)[0];\n\n return {\n src: `https://players.brightcove.net/${account}/${player}_default/index.html?videoId=${videoid}`,\n height: source?.height ?? \"480\",\n width: source?.width ?? \"640\",\n };\n};\nconst BrightcoveEmbed = ({ embed, renderContext = \"article\", lang }: Props) => {\n const [showOriginalVideo, setShowOriginalVideo] = useState(true);\n const { t } = useTranslation();\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const { embedData } = embed;\n const fallbackTitle = `${t(\"embed.type.video\")}: ${embedData.videoid}`;\n const parsedDescription = useMemo(() => {\n if (embed.embedData.caption || renderContext === \"article\") {\n return embed.embedData.caption ? parse(embed.embedData.caption) : undefined;\n } else if (embed.status === \"success\" && embed.data.description) {\n return parse(embed.data.description);\n }\n }, [embed, renderContext]);\n\n useEffect(() => {\n const iframe = iframeRef.current;\n if (iframe) {\n const [width, height] = [parseInt(iframe.width), parseInt(iframe.height)];\n iframe.style.aspectRatio = `${width}/${height}`;\n iframe.width = \"\";\n iframe.height = \"\";\n }\n }, []);\n if (embed.status === \"error\") {\n return (\n <EmbedErrorPlaceholder type=\"video\">\n <BrightcoveIframe\n ref={iframeRef}\n title={embedData.alt || fallbackTitle}\n aria-label={embedData.alt || fallbackTitle}\n {...getIframeProps(embedData, [])}\n allow=\"fullscreen; encrypted-media\"\n />\n </EmbedErrorPlaceholder>\n );\n }\n const { data } = embed;\n\n const linkedVideoId = isNumeric(data.link?.text) ? data.link?.text : undefined;\n\n const originalVideoProps = getIframeProps(embedData, data.sources);\n const alternativeVideoProps = linkedVideoId\n ? getIframeProps({ ...embedData, videoid: linkedVideoId }, data.sources)\n : undefined;\n\n const licenseProps = licenseAttributes(data?.copyright?.license.license, lang, embedData.pageUrl);\n\n const title = data.name?.trim() ? `${t(\"embed.type.video\")}: ${data.name}` : fallbackTitle;\n\n return (\n <Figure data-embed-type=\"brightcove\" {...licenseProps}>\n <div className=\"brightcove-video\">\n <BrightcoveIframe\n ref={iframeRef}\n className=\"original\"\n title={title}\n aria-label={title}\n {...(alternativeVideoProps && !showOriginalVideo ? alternativeVideoProps : originalVideoProps)}\n allow=\"fullscreen; encrypted-media\"\n />\n </div>\n <EmbedByline type=\"video\" copyright={data.copyright!} description={parsedDescription}>\n <div>\n {!!linkedVideoId && (\n <LinkedVideoButton size=\"small\" variant=\"secondary\" onClick={() => setShowOriginalVideo((p) => !p)}>\n {t(`figure.button.${!showOriginalVideo ? \"original\" : \"alternative\"}`)}\n </LinkedVideoButton>\n )}\n </div>\n </EmbedByline>\n </Figure>\n );\n};\n\nexport default BrightcoveEmbed;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,MAAM,yDAA2BA,0BAAQ,EACvC,MAAM,EACJ,kBAAkB,WACnB,EACF,CAAC;AAEF,MAAM,wDAA0B,UAAU,EACxC,MAAM;CACJ,QAAQ;CACR,QAAQ;CACR,OAAO;CACR,EACF,CAAC;AASF,MAAa,aAAa,UAAe,CAAC,OAAO,MAAM,QAAQ,OAAO,WAAW,MAAM,CAAC;AAExF,MAAM,kBAAkB,MAA2B,YAAqC;CACtF,MAAM,EAAE,SAAS,SAAS,SAAS,cAAc;CAEjD,MAAM,SAAS,QAAQ,QAAQ,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,UAAU,GAAG,MAAM,EAAG,SAAU,EAAE,OAAQ,CAAC;AAErG,QAAO;EACL,KAAK,kCAAkC,QAAQ,GAAG,OAAO,8BAA8B;EACvF,QAAQ,QAAQ,UAAU;EAC1B,OAAO,QAAQ,SAAS;EACzB;;AAEH,MAAM,mBAAmB,EAAE,OAAO,gBAAgB,WAAW,WAAkB;CAC7E,MAAM,CAAC,mBAAmB,4CAAiC,KAAK;CAChE,MAAM,EAAE,yCAAsB;CAC9B,MAAM,8BAAsC,KAAK;CACjD,MAAM,EAAE,cAAc;CACtB,MAAM,gBAAgB,GAAG,EAAE,mBAAmB,CAAC,IAAI,UAAU;CAC7D,MAAM,6CAAkC;AACtC,MAAI,MAAM,UAAU,WAAW,kBAAkB,UAC/C,QAAO,MAAM,UAAU,yCAAgB,MAAM,UAAU,QAAQ,GAAG;WACzD,MAAM,WAAW,aAAa,MAAM,KAAK,YAClD,uCAAa,MAAM,KAAK,YAAY;IAErC,CAAC,OAAO,cAAc,CAAC;AAE1B,4BAAgB;EACd,MAAM,SAAS,UAAU;AACzB,MAAI,QAAQ;GACV,MAAM,CAAC,OAAO,UAAU,CAAC,SAAS,OAAO,MAAM,EAAE,SAAS,OAAO,OAAO,CAAC;AACzE,UAAO,MAAM,cAAc,GAAG,MAAM,GAAG;AACvC,UAAO,QAAQ;AACf,UAAO,SAAS;;IAEjB,EAAE,CAAC;AACN,KAAI,MAAM,WAAW,QACnB,QACE,2CAACC;EAAsB,MAAK;YAC1B,2CAAC;GACC,KAAK;GACL,OAAO,UAAU,OAAO;GACxB,cAAY,UAAU,OAAO;GAC7B,GAAI,eAAe,WAAW,EAAE,CAAC;GACjC,OAAM;IACN;GACoB;CAG5B,MAAM,EAAE,SAAS;CAEjB,MAAM,gBAAgB,UAAU,KAAK,MAAM,KAAK,GAAG,KAAK,MAAM,OAAO;CAErE,MAAM,qBAAqB,eAAe,WAAW,KAAK,QAAQ;CAClE,MAAM,wBAAwB,gBAC1B,eAAe;EAAE,GAAG;EAAW,SAAS;EAAe,EAAE,KAAK,QAAQ,GACtE;CAEJ,MAAM,eAAeC,4CAAkB,MAAM,WAAW,QAAQ,SAAS,MAAM,UAAU,QAAQ;CAEjG,MAAM,QAAQ,KAAK,MAAM,MAAM,GAAG,GAAG,EAAE,mBAAmB,CAAC,IAAI,KAAK,SAAS;AAE7E,QACE,4CAACC;EAAO,mBAAgB;EAAa,GAAI;aACvC,2CAAC;GAAI,WAAU;aACb,2CAAC;IACC,KAAK;IACL,WAAU;IACH;IACP,cAAY;IACZ,GAAK,yBAAyB,CAAC,oBAAoB,wBAAwB;IAC3E,OAAM;KACN;IACE,EACN,2CAACC;GAAY,MAAK;GAAQ,WAAW,KAAK;GAAY,aAAa;aACjE,2CAAC,mBACE,CAAC,CAAC,iBACD,2CAAC;IAAkB,MAAK;IAAQ,SAAQ;IAAY,eAAe,sBAAsB,MAAM,CAAC,EAAE;cAC/F,EAAE,iBAAiB,CAAC,oBAAoB,aAAa,gBAAgB;KACpD,GAElB;IACM;GACP;;AAIb,8BAAe"}
@@ -1,13 +1,19 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
3
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_CodeBlock_CodeBlock = require('../CodeBlock/CodeBlock.js');
4
- const require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_CodeBlock_codeLanguageOptions = require('../CodeBlock/codeLanguageOptions.js');
5
- const react = require_rolldown_runtime.__toESM(require("react"));
6
- const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
7
- const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
8
- const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
9
- const __ndla_icons = require_rolldown_runtime.__toESM(require("@ndla/icons"));
10
- const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
2
+ const require_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
3
+ const require_CodeBlock = require('../CodeBlock/CodeBlock.js');
4
+ const require_codeLanguageOptions = require('../CodeBlock/codeLanguageOptions.js');
5
+ let react = require("react");
6
+ react = require_rolldown_runtime.__toESM(react);
7
+ let __ndla_primitives = require("@ndla/primitives");
8
+ __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
9
+ let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
10
+ __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
11
+ let react_i18next = require("react-i18next");
12
+ react_i18next = require_rolldown_runtime.__toESM(react_i18next);
13
+ let __ndla_icons = require("@ndla/icons");
14
+ __ndla_icons = require_rolldown_runtime.__toESM(__ndla_icons);
15
+ let react_jsx_runtime = require("react/jsx-runtime");
16
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
11
17
 
12
18
  //#region src/Embed/CodeEmbed.tsx
13
19
  const StyledFigCaption = (0, __ndla_styled_system_jsx.styled)("figcaption", { base: {
@@ -19,9 +25,8 @@ const StyledFigure = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Figu
19
25
  "& > *:not(:where(:first-child))": { marginBlockStart: "xsmall" }
20
26
  } });
21
27
  const getTitleFromFormat = (format) => {
22
- const selectedLanguage = require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_CodeBlock_codeLanguageOptions.codeLanguageOptions.find((item) => item.format === format);
28
+ const selectedLanguage = require_codeLanguageOptions.codeLanguageOptions.find((item) => item.format === format);
23
29
  if (selectedLanguage) return selectedLanguage.title;
24
- return;
25
30
  };
26
31
  const CodeEmbed = ({ embed }) => {
27
32
  const [isCopied, setIsCopied] = (0, react.useState)(false);
@@ -34,12 +39,12 @@ const CodeEmbed = ({ embed }) => {
34
39
  };
35
40
  }
36
41
  }, [isCopied]);
37
- if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_EmbedErrorPlaceholder.EmbedErrorPlaceholder_default, { type: "code" });
42
+ if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedErrorPlaceholder.default, { type: "code" });
38
43
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledFigure, {
39
44
  "data-embed-type": "code-block",
40
45
  children: [
41
46
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledFigCaption, { children: embed.embedData.title || getTitleFromFormat(embed.embedData.codeFormat) }),
42
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_jec_code_ndla_frontend_packages_packages_ndla_ui_src_CodeBlock_CodeBlock.CodeBlock_default, {
47
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CodeBlock.default, {
43
48
  highlightedCode: embed.status === "success" ? embed.data.highlightedCode : "",
44
49
  format: embed.embedData.codeFormat
45
50
  }),
@@ -59,5 +64,5 @@ const CodeEmbed = ({ embed }) => {
59
64
  var CodeEmbed_default = CodeEmbed;
60
65
 
61
66
  //#endregion
62
- exports.CodeEmbed_default = CodeEmbed_default;
67
+ exports.default = CodeEmbed_default;
63
68
  //# sourceMappingURL=CodeEmbed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEmbed.js","names":["Figure","format: string","item: ICodeLangugeOption","EmbedErrorPlaceholder","CodeBlock","Button","CheckLine","FileCopyLine"],"sources":["../../src/Embed/CodeEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-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 { useEffect, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { FileCopyLine, CheckLine } from \"@ndla/icons\";\nimport { Button, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CodeMetaData } from \"@ndla/types-embed\";\nimport EmbedErrorPlaceholder from \"./EmbedErrorPlaceholder\";\nimport { CodeBlock, codeLanguageOptions } from \"../CodeBlock\";\nimport type { ICodeLangugeOption } from \"../CodeBlock/codeLanguageOptions\";\n\ninterface Props {\n embed: CodeMetaData;\n}\n\nconst StyledFigCaption = styled(\"figcaption\", {\n base: {\n textStyle: \"label.large\",\n fontWeight: \"bold\",\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n clear: \"both\",\n // We apply margin here to allow for the float and size props on figure to work as intended.\n \"& > *:not(:where(:first-child))\": {\n marginBlockStart: \"xsmall\",\n },\n },\n});\n\nconst getTitleFromFormat = (format: string) => {\n const selectedLanguage = codeLanguageOptions.find((item: ICodeLangugeOption) => item.format === format);\n if (selectedLanguage) {\n return selectedLanguage.title;\n }\n return;\n};\n\nconst CodeEmbed = ({ embed }: Props) => {\n const [isCopied, setIsCopied] = useState(false);\n const { t } = useTranslation();\n\n useEffect(() => {\n if (isCopied) {\n const timer = setInterval(() => setIsCopied(false), 3000);\n // ensure interval is cleared - also if unmounted\n return () => {\n clearTimeout(timer);\n };\n }\n }, [isCopied]);\n\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type=\"code\" />;\n }\n\n return (\n <StyledFigure data-embed-type=\"code-block\">\n <StyledFigCaption>{embed.embedData.title || getTitleFromFormat(embed.embedData.codeFormat)}</StyledFigCaption>\n <CodeBlock\n highlightedCode={embed.status === \"success\" ? embed.data.highlightedCode : \"\"}\n format={embed.embedData.codeFormat}\n />\n <Button\n variant=\"secondary\"\n onClick={async () => {\n if (embed.status === \"success\") {\n try {\n await navigator.clipboard.writeText(embed.data.decodedContent);\n setIsCopied(true);\n } catch {\n // do nothing\n }\n }\n }}\n >\n {isCopied ? <CheckLine /> : <FileCopyLine />}\n {isCopied ? t(\"codeBlock.copiedCode\") : t(\"codeBlock.copyCode\")}\n </Button>\n </StyledFigure>\n );\n};\n\nexport default CodeEmbed;\n"],"mappings":";;;;;;;;;;;;AAsBA,MAAM,mBAAmB,qCAAO,cAAc,EAC5C,MAAM;CACJ,WAAW;CACX,YAAY;AACb,EACF,EAAC;AAEF,MAAM,eAAe,qCAAOA,0BAAQ,EAClC,MAAM;CACJ,OAAO;CAEP,mCAAmC,EACjC,kBAAkB,SACnB;AACF,EACF,EAAC;AAEF,MAAM,qBAAqB,CAACC,WAAmB;CAC7C,MAAM,mBAAmB,sHAAoB,KAAK,CAACC,SAA6B,KAAK,WAAW,OAAO;AACvG,KAAI,iBACF,QAAO,iBAAiB;AAE1B;AACD;AAED,MAAM,YAAY,CAAC,EAAE,OAAc,KAAK;CACtC,MAAM,CAAC,UAAU,YAAY,GAAG,oBAAS,MAAM;CAC/C,MAAM,EAAE,GAAG,GAAG,mCAAgB;AAE9B,sBAAU,MAAM;AACd,MAAI,UAAU;GACZ,MAAM,QAAQ,YAAY,MAAM,YAAY,MAAM,EAAE,IAAK;AAEzD,UAAO,MAAM;AACX,iBAAa,MAAM;GACpB;EACF;CACF,GAAE,CAAC,QAAS,EAAC;AAEd,KAAI,MAAM,WAAW,QACnB,wBAAO,2BAACC,iIAAsB,MAAK,SAAS;AAG9C,wBACE,4BAAC;EAAa,mBAAgB;;mBAC5B,2BAAC,8BAAkB,MAAM,UAAU,SAAS,mBAAmB,MAAM,UAAU,WAAW,GAAoB;mBAC9G,2BAACC;IACC,iBAAiB,MAAM,WAAW,YAAY,MAAM,KAAK,kBAAkB;IAC3E,QAAQ,MAAM,UAAU;KACxB;mBACF,4BAACC;IACC,SAAQ;IACR,SAAS,YAAY;AACnB,SAAI,MAAM,WAAW,UACnB,KAAI;AACF,YAAM,UAAU,UAAU,UAAU,MAAM,KAAK,eAAe;AAC9D,kBAAY,KAAK;KAClB,QAAO,CAEP;IAEJ;eAEA,2BAAW,2BAACC,2BAAY,mBAAG,2BAACC,8BAAe,EAC3C,WAAW,EAAE,uBAAuB,GAAG,EAAE,qBAAqB;KACxD;;GACI;AAElB;AAED,wBAAe"}
1
+ {"version":3,"file":"CodeEmbed.js","names":["Figure","codeLanguageOptions","EmbedErrorPlaceholder","CodeBlock","Button","CheckLine","FileCopyLine"],"sources":["../../src/Embed/CodeEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-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 { useEffect, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { FileCopyLine, CheckLine } from \"@ndla/icons\";\nimport { Button, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CodeMetaData } from \"@ndla/types-embed\";\nimport EmbedErrorPlaceholder from \"./EmbedErrorPlaceholder\";\nimport CodeBlock from \"../CodeBlock/CodeBlock\";\nimport { codeLanguageOptions, type ICodeLangugeOption } from \"../CodeBlock/codeLanguageOptions\";\n\ninterface Props {\n embed: CodeMetaData;\n}\n\nconst StyledFigCaption = styled(\"figcaption\", {\n base: {\n textStyle: \"label.large\",\n fontWeight: \"bold\",\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n clear: \"both\",\n // We apply margin here to allow for the float and size props on figure to work as intended.\n \"& > *:not(:where(:first-child))\": {\n marginBlockStart: \"xsmall\",\n },\n },\n});\n\nconst getTitleFromFormat = (format: string) => {\n const selectedLanguage = codeLanguageOptions.find((item: ICodeLangugeOption) => item.format === format);\n if (selectedLanguage) {\n return selectedLanguage.title;\n }\n return;\n};\n\nconst CodeEmbed = ({ embed }: Props) => {\n const [isCopied, setIsCopied] = useState(false);\n const { t } = useTranslation();\n\n useEffect(() => {\n if (isCopied) {\n const timer = setInterval(() => setIsCopied(false), 3000);\n // ensure interval is cleared - also if unmounted\n return () => {\n clearTimeout(timer);\n };\n }\n }, [isCopied]);\n\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type=\"code\" />;\n }\n\n return (\n <StyledFigure data-embed-type=\"code-block\">\n <StyledFigCaption>{embed.embedData.title || getTitleFromFormat(embed.embedData.codeFormat)}</StyledFigCaption>\n <CodeBlock\n highlightedCode={embed.status === \"success\" ? embed.data.highlightedCode : \"\"}\n format={embed.embedData.codeFormat}\n />\n <Button\n variant=\"secondary\"\n onClick={async () => {\n if (embed.status === \"success\") {\n try {\n await navigator.clipboard.writeText(embed.data.decodedContent);\n setIsCopied(true);\n } catch {\n // do nothing\n }\n }\n }}\n >\n {isCopied ? <CheckLine /> : <FileCopyLine />}\n {isCopied ? t(\"codeBlock.copiedCode\") : t(\"codeBlock.copyCode\")}\n </Button>\n </StyledFigure>\n );\n};\n\nexport default CodeEmbed;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,MAAM,wDAA0B,cAAc,EAC5C,MAAM;CACJ,WAAW;CACX,YAAY;CACb,EACF,CAAC;AAEF,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM;CACJ,OAAO;CAEP,mCAAmC,EACjC,kBAAkB,UACnB;CACF,EACF,CAAC;AAEF,MAAM,sBAAsB,WAAmB;CAC7C,MAAM,mBAAmBC,gDAAoB,MAAM,SAA6B,KAAK,WAAW,OAAO;AACvG,KAAI,iBACF,QAAO,iBAAiB;;AAK5B,MAAM,aAAa,EAAE,YAAmB;CACtC,MAAM,CAAC,UAAU,mCAAwB,MAAM;CAC/C,MAAM,EAAE,yCAAsB;AAE9B,4BAAgB;AACd,MAAI,UAAU;GACZ,MAAM,QAAQ,kBAAkB,YAAY,MAAM,EAAE,IAAK;AAEzD,gBAAa;AACX,iBAAa,MAAM;;;IAGtB,CAAC,SAAS,CAAC;AAEd,KAAI,MAAM,WAAW,QACnB,QAAO,2CAACC,yCAAsB,MAAK,SAAS;AAG9C,QACE,4CAAC;EAAa,mBAAgB;;GAC5B,2CAAC,8BAAkB,MAAM,UAAU,SAAS,mBAAmB,MAAM,UAAU,WAAW,GAAoB;GAC9G,2CAACC;IACC,iBAAiB,MAAM,WAAW,YAAY,MAAM,KAAK,kBAAkB;IAC3E,QAAQ,MAAM,UAAU;KACxB;GACF,4CAACC;IACC,SAAQ;IACR,SAAS,YAAY;AACnB,SAAI,MAAM,WAAW,UACnB,KAAI;AACF,YAAM,UAAU,UAAU,UAAU,MAAM,KAAK,eAAe;AAC9D,kBAAY,KAAK;aACX;;eAMX,WAAW,2CAACC,2BAAY,GAAG,2CAACC,8BAAe,EAC3C,WAAW,EAAE,uBAAuB,GAAG,EAAE,qBAAqB;KACxD;;GACI;;AAInB,wBAAe"}