@ndla/ui 56.0.135-alpha.0 → 56.0.136

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 (231) hide show
  1. package/es/Article/{Article.js → Article.mjs} +3 -3
  2. package/es/Article/Article.mjs.map +1 -0
  3. package/es/Article/{ArticleByline.js → ArticleByline.mjs} +2 -2
  4. package/es/Article/ArticleByline.mjs.map +1 -0
  5. package/es/Article/{ArticleFootNotes.js → ArticleFootNotes.mjs} +1 -1
  6. package/es/Article/ArticleFootNotes.mjs.map +1 -0
  7. package/es/AudioPlayer/{AudioPlayer.js → AudioPlayer.mjs} +3 -3
  8. package/es/AudioPlayer/AudioPlayer.mjs.map +1 -0
  9. package/es/AudioPlayer/{Controls.js → Controls.mjs} +1 -1
  10. package/es/AudioPlayer/Controls.mjs.map +1 -0
  11. package/es/AudioPlayer/{SpeechControl.js → SpeechControl.mjs} +1 -1
  12. package/es/AudioPlayer/SpeechControl.mjs.map +1 -0
  13. package/es/AudioPlayer/{index.js → index.mjs} +2 -2
  14. package/es/AudioPlayer/index.mjs.map +1 -0
  15. package/es/Breadcrumb/{Breadcrumb.js → Breadcrumb.mjs} +2 -2
  16. package/es/Breadcrumb/Breadcrumb.mjs.map +1 -0
  17. package/es/Breadcrumb/{BreadcrumbItem.js → BreadcrumbItem.mjs} +1 -1
  18. package/es/Breadcrumb/BreadcrumbItem.mjs.map +1 -0
  19. package/es/Breadcrumb/{HomeBreadcrumb.js → HomeBreadcrumb.mjs} +2 -2
  20. package/es/Breadcrumb/HomeBreadcrumb.mjs.map +1 -0
  21. package/es/Breadcrumb/{index.js → index.mjs} +3 -3
  22. package/es/Breadcrumb/index.mjs.map +1 -0
  23. package/es/CampaignBlock/{CampaignBlock.js → CampaignBlock.mjs} +2 -2
  24. package/es/CampaignBlock/CampaignBlock.mjs.map +1 -0
  25. package/es/CodeBlock/{CodeBlock.js → CodeBlock.mjs} +1 -1
  26. package/es/CodeBlock/CodeBlock.mjs.map +1 -0
  27. package/es/CodeBlock/{codeLanguageOptions.js → codeLanguageOptions.mjs} +1 -1
  28. package/es/CodeBlock/codeLanguageOptions.mjs.map +1 -0
  29. package/es/Concept/{Concept.js → Concept.mjs} +8 -8
  30. package/es/Concept/Concept.mjs.map +1 -0
  31. package/es/ContactBlock/{ContactBlock.js → ContactBlock.mjs} +2 -2
  32. package/es/ContactBlock/ContactBlock.mjs.map +1 -0
  33. package/es/ContentTypeBadge/{ContentTypeBadge.js → ContentTypeBadge.mjs} +2 -2
  34. package/es/ContentTypeBadge/ContentTypeBadge.mjs.map +1 -0
  35. package/es/ContentTypeBlockQuote/{ContentTypeBlockQuote.js → ContentTypeBlockQuote.mjs} +1 -1
  36. package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.mjs.map +1 -0
  37. package/es/ContentTypeFramedContent/{ContentTypeFramedContent.js → ContentTypeFramedContent.mjs} +1 -1
  38. package/es/ContentTypeFramedContent/ContentTypeFramedContent.mjs.map +1 -0
  39. package/es/ContentTypeHero/{ContentTypeHero.js → ContentTypeHero.mjs} +2 -2
  40. package/es/ContentTypeHero/ContentTypeHero.mjs.map +1 -0
  41. package/es/CopyParagraphButton/{CopyParagraphButton.js → CopyParagraphButton.mjs} +1 -1
  42. package/es/CopyParagraphButton/CopyParagraphButton.mjs.map +1 -0
  43. package/es/CopyParagraphButton/{index.js → index.mjs} +2 -2
  44. package/es/CopyParagraphButton/index.mjs.map +1 -0
  45. package/es/Embed/{AudioEmbed.js → AudioEmbed.mjs} +5 -5
  46. package/es/Embed/AudioEmbed.mjs.map +1 -0
  47. package/es/Embed/{BrightcoveEmbed.js → BrightcoveEmbed.mjs} +4 -4
  48. package/es/Embed/BrightcoveEmbed.mjs.map +1 -0
  49. package/es/Embed/{CodeEmbed.js → CodeEmbed.mjs} +4 -4
  50. package/es/Embed/CodeEmbed.mjs.map +1 -0
  51. package/es/Embed/{ConceptEmbed.js → ConceptEmbed.mjs} +5 -5
  52. package/es/Embed/ConceptEmbed.mjs.map +1 -0
  53. package/es/Embed/{ConceptInlineTriggerButton.js → ConceptInlineTriggerButton.mjs} +2 -2
  54. package/es/Embed/ConceptInlineTriggerButton.mjs.map +1 -0
  55. package/es/Embed/{ContentLinkEmbed.js → ContentLinkEmbed.mjs} +1 -1
  56. package/es/Embed/ContentLinkEmbed.mjs.map +1 -0
  57. package/es/Embed/{CopyrightEmbed.js → CopyrightEmbed.mjs} +2 -2
  58. package/es/Embed/CopyrightEmbed.mjs.map +1 -0
  59. package/es/Embed/{EmbedErrorPlaceholder.js → EmbedErrorPlaceholder.mjs} +2 -2
  60. package/es/Embed/EmbedErrorPlaceholder.mjs.map +1 -0
  61. package/es/Embed/{EmbedWrapper.js → EmbedWrapper.mjs} +1 -1
  62. package/es/Embed/EmbedWrapper.mjs.map +1 -0
  63. package/es/Embed/{ExternalEmbed.js → ExternalEmbed.mjs} +3 -3
  64. package/es/Embed/ExternalEmbed.mjs.map +1 -0
  65. package/es/Embed/{FootnoteEmbed.js → FootnoteEmbed.mjs} +1 -1
  66. package/es/Embed/FootnoteEmbed.mjs.map +1 -0
  67. package/es/Embed/{GlossEmbed.js → GlossEmbed.mjs} +4 -4
  68. package/es/Embed/GlossEmbed.mjs.map +1 -0
  69. package/es/Embed/{H5pEmbed.js → H5pEmbed.mjs} +2 -2
  70. package/es/Embed/H5pEmbed.mjs.map +1 -0
  71. package/es/Embed/{IframeEmbed.js → IframeEmbed.mjs} +3 -3
  72. package/es/Embed/IframeEmbed.mjs.map +1 -0
  73. package/es/Embed/{ImageEmbed.js → ImageEmbed.mjs} +4 -4
  74. package/es/Embed/ImageEmbed.mjs.map +1 -0
  75. package/es/Embed/{InlineTriggerButton.js → InlineTriggerButton.mjs} +1 -1
  76. package/es/Embed/InlineTriggerButton.mjs.map +1 -0
  77. package/es/Embed/{RelatedContentEmbed.js → RelatedContentEmbed.mjs} +3 -3
  78. package/es/Embed/RelatedContentEmbed.mjs.map +1 -0
  79. package/es/Embed/{UnknownEmbed.js → UnknownEmbed.mjs} +1 -1
  80. package/es/Embed/UnknownEmbed.mjs.map +1 -0
  81. package/es/Embed/{UuDisclaimerEmbed.js → UuDisclaimerEmbed.mjs} +1 -1
  82. package/es/Embed/UuDisclaimerEmbed.mjs.map +1 -0
  83. package/es/ErrorMessage/{ErrorMessage.js → ErrorMessage.mjs} +1 -1
  84. package/es/ErrorMessage/ErrorMessage.mjs.map +1 -0
  85. package/es/ErrorMessage/{index.js → index.mjs} +2 -2
  86. package/es/ErrorMessage/index.mjs.map +1 -0
  87. package/es/FactBox/{FactBox.js → FactBox.mjs} +1 -1
  88. package/es/FactBox/FactBox.mjs.map +1 -0
  89. package/es/FactBox/{index.js → index.mjs} +2 -2
  90. package/es/FactBox/index.mjs.map +1 -0
  91. package/es/FileList/{File.js → File.mjs} +2 -2
  92. package/es/FileList/File.mjs.map +1 -0
  93. package/es/FileList/{FileList.js → FileList.mjs} +1 -1
  94. package/es/FileList/FileList.mjs.map +1 -0
  95. package/es/FileList/{PdfFile.js → PdfFile.mjs} +1 -1
  96. package/es/FileList/PdfFile.mjs.map +1 -0
  97. package/es/Gloss/{Gloss.js → Gloss.mjs} +3 -3
  98. package/es/Gloss/Gloss.mjs.map +1 -0
  99. package/es/Gloss/{GlossExample.js → GlossExample.mjs} +1 -1
  100. package/es/Gloss/GlossExample.mjs.map +1 -0
  101. package/es/Grid/{Grid.js → Grid.mjs} +1 -1
  102. package/es/Grid/Grid.mjs.map +1 -0
  103. package/es/Grid/{GridParallaxItem.js → GridParallaxItem.mjs} +1 -1
  104. package/es/Grid/GridParallaxItem.mjs.map +1 -0
  105. package/es/KeyFigure/{KeyFigure.js → KeyFigure.mjs} +1 -1
  106. package/es/KeyFigure/KeyFigure.mjs.map +1 -0
  107. package/es/LicenseByline/{EmbedByline.js → EmbedByline.mjs} +2 -2
  108. package/es/LicenseByline/EmbedByline.mjs.map +1 -0
  109. package/es/LicenseByline/{LicenseLink.js → LicenseLink.mjs} +1 -1
  110. package/es/LicenseByline/LicenseLink.mjs.map +1 -0
  111. package/es/LinkBlock/{LinkBlock.js → LinkBlock.mjs} +2 -2
  112. package/es/LinkBlock/LinkBlock.mjs.map +1 -0
  113. package/es/LinkBlock/{LinkBlockSection.js → LinkBlockSection.mjs} +1 -1
  114. package/es/LinkBlock/LinkBlockSection.mjs.map +1 -0
  115. package/es/Pitch/{Pitch.js → Pitch.mjs} +2 -2
  116. package/es/Pitch/Pitch.mjs.map +1 -0
  117. package/es/RelatedArticleList/{RelatedArticleList.js → RelatedArticleList.mjs} +3 -3
  118. package/es/RelatedArticleList/RelatedArticleList.mjs.map +1 -0
  119. package/es/RelatedArticleList/{index.js → index.mjs} +2 -2
  120. package/es/RelatedArticleList/index.mjs.map +1 -0
  121. package/es/ResourceBox/{ResourceBox.js → ResourceBox.mjs} +1 -1
  122. package/es/ResourceBox/ResourceBox.mjs.map +1 -0
  123. package/es/TagSelector/{TagSelector.js → TagSelector.mjs} +1 -1
  124. package/es/TagSelector/TagSelector.mjs.map +1 -0
  125. package/es/ZendeskButton/{ZendeskButton.js → ZendeskButton.mjs} +1 -1
  126. package/es/ZendeskButton/ZendeskButton.mjs.map +1 -0
  127. package/es/i18n/{formatNestedMessages.js → formatNestedMessages.mjs} +1 -1
  128. package/es/i18n/formatNestedMessages.mjs.map +1 -0
  129. package/es/i18n/{useComponentTranslations.js → useComponentTranslations.mjs} +1 -1
  130. package/es/i18n/useComponentTranslations.mjs.map +1 -0
  131. package/es/{index.js → index.mjs} +62 -62
  132. package/es/locale/{messages-en.js → messages-en.mjs} +2 -2
  133. package/es/locale/messages-en.mjs.map +1 -0
  134. package/es/locale/{messages-nb.js → messages-nb.mjs} +2 -2
  135. package/es/locale/messages-nb.mjs.map +1 -0
  136. package/es/locale/{messages-nn.js → messages-nn.mjs} +2 -2
  137. package/es/locale/messages-nn.mjs.map +1 -0
  138. package/es/locale/{messages-se.js → messages-se.mjs} +2 -2
  139. package/es/locale/messages-se.mjs.map +1 -0
  140. package/es/model/{ContentType.js → ContentType.mjs} +1 -1
  141. package/es/model/ContentType.mjs.map +1 -0
  142. package/es/model/{SubjectCategories.js → SubjectCategories.mjs} +2 -2
  143. package/es/model/SubjectCategories.mjs.map +1 -0
  144. package/es/model/{SubjectTypes.js → SubjectTypes.mjs} +2 -2
  145. package/es/model/SubjectTypes.mjs.map +1 -0
  146. package/es/model/{WordClass.js → WordClass.mjs} +2 -2
  147. package/es/model/WordClass.mjs.map +1 -0
  148. package/es/model/{index.js → index.mjs} +5 -5
  149. package/es/model/index.mjs.map +1 -0
  150. package/es/utils/{licenseAttributes.js → licenseAttributes.mjs} +1 -1
  151. package/es/utils/licenseAttributes.mjs.map +1 -0
  152. package/es/utils/{relativeUrl.js → relativeUrl.mjs} +1 -1
  153. package/es/utils/relativeUrl.mjs.map +1 -0
  154. package/package.json +16 -13
  155. package/es/Article/Article.js.map +0 -1
  156. package/es/Article/ArticleByline.js.map +0 -1
  157. package/es/Article/ArticleFootNotes.js.map +0 -1
  158. package/es/AudioPlayer/AudioPlayer.js.map +0 -1
  159. package/es/AudioPlayer/Controls.js.map +0 -1
  160. package/es/AudioPlayer/SpeechControl.js.map +0 -1
  161. package/es/AudioPlayer/index.js.map +0 -1
  162. package/es/Breadcrumb/Breadcrumb.js.map +0 -1
  163. package/es/Breadcrumb/BreadcrumbItem.js.map +0 -1
  164. package/es/Breadcrumb/HomeBreadcrumb.js.map +0 -1
  165. package/es/Breadcrumb/index.js.map +0 -1
  166. package/es/CampaignBlock/CampaignBlock.js.map +0 -1
  167. package/es/CodeBlock/CodeBlock.js.map +0 -1
  168. package/es/CodeBlock/codeLanguageOptions.js.map +0 -1
  169. package/es/Concept/Concept.js.map +0 -1
  170. package/es/ContactBlock/ContactBlock.js.map +0 -1
  171. package/es/ContentTypeBadge/ContentTypeBadge.js.map +0 -1
  172. package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +0 -1
  173. package/es/ContentTypeFramedContent/ContentTypeFramedContent.js.map +0 -1
  174. package/es/ContentTypeHero/ContentTypeHero.js.map +0 -1
  175. package/es/CopyParagraphButton/CopyParagraphButton.js.map +0 -1
  176. package/es/CopyParagraphButton/index.js.map +0 -1
  177. package/es/Embed/AudioEmbed.js.map +0 -1
  178. package/es/Embed/BrightcoveEmbed.js.map +0 -1
  179. package/es/Embed/CodeEmbed.js.map +0 -1
  180. package/es/Embed/ConceptEmbed.js.map +0 -1
  181. package/es/Embed/ConceptInlineTriggerButton.js.map +0 -1
  182. package/es/Embed/ContentLinkEmbed.js.map +0 -1
  183. package/es/Embed/CopyrightEmbed.js.map +0 -1
  184. package/es/Embed/EmbedErrorPlaceholder.js.map +0 -1
  185. package/es/Embed/EmbedWrapper.js.map +0 -1
  186. package/es/Embed/ExternalEmbed.js.map +0 -1
  187. package/es/Embed/FootnoteEmbed.js.map +0 -1
  188. package/es/Embed/GlossEmbed.js.map +0 -1
  189. package/es/Embed/H5pEmbed.js.map +0 -1
  190. package/es/Embed/IframeEmbed.js.map +0 -1
  191. package/es/Embed/ImageEmbed.js.map +0 -1
  192. package/es/Embed/InlineTriggerButton.js.map +0 -1
  193. package/es/Embed/RelatedContentEmbed.js.map +0 -1
  194. package/es/Embed/UnknownEmbed.js.map +0 -1
  195. package/es/Embed/UuDisclaimerEmbed.js.map +0 -1
  196. package/es/ErrorMessage/ErrorMessage.js.map +0 -1
  197. package/es/ErrorMessage/index.js.map +0 -1
  198. package/es/FactBox/FactBox.js.map +0 -1
  199. package/es/FactBox/index.js.map +0 -1
  200. package/es/FileList/File.js.map +0 -1
  201. package/es/FileList/FileList.js.map +0 -1
  202. package/es/FileList/PdfFile.js.map +0 -1
  203. package/es/Gloss/Gloss.js.map +0 -1
  204. package/es/Gloss/GlossExample.js.map +0 -1
  205. package/es/Grid/Grid.js.map +0 -1
  206. package/es/Grid/GridParallaxItem.js.map +0 -1
  207. package/es/KeyFigure/KeyFigure.js.map +0 -1
  208. package/es/LicenseByline/EmbedByline.js.map +0 -1
  209. package/es/LicenseByline/LicenseLink.js.map +0 -1
  210. package/es/LinkBlock/LinkBlock.js.map +0 -1
  211. package/es/LinkBlock/LinkBlockSection.js.map +0 -1
  212. package/es/Pitch/Pitch.js.map +0 -1
  213. package/es/RelatedArticleList/RelatedArticleList.js.map +0 -1
  214. package/es/RelatedArticleList/index.js.map +0 -1
  215. package/es/ResourceBox/ResourceBox.js.map +0 -1
  216. package/es/TagSelector/TagSelector.js.map +0 -1
  217. package/es/ZendeskButton/ZendeskButton.js.map +0 -1
  218. package/es/i18n/formatNestedMessages.js.map +0 -1
  219. package/es/i18n/useComponentTranslations.js.map +0 -1
  220. package/es/locale/messages-en.js.map +0 -1
  221. package/es/locale/messages-nb.js.map +0 -1
  222. package/es/locale/messages-nn.js.map +0 -1
  223. package/es/locale/messages-se.js.map +0 -1
  224. package/es/model/ContentType.js.map +0 -1
  225. package/es/model/SubjectCategories.js.map +0 -1
  226. package/es/model/SubjectTypes.js.map +0 -1
  227. package/es/model/WordClass.js.map +0 -1
  228. package/es/model/index.js.map +0 -1
  229. package/es/utils/licenseAttributes.js.map +0 -1
  230. package/es/utils/relativeUrl.js.map +0 -1
  231. /package/es/_virtual/{rolldown_runtime.js → rolldown_runtime.mjs} +0 -0
