@ndla/ui 56.0.154-alpha.0 → 56.0.155-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 (244) hide show
  1. package/dist/panda.buildinfo.json +2 -0
  2. package/dist/styles.css +8 -0
  3. package/es/Article/Article.mjs +8 -1
  4. package/es/Article/Article.mjs.map +1 -1
  5. package/es/Article/ArticleByline.mjs +7 -0
  6. package/es/Article/ArticleByline.mjs.map +1 -1
  7. package/es/Article/ArticleFootNotes.mjs +7 -0
  8. package/es/Article/ArticleFootNotes.mjs.map +1 -1
  9. package/es/Article/BadgesContainer.mjs +7 -0
  10. package/es/Article/BadgesContainer.mjs.map +1 -1
  11. package/es/AudioPlayer/AudioPlayer.mjs +7 -0
  12. package/es/AudioPlayer/AudioPlayer.mjs.map +1 -1
  13. package/es/AudioPlayer/Controls.mjs +7 -0
  14. package/es/AudioPlayer/Controls.mjs.map +1 -1
  15. package/es/AudioPlayer/SpeechControl.mjs +7 -0
  16. package/es/AudioPlayer/SpeechControl.mjs.map +1 -1
  17. package/es/Breadcrumb/HomeBreadcrumb.mjs +7 -0
  18. package/es/Breadcrumb/HomeBreadcrumb.mjs.map +1 -1
  19. package/es/CampaignBlock/CampaignBlock.mjs +7 -0
  20. package/es/CampaignBlock/CampaignBlock.mjs.map +1 -1
  21. package/es/CodeBlock/CodeBlock.mjs +7 -0
  22. package/es/CodeBlock/CodeBlock.mjs.map +1 -1
  23. package/es/Concept/Concept.mjs +7 -0
  24. package/es/Concept/Concept.mjs.map +1 -1
  25. package/es/ContactBlock/ContactBlock.mjs +7 -0
  26. package/es/ContactBlock/ContactBlock.mjs.map +1 -1
  27. package/es/ContentTypeBadge/ContentTypeBadge.mjs +7 -0
  28. package/es/ContentTypeBadge/ContentTypeBadge.mjs.map +1 -1
  29. package/es/CopyParagraphButton/CopyParagraphButton.mjs +7 -0
  30. package/es/CopyParagraphButton/CopyParagraphButton.mjs.map +1 -1
  31. package/es/Embed/AudioEmbed.mjs +7 -0
  32. package/es/Embed/AudioEmbed.mjs.map +1 -1
  33. package/es/Embed/BrightcoveEmbed.mjs +7 -0
  34. package/es/Embed/BrightcoveEmbed.mjs.map +1 -1
  35. package/es/Embed/CodeEmbed.mjs +7 -0
  36. package/es/Embed/CodeEmbed.mjs.map +1 -1
  37. package/es/Embed/ConceptEmbed.mjs +7 -0
  38. package/es/Embed/ConceptEmbed.mjs.map +1 -1
  39. package/es/Embed/ConceptInlineTriggerButton.mjs +7 -0
  40. package/es/Embed/ConceptInlineTriggerButton.mjs.map +1 -1
  41. package/es/Embed/EmbedWrapper.mjs +7 -0
  42. package/es/Embed/EmbedWrapper.mjs.map +1 -1
  43. package/es/Embed/ExternalEmbed.mjs +7 -0
  44. package/es/Embed/ExternalEmbed.mjs.map +1 -1
  45. package/es/Embed/FootnoteEmbed.mjs +7 -0
  46. package/es/Embed/FootnoteEmbed.mjs.map +1 -1
  47. package/es/Embed/GlossEmbed.mjs +7 -0
  48. package/es/Embed/GlossEmbed.mjs.map +1 -1
  49. package/es/Embed/H5pEmbed.mjs +7 -0
  50. package/es/Embed/H5pEmbed.mjs.map +1 -1
  51. package/es/Embed/IframeEmbed.mjs +7 -0
  52. package/es/Embed/IframeEmbed.mjs.map +1 -1
  53. package/es/Embed/ImageEmbed.mjs +13 -6
  54. package/es/Embed/ImageEmbed.mjs.map +1 -1
  55. package/es/Embed/InlineTriggerButton.mjs +7 -0
  56. package/es/Embed/InlineTriggerButton.mjs.map +1 -1
  57. package/es/Embed/RelatedContentEmbed.mjs +9 -7
  58. package/es/Embed/RelatedContentEmbed.mjs.map +1 -1
  59. package/es/Embed/UnknownEmbed.mjs +7 -0
  60. package/es/Embed/UnknownEmbed.mjs.map +1 -1
  61. package/es/FactBox/FactBox.mjs +7 -0
  62. package/es/FactBox/FactBox.mjs.map +1 -1
  63. package/es/FileList/File.mjs +7 -0
  64. package/es/FileList/File.mjs.map +1 -1
  65. package/es/FileList/PdfFile.mjs +7 -0
  66. package/es/FileList/PdfFile.mjs.map +1 -1
  67. package/es/Gloss/Gloss.mjs +7 -0
  68. package/es/Gloss/Gloss.mjs.map +1 -1
  69. package/es/Gloss/GlossExample.mjs +7 -0
  70. package/es/Gloss/GlossExample.mjs.map +1 -1
  71. package/es/KeyFigure/KeyFigure.mjs +7 -0
  72. package/es/KeyFigure/KeyFigure.mjs.map +1 -1
  73. package/es/LicenseByline/EmbedByline.mjs +7 -0
  74. package/es/LicenseByline/EmbedByline.mjs.map +1 -1
  75. package/es/LicenseByline/LicenseLink.mjs +7 -0
  76. package/es/LicenseByline/LicenseLink.mjs.map +1 -1
  77. package/es/LinkBlock/LinkBlock.mjs +7 -0
  78. package/es/LinkBlock/LinkBlock.mjs.map +1 -1
  79. package/es/LinkBlock/LinkBlockSection.mjs +7 -0
  80. package/es/LinkBlock/LinkBlockSection.mjs.map +1 -1
  81. package/es/Pitch/Pitch.mjs +10 -2
  82. package/es/Pitch/Pitch.mjs.map +1 -1
  83. package/es/RelatedArticleList/RelatedArticleList.mjs +13 -8
  84. package/es/RelatedArticleList/RelatedArticleList.mjs.map +1 -1
  85. package/es/ResourceBox/ResourceBox.mjs +7 -0
  86. package/es/ResourceBox/ResourceBox.mjs.map +1 -1
  87. package/es/TagSelector/TagSelector.mjs +7 -0
  88. package/es/TagSelector/TagSelector.mjs.map +1 -1
  89. package/es/ZendeskButton/ZendeskButton.mjs +7 -0
  90. package/es/ZendeskButton/ZendeskButton.mjs.map +1 -1
  91. package/es/i18n/useComponentTranslations.mjs +7 -0
  92. package/es/i18n/useComponentTranslations.mjs.map +1 -1
  93. package/es/index.mjs +1 -1
  94. package/es/locale/messages-en.mjs +7 -0
  95. package/es/locale/messages-en.mjs.map +1 -1
  96. package/es/locale/messages-nb.mjs +7 -0
  97. package/es/locale/messages-nb.mjs.map +1 -1
  98. package/es/locale/messages-nn.mjs +7 -0
  99. package/es/locale/messages-nn.mjs.map +1 -1
  100. package/es/locale/messages-se.mjs +7 -0
  101. package/es/locale/messages-se.mjs.map +1 -1
  102. package/es/model/index.mjs +7 -0
  103. package/es/model/index.mjs.map +1 -1
  104. package/es/utils/licenseAttributes.mjs +7 -0
  105. package/es/utils/licenseAttributes.mjs.map +1 -1
  106. package/lib/Article/Article.js +8 -7
  107. package/lib/Article/Article.js.map +1 -1
  108. package/lib/Article/ArticleByline.js +7 -8
  109. package/lib/Article/ArticleByline.js.map +1 -1
  110. package/lib/Article/ArticleFootNotes.js +7 -3
  111. package/lib/Article/ArticleFootNotes.js.map +1 -1
  112. package/lib/Article/BadgesContainer.js +7 -1
  113. package/lib/Article/BadgesContainer.js.map +1 -1
  114. package/lib/AudioPlayer/AudioPlayer.js +7 -6
  115. package/lib/AudioPlayer/AudioPlayer.js.map +1 -1
  116. package/lib/AudioPlayer/Controls.js +7 -7
  117. package/lib/AudioPlayer/SpeechControl.js +7 -5
  118. package/lib/AudioPlayer/SpeechControl.js.map +1 -1
  119. package/lib/Breadcrumb/Breadcrumb.js +7 -4
  120. package/lib/Breadcrumb/Breadcrumb.js.map +1 -1
  121. package/lib/Breadcrumb/BreadcrumbItem.js +7 -3
  122. package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -1
  123. package/lib/Breadcrumb/HomeBreadcrumb.js +7 -4
  124. package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -1
  125. package/lib/CampaignBlock/CampaignBlock.js +7 -6
  126. package/lib/CampaignBlock/CampaignBlock.js.map +1 -1
  127. package/lib/CodeBlock/CodeBlock.js +7 -4
  128. package/lib/CodeBlock/CodeBlock.js.map +1 -1
  129. package/lib/Concept/Concept.d.ts +1 -1
  130. package/lib/Concept/Concept.js +7 -4
  131. package/lib/Concept/Concept.js.map +1 -1
  132. package/lib/ContactBlock/ContactBlock.d.ts +2 -2
  133. package/lib/ContactBlock/ContactBlock.js +7 -4
  134. package/lib/ContactBlock/ContactBlock.js.map +1 -1
  135. package/lib/ContentTypeBadge/ContentTypeBadge.js +7 -4
  136. package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -1
  137. package/lib/CopyParagraphButton/CopyParagraphButton.js +7 -6
  138. package/lib/CopyParagraphButton/CopyParagraphButton.js.map +1 -1
  139. package/lib/Embed/AudioEmbed.js +7 -3
  140. package/lib/Embed/AudioEmbed.js.map +1 -1
  141. package/lib/Embed/BrightcoveEmbed.js +7 -5
  142. package/lib/Embed/BrightcoveEmbed.js.map +1 -1
  143. package/lib/Embed/CodeEmbed.js +7 -6
  144. package/lib/Embed/CodeEmbed.js.map +1 -1
  145. package/lib/Embed/ConceptEmbed.js +7 -5
  146. package/lib/Embed/ConceptEmbed.js.map +1 -1
  147. package/lib/Embed/ConceptInlineTriggerButton.js +7 -1
  148. package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -1
  149. package/lib/Embed/ContentLinkEmbed.js +0 -3
  150. package/lib/Embed/ContentLinkEmbed.js.map +1 -1
  151. package/lib/Embed/CopyrightEmbed.js +0 -2
  152. package/lib/Embed/CopyrightEmbed.js.map +1 -1
  153. package/lib/Embed/EmbedErrorPlaceholder.js +7 -5
  154. package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -1
  155. package/lib/Embed/EmbedWrapper.js +7 -5
  156. package/lib/Embed/EmbedWrapper.js.map +1 -1
  157. package/lib/Embed/ExternalEmbed.js +7 -5
  158. package/lib/Embed/ExternalEmbed.js.map +1 -1
  159. package/lib/Embed/FootnoteEmbed.js +7 -3
  160. package/lib/Embed/FootnoteEmbed.js.map +1 -1
  161. package/lib/Embed/GlossEmbed.js +7 -5
  162. package/lib/Embed/GlossEmbed.js.map +1 -1
  163. package/lib/Embed/H5pEmbed.js +7 -4
  164. package/lib/Embed/H5pEmbed.js.map +1 -1
  165. package/lib/Embed/IframeEmbed.js +7 -5
  166. package/lib/Embed/IframeEmbed.js.map +1 -1
  167. package/lib/Embed/ImageEmbed.js +13 -12
  168. package/lib/Embed/ImageEmbed.js.map +1 -1
  169. package/lib/Embed/InlineTriggerButton.js +7 -4
  170. package/lib/Embed/InlineTriggerButton.js.map +1 -1
  171. package/lib/Embed/RelatedContentEmbed.d.ts +1 -2
  172. package/lib/Embed/RelatedContentEmbed.js +9 -10
  173. package/lib/Embed/RelatedContentEmbed.js.map +1 -1
  174. package/lib/Embed/UnknownEmbed.js +7 -3
  175. package/lib/Embed/UnknownEmbed.js.map +1 -1
  176. package/lib/Embed/UuDisclaimerEmbed.js +7 -7
  177. package/lib/Embed/types.d.ts +2 -2
  178. package/lib/FactBox/FactBox.js +7 -5
  179. package/lib/FactBox/FactBox.js.map +1 -1
  180. package/lib/FileList/File.js +7 -8
  181. package/lib/FileList/File.js.map +1 -1
  182. package/lib/FileList/FileList.js +7 -4
  183. package/lib/FileList/FileList.js.map +1 -1
  184. package/lib/FileList/PdfFile.js +7 -3
  185. package/lib/FileList/PdfFile.js.map +1 -1
  186. package/lib/Gloss/Gloss.d.ts +2 -2
  187. package/lib/Gloss/Gloss.js +7 -7
  188. package/lib/Gloss/Gloss.js.map +1 -1
  189. package/lib/Gloss/GlossExample.d.ts +2 -2
  190. package/lib/Gloss/GlossExample.js +7 -4
  191. package/lib/Gloss/GlossExample.js.map +1 -1
  192. package/lib/Grid/Grid.js +7 -3
  193. package/lib/Grid/Grid.js.map +1 -1
  194. package/lib/Grid/GridParallaxItem.js +7 -3
  195. package/lib/Grid/GridParallaxItem.js.map +1 -1
  196. package/lib/KeyFigure/KeyFigure.js +7 -2
  197. package/lib/KeyFigure/KeyFigure.js.map +1 -1
  198. package/lib/LicenseByline/EmbedByline.d.ts +4 -4
  199. package/lib/LicenseByline/EmbedByline.js +7 -7
  200. package/lib/LicenseByline/EmbedByline.js.map +1 -1
  201. package/lib/LicenseByline/LicenseLink.js +7 -4
  202. package/lib/LicenseByline/LicenseLink.js.map +1 -1
  203. package/lib/LinkBlock/LinkBlock.js +7 -6
  204. package/lib/LinkBlock/LinkBlock.js.map +1 -1
  205. package/lib/LinkBlock/LinkBlockSection.js +7 -3
  206. package/lib/LinkBlock/LinkBlockSection.js.map +1 -1
  207. package/lib/Pitch/Pitch.js +10 -7
  208. package/lib/Pitch/Pitch.js.map +1 -1
  209. package/lib/RelatedArticleList/RelatedArticleList.d.ts +2 -3
  210. package/lib/RelatedArticleList/RelatedArticleList.js +13 -16
  211. package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -1
  212. package/lib/ResourceBox/ResourceBox.js +7 -6
  213. package/lib/ResourceBox/ResourceBox.js.map +1 -1
  214. package/lib/TagSelector/TagSelector.js +7 -6
  215. package/lib/TagSelector/TagSelector.js.map +1 -1
  216. package/lib/ZendeskButton/ZendeskButton.js +7 -3
  217. package/lib/ZendeskButton/ZendeskButton.js.map +1 -1
  218. package/lib/i18n/useComponentTranslations.js +7 -2
  219. package/lib/i18n/useComponentTranslations.js.map +1 -1
  220. package/lib/index.js +1 -1
  221. package/lib/locale/messages-en.js +7 -1
  222. package/lib/locale/messages-en.js.map +1 -1
  223. package/lib/locale/messages-nb.js +7 -1
  224. package/lib/locale/messages-nb.js.map +1 -1
  225. package/lib/locale/messages-nn.js +7 -1
  226. package/lib/locale/messages-nn.js.map +1 -1
  227. package/lib/locale/messages-se.js +7 -1
  228. package/lib/locale/messages-se.js.map +1 -1
  229. package/lib/model/index.js +7 -0
  230. package/lib/model/index.js.map +1 -1
  231. package/lib/utils/licenseAttributes.js +7 -1
  232. package/lib/utils/licenseAttributes.js.map +1 -1
  233. package/package.json +7 -7
  234. package/src/Concept/Concept.tsx +1 -1
  235. package/src/ContactBlock/ContactBlock.tsx +2 -2
  236. package/src/Embed/ImageEmbed.stories.tsx +2 -2
  237. package/src/Embed/ImageEmbed.tsx +6 -6
  238. package/src/Embed/RelatedContentEmbed.tsx +1 -9
  239. package/src/Embed/types.ts +2 -2
  240. package/src/Gloss/Gloss.tsx +4 -4
  241. package/src/Gloss/GlossExample.tsx +2 -2
  242. package/src/LicenseByline/EmbedByline.tsx +4 -4
  243. package/src/Pitch/Pitch.tsx +3 -2
  244. package/src/RelatedArticleList/RelatedArticleList.tsx +11 -28
