@ndla/ui 56.0.181-alpha.0 → 56.0.182-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 (246) hide show
  1. package/es/AnchorHeading/AnchorHeading.mjs +1 -2
  2. package/es/AnchorHeading/AnchorHeading.mjs.map +1 -1
  3. package/es/Article/Article.mjs +1 -2
  4. package/es/Article/Article.mjs.map +1 -1
  5. package/es/Article/ArticleByline.mjs +1 -2
  6. package/es/Article/ArticleByline.mjs.map +1 -1
  7. package/es/Article/ArticleFootNotes.mjs +1 -2
  8. package/es/Article/ArticleFootNotes.mjs.map +1 -1
  9. package/es/Article/BadgesContainer.mjs +1 -2
  10. package/es/Article/BadgesContainer.mjs.map +1 -1
  11. package/es/AudioPlayer/AudioPlayer.mjs +1 -2
  12. package/es/AudioPlayer/AudioPlayer.mjs.map +1 -1
  13. package/es/AudioPlayer/Controls.mjs +1 -2
  14. package/es/AudioPlayer/Controls.mjs.map +1 -1
  15. package/es/AudioPlayer/SpeechControl.mjs +1 -2
  16. package/es/AudioPlayer/SpeechControl.mjs.map +1 -1
  17. package/es/Breadcrumb/Breadcrumb.mjs +1 -2
  18. package/es/Breadcrumb/Breadcrumb.mjs.map +1 -1
  19. package/es/Breadcrumb/BreadcrumbItem.mjs +1 -2
  20. package/es/Breadcrumb/BreadcrumbItem.mjs.map +1 -1
  21. package/es/Breadcrumb/HomeBreadcrumb.mjs +1 -2
  22. package/es/Breadcrumb/HomeBreadcrumb.mjs.map +1 -1
  23. package/es/CampaignBlock/CampaignBlock.mjs +1 -2
  24. package/es/CampaignBlock/CampaignBlock.mjs.map +1 -1
  25. package/es/CodeBlock/CodeBlock.mjs +1 -2
  26. package/es/CodeBlock/CodeBlock.mjs.map +1 -1
  27. package/es/CodeBlock/codeLanguageOptions.mjs +1 -1
  28. package/es/Concept/Concept.mjs +1 -2
  29. package/es/Concept/Concept.mjs.map +1 -1
  30. package/es/ContactBlock/ContactBlock.mjs +1 -2
  31. package/es/ContactBlock/ContactBlock.mjs.map +1 -1
  32. package/es/Embed/AudioEmbed.mjs +1 -2
  33. package/es/Embed/AudioEmbed.mjs.map +1 -1
  34. package/es/Embed/BrightcoveEmbed.mjs +1 -2
  35. package/es/Embed/BrightcoveEmbed.mjs.map +1 -1
  36. package/es/Embed/CodeEmbed.mjs +1 -2
  37. package/es/Embed/CodeEmbed.mjs.map +1 -1
  38. package/es/Embed/ConceptEmbed.mjs +1 -2
  39. package/es/Embed/ConceptEmbed.mjs.map +1 -1
  40. package/es/Embed/ConceptInlineTriggerButton.mjs +1 -2
  41. package/es/Embed/ConceptInlineTriggerButton.mjs.map +1 -1
  42. package/es/Embed/ContentLinkEmbed.mjs +1 -2
  43. package/es/Embed/ContentLinkEmbed.mjs.map +1 -1
  44. package/es/Embed/CopyrightEmbed.mjs +1 -2
  45. package/es/Embed/CopyrightEmbed.mjs.map +1 -1
  46. package/es/Embed/EmbedErrorPlaceholder.mjs +1 -2
  47. package/es/Embed/EmbedErrorPlaceholder.mjs.map +1 -1
  48. package/es/Embed/EmbedWrapper.mjs +1 -2
  49. package/es/Embed/EmbedWrapper.mjs.map +1 -1
  50. package/es/Embed/ExternalEmbed.mjs +1 -2
  51. package/es/Embed/ExternalEmbed.mjs.map +1 -1
  52. package/es/Embed/FootnoteEmbed.mjs +1 -2
  53. package/es/Embed/FootnoteEmbed.mjs.map +1 -1
  54. package/es/Embed/GlossEmbed.mjs +1 -2
  55. package/es/Embed/GlossEmbed.mjs.map +1 -1
  56. package/es/Embed/H5pEmbed.mjs +1 -2
  57. package/es/Embed/H5pEmbed.mjs.map +1 -1
  58. package/es/Embed/IframeEmbed.mjs +1 -2
  59. package/es/Embed/IframeEmbed.mjs.map +1 -1
  60. package/es/Embed/ImageEmbed.mjs +1 -2
  61. package/es/Embed/ImageEmbed.mjs.map +1 -1
  62. package/es/Embed/InlineTriggerButton.mjs +1 -2
  63. package/es/Embed/InlineTriggerButton.mjs.map +1 -1
  64. package/es/Embed/RelatedContentEmbed.mjs +1 -2
  65. package/es/Embed/RelatedContentEmbed.mjs.map +1 -1
  66. package/es/Embed/UnknownEmbed.mjs +1 -2
  67. package/es/Embed/UnknownEmbed.mjs.map +1 -1
  68. package/es/Embed/UuDisclaimerEmbed.mjs +1 -2
  69. package/es/Embed/UuDisclaimerEmbed.mjs.map +1 -1
  70. package/es/FactBox/FactBox.mjs +1 -2
  71. package/es/FactBox/FactBox.mjs.map +1 -1
  72. package/es/FileList/File.mjs +1 -2
  73. package/es/FileList/File.mjs.map +1 -1
  74. package/es/FileList/FileList.mjs +1 -2
  75. package/es/FileList/FileList.mjs.map +1 -1
  76. package/es/FileList/PdfFile.mjs +1 -2
  77. package/es/FileList/PdfFile.mjs.map +1 -1
  78. package/es/Gloss/Gloss.mjs +1 -2
  79. package/es/Gloss/Gloss.mjs.map +1 -1
  80. package/es/Gloss/GlossExample.mjs +1 -2
  81. package/es/Gloss/GlossExample.mjs.map +1 -1
  82. package/es/Grid/Grid.mjs +1 -2
  83. package/es/Grid/Grid.mjs.map +1 -1
  84. package/es/KeyFigure/KeyFigure.mjs +1 -2
  85. package/es/KeyFigure/KeyFigure.mjs.map +1 -1
  86. package/es/LicenseByline/EmbedByline.mjs +1 -2
  87. package/es/LicenseByline/EmbedByline.mjs.map +1 -1
  88. package/es/LicenseByline/LicenseLink.mjs +1 -2
  89. package/es/LicenseByline/LicenseLink.mjs.map +1 -1
  90. package/es/LinkBlock/LinkBlock.mjs +1 -2
  91. package/es/LinkBlock/LinkBlock.mjs.map +1 -1
  92. package/es/LinkBlock/LinkBlockSection.mjs +1 -2
  93. package/es/LinkBlock/LinkBlockSection.mjs.map +1 -1
  94. package/es/Pitch/Pitch.mjs +1 -2
  95. package/es/Pitch/Pitch.mjs.map +1 -1
  96. package/es/RelatedArticleList/RelatedArticleList.mjs +1 -2
  97. package/es/RelatedArticleList/RelatedArticleList.mjs.map +1 -1
  98. package/es/ResourceBox/ResourceBox.mjs +1 -2
  99. package/es/ResourceBox/ResourceBox.mjs.map +1 -1
  100. package/es/TagSelector/TagSelector.mjs +1 -2
  101. package/es/TagSelector/TagSelector.mjs.map +1 -1
  102. package/es/ZendeskButton/ZendeskButton.mjs +1 -2
  103. package/es/ZendeskButton/ZendeskButton.mjs.map +1 -1
  104. package/es/_virtual/_rolldown/runtime.mjs +6 -11
  105. package/es/i18n/useComponentTranslations.mjs +1 -2
  106. package/es/i18n/useComponentTranslations.mjs.map +1 -1
  107. package/es/index.mjs +1 -2
  108. package/es/model/ContentType.mjs +1 -1
  109. package/es/model/SubjectCategories.mjs +1 -2
  110. package/es/model/SubjectCategories.mjs.map +1 -1
  111. package/es/model/SubjectTypes.mjs +1 -2
  112. package/es/model/SubjectTypes.mjs.map +1 -1
  113. package/es/model/WordClass.mjs +1 -2
  114. package/es/model/WordClass.mjs.map +1 -1
  115. package/es/model/index.mjs +1 -2
  116. package/es/model/index.mjs.map +1 -1
  117. package/es/utils/licenseAttributes.mjs +1 -2
  118. package/es/utils/licenseAttributes.mjs.map +1 -1
  119. package/es/utils/relativeUrl.mjs +1 -1
  120. package/lib/AnchorHeading/AnchorHeading.js +2 -3
  121. package/lib/AnchorHeading/AnchorHeading.js.map +1 -1
  122. package/lib/Article/Article.js +3 -4
  123. package/lib/Article/Article.js.map +1 -1
  124. package/lib/Article/ArticleByline.js +3 -4
  125. package/lib/Article/ArticleByline.js.map +1 -1
  126. package/lib/Article/ArticleFootNotes.js +2 -3
  127. package/lib/Article/ArticleFootNotes.js.map +1 -1
  128. package/lib/Article/BadgesContainer.js +3 -5
  129. package/lib/Article/BadgesContainer.js.map +1 -1
  130. package/lib/AudioPlayer/AudioPlayer.js +4 -5
  131. package/lib/AudioPlayer/AudioPlayer.js.map +1 -1
  132. package/lib/AudioPlayer/Controls.js +2 -3
  133. package/lib/AudioPlayer/Controls.js.map +1 -1
  134. package/lib/AudioPlayer/SpeechControl.js +2 -3
  135. package/lib/AudioPlayer/SpeechControl.js.map +1 -1
  136. package/lib/Breadcrumb/Breadcrumb.js +4 -5
  137. package/lib/Breadcrumb/Breadcrumb.js.map +1 -1
  138. package/lib/Breadcrumb/BreadcrumbItem.js +3 -4
  139. package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -1
  140. package/lib/Breadcrumb/HomeBreadcrumb.js +3 -4
  141. package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -1
  142. package/lib/CampaignBlock/CampaignBlock.js +4 -5
  143. package/lib/CampaignBlock/CampaignBlock.js.map +1 -1
  144. package/lib/CodeBlock/CodeBlock.js +2 -3
  145. package/lib/CodeBlock/CodeBlock.js.map +1 -1
  146. package/lib/CodeBlock/codeLanguageOptions.js +1 -2
  147. package/lib/CodeBlock/codeLanguageOptions.js.map +1 -1
  148. package/lib/Concept/Concept.js +9 -10
  149. package/lib/Concept/Concept.js.map +1 -1
  150. package/lib/ContactBlock/ContactBlock.js +3 -4
  151. package/lib/ContactBlock/ContactBlock.js.map +1 -1
  152. package/lib/Embed/AudioEmbed.js +6 -7
  153. package/lib/Embed/AudioEmbed.js.map +1 -1
  154. package/lib/Embed/BrightcoveEmbed.js +5 -6
  155. package/lib/Embed/BrightcoveEmbed.js.map +1 -1
  156. package/lib/Embed/CodeEmbed.js +5 -6
  157. package/lib/Embed/CodeEmbed.js.map +1 -1
  158. package/lib/Embed/ConceptEmbed.js +6 -7
  159. package/lib/Embed/ConceptEmbed.js.map +1 -1
  160. package/lib/Embed/ConceptInlineTriggerButton.js +4 -6
  161. package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -1
  162. package/lib/Embed/ContentLinkEmbed.js +2 -3
  163. package/lib/Embed/ContentLinkEmbed.js.map +1 -1
  164. package/lib/Embed/CopyrightEmbed.js +3 -4
  165. package/lib/Embed/CopyrightEmbed.js.map +1 -1
  166. package/lib/Embed/EmbedErrorPlaceholder.js +4 -5
  167. package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -1
  168. package/lib/Embed/EmbedWrapper.js +2 -3
  169. package/lib/Embed/EmbedWrapper.js.map +1 -1
  170. package/lib/Embed/ExternalEmbed.js +4 -5
  171. package/lib/Embed/ExternalEmbed.js.map +1 -1
  172. package/lib/Embed/FootnoteEmbed.js +2 -3
  173. package/lib/Embed/FootnoteEmbed.js.map +1 -1
  174. package/lib/Embed/GlossEmbed.js +5 -6
  175. package/lib/Embed/GlossEmbed.js.map +1 -1
  176. package/lib/Embed/H5pEmbed.js +3 -4
  177. package/lib/Embed/H5pEmbed.js.map +1 -1
  178. package/lib/Embed/IframeEmbed.js +4 -5
  179. package/lib/Embed/IframeEmbed.js.map +1 -1
  180. package/lib/Embed/ImageEmbed.js +5 -6
  181. package/lib/Embed/ImageEmbed.js.map +1 -1
  182. package/lib/Embed/InlineTriggerButton.js +2 -3
  183. package/lib/Embed/InlineTriggerButton.js.map +1 -1
  184. package/lib/Embed/RelatedContentEmbed.js +3 -4
  185. package/lib/Embed/RelatedContentEmbed.js.map +1 -1
  186. package/lib/Embed/UnknownEmbed.js +2 -3
  187. package/lib/Embed/UnknownEmbed.js.map +1 -1
  188. package/lib/Embed/UuDisclaimerEmbed.js +3 -4
  189. package/lib/Embed/UuDisclaimerEmbed.js.map +1 -1
  190. package/lib/FactBox/FactBox.js +2 -3
  191. package/lib/FactBox/FactBox.js.map +1 -1
  192. package/lib/FileList/File.js +3 -4
  193. package/lib/FileList/File.js.map +1 -1
  194. package/lib/FileList/FileList.js +3 -4
  195. package/lib/FileList/FileList.js.map +1 -1
  196. package/lib/FileList/PdfFile.js +2 -3
  197. package/lib/FileList/PdfFile.js.map +1 -1
  198. package/lib/Gloss/Gloss.js +4 -5
  199. package/lib/Gloss/Gloss.js.map +1 -1
  200. package/lib/Gloss/GlossExample.js +2 -3
  201. package/lib/Gloss/GlossExample.js.map +1 -1
  202. package/lib/Grid/Grid.js +3 -4
  203. package/lib/Grid/Grid.js.map +1 -1
  204. package/lib/KeyFigure/KeyFigure.js +2 -3
  205. package/lib/KeyFigure/KeyFigure.js.map +1 -1
  206. package/lib/LicenseByline/EmbedByline.js +3 -4
  207. package/lib/LicenseByline/EmbedByline.js.map +1 -1
  208. package/lib/LicenseByline/LicenseLink.js +2 -3
  209. package/lib/LicenseByline/LicenseLink.js.map +1 -1
  210. package/lib/LinkBlock/LinkBlock.js +3 -4
  211. package/lib/LinkBlock/LinkBlock.js.map +1 -1
  212. package/lib/LinkBlock/LinkBlockSection.js +2 -3
  213. package/lib/LinkBlock/LinkBlockSection.js.map +1 -1
  214. package/lib/Pitch/Pitch.js +3 -4
  215. package/lib/Pitch/Pitch.js.map +1 -1
  216. package/lib/RelatedArticleList/RelatedArticleList.js +2 -3
  217. package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -1
  218. package/lib/ResourceBox/ResourceBox.js +2 -3
  219. package/lib/ResourceBox/ResourceBox.js.map +1 -1
  220. package/lib/TagSelector/TagSelector.js +2 -3
  221. package/lib/TagSelector/TagSelector.js.map +1 -1
  222. package/lib/ZendeskButton/ZendeskButton.js +2 -3
  223. package/lib/ZendeskButton/ZendeskButton.js.map +1 -1
  224. package/lib/_virtual/_rolldown/runtime.js +12 -22
  225. package/lib/i18n/useComponentTranslations.js +2 -3
  226. package/lib/i18n/useComponentTranslations.js.map +1 -1
  227. package/lib/index.js +78 -79
  228. package/lib/model/ContentType.js +1 -2
  229. package/lib/model/ContentType.js.map +1 -1
  230. package/lib/model/SubjectCategories.js +7 -9
  231. package/lib/model/SubjectCategories.js.map +1 -1
  232. package/lib/model/SubjectTypes.js +7 -9
  233. package/lib/model/SubjectTypes.js.map +1 -1
  234. package/lib/model/WordClass.js +7 -9
  235. package/lib/model/WordClass.js.map +1 -1
  236. package/lib/model/index.js +5 -6
  237. package/lib/model/index.js.map +1 -1
  238. package/lib/utils/licenseAttributes.js +2 -3
  239. package/lib/utils/licenseAttributes.js.map +1 -1
  240. package/lib/utils/relativeUrl.js +1 -2
  241. package/lib/utils/relativeUrl.js.map +1 -1
  242. package/package.json +5 -5
  243. package/src/AudioPlayer/Controls.tsx +1 -1
  244. package/src/AudioPlayer/SpeechControl.tsx +1 -1
  245. package/src/Embed/InlineTriggerButton.tsx +1 -0
  246. package/src/Grid/Grid.stories.tsx +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"BreadcrumbItem.js","names":[],"sources":["../../src/Breadcrumb/BreadcrumbItem.tsx"],"sourcesContent":["/**\n * Copyright (c) 2016-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 { type ReactNode } from \"react\";\n\nexport interface SimpleBreadcrumbItem {\n to: string | Partial<Location>;\n name: ReactNode;\n}\n\nexport interface IndexedBreadcrumbItem extends SimpleBreadcrumbItem {\n index: number;\n}\n\nexport interface BreadcrumbRenderProps {\n item: IndexedBreadcrumbItem;\n totalCount: number;\n}\n\nconst StyledListItem = styled(\"li\", {\n base: {\n display: \"flex\",\n color: \"inherit\",\n gap: \"3xsmall\",\n alignItems: \"flex-end\",\n tabletDown: {\n display: \"block\",\n },\n \"& a\": {\n _visited: {\n color: \"inherit\",\n },\n },\n },\n});\n\ninterface Props {\n item: IndexedBreadcrumbItem;\n autoCollapse?: boolean;\n totalCount: number;\n renderItem: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n renderSeparator: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n}\n\nexport const BreadcrumbItem = ({ renderItem, renderSeparator, item, totalCount }: Props) => {\n const isLast = item.index === totalCount - 1;\n return (\n <StyledListItem aria-current={isLast ? \"page\" : undefined}>\n {renderItem(item, totalCount)}\n {renderSeparator(item, totalCount)}\n </StyledListItem>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAyBA,MAAM,qDAAwB,MAAM,EAClC,MAAM;CACJ,SAAS;CACT,OAAO;CACP,KAAK;CACL,YAAY;CACZ,YAAY,EACV,SAAS,SACV;CACD,OAAO,EACL,UAAU,EACR,OAAO,WACR,EACF;CACF,EACF,CAAC;AAUF,MAAa,kBAAkB,EAAE,YAAY,iBAAiB,MAAM,iBAAwB;CAC1F,MAAM,SAAS,KAAK,UAAU,aAAa;AAC3C,QACE,4CAAC;EAAe,gBAAc,SAAS,SAAS;aAC7C,WAAW,MAAM,WAAW,EAC5B,gBAAgB,MAAM,WAAW;GACnB"}