@@ -1,5 +1,5 @@
1
- import { ContentTypeBadge } from "../ContentTypeBadge/ContentTypeBadge.js";
2
- import { ArticleByline } from "./ArticleByline.js";
1
+ import { ContentTypeBadge } from "../ContentTypeBadge/ContentTypeBadge.mjs";
2
+ import { ArticleByline } from "./ArticleByline.mjs";
3
3
  import { forwardRef } from "react";
4
4
  import { Heading, Text } from "@ndla/primitives";
5
5
  import { Stack, styled } from "@ndla/styled-system/jsx";
@@ -125,4 +125,4 @@ const Article = ({ article, contentType, licenseBox, children, competenceGoals,
125
125
 
126
126
  //#endregion
127
127
  export { Article, ArticleContent, ArticleFooter, ArticleHGroup, ArticleHeader, ArticleTitle, ArticleWrapper };
128
- //# sourceMappingURL=Article.js.map
128
+ //# sourceMappingURL=Article.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Article.mjs","names":[],"sources":["../../src/Article/Article.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 { type ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\";\nimport { Heading, Text } from \"@ndla/primitives\";\nimport { cx } from \"@ndla/styled-system/css\";\nimport { Stack, styled } from \"@ndla/styled-system/jsx\";\nimport type { JsxStyleProps } from \"@ndla/styled-system/types\";\nimport { ArticleByline } from \"./ArticleByline\";\nimport { ContentTypeBadge, type ContentType } from \"../ContentTypeBadge/ContentTypeBadge\";\nimport type { Article as ArticleType } from \"../types\";\n\nconst StyledArticleContent = styled(ark.section, {}, { baseComponent: true });\n\nexport const ArticleContent = forwardRef<HTMLElement, HTMLArkProps<\"div\"> & JsxStyleProps>(\n ({ className, ...props }, ref) => (\n <StyledArticleContent className={cx(\"ndla-article\", className)} {...props} ref={ref} />\n ),\n);\n\nconst StyledArticleWrapper = styled(\n ark.article,\n {\n base: {\n background: \"background.default\",\n display: \"flex\",\n flexDirection: \"column\",\n color: \"text.default\",\n alignItems: \"center\",\n width: \"100%\",\n overflowWrap: \"break-word\",\n position: \"relative\",\n \"& mjx-stretchy-v > mjx-ext > mjx-c\": {\n transform: \"scaleY(100) translateY(0.075em)\",\n },\n _after: {\n content: \"\",\n display: \"table\",\n clear: \"both\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleWrapper = forwardRef<HTMLElement, ComponentPropsWithRef<\"article\"> & JsxStyleProps>(\n (props, ref) => <StyledArticleWrapper data-ndla-article=\"\" ref={ref} {...props} />,\n);\n\nexport const ArticleHGroup = styled(\n ark.hgroup,\n {\n base: {\n display: \"flex\",\n width: \"100%\",\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n \"& h1\": {\n overflowWrap: \"anywhere\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleHeader = styled(\n ark.header,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n alignItems: \"flex-start\",\n width: \"100%\",\n paddingBlockStart: \"xxlarge\",\n overflowWrap: \"anywhere\",\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleFooter = styled(\n ark.footer,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xxlarge\",\n width: \"100%\",\n \"& > :is(:last-child)\": {\n paddingBlockEnd: \"5xlarge\",\n },\n },\n },\n { baseComponent: true },\n);\n\nconst StyledStack = styled(Stack, {\n base: {\n width: \"100%\",\n minHeight: \"xxlarge\",\n },\n});\n\nconst StyledWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"small\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n },\n});\n\ninterface ArticleTitleProps {\n heartButton?: ReactNode;\n contentType?: ContentType;\n contentTypeLabel?: ReactNode;\n competenceGoals?: ReactNode;\n id: string;\n lang?: string;\n title?: ReactNode;\n introduction?: ReactNode;\n disclaimer?: ReactNode;\n}\n\nexport const ArticleTitle = ({\n contentType,\n heartButton,\n title,\n lang,\n id,\n introduction,\n contentTypeLabel,\n competenceGoals,\n disclaimer,\n}: ArticleTitleProps) => {\n return (\n <ArticleHeader>\n <ArticleHGroup>\n {(!!contentType || !!heartButton) && (\n <StyledStack justify=\"space-between\" align=\"center\" direction=\"row\" gap=\"small\">\n {!!contentType && <ContentTypeBadge contentType={contentType}>{contentTypeLabel}</ContentTypeBadge>}\n {heartButton}\n </StyledStack>\n )}\n <Heading textStyle=\"heading.medium\" id={id} lang={lang} property=\"dct:title\">\n {title}\n </Heading>\n </ArticleHGroup>\n {!!introduction && (\n <Text lang={lang} textStyle=\"body.xlarge\" asChild consumeCss>\n <div>{introduction}</div>\n </Text>\n )}\n <StyledWrapper>\n {competenceGoals}\n {disclaimer}\n </StyledWrapper>\n </ArticleHeader>\n );\n};\n\ninterface Props {\n heartButton?: ReactNode;\n article: ArticleType;\n licenseBox?: ReactNode;\n contentType?: ContentType;\n contentTypeLabel?: ReactNode;\n children?: ReactNode;\n competenceGoals?: ReactNode;\n id: string;\n lang?: string;\n disclaimer?: ReactNode;\n}\n\nexport const Article = ({\n article,\n contentType,\n licenseBox,\n children,\n competenceGoals,\n contentTypeLabel,\n id,\n heartButton,\n lang,\n disclaimer,\n}: Props) => {\n const { title, introduction, published, content, footNotes, copyright } = article;\n\n const authors =\n copyright?.creators.length || copyright?.rightsholders.length ? copyright.creators : copyright?.processors;\n\n return (\n <ArticleWrapper>\n <ArticleTitle\n id={id}\n contentType={contentType}\n heartButton={heartButton}\n title={title}\n introduction={introduction}\n competenceGoals={competenceGoals}\n lang={lang}\n contentTypeLabel={contentTypeLabel}\n disclaimer={disclaimer}\n />\n <ArticleContent>{content}</ArticleContent>\n <ArticleFooter>\n <ArticleByline\n lang={lang}\n footnotes={footNotes}\n authors={authors}\n suppliers={copyright?.rightsholders}\n published={published}\n licenseBox={licenseBox}\n />\n {children}\n </ArticleFooter>\n </ArticleWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,uBAAuB,OAAO,IAAI,SAAS,CAAE,GAAE,EAAE,eAAe,KAAM,EAAC;AAE7E,MAAa,iBAAiB,WAC5B,CAAC,EAAE,UAAW,GAAG,OAAO,EAAE,wBACxB,IAAC;CAAqB,WAAW,GAAG,gBAAgB,UAAU;CAAE,GAAI;CAAY;EAAO,CAE1F;AAED,MAAM,uBAAuB,OAC3B,IAAI,SACJ,EACE,MAAM;CACJ,YAAY;CACZ,SAAS;CACT,eAAe;CACf,OAAO;CACP,YAAY;CACZ,OAAO;CACP,cAAc;CACd,UAAU;CACV,sCAAsC,EACpC,WAAW,kCACZ;CACD,QAAQ;EACN,SAAS;EACT,SAAS;EACT,OAAO;CACR;AACF,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,iBAAiB,WAC5B,CAAC,OAA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iBACA,kBACA,IACA,aACA,MACA,YACM,KAAK;CACX,MAAM,EAAE,OAAO,cAAc,WAAW,SAAS,WAAW,WAAW,GAAG;CAE1E,MAAM,UACJ,WAAW,SAAS,UAAU,WAAW,cAAc,SAAS,UAAU,WAAW,WAAW;AAElG,wBACE,KAAC;kBACC,IAAC;GACK;GACS;GACA;GACN;GACO;GACG;GACX;GACY;GACN;IACZ;kBACF,IAAC,4BAAgB,UAAyB;kBAC1C,KAAC,4CACC,IAAC;GACO;GACN,WAAW;GACF;GACT,WAAW,WAAW;GACX;GACC;IACZ,EACD,YACa;KACD;AAEpB"}
@@ -1,4 +1,4 @@
1
- import { ArticleFootNotes } from "./ArticleFootNotes.js";
1
+ import { ArticleFootNotes } from "./ArticleFootNotes.mjs";
2
2
  import { forwardRef, useCallback, useEffect, useState } from "react";
3
3
  import { AccordionItem, AccordionItemContent, AccordionItemIndicator, AccordionItemTrigger, AccordionRoot, Heading } from "@ndla/primitives";
4
4
  import { styled } from "@ndla/styled-system/jsx";
@@ -116,4 +116,4 @@ const ArticleBylineAccordionItem = forwardRef(({ value, accordionTitle, children
116
116
 
117
117
  //#endregion
118
118
  export { ArticleByline, ArticleBylineAccordionItem };
119
- //# sourceMappingURL=ArticleByline.js.map
119
+ //# sourceMappingURL=ArticleByline.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArticleByline.mjs","names":["list: SupplierProps[]","listFormatter: Intl.ListFormat","e: HashChangeEvent"],"sources":["../../src/Article/ArticleByline.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 { type ReactNode, forwardRef, useCallback, useEffect, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { useLocation } from \"react-router-dom\";\nimport { ArrowDownShortLine } from \"@ndla/icons\";\nimport {\n AccordionItem,\n AccordionItemContent,\n AccordionItemIndicator,\n type AccordionItemProps,\n AccordionItemTrigger,\n AccordionRoot,\n Heading,\n} from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { ArticleFootNotes } from \"./ArticleFootNotes\";\nimport type { FootNote } from \"../types\";\n\nconst Wrapper = styled(\"div\", {\n base: {\n // TODO: Figure out if we want to remove this margin. It's only here to add some gap between the article content and the byline.\n marginBlockStart: \"medium\",\n paddingBlockStart: \"xsmall\",\n borderTop: \"1px solid\",\n borderColor: \"stroke.subtle\",\n },\n});\n\nconst TextWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n width: \"100%\",\n justifyContent: \"space-between\",\n paddingBlock: \"xsmall\",\n textStyle: \"body.medium\",\n '& [data-contributors=\"false\"]': {\n marginInlineStart: \"auto\",\n },\n },\n variants: {\n learningpath: {\n true: {},\n false: {\n tabletWide: {\n flexDirection: \"row\",\n },\n },\n },\n },\n});\n\ntype AuthorProps = {\n name: string;\n};\n\ntype SupplierProps = {\n name: string;\n};\n\ntype Props = {\n lang?: string;\n authors?: AuthorProps[];\n suppliers?: SupplierProps[];\n published?: string;\n licenseBox?: ReactNode;\n footnotes?: FootNote[];\n displayByline?: boolean;\n bylineType?: \"article\" | \"learningPath\" | \"external\";\n bylineSuffix?: ReactNode;\n learningpathCopiedFrom?: string;\n};\n\nfunction formatList(list: SupplierProps[], listFormatter: Intl.ListFormat) {\n return listFormatter.format(list.map((l) => l.name));\n}\n\nconst StyledAccordionRoot = styled(AccordionRoot, {\n base: {\n paddingBlockStart: \"xxlarge\",\n },\n});\n\nconst refRegexp = /note\\d/;\nconst footnotesAccordionId = \"footnotes\";\n\nexport const ArticleByline = ({\n lang,\n authors = [],\n suppliers = [],\n footnotes,\n licenseBox,\n published,\n displayByline = true,\n bylineType = \"article\",\n bylineSuffix,\n learningpathCopiedFrom,\n}: Props) => {\n const { t } = useTranslation();\n const { pathname } = useLocation();\n const [openAccordions, setOpenAccordions] = useState<string[]>([]);\n const accordionItemValue = \"rulesForUse\";\n\n const onHashChange = useCallback(\n (e: HashChangeEvent) => {\n const hash = e.newURL.split(\"#\")[1];\n if (hash?.match(refRegexp) && !openAccordions.includes(footnotesAccordionId)) {\n setOpenAccordions([...openAccordions, footnotesAccordionId]);\n const el = document.getElementById(`#${hash}`);\n el?.click();\n el?.focus();\n }\n },\n [openAccordions],\n );\n\n useEffect(() => {\n setOpenAccordions((prev) => prev.filter((state) => state !== accordionItemValue));\n }, [pathname]);\n\n useEffect(() => {\n window.addEventListener(\"hashchange\", onHashChange);\n return () => window.removeEventListener(\"hashchange\", onHashChange);\n }, [onHashChange]);\n\n const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;\n const listFormatter = new Intl.ListFormat(lang, { style: \"long\", type: \"conjunction\" });\n\n return (\n <Wrapper>\n {!!displayByline && (\n <TextWrapper learningpath={bylineType === \"learningPath\"}>\n {!!showPrimaryContributors && (\n <span>\n {authors.length > 0 &&\n `${t(\"article.authorsLabel\", { context: bylineType })} ${formatList(authors, listFormatter)}. `}\n {suppliers.length > 0 &&\n `${t(\"article.supplierLabel\", { count: suppliers.length })} ${formatList(suppliers, listFormatter)}.`}\n </span>\n )}\n {learningpathCopiedFrom ? (\n <SafeLink to={learningpathCopiedFrom}>{t(`learningPath.copiedFrom`)}</SafeLink>\n ) : null}\n {published ? (\n <div data-contributors={showPrimaryContributors}>\n {t(`${bylineType}.lastUpdated`)} {published}\n </div>\n ) : null}\n {bylineSuffix}\n </TextWrapper>\n )}\n {(!!licenseBox || !!footnotes?.length) && (\n <StyledAccordionRoot\n multiple\n value={openAccordions}\n onValueChange={(details) => setOpenAccordions(details.value)}\n >\n {!!licenseBox && (\n <ArticleBylineAccordionItem value={accordionItemValue} accordionTitle={t(\"article.useContent\")}>\n {licenseBox}\n </ArticleBylineAccordionItem>\n )}\n {!!footnotes?.length && (\n <ArticleBylineAccordionItem value={footnotesAccordionId} accordionTitle={t(\"article.footnotes\")}>\n <ArticleFootNotes footNotes={footnotes} />\n </ArticleBylineAccordionItem>\n )}\n </StyledAccordionRoot>\n )}\n </Wrapper>\n );\n};\n\ninterface ArticleBylineAccordionprops extends AccordionItemProps {\n accordionTitle: ReactNode;\n}\n\nexport const ArticleBylineAccordionItem = forwardRef<HTMLDivElement, ArticleBylineAccordionprops>(\n ({ value, accordionTitle, children, ...props }, ref) => {\n return (\n <AccordionItem value={value} ref={ref} {...props}>\n <Heading asChild consumeCss textStyle=\"label.medium\" fontWeight=\"bold\">\n <h2>\n <AccordionItemTrigger>\n {accordionTitle}\n <AccordionItemIndicator asChild>\n <ArrowDownShortLine />\n </AccordionItemIndicator>\n </AccordionItemTrigger>\n </h2>\n </Heading>\n <AccordionItemContent>{children}</AccordionItemContent>\n </AccordionItem>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;AA0BA,MAAM,UAAU,OAAO,OAAO,EAC5B,MAAM;CAEJ,kBAAkB;CAClB,mBAAmB;CACnB,WAAW;CACX,aAAa;AACd,EACF,EAAC;AAEF,MAAM,cAAc,OAAO,OAAO;CAChC,MAAM;EACJ,SAAS;EACT,eAAe;EACf,KAAK;EACL,OAAO;EACP,gBAAgB;EAChB,cAAc;EACd,WAAW;EACX,mCAAiC,EAC/B,mBAAmB,OACpB;CACF;CACD,UAAU,EACR,cAAc;EACZ,MAAM,CAAE;EACR,OAAO,EACL,YAAY,EACV,eAAe,MAChB,EACF;CACF,EACF;AACF,EAAC;AAuBF,SAAS,WAAWA,MAAuBC,eAAgC;AACzE,QAAO,cAAc,OAAO,KAAK,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC;AACrD;AAED,MAAM,sBAAsB,OAAO,eAAe,EAChD,MAAM,EACJ,mBAAmB,UACpB,EACF,EAAC;AAEF,MAAM,YAAY;AAClB,MAAM,uBAAuB;AAE7B,MAAa,gBAAgB,CAAC,EAC5B,MACA,UAAU,CAAE,GACZ,YAAY,CAAE,GACd,WACA,YACA,WACA,gBAAgB,MAChB,aAA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ACH,4BACC,KAAC;IAAI,qBAAmB;;KACrB,GAAG,EAAE,WAAW,cAAc;KAAC;KAAE;;KAC9B,GACJ;GACH;;GACW,KAEZ,gBAAgB,WAAW,2BAC7B,KAAC;EACC;EACA,OAAO;EACP,eAAe,CAAC,YAAY,kBAAkB,QAAQ,MAAM;eAEzD,8BACD,IAAC;GAA2B,OAAO;GAAoB,gBAAgB,EAAE,qBAAqB;aAC3F;IAC0B,IAE5B,WAAW,0BACZ,IAAC;GAA2B,OAAO;GAAsB,gBAAgB,EAAE,oBAAoB;6BAC7F,IAAC,oBAAiB,WAAW,YAAa;IACf;GAEX,IAEhB;AAEb;AAMD,MAAa,6BAA6B,WACxC,CAAC,EAAE,OAAO,gBAAgB,SAAU,GAAG,OAAO,EAAE,QAAQ;AACtD,wBACE,KAAC;EAAqB;EAAY;EAAK,GAAI;6BACzC,IAAC;GAAQ;GAAQ;GAAW,WAAU;GAAe,YAAW;6BAC9D,IAAC,kCACC,KAAC,mCACE,gCACD,IAAC;IAAuB;8BACtB,IAAC,uBAAqB;KACC,IACJ,GACpB;IACG,kBACV,IAAC,wBAAsB,WAAgC;GACzC;AAEnB,EACF"}
@@ -37,4 +37,4 @@ const ArticleFootNotes = ({ footNotes }) => /* @__PURE__ */ jsx(FootnoteList, {
37
37
 
38
38
  //#endregion
39
39
  export { ArticleFootNotes };
40
- //# sourceMappingURL=ArticleFootNotes.js.map
40
+ //# sourceMappingURL=ArticleFootNotes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArticleFootNotes.mjs","names":["description: string | undefined"],"sources":["../../src/Article/ArticleFootNotes.tsx"],"sourcesContent":["/**\n * Copyright (c) 2017-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { FootNote as FootNoteType } from \"../types\";\n\nconst citeDetailString = (description: string | undefined) => (description ? `${description}. ` : \"\");\n\ntype FootNoteProps = {\n footNote: FootNoteType;\n};\n\nconst StyledCite = styled(\"cite\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"xsmall\",\n },\n});\n\nconst FootNote = ({ footNote }: FootNoteProps) => (\n <li>\n <Text id={`note${footNote.ref}`} asChild consumeCss textStyle=\"body.medium\">\n <StyledCite>\n <a href={`#ref${footNote.ref}`} target=\"_self\">\n {footNote.ref}\n </a>\n {`«${footNote.title}». ${footNote.authors.join(\" \")}. ${citeDetailString(footNote.edition)}${citeDetailString(\n footNote.publisher,\n )}${footNote.year}. `}\n {footNote.url ? (\n <a href={footNote.url}>\n {footNote.url}\n {\".\"}\n </a>\n ) : null}\n </StyledCite>\n </Text>\n </li>\n);\n\ntype ArticleFootNotesProps = {\n footNotes: Array<FootNoteType>;\n};\n\nconst FootnoteList = styled(\"ol\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n listStyle: \"none\",\n },\n});\n\nexport const ArticleFootNotes = ({ footNotes }: ArticleFootNotesProps) => (\n <FootnoteList>\n {footNotes.map((footNote) => (\n <FootNote key={footNote.ref} footNote={footNote} />\n ))}\n </FootnoteList>\n);\n"],"mappings":";;;;;AAYA,MAAM,mBAAmB,CAACA,gBAAqC,eAAe,EAAE,YAAY,MAAM;AAMlG,MAAM,aAAa,OAAO,QAAQ,EAChC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,KAAK;AACN,EACF,EAAC;AAEF,MAAM,WAAW,CAAC,EAAE,UAAyB,qBAC3C,IAAC,kCACC,IAAC;CAAK,KAAK,MAAM,SAAS,IAAI;CAAG;CAAQ;CAAW,WAAU;2BAC5D,KAAC;kBACC,IAAC;GAAE,OAAO,MAAM,SAAS,IAAI;GAAG,QAAO;aACpC,SAAS;IACR;GACF,GAAG,SAAS,MAAM,KAAK,SAAS,QAAQ,KAAK,IAAI,CAAC,IAAI,iBAAiB,SAAS,QAAQ,CAAC,EAAE,iBAC3F,SAAS,UACV,CAAC,EAAE,SAAS,KAAK;EACjB,SAAS,sBACR,KAAC;GAAE,MAAM,SAAS;cACf,SAAS,KACT;IACC,GACF;KACO;EACR,GACJ;AAOP,MAAM,eAAe,OAAO,MAAM,EAChC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,WAAW;AACZ,EACF,EAAC;AAEF,MAAa,mBAAmB,CAAC,EAAE,WAAkC,qBACnE,IAAC,0BACE,UAAU,IAAI,CAAC,6BACd,IAAC,YAAsC,YAAxB,SAAS,IAA2B,CACnD,GACW"}
@@ -1,5 +1,5 @@
1
- import { Controls_default } from "./Controls.js";
2
- import { SpeechControl_default } from "./SpeechControl.js";
1
+ import { Controls_default } from "./Controls.mjs";
2
+ import { SpeechControl_default } from "./SpeechControl.mjs";
3
3
  import { useId, useMemo, useState } from "react";
4
4
  import { Button, Heading, Text } from "@ndla/primitives";
5
5
  import { styled } from "@ndla/styled-system/jsx";
@@ -154,4 +154,4 @@ var AudioPlayer_default = AudioPlayer;
154
154
 
155
155
  //#endregion
156
156
  export { AudioPlayer_default as AudioPlayer_default$1 };
157
- //# sourceMappingURL=AudioPlayer.js.map
157
+ //# sourceMappingURL=AudioPlayer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AudioPlayer.mjs","names":["SpeechControl","Controls"],"sources":["../../src/AudioPlayer/AudioPlayer.tsx"],"sourcesContent":["/**\n * Copyright (c) 2017-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ReactNode, useId, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Heading, Text, Button } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport Controls from \"./Controls\";\nimport SpeechControl from \"./SpeechControl\";\n\n// TODO: Could the audio metadata be more tightly coupled to the audio player?\n\nconst AudioPlayerWrapper = styled(\"div\", {\n base: {\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n boxShadow: \"full\",\n marginBlockEnd: \"4xsmall\",\n overflow: \"hidden\",\n },\n});\n\nconst InfoWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n tabletWideDown: {\n display: \"block\",\n },\n },\n});\n\nconst ImageWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n flex: \"1 0 auto\",\n width: \"surface.4xsmall\",\n height: \"surface.4xsmall\",\n overflow: \"hidden\",\n \"& img\": {\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n },\n desktop: {\n width: \"260px\",\n height: \"260px\",\n },\n tabletWideDown: {\n maxHeight: \"surface.small\",\n maxWidth: \"100%\",\n width: \"100%\",\n height: \"auto\",\n },\n },\n});\n\nconst TextWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"flex-start\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n padding: \"xsmall\",\n width: \"100%\",\n \"&[data-has-image='true']\": {\n tablet: {\n paddingBlock: \"xsmall\",\n paddingInline: \"medium\",\n },\n },\n },\n});\n\nconst TitleWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n fontFamily: \"sans\",\n tabletWide: {\n width: \"100%\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n },\n },\n});\n\nconst TextVersionWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n borderBlockStart: \"1px solid\",\n borderColor: \"stroke.default\",\n paddingBlock: \"medium\",\n paddingInline: \"xsmall\",\n tablet: {\n paddingInline: \"medium\",\n },\n },\n});\n\nconst TextVersionText = styled(\"div\", {\n base: {\n maxWidth: \"surface.xlarge\",\n \"& span > *\": {\n whiteSpace: \"pre-wrap\",\n },\n \"& p:not(:first-child):not(:last-child)\": {\n marginBlock: \"small\",\n },\n '& p[data-align=\"center\"]': {\n textAlign: \"center\",\n },\n '& p:has(span[dir=\"rtl\"])': {\n direction: \"rtl\",\n },\n },\n});\n\nconst TextVersionButton = styled(Button, {\n base: {\n alignSelf: \"flex-start\",\n },\n});\n\nconst ShowMoreButton = styled(Button, {\n base: {\n marginInlineStart: \"3xsmall\",\n },\n});\n\nconst DESCRIPTION_MAX_LENGTH = 200;\n\ntype Props = {\n src: string;\n title: string;\n subtitle?: {\n title: string;\n url?: string;\n };\n speech?: boolean;\n description?: string;\n textVersion?: ReactNode;\n img?: {\n url: string;\n alt: string;\n };\n};\n\nconst AudioPlayer = ({ src, title, subtitle, speech, description, img, textVersion }: Props) => {\n const { t } = useTranslation();\n const [showTextVersion, setShowTextVersion] = useState(false);\n const [showFullDescription, setShowFullDescription] = useState(false);\n const truncatedDescription = useMemo(() => description?.slice(0, DESCRIPTION_MAX_LENGTH), [description]);\n const textDescriptionId = useId();\n\n if (speech) {\n return <SpeechControl src={src} title={title} />;\n }\n\n const toggleTextVersion = () => {\n setShowTextVersion((curr) => !curr);\n };\n\n const textVersionButton = (\n <TextVersionButton\n variant=\"secondary\"\n aria-expanded={showTextVersion}\n aria-controls={textDescriptionId}\n size=\"small\"\n onClick={toggleTextVersion}\n >\n {t(showTextVersion ? \"audio.textVersion.close\" : \"audio.textVersion.heading\")}\n </TextVersionButton>\n );\n\n return (\n <AudioPlayerWrapper>\n <InfoWrapper>\n {!!img && (\n <ImageWrapper>\n <img src={img.url} alt={img.alt} />\n </ImageWrapper>\n )}\n <TextWrapper data-has-image={!!img}>\n <TitleWrapper>\n <div>\n {subtitle?.url ? <SafeLink to={subtitle.url}>{subtitle.title}</SafeLink> : subtitle?.title}\n <Heading asChild consumeCss textStyle=\"title.large\">\n <h3>{title}</h3>\n </Heading>\n </div>\n {!!textVersion && !img && textVersionButton}\n </TitleWrapper>\n {!!description && (\n <Text textStyle=\"body.medium\">\n {showFullDescription || description.length < DESCRIPTION_MAX_LENGTH\n ? description\n : `${truncatedDescription}...`}\n {description.length > DESCRIPTION_MAX_LENGTH && (\n <ShowMoreButton variant=\"link\" onClick={() => setShowFullDescription((p) => !p)}>\n {t(`audio.${showFullDescription ? \"readLessDescriptionLabel\" : \"readMoreDescriptionLabel\"}`)}\n </ShowMoreButton>\n )}\n </Text>\n )}\n {!!textVersion && !!img && textVersionButton}\n </TextWrapper>\n </InfoWrapper>\n <Controls src={src} title={title} />\n {!!textVersion && (\n <TextVersionWrapper id={textDescriptionId} hidden={!showTextVersion}>\n <Heading asChild textStyle=\"title.medium\" consumeCss>\n <h4>{t(\"audio.textVersion.heading\")}</h4>\n </Heading>\n <TextVersionText>{textVersion}</TextVersionText>\n </TextVersionWrapper>\n )}\n </AudioPlayerWrapper>\n );\n};\n\nexport default AudioPlayer;\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,qBAAqB,OAAO,OAAO,EACvC,MAAM;CACJ,QAAQ;CACR,aAAa;CACb,cAAc;CACd,WAAW;CACX,gBAAgB;CAChB,UAAU;AACX,EACF,EAAC;AAEF,MAAM,cAAc,OAAO,OAAO,EAChC,MAAM;CACJ,SAAS;CACT,gBAAgB,EACd,SAAS,QACV;AACF,EACF,EAAC;AAEF,MAAM,eAAe,OAAO,OAAO,EACjC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,MAAM;CACN,OAAO;CACP,QAAQ;CACR,UAAU;CACV,SAAS;EACP,OAAO;EACP,QAAQ;EACR,WAAW;CACZ;CACD,SAAS;EACP,OAAO;EACP,QAAQ;CACT;CACD,gBAAgB;EACd,WAAW;EACX,UAAU;EACV,OAAO;EACP,QAAQ;CACT;AACF,EACF,EAAC;AAEF,MAAM,cAAc,OAAO,OAAO,EAChC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,eAAe;CACf,KAAK;CACL,SAAS;CACT,OAAO;CACP,4BAA4B,EAC1B,QAAQ;EACN,cAAc;EACd,eAAe;CAChB,EACF;AACF,EACF,EAAC;AAEF,MAAM,eAAe,OAAO,OAAO,EACjC,MAAM;CACJ,SAAS;CACT,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AAC;kBACC,KAAC,4BACI,uBACD,IAAC,0CACC,IAAC;GAAI,KAAK,IAAI;GAAK,KAAK,IAAI;IAAO,GACtB,kBAEjB,KAAC;GAAY,oBAAkB;;oBAC7B,KAAC,2CACC,KAAC,oBACE,UAAU,sBAAM,IAAC;KAAS,IAAI,SAAS;eAAM,SAAS;MAAiB,GAAG,UAAU,uBACrF,IAAC;KAAQ;KAAQ;KAAW,WAAU;+BACpC,IAAC,kBAAI,QAAW;MACR,IACN,IACH,gBAAgB,OAAO,qBACb;MACZ,+BACD,KAAC;KAAK,WAAU;gBACb,uBAAuB,YAAY,SAAS,yBACzC,eACC,EAAE,qBAAqB,MAC3B,YAAY,SAAS,0CACpB,IAAC;MAAe,SAAQ;MAAO,SAAS,MAAM,uBAAuB,CAAC,OAAO,EAAE;gBAC5E,GAAG,QAAQ,sBAAsB,6BAA6B,2BAA2B,EAAE;OAC7E;MAEd;MAEN,iBAAiB,OAAO;;IACf,IACF;kBACd,IAACC;GAAc;GAAY;IAAS;IACjC,+BACD,KAAC;GAAmB,IAAI;GAAmB,SAAS;8BAClD,IAAC;IAAQ;IAAQ,WAAU;IAAe;8BACxC,IAAC,kBAAI,EAAE,4BAA4B,GAAM;KACjC,kBACV,IAAC,6BAAiB,cAA8B;IAC7B;KAEJ;AAExB;AAED,0BAAe"}
@@ -251,4 +251,4 @@ var Controls_default = Controls;
251
251
 
252
252
  //#endregion
253
253
  export { Controls_default };
254
- //# sourceMappingURL=Controls.js.map
254
+ //# sourceMappingURL=Controls.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Controls.mjs","names":["seconds: number","currentTime","details: SliderValueChangeDetails"],"sources":["../../src/AudioPlayer/Controls.tsx"],"sourcesContent":["/**\n * Copyright (c) 2021-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { type SliderValueChangeDetails, createListCollection } from \"@ark-ui/react\";\nimport { Replay15Line, Forward15Line, PlayFill, PauseLine, VolumeUpFill, CheckLine } from \"@ndla/icons\";\nimport {\n Button,\n FieldRoot,\n IconButton,\n PopoverContent,\n PopoverRoot,\n PopoverTrigger,\n SelectContent,\n SelectControl,\n SelectItem,\n SelectItemIndicator,\n SelectItemText,\n SelectLabel,\n SelectRoot,\n SelectTrigger,\n SliderControl,\n SliderHiddenInput,\n SliderLabel,\n SliderRange,\n SliderRoot,\n SliderThumb,\n SliderTrack,\n Text,\n} from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst ControlsWrapper = styled(\"div\", {\n base: {\n borderBlockStart: \"1px solid\",\n borderColor: \"stroke.default\",\n borderBottomRadius: \"xsmall\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"background.default\",\n gap: \"xsmall\",\n paddingBlock: \"xsmall\",\n paddingInline: \"medium\",\n tabletWideDown: {\n display: \"grid\",\n paddingBlock: \"xsmall\",\n paddingInline: \"xsmall\",\n gridTemplateColumns: \"1fr repeat(5, auto) 1fr\",\n gridTemplateAreas: `\n \"track track track track track track track\"\n \". speed backwards play forwards volume .\"\n`,\n },\n mobileWideDown: {\n columnGap: \"3xsmall\",\n },\n },\n});\n\nconst PlayButton = styled(IconButton, {\n base: {\n gridArea: \"play\",\n },\n});\n\nconst Forward15SecButton = styled(IconButton, {\n base: {\n gridArea: \"forwards\",\n },\n});\n\nconst Back15SecButton = styled(IconButton, {\n base: {\n gridArea: \"backwards\",\n },\n});\n\nconst ProgressWrapper = styled(\"div\", {\n base: {\n flex: \"1\",\n display: \"flex\",\n alignItems: \"center\",\n gap: \"xxsmall\",\n gridArea: \"track\",\n paddingBlock: \"xsmall\",\n mobileDown: {\n paddingInline: \"xsmall\",\n },\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n minWidth: \"xxlarge\",\n flexShrink: \"0\",\n textAlign: \"center\",\n },\n});\n\nconst VolumeButton = styled(IconButton, {\n base: {\n gridArea: \"volume\",\n },\n});\n\nconst SpeedButton = styled(Button, {\n base: {\n paddingBlock: \"auto\",\n paddingInline: \"auto\",\n maxWidth: \"xxlarge\",\n maxHeight: \"xxlarge\",\n minWidth: \"xxlarge\",\n minHeight: \"xxlarge\",\n \"& span\": {\n flex: \"1\",\n },\n },\n});\n\nconst StyledSelectRoot = styled(SelectRoot<string>, {\n base: {\n gridArea: \"speed\",\n },\n});\n\nconst StyledSliderControl = styled(SliderControl, {\n base: {\n height: \"surface.3xsmall\",\n minWidth: \"small\",\n },\n});\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n paddingInline: \"small\",\n },\n});\n\nconst formatTime = (seconds: number) => {\n const minutes = Math.floor(seconds / 60);\n const currentSeconds = seconds % 60;\n\n const formattedSeconds = currentSeconds < 10 ? `0${currentSeconds}` : currentSeconds;\n return `${minutes}:${formattedSeconds}`;\n};\n\nconst speedValues = createListCollection({ items: [\"0.5\", \"0.75\", \"1\", \"1.25\", \"1.5\", \"1.75\", \"2\"] });\n\ninterface Props {\n src: string;\n title: string;\n}\n\nconst Controls = ({ src, title }: Props) => {\n const { t } = useTranslation();\n const [speedValue, setSpeedValue] = useState(1);\n const [volumeValue, setVolumeValue] = useState(100);\n const [currentTime, setCurrentTime] = useState(0);\n const [remainingTime, setRemainingTime] = useState(0);\n const [playing, setPlaying] = useState(false);\n const audioRef = useRef<HTMLAudioElement>(null);\n\n useEffect(() => {\n if (audioRef.current) {\n audioRef.current.playbackRate = speedValue;\n }\n }, [speedValue]);\n\n useEffect(() => {\n if (audioRef.current) {\n const audioElement = audioRef.current;\n const handleTimeUpdate = () => {\n const { currentTime, duration } = audioElement;\n setCurrentTime(Math.round(currentTime));\n setRemainingTime(Math.round(duration - currentTime));\n };\n\n const handleLoadedMetaData = () => {\n const { currentTime, duration } = audioElement;\n setCurrentTime(Math.round(currentTime));\n setRemainingTime(Math.round(duration - currentTime));\n };\n\n const handleTimeEnded = () => {\n setPlaying(false);\n };\n\n audioElement.addEventListener(\"timeupdate\", handleTimeUpdate);\n audioElement.addEventListener(\"loadedmetadata\", handleLoadedMetaData);\n audioElement.addEventListener(\"ended\", handleTimeEnded);\n return () => {\n audioElement.removeEventListener(\"timeupdate\", handleTimeUpdate);\n audioElement.removeEventListener(\"loadedmetadata\", handleLoadedMetaData);\n audioElement.removeEventListener(\"ended\", handleTimeEnded);\n };\n }\n }, []);\n\n const togglePlay = () => {\n if (audioRef.current) {\n const audioElement = audioRef.current;\n if (!playing) {\n audioElement.play();\n } else {\n audioElement.pause();\n }\n setPlaying(!playing);\n }\n };\n\n const onSeekSeconds = (seconds: number) => {\n if (audioRef.current) {\n audioRef.current.currentTime += seconds;\n }\n };\n\n const handleSliderChange = (details: SliderValueChangeDetails) => {\n const newValue = details.value[0];\n if (audioRef.current && newValue != null && !isNaN(newValue)) {\n audioRef.current.currentTime = details.value[0];\n }\n };\n\n const handleVolumeSliderChange = (details: SliderValueChangeDetails) => {\n if (audioRef.current) {\n audioRef.current.volume = details.value[0] / 100;\n setVolumeValue(details.value[0]);\n }\n };\n\n return (\n <div>\n {/* TODO: We should tie this up to the textual description somehow */}\n {/* eslint-disable-next-line jsx-a11y/media-has-caption */}\n <audio ref={audioRef} src={src} title={title} preload=\"metadata\" />\n <ControlsWrapper>\n <Back15SecButton\n variant=\"tertiary\"\n title={t(\"audio.controls.rewind15sec\")}\n aria-label={t(\"audio.controls.rewind15sec\")}\n onClick={() => onSeekSeconds(-15)}\n >\n <Replay15Line />\n </Back15SecButton>\n <PlayButton aria-label={t(playing ? t(\"audio.pause\") : t(\"audio.play\"))} variant=\"primary\" onClick={togglePlay}>\n {playing ? <PauseLine /> : <PlayFill />}\n </PlayButton>\n <Forward15SecButton\n variant=\"tertiary\"\n title={t(\"audio.controls.forward15sec\")}\n aria-label={t(\"audio.controls.forward15sec\")}\n onClick={() => onSeekSeconds(15)}\n >\n <Forward15Line />\n </Forward15SecButton>\n <ProgressWrapper>\n <StyledText textStyle=\"label.medium\" asChild consumeCss>\n <div>{formatTime(currentTime)}</div>\n </StyledText>\n <SliderRoot\n value={[audioRef.current?.currentTime || 0]}\n defaultValue={[0]}\n step={1}\n max={Math.round(audioRef.current?.duration || 0)}\n onValueChange={handleSliderChange}\n getAriaValueText={(value) =>\n t(\"audio.valueText\", {\n start: formatTime(Math.round(value.value)),\n end: formatTime(Math.round(audioRef.current?.duration ?? 0)),\n })\n }\n >\n <SliderLabel srOnly>{t(\"audio.progressBar\")}</SliderLabel>\n <SliderControl>\n <SliderTrack>\n <SliderRange />\n </SliderTrack>\n <SliderThumb index={0}>\n <SliderHiddenInput />\n </SliderThumb>\n </SliderControl>\n </SliderRoot>\n <StyledText textStyle=\"label.medium\" asChild consumeCss>\n <div>-{formatTime(remainingTime)}</div>\n </StyledText>\n </ProgressWrapper>\n <FieldRoot>\n <StyledSelectRoot\n collection={speedValues}\n value={[speedValue.toString()]}\n onValueChange={(details) => setSpeedValue(parseFloat(details.value[0]))}\n positioning={{ placement: \"top\" }}\n >\n <SelectLabel srOnly>{t(\"audio.controls.selectSpeed\")}</SelectLabel>\n <SelectControl>\n <SelectTrigger asChild>\n <SpeedButton\n variant=\"tertiary\"\n title={t(\"audio.controls.selectSpeed\")}\n aria-label={t(\"audio.controls.selectSpeed\")}\n >\n <span>{`${speedValue}x`}</span>\n </SpeedButton>\n </SelectTrigger>\n </SelectControl>\n <SelectContent>\n {speedValues.items.map((speed) => (\n <SelectItem key={speed} item={speed}>\n <SelectItemText>{speed}x</SelectItemText>\n <SelectItemIndicator>\n <CheckLine />\n </SelectItemIndicator>\n </SelectItem>\n ))}\n </SelectContent>\n </StyledSelectRoot>\n </FieldRoot>\n <PopoverRoot positioning={{ placement: \"top\" }}>\n <PopoverTrigger asChild>\n <VolumeButton variant=\"tertiary\" aria-label={t(\"audio.controls.adjustVolume\")}>\n <VolumeUpFill />\n </VolumeButton>\n </PopoverTrigger>\n <StyledPopoverContent>\n <SliderRoot\n orientation=\"vertical\"\n value={[volumeValue]}\n min={0}\n max={100}\n defaultValue={[100]}\n step={1}\n onValueChange={handleVolumeSliderChange}\n >\n <SliderLabel srOnly>{t(\"audio.controls.adjustVolume\")}</SliderLabel>\n <StyledSliderControl>\n <SliderTrack>\n <SliderRange />\n </SliderTrack>\n <SliderThumb index={0}>\n <SliderHiddenInput />\n </SliderThumb>\n </StyledSliderControl>\n </SliderRoot>\n </StyledPopoverContent>\n </PopoverRoot>\n </ControlsWrapper>\n </div>\n );\n};\n\nexport default Controls;\n"],"mappings":";;;;;;;;;AAsCA,MAAM,kBAAkB,OAAO,OAAO,EACpC,MAAM;CACJ,kBAAkB;CAClB,aAAa;CACb,oBAAoB;CACpB,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,YAAY;CACZ,KAAK;CACL,cAAc;CACd,eAAe;CACf,gBAAgB;EACd,SAAS;EACT,cAAc;EACd,eAAe;EACf,qBAAqB;EACrB,oBAAoB;;;;CAIrB;CACD,gBAAgB,EACd,WAAW,UACZ;AACF,EACF,EAAC;AAEF,MAAM,aAAa,OAAO,YAAY,EACpC,MAAM,EACJ,UAAU,OACX,EACF,EAAC;AAEF,MAAM,qBAAqB,OAAO,YAAY,EAC5C,MAAM,EACJ,UAAU,WACX,EACF,EAAC;AAEF,MAAM,kBAAkB,OAAO,YAAY,EACzC,MAAM,EACJ,UAAU,YACX,EACF,EAAC;AAEF,MAAM,kBAAkB,OAAO,OAAO,EACpC,MAAM;CACJ,MAAM;CACN,SAAS;CACT,YAAY;CACZ,KAAK;CACL,UAAU;CACV,cAAc;CACd,YAAY,EACV,eAAe,SAChB;AACF,EACF,EAAC;AAEF,MAAM,aAAa,OAAO,MAAM,EAC9B,MAAM;CACJ,UAAU;CACV,YAAY;CACZ,WAAW;AACZ,EACF,EAAC;AAEF,MAAM,eAAe,OAAO,YAAY,EACtC,MAAM,EACJ,UAAU,SACX,EACF,EAAC;AAEF,MAAM,cAAc,OAAO,QAAQ,EACjC,MAAM;CACJ,cAAc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,6BAA6B;MAAe;oBACnE,IAAC,2CACC,IAAC;KAAc;+BACb,IAAC;MACC,SAAQ;MACR,OAAO,EAAE,6BAA6B;MACtC,cAAY,EAAE,6BAA6B;gCAE3C,IAAC,qBAAO,EAAE,WAAW,KAAU;OACnB;MACA,GACF;oBAChB,IAAC,2BACE,YAAY,MAAM,IAAI,CAAC,0BACtB,KAAC;KAAuB,MAAM;gCAC5B,KAAC,6BAAgB,OAAM,OAAkB,kBACzC,IAAC,iDACC,IAAC,cAAY,GACO;OAJP,MAKJ,CACb,GACY;;IACC,GACT;kBACZ,KAAC;GAAY,aAAa,EAAE,WAAW,MAAO;8BAC5C,IAAC;IAAe;8BACd,IAAC;KAAa,SAAQ;KAAW,cAAY,EAAE,8BAA8B;+BAC3E,IAAC,iBAAe;MACH;KACA,kBACjB,IAAC,kDACC,KAAC;IACC,aAAY;IACZ,OAAO,CAAC,WAAY;IACpB,KAAK;IACL,KAAK;IACL,cAAc,CAAC,GAAI;IACnB,MAAM;IACN,eAAe;+BAEf,IAAC;KAAY;eAAQ,EAAE,8BAA8B;MAAe,kBACpE,KAAC,kDACC,IAAC,yCACC,IAAC,gBAAc,GACH,kBACd,IAAC;KAAY,OAAO;+BAClB,IAAC,sBAAoB;MACT,IACM;KACX,GACQ;IACX;KACE,IACd;AAET;AAED,uBAAe"}
@@ -37,4 +37,4 @@ var SpeechControl_default = SpeechControl;
37
37
 
38
38
  //#endregion
39
39
  export { SpeechControl_default };
40
- //# sourceMappingURL=SpeechControl.js.map
40
+ //# sourceMappingURL=SpeechControl.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpeechControl.mjs","names":[],"sources":["../../src/AudioPlayer/SpeechControl.tsx"],"sourcesContent":["/**\n * Copyright (c) 2021-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { useRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { VolumeUpFill } from \"@ndla/icons\";\nimport { TooltipRoot, TooltipTrigger, TooltipContent, IconButton } from \"@ndla/primitives\";\n\ntype Props = {\n src: string;\n title: string;\n type?: \"gloss\" | \"audio\";\n};\n\nconst SpeechControl = ({ src, title, type = \"audio\" }: Props) => {\n const { t } = useTranslation();\n const audioRef = useRef<HTMLAudioElement>(null);\n\n const togglePlay = () => {\n if (audioRef.current) {\n const audioElement = audioRef.current;\n if (audioElement.paused) {\n audioElement.play();\n } else {\n audioElement.pause();\n }\n }\n };\n return (\n <div data-embed-type=\"speech\">\n {/* eslint-disable-next-line jsx-a11y/media-has-caption */}\n <audio ref={audioRef} src={src} title={title} preload=\"metadata\" />\n <TooltipRoot>\n <TooltipTrigger asChild>\n <IconButton variant=\"tertiary\" aria-label={t(`${type}.play`)} onClick={togglePlay}>\n <VolumeUpFill />\n </IconButton>\n </TooltipTrigger>\n <TooltipContent>{t(`${type}.play`)}</TooltipContent>\n </TooltipRoot>\n </div>\n );\n};\n\nexport default SpeechControl;\n"],"mappings":";;;;;;;AAmBA,MAAM,gBAAgB,CAAC,EAAE,KAAK,OAAO,OAAO,SAAgB,KAAK;CAC/D,MAAM,EAAE,GAAG,GAAG,gBAAgB;CAC9B,MAAM,WAAW,OAAyB,KAAK;CAE/C,MAAM,aAAa,MAAM;AACvB,MAAI,SAAS,SAAS;GACpB,MAAM,eAAe,SAAS;AAC9B,OAAI,aAAa,OACf,cAAa,MAAM;OAEnB,cAAa,OAAO;EAEvB;CACF;AACD,wBACE,KAAC;EAAI,mBAAgB;6BAEnB,IAAC;GAAM,KAAK;GAAe;GAAY;GAAO,SAAQ;IAAa,kBACnE,KAAC,0CACC,IAAC;GAAe;6BACd,IAAC;IAAW,SAAQ;IAAW,cAAY,GAAG,EAAE,KAAK,OAAO;IAAE,SAAS;8BACrE,IAAC,iBAAe;KACL;IACE,kBACjB,IAAC,4BAAgB,GAAG,EAAE,KAAK,OAAO,GAAkB,IACxC;GACV;AAET;AAED,4BAAe"}
@@ -1,8 +1,8 @@
1
- import { AudioPlayer_default$1 as AudioPlayer_default } from "./AudioPlayer.js";
1
+ import { AudioPlayer_default$1 as AudioPlayer_default } from "./AudioPlayer.mjs";
2
2
 
3
3
  //#region src/AudioPlayer/index.ts
4
4
  var AudioPlayer_default$1 = AudioPlayer_default;
5
5
 
6
6
  //#endregion
7
7
  export { AudioPlayer_default$1 as AudioPlayer_default };
8
- //# sourceMappingURL=index.js.map
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["AudioPlayer"],"sources":["../../src/AudioPlayer/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2021-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport AudioPlayer from \"./AudioPlayer\";\n\nexport default AudioPlayer;\n"],"mappings":";;;AAUA,4BAAeA"}
@@ -1,4 +1,4 @@
1
- import { BreadcrumbItem_default } from "./BreadcrumbItem.js";
1
+ import { BreadcrumbItem_default } from "./BreadcrumbItem.mjs";
2
2
  import "react";
3
3
  import { styled } from "@ndla/styled-system/jsx";
4
4
  import { useTranslation } from "react-i18next";
@@ -41,4 +41,4 @@ var Breadcrumb_default = Breadcrumb;
41
41
 
42
42
  //#endregion
43
43
  export { Breadcrumb_default as Breadcrumb_default$1 };
44
- //# sourceMappingURL=Breadcrumb.js.map
44
+ //# sourceMappingURL=Breadcrumb.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Breadcrumb.mjs","names":["BreadcrumbItem"],"sources":["../../src/Breadcrumb/Breadcrumb.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 { type ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport BreadcrumbItem, { type IndexedBreadcrumbItem, type SimpleBreadcrumbItem } from \"./BreadcrumbItem\";\n\ninterface Props {\n items: SimpleBreadcrumbItem[];\n collapseFirst?: boolean;\n collapseLast?: boolean;\n renderItem?: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n renderSeparator?: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n}\n\nconst StyledList = styled(\"ol\", {\n base: {\n display: \"flex\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n listStyle: \"none\",\n gap: \"xxsmall\",\n mobileDown: {\n alignItems: \"flex-start\",\n justifyContent: \"center\",\n flexDirection: \"column\",\n },\n },\n});\n\nconst Breadcrumb = ({ items, renderItem, renderSeparator, collapseFirst, collapseLast = true }: Props) => {\n const { t } = useTranslation();\n\n return (\n <nav aria-label={t(\"breadcrumb.breadcrumb\")}>\n <StyledList>\n {items.map((item, index) => (\n <BreadcrumbItem\n renderItem={renderItem}\n renderSeparator={renderSeparator}\n ref={(element) => {\n if (\n element === null ||\n (!collapseFirst && index === 0) ||\n (!collapseLast && index === items.length - 1)\n ) {\n if (element) {\n element.setMaxWidth(\"none\");\n }\n }\n }}\n key={typeof item.to === \"string\" ? item.to : item.to.pathname}\n totalCount={items.length}\n item={{ ...item, index }}\n />\n ))}\n </StyledList>\n </nav>\n );\n};\n\nexport default Breadcrumb;\n"],"mappings":";;;;;;;AAqBA,MAAM,aAAa,OAAO,MAAM,EAC9B,MAAM;CACJ,SAAS;CACT,UAAU;CACV,YAAY;CACZ,WAAW;CACX,KAAK;CACL,YAAY;EACV,YAAY;EACZ,gBAAgB;EAChB,eAAe;CAChB;AACF,EACF,EAAC;AAEF,MAAM,aAAa,CAAC,EAAE,OAAO,YAAY,iBAAiB,eAAe,eAAe,MAAa,KAAK;CACxG,MAAM,EAAE,GAAG,GAAG,gBAAgB;AAE9B,wBACE,IAAC;EAAI,cAAY,EAAE,wBAAwB;4BACzC,IAAC,wBACE,MAAM,IAAI,CAAC,MAAM,0BAChB,IAACA;GACa;GACK;GACjB,KAAK,CAAC,YAAY;AAChB,QACE,YAAY,SACV,iBAAiB,UAAU,MAC3B,gBAAgB,UAAU,MAAM,SAAS,GAE3C;SAAI,QACF,SAAQ,YAAY,OAAO;IAC5B;GAEJ;GAED,YAAY,MAAM;GAClB,MAAM;IAAE,GAAG;IAAM;GAAO;YAFZ,KAAK,OAAO,WAAW,KAAK,KAAK,KAAK,GAAG,SAGrD,CACF,GACS;GACT;AAET;AAED,yBAAe"}
@@ -33,4 +33,4 @@ var BreadcrumbItem_default = BreadcrumbItem;
33
33
 
34
34
  //#endregion
35
35
  export { BreadcrumbItem_default };
36
- //# sourceMappingURL=BreadcrumbItem.js.map
36
+ //# sourceMappingURL=BreadcrumbItem.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BreadcrumbItem.mjs","names":["maxWidth: number"],"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 { useRef, useImperativeHandle, type ReactNode, forwardRef } from \"react\";\nimport { ArrowRightShortLine } from \"@ndla/icons\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\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\nconst BreadcrumbItem = forwardRef<any, Props>(({ renderItem, renderSeparator, item, totalCount }, ref) => {\n const liRef = useRef<any>(null);\n\n useImperativeHandle(ref, () => ({\n setMaxWidth: (maxWidth: number) => {\n liRef.current.children[0].style.maxWidth = maxWidth;\n },\n }));\n\n const { to, name, index } = item;\n const isLast = index === totalCount - 1;\n return (\n <StyledListItem ref={liRef} aria-current={isLast ? \"page\" : undefined}>\n {renderItem ? (\n renderItem(item, totalCount)\n ) : isLast ? (\n <span>{name}</span>\n ) : (\n <SafeLink to={to}>\n <span>{name}</span>\n </SafeLink>\n )}\n {renderSeparator ? renderSeparator(item, totalCount) : !isLast && <ArrowRightShortLine />}\n </StyledListItem>\n );\n});\n\nexport default BreadcrumbItem;\n"],"mappings":";;;;;;;AA2BA,MAAM,iBAAiB,OAAO,MAAM,EAClC,MAAM;CACJ,SAAS;CACT,OAAO;CACP,KAAK;CACL,YAAY;CACZ,YAAY,EACV,SAAS,QACV;CACD,OAAO,EACL,UAAU,EACR,OAAO,UACR,EACF;AACF,EACF,EAAC;AAUF,MAAM,iBAAiB,WAAuB,CAAC,EAAE,YAAY,iBAAiB,MAAM,YAAY,EAAE,QAAQ;CACxG,MAAM,QAAQ,OAAY,KAAK;AAE/B,qBAAoB,KAAK,OAAO,EAC9B,aAAa,CAACA,aAAqB;AACjC,QAAM,QAAQ,SAAS,GAAG,MAAM,WAAW;CAC5C,EACF,GAAE;CAEH,MAAM,EAAE,IAAI,MAAM,OAAO,GAAG;CAC5B,MAAM,SAAS,UAAU,aAAa;AACtC,wBACE,KAAC;EAAe,KAAK;EAAO,gBAAc,SAAS;aAChD,aACC,WAAW,MAAM,WAAW,GAC1B,yBACF,IAAC,oBAAM,OAAY,mBAEnB,IAAC;GAAa;6BACZ,IAAC,oBAAM,OAAY;IACV,EAEZ,kBAAkB,gBAAgB,MAAM,WAAW,IAAI,0BAAU,IAAC,wBAAsB;GAC1E;AAEpB,EAAC;AAEF,6BAAe"}
@@ -1,4 +1,4 @@
1
- import { Breadcrumb_default$1 as Breadcrumb_default } from "./Breadcrumb.js";
1
+ import { Breadcrumb_default$1 as Breadcrumb_default } from "./Breadcrumb.mjs";
2
2
  import { styled } from "@ndla/styled-system/jsx";
3
3
  import { ArrowRightShortLine, HomeLine } from "@ndla/icons";
4
4
  import { SafeLink } from "@ndla/safelink";
@@ -41,4 +41,4 @@ var HomeBreadcrumb_default = HomeBreadcrumb;
41
41
 
42
42
  //#endregion
43
43
  export { HomeBreadcrumb_default };
44
- //# sourceMappingURL=HomeBreadcrumb.js.map
44
+ //# sourceMappingURL=HomeBreadcrumb.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HomeBreadcrumb.mjs","names":["item: IndexedBreadcrumbItem","totalCount: number","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\nconst 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 />;\n }\n return <ArrowRightShortLine />;\n };\n\n return <Breadcrumb items={items} renderItem={renderItem} renderSeparator={renderSeparator} />;\n};\n\nexport default HomeBreadcrumb;\n"],"mappings":";;;;;;;AAcA,MAAM,iBAAiB,OAAO,UAAU,EACtC,MAAM;CACJ,OAAO;CACP,gBAAgB;CAChB,QAAQ,EACN,gBAAgB,OACjB;CACD,eAAe,EACb,gBAAgB,OACjB;AACF,EACF,EAAC;AAEF,MAAM,mBAAmB,OAAO,qBAAqB,EACnD,MAAM,EACJ,YAAY,EACV,SAAS,OACV,EACF,EACF,EAAC;AAEF,MAAM,eAAe,OAAO,UAAU,EACpC,MAAM,EACJ,OAAO,UACR,EACF,EAAC;AAMF,MAAM,iBAAiB,CAAC,EAAE,OAAc,KAAK;CAC3C,MAAM,aAAa,CAACA,MAA6BC,eAAuB;AACtE,MAAI,KAAK,UAAU,aAAa,EAC9B,wBAAO,IAAC,oBAAM,KAAK,OAAY;AAEjC,MAAI,KAAK,UAAU,YAAY,KAAK,SAAS,SAC3C,wBACE,IAAC;GAAa,cAAY,KAAK;GAAM,IAAI,KAAK;6BAC5C,IAAC,YAAS,OAAO,KAAK,OAAQ;IACjB;AAGnB,yBAAO,IAAC;GAAe,IAAI,KAAK;aAAK,KAAK;IAAsB;CACjE;CAED,MAAM,kBAAkB,CAACD,MAA6BC,eAAuB;AAC3E,MAAI,KAAK,UAAU,aAAa,EAC9B,QAAO;AAET,MAAI,KAAK,UAAU,EACjB,wBAAO,IAAC,qBAAmB;AAE7B,yBAAO,IAAC,wBAAsB;CAC/B;AAED,wBAAO,IAACC;EAAkB;EAAmB;EAA6B;GAAmB;AAC9F;AAED,6BAAe"}
@@ -1,9 +1,9 @@
1
- import { Breadcrumb_default$1 as Breadcrumb_default } from "./Breadcrumb.js";
2
- import { HomeBreadcrumb_default } from "./HomeBreadcrumb.js";
1
+ import { Breadcrumb_default$1 as Breadcrumb_default } from "./Breadcrumb.mjs";
2
+ import { HomeBreadcrumb_default } from "./HomeBreadcrumb.mjs";
3
3
 
4
4
  //#region src/Breadcrumb/index.ts
5
5
  var Breadcrumb_default$1 = Breadcrumb_default;
6
6
 
7
7
  //#endregion
8
8
  export { Breadcrumb_default$1 as Breadcrumb_default };
9
- //# sourceMappingURL=index.js.map
9
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["Breadcrumb"],"sources":["../../src/Breadcrumb/index.ts"],"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 Breadcrumb from \"./Breadcrumb\";\n\nexport type { SimpleBreadcrumbItem, IndexedBreadcrumbItem } from \"./BreadcrumbItem\";\n\nexport { default as HomeBreadcrumb } from \"./HomeBreadcrumb\";\n\nexport default Breadcrumb;\n"],"mappings":";;;;AAcA,2BAAeA"}
@@ -1,4 +1,4 @@
1
- import { getPossiblyRelativeUrl } from "../utils/relativeUrl.js";
1
+ import { getPossiblyRelativeUrl } from "../utils/relativeUrl.mjs";
2
2
  import "react";
3
3
  import { Text } from "@ndla/primitives";
4
4
  import { styled } from "@ndla/styled-system/jsx";
@@ -128,4 +128,4 @@ var CampaignBlock_default = CampaignBlock;
128
128
 
129
129
  //#endregion
130
130
  export { CampaignBlock_default };
131
- //# sourceMappingURL=CampaignBlock.js.map
131
+ //# sourceMappingURL=CampaignBlock.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CampaignBlock.mjs","names":[],"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 parse from \"html-react-parser\";\nimport { type ReactNode } from \"react\";\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 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\nconst 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\nexport default CampaignBlock;\n"],"mappings":";;;;;;;;;;AAsCA,MAAM,UAAU,OAAO,OAAO,EAC5B,MAAM;CACJ,OAAO;CACP,QAAQ;CACR,eAAe;AAChB,EACF,EAAC;AAEF,MAAM,YAAY,OAAO,OAAO;CAC9B,MAAM;EACJ,SAAS;EACT,qBAAqB;EACrB,QAAQ;EACR,aAAa;EACb,iBAAiB;EACjB,cAAc;EACd,WAAW;EACX,UAAU;CACX;CACD,UAAU;EACR,WAAW;GACT,MAAM;IACJ,YAAY,EACV,qBAAqB,4BACtB;IACD,+CAA+C,EAC7C,YAAY,EACV,qBAAqB,4BACtB,EACF;GACF;GACD,OAAO;IACL,YAAY,EACV,qBAAqB,4BACtB;IACD,+CAA+C,EAC7C,YAAY,EACV,qBAAqB,4BACtB,EACF;GACF;EACF;EACD,YAAY;GACV,SAAS,CAAE;GACX,QAAQ,EACN,iBAAiB,kBAClB;GACD,QAAQ,EACN,iBAAiB,kBAClB;EACF;CACF;CACD,iBAAiB;EACf,WAAW;EACX,YAAY;CACb;AACF,EAAC;AAEF,MAAM,YAAY,OAAO,OAAO,EAC9B,MAAM;CACJ,WAAW;CACX,OAAO;CACP,QAAQ;CACR,YAAY,EACV,QAAQ,QACT;CACD,+CAA+C;EAC7C,QAAQ,EACN,QAAQ,QACT;EACD,YAAY,EACV,QAAQ,QACT;CACF;CACD,iBAAiB;AAClB,EACF,EAAC;AAEF,MAAM,iBAAiB,OAAO,OAAO,EACnC,MAAM;CACJ,OAAO;CACP,SAAS;CACT,eAAe;CACf,KAAK;CACL,YAAY;CACZ,gBAAgB;CAChB,cAAc;CACd,eAAe;CACf,UAAU;AACX,EACF,EAAC;AAEF,MAAM,aAAa,OAAO,MAAM,EAC9B,MAAM,EACJ,QAAQ;CACN,SAAS;CACT,UAAU;CACV,UAAU;CACV,WAAW;CACX,WAAW;AACZ,EACF,EACF,EAAC;AAQF,MAAM,uBAAuB,OAAO,gBAAgB,EAClD,MAAM;CACJ,WAAW;CACX,QAAQ;CACR,aAAa;AACd,EACF,EAAC;AAEF,MAAM,aAAa,CAAC,EAAE,KAAK,UAAU,MAAuB,KAAK;AAC/D,KAAI,IACF,wBACE,IAAC;EAAqB,IAAI,uBAAuB,KAAK,KAAK;EAAE,SAAQ;EAAY,KAAI;EAClF;GACoB;AAE3B,QAAO;AACR;AAED,MAAM,gBAAgB,CAAC,EACrB,OACA,OACA,YAAY,QACZ,aACA,cAAc,kBAAkB,MAChC,KACA,MACA,WACA,YACM,KAAK;CACX,MAAM,iBAAiB,yBAAS,IAAC;EAAU,MAAM,EAAE,MAAM,IAAI;EAAa,QAAQ;EAAK,OAAO;EAAK,KAAK,MAAM;GAAO;AAErH,wBACE,IAAC,qCACC,KAAC;EAAqB;EAAW,mBAAgB;EAA4B;EAAuB;;GACjG,cAAc,UAAU;mBACzB,KAAC;oBACC,IAAC;KAAK;KAAQ;KAAW,WAAU;+BACjC,IAAC,6BAAiB,MAAM,MAAM,GAAmB;MAC5C;oBACP,IAAC;KAAW,WAAU;eAAe,MAAM,YAAY;MAAc;MAClE,KAAK,uBACN,KAAC;KAAW,KAAK,IAAI;KAAW;gBAC7B,MAAM,IAAI,QAAQ,GAAG,kBACtB,IAAC,mBAAiB;MACP;OAEA;GAChB,cAAc,UAAU;;GACf,GACJ;AAEb;AAED,4BAAe"}
@@ -22,4 +22,4 @@ var CodeBlock_default = Codeblock;
22
22
 
23
23
  //#endregion
24
24
  export { CodeBlock_default };
25
- //# sourceMappingURL=CodeBlock.js.map
25
+ //# sourceMappingURL=CodeBlock.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeBlock.mjs","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 { type ComponentPropsWithRef, forwardRef, useMemo } from \"react\";\nimport { cx } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { JsxStyleProps } from \"@ndla/styled-system/types\";\n\ninterface Props extends JsxStyleProps, 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\nexport default Codeblock;\n"],"mappings":";;;;;;AAkBA,MAAM,MAAM,OAAO,OAAO,CAAE,EAAC;AAE7B,MAAa,YAAY,WAAkC,CAAC,EAAE,iBAAiB,QAAQ,UAAW,GAAG,OAAO,EAAE,QAAQ;CACpH,MAAM,sBAAsB,QAAQ,MAAM;AACxC,SAAO,gBACJ,MAAM,KAAK,CACX,IAAI,CAAC,MAAM,MAAM;AAChB,WAAQ,2BAA2B,IAAI,EAAE,SAAS,KAAK;EACxD,EAAC,CACD,KAAK,KAAK;CACd,GAAE,CAAC,eAAgB,EAAC;AAErB,wBACE,IAAC;EACC,WAAW,GAAG,cAAc,WAAW,OAAO,GAAG,UAAU;EAC3D,GAAI;EACJ,yBAAyB,EAAE,QAAQ,oBAAqB;EACnD;GACL;AAEL,EAAC;AAEF,wBAAe"}
@@ -111,4 +111,4 @@ const codeLanguageOptions = [
111
111
 
112
112
  //#endregion
113
113
  export { codeLanguageOptions };
114
- //# sourceMappingURL=codeLanguageOptions.js.map
114
+ //# sourceMappingURL=codeLanguageOptions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codeLanguageOptions.mjs","names":["codeLanguageOptions: Array<ICodeLangugeOption>"],"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,MAAaA,sBAAiD;CAC5D;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;AACF"}
@@ -1,10 +1,10 @@
1
- import { EmbedByline } from "../LicenseByline/EmbedByline.js";
2
- import { licenseAttributes } from "../utils/licenseAttributes.js";
3
- import { ImageEmbed_default } from "../Embed/ImageEmbed.js";
4
- import { H5pEmbed_default } from "../Embed/H5pEmbed.js";
5
- import { ExternalEmbed_default } from "../Embed/ExternalEmbed.js";
6
- import { IframeEmbed_default } from "../Embed/IframeEmbed.js";
7
- import { BrightcoveEmbed_default } from "../Embed/BrightcoveEmbed.js";
1
+ import { EmbedByline } from "../LicenseByline/EmbedByline.mjs";
2
+ import { licenseAttributes } from "../utils/licenseAttributes.mjs";
3
+ import { ImageEmbed_default } from "../Embed/ImageEmbed.mjs";
4
+ import { H5pEmbed_default } from "../Embed/H5pEmbed.mjs";
5
+ import { ExternalEmbed_default } from "../Embed/ExternalEmbed.mjs";
6
+ import { IframeEmbed_default } from "../Embed/IframeEmbed.mjs";
7
+ import { BrightcoveEmbed_default } from "../Embed/BrightcoveEmbed.mjs";
8
8
  import { forwardRef } from "react";
9
9
  import { Figure } from "@ndla/primitives";
10
10
  import { styled } from "@ndla/styled-system/jsx";
@@ -47,4 +47,4 @@ const Concept = forwardRef(({ copyright, visualElement, lang, children, title, s
47
47
 
48
48
  //#endregion
49
49
  export { Concept };
50
- //# sourceMappingURL=Concept.js.map
50
+ //# sourceMappingURL=Concept.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Concept.mjs","names":["ImageEmbed","BrightcoveEmbed","H5pEmbed","IframeEmbed","ExternalEmbed"],"sources":["../../src/Concept/Concept.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { IDraftCopyrightDTO as ConceptCopyright } from \"@ndla/types-backend/concept-api\";\nimport type { ConceptVisualElementMeta } from \"@ndla/types-embed\";\nimport { BrightcoveEmbed, ExternalEmbed, H5pEmbed, IframeEmbed, ImageEmbed } from \"../Embed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nexport interface ConceptProps extends Omit<ComponentPropsWithRef<\"figure\">, \"title\"> {\n copyright?: ConceptCopyright;\n visualElement?: ConceptVisualElementMeta;\n lang?: string;\n title?: ReactNode;\n children?: ReactNode;\n source?: string;\n previewAlt?: boolean;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n textStyle: \"body.large\",\n display: \"inline\",\n \"& p\": {\n display: \"inline\",\n },\n },\n});\n\nexport const Concept = forwardRef<HTMLElement, ConceptProps>(\n ({ copyright, visualElement, lang, children, title, source, previewAlt, ...rest }, ref) => {\n const licenseProps = licenseAttributes(copyright?.license?.license, lang, source);\n\n return (\n <StyledFigure ref={ref} {...rest} {...licenseProps}>\n <ContentWrapper lang={lang}>\n {!!title && (\n <>\n <b>{title}</b>\n {` – `}\n </>\n )}\n {children}\n </ContentWrapper>\n {visualElement?.resource === \"image\" ? (\n <ImageEmbed embed={visualElement} lang={lang} previewAlt={previewAlt} />\n ) : visualElement?.resource === \"brightcove\" ? (\n <BrightcoveEmbed embed={visualElement} />\n ) : visualElement?.resource === \"h5p\" ? (\n <H5pEmbed embed={visualElement} />\n ) : visualElement?.resource === \"iframe\" ? (\n <IframeEmbed embed={visualElement} />\n ) : visualElement?.resource === \"external\" ? (\n <ExternalEmbed embed={visualElement} />\n ) : null}\n {!!copyright && <EmbedByline copyright={copyright} type=\"concept\" />}\n </StyledFigure>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;AA2BA,MAAM,eAAe,OAAO,QAAQ,EAClC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;AACN,EACF,EAAC;AAEF,MAAM,iBAAiB,OAAO,OAAO,EACnC,MAAM;CACJ,WAAW;CACX,SAAS;CACT,OAAO,EACL,SAAS,SACV;AACF,EACF,EAAC;AAEF,MAAa,UAAU,WACrB,CAAC,EAAE,WAAW,eAAe,MAAM,UAAU,OAAO,QAAQ,WAAY,GAAG,MAAM,EAAE,QAAQ;CACzF,MAAM,eAAe,kBAAkB,WAAW,SAAS,SAAS,MAAM,OAAO;AAEjF,wBACE,KAAC;EAAkB;EAAK,GAAI;EAAM,GAAI;;mBACpC,KAAC;IAAqB;iBACjB,yBACD,8CACE,IAAC,iBAAG,QAAU,GACZ,QACD,EAEJ;KACc;GAChB,eAAe,aAAa,0BAC3B,IAACA;IAAW,OAAO;IAAqB;IAAkB;KAAc,GACtE,eAAe,aAAa,+BAC9B,IAACC,2BAAgB,OAAO,gBAAiB,GACvC,eAAe,aAAa,wBAC9B,IAACC,oBAAS,OAAO,gBAAiB,GAChC,eAAe,aAAa,2BAC9B,IAACC,uBAAY,OAAO,gBAAiB,GACnC,eAAe,aAAa,6BAC9B,IAACC,yBAAc,OAAO,gBAAiB,GACrC;KACD,6BAAa,IAAC;IAAuB;IAAW,MAAK;KAAY;;GACvD;AAElB,EACF"}
@@ -1,4 +1,4 @@
1
- import { LicenseContainerContent } from "../LicenseByline/EmbedByline.js";
1
+ import { LicenseContainerContent } from "../LicenseByline/EmbedByline.mjs";
2
2
  import { Text } from "@ndla/primitives";
3
3
  import { styled } from "@ndla/styled-system/jsx";
4
4
  import { useTranslation } from "react-i18next";
@@ -142,4 +142,4 @@ const ContactBlock = ({ image, jobTitle, description, name, email, embedAlt, lan
142
142
 
143
143
  //#endregion
144
144
  export { ContactBlock, contactBlockBackgrounds };
145
- //# sourceMappingURL=ContactBlock.js.map
145
+ //# sourceMappingURL=ContactBlock.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContactBlock.mjs","names":["BackgroundVariant: Record<ContactBlockBackground, SystemStyleObject>"],"sources":["../../src/ContactBlock/ContactBlock.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { useTranslation } from \"react-i18next\";\nimport { Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { SystemStyleObject } from \"@ndla/styled-system/types\";\nimport type { IImageMetaInformationV3DTO } from \"@ndla/types-backend/image-api\";\nimport { LicenseContainerContent } from \"../LicenseByline/EmbedByline\";\n\nexport type ContactBlockBackground = \"strong\" | \"moderate\" | \"subtle\";\n\nconst BackgroundVariant: Record<ContactBlockBackground, SystemStyleObject> = {\n strong: { _before: { backgroundColor: \"surface.brand.3\" } },\n moderate: { _before: { backgroundColor: \"surface.brand.3.moderate\" } },\n subtle: { _before: { backgroundColor: \"surface.brand.3.subtle\" } },\n};\n\nexport const contactBlockBackgrounds = Object.keys(BackgroundVariant) as ContactBlockBackground[];\n\nconst StyledWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n minWidth: \"surface.xxsmall\",\n padding: \"medium\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n boxShadow: \"full\",\n border: \"1px solid\",\n gap: \"medium\",\n position: \"relative\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n overflow: \"hidden\",\n background: \"surface.default\",\n flexDirection: \"column-reverse\",\n tablet: {\n alignItems: \"unset\",\n flexDirection: \"row\",\n },\n },\n});\n\nconst EmailLink = styled(\"a\", {\n base: {\n color: \"text.default\",\n textDecoration: \"underline\",\n _hover: { textDecoration: \"none\" },\n _focusVisible: { textDecoration: \"none\" },\n },\n});\n\nconst HeaderWrapper = styled(\"div\", {\n base: {\n position: \"relative\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n zIndex: \"base\",\n _before: {\n content: '\"\"',\n position: \"absolute\",\n top: \"-60px\",\n left: \"-50px\",\n right: \"0\",\n bottom: \"0\",\n height: \"calc(100% + 50px)\",\n width: \"surface.3xlarge\",\n transform: \"rotate(-4deg)\",\n zIndex: \"hide\",\n },\n },\n variants: {\n variant: BackgroundVariant,\n imageExists: {\n true: {\n tabletDown: {\n _before: {\n display: \"none\",\n },\n },\n },\n },\n },\n});\n\nconst ImageWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"xxsmall\",\n alignItems: \"flex-start\",\n justifyContent: \"flex-start\",\n flexDirection: \"column\",\n zIndex: \"base\",\n tabletDown: {\n _before: {\n content: '\"\"',\n position: \"absolute\",\n top: \"-50px\",\n left: \"-50px\",\n right: \"0\",\n bottom: \"0\",\n height: \"surface.xxsmall\",\n width: \"surface.3xlarge\",\n transform: \"rotate(-4deg)\",\n zIndex: \"hide\",\n },\n },\n },\n variants: {\n variant: BackgroundVariant,\n },\n});\n\nconst StyledImage = styled(\"img\", {\n base: {\n borderRadius: \"xsmall\",\n width: \"surface.xsmall\",\n height: \"surface.xsmall\",\n objectFit: \"cover\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n flex: \"1\",\n width: \"100%\",\n },\n});\n\nconst StyledDescription = styled(Text, {\n base: {\n fontFamily: \"serif\",\n },\n});\n\ninterface Props {\n image?: IImageMetaInformationV3DTO;\n jobTitle: string;\n description: string;\n backgroundColor?: ContactBlockBackground;\n imageWidth?: number;\n name: string;\n email: string;\n embedAlt?: string;\n lang?: string;\n}\n\nexport const ContactBlock = ({\n image,\n jobTitle,\n description,\n name,\n email,\n embedAlt,\n lang,\n backgroundColor = \"strong\",\n}: Props) => {\n const { t } = useTranslation();\n return (\n <StyledWrapper data-embed-type=\"contact-block\">\n <ContentWrapper>\n <HeaderWrapper variant={backgroundColor} imageExists={!!image}>\n <Text lang={lang} fontWeight=\"bold\" textStyle=\"heading.small\">\n {name}\n </Text>\n <Text lang={lang}>{jobTitle}</Text>\n <Text>\n {`${t(\"email\")}: `}\n <EmailLink href={`mailto:${email}`}>{email}</EmailLink>\n </Text>\n </HeaderWrapper>\n <StyledDescription textStyle=\"body.large\">{description}</StyledDescription>\n </ContentWrapper>\n {!!image && (\n <ImageWrapper variant={backgroundColor}>\n <StyledImage\n alt={embedAlt !== undefined ? embedAlt : image.alttext.alttext}\n src={image.image.imageUrl}\n width={300}\n height={300}\n />\n <LicenseContainerContent type=\"image\" copyright={image.copyright} />\n </ImageWrapper>\n )}\n </StyledWrapper>\n );\n};\n"],"mappings":";;;;;;;AAiBA,MAAMA,oBAAuE;CAC3E,QAAQ,EAAE,SAAS,EAAE,iB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AAC;AAEF,MAAM,cAAc,OAAO,OAAO,EAChC,MAAM;CACJ,cAAc;CACd,OAAO;CACP,QAAQ;CACR,WAAW;AACZ,EACF,EAAC;AAEF,MAAM,iBAAiB,OAAO,OAAO,EACnC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,MAAM;CACN,OAAO;AACR,EACF,EAAC;AAEF,MAAM,oBAAoB,OAAO,MAAM,EACrC,MAAM,EACJ,YAAY,QACb,EACF,EAAC;AAcF,MAAa,eAAe,CAAC,EAC3B,OACA,UACA,aACA,MACA,OACA,UACA,MACA,kBAAkB,UACZ,KAAK;CACX,MAAM,EAAE,GAAG,GAAG,gBAAgB;AAC9B,wBACE,KAAC;EAAc,mBAAgB;6BAC7B,KAAC,6CACC,KAAC;GAAc,SAAS;GAAiB,eAAe;;oBACtD,IAAC;KAAW;KAAM,YAAW;KAAO,WAAU;eAC3C;MACI;oBACP,IAAC;KAAW;eAAO;MAAgB;oBACnC,KAAC,oBACG,EAAE,EAAE,QAAQ,CAAC,qBACf,IAAC;KAAU,OAAO,SAAS,MAAM;eAAI;MAAkB,IAClD;;IACO,kBAChB,IAAC;GAAkB,WAAU;aAAc;IAAgC,IAC5D,IACd,yBACD,KAAC;GAAa,SAAS;8BACrB,IAAC;IACC,KAAK,sBAAyB,WAAW,MAAM,QAAQ;IACvD,KAAK,MAAM,MAAM;IACjB,OAAO;IACP,QAAQ;KACR,kBACF,IAAC;IAAwB,MAAK;IAAQ,WAAW,MAAM;KAAa;IACvD;GAEH;AAEnB"}
@@ -1,4 +1,4 @@
1
- import { ASSESSMENT_RESOURCES, AUDIO, CONCEPT, EXTERNAL, FRONTPAGE_ARTICLE, GLOSS, IMAGE, LEARNING_PATH, MISSING, MULTIDISCIPLINARY, PODCAST, PODCAST_SERIES, PROGRAMME, SOURCE_MATERIAL, SUBJECT, SUBJECT_MATERIAL, TASKS_AND_ACTIVITIES, TOPIC, VIDEO } from "../model/ContentType.js";
1
+ import { ASSESSMENT_RESOURCES, AUDIO, CONCEPT, EXTERNAL, FRONTPAGE_ARTICLE, GLOSS, IMAGE, LEARNING_PATH, MISSING, MULTIDISCIPLINARY, PODCAST, PODCAST_SERIES, PROGRAMME, SOURCE_MATERIAL, SUBJECT, SUBJECT_MATERIAL, TASKS_AND_ACTIVITIES, TOPIC, VIDEO } from "../model/ContentType.mjs";
2
2
  import { forwardRef } from "react";
3
3
  import { Badge } from "@ndla/primitives";
4
4
  import { useTranslation } from "react-i18next";
@@ -38,4 +38,4 @@ const ContentTypeBadge = forwardRef(({ contentType, children,...props }, ref) =>
38
38
 
39
39
  //#endregion
40
40
  export { ContentTypeBadge, contentTypeToBadgeVariantMap };
41
- //# sourceMappingURL=ContentTypeBadge.js.map
41
+ //# sourceMappingURL=ContentTypeBadge.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentTypeBadge.mjs","names":["contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant>"],"sources":["../../src/ContentTypeBadge/ContentTypeBadge.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { forwardRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Badge, type BadgeProps, type BadgeVariant } from \"@ndla/primitives\";\nimport * as contentTypes from \"../model/ContentType\";\n\nexport interface ContentTypeBadgeProps extends Omit<BadgeProps, \"colorTheme\"> {\n contentType: ContentType | undefined;\n}\n\nexport type StrictContentType =\n | typeof contentTypes.SUBJECT_MATERIAL\n | typeof contentTypes.TASKS_AND_ACTIVITIES\n | typeof contentTypes.ASSESSMENT_RESOURCES\n | typeof contentTypes.SUBJECT\n | typeof contentTypes.SOURCE_MATERIAL\n | typeof contentTypes.LEARNING_PATH\n | typeof contentTypes.TOPIC\n | typeof contentTypes.MULTIDISCIPLINARY\n | typeof contentTypes.CONCEPT\n | typeof contentTypes.EXTERNAL\n | typeof contentTypes.IMAGE\n | typeof contentTypes.AUDIO\n | typeof contentTypes.VIDEO\n | typeof contentTypes.MISSING\n | typeof contentTypes.PODCAST\n | typeof contentTypes.GLOSS\n | typeof contentTypes.PROGRAMME\n | typeof contentTypes.PODCAST_SERIES\n | typeof contentTypes.FRONTPAGE_ARTICLE;\n\nexport type ContentType =\n | StrictContentType\n // This allows for us to fallback to string without getting a ts error, while still keeping intellisense\n | (string & {});\n\nexport const contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant> = {\n [contentTypes.SUBJECT_MATERIAL]: \"brand1\",\n [contentTypes.TASKS_AND_ACTIVITIES]: \"brand2\",\n [contentTypes.ASSESSMENT_RESOURCES]: \"brand2\",\n [contentTypes.SUBJECT]: \"neutral\",\n [contentTypes.SOURCE_MATERIAL]: \"brand1\",\n [contentTypes.LEARNING_PATH]: \"brand3\",\n [contentTypes.TOPIC]: \"neutral\",\n [contentTypes.MULTIDISCIPLINARY]: \"neutral\",\n [contentTypes.CONCEPT]: \"brand1\",\n [contentTypes.EXTERNAL]: \"brand2\",\n [contentTypes.IMAGE]: \"brand1\",\n [contentTypes.AUDIO]: \"brand1\",\n [contentTypes.PODCAST]: \"brand1\",\n [contentTypes.VIDEO]: \"brand1\",\n [contentTypes.MISSING]: \"neutral\",\n [contentTypes.PODCAST_SERIES]: \"brand1\",\n [contentTypes.GLOSS]: \"brand1\",\n [contentTypes.PROGRAMME]: \"neutral\",\n [contentTypes.FRONTPAGE_ARTICLE]: \"brand2\",\n};\n\nexport const ContentTypeBadge = forwardRef<HTMLDivElement, ContentTypeBadgeProps>(\n ({ contentType, children, ...props }, ref) => {\n const { t } = useTranslation();\n return (\n <Badge\n colorTheme={contentTypeToBadgeVariantMap[contentType ?? \"missing\"] ?? contentTypeToBadgeVariantMap[\"missing\"]}\n {...props}\n ref={ref}\n >\n {children ?? t(`contentTypes.${contentType}`)}\n </Badge>\n );\n },\n);\n"],"mappings":";;;;;;;AA2CA,MAAaA,+BAAkE;qBAC5C;yBACI;yBACA;YACb;oBACQ;kBACF;UACR;sBACY;YACV;aACC;UACH;UACA;YACE;UACF;YACE;mBACO;UACT;cACI;sBACQ;AACnC;AAED,MAAa,mBAAmB,WAC9B,CAAC,EAAE,aAAa,SAAU,GAAG,OAAO,EAAE,QAAQ;CAC5C,MAAM,EAAE,GAAG,GAAG,gBAAgB;AAC9B,wBACE,IAAC;EACC,YAAY,6BAA6B,eAAe,cAAc,6BAA6B;EACnG,GAAI;EACC;YAEJ,YAAY,GAAG,eAAe,YAAY,EAAE;GACvC;AAEX,EACF"}
@@ -22,4 +22,4 @@ const ContentTypeBlockQuote = forwardRef(({ variant, contentType,...props }, ref
22
22
 
23
23
  //#endregion
24
24
  export { ContentTypeBlockQuote };
25
- //# sourceMappingURL=ContentTypeBlockQuote.js.map
25
+ //# sourceMappingURL=ContentTypeBlockQuote.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentTypeBlockQuote.mjs","names":[],"sources":["../../src/ContentTypeBlockQuote/ContentTypeBlockQuote.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { forwardRef } from \"react\";\nimport { BlockQuote, type BlockQuoteProps, type BlockQuoteVariantProps } from \"@ndla/primitives\";\nimport type { ContentType } from \"../ContentTypeBadge/ContentTypeBadge\";\n\nexport type ContentTypeBlockQuoteVariant = \"colored\" | \"neutral\";\n\nconst contentTypeToVariantMapping = {\n \"subject-material\": \"brand1\",\n \"source-material\": \"brand1\",\n concept: \"brand1\",\n \"tasks-and-activities\": \"brand2\",\n \"assessment-resources\": \"brand2\",\n} as Record<ContentType, NonNullable<BlockQuoteVariantProps>[\"variant\"]>;\n\ninterface Props extends Omit<BlockQuoteProps, \"variant\"> {\n variant?: ContentTypeBlockQuoteVariant;\n contentType?: ContentType;\n}\n\nexport const ContentTypeBlockQuote = forwardRef<HTMLQuoteElement, Props>(({ variant, contentType, ...props }, ref) => {\n const color = contentType ? (contentTypeToVariantMapping[contentType] ?? \"brand1\") : \"brand1\";\n const variantColor = variant === \"colored\" ? color : undefined;\n return <BlockQuote {...props} variant={variantColor} ref={ref} />;\n});\n"],"mappings":";;;;;AAcA,MAAM,8BAA8B;CAClC,oBAAoB;CACpB,mBAAmB;CACnB,SAAS;CACT,wBAAwB;CACxB,wBAAwB;AACzB;AAOD,MAAa,wBAAwB,WAAoC,CAAC,EAAE,SAAS,YAAa,GAAG,OAAO,EAAE,QAAQ;CACpH,MAAM,QAAQ,cAAe,4BAA4B,gBAAgB,WAAY;CACrF,MAAM,eAAe,YAAY,YAAY;AAC7C,wBAAO,IAAC;EAAW,GAAI;EAAO,SAAS;EAAmB;GAAO;AAClE,EAAC"}
@@ -22,4 +22,4 @@ const ContentTypeFramedContent = forwardRef(({ variant = "neutral", contentType,
22
22
 
23
23
  //#endregion
24
24
  export { ContentTypeFramedContent };
25
- //# sourceMappingURL=ContentTypeFramedContent.js.map
25
+ //# sourceMappingURL=ContentTypeFramedContent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentTypeFramedContent.mjs","names":[],"sources":["../../src/ContentTypeFramedContent/ContentTypeFramedContent.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { forwardRef } from \"react\";\nimport { FramedContent, type FramedContentProps, type FramedContentVariantProps } from \"@ndla/primitives\";\nimport type { ContentType } from \"..\";\n\nconst contentTypeToVariantMapping = {\n \"subject-material\": \"brand1\",\n \"source-material\": \"brand1\",\n concept: \"brand1\",\n \"tasks-and-activities\": \"brand2\",\n \"assessment-resources\": \"brand2\",\n} as Record<ContentType, NonNullable<FramedContentVariantProps>[\"colorTheme\"]>;\n\nexport type ContentTypeFramedContentVariant = \"colored\" | \"neutral\";\n\ninterface Props extends FramedContentProps {\n variant?: ContentTypeFramedContentVariant;\n contentType?: ContentType;\n}\n\nexport const ContentTypeFramedContent = forwardRef<HTMLDivElement, Props>(\n ({ variant = \"neutral\", contentType, ...props }, ref) => {\n const color = contentType ? (contentTypeToVariantMapping[contentType] ?? \"brand1\") : \"brand1\";\n const variantColor = variant === \"colored\" ? color : undefined;\n return <FramedContent {...props} colorTheme={variantColor} ref={ref} />;\n },\n);\n"],"mappings":";;;;;AAYA,MAAM,8BAA8B;CAClC,oBAAoB;CACpB,mBAAmB;CACnB,SAAS;CACT,wBAAwB;CACxB,wBAAwB;AACzB;AASD,MAAa,2BAA2B,WACtC,CAAC,EAAE,UAAU,WAAW,YAAa,GAAG,OAAO,EAAE,QAAQ;CACvD,MAAM,QAAQ,cAAe,4BAA4B,gBAAgB,WAAY;CACrF,MAAM,eAAe,YAAY,YAAY;AAC7C,wBAAO,IAAC;EAAc,GAAI;EAAO,YAAY;EAAmB;GAAO;AACxE,EACF"}
@@ -1,4 +1,4 @@
1
- import { ASSESSMENT_RESOURCES, AUDIO, CONCEPT, EXTERNAL, FRONTPAGE_ARTICLE, GLOSS, IMAGE, LEARNING_PATH, MISSING, MULTIDISCIPLINARY, PODCAST, PODCAST_SERIES, PROGRAMME, SOURCE_MATERIAL, SUBJECT, SUBJECT_MATERIAL, TASKS_AND_ACTIVITIES, TOPIC, VIDEO } from "../model/ContentType.js";
1
+ import { ASSESSMENT_RESOURCES, AUDIO, CONCEPT, EXTERNAL, FRONTPAGE_ARTICLE, GLOSS, IMAGE, LEARNING_PATH, MISSING, MULTIDISCIPLINARY, PODCAST, PODCAST_SERIES, PROGRAMME, SOURCE_MATERIAL, SUBJECT, SUBJECT_MATERIAL, TASKS_AND_ACTIVITIES, TOPIC, VIDEO } from "../model/ContentType.mjs";
2
2
  import { forwardRef } from "react";
3
3
  import { Hero } from "@ndla/primitives";
4
4
  import { jsx } from "react/jsx-runtime";
@@ -36,4 +36,4 @@ const ContentTypeHero = forwardRef(({ contentType, children,...props }, ref) =>
36
36
 
37
37
  //#endregion
38
38
  export { ContentTypeHero };
39
- //# sourceMappingURL=ContentTypeHero.js.map
39
+ //# sourceMappingURL=ContentTypeHero.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentTypeHero.mjs","names":["contentTypeToHeroMap: Record<ContentType, HeroVariant>"],"sources":["../../src/ContentTypeHero/ContentTypeHero.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { forwardRef } from \"react\";\nimport { Hero, type HeroProps, type HeroVariant } from \"@ndla/primitives\";\nimport type { ContentType } from \"../ContentTypeBadge/ContentTypeBadge\";\nimport * as contentTypes from \"../model/ContentType\";\n\nexport const contentTypeToHeroMap: Record<ContentType, HeroVariant> = {\n [contentTypes.SUBJECT_MATERIAL]: \"primary\",\n [contentTypes.TASKS_AND_ACTIVITIES]: \"brand2Bold\",\n [contentTypes.ASSESSMENT_RESOURCES]: \"brand2\",\n // This will never happen\n [contentTypes.SUBJECT]: \"primary\",\n [contentTypes.SOURCE_MATERIAL]: \"brand1\",\n // This will never happen\n [contentTypes.LEARNING_PATH]: \"primary\",\n [contentTypes.TOPIC]: \"neutral\",\n [contentTypes.MULTIDISCIPLINARY]: \"primary\",\n [contentTypes.CONCEPT]: \"brand1Moderate\",\n [contentTypes.EXTERNAL]: \"primary\",\n [contentTypes.IMAGE]: \"primary\",\n [contentTypes.AUDIO]: \"primary\",\n [contentTypes.PODCAST]: \"primary\",\n [contentTypes.VIDEO]: \"primary\",\n [contentTypes.MISSING]: \"neutral\",\n [contentTypes.GLOSS]: \"brand1Moderate\",\n // this will never happen\n [contentTypes.PROGRAMME]: \"primary\",\n // this will never happen\n [contentTypes.PODCAST_SERIES]: \"primary\",\n [contentTypes.FRONTPAGE_ARTICLE]: \"primary\",\n};\n\nexport interface ContentTypeHeroProps extends HeroProps {\n contentType: ContentType | undefined;\n}\n\nexport const ContentTypeHero = forwardRef<HTMLDivElement, ContentTypeHeroProps>(\n ({ contentType, children, ...props }, ref) => {\n return (\n <Hero\n variant={contentTypeToHeroMap[contentType ?? \"missing\"] ?? contentTypeToHeroMap[\"missing\"]}\n {...props}\n ref={ref}\n >\n {children}\n </Hero>\n );\n },\n);\n"],"mappings":";;;;;;AAaA,MAAaA,uBAAyD;qBACnC;yBACI;yBACA;YAEb;oBACQ;kBAEF;UACR;sBACY;YACV;aACC;UACH;UACA;YACE;UACF;YACE;UACF;cAEI;mBAEK;sBACG;AACnC;AAMD,MAAa,kBAAkB,WAC7B,CAAC,EAAE,aAAa,SAAU,GAAG,OAAO,EAAE,QAAQ;AAC5C,wBACE,IAAC;EACC,SAAS,qBAAqB,eAAe,cAAc,qBAAqB;EAChF,GAAI;EACC;EAEJ;GACI;AAEV,EACF"}
@@ -59,4 +59,4 @@ var CopyParagraphButton_default = CopyParagraphButton;
59
59
 
60
60
  //#endregion
61
61
  export { CopyParagraphButton_default as CopyParagraphButton_default$1 };
62
- //# sourceMappingURL=CopyParagraphButton.js.map
62
+ //# sourceMappingURL=CopyParagraphButton.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyParagraphButton.mjs","names":[],"sources":["../../src/CopyParagraphButton/CopyParagraphButton.tsx"],"sourcesContent":["/**\n * Copyright (c) 2021-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ReactNode, useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { LinkMedium } from \"@ndla/icons\";\nimport { IconButton } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { copyTextToClipboard } from \"@ndla/util\";\n\nconst ContainerDiv = styled(\"div\", {\n base: {\n position: \"relative\",\n _hover: {\n \"& [data-copy-button]\": {\n opacity: \"1\",\n cursor: \"pointer\",\n },\n },\n },\n});\n\nconst StyledIconButton = styled(IconButton, {\n base: {\n position: \"absolute\",\n left: \"-xxlarge\",\n top: \"-4xsmall\",\n opacity: \"0\",\n cursor: \"pointer\",\n \"&:focus, &:focus-visible, &:active\": {\n opacity: \"1\",\n },\n },\n});\n\ninterface Props {\n // What to render within the h2\n children: ReactNode;\n copyText: string;\n lang?: string;\n}\nconst CopyParagraphButton = ({ children, copyText, lang }: Props) => {\n const [hasCopied, setHasCopied] = useState(false);\n const { t } = useTranslation();\n const sanitizedTitle = useMemo(() => encodeURIComponent(copyText.replace(/ /g, \"-\")), [copyText]);\n\n useEffect(() => {\n if (hasCopied) {\n setTimeout(() => setHasCopied(false), 3000);\n }\n }, [hasCopied]);\n\n const onCopyClick = useCallback(() => {\n setHasCopied(true);\n const { location } = window;\n const newHash = `#${sanitizedTitle}`;\n const port = location.port ? `:${location.port}` : \"\";\n const urlToCopy = `${location.protocol}//${location.hostname}${port}${location.pathname}${location.search}${newHash}`;\n\n copyTextToClipboard(urlToCopy);\n }, [sanitizedTitle]);\n\n const tooltip = hasCopied ? t(\"article.copyPageLinkCopied\") : t(\"article.copyHeaderLink\");\n return (\n <ContainerDiv data-embed-type=\"copy-heading\">\n <StyledIconButton\n variant=\"clear\"\n data-copy-button=\"\"\n onClick={onCopyClick}\n title={tooltip}\n aria-label={`${tooltip}: ${copyText}`}\n >\n <LinkMedium />\n </StyledIconButton>\n <h2 id={sanitizedTitle} tabIndex={-1} lang={lang}>\n {children}\n </h2>\n </ContainerDiv>\n );\n};\n\nexport default CopyParagraphButton;\n"],"mappings":";;;;;;;;;AAeA,MAAM,eAAe,OAAO,OAAO,EACjC,MAAM;CACJ,UAAU;CACV,QAAQ,EACN,wBAAwB;EACtB,SAAS;EACT,QAAQ;CACT,EACF;AACF,EACF,EAAC;AAEF,MAAM,mBAAmB,OAAO,YAAY,EAC1C,MAAM;CACJ,UAAU;CACV,MAAM;CACN,KAAK;CACL,SAAS;CACT,QAAQ;CACR,sCAAsC,EACpC,SAAS,IACV;AACF,EACF,EAAC;AAQF,MAAM,sBAAsB,CAAC,EAAE,UAAU,UAAU,MAAa,KAAK;CACnE,MAAM,CAAC,WAAW,aAAa,GAAG,SAAS,MAAM;CACjD,MAAM,EAAE,GAAG,GAAG,gBAAgB;CAC9B,MAAM,iBAAiB,QAAQ,MAAM,mBAAmB,SAAS,QAAQ,MAAM,IAAI,CAAC,EAAE,CAAC,QAAS,EAAC;AAEjG,WAAU,MAAM;AACd,MAAI,UACF,YAAW,MAAM,aAAa,MAAM,EAAE,IAAK;CAE9C,GAAE,CAAC,SAAU,EAAC;CAEf,MAAM,cAAc,YAAY,MAAM;AACpC,eAAa,KAAK;EAClB,MAAM,EAAE,UAAU,GAAG;EACrB,MAAM,WAAW,GAAG,eAAe;EACnC,MAAM,OAAO,SAAS,QAAQ,GAAG,SAAS,KAAK,IAAI;EACnD,MAAM,aAAa,EAAE,SAAS,SAAS,IAAI,SAAS,SAAS,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,SAAS,OAAO,EAAE,QAAQ;AAEpH,sBAAoB,UAAU;CAC/B,GAAE,CAAC,cAAe,EAAC;CAEpB,MAAM,UAAU,YAAY,EAAE,6BAA6B,GAAG,EAAE,yBAAyB;AACzF,wBACE,KAAC;EAAa,mBAAgB;6BAC5B,IAAC;GACC,SAAQ;GACR,oBAAiB;GACjB,SAAS;GACT,OAAO;GACP,eAAa,EAAE,QAAQ,IAAI,SAAS;6BAEpC,IAAC,eAAa;IACG,kBACnB,IAAC;GAAG,IAAI;GAAgB,UAAU;GAAU;GACzC;IACE;GACQ;AAElB;AAED,kCAAe"}
@@ -1,8 +1,8 @@
1
- import { CopyParagraphButton_default$1 as CopyParagraphButton_default } from "./CopyParagraphButton.js";
1
+ import { CopyParagraphButton_default$1 as CopyParagraphButton_default } from "./CopyParagraphButton.mjs";
2
2
 
3
3
  //#region src/CopyParagraphButton/index.tsx
4
4
  var CopyParagraphButton_default$1 = CopyParagraphButton_default;
5
5
 
6
6
  //#endregion
7
7
  export { CopyParagraphButton_default$1 as CopyParagraphButton_default };
8
- //# sourceMappingURL=index.js.map
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["CopyParagraphButton"],"sources":["../../src/CopyParagraphButton/index.tsx"],"sourcesContent":["/**\n * Copyright (c) 2021-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport CopyParagraphButton from \"./CopyParagraphButton\";\n\nexport { CopyParagraphButton };\nexport default CopyParagraphButton;\n"],"mappings":";;;AAWA,oCAAeA"}
@@ -1,7 +1,7 @@
1
- import { EmbedByline } from "../LicenseByline/EmbedByline.js";
2
- import { EmbedErrorPlaceholder_default } from "./EmbedErrorPlaceholder.js";
3
- import { licenseAttributes } from "../utils/licenseAttributes.js";
4
- import { AudioPlayer_default } from "../AudioPlayer/index.js";
1
+ import { EmbedByline } from "../LicenseByline/EmbedByline.mjs";
2
+ import { EmbedErrorPlaceholder_default } from "./EmbedErrorPlaceholder.mjs";
3
+ import { licenseAttributes } from "../utils/licenseAttributes.mjs";
4
+ import { AudioPlayer_default } from "../AudioPlayer/index.mjs";
5
5
  import { Figure } from "@ndla/primitives";
6
6
  import { styled } from "@ndla/styled-system/jsx";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -49,4 +49,4 @@ var AudioEmbed_default = AudioEmbed;
49
49
 
50
50
  //#endregion
51
51
  export { AudioEmbed_default };
52
- //# sourceMappingURL=AudioEmbed.js.map
52
+ //# sourceMappingURL=AudioEmbed.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AudioEmbed.mjs","names":["EmbedErrorPlaceholder","AudioPlayer"],"sources":["../../src/Embed/AudioEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { AudioMetaData } from \"@ndla/types-embed\";\nimport EmbedErrorPlaceholder from \"./EmbedErrorPlaceholder\";\nimport type { Author } from \"./ImageEmbed\";\nimport AudioPlayer from \"../AudioPlayer\";\nimport { EmbedByline } from \"../LicenseByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nconst StyledFigure = styled(Figure, {\n base: {\n clear: \"both\",\n },\n});\n\ninterface Props {\n embed: AudioMetaData;\n lang?: string;\n}\n\nexport const getFirstNonEmptyLicenseCredits = (authors: {\n creators: Author[];\n rightsholders: Author[];\n processors: Author[];\n}) => Object.values(authors).find((i) => i.length > 0) ?? [];\n\nconst AudioEmbed = ({ embed, lang }: Props) => {\n const type = embed.embedData.type === \"standard\" ? \"audio\" : \"podcast\";\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type={type} />;\n }\n\n const { data, embedData } = embed;\n\n if (embedData.type === \"minimal\") {\n return <AudioPlayer speech src={data.audioFile.url} title={data.title.title} />;\n }\n\n const subtitle = data.series ? { title: data.series.title.title, url: `/podkast/${data.series.id}` } : undefined;\n\n const coverPhoto = data.podcastMeta?.coverPhoto;\n\n const img = coverPhoto && { url: coverPhoto.url, alt: coverPhoto.altText };\n\n const licenseProps = licenseAttributes(data.copyright.license.license, lang, embedData.url);\n\n return (\n <StyledFigure lang={lang} data-embed-type={type} {...licenseProps}>\n <AudioPlayer\n description={data.podcastMeta?.introduction ?? \"\"}\n img={img}\n src={data.audioFile.url}\n textVersion={\n data.manuscript?.manuscript.length ? (\n <div dangerouslySetInnerHTML={{ __html: data.manuscript.manuscript }} />\n ) : undefined\n }\n title={data.title.title}\n subtitle={subtitle}\n />\n <EmbedByline\n error={false}\n type={data.audioType === \"standard\" ? \"audio\" : \"podcast\"}\n copyright={embed.data.copyright}\n />\n </StyledFigure>\n );\n};\n\nexport default AudioEmbed;\n"],"mappings":";;;;;;;;;AAiBA,MAAM,eAAe,OAAO,QAAQ,EAClC,MAAM,EACJ,OAAO,OACR,EACF,EAAC;AAaF,MAAM,aAAa,CAAC,EAAE,OAAO,MAAa,KAAK;CAC7C,MAAM,OAAO,MAAM,UAAU,SAAS,aAAa,UAAU;AAC7D,KAAI,MAAM,WAAW,QACnB,wBAAO,IAACA,iCAA4B,OAAQ;CAG9C,MAAM,EAAE,MAAM,WAAW,GAAG;AAE5B,KAAI,UAAU,SAAS,UACrB,wBAAO,IAACC;EAAY;EAAO,KAAK,KAAK,UAAU;EAAK,OAAO,KAAK,MAAM;GAAS;CAGjF,MAAM,WAAW,KAAK,SAAS;EAAE,OAAO,KAAK,OAAO,MAAM;EAAO,MAAM,WAAW,KAAK,OAAO,GAAG;CAAG;CAEpG,MAAM,aAAa,KAAK,aAAa;CAErC,MAAM,MAAM,cAAc;EAAE,KAAK,WAAW;EAAK,KAAK,WAAW;CAAS;CAE1E,MAAM,eAAe,kBAAkB,KAAK,UAAU,QAAQ,SAAS,MAAM,UAAU,IAAI;AAE3F,wBACE,KAAC;EAAmB;EAAM,mBAAiB;EAAM,GAAI;6BACnD,IAACA;GACC,aAAa,KAAK,aAAa,gBAAgB;GAC1C;GACL,KAAK,KAAK,UAAU;GACpB,aACE,KAAK,YAAY,WAAW,yBAC1B,IAAC,SAAI,yBAAyB,EAAE,QAAQ,KAAK,WAAW,WAAY,IAAI;GAG5E,OAAO,KAAK,MAAM;GACR;IACV,kBACF,IAAC;GACC,OAAO;GACP,MAAM,KAAK,cAAc,aAAa,UAAU;GAChD,WAAW,MAAM,KAAK;IACtB;GACW;AAElB;AAED,yBAAe"}