@@ -1,18 +1,19 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  let react = require("react");
3
- react = require_rolldown_runtime.__toESM(react);
4
3
  let __ndla_primitives = require("@ndla/primitives");
5
- __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
6
4
  let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
7
- __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
8
5
  let react_i18next = require("react-i18next");
9
- react_i18next = require_rolldown_runtime.__toESM(react_i18next);
10
6
  let __ndla_icons = require("@ndla/icons");
11
- __ndla_icons = require_rolldown_runtime.__toESM(__ndla_icons);
12
7
  let react_jsx_runtime = require("react/jsx-runtime");
13
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
14
8
 
15
9
  //#region src/CopyParagraphButton/CopyParagraphButton.tsx
10
+ /**
11
+ * Copyright (c) 2021-present, NDLA.
12
+ *
13
+ * This source code is licensed under the GPLv3 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ *
16
+ */
16
17
  const ContainerDiv = (0, __ndla_styled_system_jsx.styled)("div", { base: {
17
18
  position: "relative",
18
19
  _hover: { "& [data-copy-button]": {
@@ -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}\nexport const 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"],"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,MAAa,uBAAuB,EAAE,UAAU,UAAU,WAAkB;CAC1E,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"}
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}\nexport const 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"],"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,MAAa,uBAAuB,EAAE,UAAU,UAAU,WAAkB;CAC1E,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"}
@@ -4,13 +4,17 @@ const require_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
4
4
  const require_licenseAttributes = require('../utils/licenseAttributes.js');
5
5
  const require_AudioPlayer = require('../AudioPlayer/AudioPlayer.js');
6
6
  let __ndla_primitives = require("@ndla/primitives");
7
- __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
8
7
  let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
9
- __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
10
8
  let react_jsx_runtime = require("react/jsx-runtime");
11
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
12
9
 
13
10
  //#region src/Embed/AudioEmbed.tsx
11
+ /**
12
+ * Copyright (c) 2023-present, NDLA.
13
+ *
14
+ * This source code is licensed under the GPLv3 license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ *
17
+ */
14
18
  const StyledFigure = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Figure, { base: { clear: "both" } });
15
19
  const AudioEmbed = ({ embed, lang }) => {
16
20
  const type = embed.embedData.type === "standard" ? "audio" : "podcast";
@@ -1 +1 @@
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\nexport const 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"],"mappings":";;;;;;;;;;;;;AAiBA,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM,EACJ,OAAO,QACR,EACF,CAAC;AAaF,MAAa,cAAc,EAAE,OAAO,WAAkB;CACpD,MAAM,OAAO,MAAM,UAAU,SAAS,aAAa,UAAU;AAC7D,KAAI,MAAM,WAAW,QACnB,QAAO,2CAACC,uDAA4B,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"}
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\nexport const 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"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM,EACJ,OAAO,QACR,EACF,CAAC;AAaF,MAAa,cAAc,EAAE,OAAO,WAAkB;CACpD,MAAM,OAAO,MAAM,UAAU,SAAS,aAAa,UAAU;AAC7D,KAAI,MAAM,WAAW,QACnB,QAAO,2CAACC,uDAA4B,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"}
@@ -3,19 +3,21 @@ const require_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
3
  const require_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
4
4
  const require_licenseAttributes = require('../utils/licenseAttributes.js');
5
5
  let react = require("react");
6
- react = require_rolldown_runtime.__toESM(react);
7
6
  let __ndla_primitives = require("@ndla/primitives");
8
- __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
9
7
  let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
10
- __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
11
8
  let html_react_parser = require("html-react-parser");
12
9
  html_react_parser = require_rolldown_runtime.__toESM(html_react_parser);
13
10
  let react_i18next = require("react-i18next");
14
- react_i18next = require_rolldown_runtime.__toESM(react_i18next);
15
11
  let react_jsx_runtime = require("react/jsx-runtime");
16
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
17
12
 
18
13
  //#region src/Embed/BrightcoveEmbed.tsx
14
+ /**
15
+ * Copyright (c) 2023-present, NDLA.
16
+ *
17
+ * This source code is licensed under the GPLv3 license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ *
20
+ */
19
21
  const LinkedVideoButton = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Button, { base: { marginBlockStart: "3xsmall" } });
20
22
  const BrightcoveIframe = (0, __ndla_styled_system_jsx.styled)("iframe", { base: {
21
23
  border: 0,
@@ -1 +1 @@
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};\nexport const 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"],"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,MAAa,mBAAmB,EAAE,OAAO,gBAAgB,WAAW,WAAkB;CACpF,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"}
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};\nexport const 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"],"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,MAAa,mBAAmB,EAAE,OAAO,gBAAgB,WAAW,WAAkB;CACpF,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"}
@@ -3,19 +3,20 @@ const require_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
3
3
  const require_CodeBlock = require('../CodeBlock/CodeBlock.js');
4
4
  const require_codeLanguageOptions = require('../CodeBlock/codeLanguageOptions.js');
5
5
  let react = require("react");
6
- react = require_rolldown_runtime.__toESM(react);
7
6
  let __ndla_primitives = require("@ndla/primitives");
8
- __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
9
7
  let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
10
- __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
11
8
  let react_i18next = require("react-i18next");
12
- react_i18next = require_rolldown_runtime.__toESM(react_i18next);
13
9
  let __ndla_icons = require("@ndla/icons");
14
- __ndla_icons = require_rolldown_runtime.__toESM(__ndla_icons);
15
10
  let react_jsx_runtime = require("react/jsx-runtime");
16
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
17
11
 
18
12
  //#region src/Embed/CodeEmbed.tsx
13
+ /**
14
+ * Copyright (c) 2023-present, NDLA.
15
+ *
16
+ * This source code is licensed under the GPLv3 license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ *
19
+ */
19
20
  const StyledFigCaption = (0, __ndla_styled_system_jsx.styled)("figcaption", { base: {
20
21
  textStyle: "label.large",
21
22
  fontWeight: "bold"
@@ -1 +1 @@
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\nexport const 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"],"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,MAAa,aAAa,EAAE,YAAmB;CAC7C,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,uDAAsB,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"}
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\nexport const 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"],"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,MAAa,aAAa,EAAE,YAAmB;CAC7C,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,uDAAsB,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"}
@@ -4,19 +4,21 @@ const require_Concept = require('../Concept/Concept.js');
4
4
  const require_ConceptInlineTriggerButton = require('./ConceptInlineTriggerButton.js');
5
5
  const require_GlossEmbed = require('./GlossEmbed.js');
6
6
  let react = require("react");
7
- react = require_rolldown_runtime.__toESM(react);
8
7
  let __ndla_primitives = require("@ndla/primitives");
9
- __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
10
8
  let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
11
- __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
12
9
  let html_react_parser = require("html-react-parser");
13
10
  html_react_parser = require_rolldown_runtime.__toESM(html_react_parser);
14
11
  let react_jsx_runtime = require("react/jsx-runtime");
15
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
16
12
  let __ark_ui_react = require("@ark-ui/react");
17
- __ark_ui_react = require_rolldown_runtime.__toESM(__ark_ui_react);
18
13
 
19
14
  //#region src/Embed/ConceptEmbed.tsx
15
+ /**
16
+ * Copyright (c) 2024-present, NDLA.
17
+ *
18
+ * This source code is licensed under the GPLv3 license found in the
19
+ * LICENSE file in the root directory of this source tree.
20
+ *
21
+ */
20
22
  const StyledPopoverContent = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.PopoverContent, { base: {
21
23
  width: "surface.xlarge",
22
24
  maxHeight: "50vh",
@@ -1 +1 @@
1
- {"version":3,"file":"ConceptEmbed.js","names":["PopoverContent","EmbedErrorPlaceholder","GlossEmbed","PopoverRoot","PopoverTrigger","ConceptInlineTriggerButton","Portal","Concept"],"sources":["../../src/Embed/ConceptEmbed.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 parse from \"html-react-parser\";\nimport { forwardRef, useMemo, useRef, type ReactNode } from \"react\";\nimport { Portal } from \"@ark-ui/react\";\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { ConceptMetaData } from \"@ndla/types-embed\";\nimport { ConceptInlineTriggerButton } from \"./ConceptInlineTriggerButton\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport { GlossEmbed } from \"./GlossEmbed\";\nimport type { RenderContext } from \"./types\";\nimport { Concept, type ConceptProps } from \"../Concept/Concept\";\n\ninterface BaseProps {\n renderContext?: RenderContext;\n lang?: string;\n previewAlt?: boolean;\n}\n\ninterface Props extends BaseProps {\n embed: ConceptMetaData;\n children?: ReactNode;\n}\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n width: \"surface.xlarge\",\n maxHeight: \"50vh\",\n overflowY: \"auto\",\n },\n});\n\nexport const ConceptEmbed = ({ embed, renderContext, lang, previewAlt, children }: Props) => {\n const parsedContent = useMemo(() => {\n if (embed.status === \"error\" || !embed.data.concept.content) return undefined;\n return parse(embed.data.concept.content.htmlContent);\n }, [embed]);\n\n const parsedTitle = useMemo(\n () => (embed.status === \"success\" ? parse(embed.data.concept.title.htmlTitle) : undefined),\n [embed],\n );\n\n if (embed.status === \"error\" && embed.embedData.type === \"inline\") {\n return <span>{children}</span>;\n }\n if (embed.status === \"error\") {\n // TODO: This could be either concept or gloss. We don't know if it errors out. :)\n return <EmbedErrorPlaceholder type=\"gloss\" />;\n }\n\n const { concept, visualElement } = embed.data;\n\n // TODO: Consider whether we should do this in article-converter instead.\n if (embed.data.concept.glossData) {\n return <GlossEmbed embed={embed} />;\n }\n\n if (embed.embedData.type === \"inline\") {\n return (\n <InlineConcept\n previewAlt={previewAlt}\n linkContent={children}\n copyright={concept.copyright}\n visualElement={visualElement}\n lang={lang}\n title={parsedTitle}\n source={concept.source}\n >\n {parsedContent}\n </InlineConcept>\n );\n }\n\n return (\n <BlockConcept\n previewAlt={previewAlt}\n copyright={concept.copyright}\n visualElement={visualElement}\n lang={lang}\n title={renderContext === \"embed\" ? undefined : parsedTitle}\n source={concept.source}\n >\n {parsedContent}\n </BlockConcept>\n );\n};\n\nexport interface InlineConceptProps extends ConceptProps, BaseProps {\n linkContent?: ReactNode;\n source?: string;\n}\n\nexport const InlineConcept = forwardRef<HTMLSpanElement, InlineConceptProps>(\n ({ linkContent, copyright, visualElement, previewAlt, lang, children, title, source, ...rest }, ref) => {\n const contentRef = useRef<HTMLDivElement>(null);\n return (\n <PopoverRoot initialFocusEl={() => contentRef.current}>\n {/* @ts-expect-error placing ref and rest on popover trigger somehow removes a bug where the popover target becomes a bit bigger */}\n <PopoverTrigger asChild ref={ref} {...rest}>\n <ConceptInlineTriggerButton>{linkContent}</ConceptInlineTriggerButton>\n </PopoverTrigger>\n <Portal>\n <StyledPopoverContent ref={contentRef}>\n <Concept\n copyright={copyright}\n visualElement={visualElement}\n title={title}\n lang={lang}\n source={source}\n previewAlt={previewAlt}\n >\n {children}\n </Concept>\n </StyledPopoverContent>\n </Portal>\n </PopoverRoot>\n );\n },\n);\n\nexport interface BlockConceptProps extends ConceptProps {}\n\nexport const BlockConcept = forwardRef<HTMLElement, BlockConceptProps>((props, ref) => (\n <Concept {...props} data-embed-type=\"concept\" ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+BA,MAAM,4DAA8BA,kCAAgB,EAClD,MAAM;CACJ,OAAO;CACP,WAAW;CACX,WAAW;CACZ,EACF,CAAC;AAEF,MAAa,gBAAgB,EAAE,OAAO,eAAe,MAAM,YAAY,eAAsB;CAC3F,MAAM,yCAA8B;AAClC,MAAI,MAAM,WAAW,WAAW,CAAC,MAAM,KAAK,QAAQ,QAAS,QAAO;AACpE,wCAAa,MAAM,KAAK,QAAQ,QAAQ,YAAY;IACnD,CAAC,MAAM,CAAC;CAEX,MAAM,uCACG,MAAM,WAAW,2CAAkB,MAAM,KAAK,QAAQ,MAAM,UAAU,GAAG,QAChF,CAAC,MAAM,CACR;AAED,KAAI,MAAM,WAAW,WAAW,MAAM,UAAU,SAAS,SACvD,QAAO,2CAAC,UAAM,WAAgB;AAEhC,KAAI,MAAM,WAAW,QAEnB,QAAO,2CAACC,uDAAsB,MAAK,UAAU;CAG/C,MAAM,EAAE,SAAS,kBAAkB,MAAM;AAGzC,KAAI,MAAM,KAAK,QAAQ,UACrB,QAAO,2CAACC,iCAAkB,QAAS;AAGrC,KAAI,MAAM,UAAU,SAAS,SAC3B,QACE,2CAAC;EACa;EACZ,aAAa;EACb,WAAW,QAAQ;EACJ;EACT;EACN,OAAO;EACP,QAAQ,QAAQ;YAEf;GACa;AAIpB,QACE,2CAAC;EACa;EACZ,WAAW,QAAQ;EACJ;EACT;EACN,OAAO,kBAAkB,UAAU,SAAY;EAC/C,QAAQ,QAAQ;YAEf;GACY;;AASnB,MAAa,uCACV,EAAE,aAAa,WAAW,eAAe,YAAY,MAAM,UAAU,OAAO,OAAQ,GAAG,QAAQ,QAAQ;CACtG,MAAM,+BAAoC,KAAK;AAC/C,QACE,4CAACC;EAAY,sBAAsB,WAAW;aAE5C,2CAACC;GAAe;GAAa;GAAK,GAAI;aACpC,2CAACC,2EAA4B,cAAyC;IACvD,EACjB,2CAACC,mCACC,2CAAC;GAAqB,KAAK;aACzB,2CAACC;IACY;IACI;IACR;IACD;IACE;IACI;IAEX;KACO;IACW,GAChB;GACG;EAGnB;AAID,MAAa,sCAA2D,OAAO,QAC7E,2CAACA;CAAQ,GAAI;CAAO,mBAAgB;CAAe;EAAO,CAC1D"}
1
+ {"version":3,"file":"ConceptEmbed.js","names":["PopoverContent","EmbedErrorPlaceholder","GlossEmbed","PopoverRoot","PopoverTrigger","ConceptInlineTriggerButton","Portal","Concept"],"sources":["../../src/Embed/ConceptEmbed.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 parse from \"html-react-parser\";\nimport { forwardRef, useMemo, useRef, type ReactNode } from \"react\";\nimport { Portal } from \"@ark-ui/react\";\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { ConceptMetaData } from \"@ndla/types-embed\";\nimport { ConceptInlineTriggerButton } from \"./ConceptInlineTriggerButton\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport { GlossEmbed } from \"./GlossEmbed\";\nimport type { RenderContext } from \"./types\";\nimport { Concept, type ConceptProps } from \"../Concept/Concept\";\n\ninterface BaseProps {\n renderContext?: RenderContext;\n lang?: string;\n previewAlt?: boolean;\n}\n\ninterface Props extends BaseProps {\n embed: ConceptMetaData;\n children?: ReactNode;\n}\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n width: \"surface.xlarge\",\n maxHeight: \"50vh\",\n overflowY: \"auto\",\n },\n});\n\nexport const ConceptEmbed = ({ embed, renderContext, lang, previewAlt, children }: Props) => {\n const parsedContent = useMemo(() => {\n if (embed.status === \"error\" || !embed.data.concept.content) return undefined;\n return parse(embed.data.concept.content.htmlContent);\n }, [embed]);\n\n const parsedTitle = useMemo(\n () => (embed.status === \"success\" ? parse(embed.data.concept.title.htmlTitle) : undefined),\n [embed],\n );\n\n if (embed.status === \"error\" && embed.embedData.type === \"inline\") {\n return <span>{children}</span>;\n }\n if (embed.status === \"error\") {\n // TODO: This could be either concept or gloss. We don't know if it errors out. :)\n return <EmbedErrorPlaceholder type=\"gloss\" />;\n }\n\n const { concept, visualElement } = embed.data;\n\n // TODO: Consider whether we should do this in article-converter instead.\n if (embed.data.concept.glossData) {\n return <GlossEmbed embed={embed} />;\n }\n\n if (embed.embedData.type === \"inline\") {\n return (\n <InlineConcept\n previewAlt={previewAlt}\n linkContent={children}\n copyright={concept.copyright}\n visualElement={visualElement}\n lang={lang}\n title={parsedTitle}\n source={concept.source}\n >\n {parsedContent}\n </InlineConcept>\n );\n }\n\n return (\n <BlockConcept\n previewAlt={previewAlt}\n copyright={concept.copyright}\n visualElement={visualElement}\n lang={lang}\n title={renderContext === \"embed\" ? undefined : parsedTitle}\n source={concept.source}\n >\n {parsedContent}\n </BlockConcept>\n );\n};\n\nexport interface InlineConceptProps extends ConceptProps, BaseProps {\n linkContent?: ReactNode;\n source?: string;\n}\n\nexport const InlineConcept = forwardRef<HTMLSpanElement, InlineConceptProps>(\n ({ linkContent, copyright, visualElement, previewAlt, lang, children, title, source, ...rest }, ref) => {\n const contentRef = useRef<HTMLDivElement>(null);\n return (\n <PopoverRoot initialFocusEl={() => contentRef.current}>\n {/* @ts-expect-error placing ref and rest on popover trigger somehow removes a bug where the popover target becomes a bit bigger */}\n <PopoverTrigger asChild ref={ref} {...rest}>\n <ConceptInlineTriggerButton>{linkContent}</ConceptInlineTriggerButton>\n </PopoverTrigger>\n <Portal>\n <StyledPopoverContent ref={contentRef}>\n <Concept\n copyright={copyright}\n visualElement={visualElement}\n title={title}\n lang={lang}\n source={source}\n previewAlt={previewAlt}\n >\n {children}\n </Concept>\n </StyledPopoverContent>\n </Portal>\n </PopoverRoot>\n );\n },\n);\n\nexport interface BlockConceptProps extends ConceptProps {}\n\nexport const BlockConcept = forwardRef<HTMLElement, BlockConceptProps>((props, ref) => (\n <Concept {...props} data-embed-type=\"concept\" ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,4DAA8BA,kCAAgB,EAClD,MAAM;CACJ,OAAO;CACP,WAAW;CACX,WAAW;CACZ,EACF,CAAC;AAEF,MAAa,gBAAgB,EAAE,OAAO,eAAe,MAAM,YAAY,eAAsB;CAC3F,MAAM,yCAA8B;AAClC,MAAI,MAAM,WAAW,WAAW,CAAC,MAAM,KAAK,QAAQ,QAAS,QAAO;AACpE,wCAAa,MAAM,KAAK,QAAQ,QAAQ,YAAY;IACnD,CAAC,MAAM,CAAC;CAEX,MAAM,uCACG,MAAM,WAAW,2CAAkB,MAAM,KAAK,QAAQ,MAAM,UAAU,GAAG,QAChF,CAAC,MAAM,CACR;AAED,KAAI,MAAM,WAAW,WAAW,MAAM,UAAU,SAAS,SACvD,QAAO,2CAAC,UAAM,WAAgB;AAEhC,KAAI,MAAM,WAAW,QAEnB,QAAO,2CAACC,uDAAsB,MAAK,UAAU;CAG/C,MAAM,EAAE,SAAS,kBAAkB,MAAM;AAGzC,KAAI,MAAM,KAAK,QAAQ,UACrB,QAAO,2CAACC,iCAAkB,QAAS;AAGrC,KAAI,MAAM,UAAU,SAAS,SAC3B,QACE,2CAAC;EACa;EACZ,aAAa;EACb,WAAW,QAAQ;EACJ;EACT;EACN,OAAO;EACP,QAAQ,QAAQ;YAEf;GACa;AAIpB,QACE,2CAAC;EACa;EACZ,WAAW,QAAQ;EACJ;EACT;EACN,OAAO,kBAAkB,UAAU,SAAY;EAC/C,QAAQ,QAAQ;YAEf;GACY;;AASnB,MAAa,uCACV,EAAE,aAAa,WAAW,eAAe,YAAY,MAAM,UAAU,OAAO,OAAQ,GAAG,QAAQ,QAAQ;CACtG,MAAM,+BAAoC,KAAK;AAC/C,QACE,4CAACC;EAAY,sBAAsB,WAAW;aAE5C,2CAACC;GAAe;GAAa;GAAK,GAAI;aACpC,2CAACC,2EAA4B,cAAyC;IACvD,EACjB,2CAACC,mCACC,2CAAC;GAAqB,KAAK;aACzB,2CAACC;IACY;IACI;IACR;IACD;IACE;IACI;IAEX;KACO;IACW,GAChB;GACG;EAGnB;AAID,MAAa,sCAA2D,OAAO,QAC7E,2CAACA;CAAQ,GAAI;CAAO,mBAAgB;CAAe;EAAO,CAC1D"}
@@ -1,9 +1,15 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  const require_InlineTriggerButton = require('./InlineTriggerButton.js');
3
3
  let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
4
- __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
5
4
 
6
5
  //#region src/Embed/ConceptInlineTriggerButton.tsx
6
+ /**
7
+ * Copyright (c) 2024-present, NDLA.
8
+ *
9
+ * This source code is licensed under the GPLv3 license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ *
12
+ */
7
13
  const ConceptInlineTriggerButton = (0, __ndla_styled_system_jsx.styled)(require_InlineTriggerButton.InlineTriggerButton, { base: {
8
14
  position: "relative",
9
15
  overflow: "visible",
@@ -1 +1 @@
1
- {"version":3,"file":"ConceptInlineTriggerButton.js","names":["InlineTriggerButton"],"sources":["../../src/Embed/ConceptInlineTriggerButton.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 { styled } from \"@ndla/styled-system/jsx\";\nimport { InlineTriggerButton } from \"./InlineTriggerButton\";\n\nexport const ConceptInlineTriggerButton = styled(InlineTriggerButton, {\n base: {\n position: \"relative\",\n overflow: \"visible\",\n borderBottom: \"1px solid\",\n borderStyle: \"dashed\",\n borderColor: \"stroke.hover\",\n paddingBlockStart: \"5xsmall\",\n width: \"fit-content\",\n cursor: \"pointer\",\n _hover: {\n borderColor: \"text.link\",\n background: \"surface.actionSubtle.hover\",\n },\n _active: {\n borderColor: \"text.link\",\n background: \"surface.actionSubtle.active\",\n },\n // The global focus ring forces the border-radius to be xsmall, causing the dashed border to be cut off. This is a workaround.\n _focusVisible: {\n outline: \"none\",\n borderRadius: \"0\",\n _after: {\n content: '\"\"',\n position: \"absolute\",\n inset: \"0\",\n outline: \"3px\",\n borderRadius: \"xsmall\",\n outlineColor: \"stroke.default\",\n outlineOffset: \"3px\",\n outlineStyle: \"solid\",\n },\n },\n },\n});\n"],"mappings":";;;;;;AAWA,MAAa,kEAAoCA,iDAAqB,EACpE,MAAM;CACJ,UAAU;CACV,UAAU;CACV,cAAc;CACd,aAAa;CACb,aAAa;CACb,mBAAmB;CACnB,OAAO;CACP,QAAQ;CACR,QAAQ;EACN,aAAa;EACb,YAAY;EACb;CACD,SAAS;EACP,aAAa;EACb,YAAY;EACb;CAED,eAAe;EACb,SAAS;EACT,cAAc;EACd,QAAQ;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACP,SAAS;GACT,cAAc;GACd,cAAc;GACd,eAAe;GACf,cAAc;GACf;EACF;CACF,EACF,CAAC"}
1
+ {"version":3,"file":"ConceptInlineTriggerButton.js","names":["InlineTriggerButton"],"sources":["../../src/Embed/ConceptInlineTriggerButton.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 { styled } from \"@ndla/styled-system/jsx\";\nimport { InlineTriggerButton } from \"./InlineTriggerButton\";\n\nexport const ConceptInlineTriggerButton = styled(InlineTriggerButton, {\n base: {\n position: \"relative\",\n overflow: \"visible\",\n borderBottom: \"1px solid\",\n borderStyle: \"dashed\",\n borderColor: \"stroke.hover\",\n paddingBlockStart: \"5xsmall\",\n width: \"fit-content\",\n cursor: \"pointer\",\n _hover: {\n borderColor: \"text.link\",\n background: \"surface.actionSubtle.hover\",\n },\n _active: {\n borderColor: \"text.link\",\n background: \"surface.actionSubtle.active\",\n },\n // The global focus ring forces the border-radius to be xsmall, causing the dashed border to be cut off. This is a workaround.\n _focusVisible: {\n outline: \"none\",\n borderRadius: \"0\",\n _after: {\n content: '\"\"',\n position: \"absolute\",\n inset: \"0\",\n outline: \"3px\",\n borderRadius: \"xsmall\",\n outlineColor: \"stroke.default\",\n outlineOffset: \"3px\",\n outlineStyle: \"solid\",\n },\n },\n },\n});\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,kEAAoCA,iDAAqB,EACpE,MAAM;CACJ,UAAU;CACV,UAAU;CACV,cAAc;CACd,aAAa;CACb,aAAa;CACb,mBAAmB;CACnB,OAAO;CACP,QAAQ;CACR,QAAQ;EACN,aAAa;EACb,YAAY;EACb;CACD,SAAS;EACP,aAAa;EACb,YAAY;EACb;CAED,eAAe;EACb,SAAS;EACT,cAAc;EACd,QAAQ;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACP,SAAS;GACT,cAAc;GACd,cAAc;GACd,eAAe;GACf,cAAc;GACf;EACF;CACF,EACF,CAAC"}
@@ -1,10 +1,7 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  let __ndla_primitives = require("@ndla/primitives");
3
- __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
4
3
  let react_i18next = require("react-i18next");
5
- react_i18next = require_rolldown_runtime.__toESM(react_i18next);
6
4
  let react_jsx_runtime = require("react/jsx-runtime");
7
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
8
5
 
9
6
  //#region src/Embed/ContentLinkEmbed.tsx
10
7
  const ContentLinkEmbed = ({ embed, isOembed, children }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"ContentLinkEmbed.js","names":["Text"],"sources":["../../src/Embed/ContentLinkEmbed.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 type { ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Text } from \"@ndla/primitives\";\nimport type { ContentLinkMetaData } from \"@ndla/types-embed\";\n\ninterface Props {\n embed: ContentLinkMetaData;\n isOembed?: boolean;\n children?: ReactNode;\n}\n\nexport const ContentLinkEmbed = ({ embed, isOembed, children }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return (\n <Text color=\"text.error\" asChild consumeCss>\n <span>\n <span>{`${t(\"embed.linkError\")}: `}</span>\n {children}\n </span>\n </Text>\n );\n }\n\n const { embedData, data } = embed;\n\n if (embedData.openIn === \"new-context\" || isOembed) {\n return (\n <a href={data.path} data-embed-type=\"content-link\" target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n }\n\n return <a href={data.path}>{children}</a>;\n};\n"],"mappings":";;;;;;;;;AAmBA,MAAa,oBAAoB,EAAE,OAAO,UAAU,eAAsB;CACxE,MAAM,EAAE,yCAAsB;AAC9B,KAAI,MAAM,WAAW,QACnB,QACE,2CAACA;EAAK,OAAM;EAAa;EAAQ;YAC/B,4CAAC,qBACC,2CAAC,oBAAM,GAAG,EAAE,kBAAkB,CAAC,MAAW,EACzC,YACI;GACF;CAIX,MAAM,EAAE,WAAW,SAAS;AAE5B,KAAI,UAAU,WAAW,iBAAiB,SACxC,QACE,2CAAC;EAAE,MAAM,KAAK;EAAM,mBAAgB;EAAe,QAAO;EAAS,KAAI;EACpE;GACC;AAIR,QAAO,2CAAC;EAAE,MAAM,KAAK;EAAO;GAAa"}
1
+ {"version":3,"file":"ContentLinkEmbed.js","names":["Text"],"sources":["../../src/Embed/ContentLinkEmbed.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 type { ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Text } from \"@ndla/primitives\";\nimport type { ContentLinkMetaData } from \"@ndla/types-embed\";\n\ninterface Props {\n embed: ContentLinkMetaData;\n isOembed?: boolean;\n children?: ReactNode;\n}\n\nexport const ContentLinkEmbed = ({ embed, isOembed, children }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return (\n <Text color=\"text.error\" asChild consumeCss>\n <span>\n <span>{`${t(\"embed.linkError\")}: `}</span>\n {children}\n </span>\n </Text>\n );\n }\n\n const { embedData, data } = embed;\n\n if (embedData.openIn === \"new-context\" || isOembed) {\n return (\n <a href={data.path} data-embed-type=\"content-link\" target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n }\n\n return <a href={data.path}>{children}</a>;\n};\n"],"mappings":";;;;;;AAmBA,MAAa,oBAAoB,EAAE,OAAO,UAAU,eAAsB;CACxE,MAAM,EAAE,yCAAsB;AAC9B,KAAI,MAAM,WAAW,QACnB,QACE,2CAACA;EAAK,OAAM;EAAa;EAAQ;YAC/B,4CAAC,qBACC,2CAAC,oBAAM,GAAG,EAAE,kBAAkB,CAAC,MAAW,EACzC,YACI;GACF;CAIX,MAAM,EAAE,WAAW,SAAS;AAE5B,KAAI,UAAU,WAAW,iBAAiB,SACxC,QACE,2CAAC;EAAE,MAAM,KAAK;EAAM,mBAAgB;EAAe,QAAO;EAAS,KAAI;EACpE;GACC;AAIR,QAAO,2CAAC;EAAE,MAAM,KAAK;EAAO;GAAa"}
@@ -1,9 +1,7 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  const require_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
3
  let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
4
- __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
5
4
  let react_jsx_runtime = require("react/jsx-runtime");
6
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
7
5
 
8
6
  //#region src/Embed/CopyrightEmbed.tsx
9
7
  const StyledCopyrightContent = (0, __ndla_styled_system_jsx.styled)("div", { base: { marginBlockEnd: "xsmall" } });
@@ -1 +1 @@
1
- {"version":3,"file":"CopyrightEmbed.js","names":["EmbedByline"],"sources":["../../src/Embed/CopyrightEmbed.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 { ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CopyrightMetaData } from \"@ndla/types-embed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\n\ninterface Props {\n embed: CopyrightMetaData;\n children?: ReactNode;\n}\n\nconst StyledCopyrightContent = styled(\"div\", {\n base: {\n marginBlockEnd: \"xsmall\",\n },\n});\n\nexport const CopyrightEmbed = ({ embed, children }: Props) => {\n return (\n <figure data-embed-type=\"copyright\">\n <StyledCopyrightContent data-copyright-content=\"\">{children}</StyledCopyrightContent>\n <EmbedByline type=\"copyright\" copyright={embed.embedData.copyright} />\n </figure>\n );\n};\n"],"mappings":";;;;;;;;AAkBA,MAAM,8DAAgC,OAAO,EAC3C,MAAM,EACJ,gBAAgB,UACjB,EACF,CAAC;AAEF,MAAa,kBAAkB,EAAE,OAAO,eAAsB;AAC5D,QACE,4CAAC;EAAO,mBAAgB;aACtB,2CAAC;GAAuB,0BAAuB;GAAI;IAAkC,EACrF,2CAACA;GAAY,MAAK;GAAY,WAAW,MAAM,UAAU;IAAa;GAC/D"}
1
+ {"version":3,"file":"CopyrightEmbed.js","names":["EmbedByline"],"sources":["../../src/Embed/CopyrightEmbed.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 { ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CopyrightMetaData } from \"@ndla/types-embed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\n\ninterface Props {\n embed: CopyrightMetaData;\n children?: ReactNode;\n}\n\nconst StyledCopyrightContent = styled(\"div\", {\n base: {\n marginBlockEnd: \"xsmall\",\n },\n});\n\nexport const CopyrightEmbed = ({ embed, children }: Props) => {\n return (\n <figure data-embed-type=\"copyright\">\n <StyledCopyrightContent data-copyright-content=\"\">{children}</StyledCopyrightContent>\n <EmbedByline type=\"copyright\" copyright={embed.embedData.copyright} />\n </figure>\n );\n};\n"],"mappings":";;;;;;AAkBA,MAAM,8DAAgC,OAAO,EAC3C,MAAM,EACJ,gBAAgB,UACjB,EACF,CAAC;AAEF,MAAa,kBAAkB,EAAE,OAAO,eAAsB;AAC5D,QACE,4CAAC;EAAO,mBAAgB;aACtB,2CAAC;GAAuB,0BAAuB;GAAI;IAAkC,EACrF,2CAACA;GAAY,MAAK;GAAY,WAAW,MAAM,UAAU;IAAa;GAC/D"}
@@ -1,17 +1,19 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  const require_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
3
  let react = require("react");
4
- react = require_rolldown_runtime.__toESM(react);
5
4
  let __ndla_primitives = require("@ndla/primitives");
6
- __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
7
5
  let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
8
- __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
9
6
  let __ndla_icons = require("@ndla/icons");
10
- __ndla_icons = require_rolldown_runtime.__toESM(__ndla_icons);
11
7
  let react_jsx_runtime = require("react/jsx-runtime");
12
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
13
8
 
14
9
  //#region src/Embed/EmbedErrorPlaceholder.tsx
10
+ /**
11
+ * Copyright (c) 2023-present, NDLA.
12
+ *
13
+ * This source code is licensed under the GPLv3 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ *
16
+ */
15
17
  const ErrorPlaceholder = (0, __ndla_styled_system_jsx.styled)("div", { base: {
16
18
  display: "flex",
17
19
  alignItems: "center",
@@ -1 +1 @@
1
- {"version":3,"file":"EmbedErrorPlaceholder.js","names":["Figure","ErrorWarningLine","EmbedByline"],"sources":["../../src/Embed/EmbedErrorPlaceholder.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 { type ReactNode } from \"react\";\nimport { ErrorWarningLine } from \"@ndla/icons\";\nimport { Figure, type FigureFloat, type FigureSize } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { EmbedByline, type EmbedBylineErrorProps } from \"../LicenseByline/EmbedByline\";\n\ninterface Props {\n type: EmbedBylineErrorProps[\"type\"];\n figureType?: FigureSize;\n float?: FigureFloat;\n children?: ReactNode;\n}\n\nconst ErrorPlaceholder = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"background.subtle\",\n height: \"surface.xsmall\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n \"& svg\": {\n height: \"5xlarge\",\n width: \"5xlarge\",\n fill: \"stroke.default\",\n },\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& > *:not(:first-child)\": {\n marginBlockStart: \"3xsmall\",\n },\n },\n});\n\nexport const EmbedErrorPlaceholder = ({ type, children, figureType, float }: Props) => {\n return (\n <StyledFigure size={figureType} float={float} data-embed-type={type}>\n {children ?? (\n <ErrorPlaceholder data-embed-type={type}>\n <ErrorWarningLine />\n </ErrorPlaceholder>\n )}\n <EmbedByline error type={type} />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAM,wDAA0B,OAAO,EACrC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,QAAQ;CACR,aAAa;CACb,cAAc;CACd,SAAS;EACP,QAAQ;EACR,OAAO;EACP,MAAM;EACP;CACF,EACF,CAAC;AAEF,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM,EACJ,2BAA2B,EACzB,kBAAkB,WACnB,EACF,EACF,CAAC;AAEF,MAAa,yBAAyB,EAAE,MAAM,UAAU,YAAY,YAAmB;AACrF,QACE,4CAAC;EAAa,MAAM;EAAmB;EAAO,mBAAiB;aAC5D,YACC,2CAAC;GAAiB,mBAAiB;aACjC,2CAACC,kCAAmB;IACH,EAErB,2CAACC;GAAY;GAAY;IAAQ;GACpB"}
1
+ {"version":3,"file":"EmbedErrorPlaceholder.js","names":["Figure","ErrorWarningLine","EmbedByline"],"sources":["../../src/Embed/EmbedErrorPlaceholder.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 { type ReactNode } from \"react\";\nimport { ErrorWarningLine } from \"@ndla/icons\";\nimport { Figure, type FigureFloat, type FigureSize } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { EmbedByline, type EmbedBylineErrorProps } from \"../LicenseByline/EmbedByline\";\n\ninterface Props {\n type: EmbedBylineErrorProps[\"type\"];\n figureType?: FigureSize;\n float?: FigureFloat;\n children?: ReactNode;\n}\n\nconst ErrorPlaceholder = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"background.subtle\",\n height: \"surface.xsmall\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n \"& svg\": {\n height: \"5xlarge\",\n width: \"5xlarge\",\n fill: \"stroke.default\",\n },\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& > *:not(:first-child)\": {\n marginBlockStart: \"3xsmall\",\n },\n },\n});\n\nexport const EmbedErrorPlaceholder = ({ type, children, figureType, float }: Props) => {\n return (\n <StyledFigure size={figureType} float={float} data-embed-type={type}>\n {children ?? (\n <ErrorPlaceholder data-embed-type={type}>\n <ErrorWarningLine />\n </ErrorPlaceholder>\n )}\n <EmbedByline error type={type} />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAqBA,MAAM,wDAA0B,OAAO,EACrC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,QAAQ;CACR,aAAa;CACb,cAAc;CACd,SAAS;EACP,QAAQ;EACR,OAAO;EACP,MAAM;EACP;CACF,EACF,CAAC;AAEF,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM,EACJ,2BAA2B,EACzB,kBAAkB,WACnB,EACF,EACF,CAAC;AAEF,MAAa,yBAAyB,EAAE,MAAM,UAAU,YAAY,YAAmB;AACrF,QACE,4CAAC;EAAa,MAAM;EAAmB;EAAO,mBAAiB;aAC5D,YACC,2CAAC;GAAiB,mBAAiB;aACjC,2CAACC,kCAAmB;IACH,EAErB,2CAACC;GAAY;GAAY;IAAQ;GACpB"}
@@ -1,16 +1,18 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  let react = require("react");
3
- react = require_rolldown_runtime.__toESM(react);
4
3
  let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
5
- __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
6
4
  let react_jsx_runtime = require("react/jsx-runtime");
7
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
8
5
  let __ark_ui_react = require("@ark-ui/react");
9
- __ark_ui_react = require_rolldown_runtime.__toESM(__ark_ui_react);
10
6
  let __ndla_styled_system_css = require("@ndla/styled-system/css");
11
- __ndla_styled_system_css = require_rolldown_runtime.__toESM(__ndla_styled_system_css);
12
7
 
13
8
  //#region src/Embed/EmbedWrapper.tsx
9
+ /**
10
+ * Copyright (c) 2024-present, NDLA.
11
+ *
12
+ * This source code is licensed under the GPLv3 license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ *
15
+ */
14
16
  const embedWrapperRecipe = (0, __ndla_styled_system_css.cva)({
15
17
  base: { position: "relative" },
16
18
  defaultVariants: { noClear: false },
@@ -1 +1 @@
1
- {"version":3,"file":"EmbedWrapper.js","names":["ark","css"],"sources":["../../src/Embed/EmbedWrapper.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 { ark, type HTMLArkProps } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\n\nconst embedWrapperRecipe = cva({\n base: {\n position: \"relative\",\n },\n defaultVariants: {\n noClear: false,\n },\n variants: {\n noClear: {\n true: {\n \"& + [data-embed-wrapper]\": {\n clear: \"both\",\n },\n },\n false: {\n clear: \"both\",\n },\n },\n },\n});\n\nexport type EmbedWrapperVariantProps = NonNullable<RecipeVariantProps<typeof embedWrapperRecipe>>;\n\nexport interface EmbedWrapperProps extends HTMLArkProps<\"div\">, StyledProps, EmbedWrapperVariantProps {}\n\nconst StyledEmbedWrapper = styled(ark.div, {}, { baseComponent: true });\n\nexport const EmbedWrapper = forwardRef<HTMLDivElement, EmbedWrapperProps>(\n ({ noClear, css: cssProp, ...props }, ref) => (\n <StyledEmbedWrapper\n css={css.raw(embedWrapperRecipe.raw({ noClear }), cssProp)}\n data-embed-wrapper=\"\"\n {...props}\n ref={ref}\n />\n ),\n);\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,uDAAyB;CAC7B,MAAM,EACJ,UAAU,YACX;CACD,iBAAiB,EACf,SAAS,OACV;CACD,UAAU,EACR,SAAS;EACP,MAAM,EACJ,4BAA4B,EAC1B,OAAO,QACR,EACF;EACD,OAAO,EACL,OAAO,QACR;EACF,EACF;CACF,CAAC;AAMF,MAAM,0DAA4BA,mBAAI,KAAK,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAEvE,MAAa,sCACV,EAAE,SAAS,KAAK,QAAS,GAAG,SAAS,QACpC,2CAAC;CACC,KAAKC,6BAAI,IAAI,mBAAmB,IAAI,EAAE,SAAS,CAAC,EAAE,QAAQ;CAC1D,sBAAmB;CACnB,GAAI;CACC;EACL,CAEL"}
1
+ {"version":3,"file":"EmbedWrapper.js","names":["ark","css"],"sources":["../../src/Embed/EmbedWrapper.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 { ark, type HTMLArkProps } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\n\nconst embedWrapperRecipe = cva({\n base: {\n position: \"relative\",\n },\n defaultVariants: {\n noClear: false,\n },\n variants: {\n noClear: {\n true: {\n \"& + [data-embed-wrapper]\": {\n clear: \"both\",\n },\n },\n false: {\n clear: \"both\",\n },\n },\n },\n});\n\nexport type EmbedWrapperVariantProps = NonNullable<RecipeVariantProps<typeof embedWrapperRecipe>>;\n\nexport interface EmbedWrapperProps extends HTMLArkProps<\"div\">, StyledProps, EmbedWrapperVariantProps {}\n\nconst StyledEmbedWrapper = styled(ark.div, {}, { baseComponent: true });\n\nexport const EmbedWrapper = forwardRef<HTMLDivElement, EmbedWrapperProps>(\n ({ noClear, css: cssProp, ...props }, ref) => (\n <StyledEmbedWrapper\n css={css.raw(embedWrapperRecipe.raw({ noClear }), cssProp)}\n data-embed-wrapper=\"\"\n {...props}\n ref={ref}\n />\n ),\n);\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,uDAAyB;CAC7B,MAAM,EACJ,UAAU,YACX;CACD,iBAAiB,EACf,SAAS,OACV;CACD,UAAU,EACR,SAAS;EACP,MAAM,EACJ,4BAA4B,EAC1B,OAAO,QACR,EACF;EACD,OAAO,EACL,OAAO,QACR;EACF,EACF;CACF,CAAC;AAMF,MAAM,0DAA4BA,mBAAI,KAAK,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAEvE,MAAa,sCACV,EAAE,SAAS,KAAK,QAAS,GAAG,SAAS,QACpC,2CAAC;CACC,KAAKC,6BAAI,IAAI,mBAAmB,IAAI,EAAE,SAAS,CAAC,EAAE,QAAQ;CAC1D,sBAAmB;CACnB,GAAI;CACC;EACL,CAEL"}
@@ -2,17 +2,19 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  const require_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
3
3
  const require_ResourceBox = require('../ResourceBox/ResourceBox.js');
4
4
  let react = require("react");
5
- react = require_rolldown_runtime.__toESM(react);
6
5
  let __ndla_primitives = require("@ndla/primitives");
7
- __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
8
6
  let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
9
- __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
10
7
  let react_i18next = require("react-i18next");
11
- react_i18next = require_rolldown_runtime.__toESM(react_i18next);
12
8
  let react_jsx_runtime = require("react/jsx-runtime");
13
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
14
9
 
15
10
  //#region src/Embed/ExternalEmbed.tsx
11
+ /**
12
+ * Copyright (c) 2023-present, NDLA.
13
+ *
14
+ * This source code is licensed under the GPLv3 license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ *
17
+ */
16
18
  const StyledFigure = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Figure, { base: { "& iframe": {
17
19
  height: "auto",
18
20
  width: "100%"
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalEmbed.js","names":["Figure","EmbedErrorPlaceholder","ResourceBox"],"sources":["../../src/Embed/ExternalEmbed.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, useRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { OembedMetaData } from \"@ndla/types-embed\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport { ResourceBox } from \"../ResourceBox/ResourceBox\";\n\ninterface Props {\n embed: OembedMetaData;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& iframe\": {\n height: \"auto\",\n width: \"100%\",\n },\n },\n});\n\nexport const ExternalEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n const figRef = useRef<HTMLElement>(null);\n\n useEffect(() => {\n const iframe = figRef.current?.querySelector(\"iframe\");\n if (iframe) {\n const [width, height] = [Number.parseInt(iframe.width), Number.parseInt(iframe.height)];\n iframe.style.aspectRatio = `${width ? width : 16}/${height ? height : 9}`;\n iframe.width = \"\";\n iframe.height = \"\";\n }\n }, []);\n\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type=\"external\" />;\n }\n\n const { embedData, data } = embed;\n\n if (embedData.type === \"fullscreen\") {\n const image = {\n src: data.iframeImage?.image.imageUrl,\n alt: embedData.alt !== undefined ? embedData.alt : (data.iframeImage?.alttext?.alttext ?? \"\"),\n };\n return (\n <Figure data-embed-type=\"external\">\n <ResourceBox\n image={image}\n title={embedData.title ?? \"\"}\n url={embedData.url}\n caption={embedData.caption ?? \"\"}\n buttonText={t(\"license.other.itemImage.ariaLabel\")}\n />\n </Figure>\n );\n }\n\n return (\n <StyledFigure\n data-embed-type=\"external\"\n ref={figRef}\n dangerouslySetInnerHTML={{ __html: data?.oembed?.html ?? \"\" }}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM,EACJ,YAAY;CACV,QAAQ;CACR,OAAO;CACR,EACF,EACF,CAAC;AAEF,MAAa,iBAAiB,EAAE,YAAmB;CACjD,MAAM,EAAE,yCAAsB;CAC9B,MAAM,2BAA6B,KAAK;AAExC,4BAAgB;EACd,MAAM,SAAS,OAAO,SAAS,cAAc,SAAS;AACtD,MAAI,QAAQ;GACV,MAAM,CAAC,OAAO,UAAU,CAAC,OAAO,SAAS,OAAO,MAAM,EAAE,OAAO,SAAS,OAAO,OAAO,CAAC;AACvF,UAAO,MAAM,cAAc,GAAG,QAAQ,QAAQ,GAAG,GAAG,SAAS,SAAS;AACtE,UAAO,QAAQ;AACf,UAAO,SAAS;;IAEjB,EAAE,CAAC;AAEN,KAAI,MAAM,WAAW,QACnB,QAAO,2CAACC,uDAAsB,MAAK,aAAa;CAGlD,MAAM,EAAE,WAAW,SAAS;AAE5B,KAAI,UAAU,SAAS,cAAc;EACnC,MAAM,QAAQ;GACZ,KAAK,KAAK,aAAa,MAAM;GAC7B,KAAK,UAAU,QAAQ,SAAY,UAAU,MAAO,KAAK,aAAa,SAAS,WAAW;GAC3F;AACD,SACE,2CAACD;GAAO,mBAAgB;aACtB,2CAACE;IACQ;IACP,OAAO,UAAU,SAAS;IAC1B,KAAK,UAAU;IACf,SAAS,UAAU,WAAW;IAC9B,YAAY,EAAE,oCAAoC;KAClD;IACK;;AAIb,QACE,2CAAC;EACC,mBAAgB;EAChB,KAAK;EACL,yBAAyB,EAAE,QAAQ,MAAM,QAAQ,QAAQ,IAAI;GAC7D"}
1
+ {"version":3,"file":"ExternalEmbed.js","names":["Figure","EmbedErrorPlaceholder","ResourceBox"],"sources":["../../src/Embed/ExternalEmbed.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, useRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { OembedMetaData } from \"@ndla/types-embed\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport { ResourceBox } from \"../ResourceBox/ResourceBox\";\n\ninterface Props {\n embed: OembedMetaData;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& iframe\": {\n height: \"auto\",\n width: \"100%\",\n },\n },\n});\n\nexport const ExternalEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n const figRef = useRef<HTMLElement>(null);\n\n useEffect(() => {\n const iframe = figRef.current?.querySelector(\"iframe\");\n if (iframe) {\n const [width, height] = [Number.parseInt(iframe.width), Number.parseInt(iframe.height)];\n iframe.style.aspectRatio = `${width ? width : 16}/${height ? height : 9}`;\n iframe.width = \"\";\n iframe.height = \"\";\n }\n }, []);\n\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type=\"external\" />;\n }\n\n const { embedData, data } = embed;\n\n if (embedData.type === \"fullscreen\") {\n const image = {\n src: data.iframeImage?.image.imageUrl,\n alt: embedData.alt !== undefined ? embedData.alt : (data.iframeImage?.alttext?.alttext ?? \"\"),\n };\n return (\n <Figure data-embed-type=\"external\">\n <ResourceBox\n image={image}\n title={embedData.title ?? \"\"}\n url={embedData.url}\n caption={embedData.caption ?? \"\"}\n buttonText={t(\"license.other.itemImage.ariaLabel\")}\n />\n </Figure>\n );\n }\n\n return (\n <StyledFigure\n data-embed-type=\"external\"\n ref={figRef}\n dangerouslySetInnerHTML={{ __html: data?.oembed?.html ?? \"\" }}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM,EACJ,YAAY;CACV,QAAQ;CACR,OAAO;CACR,EACF,EACF,CAAC;AAEF,MAAa,iBAAiB,EAAE,YAAmB;CACjD,MAAM,EAAE,yCAAsB;CAC9B,MAAM,2BAA6B,KAAK;AAExC,4BAAgB;EACd,MAAM,SAAS,OAAO,SAAS,cAAc,SAAS;AACtD,MAAI,QAAQ;GACV,MAAM,CAAC,OAAO,UAAU,CAAC,OAAO,SAAS,OAAO,MAAM,EAAE,OAAO,SAAS,OAAO,OAAO,CAAC;AACvF,UAAO,MAAM,cAAc,GAAG,QAAQ,QAAQ,GAAG,GAAG,SAAS,SAAS;AACtE,UAAO,QAAQ;AACf,UAAO,SAAS;;IAEjB,EAAE,CAAC;AAEN,KAAI,MAAM,WAAW,QACnB,QAAO,2CAACC,uDAAsB,MAAK,aAAa;CAGlD,MAAM,EAAE,WAAW,SAAS;AAE5B,KAAI,UAAU,SAAS,cAAc;EACnC,MAAM,QAAQ;GACZ,KAAK,KAAK,aAAa,MAAM;GAC7B,KAAK,UAAU,QAAQ,SAAY,UAAU,MAAO,KAAK,aAAa,SAAS,WAAW;GAC3F;AACD,SACE,2CAACD;GAAO,mBAAgB;aACtB,2CAACE;IACQ;IACP,OAAO,UAAU,SAAS;IAC1B,KAAK,UAAU;IACf,SAAS,UAAU,WAAW;IAC9B,YAAY,EAAE,oCAAoC;KAClD;IACK;;AAIb,QACE,2CAAC;EACC,mBAAgB;EAChB,KAAK;EACL,yBAAyB,EAAE,QAAQ,MAAM,QAAQ,QAAQ,IAAI;GAC7D"}
@@ -1,12 +1,16 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
3
- __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
4
3
  let react_i18next = require("react-i18next");
5
- react_i18next = require_rolldown_runtime.__toESM(react_i18next);
6
4
  let react_jsx_runtime = require("react/jsx-runtime");
7
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
8
5
 
9
6
  //#region src/Embed/FootnoteEmbed.tsx
7
+ /**
8
+ * Copyright (c) 2023-present, NDLA.
9
+ *
10
+ * This source code is licensed under the GPLv3 license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ *
13
+ */
10
14
  const StyledSup = (0, __ndla_styled_system_jsx.styled)("sup", { base: { "& a": {
11
15
  textStyle: "label.xsmall",
12
16
  marginInlineStart: "1"
@@ -1 +1 @@
1
- {"version":3,"file":"FootnoteEmbed.js","names":[],"sources":["../../src/Embed/FootnoteEmbed.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 { useTranslation } from \"react-i18next\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { FootnoteMetaData } from \"@ndla/types-embed\";\n\ninterface Props {\n embed: FootnoteMetaData;\n}\n\nconst StyledSup = styled(\"sup\", {\n base: {\n \"& a\": {\n textStyle: \"label.xsmall\",\n marginInlineStart: \"1\",\n },\n },\n});\n\nexport const FootnoteEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return <div>{t(\"error\")}</div>;\n }\n\n return (\n <span id={`ref${embed.data.entryNum}`} data-embed-type=\"footnote\">\n <StyledSup>\n <a href={`#note${embed.data.entryNum}`} target=\"_self\">{`[${embed.data.entryNum}]`}</a>\n </StyledSup>\n </span>\n );\n};\n"],"mappings":";;;;;;;;;AAgBA,MAAM,iDAAmB,OAAO,EAC9B,MAAM,EACJ,OAAO;CACL,WAAW;CACX,mBAAmB;CACpB,EACF,EACF,CAAC;AAEF,MAAa,iBAAiB,EAAE,YAAmB;CACjD,MAAM,EAAE,yCAAsB;AAC9B,KAAI,MAAM,WAAW,QACnB,QAAO,2CAAC,mBAAK,EAAE,QAAQ,GAAO;AAGhC,QACE,2CAAC;EAAK,IAAI,MAAM,MAAM,KAAK;EAAY,mBAAgB;YACrD,2CAAC,uBACC,2CAAC;GAAE,MAAM,QAAQ,MAAM,KAAK;GAAY,QAAO;aAAS,IAAI,MAAM,KAAK,SAAS;IAAO,GAC7E;GACP"}
1
+ {"version":3,"file":"FootnoteEmbed.js","names":[],"sources":["../../src/Embed/FootnoteEmbed.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 { useTranslation } from \"react-i18next\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { FootnoteMetaData } from \"@ndla/types-embed\";\n\ninterface Props {\n embed: FootnoteMetaData;\n}\n\nconst StyledSup = styled(\"sup\", {\n base: {\n \"& a\": {\n textStyle: \"label.xsmall\",\n marginInlineStart: \"1\",\n },\n },\n});\n\nexport const FootnoteEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return <div>{t(\"error\")}</div>;\n }\n\n return (\n <span id={`ref${embed.data.entryNum}`} data-embed-type=\"footnote\">\n <StyledSup>\n <a href={`#note${embed.data.entryNum}`} target=\"_self\">{`[${embed.data.entryNum}]`}</a>\n </StyledSup>\n </span>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,iDAAmB,OAAO,EAC9B,MAAM,EACJ,OAAO;CACL,WAAW;CACX,mBAAmB;CACpB,EACF,EACF,CAAC;AAEF,MAAa,iBAAiB,EAAE,YAAmB;CACjD,MAAM,EAAE,yCAAsB;AAC9B,KAAI,MAAM,WAAW,QACnB,QAAO,2CAAC,mBAAK,EAAE,QAAQ,GAAO;AAGhC,QACE,2CAAC;EAAK,IAAI,MAAM,MAAM,KAAK;EAAY,mBAAgB;YACrD,2CAAC,uBACC,2CAAC;GAAE,MAAM,QAAQ,MAAM,KAAK;GAAY,QAAO;aAAS,IAAI,MAAM,KAAK,SAAS;IAAO,GAC7E;GACP"}
@@ -3,17 +3,19 @@ const require_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
3
3
  const require_ConceptInlineTriggerButton = require('./ConceptInlineTriggerButton.js');
4
4
  const require_Gloss = require('../Gloss/Gloss.js');
5
5
  let react = require("react");
6
- react = require_rolldown_runtime.__toESM(react);
7
6
  let __ndla_primitives = require("@ndla/primitives");
8
- __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
9
7
  let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
10
- __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
11
8
  let react_jsx_runtime = require("react/jsx-runtime");
12
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
13
9
  let __ark_ui_react = require("@ark-ui/react");
14
- __ark_ui_react = require_rolldown_runtime.__toESM(__ark_ui_react);
15
10
 
16
11
  //#region src/Embed/GlossEmbed.tsx
12
+ /**
13
+ * Copyright (c) 2024-present, NDLA.
14
+ *
15
+ * This source code is licensed under the GPLv3 license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ *
18
+ */
17
19
  const StyledPopoverContent = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.PopoverContent, { base: { width: "surface.xlarge" } });
18
20
  const GlossEmbed = ({ embed, children }) => {
19
21
  const contentRef = (0, react.useRef)(null);
@@ -1 +1 @@
1
- {"version":3,"file":"GlossEmbed.js","names":["PopoverContent","EmbedErrorPlaceholder","PopoverRoot","PopoverTrigger","ConceptInlineTriggerButton","Portal","Figure","Gloss"],"sources":["../../src/Embed/GlossEmbed.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 { useRef, type ReactNode } from \"react\";\nimport { Portal } from \"@ark-ui/react\";\nimport { Figure, PopoverContent, PopoverRoot, PopoverTrigger } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { ConceptMetaData } from \"@ndla/types-embed\";\nimport { ConceptInlineTriggerButton } from \"./ConceptInlineTriggerButton\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport { Gloss } from \"../Gloss/Gloss\";\n\ninterface Props {\n embed: ConceptMetaData;\n children?: ReactNode;\n}\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n width: \"surface.xlarge\",\n },\n});\n\nexport const GlossEmbed = ({ embed, children }: Props) => {\n const contentRef = useRef<HTMLDivElement>(null);\n if (embed.status === \"error\" && embed.embedData.type === \"inline\") {\n return <span>{children}</span>;\n }\n if (embed.status === \"error\" || !embed.data.concept.glossData) {\n return <EmbedErrorPlaceholder type=\"gloss\" />;\n }\n\n const { concept, visualElement } = embed.data;\n\n const audio =\n visualElement?.status === \"success\" && visualElement.resource === \"audio\"\n ? {\n src: visualElement.data.audioFile.url,\n title: visualElement.data.title.title,\n }\n : undefined;\n\n if (embed.embedData.type === \"inline\") {\n return (\n <PopoverRoot initialFocusEl={() => contentRef.current}>\n <PopoverTrigger asChild>\n <ConceptInlineTriggerButton>{children}</ConceptInlineTriggerButton>\n </PopoverTrigger>\n <Portal>\n <StyledPopoverContent ref={contentRef}>\n <Figure>\n <Gloss\n glossData={concept.glossData}\n title={concept.title}\n audio={audio}\n exampleIds={embed.embedData.exampleIds}\n exampleLangs={embed.embedData.exampleLangs}\n />\n </Figure>\n </StyledPopoverContent>\n </Portal>\n </PopoverRoot>\n );\n }\n\n return (\n <Figure data-embed-type=\"gloss\">\n <Gloss\n glossData={concept.glossData}\n title={concept.title}\n audio={audio}\n exampleIds={embed.embedData.exampleIds}\n exampleLangs={embed.embedData.exampleLangs}\n variant=\"bordered\"\n />\n </Figure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,MAAM,4DAA8BA,kCAAgB,EAClD,MAAM,EACJ,OAAO,kBACR,EACF,CAAC;AAEF,MAAa,cAAc,EAAE,OAAO,eAAsB;CACxD,MAAM,+BAAoC,KAAK;AAC/C,KAAI,MAAM,WAAW,WAAW,MAAM,UAAU,SAAS,SACvD,QAAO,2CAAC,UAAM,WAAgB;AAEhC,KAAI,MAAM,WAAW,WAAW,CAAC,MAAM,KAAK,QAAQ,UAClD,QAAO,2CAACC,uDAAsB,MAAK,UAAU;CAG/C,MAAM,EAAE,SAAS,kBAAkB,MAAM;CAEzC,MAAM,QACJ,eAAe,WAAW,aAAa,cAAc,aAAa,UAC9D;EACE,KAAK,cAAc,KAAK,UAAU;EAClC,OAAO,cAAc,KAAK,MAAM;EACjC,GACD;AAEN,KAAI,MAAM,UAAU,SAAS,SAC3B,QACE,4CAACC;EAAY,sBAAsB,WAAW;aAC5C,2CAACC;GAAe;aACd,2CAACC,iEAA4B,WAAsC;IACpD,EACjB,2CAACC,mCACC,2CAAC;GAAqB,KAAK;aACzB,2CAACC,sCACC,2CAACC;IACC,WAAW,QAAQ;IACnB,OAAO,QAAQ;IACR;IACP,YAAY,MAAM,UAAU;IAC5B,cAAc,MAAM,UAAU;KAC9B,GACK;IACY,GAChB;GACG;AAIlB,QACE,2CAACD;EAAO,mBAAgB;YACtB,2CAACC;GACC,WAAW,QAAQ;GACnB,OAAO,QAAQ;GACR;GACP,YAAY,MAAM,UAAU;GAC5B,cAAc,MAAM,UAAU;GAC9B,SAAQ;IACR;GACK"}
1
+ {"version":3,"file":"GlossEmbed.js","names":["PopoverContent","EmbedErrorPlaceholder","PopoverRoot","PopoverTrigger","ConceptInlineTriggerButton","Portal","Figure","Gloss"],"sources":["../../src/Embed/GlossEmbed.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 { useRef, type ReactNode } from \"react\";\nimport { Portal } from \"@ark-ui/react\";\nimport { Figure, PopoverContent, PopoverRoot, PopoverTrigger } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { ConceptMetaData } from \"@ndla/types-embed\";\nimport { ConceptInlineTriggerButton } from \"./ConceptInlineTriggerButton\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport { Gloss } from \"../Gloss/Gloss\";\n\ninterface Props {\n embed: ConceptMetaData;\n children?: ReactNode;\n}\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n width: \"surface.xlarge\",\n },\n});\n\nexport const GlossEmbed = ({ embed, children }: Props) => {\n const contentRef = useRef<HTMLDivElement>(null);\n if (embed.status === \"error\" && embed.embedData.type === \"inline\") {\n return <span>{children}</span>;\n }\n if (embed.status === \"error\" || !embed.data.concept.glossData) {\n return <EmbedErrorPlaceholder type=\"gloss\" />;\n }\n\n const { concept, visualElement } = embed.data;\n\n const audio =\n visualElement?.status === \"success\" && visualElement.resource === \"audio\"\n ? {\n src: visualElement.data.audioFile.url,\n title: visualElement.data.title.title,\n }\n : undefined;\n\n if (embed.embedData.type === \"inline\") {\n return (\n <PopoverRoot initialFocusEl={() => contentRef.current}>\n <PopoverTrigger asChild>\n <ConceptInlineTriggerButton>{children}</ConceptInlineTriggerButton>\n </PopoverTrigger>\n <Portal>\n <StyledPopoverContent ref={contentRef}>\n <Figure>\n <Gloss\n glossData={concept.glossData}\n title={concept.title}\n audio={audio}\n exampleIds={embed.embedData.exampleIds}\n exampleLangs={embed.embedData.exampleLangs}\n />\n </Figure>\n </StyledPopoverContent>\n </Portal>\n </PopoverRoot>\n );\n }\n\n return (\n <Figure data-embed-type=\"gloss\">\n <Gloss\n glossData={concept.glossData}\n title={concept.title}\n audio={audio}\n exampleIds={embed.embedData.exampleIds}\n exampleLangs={embed.embedData.exampleLangs}\n variant=\"bordered\"\n />\n </Figure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,MAAM,4DAA8BA,kCAAgB,EAClD,MAAM,EACJ,OAAO,kBACR,EACF,CAAC;AAEF,MAAa,cAAc,EAAE,OAAO,eAAsB;CACxD,MAAM,+BAAoC,KAAK;AAC/C,KAAI,MAAM,WAAW,WAAW,MAAM,UAAU,SAAS,SACvD,QAAO,2CAAC,UAAM,WAAgB;AAEhC,KAAI,MAAM,WAAW,WAAW,CAAC,MAAM,KAAK,QAAQ,UAClD,QAAO,2CAACC,uDAAsB,MAAK,UAAU;CAG/C,MAAM,EAAE,SAAS,kBAAkB,MAAM;CAEzC,MAAM,QACJ,eAAe,WAAW,aAAa,cAAc,aAAa,UAC9D;EACE,KAAK,cAAc,KAAK,UAAU;EAClC,OAAO,cAAc,KAAK,MAAM;EACjC,GACD;AAEN,KAAI,MAAM,UAAU,SAAS,SAC3B,QACE,4CAACC;EAAY,sBAAsB,WAAW;aAC5C,2CAACC;GAAe;aACd,2CAACC,iEAA4B,WAAsC;IACpD,EACjB,2CAACC,mCACC,2CAAC;GAAqB,KAAK;aACzB,2CAACC,sCACC,2CAACC;IACC,WAAW,QAAQ;IACnB,OAAO,QAAQ;IACR;IACP,YAAY,MAAM,UAAU;IAC5B,cAAc,MAAM,UAAU;KAC9B,GACK;IACY,GAChB;GACG;AAIlB,QACE,2CAACD;EAAO,mBAAgB;YACtB,2CAACC;GACC,WAAW,QAAQ;GACnB,OAAO,QAAQ;GACR;GACP,YAAY,MAAM,UAAU;GAC5B,cAAc,MAAM,UAAU;GAC9B,SAAQ;IACR;GACK"}
@@ -1,15 +1,18 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
2
  const require_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
3
3
  let __ndla_primitives = require("@ndla/primitives");
4
- __ndla_primitives = require_rolldown_runtime.__toESM(__ndla_primitives);
5
4
  let __ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
6
- __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(__ndla_styled_system_jsx);
7
5
  let react_i18next = require("react-i18next");
8
- react_i18next = require_rolldown_runtime.__toESM(react_i18next);
9
6
  let react_jsx_runtime = require("react/jsx-runtime");
10
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
11
7
 
12
8
  //#region src/Embed/H5pEmbed.tsx
9
+ /**
10
+ * Copyright (c) 2023-present, NDLA.
11
+ *
12
+ * This source code is licensed under the GPLv3 license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ *
15
+ */
13
16
  const StyledFigure = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Figure, { base: { "& iframe": {
14
17
  height: "auto",
15
18
  width: "100%"
@@ -1 +1 @@
1
- {"version":3,"file":"H5pEmbed.js","names":["Figure","EmbedErrorPlaceholder"],"sources":["../../src/Embed/H5pEmbed.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 { useTranslation } from \"react-i18next\";\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { H5pMetaData } from \"@ndla/types-embed\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\n\ninterface Props {\n embed: H5pMetaData;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& iframe\": {\n height: \"auto\",\n width: \"100%\",\n },\n },\n});\n\nconst FigureOembed = styled(Figure, {\n base: {\n width: \"100%\",\n \"& iframe\": {\n width: \"100%\",\n },\n },\n});\n\nexport const H5pEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type=\"h5p\" />;\n }\n\n if (embed.data.oembed) {\n return <FigureOembed data-embed-type=\"h5p\" dangerouslySetInnerHTML={{ __html: embed.data.oembed.html ?? \"\" }} />;\n }\n\n const title = embed.embedData.title?.trim()\n ? embed.embedData.title\n : embed.data.h5pLicenseInformation?.h5p.title?.trim()\n ? embed.data.h5pLicenseInformation.h5p.title\n : embed.embedData.url;\n\n const titleWithPrefix = `${t(\"embed.type.h5p\")}: ${title}`;\n\n return (\n <StyledFigure data-embed-type=\"h5p\">\n <iframe title={titleWithPrefix} aria-label={titleWithPrefix} src={embed.embedData.url} />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM,EACJ,YAAY;CACV,QAAQ;CACR,OAAO;CACR,EACF,EACF,CAAC;AAEF,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM;CACJ,OAAO;CACP,YAAY,EACV,OAAO,QACR;CACF,EACF,CAAC;AAEF,MAAa,YAAY,EAAE,YAAmB;CAC5C,MAAM,EAAE,yCAAsB;AAC9B,KAAI,MAAM,WAAW,QACnB,QAAO,2CAACC,uDAAsB,MAAK,QAAQ;AAG7C,KAAI,MAAM,KAAK,OACb,QAAO,2CAAC;EAAa,mBAAgB;EAAM,yBAAyB,EAAE,QAAQ,MAAM,KAAK,OAAO,QAAQ,IAAI;GAAI;CAGlH,MAAM,QAAQ,MAAM,UAAU,OAAO,MAAM,GACvC,MAAM,UAAU,QAChB,MAAM,KAAK,uBAAuB,IAAI,OAAO,MAAM,GACjD,MAAM,KAAK,sBAAsB,IAAI,QACrC,MAAM,UAAU;CAEtB,MAAM,kBAAkB,GAAG,EAAE,iBAAiB,CAAC,IAAI;AAEnD,QACE,2CAAC;EAAa,mBAAgB;YAC5B,2CAAC;GAAO,OAAO;GAAiB,cAAY;GAAiB,KAAK,MAAM,UAAU;IAAO;GAC5E"}
1
+ {"version":3,"file":"H5pEmbed.js","names":["Figure","EmbedErrorPlaceholder"],"sources":["../../src/Embed/H5pEmbed.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 { useTranslation } from \"react-i18next\";\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { H5pMetaData } from \"@ndla/types-embed\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\n\ninterface Props {\n embed: H5pMetaData;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& iframe\": {\n height: \"auto\",\n width: \"100%\",\n },\n },\n});\n\nconst FigureOembed = styled(Figure, {\n base: {\n width: \"100%\",\n \"& iframe\": {\n width: \"100%\",\n },\n },\n});\n\nexport const H5pEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type=\"h5p\" />;\n }\n\n if (embed.data.oembed) {\n return <FigureOembed data-embed-type=\"h5p\" dangerouslySetInnerHTML={{ __html: embed.data.oembed.html ?? \"\" }} />;\n }\n\n const title = embed.embedData.title?.trim()\n ? embed.embedData.title\n : embed.data.h5pLicenseInformation?.h5p.title?.trim()\n ? embed.data.h5pLicenseInformation.h5p.title\n : embed.embedData.url;\n\n const titleWithPrefix = `${t(\"embed.type.h5p\")}: ${title}`;\n\n return (\n <StyledFigure data-embed-type=\"h5p\">\n <iframe title={titleWithPrefix} aria-label={titleWithPrefix} src={embed.embedData.url} />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM,EACJ,YAAY;CACV,QAAQ;CACR,OAAO;CACR,EACF,EACF,CAAC;AAEF,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM;CACJ,OAAO;CACP,YAAY,EACV,OAAO,QACR;CACF,EACF,CAAC;AAEF,MAAa,YAAY,EAAE,YAAmB;CAC5C,MAAM,EAAE,yCAAsB;AAC9B,KAAI,MAAM,WAAW,QACnB,QAAO,2CAACC,uDAAsB,MAAK,QAAQ;AAG7C,KAAI,MAAM,KAAK,OACb,QAAO,2CAAC;EAAa,mBAAgB;EAAM,yBAAyB,EAAE,QAAQ,MAAM,KAAK,OAAO,QAAQ,IAAI;GAAI;CAGlH,MAAM,QAAQ,MAAM,UAAU,OAAO,MAAM,GACvC,MAAM,UAAU,QAChB,MAAM,KAAK,uBAAuB,IAAI,OAAO,MAAM,GACjD,MAAM,KAAK,sBAAsB,IAAI,QACrC,MAAM,UAAU;CAEtB,MAAM,kBAAkB,GAAG,EAAE,iBAAiB,CAAC,IAAI;AAEnD,QACE,2CAAC;EAAa,mBAAgB;YAC5B,2CAAC;GAAO,OAAO;GAAiB,cAAY;GAAiB,KAAK,MAAM,UAAU;IAAO;GAC5E"}