1
+ {"version":3,"file":"BreadcrumbItem.js","names":[],"sources":["../../src/Breadcrumb/BreadcrumbItem.tsx"],"sourcesContent":["/**\n * Copyright (c) 2016-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 { type ReactNode } from \"react\";\n\nexport interface SimpleBreadcrumbItem {\n to: string | Partial<Location>;\n name: ReactNode;\n}\n\nexport interface IndexedBreadcrumbItem extends SimpleBreadcrumbItem {\n index: number;\n}\n\nexport interface BreadcrumbRenderProps {\n item: IndexedBreadcrumbItem;\n totalCount: number;\n}\n\nconst StyledListItem = styled(\"li\", {\n base: {\n display: \"flex\",\n color: \"inherit\",\n gap: \"3xsmall\",\n alignItems: \"flex-end\",\n tabletDown: {\n display: \"block\",\n },\n \"& a\": {\n _visited: {\n color: \"inherit\",\n },\n },\n },\n});\n\ninterface Props {\n item: IndexedBreadcrumbItem;\n autoCollapse?: boolean;\n totalCount: number;\n renderItem: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n renderSeparator: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n}\n\nexport const BreadcrumbItem = ({ renderItem, renderSeparator, item, totalCount }: Props) => {\n const isLast = item.index === totalCount - 1;\n return (\n <StyledListItem aria-current={isLast ? \"page\" : undefined}>\n {renderItem(item, totalCount)}\n {renderSeparator(item, totalCount)}\n </StyledListItem>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAyBA,MAAM,kBAAA,GAAA,wBAAA,QAAwB,MAAM,EAClC,MAAM;CACJ,SAAS;CACT,OAAO;CACP,KAAK;CACL,YAAY;CACZ,YAAY,EACV,SAAS,SACV;CACD,OAAO,EACL,UAAU,EACR,OAAO,WACR,EACF;CACF,EACF,CAAC;AAUF,MAAa,kBAAkB,EAAE,YAAY,iBAAiB,MAAM,iBAAwB;CAC1F,MAAM,SAAS,KAAK,UAAU,aAAa;AAC3C,QACE,iBAAA,GAAA,kBAAA,MAAC,gBAAD;EAAgB,gBAAc,SAAS,SAAS,KAAA;YAAhD,CACG,WAAW,MAAM,WAAW,EAC5B,gBAAgB,MAAM,WAAW,CACnB"}
@@ -1,10 +1,9 @@
1
- const require_runtime = require('../_virtual/_rolldown/runtime.js');
2
- const require_Breadcrumb = require('./Breadcrumb.js');
1
+ require("../_virtual/_rolldown/runtime.js");
2
+ const require_Breadcrumb = require("./Breadcrumb.js");
3
3
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
4
4
  let _ndla_icons = require("@ndla/icons");
5
5
  let _ndla_safelink = require("@ndla/safelink");
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
-
8
7
  //#region src/Breadcrumb/HomeBreadcrumb.tsx
9
8
  /**
10
9
  * Copyright (c) 2022-present, NDLA.
@@ -45,7 +44,7 @@ const HomeBreadcrumb = ({ items }) => {
45
44
  renderSeparator
46
45
  });
47
46
  };
48
-
49
47
  //#endregion
50
48
  exports.HomeBreadcrumb = HomeBreadcrumb;
49
+
51
50
  //# sourceMappingURL=HomeBreadcrumb.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HomeBreadcrumb.js","names":["SafeLink","ArrowRightShortLine","HomeLine","Breadcrumb"],"sources":["../../src/Breadcrumb/HomeBreadcrumb.tsx"],"sourcesContent":["/**\n * Copyright (c) 2022-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 { ArrowRightShortLine, HomeLine } from \"@ndla/icons\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { Breadcrumb } from \"./Breadcrumb\";\nimport type { IndexedBreadcrumbItem, SimpleBreadcrumbItem } from \"./BreadcrumbItem\";\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n color: \"inherit\",\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n _focusVisible: {\n textDecoration: \"none\",\n },\n },\n});\n\nconst StyledArrowRight = styled(ArrowRightShortLine, {\n base: {\n tabletDown: {\n display: \"none\",\n },\n },\n});\n\nconst IconSafeLink = styled(SafeLink, {\n base: {\n color: \"inherit\",\n },\n});\n\ninterface Props {\n items: SimpleBreadcrumbItem[];\n}\n\nexport const HomeBreadcrumb = ({ items }: Props) => {\n const renderItem = (item: IndexedBreadcrumbItem, totalCount: number) => {\n if (item.index === totalCount - 1) {\n return <span>{item.name}</span>;\n }\n if (item.index === 0 && typeof item.name === \"string\") {\n return (\n <IconSafeLink aria-label={item.name} to={item.to}>\n <HomeLine title={item.name} />\n </IconSafeLink>\n );\n }\n return <StyledSafeLink to={item.to}>{item.name}</StyledSafeLink>;\n };\n\n const renderSeparator = (item: IndexedBreadcrumbItem, totalCount: number) => {\n if (item.index === totalCount - 1) {\n return null;\n }\n if (item.index === 0) {\n return <StyledArrowRight aria-hidden />;\n }\n return <ArrowRightShortLine aria-hidden />;\n };\n\n return <Breadcrumb items={items} renderItem={renderItem} renderSeparator={renderSeparator} />;\n};\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,qDAAwBA,yBAAU,EACtC,MAAM;CACJ,OAAO;CACP,gBAAgB;CAChB,QAAQ,EACN,gBAAgB,QACjB;CACD,eAAe,EACb,gBAAgB,QACjB;CACF,EACF,CAAC;AAEF,MAAM,uDAA0BC,iCAAqB,EACnD,MAAM,EACJ,YAAY,EACV,SAAS,QACV,EACF,EACF,CAAC;AAEF,MAAM,mDAAsBD,yBAAU,EACpC,MAAM,EACJ,OAAO,WACR,EACF,CAAC;AAMF,MAAa,kBAAkB,EAAE,YAAmB;CAClD,MAAM,cAAc,MAA6B,eAAuB;AACtE,MAAI,KAAK,UAAU,aAAa,EAC9B,QAAO,2CAAC,oBAAM,KAAK,OAAY;AAEjC,MAAI,KAAK,UAAU,KAAK,OAAO,KAAK,SAAS,SAC3C,QACE,2CAAC;GAAa,cAAY,KAAK;GAAM,IAAI,KAAK;aAC5C,2CAACE,wBAAS,OAAO,KAAK,OAAQ;IACjB;AAGnB,SAAO,2CAAC;GAAe,IAAI,KAAK;aAAK,KAAK;IAAsB;;CAGlE,MAAM,mBAAmB,MAA6B,eAAuB;AAC3E,MAAI,KAAK,UAAU,aAAa,EAC9B,QAAO;AAET,MAAI,KAAK,UAAU,EACjB,QAAO,2CAAC,oBAAiB,sBAAc;AAEzC,SAAO,2CAACD,mCAAoB,sBAAc;;AAG5C,QAAO,2CAACE;EAAkB;EAAmB;EAA6B;GAAmB"}
1
+ {"version":3,"file":"HomeBreadcrumb.js","names":["SafeLink","ArrowRightShortLine","HomeLine","Breadcrumb"],"sources":["../../src/Breadcrumb/HomeBreadcrumb.tsx"],"sourcesContent":["/**\n * Copyright (c) 2022-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 { ArrowRightShortLine, HomeLine } from \"@ndla/icons\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { Breadcrumb } from \"./Breadcrumb\";\nimport type { IndexedBreadcrumbItem, SimpleBreadcrumbItem } from \"./BreadcrumbItem\";\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n color: \"inherit\",\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n _focusVisible: {\n textDecoration: \"none\",\n },\n },\n});\n\nconst StyledArrowRight = styled(ArrowRightShortLine, {\n base: {\n tabletDown: {\n display: \"none\",\n },\n },\n});\n\nconst IconSafeLink = styled(SafeLink, {\n base: {\n color: \"inherit\",\n },\n});\n\ninterface Props {\n items: SimpleBreadcrumbItem[];\n}\n\nexport const HomeBreadcrumb = ({ items }: Props) => {\n const renderItem = (item: IndexedBreadcrumbItem, totalCount: number) => {\n if (item.index === totalCount - 1) {\n return <span>{item.name}</span>;\n }\n if (item.index === 0 && typeof item.name === \"string\") {\n return (\n <IconSafeLink aria-label={item.name} to={item.to}>\n <HomeLine title={item.name} />\n </IconSafeLink>\n );\n }\n return <StyledSafeLink to={item.to}>{item.name}</StyledSafeLink>;\n };\n\n const renderSeparator = (item: IndexedBreadcrumbItem, totalCount: number) => {\n if (item.index === totalCount - 1) {\n return null;\n }\n if (item.index === 0) {\n return <StyledArrowRight aria-hidden />;\n }\n return <ArrowRightShortLine aria-hidden />;\n };\n\n return <Breadcrumb items={items} renderItem={renderItem} renderSeparator={renderSeparator} />;\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,kBAAA,GAAA,wBAAA,QAAwBA,eAAAA,UAAU,EACtC,MAAM;CACJ,OAAO;CACP,gBAAgB;CAChB,QAAQ,EACN,gBAAgB,QACjB;CACD,eAAe,EACb,gBAAgB,QACjB;CACF,EACF,CAAC;AAEF,MAAM,oBAAA,GAAA,wBAAA,QAA0BC,YAAAA,qBAAqB,EACnD,MAAM,EACJ,YAAY,EACV,SAAS,QACV,EACF,EACF,CAAC;AAEF,MAAM,gBAAA,GAAA,wBAAA,QAAsBD,eAAAA,UAAU,EACpC,MAAM,EACJ,OAAO,WACR,EACF,CAAC;AAMF,MAAa,kBAAkB,EAAE,YAAmB;CAClD,MAAM,cAAc,MAA6B,eAAuB;AACtE,MAAI,KAAK,UAAU,aAAa,EAC9B,QAAO,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAA,UAAO,KAAK,MAAY,CAAA;AAEjC,MAAI,KAAK,UAAU,KAAK,OAAO,KAAK,SAAS,SAC3C,QACE,iBAAA,GAAA,kBAAA,KAAC,cAAD;GAAc,cAAY,KAAK;GAAM,IAAI,KAAK;aAC5C,iBAAA,GAAA,kBAAA,KAACE,YAAAA,UAAD,EAAU,OAAO,KAAK,MAAQ,CAAA;GACjB,CAAA;AAGnB,SAAO,iBAAA,GAAA,kBAAA,KAAC,gBAAD;GAAgB,IAAI,KAAK;aAAK,KAAK;GAAsB,CAAA;;CAGlE,MAAM,mBAAmB,MAA6B,eAAuB;AAC3E,MAAI,KAAK,UAAU,aAAa,EAC9B,QAAO;AAET,MAAI,KAAK,UAAU,EACjB,QAAO,iBAAA,GAAA,kBAAA,KAAC,kBAAD,EAAkB,eAAA,MAAc,CAAA;AAEzC,SAAO,iBAAA,GAAA,kBAAA,KAACD,YAAAA,qBAAD,EAAqB,eAAA,MAAc,CAAA;;AAG5C,QAAO,iBAAA,GAAA,kBAAA,KAACE,mBAAAA,YAAD;EAAmB;EAAmB;EAA6B;EAAmB,CAAA"}
@@ -1,14 +1,13 @@
1
- const require_runtime = require('../_virtual/_rolldown/runtime.js');
2
- const require_relativeUrl = require('../utils/relativeUrl.js');
1
+ const require_runtime = require("../_virtual/_rolldown/runtime.js");
2
+ const require_relativeUrl = require("../utils/relativeUrl.js");
3
3
  let _ndla_primitives = require("@ndla/primitives");
4
4
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
5
- let react = require("react");
5
+ require("react");
6
6
  let html_react_parser = require("html-react-parser");
7
7
  html_react_parser = require_runtime.__toESM(html_react_parser);
8
8
  let _ndla_icons = require("@ndla/icons");
9
9
  let _ndla_safelink = require("@ndla/safelink");
10
10
  let react_jsx_runtime = require("react/jsx-runtime");
11
-
12
11
  //#region src/CampaignBlock/CampaignBlock.tsx
13
12
  /**
14
13
  * Copyright (c) 2023-present, NDLA.
@@ -133,7 +132,7 @@ const CampaignBlock = ({ title, image, imageSide = "left", description, headingL
133
132
  ]
134
133
  }) });
135
134
  };
136
-
137
135
  //#endregion
138
136
  exports.CampaignBlock = CampaignBlock;
137
+
139
138
  //# sourceMappingURL=CampaignBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CampaignBlock.js","names":["Text","SafeLinkButton","getPossiblyRelativeUrl","ArrowRightLine"],"sources":["../../src/CampaignBlock/CampaignBlock.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 { ArrowRightLine } from \"@ndla/icons\";\nimport { Text } from \"@ndla/primitives\";\nimport { SafeLinkButton } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CampaignBlockEmbedData } from \"@ndla/types-embed\";\nimport parse from \"html-react-parser\";\nimport { type ReactNode } from \"react\";\nimport type { HeadingLevel } from \"../types\";\nimport { getPossiblyRelativeUrl } from \"../utils/relativeUrl\";\n\ninterface Image {\n src: string;\n alt: string;\n}\n\ninterface Props {\n title: string;\n description: string;\n headingLevel?: HeadingLevel;\n url: {\n url?: string;\n text?: string;\n };\n image?: Image;\n imageSide?: CampaignBlockEmbedData[\"imageSide\"];\n className?: string;\n path?: string;\n background?: CampaignBlockEmbedData[\"background\"];\n}\n\nconst Wrapper = styled(\"div\", {\n base: {\n width: \"100%\",\n height: \"100%\",\n containerType: \"inline-size\",\n },\n});\n\nconst Container = styled(\"div\", {\n base: {\n display: \"grid\",\n gridTemplateColumns: \"1fr\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n backgroundColor: \"background.default\",\n borderRadius: \"xsmall\",\n boxShadow: \"full\",\n overflow: \"hidden\",\n },\n variants: {\n imageSide: {\n left: {\n \"@/tablet\": {\n gridTemplateColumns: \"minmax(230px, 455px) auto\", //required for campaign block in myNdla\n },\n \"@supports not (container-type: inline-size)\": {\n tabletWide: {\n gridTemplateColumns: \"minmax(230px, 455px) auto\",\n },\n },\n },\n right: {\n \"@/tablet\": {\n gridTemplateColumns: \"auto minmax(230px, 455px)\", //required for campaign block in myNdla\n },\n \"@supports not (container-type: inline-size)\": {\n tabletWide: {\n gridTemplateColumns: \"auto minmax(230px, 455px)\",\n },\n },\n },\n },\n background: {\n neutral: {},\n brand1: {\n backgroundColor: \"surface.brand.1\",\n },\n brand3: {\n backgroundColor: \"surface.brand.3\",\n },\n },\n },\n defaultVariants: {\n imageSide: \"left\",\n background: \"neutral\",\n },\n});\n\nconst StyledImg = styled(\"img\", {\n base: {\n objectFit: \"cover\",\n width: \"100%\",\n height: \"215px\",\n \"@/tablet\": {\n height: \"340px\",\n },\n \"@supports not (container-type: inline-size)\": {\n tablet: {\n height: \"265px\",\n },\n tabletWide: {\n height: \"340px\",\n },\n },\n backgroundColor: \"background.default\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n alignItems: \"flex-start\",\n justifyContent: \"center\",\n paddingBlock: \"medium\",\n paddingInline: \"medium\",\n position: \"relative\",\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n tablet: {\n display: \"block\",\n overflow: \"hidden\",\n position: \"relative\",\n lineClamp: 4,\n boxOrient: \"vertical\",\n },\n },\n});\n\ninterface LinkButtonProps {\n url?: string;\n path?: string;\n children: ReactNode;\n}\n\nconst StyledSafeLinkButton = styled(SafeLinkButton, {\n base: {\n boxShadow: \"full\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n },\n});\n\nconst LinkButton = ({ url, children, path }: LinkButtonProps) => {\n if (url)\n return (\n <StyledSafeLinkButton to={getPossiblyRelativeUrl(url, path)} variant=\"secondary\" rel=\"noopener noreferrer\">\n {children}\n </StyledSafeLinkButton>\n );\n return children;\n};\n\nexport const CampaignBlock = ({\n title,\n image,\n imageSide = \"left\",\n description,\n headingLevel: InternalHeading = \"h2\",\n url,\n path,\n className,\n background,\n}: Props) => {\n const imageComponent = image && <StyledImg src={`${image.src}?width=455`} height={340} width={455} alt={image.alt} />;\n\n return (\n <Wrapper>\n <Container className={className} data-embed-type=\"campaign-block\" imageSide={imageSide} background={background}>\n {imageSide === \"left\" && imageComponent}\n <ContentWrapper>\n <Text asChild consumeCss textStyle=\"heading.small\">\n <InternalHeading>{parse(title)}</InternalHeading>\n </Text>\n <StyledText textStyle=\"body.xlarge\">{parse(description)}</StyledText>\n {!!url?.url && (\n <LinkButton url={url.url} path={path}>\n {parse(url.text ?? \"\")}\n <ArrowRightLine />\n </LinkButton>\n )}\n </ContentWrapper>\n {imageSide !== \"left\" && imageComponent}\n </Container>\n </Wrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA,MAAM,8CAAiB,OAAO,EAC5B,MAAM;CACJ,OAAO;CACP,QAAQ;CACR,eAAe;CAChB,EACF,CAAC;AAEF,MAAM,gDAAmB,OAAO;CAC9B,MAAM;EACJ,SAAS;EACT,qBAAqB;EACrB,QAAQ;EACR,aAAa;EACb,iBAAiB;EACjB,cAAc;EACd,WAAW;EACX,UAAU;EACX;CACD,UAAU;EACR,WAAW;GACT,MAAM;IACJ,YAAY,EACV,qBAAqB,6BACtB;IACD,+CAA+C,EAC7C,YAAY,EACV,qBAAqB,6BACtB,EACF;IACF;GACD,OAAO;IACL,YAAY,EACV,qBAAqB,6BACtB;IACD,+CAA+C,EAC7C,YAAY,EACV,qBAAqB,6BACtB,EACF;IACF;GACF;EACD,YAAY;GACV,SAAS,EAAE;GACX,QAAQ,EACN,iBAAiB,mBAClB;GACD,QAAQ,EACN,iBAAiB,mBAClB;GACF;EACF;CACD,iBAAiB;EACf,WAAW;EACX,YAAY;EACb;CACF,CAAC;AAEF,MAAM,gDAAmB,OAAO,EAC9B,MAAM;CACJ,WAAW;CACX,OAAO;CACP,QAAQ;CACR,YAAY,EACV,QAAQ,SACT;CACD,+CAA+C;EAC7C,QAAQ,EACN,QAAQ,SACT;EACD,YAAY,EACV,QAAQ,SACT;EACF;CACD,iBAAiB;CAClB,EACF,CAAC;AAEF,MAAM,qDAAwB,OAAO,EACnC,MAAM;CACJ,OAAO;CACP,SAAS;CACT,eAAe;CACf,KAAK;CACL,YAAY;CACZ,gBAAgB;CAChB,cAAc;CACd,eAAe;CACf,UAAU;CACX,EACF,CAAC;AAEF,MAAM,iDAAoBA,uBAAM,EAC9B,MAAM,EACJ,QAAQ;CACN,SAAS;CACT,UAAU;CACV,UAAU;CACV,WAAW;CACX,WAAW;CACZ,EACF,EACF,CAAC;AAQF,MAAM,2DAA8BC,+BAAgB,EAClD,MAAM;CACJ,WAAW;CACX,QAAQ;CACR,aAAa;CACd,EACF,CAAC;AAEF,MAAM,cAAc,EAAE,KAAK,UAAU,WAA4B;AAC/D,KAAI,IACF,QACE,2CAAC;EAAqB,IAAIC,2CAAuB,KAAK,KAAK;EAAE,SAAQ;EAAY,KAAI;EAClF;GACoB;AAE3B,QAAO;;AAGT,MAAa,iBAAiB,EAC5B,OACA,OACA,YAAY,QACZ,aACA,cAAc,kBAAkB,MAChC,KACA,MACA,WACA,iBACW;CACX,MAAM,iBAAiB,SAAS,2CAAC;EAAU,KAAK,GAAG,MAAM,IAAI;EAAa,QAAQ;EAAK,OAAO;EAAK,KAAK,MAAM;GAAO;AAErH,QACE,2CAAC,qBACC,4CAAC;EAAqB;EAAW,mBAAgB;EAA4B;EAAuB;;GACjG,cAAc,UAAU;GACzB,4CAAC;IACC,2CAACF;KAAK;KAAQ;KAAW,WAAU;eACjC,2CAAC,4DAAuB,MAAM,GAAmB;MAC5C;IACP,2CAAC;KAAW,WAAU;8CAAqB,YAAY;MAAc;IACpE,CAAC,CAAC,KAAK,OACN,4CAAC;KAAW,KAAK,IAAI;KAAW;+CACvB,IAAI,QAAQ,GAAG,EACtB,2CAACG,+BAAiB;MACP;OAEA;GAChB,cAAc,UAAU;;GACf,GACJ"}
1
+ {"version":3,"file":"CampaignBlock.js","names":["Text","SafeLinkButton","getPossiblyRelativeUrl","ArrowRightLine"],"sources":["../../src/CampaignBlock/CampaignBlock.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 { ArrowRightLine } from \"@ndla/icons\";\nimport { Text } from \"@ndla/primitives\";\nimport { SafeLinkButton } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CampaignBlockEmbedData } from \"@ndla/types-embed\";\nimport parse from \"html-react-parser\";\nimport { type ReactNode } from \"react\";\nimport type { HeadingLevel } from \"../types\";\nimport { getPossiblyRelativeUrl } from \"../utils/relativeUrl\";\n\ninterface Image {\n src: string;\n alt: string;\n}\n\ninterface Props {\n title: string;\n description: string;\n headingLevel?: HeadingLevel;\n url: {\n url?: string;\n text?: string;\n };\n image?: Image;\n imageSide?: CampaignBlockEmbedData[\"imageSide\"];\n className?: string;\n path?: string;\n background?: CampaignBlockEmbedData[\"background\"];\n}\n\nconst Wrapper = styled(\"div\", {\n base: {\n width: \"100%\",\n height: \"100%\",\n containerType: \"inline-size\",\n },\n});\n\nconst Container = styled(\"div\", {\n base: {\n display: \"grid\",\n gridTemplateColumns: \"1fr\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n backgroundColor: \"background.default\",\n borderRadius: \"xsmall\",\n boxShadow: \"full\",\n overflow: \"hidden\",\n },\n variants: {\n imageSide: {\n left: {\n \"@/tablet\": {\n gridTemplateColumns: \"minmax(230px, 455px) auto\", //required for campaign block in myNdla\n },\n \"@supports not (container-type: inline-size)\": {\n tabletWide: {\n gridTemplateColumns: \"minmax(230px, 455px) auto\",\n },\n },\n },\n right: {\n \"@/tablet\": {\n gridTemplateColumns: \"auto minmax(230px, 455px)\", //required for campaign block in myNdla\n },\n \"@supports not (container-type: inline-size)\": {\n tabletWide: {\n gridTemplateColumns: \"auto minmax(230px, 455px)\",\n },\n },\n },\n },\n background: {\n neutral: {},\n brand1: {\n backgroundColor: \"surface.brand.1\",\n },\n brand3: {\n backgroundColor: \"surface.brand.3\",\n },\n },\n },\n defaultVariants: {\n imageSide: \"left\",\n background: \"neutral\",\n },\n});\n\nconst StyledImg = styled(\"img\", {\n base: {\n objectFit: \"cover\",\n width: \"100%\",\n height: \"215px\",\n \"@/tablet\": {\n height: \"340px\",\n },\n \"@supports not (container-type: inline-size)\": {\n tablet: {\n height: \"265px\",\n },\n tabletWide: {\n height: \"340px\",\n },\n },\n backgroundColor: \"background.default\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n alignItems: \"flex-start\",\n justifyContent: \"center\",\n paddingBlock: \"medium\",\n paddingInline: \"medium\",\n position: \"relative\",\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n tablet: {\n display: \"block\",\n overflow: \"hidden\",\n position: \"relative\",\n lineClamp: 4,\n boxOrient: \"vertical\",\n },\n },\n});\n\ninterface LinkButtonProps {\n url?: string;\n path?: string;\n children: ReactNode;\n}\n\nconst StyledSafeLinkButton = styled(SafeLinkButton, {\n base: {\n boxShadow: \"full\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n },\n});\n\nconst LinkButton = ({ url, children, path }: LinkButtonProps) => {\n if (url)\n return (\n <StyledSafeLinkButton to={getPossiblyRelativeUrl(url, path)} variant=\"secondary\" rel=\"noopener noreferrer\">\n {children}\n </StyledSafeLinkButton>\n );\n return children;\n};\n\nexport const CampaignBlock = ({\n title,\n image,\n imageSide = \"left\",\n description,\n headingLevel: InternalHeading = \"h2\",\n url,\n path,\n className,\n background,\n}: Props) => {\n const imageComponent = image && <StyledImg src={`${image.src}?width=455`} height={340} width={455} alt={image.alt} />;\n\n return (\n <Wrapper>\n <Container className={className} data-embed-type=\"campaign-block\" imageSide={imageSide} background={background}>\n {imageSide === \"left\" && imageComponent}\n <ContentWrapper>\n <Text asChild consumeCss textStyle=\"heading.small\">\n <InternalHeading>{parse(title)}</InternalHeading>\n </Text>\n <StyledText textStyle=\"body.xlarge\">{parse(description)}</StyledText>\n {!!url?.url && (\n <LinkButton url={url.url} path={path}>\n {parse(url.text ?? \"\")}\n <ArrowRightLine />\n </LinkButton>\n )}\n </ContentWrapper>\n {imageSide !== \"left\" && imageComponent}\n </Container>\n </Wrapper>\n );\n};\n"],"mappings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CAAA;GAChB,cAAc,UAAU;GACf;KACJ,CAAA"}
@@ -1,9 +1,8 @@
1
- const require_runtime = require('../_virtual/_rolldown/runtime.js');
1
+ require("../_virtual/_rolldown/runtime.js");
2
2
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
3
3
  let react = require("react");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
5
  let _ndla_styled_system_css = require("@ndla/styled-system/css");
6
-
7
6
  //#region src/CodeBlock/CodeBlock.tsx
8
7
  /**
9
8
  * Copyright (c) 2020-present, NDLA.
@@ -26,7 +25,7 @@ const CodeBlock = (0, react.forwardRef)(({ highlightedCode, format, className, .
26
25
  ref
27
26
  });
28
27
  });
29
-
30
28
  //#endregion
31
29
  exports.CodeBlock = CodeBlock;
30
+
32
31
  //# sourceMappingURL=CodeBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock.js","names":[],"sources":["../../src/CodeBlock/CodeBlock.tsx"],"sourcesContent":["/**\n * Copyright (c) 2020-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 { cx } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { type ComponentPropsWithRef, forwardRef, useMemo } from \"react\";\n\ninterface Props extends StyledProps, ComponentPropsWithRef<\"pre\"> {\n highlightedCode: string;\n format: string;\n}\n\nconst Pre = styled(\"pre\", {});\n\nexport const CodeBlock = forwardRef<HTMLPreElement, Props>(({ highlightedCode, format, className, ...props }, ref) => {\n const codeWithLineNumbers = useMemo(() => {\n return highlightedCode\n .split(\"\\n\")\n .map((line, i) => {\n return `<span class=\"linenumber\">${i + 1}</span>${line}`;\n })\n .join(\"\\n\");\n }, [highlightedCode]);\n\n return (\n <Pre\n className={cx(\"codeblock\", `language-${format}`, className)}\n {...props}\n dangerouslySetInnerHTML={{ __html: codeWithLineNumbers }}\n ref={ref}\n />\n );\n});\n"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,0CAAa,OAAO,EAAE,CAAC;AAE7B,MAAa,mCAA+C,EAAE,iBAAiB,QAAQ,WAAW,GAAG,SAAS,QAAQ;CACpH,MAAM,+CAAoC;AACxC,SAAO,gBACJ,MAAM,KAAK,CACX,KAAK,MAAM,MAAM;AAChB,UAAO,4BAA4B,IAAI,EAAE,SAAS;IAClD,CACD,KAAK,KAAK;IACZ,CAAC,gBAAgB,CAAC;AAErB,QACE,2CAAC;EACC,2CAAc,aAAa,YAAY,UAAU,UAAU;EAC3D,GAAI;EACJ,yBAAyB,EAAE,QAAQ,qBAAqB;EACnD;GACL;EAEJ"}
1
+ {"version":3,"file":"CodeBlock.js","names":[],"sources":["../../src/CodeBlock/CodeBlock.tsx"],"sourcesContent":["/**\n * Copyright (c) 2020-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 { cx } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { type ComponentPropsWithRef, forwardRef, useMemo } from \"react\";\n\ninterface Props extends StyledProps, ComponentPropsWithRef<\"pre\"> {\n highlightedCode: string;\n format: string;\n}\n\nconst Pre = styled(\"pre\", {});\n\nexport const CodeBlock = forwardRef<HTMLPreElement, Props>(({ highlightedCode, format, className, ...props }, ref) => {\n const codeWithLineNumbers = useMemo(() => {\n return highlightedCode\n .split(\"\\n\")\n .map((line, i) => {\n return `<span class=\"linenumber\">${i + 1}</span>${line}`;\n })\n .join(\"\\n\");\n }, [highlightedCode]);\n\n return (\n <Pre\n className={cx(\"codeblock\", `language-${format}`, className)}\n {...props}\n dangerouslySetInnerHTML={{ __html: codeWithLineNumbers }}\n ref={ref}\n />\n );\n});\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAM,OAAA,GAAA,wBAAA,QAAa,OAAO,EAAE,CAAC;AAE7B,MAAa,aAAA,GAAA,MAAA,aAA+C,EAAE,iBAAiB,QAAQ,WAAW,GAAG,SAAS,QAAQ;CACpH,MAAM,uBAAA,GAAA,MAAA,eAAoC;AACxC,SAAO,gBACJ,MAAM,KAAK,CACX,KAAK,MAAM,MAAM;AAChB,UAAO,4BAA4B,IAAI,EAAE,SAAS;IAClD,CACD,KAAK,KAAK;IACZ,CAAC,gBAAgB,CAAC;AAErB,QACE,iBAAA,GAAA,kBAAA,KAAC,KAAD;EACE,YAAA,GAAA,wBAAA,IAAc,aAAa,YAAY,UAAU,UAAU;EAC3D,GAAI;EACJ,yBAAyB,EAAE,QAAQ,qBAAqB;EACnD;EACL,CAAA;EAEJ"}
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/CodeBlock/codeLanguageOptions.ts
3
2
  /**
4
3
  * Copyright (c) 2019-present, NDLA.
@@ -109,7 +108,7 @@ const codeLanguageOptions = [
109
108
  format: "xml"
110
109
  }
111
110
  ];
112
-
113
111
  //#endregion
114
112
  exports.codeLanguageOptions = codeLanguageOptions;
113
+
115
114
  //# sourceMappingURL=codeLanguageOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codeLanguageOptions.js","names":[],"sources":["../../src/CodeBlock/codeLanguageOptions.ts"],"sourcesContent":["/**\n * Copyright (c) 2019-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nexport const codeLanguageOptions: Array<ICodeLangugeOption> = [\n {\n title: \"Bash\",\n format: \"bash\",\n },\n {\n title: \"C\",\n format: \"c\",\n },\n {\n title: \"CSharp\",\n format: \"csharp\",\n },\n {\n title: \"CSS\",\n format: \"css\",\n },\n {\n title: \"Diff\",\n format: \"diff\",\n },\n {\n title: \"HTML\",\n format: \"markup\",\n },\n {\n title: \"Ini\",\n format: \"ini\",\n },\n {\n title: \"Java\",\n format: \"java\",\n },\n {\n title: \"Javascript\",\n format: \"js\",\n },\n {\n title: \"JSON\",\n format: \"json\",\n },\n {\n title: \"JSX\",\n format: \"jsx\",\n },\n {\n title: \"Kotlin\",\n format: \"kotlin\",\n },\n {\n title: \"LUA\",\n format: \"lua\",\n },\n {\n title: \"Markdown\",\n format: \"markdown\",\n },\n {\n title: \"Matlab\",\n format: \"matlab\",\n },\n {\n title: \"NSIS\",\n format: \"nsis\",\n },\n {\n title: \"PHP\",\n format: \"php\",\n },\n {\n title: \"Powershell\",\n format: \"powershell\",\n },\n {\n title: \"Python\",\n format: \"python\",\n },\n {\n title: \"Ruby\",\n format: \"ruby\",\n },\n {\n title: \"Rust\",\n format: \"rust\",\n },\n {\n title: \"SQL\",\n format: \"sql\",\n },\n {\n title: \"Text\",\n format: \"text\",\n },\n {\n title: \"VHDL\",\n format: \"vhdl\",\n },\n {\n title: \"XML\",\n format: \"xml\",\n },\n];\n\nexport interface ICodeLangugeOption {\n title: string;\n format: string;\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,sBAAiD;CAC5D;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACF"}
1
+ {"version":3,"file":"codeLanguageOptions.js","names":[],"sources":["../../src/CodeBlock/codeLanguageOptions.ts"],"sourcesContent":["/**\n * Copyright (c) 2019-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nexport const codeLanguageOptions: Array<ICodeLangugeOption> = [\n {\n title: \"Bash\",\n format: \"bash\",\n },\n {\n title: \"C\",\n format: \"c\",\n },\n {\n title: \"CSharp\",\n format: \"csharp\",\n },\n {\n title: \"CSS\",\n format: \"css\",\n },\n {\n title: \"Diff\",\n format: \"diff\",\n },\n {\n title: \"HTML\",\n format: \"markup\",\n },\n {\n title: \"Ini\",\n format: \"ini\",\n },\n {\n title: \"Java\",\n format: \"java\",\n },\n {\n title: \"Javascript\",\n format: \"js\",\n },\n {\n title: \"JSON\",\n format: \"json\",\n },\n {\n title: \"JSX\",\n format: \"jsx\",\n },\n {\n title: \"Kotlin\",\n format: \"kotlin\",\n },\n {\n title: \"LUA\",\n format: \"lua\",\n },\n {\n title: \"Markdown\",\n format: \"markdown\",\n },\n {\n title: \"Matlab\",\n format: \"matlab\",\n },\n {\n title: \"NSIS\",\n format: \"nsis\",\n },\n {\n title: \"PHP\",\n format: \"php\",\n },\n {\n title: \"Powershell\",\n format: \"powershell\",\n },\n {\n title: \"Python\",\n format: \"python\",\n },\n {\n title: \"Ruby\",\n format: \"ruby\",\n },\n {\n title: \"Rust\",\n format: \"rust\",\n },\n {\n title: \"SQL\",\n format: \"sql\",\n },\n {\n title: \"Text\",\n format: \"text\",\n },\n {\n title: \"VHDL\",\n format: \"vhdl\",\n },\n {\n title: \"XML\",\n format: \"xml\",\n },\n];\n\nexport interface ICodeLangugeOption {\n title: string;\n format: string;\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,sBAAiD;CAC5D;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACD;EACE,OAAO;EACP,QAAQ;EACT;CACF"}
@@ -1,16 +1,15 @@
1
- const require_runtime = require('../_virtual/_rolldown/runtime.js');
2
- const require_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
- const require_licenseAttributes = require('../utils/licenseAttributes.js');
4
- const require_BrightcoveEmbed = require('../Embed/BrightcoveEmbed.js');
5
- const require_ExternalEmbed = require('../Embed/ExternalEmbed.js');
6
- const require_H5pEmbed = require('../Embed/H5pEmbed.js');
7
- const require_IframeEmbed = require('../Embed/IframeEmbed.js');
8
- const require_ImageEmbed = require('../Embed/ImageEmbed.js');
1
+ require("../_virtual/_rolldown/runtime.js");
2
+ const require_EmbedByline = require("../LicenseByline/EmbedByline.js");
3
+ const require_licenseAttributes = require("../utils/licenseAttributes.js");
4
+ const require_BrightcoveEmbed = require("../Embed/BrightcoveEmbed.js");
5
+ const require_ExternalEmbed = require("../Embed/ExternalEmbed.js");
6
+ const require_H5pEmbed = require("../Embed/H5pEmbed.js");
7
+ const require_IframeEmbed = require("../Embed/IframeEmbed.js");
8
+ const require_ImageEmbed = require("../Embed/ImageEmbed.js");
9
9
  let _ndla_primitives = require("@ndla/primitives");
10
10
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
11
11
  let react = require("react");
12
12
  let react_jsx_runtime = require("react/jsx-runtime");
13
-
14
13
  //#region src/Concept/Concept.tsx
15
14
  /**
16
15
  * Copyright (c) 2024-present, NDLA.
@@ -52,7 +51,7 @@ const Concept = (0, react.forwardRef)(({ copyright, visualElement, lang, childre
52
51
  ]
53
52
  });
54
53
  });
55
-
56
54
  //#endregion
57
55
  exports.Concept = Concept;
56
+
58
57
  //# sourceMappingURL=Concept.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Concept.js","names":["Figure","licenseAttributes","ImageEmbed","BrightcoveEmbed","H5pEmbed","IframeEmbed","ExternalEmbed","EmbedByline"],"sources":["../../src/Concept/Concept.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { DraftCopyrightDTO as ConceptCopyright } from \"@ndla/types-backend/concept-api\";\nimport type { ConceptVisualElementMeta } from \"@ndla/types-embed\";\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { BrightcoveEmbed } from \"../Embed/BrightcoveEmbed\";\nimport { ExternalEmbed } from \"../Embed/ExternalEmbed\";\nimport { H5pEmbed } from \"../Embed/H5pEmbed\";\nimport { IframeEmbed } from \"../Embed/IframeEmbed\";\nimport { ImageEmbed } from \"../Embed/ImageEmbed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nexport interface ConceptProps extends Omit<ComponentPropsWithRef<\"figure\">, \"title\"> {\n copyright?: ConceptCopyright;\n visualElement?: ConceptVisualElementMeta;\n lang?: string;\n title?: ReactNode;\n children?: ReactNode;\n source?: string;\n previewAlt?: boolean;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n textStyle: \"body.large\",\n display: \"inline\",\n \"& p\": {\n display: \"inline\",\n },\n },\n});\n\nexport const Concept = forwardRef<HTMLElement, ConceptProps>(\n ({ copyright, visualElement, lang, children, title, source, previewAlt, ...rest }, ref) => {\n const licenseProps = licenseAttributes(copyright?.license?.license, lang, source);\n\n return (\n <StyledFigure ref={ref} {...rest} {...licenseProps}>\n <ContentWrapper lang={lang}>\n {!!title && (\n <>\n <b>{title}</b>\n {` – `}\n </>\n )}\n {children}\n </ContentWrapper>\n {visualElement?.resource === \"image\" ? (\n <ImageEmbed embed={visualElement} lang={lang} previewAlt={previewAlt} />\n ) : visualElement?.resource === \"brightcove\" ? (\n <BrightcoveEmbed embed={visualElement} />\n ) : visualElement?.resource === \"h5p\" ? (\n <H5pEmbed embed={visualElement} />\n ) : visualElement?.resource === \"iframe\" ? (\n <IframeEmbed embed={visualElement} />\n ) : visualElement?.resource === \"external\" ? (\n <ExternalEmbed embed={visualElement} />\n ) : null}\n {!!copyright && <EmbedByline copyright={copyright} type=\"concept\" />}\n </StyledFigure>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,mDAAsBA,yBAAQ,EAClC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACN,EACF,CAAC;AAEF,MAAM,qDAAwB,OAAO,EACnC,MAAM;CACJ,WAAW;CACX,SAAS;CACT,OAAO,EACL,SAAS,UACV;CACF,EACF,CAAC;AAEF,MAAa,iCACV,EAAE,WAAW,eAAe,MAAM,UAAU,OAAO,QAAQ,YAAY,GAAG,QAAQ,QAAQ;CACzF,MAAM,eAAeC,4CAAkB,WAAW,SAAS,SAAS,MAAM,OAAO;AAEjF,QACE,4CAAC;EAAkB;EAAK,GAAI;EAAM,GAAI;;GACpC,4CAAC;IAAqB;eACnB,CAAC,CAAC,SACD,qFACE,2CAAC,iBAAG,QAAU,EACb,SACA,EAEJ;KACc;GAChB,eAAe,aAAa,UAC3B,2CAACC;IAAW,OAAO;IAAqB;IAAkB;KAAc,GACtE,eAAe,aAAa,eAC9B,2CAACC,2CAAgB,OAAO,gBAAiB,GACvC,eAAe,aAAa,QAC9B,2CAACC,6BAAS,OAAO,gBAAiB,GAChC,eAAe,aAAa,WAC9B,2CAACC,mCAAY,OAAO,gBAAiB,GACnC,eAAe,aAAa,aAC9B,2CAACC,uCAAc,OAAO,gBAAiB,GACrC;GACH,CAAC,CAAC,aAAa,2CAACC;IAAuB;IAAW,MAAK;KAAY;;GACvD;EAGpB"}
1
+ {"version":3,"file":"Concept.js","names":["Figure","licenseAttributes","ImageEmbed","BrightcoveEmbed","H5pEmbed","IframeEmbed","ExternalEmbed","EmbedByline"],"sources":["../../src/Concept/Concept.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { DraftCopyrightDTO as ConceptCopyright } from \"@ndla/types-backend/concept-api\";\nimport type { ConceptVisualElementMeta } from \"@ndla/types-embed\";\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { BrightcoveEmbed } from \"../Embed/BrightcoveEmbed\";\nimport { ExternalEmbed } from \"../Embed/ExternalEmbed\";\nimport { H5pEmbed } from \"../Embed/H5pEmbed\";\nimport { IframeEmbed } from \"../Embed/IframeEmbed\";\nimport { ImageEmbed } from \"../Embed/ImageEmbed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nexport interface ConceptProps extends Omit<ComponentPropsWithRef<\"figure\">, \"title\"> {\n copyright?: ConceptCopyright;\n visualElement?: ConceptVisualElementMeta;\n lang?: string;\n title?: ReactNode;\n children?: ReactNode;\n source?: string;\n previewAlt?: boolean;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n textStyle: \"body.large\",\n display: \"inline\",\n \"& p\": {\n display: \"inline\",\n },\n },\n});\n\nexport const Concept = forwardRef<HTMLElement, ConceptProps>(\n ({ copyright, visualElement, lang, children, title, source, previewAlt, ...rest }, ref) => {\n const licenseProps = licenseAttributes(copyright?.license?.license, lang, source);\n\n return (\n <StyledFigure ref={ref} {...rest} {...licenseProps}>\n <ContentWrapper lang={lang}>\n {!!title && (\n <>\n <b>{title}</b>\n {` – `}\n </>\n )}\n {children}\n </ContentWrapper>\n {visualElement?.resource === \"image\" ? (\n <ImageEmbed embed={visualElement} lang={lang} previewAlt={previewAlt} />\n ) : visualElement?.resource === \"brightcove\" ? (\n <BrightcoveEmbed embed={visualElement} />\n ) : visualElement?.resource === \"h5p\" ? (\n <H5pEmbed embed={visualElement} />\n ) : visualElement?.resource === \"iframe\" ? (\n <IframeEmbed embed={visualElement} />\n ) : visualElement?.resource === \"external\" ? (\n <ExternalEmbed embed={visualElement} />\n ) : null}\n {!!copyright && <EmbedByline copyright={copyright} type=\"concept\" />}\n </StyledFigure>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAAQ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AAA;GACvD;;EAGpB"}
@@ -1,10 +1,9 @@
1
- const require_runtime = require('../_virtual/_rolldown/runtime.js');
2
- const require_EmbedByline = require('../LicenseByline/EmbedByline.js');
1
+ require("../_virtual/_rolldown/runtime.js");
2
+ const require_EmbedByline = require("../LicenseByline/EmbedByline.js");
3
3
  let _ndla_primitives = require("@ndla/primitives");
4
4
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
5
5
  let react_i18next = require("react-i18next");
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
-
8
7
  //#region src/ContactBlock/ContactBlock.tsx
9
8
  /**
10
9
  * Copyright (c) 2024-present, NDLA.
@@ -147,8 +146,8 @@ const ContactBlock = ({ image, jobTitle, description, name, email, embedAlt, lan
147
146
  })]
148
147
  });
149
148
  };
150
-
151
149
  //#endregion
152
150
  exports.ContactBlock = ContactBlock;
153
151
  exports.contactBlockBackgrounds = contactBlockBackgrounds;
152
+
154
153
  //# sourceMappingURL=ContactBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContactBlock.js","names":["Text","LicenseContainerContent"],"sources":["../../src/ContactBlock/ContactBlock.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { SystemStyleObject } from \"@ndla/styled-system/types\";\nimport type { ImageMetaInformationV3DTO } from \"@ndla/types-backend/image-api\";\nimport { useTranslation } from \"react-i18next\";\nimport { LicenseContainerContent } from \"../LicenseByline/EmbedByline\";\n\nexport type ContactBlockBackground = \"strong\" | \"moderate\" | \"subtle\";\n\nconst BackgroundVariant: Record<ContactBlockBackground, SystemStyleObject> = {\n strong: { _before: { backgroundColor: \"surface.brand.3\" } },\n moderate: { _before: { backgroundColor: \"surface.brand.3.moderate\" } },\n subtle: { _before: { backgroundColor: \"surface.brand.3.subtle\" } },\n};\n\nexport const contactBlockBackgrounds = Object.keys(BackgroundVariant) as ContactBlockBackground[];\n\nconst StyledWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n minWidth: \"surface.xxsmall\",\n padding: \"medium\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n boxShadow: \"full\",\n border: \"1px solid\",\n gap: \"medium\",\n position: \"relative\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n overflow: \"hidden\",\n background: \"surface.default\",\n flexDirection: \"column-reverse\",\n tablet: {\n alignItems: \"unset\",\n flexDirection: \"row\",\n },\n },\n});\n\nconst EmailLink = styled(\"a\", {\n base: {\n color: \"text.default\",\n textDecoration: \"underline\",\n _hover: { textDecoration: \"none\" },\n _focusVisible: { textDecoration: \"none\" },\n },\n});\n\nconst HeaderWrapper = styled(\"div\", {\n base: {\n position: \"relative\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n zIndex: \"base\",\n _before: {\n content: '\"\"',\n position: \"absolute\",\n top: \"-60px\",\n left: \"-50px\",\n right: \"0\",\n bottom: \"0\",\n height: \"calc(100% + 50px)\",\n width: \"surface.3xlarge\",\n transform: \"rotate(-4deg)\",\n zIndex: \"hide\",\n },\n },\n variants: {\n variant: BackgroundVariant,\n imageExists: {\n true: {\n tabletDown: {\n _before: {\n display: \"none\",\n },\n },\n },\n },\n },\n});\n\nconst ImageWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"xxsmall\",\n alignItems: \"flex-start\",\n justifyContent: \"flex-start\",\n flexDirection: \"column\",\n zIndex: \"base\",\n tabletDown: {\n _before: {\n content: '\"\"',\n position: \"absolute\",\n top: \"-50px\",\n left: \"-50px\",\n right: \"0\",\n bottom: \"0\",\n height: \"surface.xxsmall\",\n width: \"surface.3xlarge\",\n transform: \"rotate(-4deg)\",\n zIndex: \"hide\",\n },\n },\n },\n variants: {\n variant: BackgroundVariant,\n },\n});\n\nconst StyledImage = styled(\"img\", {\n base: {\n borderRadius: \"xsmall\",\n width: \"surface.xsmall\",\n height: \"surface.xsmall\",\n objectFit: \"cover\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n flex: \"1\",\n width: \"100%\",\n },\n});\n\nconst StyledDescription = styled(Text, {\n base: {\n fontFamily: \"serif\",\n },\n});\n\ninterface Props {\n image?: ImageMetaInformationV3DTO;\n jobTitle: string;\n description: string;\n backgroundColor?: ContactBlockBackground;\n imageWidth?: number;\n name: string;\n email: string;\n embedAlt?: string;\n lang?: string;\n}\n\nexport const ContactBlock = ({\n image,\n jobTitle,\n description,\n name,\n email,\n embedAlt,\n lang,\n backgroundColor = \"strong\",\n}: Props) => {\n const { t } = useTranslation();\n return (\n <StyledWrapper data-embed-type=\"contact-block\">\n <ContentWrapper>\n <HeaderWrapper variant={backgroundColor} imageExists={!!image}>\n <Text lang={lang} fontWeight=\"bold\" textStyle=\"heading.small\">\n {name}\n </Text>\n <Text lang={lang}>{jobTitle}</Text>\n <Text>\n {`${t(\"email\")}: `}\n <EmailLink href={`mailto:${email}`}>{email}</EmailLink>\n </Text>\n </HeaderWrapper>\n <StyledDescription textStyle=\"body.large\">{description}</StyledDescription>\n </ContentWrapper>\n {!!image && (\n <ImageWrapper variant={backgroundColor}>\n <StyledImage\n alt={embedAlt !== undefined ? embedAlt : image.alttext.alttext}\n src={image.image.imageUrl}\n width={300}\n height={300}\n />\n <LicenseContainerContent type=\"image\" copyright={image.copyright} />\n </ImageWrapper>\n )}\n </StyledWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAM,oBAAuE;CAC3E,QAAQ,EAAE,SAAS,EAAE,iBAAiB,mBAAmB,EAAE;CAC3D,UAAU,EAAE,SAAS,EAAE,iBAAiB,4BAA4B,EAAE;CACtE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,0BAA0B,EAAE;CACnE;AAED,MAAa,0BAA0B,OAAO,KAAK,kBAAkB;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OAAO;CACR,EACF,CAAC;AAEF,MAAM,wDAA2BA,uBAAM,EACrC,MAAM,EACJ,YAAY,SACb,EACF,CAAC;AAcF,MAAa,gBAAgB,EAC3B,OACA,UACA,aACA,MACA,OACA,UACA,MACA,kBAAkB,eACP;CACX,MAAM,EAAE,yCAAsB;AAC9B,QACE,4CAAC;EAAc,mBAAgB;aAC7B,4CAAC,6BACC,4CAAC;GAAc,SAAS;GAAiB,aAAa,CAAC,CAAC;;IACtD,2CAACA;KAAW;KAAM,YAAW;KAAO,WAAU;eAC3C;MACI;IACP,2CAACA;KAAW;eAAO;MAAgB;IACnC,4CAACA,oCACE,GAAG,EAAE,QAAQ,CAAC,KACf,2CAAC;KAAU,MAAM,UAAU;eAAU;MAAkB,IAClD;;IACO,EAChB,2CAAC;GAAkB,WAAU;aAAc;IAAgC,IAC5D,EAChB,CAAC,CAAC,SACD,4CAAC;GAAa,SAAS;cACrB,2CAAC;IACC,KAAK,aAAa,SAAY,WAAW,MAAM,QAAQ;IACvD,KAAK,MAAM,MAAM;IACjB,OAAO;IACP,QAAQ;KACR,EACF,2CAACC;IAAwB,MAAK;IAAQ,WAAW,MAAM;KAAa;IACvD;GAEH"}
1
+ {"version":3,"file":"ContactBlock.js","names":["Text","LicenseContainerContent"],"sources":["../../src/ContactBlock/ContactBlock.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { SystemStyleObject } from \"@ndla/styled-system/types\";\nimport type { ImageMetaInformationV3DTO } from \"@ndla/types-backend/image-api\";\nimport { useTranslation } from \"react-i18next\";\nimport { LicenseContainerContent } from \"../LicenseByline/EmbedByline\";\n\nexport type ContactBlockBackground = \"strong\" | \"moderate\" | \"subtle\";\n\nconst BackgroundVariant: Record<ContactBlockBackground, SystemStyleObject> = {\n strong: { _before: { backgroundColor: \"surface.brand.3\" } },\n moderate: { _before: { backgroundColor: \"surface.brand.3.moderate\" } },\n subtle: { _before: { backgroundColor: \"surface.brand.3.subtle\" } },\n};\n\nexport const contactBlockBackgrounds = Object.keys(BackgroundVariant) as ContactBlockBackground[];\n\nconst StyledWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n minWidth: \"surface.xxsmall\",\n padding: \"medium\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n boxShadow: \"full\",\n border: \"1px solid\",\n gap: \"medium\",\n position: \"relative\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n overflow: \"hidden\",\n background: \"surface.default\",\n flexDirection: \"column-reverse\",\n tablet: {\n alignItems: \"unset\",\n flexDirection: \"row\",\n },\n },\n});\n\nconst EmailLink = styled(\"a\", {\n base: {\n color: \"text.default\",\n textDecoration: \"underline\",\n _hover: { textDecoration: \"none\" },\n _focusVisible: { textDecoration: \"none\" },\n },\n});\n\nconst HeaderWrapper = styled(\"div\", {\n base: {\n position: \"relative\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n zIndex: \"base\",\n _before: {\n content: '\"\"',\n position: \"absolute\",\n top: \"-60px\",\n left: \"-50px\",\n right: \"0\",\n bottom: \"0\",\n height: \"calc(100% + 50px)\",\n width: \"surface.3xlarge\",\n transform: \"rotate(-4deg)\",\n zIndex: \"hide\",\n },\n },\n variants: {\n variant: BackgroundVariant,\n imageExists: {\n true: {\n tabletDown: {\n _before: {\n display: \"none\",\n },\n },\n },\n },\n },\n});\n\nconst ImageWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"xxsmall\",\n alignItems: \"flex-start\",\n justifyContent: \"flex-start\",\n flexDirection: \"column\",\n zIndex: \"base\",\n tabletDown: {\n _before: {\n content: '\"\"',\n position: \"absolute\",\n top: \"-50px\",\n left: \"-50px\",\n right: \"0\",\n bottom: \"0\",\n height: \"surface.xxsmall\",\n width: \"surface.3xlarge\",\n transform: \"rotate(-4deg)\",\n zIndex: \"hide\",\n },\n },\n },\n variants: {\n variant: BackgroundVariant,\n },\n});\n\nconst StyledImage = styled(\"img\", {\n base: {\n borderRadius: \"xsmall\",\n width: \"surface.xsmall\",\n height: \"surface.xsmall\",\n objectFit: \"cover\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n flex: \"1\",\n width: \"100%\",\n },\n});\n\nconst StyledDescription = styled(Text, {\n base: {\n fontFamily: \"serif\",\n },\n});\n\ninterface Props {\n image?: ImageMetaInformationV3DTO;\n jobTitle: string;\n description: string;\n backgroundColor?: ContactBlockBackground;\n imageWidth?: number;\n name: string;\n email: string;\n embedAlt?: string;\n lang?: string;\n}\n\nexport const ContactBlock = ({\n image,\n jobTitle,\n description,\n name,\n email,\n embedAlt,\n lang,\n backgroundColor = \"strong\",\n}: Props) => {\n const { t } = useTranslation();\n return (\n <StyledWrapper data-embed-type=\"contact-block\">\n <ContentWrapper>\n <HeaderWrapper variant={backgroundColor} imageExists={!!image}>\n <Text lang={lang} fontWeight=\"bold\" textStyle=\"heading.small\">\n {name}\n </Text>\n <Text lang={lang}>{jobTitle}</Text>\n <Text>\n {`${t(\"email\")}: `}\n <EmailLink href={`mailto:${email}`}>{email}</EmailLink>\n </Text>\n </HeaderWrapper>\n <StyledDescription textStyle=\"body.large\">{description}</StyledDescription>\n </ContentWrapper>\n {!!image && (\n <ImageWrapper variant={backgroundColor}>\n <StyledImage\n alt={embedAlt !== undefined ? embedAlt : image.alttext.alttext}\n src={image.image.imageUrl}\n width={300}\n height={300}\n />\n <LicenseContainerContent type=\"image\" copyright={image.copyright} />\n </ImageWrapper>\n )}\n </StyledWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,oBAAuE;CAC3E,QAAQ,EAAE,SAAS,EAAE,iBAAiB,mBAAmB,EAAE;CAC3D,UAAU,EAAE,SAAS,EAAE,iBAAiB,4BA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A,IAAY,WAAW,MAAM,QAAQ;IACvD,KAAK,MAAM,MAAM;IACjB,OAAO;IACP,QAAQ;IACR,CAAA,EACF,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,yBAAD;IAAyB,MAAK;IAAQ,WAAW,MAAM;IAAa,CAAA,CACvD;KAEH"}
@@ -1,12 +1,11 @@
1
- const require_runtime = require('../_virtual/_rolldown/runtime.js');
2
- const require_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
- const require_licenseAttributes = require('../utils/licenseAttributes.js');
4
- const require_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
5
- const require_AudioPlayer = require('../AudioPlayer/AudioPlayer.js');
1
+ require("../_virtual/_rolldown/runtime.js");
2
+ const require_EmbedByline = require("../LicenseByline/EmbedByline.js");
3
+ const require_licenseAttributes = require("../utils/licenseAttributes.js");
4
+ const require_EmbedErrorPlaceholder = require("./EmbedErrorPlaceholder.js");
5
+ const require_AudioPlayer = require("../AudioPlayer/AudioPlayer.js");
6
6
  let _ndla_primitives = require("@ndla/primitives");
7
7
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
-
10
9
  //#region src/Embed/AudioEmbed.tsx
11
10
  /**
12
11
  * Copyright (c) 2023-present, NDLA.
@@ -53,7 +52,7 @@ const AudioEmbed = ({ embed, lang }) => {
53
52
  })]
54
53
  });
55
54
  };
56
-
57
55
  //#endregion
58
56
  exports.AudioEmbed = AudioEmbed;
57
+
59
58
  //# sourceMappingURL=AudioEmbed.js.map
@@ -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 { AudioPlayer } from \"../AudioPlayer/AudioPlayer\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport type { Author } from \"./ImageEmbed\";\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,mDAAsBA,yBAAQ,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 { AudioPlayer } from \"../AudioPlayer/AudioPlayer\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport type { Author } from \"./ImageEmbed\";\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,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAA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= require('../_virtual/_rolldown/runtime.js');
2
- const require_EmbedByline = require('../LicenseByline/EmbedByline.js');
3
- const require_licenseAttributes = require('../utils/licenseAttributes.js');
4
- const require_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
1
+ const require_runtime = require("../_virtual/_rolldown/runtime.js");
2
+ const require_EmbedByline = require("../LicenseByline/EmbedByline.js");
3
+ const require_licenseAttributes = require("../utils/licenseAttributes.js");
4
+ const require_EmbedErrorPlaceholder = require("./EmbedErrorPlaceholder.js");
5
5
  let _ndla_primitives = require("@ndla/primitives");
6
6
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
7
7
  let react = require("react");
@@ -9,7 +9,6 @@ let html_react_parser = require("html-react-parser");
9
9
  html_react_parser = require_runtime.__toESM(html_react_parser);
10
10
  let react_i18next = require("react-i18next");
11
11
  let react_jsx_runtime = require("react/jsx-runtime");
12
-
13
12
  //#region src/Embed/BrightcoveEmbed.tsx
14
13
  /**
15
14
  * Copyright (c) 2023-present, NDLA.
@@ -98,7 +97,7 @@ const BrightcoveEmbed = ({ embed, renderContext = "article", lang }) => {
98
97
  })]
99
98
  });
100
99
  };
101
-
102
100
  //#endregion
103
101
  exports.BrightcoveEmbed = BrightcoveEmbed;
102
+
104
103
  //# sourceMappingURL=BrightcoveEmbed.js.map
@@ -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 { Button, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { BrightcoveEmbedData, BrightcoveMetaData, BrightcoveVideoSource } from \"@ndla/types-embed\";\nimport parse from \"html-react-parser\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport type { RenderContext } from \"./types\";\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\" style=\"border: none;\" 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,wDAA2BA,yBAA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AW,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 { Button, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { BrightcoveEmbedData, BrightcoveMetaData, BrightcoveVideoSource } from \"@ndla/types-embed\";\nimport parse from \"html-react-parser\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport type { RenderContext } from \"./types\";\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\" style=\"border: none;\" 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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oBAAoB,wBAAwB;IAC3E,OAAM;IACN,CAAA;GACE,CAAA,EACN,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,aAAD;GAAa,MAAK;GAAQ,WAAW,KAAK;GAAY,aAAa;aACjE,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAA,UACG,CAAC,CAAC,iBACD,iBAAA,GAAA,kBAAA,KAAC,mBAAD;IAAmB,MAAK;IAAQ,SAAQ;IAAY,eAAe,sBAAsB,MAAM,CAAC,EAAE;cAC/F,EAAE,iBAAiB,CAAC,oBAAoB,aAAa,gBAAgB;IACpD,CAAA,EAElB,CAAA;GACM,CAAA,CACP"}
@@ -1,14 +1,13 @@
1
- const require_runtime = require('../_virtual/_rolldown/runtime.js');
2
- const require_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
3
- const require_CodeBlock = require('../CodeBlock/CodeBlock.js');
4
- const require_codeLanguageOptions = require('../CodeBlock/codeLanguageOptions.js');
1
+ require("../_virtual/_rolldown/runtime.js");
2
+ const require_EmbedErrorPlaceholder = require("./EmbedErrorPlaceholder.js");
3
+ const require_CodeBlock = require("../CodeBlock/CodeBlock.js");
4
+ const require_codeLanguageOptions = require("../CodeBlock/codeLanguageOptions.js");
5
5
  let _ndla_primitives = require("@ndla/primitives");
6
6
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
7
7
  let react = require("react");
8
8
  let react_i18next = require("react-i18next");
9
9
  let _ndla_icons = require("@ndla/icons");
10
10
  let react_jsx_runtime = require("react/jsx-runtime");
11
-
12
11
  //#region src/Embed/CodeEmbed.tsx
13
12
  /**
14
13
  * Copyright (c) 2023-present, NDLA.
@@ -62,7 +61,7 @@ const CodeEmbed = ({ embed }) => {
62
61
  ]
63
62
  });
64
63
  };
65
-
66
64
  //#endregion
67
65
  exports.CodeEmbed = CodeEmbed;
66
+
68
67
  //# sourceMappingURL=CodeEmbed.js.map
@@ -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 { 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 { useEffect, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { CodeBlock } from \"../CodeBlock/CodeBlock\";\nimport { codeLanguageOptions, type ICodeLangugeOption } from \"../CodeBlock/codeLanguageOptions\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\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,uDAA0B,cAAc,EAC5C,MAAM;CACJ,WAAW;CACX,YAAY;CACb,EACF,CAAC;AAEF,MAAM,mDAAsBA,yBAAQ,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,0BAAY,GAAG,2CAACC,6BAAe,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 { 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 { useEffect, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { CodeBlock } from \"../CodeBlock/CodeBlock\";\nimport { codeLanguageOptions, type ICodeLangugeOption } from \"../CodeBlock/codeLanguageOptions\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\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,oBAAA,GAAA,wBAAA,QAA0B,cAAc,EAC5C,MAAM;CACJ,WAAW;CACX,YAAY;CACb,EACF,CAAC;AAEF,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAAQ,EAClC,MAAM;CACJ,OAAO;CAEP,mCAAmC,EACjC,kBAAkB,UACnB;CACF,EACF,CAAC;AAEF,MAAM,sBAAsB,WAAmB;CAC7C,MAAM,mBAAmBC,4BAAAA,oBAAoB,MAAM,SAA6B,KAAK,WAAW,OAAO;AACvG,KAAI,iBACF,QAAO,iBAAiB;;AAK5B,MAAa,aAAa,EAAE,YAAmB;CAC7C,MAAM,CAAC,UAAU,gBAAA,GAAA,MAAA,UAAwB,MAAM;CAC/C,MAAM,EAAE,OAAA,GAAA,cAAA,iBAAsB;AAE9B,EAAA,GAAA,MAAA,iBAAgB;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,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD,EAAuB,MAAK,QAAS,CAAA;AAG9C,QACE,iBAAA,GAAA,kBAAA,MAAC,cAAD;EAAc,mBAAgB;YAA9B;GACE,iBAAA,GAAA,kBAAA,KAAC,kBAAD,EAAA,UAAmB,MAAM,UAAU,SAAS,mBAAmB,MAAM,UAAU,WAAW,EAAoB,CAAA;GAC9G,iBAAA,GAAA,kBAAA,KAACC,kBAAAA,WAAD;IACE,iBAAiB,MAAM,WAAW,YAAY,MAAM,KAAK,kBAAkB;IAC3E,QAAQ,MAAM,UAAU;IACxB,CAAA;GACF,iBAAA,GAAA,kBAAA,MAACC,iBAAAA,QAAD;IACE,SAAQ;IACR,SAAS,YAAY;AACnB,SAAI,MAAM,WAAW,UACnB,KAAI;AACF,YAAM,UAAU,UAAU,UAAU,MAAM,KAAK,eAAe;AAC9D,kBAAY,KAAK;aACX;;cAPd,CAaG,WAAW,iBAAA,GAAA,kBAAA,KAACC,YAAAA,WAAD,EAAa,CAAA,GAAG,iBAAA,GAAA,kBAAA,KAACC,YAAAA,cAAD,EAAgB,CAAA,EAC3C,WAAW,EAAE,uBAAuB,GAAG,EAAE,qBAAqB,CACxD;;GACI"}
@@ -1,8 +1,8 @@
1
- const require_runtime = require('../_virtual/_rolldown/runtime.js');
2
- const require_EmbedErrorPlaceholder = require('./EmbedErrorPlaceholder.js');
3
- const require_Concept = require('../Concept/Concept.js');
4
- const require_ConceptInlineTriggerButton = require('./ConceptInlineTriggerButton.js');
5
- const require_GlossEmbed = require('./GlossEmbed.js');
1
+ const require_runtime = require("../_virtual/_rolldown/runtime.js");
2
+ const require_EmbedErrorPlaceholder = require("./EmbedErrorPlaceholder.js");
3
+ const require_Concept = require("../Concept/Concept.js");
4
+ const require_ConceptInlineTriggerButton = require("./ConceptInlineTriggerButton.js");
5
+ const require_GlossEmbed = require("./GlossEmbed.js");
6
6
  let _ndla_primitives = require("@ndla/primitives");
7
7
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
8
8
  let react = require("react");
@@ -10,7 +10,6 @@ let html_react_parser = require("html-react-parser");
10
10
  html_react_parser = require_runtime.__toESM(html_react_parser);
11
11
  let react_jsx_runtime = require("react/jsx-runtime");
12
12
  let _ark_ui_react = require("@ark-ui/react");
13
-
14
13
  //#region src/Embed/ConceptEmbed.tsx
15
14
  /**
16
15
  * Copyright (c) 2024-present, NDLA.
@@ -85,9 +84,9 @@ const BlockConcept = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, r
85
84
  "data-embed-type": "concept",
86
85
  ref
87
86
  }));
88
-
89
87
  //#endregion
90
88
  exports.BlockConcept = BlockConcept;
91
89
  exports.ConceptEmbed = ConceptEmbed;
92
90
  exports.InlineConcept = InlineConcept;
91
+
93
92
  //# sourceMappingURL=ConceptEmbed.js.map
@@ -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 { 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 parse from \"html-react-parser\";\nimport { forwardRef, useMemo, useRef, type ReactNode } from \"react\";\nimport { Concept, type ConceptProps } from \"../Concept/Concept\";\nimport { ConceptInlineTriggerButton } from \"./ConceptInlineTriggerButton\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport { GlossEmbed } from \"./GlossEmbed\";\nimport type { RenderContext } from \"./types\";\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}>{children}</GlossEmbed>;\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,2DAA8BA,iCAAgB,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;EAAkB;EAAQ;GAAsB;AAG1D,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,QAAQ,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,kCACC,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 { 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 parse from \"html-react-parser\";\nimport { forwardRef, useMemo, useRef, type ReactNode } from \"react\";\nimport { Concept, type ConceptProps } from \"../Concept/Concept\";\nimport { ConceptInlineTriggerButton } from \"./ConceptInlineTriggerButton\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport { GlossEmbed } from \"./GlossEmbed\";\nimport type { RenderContext } from \"./types\";\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}>{children}</GlossEmbed>;\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,wBAAA,GAAA,wBAAA,QAA8BA,iBAAAA,gBAAgB,EAClD,MAAM;CACJ,OAAO;CACP,WAAW;CACX,WAAW;CACZ,EACF,CAAC;AAEF,MAAa,gBAAgB,EAAE,OAAO,eAAe,MAAM,YAAY,eAAsB;CAC3F,MAAM,iBAAA,GAAA,MAAA,eAA8B;AAClC,MAAI,MAAM,WAAW,WAAW,CAAC,MAAM,KAAK,QAAQ,QAAS,QAAO,KAAA;AACpE,UAAA,GAAA,kBAAA,SAAa,MAAM,KAAK,QAAQ,QAAQ,YAAY;IACnD,CAAC,MAAM,CAAC;CAEX,MAAM,eAAA,GAAA,MAAA,eACG,MAAM,WAAW,aAAA,GAAA,kBAAA,SAAkB,MAAM,KAAK,QAAQ,MAAM,UAAU,GAAG,KAAA,GAChF,CAAC,MAAM,CACR;AAED,KAAI,MAAM,WAAW,WAAW,MAAM,UAAU,SAAS,SACvD,QAAO,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAO,UAAgB,CAAA;AAEhC,KAAI,MAAM,WAA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OAAO,QAC7E,iBAAA,GAAA,kBAAA,KAACA,gBAAAA,SAAD;CAAS,GAAI;CAAO,mBAAgB;CAAe;CAAO,CAAA,CAC1D"}
@@ -1,7 +1,5 @@
1
- const require_runtime = require('../_virtual/_rolldown/runtime.js');
2
- const require_InlineTriggerButton = require('./InlineTriggerButton.js');
3
- let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
4
-
1
+ require("../_virtual/_rolldown/runtime.js");
2
+ const require_InlineTriggerButton = require("./InlineTriggerButton.js");
5
3
  //#region src/Embed/ConceptInlineTriggerButton.tsx
6
4
  /**
7
5
  * Copyright (c) 2024-present, NDLA.
@@ -10,7 +8,7 @@ let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
10
8
  * LICENSE file in the root directory of this source tree.
11
9
  *
12
10
  */
13
- const ConceptInlineTriggerButton = (0, _ndla_styled_system_jsx.styled)(require_InlineTriggerButton.InlineTriggerButton, { base: {
11
+ const ConceptInlineTriggerButton = (0, require("@ndla/styled-system/jsx").styled)(require_InlineTriggerButton.InlineTriggerButton, { base: {
14
12
  position: "relative",
15
13
  overflow: "visible",
16
14
  borderBottom: "1px solid",
@@ -42,7 +40,7 @@ const ConceptInlineTriggerButton = (0, _ndla_styled_system_jsx.styled)(require_I
42
40
  }
43
41
  }
44
42
  } });
45
-
46
43
  //#endregion
47
44
  exports.ConceptInlineTriggerButton = ConceptInlineTriggerButton;
45
+
48
46
  //# sourceMappingURL=ConceptInlineTriggerButton.js.map