@ndla/ui 56.0.191-alpha.0 → 56.0.194-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/panda.buildinfo.json +10 -0
  2. package/dist/styles.css +53 -1
  3. package/es/AnchorHeading/AnchorHeading.mjs.map +1 -1
  4. package/es/Article/Article.mjs +1 -1
  5. package/es/Article/Article.mjs.map +1 -1
  6. package/es/Article/ArticleByline.mjs +1 -1
  7. package/es/Article/ArticleByline.mjs.map +1 -1
  8. package/es/Article/ArticleFootNotes.mjs.map +1 -1
  9. package/es/Article/BadgesContainer.mjs.map +1 -1
  10. package/es/AudioPlayer/AudioElement.mjs.map +1 -1
  11. package/es/AudioPlayer/AudioPlayer.mjs.map +1 -1
  12. package/es/AudioPlayer/AudioProgress.mjs.map +1 -1
  13. package/es/AudioPlayer/CompactAudioPlayer.mjs.map +1 -1
  14. package/es/AudioPlayer/Controls.mjs +1 -1
  15. package/es/AudioPlayer/Controls.mjs.map +1 -1
  16. package/es/AudioPlayer/PlayButton.mjs.map +1 -1
  17. package/es/AudioPlayer/SpeechControl.mjs.map +1 -1
  18. package/es/AudioPlayer/VolumeSlider.mjs.map +1 -1
  19. package/es/AudioPlayer/audioUtils.mjs.map +1 -1
  20. package/es/AudioPlayer/useAudioControls.mjs.map +1 -1
  21. package/es/Breadcrumb/Breadcrumb.mjs.map +1 -1
  22. package/es/Breadcrumb/BreadcrumbItem.mjs.map +1 -1
  23. package/es/Breadcrumb/HomeBreadcrumb.mjs.map +1 -1
  24. package/es/CampaignBlock/CampaignBlock.mjs.map +1 -1
  25. package/es/CodeBlock/CodeBlock.mjs.map +1 -1
  26. package/es/CodeBlock/codeLanguageOptions.mjs.map +1 -1
  27. package/es/Concept/Concept.mjs.map +1 -1
  28. package/es/ContactBlock/ContactBlock.mjs.map +1 -1
  29. package/es/Embed/AudioEmbed.mjs.map +1 -1
  30. package/es/Embed/BrightcoveEmbed.mjs.map +1 -1
  31. package/es/Embed/CodeEmbed.mjs.map +1 -1
  32. package/es/Embed/ConceptEmbed.mjs +1 -1
  33. package/es/Embed/ConceptEmbed.mjs.map +1 -1
  34. package/es/Embed/ConceptInlineTriggerButton.mjs.map +1 -1
  35. package/es/Embed/ContentLinkEmbed.mjs.map +1 -1
  36. package/es/Embed/CopyrightEmbed.mjs.map +1 -1
  37. package/es/Embed/EmbedErrorPlaceholder.mjs.map +1 -1
  38. package/es/Embed/EmbedWrapper.mjs +1 -1
  39. package/es/Embed/EmbedWrapper.mjs.map +1 -1
  40. package/es/Embed/ExternalEmbed.mjs.map +1 -1
  41. package/es/Embed/FootnoteEmbed.mjs.map +1 -1
  42. package/es/Embed/GlossEmbed.mjs +1 -1
  43. package/es/Embed/GlossEmbed.mjs.map +1 -1
  44. package/es/Embed/H5pEmbed.mjs.map +1 -1
  45. package/es/Embed/IframeEmbed.mjs.map +1 -1
  46. package/es/Embed/ImageEmbed.mjs.map +1 -1
  47. package/es/Embed/InlineTriggerButton.mjs.map +1 -1
  48. package/es/Embed/RelatedContentEmbed.mjs.map +1 -1
  49. package/es/Embed/UnknownEmbed.mjs.map +1 -1
  50. package/es/Embed/UuDisclaimerEmbed.mjs +50 -15
  51. package/es/Embed/UuDisclaimerEmbed.mjs.map +1 -1
  52. package/es/FactBox/FactBox.mjs.map +1 -1
  53. package/es/FileList/File.mjs.map +1 -1
  54. package/es/FileList/FileList.mjs +1 -1
  55. package/es/FileList/FileList.mjs.map +1 -1
  56. package/es/FileList/PdfFile.mjs.map +1 -1
  57. package/es/Gloss/Gloss.mjs +1 -1
  58. package/es/Gloss/Gloss.mjs.map +1 -1
  59. package/es/Gloss/GlossExample.mjs.map +1 -1
  60. package/es/Grid/Grid.mjs.map +1 -1
  61. package/es/KeyFigure/KeyFigure.mjs.map +1 -1
  62. package/es/LicenseByline/EmbedByline.mjs.map +1 -1
  63. package/es/LicenseByline/LicenseLink.mjs.map +1 -1
  64. package/es/LinkBlock/LinkBlock.mjs.map +1 -1
  65. package/es/LinkBlock/LinkBlockSection.mjs.map +1 -1
  66. package/es/Pitch/Pitch.mjs.map +1 -1
  67. package/es/RelatedArticleList/RelatedArticleList.mjs.map +1 -1
  68. package/es/ResourceBox/ResourceBox.mjs.map +1 -1
  69. package/es/TagSelector/TagSelector.mjs +3 -8
  70. package/es/TagSelector/TagSelector.mjs.map +1 -1
  71. package/es/ZendeskButton/ZendeskButton.mjs.map +1 -1
  72. package/es/i18n/useComponentTranslations.mjs +3 -3
  73. package/es/i18n/useComponentTranslations.mjs.map +1 -1
  74. package/es/model/ContentType.mjs.map +1 -1
  75. package/es/model/SubjectCategories.mjs.map +1 -1
  76. package/es/model/SubjectTypes.mjs.map +1 -1
  77. package/es/model/WordClass.mjs.map +1 -1
  78. package/es/model/index.mjs.map +1 -1
  79. package/es/utils/licenseAttributes.mjs.map +1 -1
  80. package/es/utils/relativeUrl.mjs.map +1 -1
  81. package/lib/AnchorHeading/AnchorHeading.js.map +1 -1
  82. package/lib/Article/Article.d.ts +4 -4
  83. package/lib/Article/Article.js +6 -6
  84. package/lib/Article/Article.js.map +1 -1
  85. package/lib/Article/ArticleByline.js +2 -2
  86. package/lib/Article/ArticleByline.js.map +1 -1
  87. package/lib/Article/ArticleFootNotes.js.map +1 -1
  88. package/lib/Article/BadgesContainer.js.map +1 -1
  89. package/lib/AudioPlayer/AudioElement.js.map +1 -1
  90. package/lib/AudioPlayer/AudioPlayer.js.map +1 -1
  91. package/lib/AudioPlayer/AudioProgress.d.ts +1 -1
  92. package/lib/AudioPlayer/AudioProgress.js.map +1 -1
  93. package/lib/AudioPlayer/CompactAudioPlayer.js.map +1 -1
  94. package/lib/AudioPlayer/Controls.js +2 -2
  95. package/lib/AudioPlayer/Controls.js.map +1 -1
  96. package/lib/AudioPlayer/PlayButton.js.map +1 -1
  97. package/lib/AudioPlayer/SpeechControl.js.map +1 -1
  98. package/lib/AudioPlayer/VolumeSlider.d.ts +1 -1
  99. package/lib/AudioPlayer/VolumeSlider.js.map +1 -1
  100. package/lib/AudioPlayer/audioUtils.js.map +1 -1
  101. package/lib/AudioPlayer/useAudioControls.d.ts +1 -1
  102. package/lib/AudioPlayer/useAudioControls.js.map +1 -1
  103. package/lib/Breadcrumb/Breadcrumb.js.map +1 -1
  104. package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -1
  105. package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -1
  106. package/lib/CampaignBlock/CampaignBlock.js.map +1 -1
  107. package/lib/CodeBlock/CodeBlock.js.map +1 -1
  108. package/lib/CodeBlock/codeLanguageOptions.js.map +1 -1
  109. package/lib/Concept/Concept.js.map +1 -1
  110. package/lib/ContactBlock/ContactBlock.js.map +1 -1
  111. package/lib/Embed/AudioEmbed.js.map +1 -1
  112. package/lib/Embed/BrightcoveEmbed.js.map +1 -1
  113. package/lib/Embed/CodeEmbed.js.map +1 -1
  114. package/lib/Embed/ConceptEmbed.js +2 -2
  115. package/lib/Embed/ConceptEmbed.js.map +1 -1
  116. package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -1
  117. package/lib/Embed/ContentLinkEmbed.js.map +1 -1
  118. package/lib/Embed/CopyrightEmbed.js.map +1 -1
  119. package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -1
  120. package/lib/Embed/EmbedWrapper.d.ts +1 -1
  121. package/lib/Embed/EmbedWrapper.js +2 -2
  122. package/lib/Embed/EmbedWrapper.js.map +1 -1
  123. package/lib/Embed/ExternalEmbed.js.map +1 -1
  124. package/lib/Embed/FootnoteEmbed.js.map +1 -1
  125. package/lib/Embed/GlossEmbed.js +2 -2
  126. package/lib/Embed/GlossEmbed.js.map +1 -1
  127. package/lib/Embed/H5pEmbed.js.map +1 -1
  128. package/lib/Embed/IframeEmbed.js.map +1 -1
  129. package/lib/Embed/ImageEmbed.js.map +1 -1
  130. package/lib/Embed/InlineTriggerButton.js.map +1 -1
  131. package/lib/Embed/RelatedContentEmbed.js.map +1 -1
  132. package/lib/Embed/UnknownEmbed.js.map +1 -1
  133. package/lib/Embed/UuDisclaimerEmbed.js +49 -14
  134. package/lib/Embed/UuDisclaimerEmbed.js.map +1 -1
  135. package/lib/FactBox/FactBox.js.map +1 -1
  136. package/lib/FileList/File.js.map +1 -1
  137. package/lib/FileList/FileList.d.ts +2 -2
  138. package/lib/FileList/FileList.js +3 -3
  139. package/lib/FileList/FileList.js.map +1 -1
  140. package/lib/FileList/PdfFile.js.map +1 -1
  141. package/lib/Gloss/Gloss.d.ts +2 -2
  142. package/lib/Gloss/Gloss.js +2 -2
  143. package/lib/Gloss/Gloss.js.map +1 -1
  144. package/lib/Gloss/GlossExample.js.map +1 -1
  145. package/lib/Grid/Grid.js.map +1 -1
  146. package/lib/KeyFigure/KeyFigure.js.map +1 -1
  147. package/lib/LicenseByline/EmbedByline.js.map +1 -1
  148. package/lib/LicenseByline/LicenseLink.js.map +1 -1
  149. package/lib/LinkBlock/LinkBlock.js.map +1 -1
  150. package/lib/LinkBlock/LinkBlockSection.js.map +1 -1
  151. package/lib/Pitch/Pitch.js.map +1 -1
  152. package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -1
  153. package/lib/ResourceBox/ResourceBox.js.map +1 -1
  154. package/lib/TagSelector/TagSelector.d.ts +4 -4
  155. package/lib/TagSelector/TagSelector.js +6 -4
  156. package/lib/TagSelector/TagSelector.js.map +1 -1
  157. package/lib/ZendeskButton/ZendeskButton.js.map +1 -1
  158. package/lib/i18n/useComponentTranslations.d.ts +1 -1
  159. package/lib/i18n/useComponentTranslations.js +3 -3
  160. package/lib/i18n/useComponentTranslations.js.map +1 -1
  161. package/lib/model/ContentType.js.map +1 -1
  162. package/lib/model/SubjectCategories.js.map +1 -1
  163. package/lib/model/SubjectTypes.js.map +1 -1
  164. package/lib/model/WordClass.js.map +1 -1
  165. package/lib/model/index.js.map +1 -1
  166. package/lib/utils/licenseAttributes.js.map +1 -1
  167. package/lib/utils/relativeUrl.js.map +1 -1
  168. package/package.json +9 -9
  169. package/src/Article/Article.tsx +1 -1
  170. package/src/Article/ArticleByline.tsx +1 -1
  171. package/src/AudioPlayer/AudioProgress.tsx +1 -1
  172. package/src/AudioPlayer/Controls.tsx +1 -1
  173. package/src/AudioPlayer/SpeechControl.tsx +1 -1
  174. package/src/AudioPlayer/VolumeSlider.tsx +1 -1
  175. package/src/AudioPlayer/useAudioControls.ts +1 -1
  176. package/src/Embed/ConceptEmbed.tsx +1 -1
  177. package/src/Embed/EmbedWrapper.tsx +1 -1
  178. package/src/Embed/GlossEmbed.tsx +1 -1
  179. package/src/Embed/UuDisclaimerEmbed.stories.tsx +28 -1
  180. package/src/Embed/UuDisclaimerEmbed.tsx +32 -5
  181. package/src/FileList/FileList.tsx +1 -1
  182. package/src/Gloss/Gloss.tsx +1 -1
  183. package/src/TagSelector/TagSelector.stories.tsx +2 -1
  184. package/src/TagSelector/TagSelector.tsx +3 -1
  185. package/src/i18n/useComponentTranslations.ts +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"ConceptInlineTriggerButton.js","names":["InlineTriggerButton"],"sources":["../../src/Embed/ConceptInlineTriggerButton.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { InlineTriggerButton } from \"./InlineTriggerButton\";\n\nexport const ConceptInlineTriggerButton = styled(InlineTriggerButton, {\n base: {\n position: \"relative\",\n overflow: \"visible\",\n borderBottom: \"1px solid\",\n borderStyle: \"dashed\",\n borderColor: \"stroke.hover\",\n paddingBlockStart: \"5xsmall\",\n width: \"fit-content\",\n cursor: \"pointer\",\n _hover: {\n borderColor: \"text.link\",\n background: \"surface.actionSubtle.hover\",\n },\n _active: {\n borderColor: \"text.link\",\n background: \"surface.actionSubtle.active\",\n },\n // The global focus ring forces the border-radius to be xsmall, causing the dashed border to be cut off. This is a workaround.\n _focusVisible: {\n outline: \"none\",\n borderRadius: \"0\",\n _after: {\n content: '\"\"',\n position: \"absolute\",\n inset: \"0\",\n outline: \"3px\",\n borderRadius: \"xsmall\",\n outlineColor: \"stroke.default\",\n outlineOffset: \"3px\",\n outlineStyle: \"solid\",\n },\n },\n },\n});\n"],"mappings":";;;;;;;;;;AAWA,MAAa,8BAAA,qCAAA,CAAA,QAAoCA,4BAAAA,qBAAqB,EACpE,MAAM;CACJ,UAAU;CACV,UAAU;CACV,cAAc;CACd,aAAa;CACb,aAAa;CACb,mBAAmB;CACnB,OAAO;CACP,QAAQ;CACR,QAAQ;EACN,aAAa;EACb,YAAY;EACb;CACD,SAAS;EACP,aAAa;EACb,YAAY;EACb;CAED,eAAe;EACb,SAAS;EACT,cAAc;EACd,QAAQ;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACP,SAAS;GACT,cAAc;GACd,cAAc;GACd,eAAe;GACf,cAAc;GACf;EACF;CACF,EACF,CAAC"}
1
+ {"version":3,"file":"ConceptInlineTriggerButton.js","names":["InlineTriggerButton"],"sources":["../../src/Embed/ConceptInlineTriggerButton.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { InlineTriggerButton } from \"./InlineTriggerButton\";\n\nexport const ConceptInlineTriggerButton = styled(InlineTriggerButton, {\n base: {\n position: \"relative\",\n overflow: \"visible\",\n borderBottom: \"1px solid\",\n borderStyle: \"dashed\",\n borderColor: \"stroke.hover\",\n paddingBlockStart: \"5xsmall\",\n width: \"fit-content\",\n cursor: \"pointer\",\n _hover: {\n borderColor: \"text.link\",\n background: \"surface.actionSubtle.hover\",\n },\n _active: {\n borderColor: \"text.link\",\n background: \"surface.actionSubtle.active\",\n },\n // The global focus ring forces the border-radius to be xsmall, causing the dashed border to be cut off. This is a workaround.\n _focusVisible: {\n outline: \"none\",\n borderRadius: \"0\",\n _after: {\n content: '\"\"',\n position: \"absolute\",\n inset: \"0\",\n outline: \"3px\",\n borderRadius: \"xsmall\",\n outlineColor: \"stroke.default\",\n outlineOffset: \"3px\",\n outlineStyle: \"solid\",\n },\n },\n },\n});\n"],"mappings":";;;;;;;;;;AAWA,MAAa,8BAAA,oCAAA,EAAA,QAAoCA,4BAAAA,qBAAqB,EACpE,MAAM;CACJ,UAAU;CACV,UAAU;CACV,cAAc;CACd,aAAa;CACb,aAAa;CACb,mBAAmB;CACnB,OAAO;CACP,QAAQ;CACR,QAAQ;EACN,aAAa;EACb,YAAY;CACd;CACA,SAAS;EACP,aAAa;EACb,YAAY;CACd;CAEA,eAAe;EACb,SAAS;EACT,cAAc;EACd,QAAQ;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACP,SAAS;GACT,cAAc;GACd,cAAc;GACd,eAAe;GACf,cAAc;EAChB;CACF;AACF,EACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ContentLinkEmbed.js","names":["Text"],"sources":["../../src/Embed/ContentLinkEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Text } from \"@ndla/primitives\";\nimport type { ContentLinkMetaData } from \"@ndla/types-embed\";\nimport type { ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\ninterface Props {\n embed: ContentLinkMetaData;\n isOembed?: boolean;\n children?: ReactNode;\n}\n\nexport const ContentLinkEmbed = ({ embed, isOembed, children }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return (\n <Text color=\"text.error\" asChild consumeCss>\n <span>\n <span>{`${t(\"embed.linkError\")}: `}</span>\n {children}\n </span>\n </Text>\n );\n }\n\n const { embedData, data } = embed;\n\n if (embedData.openIn === \"new-context\" || isOembed) {\n return (\n <a href={data.path} data-embed-type=\"content-link\" target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n }\n\n return <a href={data.path}>{children}</a>;\n};\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,oBAAoB,EAAE,OAAO,UAAU,eAAsB;CACxE,MAAM,EAAE,OAAA,GAAA,cAAA,iBAAsB;AAC9B,KAAI,MAAM,WAAW,QACnB,QACE,iBAAA,GAAA,kBAAA,KAACA,iBAAAA,MAAD;EAAM,OAAM;EAAa,SAAA;EAAQ,YAAA;YAC/B,iBAAA,GAAA,kBAAA,MAAC,QAAD,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAA,UAAO,GAAG,EAAE,kBAAkB,CAAC,KAAW,CAAA,EACzC,SACI,EAAA,CAAA;EACF,CAAA;CAIX,MAAM,EAAE,WAAW,SAAS;AAE5B,KAAI,UAAU,WAAW,iBAAiB,SACxC,QACE,iBAAA,GAAA,kBAAA,KAAC,KAAD;EAAG,MAAM,KAAK;EAAM,mBAAgB;EAAe,QAAO;EAAS,KAAI;EACpE;EACC,CAAA;AAIR,QAAO,iBAAA,GAAA,kBAAA,KAAC,KAAD;EAAG,MAAM,KAAK;EAAO;EAAa,CAAA"}
1
+ {"version":3,"file":"ContentLinkEmbed.js","names":["Text"],"sources":["../../src/Embed/ContentLinkEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Text } from \"@ndla/primitives\";\nimport type { ContentLinkMetaData } from \"@ndla/types-embed\";\nimport type { ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\ninterface Props {\n embed: ContentLinkMetaData;\n isOembed?: boolean;\n children?: ReactNode;\n}\n\nexport const ContentLinkEmbed = ({ embed, isOembed, children }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return (\n <Text color=\"text.error\" asChild consumeCss>\n <span>\n <span>{`${t(\"embed.linkError\")}: `}</span>\n {children}\n </span>\n </Text>\n );\n }\n\n const { embedData, data } = embed;\n\n if (embedData.openIn === \"new-context\" || isOembed) {\n return (\n <a href={data.path} data-embed-type=\"content-link\" target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n }\n\n return <a href={data.path}>{children}</a>;\n};\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,oBAAoB,EAAE,OAAO,UAAU,eAAsB;CACxE,MAAM,EAAE,OAAA,GAAA,cAAA,gBAAqB;CAC7B,IAAI,MAAM,WAAW,SACnB,OACE,iBAAA,GAAA,kBAAA,KAACA,iBAAAA,MAAD;EAAM,OAAM;EAAa,SAAA;EAAQ,YAAA;YAC/B,iBAAA,GAAA,kBAAA,MAAC,QAAD,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAA,UAAO,GAAG,EAAE,iBAAiB,EAAE,IAAU,CAAA,GACxC,QACG,EAAA,CAAA;CACF,CAAA;CAIV,MAAM,EAAE,WAAW,SAAS;CAE5B,IAAI,UAAU,WAAW,iBAAiB,UACxC,OACE,iBAAA,GAAA,kBAAA,KAAC,KAAD;EAAG,MAAM,KAAK;EAAM,mBAAgB;EAAe,QAAO;EAAS,KAAI;EACpE;CACA,CAAA;CAIP,OAAO,iBAAA,GAAA,kBAAA,KAAC,KAAD;EAAG,MAAM,KAAK;EAAO;CAAY,CAAA;AAC1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"CopyrightEmbed.js","names":["EmbedByline"],"sources":["../../src/Embed/CopyrightEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CopyrightMetaData } from \"@ndla/types-embed\";\nimport type { ReactNode } from \"react\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\n\ninterface Props {\n embed: CopyrightMetaData;\n children?: ReactNode;\n}\n\nconst StyledCopyrightContent = styled(\"div\", {\n base: {\n marginBlockEnd: \"xsmall\",\n },\n});\n\nexport const CopyrightEmbed = ({ embed, children }: Props) => {\n return (\n <figure data-embed-type=\"copyright\">\n <StyledCopyrightContent data-copyright-content=\"\">{children}</StyledCopyrightContent>\n <EmbedByline type=\"copyright\" copyright={embed.embedData.copyright} />\n </figure>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAM,0BAAA,GAAA,wBAAA,QAAgC,OAAO,EAC3C,MAAM,EACJ,gBAAgB,UACjB,EACF,CAAC;AAEF,MAAa,kBAAkB,EAAE,OAAO,eAAsB;AAC5D,QACE,iBAAA,GAAA,kBAAA,MAAC,UAAD;EAAQ,mBAAgB;YAAxB,CACE,iBAAA,GAAA,kBAAA,KAAC,wBAAD;GAAwB,0BAAuB;GAAI;GAAkC,CAAA,EACrF,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,aAAD;GAAa,MAAK;GAAY,WAAW,MAAM,UAAU;GAAa,CAAA,CAC/D"}
1
+ {"version":3,"file":"CopyrightEmbed.js","names":["EmbedByline"],"sources":["../../src/Embed/CopyrightEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CopyrightMetaData } from \"@ndla/types-embed\";\nimport type { ReactNode } from \"react\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\n\ninterface Props {\n embed: CopyrightMetaData;\n children?: ReactNode;\n}\n\nconst StyledCopyrightContent = styled(\"div\", {\n base: {\n marginBlockEnd: \"xsmall\",\n },\n});\n\nexport const CopyrightEmbed = ({ embed, children }: Props) => {\n return (\n <figure data-embed-type=\"copyright\">\n <StyledCopyrightContent data-copyright-content=\"\">{children}</StyledCopyrightContent>\n <EmbedByline type=\"copyright\" copyright={embed.embedData.copyright} />\n </figure>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAM,0BAAA,GAAA,wBAAA,QAAgC,OAAO,EAC3C,MAAM,EACJ,gBAAgB,SAClB,EACF,CAAC;AAED,MAAa,kBAAkB,EAAE,OAAO,eAAsB;CAC5D,OACE,iBAAA,GAAA,kBAAA,MAAC,UAAD;EAAQ,mBAAgB;YAAxB,CACE,iBAAA,GAAA,kBAAA,KAAC,wBAAD;GAAwB,0BAAuB;GAAI;EAAiC,CAAA,GACpF,iBAAA,GAAA,kBAAA,KAACA,oBAAAA,aAAD;GAAa,MAAK;GAAY,WAAW,MAAM,UAAU;EAAY,CAAA,CAC/D;;AAEZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"EmbedErrorPlaceholder.js","names":["Figure","ErrorWarningLine","EmbedByline"],"sources":["../../src/Embed/EmbedErrorPlaceholder.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { ErrorWarningLine } from \"@ndla/icons\";\nimport { Figure, type FigureFloat, type FigureSize } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { type ReactNode } from \"react\";\nimport { EmbedByline, type EmbedBylineErrorProps } from \"../LicenseByline/EmbedByline\";\n\ninterface Props {\n type: EmbedBylineErrorProps[\"type\"];\n figureType?: FigureSize;\n float?: FigureFloat;\n children?: ReactNode;\n}\n\nconst ErrorPlaceholder = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"background.subtle\",\n height: \"surface.xsmall\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n \"& svg\": {\n height: \"5xlarge\",\n width: \"5xlarge\",\n fill: \"stroke.default\",\n },\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& > *:not(:first-child)\": {\n marginBlockStart: \"3xsmall\",\n },\n },\n});\n\nexport const EmbedErrorPlaceholder = ({ type, children, figureType, float }: Props) => {\n return (\n <StyledFigure size={figureType} float={float} data-embed-type={type}>\n {children ?? (\n <ErrorPlaceholder data-embed-type={type}>\n <ErrorWarningLine />\n </ErrorPlaceholder>\n )}\n <EmbedByline error type={type} />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAM,oBAAA,GAAA,wBAAA,QAA0B,OAAO,EACrC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,QAAQ;CACR,aAAa;CACb,cAAc;CACd,SAAS;EACP,QAAQ;EACR,OAAO;EACP,MAAM;EACP;CACF,EACF,CAAC;AAEF,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAAQ,EAClC,MAAM,EACJ,2BAA2B,EACzB,kBAAkB,WACnB,EACF,EACF,CAAC;AAEF,MAAa,yBAAyB,EAAE,MAAM,UAAU,YAAY,YAAmB;AACrF,QACE,iBAAA,GAAA,kBAAA,MAAC,cAAD;EAAc,MAAM;EAAmB;EAAO,mBAAiB;YAA/D,CACG,YACC,iBAAA,GAAA,kBAAA,KAAC,kBAAD;GAAkB,mBAAiB;aACjC,iBAAA,GAAA,kBAAA,KAACC,YAAAA,kBAAD,EAAoB,CAAA;GACH,CAAA,EAErB,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,aAAD;GAAa,OAAA;GAAY;GAAQ,CAAA,CACpB"}
1
+ {"version":3,"file":"EmbedErrorPlaceholder.js","names":["Figure","ErrorWarningLine","EmbedByline"],"sources":["../../src/Embed/EmbedErrorPlaceholder.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { ErrorWarningLine } from \"@ndla/icons\";\nimport { Figure, type FigureFloat, type FigureSize } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { type ReactNode } from \"react\";\nimport { EmbedByline, type EmbedBylineErrorProps } from \"../LicenseByline/EmbedByline\";\n\ninterface Props {\n type: EmbedBylineErrorProps[\"type\"];\n figureType?: FigureSize;\n float?: FigureFloat;\n children?: ReactNode;\n}\n\nconst ErrorPlaceholder = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"background.subtle\",\n height: \"surface.xsmall\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n \"& svg\": {\n height: \"5xlarge\",\n width: \"5xlarge\",\n fill: \"stroke.default\",\n },\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& > *:not(:first-child)\": {\n marginBlockStart: \"3xsmall\",\n },\n },\n});\n\nexport const EmbedErrorPlaceholder = ({ type, children, figureType, float }: Props) => {\n return (\n <StyledFigure size={figureType} float={float} data-embed-type={type}>\n {children ?? (\n <ErrorPlaceholder data-embed-type={type}>\n <ErrorWarningLine />\n </ErrorPlaceholder>\n )}\n <EmbedByline error type={type} />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAM,oBAAA,GAAA,wBAAA,QAA0B,OAAO,EACrC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,QAAQ;CACR,aAAa;CACb,cAAc;CACd,SAAS;EACP,QAAQ;EACR,OAAO;EACP,MAAM;CACR;AACF,EACF,CAAC;AAED,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAAQ,EAClC,MAAM,EACJ,2BAA2B,EACzB,kBAAkB,UACpB,EACF,EACF,CAAC;AAED,MAAa,yBAAyB,EAAE,MAAM,UAAU,YAAY,YAAmB;CACrF,OACE,iBAAA,GAAA,kBAAA,MAAC,cAAD;EAAc,MAAM;EAAmB;EAAO,mBAAiB;YAA/D,CACG,YACC,iBAAA,GAAA,kBAAA,KAAC,kBAAD;GAAkB,mBAAiB;aACjC,iBAAA,GAAA,kBAAA,KAACC,YAAAA,kBAAD,CAAmB,CAAA;EACH,CAAA,GAEpB,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,aAAD;GAAa,OAAA;GAAY;EAAO,CAAA,CACpB;;AAElB"}
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { type HTMLArkProps } from "@ark-ui/react";
8
+ import { type HTMLArkProps } from "@ark-ui/react/factory";
9
9
  import type { StyledProps, RecipeVariantProps } from "@ndla/styled-system/types";
10
10
  declare const embedWrapperRecipe: import("@ndla/styled-system/types").RecipeRuntimeFn<{
11
11
  noClear: {
@@ -2,8 +2,8 @@ require("../_virtual/_rolldown/runtime.js");
2
2
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
3
3
  let react = require("react");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
- let _ark_ui_react = require("@ark-ui/react");
6
5
  let _ndla_styled_system_css = require("@ndla/styled-system/css");
6
+ let _ark_ui_react_factory = require("@ark-ui/react/factory");
7
7
  //#region src/Embed/EmbedWrapper.tsx
8
8
  /**
9
9
  * Copyright (c) 2024-present, NDLA.
@@ -20,7 +20,7 @@ const embedWrapperRecipe = (0, _ndla_styled_system_css.cva)({
20
20
  false: { clear: "both" }
21
21
  } }
22
22
  });
23
- const StyledEmbedWrapper = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.div, {}, { baseComponent: true });
23
+ const StyledEmbedWrapper = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.div, {}, { baseComponent: true });
24
24
  const EmbedWrapper = (0, react.forwardRef)(({ noClear, css: cssProp, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledEmbedWrapper, {
25
25
  css: _ndla_styled_system_css.css.raw(embedWrapperRecipe.raw({ noClear }), cssProp),
26
26
  "data-embed-wrapper": "",
@@ -1 +1 @@
1
- {"version":3,"file":"EmbedWrapper.js","names":["ark","css"],"sources":["../../src/Embed/EmbedWrapper.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst embedWrapperRecipe = cva({\n base: {\n position: \"relative\",\n },\n defaultVariants: {\n noClear: false,\n },\n variants: {\n noClear: {\n true: {\n \"& + [data-embed-wrapper]\": {\n clear: \"both\",\n },\n },\n false: {\n clear: \"both\",\n },\n },\n },\n});\n\nexport type EmbedWrapperVariantProps = NonNullable<RecipeVariantProps<typeof embedWrapperRecipe>>;\n\nexport interface EmbedWrapperProps extends HTMLArkProps<\"div\">, StyledProps, EmbedWrapperVariantProps {}\n\nconst StyledEmbedWrapper = styled(ark.div, {}, { baseComponent: true });\n\nexport const EmbedWrapper = forwardRef<HTMLDivElement, EmbedWrapperProps>(\n ({ noClear, css: cssProp, ...props }, ref) => (\n <StyledEmbedWrapper\n css={css.raw(embedWrapperRecipe.raw({ noClear }), cssProp)}\n data-embed-wrapper=\"\"\n {...props}\n ref={ref}\n />\n ),\n);\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,sBAAA,GAAA,wBAAA,KAAyB;CAC7B,MAAM,EACJ,UAAU,YACX;CACD,iBAAiB,EACf,SAAS,OACV;CACD,UAAU,EACR,SAAS;EACP,MAAM,EACJ,4BAA4B,EAC1B,OAAO,QACR,EACF;EACD,OAAO,EACL,OAAO,QACR;EACF,EACF;CACF,CAAC;AAMF,MAAM,sBAAA,GAAA,wBAAA,QAA4BA,cAAAA,IAAI,KAAK,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAEvE,MAAa,gBAAA,GAAA,MAAA,aACV,EAAE,SAAS,KAAK,SAAS,GAAG,SAAS,QACpC,iBAAA,GAAA,kBAAA,KAAC,oBAAD;CACE,KAAKC,wBAAAA,IAAI,IAAI,mBAAmB,IAAI,EAAE,SAAS,CAAC,EAAE,QAAQ;CAC1D,sBAAmB;CACnB,GAAI;CACC;CACL,CAAA,CAEL"}
1
+ {"version":3,"file":"EmbedWrapper.js","names":["ark","css"],"sources":["../../src/Embed/EmbedWrapper.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react/factory\";\nimport { css, cva } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps, RecipeVariantProps } from \"@ndla/styled-system/types\";\nimport { forwardRef } from \"react\";\n\nconst embedWrapperRecipe = cva({\n base: {\n position: \"relative\",\n },\n defaultVariants: {\n noClear: false,\n },\n variants: {\n noClear: {\n true: {\n \"& + [data-embed-wrapper]\": {\n clear: \"both\",\n },\n },\n false: {\n clear: \"both\",\n },\n },\n },\n});\n\nexport type EmbedWrapperVariantProps = NonNullable<RecipeVariantProps<typeof embedWrapperRecipe>>;\n\nexport interface EmbedWrapperProps extends HTMLArkProps<\"div\">, StyledProps, EmbedWrapperVariantProps {}\n\nconst StyledEmbedWrapper = styled(ark.div, {}, { baseComponent: true });\n\nexport const EmbedWrapper = forwardRef<HTMLDivElement, EmbedWrapperProps>(\n ({ noClear, css: cssProp, ...props }, ref) => (\n <StyledEmbedWrapper\n css={css.raw(embedWrapperRecipe.raw({ noClear }), cssProp)}\n data-embed-wrapper=\"\"\n {...props}\n ref={ref}\n />\n ),\n);\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,sBAAA,GAAA,wBAAA,KAAyB;CAC7B,MAAM,EACJ,UAAU,WACZ;CACA,iBAAiB,EACf,SAAS,MACX;CACA,UAAU,EACR,SAAS;EACP,MAAM,EACJ,4BAA4B,EAC1B,OAAO,OACT,EACF;EACA,OAAO,EACL,OAAO,OACT;CACF,EACF;AACF,CAAC;AAMD,MAAM,sBAAA,GAAA,wBAAA,QAA4BA,sBAAAA,IAAI,KAAK,CAAC,GAAG,EAAE,eAAe,KAAK,CAAC;AAEtE,MAAa,gBAAA,GAAA,MAAA,aACV,EAAE,SAAS,KAAK,SAAS,GAAG,SAAS,QACpC,iBAAA,GAAA,kBAAA,KAAC,oBAAD;CACE,KAAKC,wBAAAA,IAAI,IAAI,mBAAmB,IAAI,EAAE,QAAQ,CAAC,GAAG,OAAO;CACzD,sBAAmB;CACnB,GAAI;CACC;AACN,CAAA,CAEL"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalEmbed.js","names":["Figure","EmbedErrorPlaceholder","ResourceBox"],"sources":["../../src/Embed/ExternalEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { OembedMetaData } from \"@ndla/types-embed\";\nimport { useEffect, useRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { ResourceBox } from \"../ResourceBox/ResourceBox\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\n\ninterface Props {\n embed: OembedMetaData;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& iframe\": {\n height: \"auto\",\n width: \"100%\",\n },\n },\n});\n\nexport const ExternalEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n const figRef = useRef<HTMLElement>(null);\n\n useEffect(() => {\n const iframe = figRef.current?.querySelector(\"iframe\");\n if (iframe) {\n const [width, height] = [Number.parseInt(iframe.width), Number.parseInt(iframe.height)];\n iframe.style.aspectRatio = `${width ? width : 16}/${height ? height : 9}`;\n iframe.width = \"\";\n iframe.height = \"\";\n }\n }, []);\n\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type=\"external\" />;\n }\n\n const { embedData, data } = embed;\n\n if (embedData.type === \"fullscreen\") {\n const image = {\n src: data.iframeImage?.image.imageUrl,\n alt: embedData.alt !== undefined ? embedData.alt : (data.iframeImage?.alttext?.alttext ?? \"\"),\n };\n return (\n <Figure data-embed-type=\"external\">\n <ResourceBox\n image={image}\n title={embedData.title ?? \"\"}\n url={embedData.url}\n caption={embedData.caption ?? \"\"}\n buttonText={t(\"license.other.itemImage.ariaLabel\")}\n />\n </Figure>\n );\n }\n\n return (\n <StyledFigure\n data-embed-type=\"external\"\n ref={figRef}\n dangerouslySetInnerHTML={{ __html: data?.oembed?.html ?? \"\" }}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAoBA,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAAQ,EAClC,MAAM,EACJ,YAAY;CACV,QAAQ;CACR,OAAO;CACR,EACF,EACF,CAAC;AAEF,MAAa,iBAAiB,EAAE,YAAmB;CACjD,MAAM,EAAE,OAAA,GAAA,cAAA,iBAAsB;CAC9B,MAAM,UAAA,GAAA,MAAA,QAA6B,KAAK;AAExC,EAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,SAAS,OAAO,SAAS,cAAc,SAAS;AACtD,MAAI,QAAQ;GACV,MAAM,CAAC,OAAO,UAAU,CAAC,OAAO,SAAS,OAAO,MAAM,EAAE,OAAO,SAAS,OAAO,OAAO,CAAC;AACvF,UAAO,MAAM,cAAc,GAAG,QAAQ,QAAQ,GAAG,GAAG,SAAS,SAAS;AACtE,UAAO,QAAQ;AACf,UAAO,SAAS;;IAEjB,EAAE,CAAC;AAEN,KAAI,MAAM,WAAW,QACnB,QAAO,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD,EAAuB,MAAK,YAAa,CAAA;CAGlD,MAAM,EAAE,WAAW,SAAS;AAE5B,KAAI,UAAU,SAAS,aAKrB,QACE,iBAAA,GAAA,kBAAA,KAACD,iBAAAA,QAAD;EAAQ,mBAAgB;YACtB,iBAAA,GAAA,kBAAA,KAACE,oBAAAA,aAAD;GACE,OAAO;IANX,KAAK,KAAK,aAAa,MAAM;IAC7B,KAAK,UAAU,QAAQ,KAAA,IAAY,UAAU,MAAO,KAAK,aAAa,SAAS,WAAW;IAK1E;GACZ,OAAO,UAAU,SAAS;GAC1B,KAAK,UAAU;GACf,SAAS,UAAU,WAAW;GAC9B,YAAY,EAAE,oCAAoC;GAClD,CAAA;EACK,CAAA;AAIb,QACE,iBAAA,GAAA,kBAAA,KAAC,cAAD;EACE,mBAAgB;EAChB,KAAK;EACL,yBAAyB,EAAE,QAAQ,MAAM,QAAQ,QAAQ,IAAI;EAC7D,CAAA"}
1
+ {"version":3,"file":"ExternalEmbed.js","names":["Figure","EmbedErrorPlaceholder","ResourceBox"],"sources":["../../src/Embed/ExternalEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { OembedMetaData } from \"@ndla/types-embed\";\nimport { useEffect, useRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { ResourceBox } from \"../ResourceBox/ResourceBox\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\n\ninterface Props {\n embed: OembedMetaData;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& iframe\": {\n height: \"auto\",\n width: \"100%\",\n },\n },\n});\n\nexport const ExternalEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n const figRef = useRef<HTMLElement>(null);\n\n useEffect(() => {\n const iframe = figRef.current?.querySelector(\"iframe\");\n if (iframe) {\n const [width, height] = [Number.parseInt(iframe.width), Number.parseInt(iframe.height)];\n iframe.style.aspectRatio = `${width ? width : 16}/${height ? height : 9}`;\n iframe.width = \"\";\n iframe.height = \"\";\n }\n }, []);\n\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type=\"external\" />;\n }\n\n const { embedData, data } = embed;\n\n if (embedData.type === \"fullscreen\") {\n const image = {\n src: data.iframeImage?.image.imageUrl,\n alt: embedData.alt !== undefined ? embedData.alt : (data.iframeImage?.alttext?.alttext ?? \"\"),\n };\n return (\n <Figure data-embed-type=\"external\">\n <ResourceBox\n image={image}\n title={embedData.title ?? \"\"}\n url={embedData.url}\n caption={embedData.caption ?? \"\"}\n buttonText={t(\"license.other.itemImage.ariaLabel\")}\n />\n </Figure>\n );\n }\n\n return (\n <StyledFigure\n data-embed-type=\"external\"\n ref={figRef}\n dangerouslySetInnerHTML={{ __html: data?.oembed?.html ?? \"\" }}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAoBA,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAAQ,EAClC,MAAM,EACJ,YAAY;CACV,QAAQ;CACR,OAAO;AACT,EACF,EACF,CAAC;AAED,MAAa,iBAAiB,EAAE,YAAmB;CACjD,MAAM,EAAE,OAAA,GAAA,cAAA,gBAAqB;CAC7B,MAAM,UAAA,GAAA,MAAA,QAA6B,IAAI;CAEvC,CAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,SAAS,OAAO,SAAS,cAAc,QAAQ;EACrD,IAAI,QAAQ;GACV,MAAM,CAAC,OAAO,UAAU,CAAC,OAAO,SAAS,OAAO,KAAK,GAAG,OAAO,SAAS,OAAO,MAAM,CAAC;GACtF,OAAO,MAAM,cAAc,GAAG,QAAQ,QAAQ,GAAG,GAAG,SAAS,SAAS;GACtE,OAAO,QAAQ;GACf,OAAO,SAAS;EAClB;CACF,GAAG,CAAC,CAAC;CAEL,IAAI,MAAM,WAAW,SACnB,OAAO,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD,EAAuB,MAAK,WAAY,CAAA;CAGjD,MAAM,EAAE,WAAW,SAAS;CAE5B,IAAI,UAAU,SAAS,cAKrB,OACE,iBAAA,GAAA,kBAAA,KAACD,iBAAAA,QAAD;EAAQ,mBAAgB;YACtB,iBAAA,GAAA,kBAAA,KAACE,oBAAAA,aAAD;GACE,OAAO;IANX,KAAK,KAAK,aAAa,MAAM;IAC7B,KAAK,UAAU,QAAQ,KAAA,IAAY,UAAU,MAAO,KAAK,aAAa,SAAS,WAAW;GAK3E;GACX,OAAO,UAAU,SAAS;GAC1B,KAAK,UAAU;GACf,SAAS,UAAU,WAAW;GAC9B,YAAY,EAAE,mCAAmC;EAClD,CAAA;CACK,CAAA;CAIZ,OACE,iBAAA,GAAA,kBAAA,KAAC,cAAD;EACE,mBAAgB;EAChB,KAAK;EACL,yBAAyB,EAAE,QAAQ,MAAM,QAAQ,QAAQ,GAAG;CAC7D,CAAA;AAEL"}
@@ -1 +1 @@
1
- {"version":3,"file":"FootnoteEmbed.js","names":[],"sources":["../../src/Embed/FootnoteEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { FootnoteMetaData } from \"@ndla/types-embed\";\nimport { useTranslation } from \"react-i18next\";\n\ninterface Props {\n embed: FootnoteMetaData;\n}\n\nconst StyledSup = styled(\"sup\", {\n base: {\n \"& a\": {\n textStyle: \"label.xsmall\",\n marginInlineStart: \"1\",\n },\n },\n});\n\nexport const FootnoteEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return <div>{t(\"error\")}</div>;\n }\n\n return (\n <span id={`ref${embed.data.entryNum}`} data-embed-type=\"footnote\">\n <StyledSup>\n <a href={`#note${embed.data.entryNum}`} target=\"_self\">{`[${embed.data.entryNum}]`}</a>\n </StyledSup>\n </span>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAM,aAAA,GAAA,wBAAA,QAAmB,OAAO,EAC9B,MAAM,EACJ,OAAO;CACL,WAAW;CACX,mBAAmB;CACpB,EACF,EACF,CAAC;AAEF,MAAa,iBAAiB,EAAE,YAAmB;CACjD,MAAM,EAAE,OAAA,GAAA,cAAA,iBAAsB;AAC9B,KAAI,MAAM,WAAW,QACnB,QAAO,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAA,UAAM,EAAE,QAAQ,EAAO,CAAA;AAGhC,QACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EAAM,IAAI,MAAM,MAAM,KAAK;EAAY,mBAAgB;YACrD,iBAAA,GAAA,kBAAA,KAAC,WAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,KAAD;GAAG,MAAM,QAAQ,MAAM,KAAK;GAAY,QAAO;aAAS,IAAI,MAAM,KAAK,SAAS;GAAO,CAAA,EAC7E,CAAA;EACP,CAAA"}
1
+ {"version":3,"file":"FootnoteEmbed.js","names":[],"sources":["../../src/Embed/FootnoteEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { FootnoteMetaData } from \"@ndla/types-embed\";\nimport { useTranslation } from \"react-i18next\";\n\ninterface Props {\n embed: FootnoteMetaData;\n}\n\nconst StyledSup = styled(\"sup\", {\n base: {\n \"& a\": {\n textStyle: \"label.xsmall\",\n marginInlineStart: \"1\",\n },\n },\n});\n\nexport const FootnoteEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return <div>{t(\"error\")}</div>;\n }\n\n return (\n <span id={`ref${embed.data.entryNum}`} data-embed-type=\"footnote\">\n <StyledSup>\n <a href={`#note${embed.data.entryNum}`} target=\"_self\">{`[${embed.data.entryNum}]`}</a>\n </StyledSup>\n </span>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAM,aAAA,GAAA,wBAAA,QAAmB,OAAO,EAC9B,MAAM,EACJ,OAAO;CACL,WAAW;CACX,mBAAmB;AACrB,EACF,EACF,CAAC;AAED,MAAa,iBAAiB,EAAE,YAAmB;CACjD,MAAM,EAAE,OAAA,GAAA,cAAA,gBAAqB;CAC7B,IAAI,MAAM,WAAW,SACnB,OAAO,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAA,UAAM,EAAE,OAAO,EAAO,CAAA;CAG/B,OACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EAAM,IAAI,MAAM,MAAM,KAAK;EAAY,mBAAgB;YACrD,iBAAA,GAAA,kBAAA,KAAC,WAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,KAAD;GAAG,MAAM,QAAQ,MAAM,KAAK;GAAY,QAAO;aAAS,IAAI,MAAM,KAAK,SAAS;EAAM,CAAA,EAC7E,CAAA;CACP,CAAA;AAEV"}
@@ -6,7 +6,7 @@ let _ndla_primitives = require("@ndla/primitives");
6
6
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
7
7
  let react = require("react");
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
- let _ark_ui_react = require("@ark-ui/react");
9
+ let _ark_ui_react_portal = require("@ark-ui/react/portal");
10
10
  //#region src/Embed/GlossEmbed.tsx
11
11
  /**
12
12
  * Copyright (c) 2024-present, NDLA.
@@ -30,7 +30,7 @@ const GlossEmbed = ({ embed, children }) => {
30
30
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.PopoverTrigger, {
31
31
  asChild: true,
32
32
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ConceptInlineTriggerButton.ConceptInlineTriggerButton, { children })
33
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledPopoverContent, {
33
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react_portal.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledPopoverContent, {
34
34
  ref: contentRef,
35
35
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Figure, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Gloss.Gloss, {
36
36
  glossData: concept.glossData,
@@ -1 +1 @@
1
- {"version":3,"file":"GlossEmbed.js","names":["PopoverContent","EmbedErrorPlaceholder","PopoverRoot","PopoverTrigger","ConceptInlineTriggerButton","Portal","Figure","Gloss"],"sources":["../../src/Embed/GlossEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Portal } from \"@ark-ui/react\";\nimport { Figure, PopoverContent, PopoverRoot, PopoverTrigger } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { ConceptMetaData } from \"@ndla/types-embed\";\nimport { useRef, type ReactNode } from \"react\";\nimport { Gloss } from \"../Gloss/Gloss\";\nimport { ConceptInlineTriggerButton } from \"./ConceptInlineTriggerButton\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\n\ninterface Props {\n embed: ConceptMetaData;\n children?: ReactNode;\n}\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n width: \"surface.xlarge\",\n },\n});\n\nexport const GlossEmbed = ({ embed, children }: Props) => {\n const contentRef = useRef<HTMLDivElement>(null);\n if (embed.status === \"error\" && embed.embedData.type === \"inline\") {\n return <span>{children}</span>;\n }\n if (embed.status === \"error\" || !embed.data.concept.glossData) {\n return <EmbedErrorPlaceholder type=\"gloss\" />;\n }\n\n const { concept, visualElement } = embed.data;\n\n const audio =\n visualElement?.status === \"success\" && visualElement.resource === \"audio\"\n ? {\n src: visualElement.data.audioFile.url,\n title: visualElement.data.title.title,\n }\n : undefined;\n\n if (embed.embedData.type === \"inline\") {\n return (\n <PopoverRoot initialFocusEl={() => contentRef.current}>\n <PopoverTrigger asChild>\n <ConceptInlineTriggerButton>{children}</ConceptInlineTriggerButton>\n </PopoverTrigger>\n <Portal>\n <StyledPopoverContent ref={contentRef}>\n <Figure>\n <Gloss\n glossData={concept.glossData}\n title={concept.title}\n audio={audio}\n exampleIds={embed.embedData.exampleIds}\n exampleLangs={embed.embedData.exampleLangs}\n />\n </Figure>\n </StyledPopoverContent>\n </Portal>\n </PopoverRoot>\n );\n }\n\n return (\n <Figure data-embed-type=\"gloss\">\n <Gloss\n glossData={concept.glossData}\n title={concept.title}\n audio={audio}\n exampleIds={embed.embedData.exampleIds}\n exampleLangs={embed.embedData.exampleLangs}\n variant=\"bordered\"\n />\n </Figure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,MAAM,wBAAA,GAAA,wBAAA,QAA8BA,iBAAAA,gBAAgB,EAClD,MAAM,EACJ,OAAO,kBACR,EACF,CAAC;AAEF,MAAa,cAAc,EAAE,OAAO,eAAsB;CACxD,MAAM,cAAA,GAAA,MAAA,QAAoC,KAAK;AAC/C,KAAI,MAAM,WAAW,WAAW,MAAM,UAAU,SAAS,SACvD,QAAO,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAO,UAAgB,CAAA;AAEhC,KAAI,MAAM,WAAW,WAAW,CAAC,MAAM,KAAK,QAAQ,UAClD,QAAO,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD,EAAuB,MAAK,SAAU,CAAA;CAG/C,MAAM,EAAE,SAAS,kBAAkB,MAAM;CAEzC,MAAM,QACJ,eAAe,WAAW,aAAa,cAAc,aAAa,UAC9D;EACE,KAAK,cAAc,KAAK,UAAU;EAClC,OAAO,cAAc,KAAK,MAAM;EACjC,GACD,KAAA;AAEN,KAAI,MAAM,UAAU,SAAS,SAC3B,QACE,iBAAA,GAAA,kBAAA,MAACC,iBAAAA,aAAD;EAAa,sBAAsB,WAAW;YAA9C,CACE,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,gBAAD;GAAgB,SAAA;aACd,iBAAA,GAAA,kBAAA,KAACC,mCAAAA,4BAAD,EAA6B,UAAsC,CAAA;GACpD,CAAA,EACjB,iBAAA,GAAA,kBAAA,KAACC,cAAAA,QAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,sBAAD;GAAsB,KAAK;aACzB,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,QAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAACC,cAAAA,OAAD;IACE,WAAW,QAAQ;IACnB,OAAO,QAAQ;IACR;IACP,YAAY,MAAM,UAAU;IAC5B,cAAc,MAAM,UAAU;IAC9B,CAAA,EACK,CAAA;GACY,CAAA,EAChB,CAAA,CACG;;AAIlB,QACE,iBAAA,GAAA,kBAAA,KAACD,iBAAAA,QAAD;EAAQ,mBAAgB;YACtB,iBAAA,GAAA,kBAAA,KAACC,cAAAA,OAAD;GACE,WAAW,QAAQ;GACnB,OAAO,QAAQ;GACR;GACP,YAAY,MAAM,UAAU;GAC5B,cAAc,MAAM,UAAU;GAC9B,SAAQ;GACR,CAAA;EACK,CAAA"}
1
+ {"version":3,"file":"GlossEmbed.js","names":["PopoverContent","EmbedErrorPlaceholder","PopoverRoot","PopoverTrigger","ConceptInlineTriggerButton","Portal","Figure","Gloss"],"sources":["../../src/Embed/GlossEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Portal } from \"@ark-ui/react/portal\";\nimport { Figure, PopoverContent, PopoverRoot, PopoverTrigger } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { ConceptMetaData } from \"@ndla/types-embed\";\nimport { useRef, type ReactNode } from \"react\";\nimport { Gloss } from \"../Gloss/Gloss\";\nimport { ConceptInlineTriggerButton } from \"./ConceptInlineTriggerButton\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\n\ninterface Props {\n embed: ConceptMetaData;\n children?: ReactNode;\n}\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n width: \"surface.xlarge\",\n },\n});\n\nexport const GlossEmbed = ({ embed, children }: Props) => {\n const contentRef = useRef<HTMLDivElement>(null);\n if (embed.status === \"error\" && embed.embedData.type === \"inline\") {\n return <span>{children}</span>;\n }\n if (embed.status === \"error\" || !embed.data.concept.glossData) {\n return <EmbedErrorPlaceholder type=\"gloss\" />;\n }\n\n const { concept, visualElement } = embed.data;\n\n const audio =\n visualElement?.status === \"success\" && visualElement.resource === \"audio\"\n ? {\n src: visualElement.data.audioFile.url,\n title: visualElement.data.title.title,\n }\n : undefined;\n\n if (embed.embedData.type === \"inline\") {\n return (\n <PopoverRoot initialFocusEl={() => contentRef.current}>\n <PopoverTrigger asChild>\n <ConceptInlineTriggerButton>{children}</ConceptInlineTriggerButton>\n </PopoverTrigger>\n <Portal>\n <StyledPopoverContent ref={contentRef}>\n <Figure>\n <Gloss\n glossData={concept.glossData}\n title={concept.title}\n audio={audio}\n exampleIds={embed.embedData.exampleIds}\n exampleLangs={embed.embedData.exampleLangs}\n />\n </Figure>\n </StyledPopoverContent>\n </Portal>\n </PopoverRoot>\n );\n }\n\n return (\n <Figure data-embed-type=\"gloss\">\n <Gloss\n glossData={concept.glossData}\n title={concept.title}\n audio={audio}\n exampleIds={embed.embedData.exampleIds}\n exampleLangs={embed.embedData.exampleLangs}\n variant=\"bordered\"\n />\n </Figure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,MAAM,wBAAA,GAAA,wBAAA,QAA8BA,iBAAAA,gBAAgB,EAClD,MAAM,EACJ,OAAO,iBACT,EACF,CAAC;AAED,MAAa,cAAc,EAAE,OAAO,eAAsB;CACxD,MAAM,cAAA,GAAA,MAAA,QAAoC,IAAI;CAC9C,IAAI,MAAM,WAAW,WAAW,MAAM,UAAU,SAAS,UACvD,OAAO,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAO,SAAe,CAAA;CAE/B,IAAI,MAAM,WAAW,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cesContent":["/**\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 { H5pMetaData } from \"@ndla/types-embed\";\nimport { useTranslation } from \"react-i18next\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\n\ninterface Props {\n embed: H5pMetaData;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& iframe\": {\n height: \"auto\",\n width: \"100%\",\n },\n },\n});\n\nconst FigureOembed = styled(Figure, {\n base: {\n width: \"100%\",\n \"& iframe\": {\n width: \"100%\",\n },\n },\n});\n\nexport const H5pEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type=\"h5p\" />;\n }\n\n if (embed.data.oembed) {\n return <FigureOembed data-embed-type=\"h5p\" dangerouslySetInnerHTML={{ __html: embed.data.oembed.html ?? \"\" }} />;\n }\n\n const title = embed.embedData.title?.trim()\n ? embed.embedData.title\n : embed.data.h5pLicenseInformation?.h5p.title?.trim()\n ? embed.data.h5pLicenseInformation.h5p.title\n : embed.embedData.url;\n\n const titleWithPrefix = `${t(\"embed.type.h5p\")}: ${title}`;\n\n return (\n <StyledFigure data-embed-type=\"h5p\">\n <iframe title={titleWithPrefix} aria-label={titleWithPrefix} src={embed.embedData.url} />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAAQ,EAClC,MAAM,EACJ,YAAY;CACV,QAAQ;CACR,OAAO;CACR,EACF,EACF,CAAC;AAEF,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAAQ,EAClC,MAAM;CACJ,OAAO;CACP,YAAY,EACV,OAAO,QACR;CACF,EACF,CAAC;AAEF,MAAa,YAAY,EAAE,YAAmB;CAC5C,MAAM,EAAE,OAAA,GAAA,cAAA,iBAAsB;AAC9B,KAAI,MAAM,WAAW,QACnB,QAAO,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD,EAAuB,MAAK,OAAQ,CAAA;AAG7C,KAAI,MAAM,KAAK,OACb,QAAO,iBAAA,GAAA,kBAAA,KAAC,cAAD;EAAc,mBAAgB;EAAM,yBAAyB,EAAE,QAAQ,MAAM,KAAK,OAAO,QAAQ,IAAI;EAAI,CAAA;CAGlH,MAAM,QAAQ,MAAM,UAAU,OAAO,MAAM,GACvC,MAAM,UAAU,QAChB,MAAM,KAAK,uBAAuB,IAAI,OAAO,MAAM,GACjD,MAAM,KAAK,sBAAsB,IAAI,QACrC,MAAM,UAAU;CAEtB,MAAM,kBAAkB,GAAG,EAAE,iBAAiB,CAAC,IAAI;AAEnD,QACE,iBAAA,GAAA,kBAAA,KAAC,cAAD;EAAc,mBAAgB;YAC5B,iBAAA,GAAA,kBAAA,KAAC,UAAD;GAAQ,OAAO;GAAiB,cAAY;GAAiB,KAAK,MAAM,UAAU;GAAO,CAAA;EAC5E,CAAA"}
1
+ {"version":3,"file":"H5pEmbed.js","names":["Figure","EmbedErrorPlaceholder"],"sources":["../../src/Embed/H5pEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { H5pMetaData } from \"@ndla/types-embed\";\nimport { useTranslation } from \"react-i18next\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\n\ninterface Props {\n embed: H5pMetaData;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& iframe\": {\n height: \"auto\",\n width: \"100%\",\n },\n },\n});\n\nconst FigureOembed = styled(Figure, {\n base: {\n width: \"100%\",\n \"& iframe\": {\n width: \"100%\",\n },\n },\n});\n\nexport const H5pEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type=\"h5p\" />;\n }\n\n if (embed.data.oembed) {\n return <FigureOembed data-embed-type=\"h5p\" dangerouslySetInnerHTML={{ __html: embed.data.oembed.html ?? \"\" }} />;\n }\n\n const title = embed.embedData.title?.trim()\n ? embed.embedData.title\n : embed.data.h5pLicenseInformation?.h5p.title?.trim()\n ? embed.data.h5pLicenseInformation.h5p.title\n : embed.embedData.url;\n\n const titleWithPrefix = `${t(\"embed.type.h5p\")}: ${title}`;\n\n return (\n <StyledFigure data-embed-type=\"h5p\">\n <iframe title={titleWithPrefix} aria-label={titleWithPrefix} src={embed.embedData.url} />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAAQ,EAClC,MAAM,EACJ,YAAY;CACV,QAAQ;CACR,OAAO;AACT,EACF,EACF,CAAC;AAED,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAAQ,EAClC,MAAM;CACJ,OAAO;CACP,YAAY,EACV,OAAO,OACT;AACF,EACF,CAAC;AAED,MAAa,YAAY,EAAE,YAAmB;CAC5C,MAAM,EAAE,OAAA,GAAA,cAAA,gBAAqB;CAC7B,IAAI,MAAM,WAAW,SACnB,OAAO,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD,EAAuB,MAAK,MAAO,CAAA;CAG5C,IAAI,MAAM,KAAK,QACb,OAAO,iBAAA,GAAA,kBAAA,KAAC,cAAD;EAAc,mBAAgB;EAAM,yBAAyB,EAAE,QAAQ,MAAM,KAAK,OAAO,QAAQ,GAAG;CAAI,CAAA;CAGjH,MAAM,QAAQ,MAAM,UAAU,OAAO,KAAK,IACtC,MAAM,UAAU,QAChB,MAAM,KAAK,uBAAuB,IAAI,OAAO,KAAK,IAChD,MAAM,KAAK,sBAAsB,IAAI,QACrC,MAAM,UAAU;CAEtB,MAAM,kBAAkB,GAAG,EAAE,gBAAgB,EAAE,IAAI;CAEnD,OACE,iBAAA,GAAA,kBAAA,KAAC,cAAD;EAAc,mBAAgB;YAC5B,iBAAA,GAAA,kBAAA,KAAC,UAAD;GAAQ,OAAO;GAAiB,cAAY;GAAiB,KAAK,MAAM,UAAU;EAAM,CAAA;CAC5E,CAAA;AAElB"}
@@ -1 +1 @@
1
- {"version":3,"file":"IframeEmbed.js","names":["Figure","EmbedErrorPlaceholder","ResourceBox"],"sources":["../../src/Embed/IframeEmbed.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 { IframeMetaData } from \"@ndla/types-embed\";\nimport { useEffect, useRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { ResourceBox } from \"../ResourceBox/ResourceBox\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\n\ninterface Props {\n embed: IframeMetaData;\n}\n\nconst StyledIframe = styled(\"iframe\", {\n base: {\n width: \"100%\",\n border: 0,\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n clear: \"both\",\n },\n});\n\nexport const IframeEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n const iframeRef = useRef<HTMLIFrameElement>(null);\n\n useEffect(() => {\n const iframe = iframeRef.current;\n if (iframe) {\n const [width, height] = [Number.parseInt(iframe.width), Number.parseInt(iframe.height)];\n iframe.style.aspectRatio = `${width ? width : 16}/${height ? height : 9}`;\n iframe.width = \"\";\n iframe.height = \"\";\n }\n }, []);\n\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type=\"external\" />;\n }\n\n const { embedData, data } = embed;\n\n if (embedData.type === \"fullscreen\") {\n const iframeImage = embed.status === \"success\" ? data.iframeImage : undefined;\n const alt = embedData.alt !== undefined ? embedData.alt : iframeImage?.alttext.alttext;\n const image = { src: iframeImage?.image.imageUrl, alt: alt ?? \"\" };\n return (\n <StyledFigure data-embed-type=\"iframe\">\n <ResourceBox\n image={image}\n title={embedData.title ?? \"\"}\n url={embedData.url}\n caption={embedData.caption ?? \"\"}\n buttonText={t(\"license.other.itemImage.ariaLabel\")}\n />\n </StyledFigure>\n );\n }\n\n const { width, height, url } = embedData;\n\n const strippedWidth = typeof width === \"number\" ? width : width?.replace(/\\s*px/, \"\");\n const strippedHeight = typeof height === \"number\" ? height : height?.replace(/\\s*px/, \"\");\n const title = `${t(\"embed.type.external\")}: ${embedData.title?.trim() ? embedData.title : url}`;\n\n return (\n <StyledFigure data-embed-type=\"iframe\">\n <StyledIframe\n ref={iframeRef}\n title={title}\n aria-label={title}\n src={url}\n width={strippedWidth}\n height={strippedHeight}\n allow=\"autoplay; encrypted-media; fullscreen\"\n loading=\"lazy\"\n />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAoBA,MAAM,gBAAA,GAAA,wBAAA,QAAsB,UAAU,EACpC,MAAM;CACJ,OAAO;CACP,QAAQ;CACT,EACF,CAAC;AAEF,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAAQ,EAClC,MAAM,EACJ,OAAO,QACR,EACF,CAAC;AAEF,MAAa,eAAe,EAAE,YAAmB;CAC/C,MAAM,EAAE,OAAA,GAAA,cAAA,iBAAsB;CAC9B,MAAM,aAAA,GAAA,MAAA,QAAsC,KAAK;AAEjD,EAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,SAAS,UAAU;AACzB,MAAI,QAAQ;GACV,MAAM,CAAC,OAAO,UAAU,CAAC,OAAO,SAAS,OAAO,MAAM,EAAE,OAAO,SAAS,OAAO,OAAO,CAAC;AACvF,UAAO,MAAM,cAAc,GAAG,QAAQ,QAAQ,GAAG,GAAG,SAAS,SAAS;AACtE,UAAO,QAAQ;AACf,UAAO,SAAS;;IAEjB,EAAE,CAAC;AAEN,KAAI,MAAM,WAAW,QACnB,QAAO,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD,EAAuB,MAAK,YAAa,CAAA;CAGlD,MAAM,EAAE,WAAW,SAAS;AAE5B,KAAI,UAAU,SAAS,cAAc;EACnC,MAAM,cAAc,MAAM,WAAW,YAAY,KAAK,cAAc,KAAA;EACpE,MAAM,MAAM,UAAU,QAAQ,KAAA,IAAY,UAAU,MAAM,aAAa,QAAQ;AAE/E,SACE,iBAAA,GAAA,kBAAA,KAAC,cAAD;GAAc,mBAAgB;aAC5B,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,aAAD;IACE,OAAO;KAJG,KAAK,aAAa,MAAM;KAAU,KAAK,OAAO;KAI5C;IACZ,OAAO,UAAU,SAAS;IAC1B,KAAK,UAAU;IACf,SAAS,UAAU,WAAW;IAC9B,YAAY,EAAE,oCAAoC;IAClD,CAAA;GACW,CAAA;;CAInB,MAAM,EAAE,OAAO,QAAQ,QAAQ;CAE/B,MAAM,gBAAgB,OAAO,UAAU,WAAW,QAAQ,OAAO,QAAQ,SAAS,GAAG;CACrF,MAAM,iBAAiB,OAAO,WAAW,WAAW,SAAS,QAAQ,QAAQ,SAAS,GAAG;CACzF,MAAM,QAAQ,GAAG,EAAE,sBAAsB,CAAC,IAAI,UAAU,OAAO,MAAM,GAAG,UAAU,QAAQ;AAE1F,QACE,iBAAA,GAAA,kBAAA,KAAC,cAAD;EAAc,mBAAgB;YAC5B,iBAAA,GAAA,kBAAA,KAAC,cAAD;GACE,KAAK;GACE;GACP,cAAY;GACZ,KAAK;GACL,OAAO;GACP,QAAQ;GACR,OAAM;GACN,SAAQ;GACR,CAAA;EACW,CAAA"}
1
+ {"version":3,"file":"IframeEmbed.js","names":["Figure","EmbedErrorPlaceholder","ResourceBox"],"sources":["../../src/Embed/IframeEmbed.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 { IframeMetaData } from \"@ndla/types-embed\";\nimport { useEffect, useRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { ResourceBox } from \"../ResourceBox/ResourceBox\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\n\ninterface Props {\n embed: IframeMetaData;\n}\n\nconst StyledIframe = styled(\"iframe\", {\n base: {\n width: \"100%\",\n border: 0,\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n clear: \"both\",\n },\n});\n\nexport const IframeEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n const iframeRef = useRef<HTMLIFrameElement>(null);\n\n useEffect(() => {\n const iframe = iframeRef.current;\n if (iframe) {\n const [width, height] = [Number.parseInt(iframe.width), Number.parseInt(iframe.height)];\n iframe.style.aspectRatio = `${width ? width : 16}/${height ? height : 9}`;\n iframe.width = \"\";\n iframe.height = \"\";\n }\n }, []);\n\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type=\"external\" />;\n }\n\n const { embedData, data } = embed;\n\n if (embedData.type === \"fullscreen\") {\n const iframeImage = embed.status === \"success\" ? data.iframeImage : undefined;\n const alt = embedData.alt !== undefined ? embedData.alt : iframeImage?.alttext.alttext;\n const image = { src: iframeImage?.image.imageUrl, alt: alt ?? \"\" };\n return (\n <StyledFigure data-embed-type=\"iframe\">\n <ResourceBox\n image={image}\n title={embedData.title ?? \"\"}\n url={embedData.url}\n caption={embedData.caption ?? \"\"}\n buttonText={t(\"license.other.itemImage.ariaLabel\")}\n />\n </StyledFigure>\n );\n }\n\n const { width, height, url } = embedData;\n\n const strippedWidth = typeof width === \"number\" ? width : width?.replace(/\\s*px/, \"\");\n const strippedHeight = typeof height === \"number\" ? height : height?.replace(/\\s*px/, \"\");\n const title = `${t(\"embed.type.external\")}: ${embedData.title?.trim() ? embedData.title : url}`;\n\n return (\n <StyledFigure data-embed-type=\"iframe\">\n <StyledIframe\n ref={iframeRef}\n title={title}\n aria-label={title}\n src={url}\n width={strippedWidth}\n height={strippedHeight}\n allow=\"autoplay; encrypted-media; fullscreen\"\n loading=\"lazy\"\n />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAoBA,MAAM,gBAAA,GAAA,wBAAA,QAAsB,UAAU,EACpC,MAAM;CACJ,OAAO;CACP,QAAQ;AACV,EACF,CAAC;AAED,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAAQ,EAClC,MAAM,EACJ,OAAO,OACT,EACF,CAAC;AAED,MAAa,eAAe,EAAE,YAAmB;CAC/C,MAAM,EAAE,OAAA,GAAA,cAAA,gBAAqB;CAC7B,MAAM,aAAA,GAAA,MAAA,QAAsC,IAAI;CAEhD,CAAA,GAAA,MAAA,iBAAgB;EACd,MAAM,SAAS,UAAU;EACzB,IAAI,QAAQ;GACV,MAAM,CAAC,OAAO,UAAU,CAAC,OAAO,SAAS,OAAO,KAAK,GAAG,OAAO,SAAS,OAAO,MAAM,CAAC;GACtF,OAAO,MAAM,cAAc,GAAG,QAAQ,QAAQ,GAAG,GAAG,SAAS,SAAS;GACtE,OAAO,QAAQ;GACf,OAAO,SAAS;EAClB;CACF,GAAG,CAAC,CAAC;CAEL,IAAI,MAAM,WAAW,SACnB,OAAO,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD,EAAuB,MAAK,WAAY,CAAA;CAGjD,MAAM,EAAE,WAAW,SAAS;CAE5B,IAAI,UAAU,SAAS,cAAc;EACnC,MAAM,cAAc,MAAM,WAAW,YAAY,KAAK,cAAc,KAAA;EACpE,MAAM,MAAM,UAAU,QAAQ,KAAA,IAAY,UAAU,MAAM,aAAa,QAAQ;EAE/E,OACE,iBAAA,GAAA,kBAAA,KAAC,cAAD;GAAc,mBAAgB;aAC5B,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,aAAD;IACE,OAAO;KAJG,KAAK,aAAa,MAAM;KAAU,KAAK,OAAO;IAI7C;IACX,OAAO,UAAU,SAAS;IAC1B,KAAK,UAAU;IACf,SAAS,UAAU,WAAW;IAC9B,YAAY,EAAE,mCAAmC;GAClD,CAAA;EACW,CAAA;CAElB;CAEA,MAAM,EAAE,OAAO,QAAQ,QAAQ;CAE/B,MAAM,gBAAgB,OAAO,UAAU,WAAW,QAAQ,OAAO,QAAQ,SAAS,EAAE;CACpF,MAAM,iBAAiB,OAAO,WAAW,WAAW,SAAS,QAAQ,QAAQ,SAAS,EAAE;CACxF,MAAM,QAAQ,GAAG,EAAE,qBAAqB,EAAE,IAAI,UAAU,OAAO,KAAK,IAAI,UAAU,QAAQ;CAE1F,OACE,iBAAA,GAAA,kBAAA,KAAC,cAAD;EAAc,mBAAgB;YAC5B,iBAAA,GAAA,kBAAA,KAAC,cAAD;GACE,KAAK;GACE;GACP,cAAY;GACZ,KAAK;GACL,OAAO;GACP,QAAQ;GACR,OAAM;GACN,SAAQ;EACT,CAAA;CACW,CAAA;AAElB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ImageEmbed.js","names":["Figure","EmbedErrorPlaceholder","licenseAttributes","Image","AddLine","EmbedByline"],"sources":["../../src/Embed/ImageEmbed.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 { AddLine } from \"@ndla/icons\";\nimport { Figure, type FigureSize, type FigureVariantProps, Image } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { ImageEmbedData, ImageMetaData } from \"@ndla/types-embed\";\nimport parse from \"html-react-parser\";\nimport { type ReactNode, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport type { RenderContext } from \"./types\";\n\ninterface Props {\n embed: ImageMetaData;\n previewAlt?: boolean;\n lang?: string;\n renderContext?: RenderContext;\n children?: ReactNode;\n}\n\nexport interface Author {\n name: string;\n type: string;\n}\n\nconst getFigureProps = (size?: string, float?: string): FigureVariantProps => {\n const actualFloat = float === \"left\" ? \"left\" : float === \"right\" ? \"right\" : undefined;\n const replacedSize = size?.replace(\"-hide-byline\", \"\") ?? \"full\";\n const actualSize: FigureSize = (replacedSize === \"fullwidth\" ? \"full\" : replacedSize) as FigureSize;\n return {\n float: actualFloat,\n // Figure expects you to set a size when floating. If you don't, the figure will simply take up the available width. Fallback to medium in those cases.\n size: actualSize === \"full\" && float ? \"medium\" : actualSize,\n };\n};\n\nconst getSizes = (size?: string, align?: string) => {\n if (align && size === \"full\") {\n return \"(min-width: 1024px) 512px, (min-width: 768px) 350px, 100vw\";\n }\n if (align && size === \"small\") {\n return \"(min-width: 1024px) 350px, (min-width: 768px) 180px, 100vw\";\n }\n if (align && size === \"xsmall\") {\n return \"(min-width: 1024px) 180px, (min-width: 768px) 180px, 100vw\";\n }\n return \"(min-width: 1024px) 1024px, 100vw\";\n};\n\nexport const getFocalPoint = (data: ImageEmbedData) => {\n const focalX = Number.parseFloat(data.focalX ?? \"\");\n const focalY = Number.parseFloat(data.focalY ?? \"\");\n if (!Number.isNaN(focalX) && !Number.isNaN(focalY)) {\n return { x: focalX, y: focalY };\n }\n return undefined;\n};\n\nexport const getCrop = (data: ImageEmbedData) => {\n const lowerRightX = Number.parseFloat(data.lowerRightX ?? \"\");\n const lowerRightY = Number.parseFloat(data.lowerRightY ?? \"\");\n const upperLeftX = Number.parseFloat(data.upperLeftX ?? \"\");\n const upperLeftY = Number.parseFloat(data.upperLeftY ?? \"\");\n if (\n !Number.isNaN(lowerRightX) &&\n !Number.isNaN(lowerRightY) &&\n !Number.isNaN(upperLeftX) &&\n !Number.isNaN(upperLeftY)\n ) {\n return {\n startX: lowerRightX,\n startY: lowerRightY,\n endX: upperLeftX,\n endY: upperLeftY,\n };\n }\n return undefined;\n};\n\nconst expandedSizes = \"(min-width: 1024px) 1024px, 100vw\";\n\nconst ImageWrapper = styled(\"div\", {\n base: {\n overflow: \"hidden\",\n position: \"relative\",\n width: \"100%\",\n \"& img\": {\n width: \"100%\",\n },\n },\n variants: {\n svg: {\n true: {\n display: \"flex\",\n justifyContent: \"center\",\n },\n false: {},\n },\n border: {\n true: {\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n borderRadius: \"xsmall\",\n \"& img\": {\n borderRadius: \"0\",\n },\n },\n false: {},\n },\n expandable: {\n true: {\n cursor: \"pointer\",\n },\n false: {},\n },\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n zIndex: \"docked\",\n _hover: {\n \"& [data-byline-button]\": {\n background: \"background.default\",\n },\n \"& button[data-expanded]\": {\n transform: \"scale(1.2)\",\n },\n },\n \"& button[data-expanded='true']\": {\n \"& svg\": {\n transform: \"rotate(-45deg)\",\n },\n },\n },\n});\n\nconst ExpandButton = styled(\n \"button\",\n {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n cursor: \"pointer\",\n position: \"absolute\",\n padding: \"0\",\n top: \"xsmall\",\n right: \"xsmall\",\n width: \"medium\",\n height: \"medium\",\n border: \"2px solid\",\n borderColor: \"background.default\",\n transitionProperty: \"transform, background-color, color\",\n transitionDuration: \"normal\",\n transitionTimingFunction: \"ease-out\",\n color: \"background.default\",\n backgroundColor: \"surface.action\",\n borderRadius: \"large\",\n \"& svg\": {\n transitionProperty: \"transform\",\n transitionDuration: \"normal\",\n transitionTimingFunction: \"ease-out\",\n },\n tabletDown: {\n display: \"none\",\n },\n _print: {\n display: \"none\",\n },\n },\n },\n { defaultProps: { type: \"button\" } },\n);\n\nexport const ImageEmbed = ({ embed, previewAlt, lang, renderContext = \"article\", children }: Props) => {\n const [expanded, setExpanded] = useState(false);\n const figureProps = getFigureProps(embed.embedData.size, embed.embedData.align);\n const { t } = useTranslation();\n\n const parsedDescription = useMemo(() => {\n if (embed.embedData.caption || renderContext === \"article\") {\n return embed.embedData.caption ? parse(embed.embedData.caption) : undefined;\n }\n if (embed.status === \"success\" && embed.data.caption.caption) {\n return parse(embed.data.caption.caption);\n }\n }, [embed, renderContext]);\n\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type={\"image\"} figureType={figureProps?.size} float={figureProps?.float} />;\n }\n\n const { data, embedData } = embed;\n\n const altText = embedData.alt || \"\";\n\n const sizes = getSizes(embedData.size, embedData.align);\n\n const focalPoint = getFocalPoint(embedData);\n const crop = getCrop(embedData);\n\n const toggleImageSize = () => {\n setExpanded((prev) => !prev);\n };\n\n const licenseProps = licenseAttributes(data.copyright.license.license, lang, embedData.url);\n\n const figureSize = figureProps?.float ? (figureProps?.size ?? \"medium\") : \"full\";\n\n return (\n <StyledFigure\n float={figureProps?.float}\n size={expanded ? \"full\" : figureSize}\n data-embed-type=\"image\"\n {...licenseProps}\n >\n {children}\n <ImageWrapper border={embedData.border === \"true\"} expandable={!!figureProps?.float}>\n <Image\n focalPoint={focalPoint}\n contentType={data.image.contentType}\n crop={crop}\n sizes={expanded ? expandedSizes : sizes}\n alt={altText}\n src={data.image.imageUrl}\n variants={data.image.variants}\n lang={lang}\n onClick={figureProps?.float ? toggleImageSize : undefined}\n variant=\"rounded\"\n {...data.image.dimensions}\n />\n {(embedData.align === \"right\" || embedData.align === \"left\") && (\n <ExpandButton\n aria-label={t(`license.images.itemImage.zoom${expanded ? \"Out\" : \"\"}ImageButtonLabel`)}\n onClick={toggleImageSize}\n data-expanded={expanded}\n >\n <AddLine />\n </ExpandButton>\n )}\n </ImageWrapper>\n <EmbedByline\n type=\"image\"\n copyright={data.copyright}\n description={parsedDescription}\n hideDescription={embedData.hideCaption === \"true\"}\n hideCopyright={embedData.hideByline === \"true\"}\n visibleAlt={previewAlt ? embed.embedData.alt : \"\"}\n />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;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U,UAAU,WACnD,iBAAA,GAAA,kBAAA,KAAC,cAAD;KACE,cAAY,EAAE,gCAAgC,WAAW,QAAQ,GAAG,kBAAkB;KACtF,SAAS;KACT,iBAAe;eAEf,iBAAA,GAAA,kBAAA,KAACC,YAAAA,SAAD,EAAW,CAAA;KACE,CAAA,CAEJ;;GACf,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,aAAD;IACE,MAAK;IACL,WAAW,KAAK;IAChB,aAAa;IACb,iBAAiB,UAAU,gBAAgB;IAC3C,eAAe,UAAU,eAAe;IACxC,YAAY,aAAa,MAAM,UAAU,MAAM;IAC/C,CAAA;GACW"}
1
+ {"version":3,"file":"ImageEmbed.js","names":["Figure","EmbedErrorPlaceholder","licenseAttributes","Image","AddLine","EmbedByline"],"sources":["../../src/Embed/ImageEmbed.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 { AddLine } from \"@ndla/icons\";\nimport { Figure, type FigureSize, type FigureVariantProps, Image } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { ImageEmbedData, ImageMetaData } from \"@ndla/types-embed\";\nimport parse from \"html-react-parser\";\nimport { type ReactNode, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport type { RenderContext } from \"./types\";\n\ninterface Props {\n embed: ImageMetaData;\n previewAlt?: boolean;\n lang?: string;\n renderContext?: RenderContext;\n children?: ReactNode;\n}\n\nexport interface Author {\n name: string;\n type: string;\n}\n\nconst getFigureProps = (size?: string, float?: string): FigureVariantProps => {\n const actualFloat = float === \"left\" ? \"left\" : float === \"right\" ? \"right\" : undefined;\n const replacedSize = size?.replace(\"-hide-byline\", \"\") ?? \"full\";\n const actualSize: FigureSize = (replacedSize === \"fullwidth\" ? \"full\" : replacedSize) as FigureSize;\n return {\n float: actualFloat,\n // Figure expects you to set a size when floating. If you don't, the figure will simply take up the available width. Fallback to medium in those cases.\n size: actualSize === \"full\" && float ? \"medium\" : actualSize,\n };\n};\n\nconst getSizes = (size?: string, align?: string) => {\n if (align && size === \"full\") {\n return \"(min-width: 1024px) 512px, (min-width: 768px) 350px, 100vw\";\n }\n if (align && size === \"small\") {\n return \"(min-width: 1024px) 350px, (min-width: 768px) 180px, 100vw\";\n }\n if (align && size === \"xsmall\") {\n return \"(min-width: 1024px) 180px, (min-width: 768px) 180px, 100vw\";\n }\n return \"(min-width: 1024px) 1024px, 100vw\";\n};\n\nexport const getFocalPoint = (data: ImageEmbedData) => {\n const focalX = Number.parseFloat(data.focalX ?? \"\");\n const focalY = Number.parseFloat(data.focalY ?? \"\");\n if (!Number.isNaN(focalX) && !Number.isNaN(focalY)) {\n return { x: focalX, y: focalY };\n }\n return undefined;\n};\n\nexport const getCrop = (data: ImageEmbedData) => {\n const lowerRightX = Number.parseFloat(data.lowerRightX ?? \"\");\n const lowerRightY = Number.parseFloat(data.lowerRightY ?? \"\");\n const upperLeftX = Number.parseFloat(data.upperLeftX ?? \"\");\n const upperLeftY = Number.parseFloat(data.upperLeftY ?? \"\");\n if (\n !Number.isNaN(lowerRightX) &&\n !Number.isNaN(lowerRightY) &&\n !Number.isNaN(upperLeftX) &&\n !Number.isNaN(upperLeftY)\n ) {\n return {\n startX: lowerRightX,\n startY: lowerRightY,\n endX: upperLeftX,\n endY: upperLeftY,\n };\n }\n return undefined;\n};\n\nconst expandedSizes = \"(min-width: 1024px) 1024px, 100vw\";\n\nconst ImageWrapper = styled(\"div\", {\n base: {\n overflow: \"hidden\",\n position: \"relative\",\n width: \"100%\",\n \"& img\": {\n width: \"100%\",\n },\n },\n variants: {\n svg: {\n true: {\n display: \"flex\",\n justifyContent: \"center\",\n },\n false: {},\n },\n border: {\n true: {\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n borderRadius: \"xsmall\",\n \"& img\": {\n borderRadius: \"0\",\n },\n },\n false: {},\n },\n expandable: {\n true: {\n cursor: \"pointer\",\n },\n false: {},\n },\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n zIndex: \"docked\",\n _hover: {\n \"& [data-byline-button]\": {\n background: \"background.default\",\n },\n \"& button[data-expanded]\": {\n transform: \"scale(1.2)\",\n },\n },\n \"& button[data-expanded='true']\": {\n \"& svg\": {\n transform: \"rotate(-45deg)\",\n },\n },\n },\n});\n\nconst ExpandButton = styled(\n \"button\",\n {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n cursor: \"pointer\",\n position: \"absolute\",\n padding: \"0\",\n top: \"xsmall\",\n right: \"xsmall\",\n width: \"medium\",\n height: \"medium\",\n border: \"2px solid\",\n borderColor: \"background.default\",\n transitionProperty: \"transform, background-color, color\",\n transitionDuration: \"normal\",\n transitionTimingFunction: \"ease-out\",\n color: \"background.default\",\n backgroundColor: \"surface.action\",\n borderRadius: \"large\",\n \"& svg\": {\n transitionProperty: \"transform\",\n transitionDuration: \"normal\",\n transitionTimingFunction: \"ease-out\",\n },\n tabletDown: {\n display: \"none\",\n },\n _print: {\n display: \"none\",\n },\n },\n },\n { defaultProps: { type: \"button\" } },\n);\n\nexport const ImageEmbed = ({ embed, previewAlt, lang, renderContext = \"article\", children }: Props) => {\n const [expanded, setExpanded] = useState(false);\n const figureProps = getFigureProps(embed.embedData.size, embed.embedData.align);\n const { t } = useTranslation();\n\n const parsedDescription = useMemo(() => {\n if (embed.embedData.caption || renderContext === \"article\") {\n return embed.embedData.caption ? parse(embed.embedData.caption) : undefined;\n }\n if (embed.status === \"success\" && embed.data.caption.caption) {\n return parse(embed.data.caption.caption);\n }\n }, [embed, renderContext]);\n\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type={\"image\"} figureType={figureProps?.size} float={figureProps?.float} />;\n }\n\n const { data, embedData } = embed;\n\n const altText = embedData.alt || \"\";\n\n const sizes = getSizes(embedData.size, embedData.align);\n\n const focalPoint = getFocalPoint(embedData);\n const crop = getCrop(embedData);\n\n const toggleImageSize = () => {\n setExpanded((prev) => !prev);\n };\n\n const licenseProps = licenseAttributes(data.copyright.license.license, lang, embedData.url);\n\n const figureSize = figureProps?.float ? (figureProps?.size ?? \"medium\") : \"full\";\n\n return (\n <StyledFigure\n float={figureProps?.float}\n size={expanded ? \"full\" : figureSize}\n data-embed-type=\"image\"\n {...licenseProps}\n >\n {children}\n <ImageWrapper border={embedData.border === \"true\"} expandable={!!figureProps?.float}>\n <Image\n focalPoint={focalPoint}\n contentType={data.image.contentType}\n crop={crop}\n sizes={expanded ? expandedSizes : sizes}\n alt={altText}\n src={data.image.imageUrl}\n variants={data.image.variants}\n lang={lang}\n onClick={figureProps?.float ? toggleImageSize : undefined}\n variant=\"rounded\"\n {...data.image.dimensions}\n />\n {(embedData.align === \"right\" || embedData.align === \"left\") && (\n <ExpandButton\n aria-label={t(`license.images.itemImage.zoom${expanded ? \"Out\" : \"\"}ImageButtonLabel`)}\n onClick={toggleImageSize}\n data-expanded={expanded}\n >\n <AddLine />\n </ExpandButton>\n )}\n </ImageWrapper>\n <EmbedByline\n type=\"image\"\n copyright={data.copyright}\n description={parsedDescription}\n hideDescription={embedData.hideCaption === \"true\"}\n hideCopyright={embedData.hideByline === \"true\"}\n visibleAlt={previewAlt ? embed.embedData.alt : \"\"}\n />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,kBAAkB,MAAe,UAAuC;CAC5E,MAAM,cAAc,UAAU,SAAS,SAAS,UAAU,UAAU,UAAU,KAAA;CAC9E,MAAM,eAAe,MAAM,QAAQ,gBAAgB,EAAE,KAAK;CAC1D,MAAM,aAA0B,iBAAiB,cAAc,SAAS;CACxE,OAAO;EACL,OAAO;EAEP,MAAM,eAAe,UAAU,QAAQ,WAAW;CACpD;AACF;AAE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AAK;IACL,WAAW,KAAK;IAChB,aAAa;IACb,iBAAiB,UAAU,gBAAgB;IAC3C,eAAe,UAAU,eAAe;IACxC,YAAY,aAAa,MAAM,UAAU,MAAM;GAChD,CAAA;EACW;;AAElB"}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineTriggerButton.js","names":[],"sources":["../../src/Embed/InlineTriggerButton.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { composeRefs } from \"@ndla/util\";\nimport { type ComponentPropsWithRef, type KeyboardEvent, forwardRef, useCallback, useRef } from \"react\";\n\nconst StyledSpan = styled(\"span\", { base: {} });\n\nexport const InlineTriggerButton = forwardRef<HTMLSpanElement, ComponentPropsWithRef<\"span\">>(\n ({ onClick, ...props }, ref) => {\n const spanRef = useRef<HTMLSpanElement>(null);\n\n // Emulate a button click when pressing Enter or Space\n const onKeyboardEvent = useCallback((event: KeyboardEvent<HTMLSpanElement>) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n spanRef.current?.click();\n }\n }, []);\n\n return (\n <StyledSpan\n ref={composeRefs(spanRef, ref)}\n onKeyUp={onKeyboardEvent}\n onClick={onClick}\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"button\"\n tabIndex={0}\n {...props}\n />\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,cAAA,GAAA,wBAAA,QAAoB,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC;AAE/C,MAAa,uBAAA,GAAA,MAAA,aACV,EAAE,SAAS,GAAG,SAAS,QAAQ;CAC9B,MAAM,WAAA,GAAA,MAAA,QAAkC,KAAK;CAG7C,MAAM,mBAAA,GAAA,MAAA,cAA+B,UAA0C;AAC7E,MAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,IACzC,SAAQ,SAAS,OAAO;IAEzB,EAAE,CAAC;AAEN,QACE,iBAAA,GAAA,kBAAA,KAAC,YAAD;EACE,MAAA,GAAA,WAAA,aAAiB,SAAS,IAAI;EAC9B,SAAS;EACA;EAET,MAAK;EACL,UAAU;EACV,GAAI;EACJ,CAAA;EAGP"}
1
+ {"version":3,"file":"InlineTriggerButton.js","names":[],"sources":["../../src/Embed/InlineTriggerButton.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { composeRefs } from \"@ndla/util\";\nimport { type ComponentPropsWithRef, type KeyboardEvent, forwardRef, useCallback, useRef } from \"react\";\n\nconst StyledSpan = styled(\"span\", { base: {} });\n\nexport const InlineTriggerButton = forwardRef<HTMLSpanElement, ComponentPropsWithRef<\"span\">>(\n ({ onClick, ...props }, ref) => {\n const spanRef = useRef<HTMLSpanElement>(null);\n\n // Emulate a button click when pressing Enter or Space\n const onKeyboardEvent = useCallback((event: KeyboardEvent<HTMLSpanElement>) => {\n if (event.key === \"Enter\" || event.key === \" \") {\n spanRef.current?.click();\n }\n }, []);\n\n return (\n <StyledSpan\n ref={composeRefs(spanRef, ref)}\n onKeyUp={onKeyboardEvent}\n onClick={onClick}\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"button\"\n tabIndex={0}\n {...props}\n />\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,cAAA,GAAA,wBAAA,QAAoB,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;AAE9C,MAAa,uBAAA,GAAA,MAAA,aACV,EAAE,SAAS,GAAG,SAAS,QAAQ;CAC9B,MAAM,WAAA,GAAA,MAAA,QAAkC,IAAI;CAG5C,MAAM,mBAAA,GAAA,MAAA,cAA+B,UAA0C;EAC7E,IAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KACzC,QAAQ,SAAS,MAAM;CAE3B,GAAG,CAAC,CAAC;CAEL,OACE,iBAAA,GAAA,kBAAA,KAAC,YAAD;EACE,MAAA,GAAA,WAAA,aAAiB,SAAS,GAAG;EAC7B,SAAS;EACA;EAET,MAAK;EACL,UAAU;EACV,GAAI;CACL,CAAA;AAEL,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"RelatedContentEmbed.js","names":["RelatedArticle"],"sources":["../../src/Embed/RelatedContentEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { RelatedContentMetaData } from \"@ndla/types-embed\";\nimport { useTranslation } from \"react-i18next\";\nimport { RelatedArticle } from \"../RelatedArticleList/RelatedArticleList\";\n\ninterface Props {\n embed: RelatedContentMetaData;\n isOembed?: boolean;\n subject?: string;\n ndlaFrontendDomain?: string;\n}\n\nexport const RelatedContentEmbed = ({ embed, isOembed, subject, ndlaFrontendDomain }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return null;\n }\n\n const { data, embedData } = embed;\n\n if (embedData.articleId && data) {\n const context = data.resource?.contexts.find((c) => c.rootId === subject);\n const url = context?.url ?? data.resource?.url ?? `/article/${embedData.articleId}`;\n return (\n <RelatedArticle\n title={data.article.title?.title ?? \"\"}\n introduction={data.article.metaDescription?.metaDescription ?? \"\"}\n target={isOembed ? \"_blank\" : undefined}\n to={`${ndlaFrontendDomain ?? \"\"}${url ?? \"\"}`}\n />\n );\n }\n if (typeof embedData.url === \"string\") {\n return (\n <RelatedArticle\n title={embedData.title ?? \"\"}\n to={embedData.url}\n target=\"_blank\"\n linkInfo={`${t(\"related.linkInfo\")} ${embedData.urlDomain}`}\n />\n );\n }\n return null;\n};\n"],"mappings":";;;;;AAmBA,MAAa,uBAAuB,EAAE,OAAO,UAAU,SAAS,yBAAgC;CAC9F,MAAM,EAAE,OAAA,GAAA,cAAA,iBAAsB;AAC9B,KAAI,MAAM,WAAW,QACnB,QAAO;CAGT,MAAM,EAAE,MAAM,cAAc;AAE5B,KAAI,UAAU,aAAa,MAAM;EAE/B,MAAM,OADU,KAAK,UAAU,SAAS,MAAM,MAAM,EAAE,WAAW,QAAQ,GACpD,OAAO,KAAK,UAAU,OAAO,YAAY,UAAU;AACxE,SACE,iBAAA,GAAA,kBAAA,KAACA,2BAAAA,gBAAD;GACE,OAAO,KAAK,QAAQ,OAAO,SAAS;GACpC,cAAc,KAAK,QAAQ,iBAAiB,mBAAmB;GAC/D,QAAQ,WAAW,WAAW,KAAA;GAC9B,IAAI,GAAG,sBAAsB,KAAK,OAAO;GACzC,CAAA;;AAGN,KAAI,OAAO,UAAU,QAAQ,SAC3B,QACE,iBAAA,GAAA,kBAAA,KAACA,2BAAAA,gBAAD;EACE,OAAO,UAAU,SAAS;EAC1B,IAAI,UAAU;EACd,QAAO;EACP,UAAU,GAAG,EAAE,mBAAmB,CAAC,GAAG,UAAU;EAChD,CAAA;AAGN,QAAO"}
1
+ {"version":3,"file":"RelatedContentEmbed.js","names":["RelatedArticle"],"sources":["../../src/Embed/RelatedContentEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { RelatedContentMetaData } from \"@ndla/types-embed\";\nimport { useTranslation } from \"react-i18next\";\nimport { RelatedArticle } from \"../RelatedArticleList/RelatedArticleList\";\n\ninterface Props {\n embed: RelatedContentMetaData;\n isOembed?: boolean;\n subject?: string;\n ndlaFrontendDomain?: string;\n}\n\nexport const RelatedContentEmbed = ({ embed, isOembed, subject, ndlaFrontendDomain }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return null;\n }\n\n const { data, embedData } = embed;\n\n if (embedData.articleId && data) {\n const context = data.resource?.contexts.find((c) => c.rootId === subject);\n const url = context?.url ?? data.resource?.url ?? `/article/${embedData.articleId}`;\n return (\n <RelatedArticle\n title={data.article.title?.title ?? \"\"}\n introduction={data.article.metaDescription?.metaDescription ?? \"\"}\n target={isOembed ? \"_blank\" : undefined}\n to={`${ndlaFrontendDomain ?? \"\"}${url ?? \"\"}`}\n />\n );\n }\n if (typeof embedData.url === \"string\") {\n return (\n <RelatedArticle\n title={embedData.title ?? \"\"}\n to={embedData.url}\n target=\"_blank\"\n linkInfo={`${t(\"related.linkInfo\")} ${embedData.urlDomain}`}\n />\n );\n }\n return null;\n};\n"],"mappings":";;;;;AAmBA,MAAa,uBAAuB,EAAE,OAAO,UAAU,SAAS,yBAAgC;CAC9F,MAAM,EAAE,OAAA,GAAA,cAAA,gBAAqB;CAC7B,IAAI,MAAM,WAAW,SACnB,OAAO;CAGT,MAAM,EAAE,MAAM,cAAc;CAE5B,IAAI,UAAU,aAAa,MAAM;EAE/B,MAAM,OADU,KAAK,UAAU,SAAS,MAAM,MAAM,EAAE,WAAW,OAAO,IACnD,OAAO,KAAK,UAAU,OAAO,YAAY,UAAU;EACxE,OACE,iBAAA,GAAA,kBAAA,KAACA,2BAAAA,gBAAD;GACE,OAAO,KAAK,QAAQ,OAAO,SAAS;GACpC,cAAc,KAAK,QAAQ,iBAAiB,mBAAmB;GAC/D,QAAQ,WAAW,WAAW,KAAA;GAC9B,IAAI,GAAG,sBAAsB,KAAK,OAAO;EAC1C,CAAA;CAEL;CACA,IAAI,OAAO,UAAU,QAAQ,UAC3B,OACE,iBAAA,GAAA,kBAAA,KAACA,2BAAAA,gBAAD;EACE,OAAO,UAAU,SAAS;EAC1B,IAAI,UAAU;EACd,QAAO;EACP,UAAU,GAAG,EAAE,kBAAkB,EAAE,GAAG,UAAU;CACjD,CAAA;CAGL,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"UnknownEmbed.js","names":["Text"],"sources":["../../src/Embed/UnknownEmbed.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 { Text } from \"@ndla/primitives\";\nimport type { MetaData } from \"@ndla/types-embed\";\nimport { useTranslation } from \"react-i18next\";\n\ninterface Props {\n embed: MetaData<any, any>;\n}\n\nexport const UnknownEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n return (\n <Text color=\"text.error\" asChild consumeCss data-embed-type=\"unknown\">\n <span>{t(\"embed.unsupported\", { type: embed.resource })}</span>\n </Text>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAa,gBAAgB,EAAE,YAAmB;CAChD,MAAM,EAAE,OAAA,GAAA,cAAA,iBAAsB;AAC9B,QACE,iBAAA,GAAA,kBAAA,KAACA,iBAAAA,MAAD;EAAM,OAAM;EAAa,SAAA;EAAQ,YAAA;EAAW,mBAAgB;YAC1D,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAA,UAAO,EAAE,qBAAqB,EAAE,MAAM,MAAM,UAAU,CAAC,EAAQ,CAAA;EAC1D,CAAA"}
1
+ {"version":3,"file":"UnknownEmbed.js","names":["Text"],"sources":["../../src/Embed/UnknownEmbed.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 { Text } from \"@ndla/primitives\";\nimport type { MetaData } from \"@ndla/types-embed\";\nimport { useTranslation } from \"react-i18next\";\n\ninterface Props {\n embed: MetaData<any, any>;\n}\n\nexport const UnknownEmbed = ({ embed }: Props) => {\n const { t } = useTranslation();\n return (\n <Text color=\"text.error\" asChild consumeCss data-embed-type=\"unknown\">\n <span>{t(\"embed.unsupported\", { type: embed.resource })}</span>\n </Text>\n );\n};\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAa,gBAAgB,EAAE,YAAmB;CAChD,MAAM,EAAE,OAAA,GAAA,cAAA,gBAAqB;CAC7B,OACE,iBAAA,GAAA,kBAAA,KAACA,iBAAAA,MAAD;EAAM,OAAM;EAAa,SAAA;EAAQ,YAAA;EAAW,mBAAgB;YAC1D,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAA,UAAO,EAAE,qBAAqB,EAAE,MAAM,MAAM,SAAS,CAAC,EAAQ,CAAA;CAC1D,CAAA;AAEV"}
@@ -1,11 +1,12 @@
1
1
  require("../_virtual/_rolldown/runtime.js");
2
2
  let _ndla_primitives = require("@ndla/primitives");
3
3
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
4
- require("react");
4
+ let react = require("react");
5
5
  let react_i18next = require("react-i18next");
6
6
  let _ndla_icons = require("@ndla/icons");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
8
- let _ark_ui_react = require("@ark-ui/react");
8
+ let _ndla_styled_system_patterns = require("@ndla/styled-system/patterns");
9
+ let _ark_ui_react_portal = require("@ark-ui/react/portal");
9
10
  //#region src/Embed/UuDisclaimerEmbed.tsx
10
11
  /**
11
12
  * Copyright (c) 2024-present, NDLA.
@@ -26,12 +27,28 @@ const StyledErrorWarningFill = (0, _ndla_styled_system_jsx.styled)(_ndla_icons.E
26
27
  fill: "icon.subtle"
27
28
  } });
28
29
  const StyledPopoverContent = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.PopoverContent, { base: {
30
+ display: "flex",
31
+ flexDirection: "column",
32
+ gap: "xsmall",
29
33
  width: "surface.xlarge",
30
34
  maxHeight: "50vh",
31
35
  overflowY: "auto"
32
36
  } });
37
+ const HiddenButton = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.Button, { base: { "&:not(:focus)": {
38
+ position: "absolute",
39
+ width: "1px",
40
+ height: "1px",
41
+ padding: "0",
42
+ margin: "-1px",
43
+ overflow: "hidden",
44
+ clip: "rect(0,0,0,0)",
45
+ whiteSpace: "nowrap",
46
+ borderWidth: "0"
47
+ } } });
33
48
  const UuDisclaimerEmbed = ({ embed, transformedDisclaimer, children }) => {
34
49
  const { t } = (0, react_i18next.useTranslation)();
50
+ const skipRef = (0, react.useRef)(null);
51
+ const contentRef = (0, react.useRef)(null);
35
52
  if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DisclaimerWrapper, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledErrorWarningFill, {
36
53
  "aria-label": t("embed.embedError", { type: t("embed.type.disclaimer") }),
37
54
  title: t("embed.embedError", { type: t("embed.type.disclaimer") })
@@ -39,19 +56,37 @@ const UuDisclaimerEmbed = ({ embed, transformedDisclaimer, children }) => {
39
56
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DisclaimerWrapper, {
40
57
  role: "region",
41
58
  "data-embed-type": "uu-disclaimer",
42
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_ndla_primitives.PopoverRoot, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.PopoverTrigger, {
43
- asChild: true,
44
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledIconButton, {
45
- size: "small",
46
- variant: "secondary",
47
- "aria-label": t("uuDisclaimer.title"),
48
- title: t("uuDisclaimer.title"),
49
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_icons.AccessibilityFill, {})
59
+ children: [
60
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_ndla_primitives.PopoverRoot, {
61
+ initialFocusEl: () => contentRef.current,
62
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.PopoverTrigger, {
63
+ asChild: true,
64
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledIconButton, {
65
+ size: "small",
66
+ variant: "secondary",
67
+ "aria-label": t("uuDisclaimer.title"),
68
+ title: t("uuDisclaimer.title"),
69
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_icons.AccessibilityFill, {})
70
+ })
71
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react_portal.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledPopoverContent, {
72
+ ref: contentRef,
73
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: transformedDisclaimer }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HiddenButton, {
74
+ onClick: () => skipRef.current?.focus(),
75
+ children: t("uuDisclaimer.skipContent")
76
+ })]
77
+ }) })]
78
+ }),
79
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
80
+ "data-uu-content": "",
81
+ children
82
+ }),
83
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
84
+ className: (0, _ndla_styled_system_patterns.visuallyHidden)(),
85
+ tabIndex: -1,
86
+ ref: skipRef,
87
+ children: t("uuDisclaimer.contentCompleted")
50
88
  })
51
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledPopoverContent, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: transformedDisclaimer }) }) })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
52
- "data-uu-content": "",
53
- children
54
- })]
89
+ ]
55
90
  });
56
91
  };
57
92
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"UuDisclaimerEmbed.js","names":["IconButton","ErrorWarningFill","PopoverContent","PopoverRoot","PopoverTrigger","AccessibilityFill","Portal"],"sources":["../../src/Embed/UuDisclaimerEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Portal } from \"@ark-ui/react\";\nimport { AccessibilityFill, ErrorWarningFill } from \"@ndla/icons\";\nimport { IconButton, PopoverContent, PopoverRoot, PopoverTrigger } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { UuDisclaimerMetaData } from \"@ndla/types-embed\";\nimport { type ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\ninterface Props {\n embed: UuDisclaimerMetaData;\n transformedDisclaimer: ReactNode;\n children?: ReactNode;\n}\n\nconst DisclaimerWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n clear: \"both\",\n },\n});\n\nconst StyledIconButton = styled(IconButton, {\n base: {\n alignSelf: \"flex-end\",\n },\n});\n\nconst StyledErrorWarningFill = styled(ErrorWarningFill, {\n base: {\n alignSelf: \"flex-end\",\n fill: \"icon.subtle\",\n },\n});\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n width: \"surface.xlarge\",\n maxHeight: \"50vh\",\n overflowY: \"auto\",\n },\n});\n\nexport const UuDisclaimerEmbed = ({ embed, transformedDisclaimer, children }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return (\n <DisclaimerWrapper>\n <StyledErrorWarningFill\n aria-label={t(\"embed.embedError\", { type: t(\"embed.type.disclaimer\") })}\n title={t(\"embed.embedError\", { type: t(\"embed.type.disclaimer\") })}\n />\n {children}\n </DisclaimerWrapper>\n );\n }\n\n return (\n <DisclaimerWrapper role=\"region\" data-embed-type=\"uu-disclaimer\">\n <PopoverRoot>\n <PopoverTrigger asChild>\n <StyledIconButton\n size=\"small\"\n variant=\"secondary\"\n aria-label={t(\"uuDisclaimer.title\")}\n title={t(\"uuDisclaimer.title\")}\n >\n <AccessibilityFill />\n </StyledIconButton>\n </PopoverTrigger>\n <Portal>\n <StyledPopoverContent>\n <div>{transformedDisclaimer}</div>\n </StyledPopoverContent>\n </Portal>\n </PopoverRoot>\n <div data-uu-content=\"\">{children}</div>\n </DisclaimerWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,MAAM,qBAAA,GAAA,wBAAA,QAA2B,OAAO,EACtC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,OAAO;CACR,EACF,CAAC;AAEF,MAAM,oBAAA,GAAA,wBAAA,QAA0BA,iBAAAA,YAAY,EAC1C,MA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,EACd,iBAAA,GAAA,kBAAA,KAAC,OAAD;GAAK,mBAAgB;GAAI;GAAe,CAAA,CACtB"}
1
+ {"version":3,"file":"UuDisclaimerEmbed.js","names":["IconButton","ErrorWarningFill","PopoverContent","Button","PopoverRoot","PopoverTrigger","AccessibilityFill","Portal"],"sources":["../../src/Embed/UuDisclaimerEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Portal } from \"@ark-ui/react/portal\";\nimport { AccessibilityFill, ErrorWarningFill } from \"@ndla/icons\";\nimport { Button, IconButton, PopoverContent, PopoverRoot, PopoverTrigger } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { visuallyHidden } from \"@ndla/styled-system/patterns\";\nimport type { UuDisclaimerMetaData } from \"@ndla/types-embed\";\nimport { useRef, type ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\ninterface Props {\n embed: UuDisclaimerMetaData;\n transformedDisclaimer: ReactNode;\n children?: ReactNode;\n}\n\nconst DisclaimerWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n clear: \"both\",\n },\n});\n\nconst StyledIconButton = styled(IconButton, {\n base: {\n alignSelf: \"flex-end\",\n },\n});\n\nconst StyledErrorWarningFill = styled(ErrorWarningFill, {\n base: {\n alignSelf: \"flex-end\",\n fill: \"icon.subtle\",\n },\n});\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n width: \"surface.xlarge\",\n maxHeight: \"50vh\",\n overflowY: \"auto\",\n },\n});\n\nconst HiddenButton = styled(Button, {\n base: {\n \"&:not(:focus)\": {\n position: \"absolute\",\n width: \"1px\",\n height: \"1px\",\n padding: \"0\",\n margin: \"-1px\",\n overflow: \"hidden\",\n clip: \"rect(0,0,0,0)\",\n whiteSpace: \"nowrap\",\n borderWidth: \"0\",\n },\n },\n});\n\nexport const UuDisclaimerEmbed = ({ embed, transformedDisclaimer, children }: Props) => {\n const { t } = useTranslation();\n const skipRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n if (embed.status === \"error\") {\n return (\n <DisclaimerWrapper>\n <StyledErrorWarningFill\n aria-label={t(\"embed.embedError\", { type: t(\"embed.type.disclaimer\") })}\n title={t(\"embed.embedError\", { type: t(\"embed.type.disclaimer\") })}\n />\n {children}\n </DisclaimerWrapper>\n );\n }\n\n return (\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n <DisclaimerWrapper role=\"region\" data-embed-type=\"uu-disclaimer\">\n <PopoverRoot initialFocusEl={() => contentRef.current}>\n <PopoverTrigger asChild>\n <StyledIconButton\n size=\"small\"\n variant=\"secondary\"\n aria-label={t(\"uuDisclaimer.title\")}\n title={t(\"uuDisclaimer.title\")}\n >\n <AccessibilityFill />\n </StyledIconButton>\n </PopoverTrigger>\n <Portal>\n <StyledPopoverContent ref={contentRef}>\n <div>{transformedDisclaimer}</div>\n <HiddenButton onClick={() => skipRef.current?.focus()}>{t(\"uuDisclaimer.skipContent\")}</HiddenButton>\n </StyledPopoverContent>\n </Portal>\n </PopoverRoot>\n <div data-uu-content=\"\">{children}</div>\n <div className={visuallyHidden()} tabIndex={-1} ref={skipRef}>\n {t(\"uuDisclaimer.contentCompleted\")}\n </div>\n </DisclaimerWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,MAAM,qBAAA,GAAA,wBAAA,QAA2B,OAAO,EACtC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,OAAO;AACT,EACF,CAAC;AAED,MAAM,oBAAA,GAAA,wBAAA,QAA0BA,iBAAAA,YAAY,EAC1C,MAAM,EACJ,WAAW,WACb,EACF,CAAC;AAED,MAAM,0BAAA,GAAA,wBAAA,QAAgCC,YAAAA,kBAAkB,EACtD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A,mBAAD,CAAoB,CAAA;KACJ,CAAA;IACJ,CAAA,GAChB,iBAAA,GAAA,kBAAA,KAACC,qBAAAA,QAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,MAAC,sBAAD;KAAsB,KAAK;eAA3B,CACE,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAA,UAAM,sBAA2B,CAAA,GACjC,iBAAA,GAAA,kBAAA,KAAC,cAAD;MAAc,eAAe,QAAQ,SAAS,MAAM;gBAAI,EAAE,0BAA0B;KAAgB,CAAA,CAChF;OAChB,CAAA,CACG;;GACb,iBAAA,GAAA,kBAAA,KAAC,OAAD;IAAK,mBAAgB;IAAI;GAAc,CAAA;GACvC,iBAAA,GAAA,kBAAA,KAAC,OAAD;IAAK,YAAA,GAAA,6BAAA,gBAA0B;IAAG,UAAU;IAAI,KAAK;cAClD,EAAE,+BAA+B;GAC/B,CAAA;EACY;;AAEvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"FactBox.js","names":["Button","React"],"sources":["../../src/FactBox/FactBox.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 { Button } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport React, {\n type ComponentProps,\n type ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useState,\n} from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\ninterface Props extends ComponentProps<\"aside\"> {\n children?: ReactNode;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nconst StyledAside = styled(\"aside\", {\n base: {\n position: \"relative\",\n padding: \"medium\",\n paddingBottom: \"xxlarge\",\n display: \"grid\",\n gridTemplateRows: \"0fr\",\n transitionProperty: \"grid-template-rows\",\n transitionDuration: \"slow\",\n transitionTimingFunction: \"ease-in-out\",\n justifyItems: \"center\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n clear: \"both\",\n _open: {\n gridTemplateRows: \"1fr\",\n },\n _print: {\n gridTemplateRows: \"1fr\",\n overflow: \"visible\",\n maxHeight: \"500vh\",\n },\n \"& > div\": {\n minHeight: \"surface.3xsmall\",\n },\n },\n variants: {\n overflowHidden: {\n true: {\n \"& > div\": {\n overflow: \"hidden\",\n _print: {\n overflow: \"visible\",\n },\n },\n },\n },\n },\n});\n\nconst StyledContent = styled(\"div\", {\n base: {\n position: \"relative\",\n width: \"100%\",\n // Reset the top margin of the very first child.\n \"& :first-child\": {\n marginBlockStart: \"0\",\n },\n _print: {\n overflow: \"visible\",\n },\n _open: {\n paddingBlockEnd: \"xsmall\",\n },\n },\n});\n\nconst StyledButton = styled(Button, {\n base: {\n position: \"absolute\",\n bottom: \"-medium\",\n zIndex: \"base\",\n _print: {\n display: \"none\",\n },\n },\n});\n\n// TODO: Consider moving the open trigger depending on whether the content is open or closed.\n\nexport const FactBox = forwardRef<HTMLElement, Props>(\n ({ children, open, onOpenChange, defaultOpen = false, ...rest }, ref) => {\n const { t } = useTranslation();\n const [state, setState] = useState<\"open\" | \"closed\">(defaultOpen ? \"open\" : \"closed\");\n const [overflowHidden, setOverflowHidden] = useState(!defaultOpen);\n const contentId = useId();\n // Inert has existed since early 2023. It allows us to disable tabindex inside the content if it is closed, allowing us to be accessible for users with newish browsers. React 18 removes this because it doesn't recognize the attribute. This is a workaround for that.\n // When running in React 18, we need to use an empty string instead of true.\n // TODO: Remove this hack once we upgrade to React 19 as a peer dep.\n const inertAttribute = useMemo(() => {\n return state === \"closed\" ? { inert: typeof React.use === \"function\" ? true : \"\" } : {};\n }, [state]) as { inert?: boolean };\n\n useEffect(() => {\n if (open !== undefined) {\n setState(open ? \"open\" : \"closed\");\n }\n }, [open]);\n\n const onClick = useCallback(() => {\n const newState = state === \"open\" ? \"closed\" : \"open\";\n setState(newState);\n onOpenChange?.(newState === \"open\");\n }, [state, onOpenChange]);\n\n return (\n <StyledAside\n data-state={state}\n data-embed-type=\"factbox\"\n {...rest}\n ref={ref}\n overflowHidden={overflowHidden}\n onTransitionStart={(e) => {\n if (e.target === e.currentTarget && state === \"closed\") {\n setOverflowHidden(true);\n }\n }}\n onTransitionEnd={(e) => {\n if (e.target === e.currentTarget && state === \"open\") {\n setOverflowHidden(false);\n }\n }}\n >\n <StyledButton\n data-state={state}\n onClick={onClick}\n contentEditable={false}\n aria-expanded={state === \"open\"}\n variant=\"secondary\"\n aria-controls={contentId}\n >\n {t(`factbox.${state === \"open\" ? \"showLess\" : \"showMore\"}`)}\n </StyledButton>\n <StyledContent id={contentId} data-state={state} aria-hidden={state === \"closed\"} {...inertAttribute}>\n {children}\n </StyledContent>\n </StyledAside>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;AA6BA,MAAM,eAAA,GAAA,wBAAA,QAAqB,SAAS;CAClC,MAAM;EACJ,UAAU;EACV,SAAS;EACT,eAAe;EACf,SAAS;EACT,kBAAkB;EAClB,oBAAoB;EACpB,oBAAoB;EACpB,0BAA0B;EAC1B,cAAc;EACd,QAAQ;EACR,aAAa;EACb,cAAc;EACd,OAAO;EACP,OAAO,EACL,kBAAkB,OACnB;EACD,QAAQ;GACN,kBAAkB;GAClB,UAAU;GACV,WAAW;GACZ;EACD,WAAW,EACT,WAAW,mBACZ;EACF;CACD,UAAU,EACR,gBAAgB,EACd,MAAM,EACJ,WAAW;EACT,UAAU;EACV,QAAQ,EACN,UAAU,WACX;EACF,EACF,EACF,EACF;CACF,CAAC;AAEF,MAAM,iBAAA,GAAA,wBAAA,QAAuB,OAAO,EAClC,MAAM;CACJ,UAAU;CACV,OAAO;CAEP,kBAAkB,EAChB,kBAAkB,KACnB;CACD,QAAQ,EACN,UAAU,WACX;CACD,OAAO,EACL,iBAAiB,UAClB;CACF,EACF,CAAC;AAEF,MAAM,gBAAA,GAAA,wBAAA,QAAsBA,iBAAAA,QAAQ,EAClC,MAAM;CACJ,UAAU;CACV,QA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iBAAA,GAAA,kBAAA,KAAC,eAAD;GAAe,IAAI;GAAW,cAAY;GAAO,eAAa,UAAU;GAAU,GAAI;GACnF;GACa,CAAA,CACJ;;EAGnB"}
1
+ {"version":3,"file":"FactBox.js","names":["Button","React"],"sources":["../../src/FactBox/FactBox.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 { Button } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport React, {\n type ComponentProps,\n type ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useState,\n} from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\ninterface Props extends ComponentProps<\"aside\"> {\n children?: ReactNode;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nconst StyledAside = styled(\"aside\", {\n base: {\n position: \"relative\",\n padding: \"medium\",\n paddingBottom: \"xxlarge\",\n display: \"grid\",\n gridTemplateRows: \"0fr\",\n transitionProperty: \"grid-template-rows\",\n transitionDuration: \"slow\",\n transitionTimingFunction: \"ease-in-out\",\n justifyItems: \"center\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n clear: \"both\",\n _open: {\n gridTemplateRows: \"1fr\",\n },\n _print: {\n gridTemplateRows: \"1fr\",\n overflow: \"visible\",\n maxHeight: \"500vh\",\n },\n \"& > div\": {\n minHeight: \"surface.3xsmall\",\n },\n },\n variants: {\n overflowHidden: {\n true: {\n \"& > div\": {\n overflow: \"hidden\",\n _print: {\n overflow: \"visible\",\n },\n },\n },\n },\n },\n});\n\nconst StyledContent = styled(\"div\", {\n base: {\n position: \"relative\",\n width: \"100%\",\n // Reset the top margin of the very first child.\n \"& :first-child\": {\n marginBlockStart: \"0\",\n },\n _print: {\n overflow: \"visible\",\n },\n _open: {\n paddingBlockEnd: \"xsmall\",\n },\n },\n});\n\nconst StyledButton = styled(Button, {\n base: {\n position: \"absolute\",\n bottom: \"-medium\",\n zIndex: \"base\",\n _print: {\n display: \"none\",\n },\n },\n});\n\n// TODO: Consider moving the open trigger depending on whether the content is open or closed.\n\nexport const FactBox = forwardRef<HTMLElement, Props>(\n ({ children, open, onOpenChange, defaultOpen = false, ...rest }, ref) => {\n const { t } = useTranslation();\n const [state, setState] = useState<\"open\" | \"closed\">(defaultOpen ? \"open\" : \"closed\");\n const [overflowHidden, setOverflowHidden] = useState(!defaultOpen);\n const contentId = useId();\n // Inert has existed since early 2023. It allows us to disable tabindex inside the content if it is closed, allowing us to be accessible for users with newish browsers. React 18 removes this because it doesn't recognize the attribute. This is a workaround for that.\n // When running in React 18, we need to use an empty string instead of true.\n // TODO: Remove this hack once we upgrade to React 19 as a peer dep.\n const inertAttribute = useMemo(() => {\n return state === \"closed\" ? { inert: typeof React.use === \"function\" ? true : \"\" } : {};\n }, [state]) as { inert?: boolean };\n\n useEffect(() => {\n if (open !== undefined) {\n setState(open ? \"open\" : \"closed\");\n }\n }, [open]);\n\n const onClick = useCallback(() => {\n const newState = state === \"open\" ? \"closed\" : \"open\";\n setState(newState);\n onOpenChange?.(newState === \"open\");\n }, [state, onOpenChange]);\n\n return (\n <StyledAside\n data-state={state}\n data-embed-type=\"factbox\"\n {...rest}\n ref={ref}\n overflowHidden={overflowHidden}\n onTransitionStart={(e) => {\n if (e.target === e.currentTarget && state === \"closed\") {\n setOverflowHidden(true);\n }\n }}\n onTransitionEnd={(e) => {\n if (e.target === e.currentTarget && state === \"open\") {\n setOverflowHidden(false);\n }\n }}\n >\n <StyledButton\n data-state={state}\n onClick={onClick}\n contentEditable={false}\n aria-expanded={state === \"open\"}\n variant=\"secondary\"\n aria-controls={contentId}\n >\n {t(`factbox.${state === \"open\" ? \"showLess\" : \"showMore\"}`)}\n </StyledButton>\n <StyledContent id={contentId} data-state={state} aria-hidden={state === \"closed\"} {...inertAttribute}>\n {children}\n </StyledContent>\n </St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,QAAQ,aAAa,OAAO,GAAG,IAAI,CAAC;CACxF,GAAG,CAAC,KAAK,CAAC;CAEV,CAAA,GAAA,MAAA,iBAAgB;EACd,IAAI,SAAS,KAAA,GACX,SAAS,OAAO,SAAS,QAAQ;CAErC,GAAG,CAAC,IAAI,CAAC;CAET,MAAM,WAAA,GAAA,MAAA,mBAA4B;EAChC,MAAM,WAAW,UAAU,SAAS,WAAW;EAC/C,SAAS,QAAQ;EACjB,eAAe,aAAa,MAAM;CACpC,GAAG,CAAC,OAAO,YAAY,CAAC;CAExB,OACE,iBAAA,GAAA,kBAAA,MAAC,aAAD;EACE,cAAY;EACZ,mBAAgB;EAChB,GAAI;EACC;EACW;EAChB,oBAAoB,MAAM;GACxB,IAAI,EAAE,WAAW,EAAE,iBAAiB,UAAU,UAC5C,kBAAkB,IAAI;EAE1B;EACA,kBAAkB,MAAM;GACtB,IAAI,EAAE,WAAW,EAAE,iBAAiB,UAAU,QAC5C,kBAAkB,KAAK;EAE3B;YAfF,CAiBE,iBAAA,GAAA,kBAAA,KAAC,cAAD;GACE,cAAY;GACH;GACT,iBAAiB;GACjB,iBAAe,UAAU;GACzB,SAAQ;GACR,iBAAe;aAEd,EAAE,WAAW,UAAU,SAAS,aAAa,YAAY;EAC9C,CAAA,GACd,iBAAA,GAAA,kBAAA,KAAC,eAAD;GAAe,IAAI;GAAW,cAAY;GAAO,eAAa,UAAU;GAAU,GAAI;GACnF;EACY,CAAA,CACJ;;AAEjB,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"File.js","names":["SafeLink","DownloadLine","linkOverlay","Text","FileListItem"],"sources":["../../src/FileList/File.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 { DownloadLine } from \"@ndla/icons\";\nimport { Text } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { linkOverlay } from \"@ndla/styled-system/patterns\";\nimport { type ComponentPropsWithRef, forwardRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { FileListItem } from \"./FileList\";\n\nexport interface FileProps extends ComponentPropsWithRef<\"div\"> {\n title: string;\n url: string;\n fileExists: boolean;\n fileType: string;\n fileSize?: string;\n}\n\nexport interface FileType {\n title: string;\n formats: FileFormat[];\n fileExists?: boolean;\n}\n\nexport interface FileFormat {\n url: string;\n fileType: string;\n tooltip: string;\n}\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n textUnderlineOffset: \"2px\",\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n});\n\nconst FileContainer = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n position: \"relative\",\n paddingBlock: \"small\",\n paddingInlineEnd: \"medium\",\n paddingInlineStart: \"small\",\n width: \"100%\",\n },\n});\n\nconst InfoContainer = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"xxsmall\",\n alignItems: \"center\",\n },\n});\n\nexport const File = forwardRef<HTMLDivElement, FileProps>(\n ({ title, url, fileExists, fileType, fileSize, ...rest }, ref) => {\n const { t } = useTranslation();\n const filename = `${title}-${url.split(\"/\").pop() ?? \"\"}`;\n const downloadUrl = `${url}?download=true`;\n const tooltip = `${t(\"download\")} ${filename}`;\n\n return (\n <FileContainer ref={ref} {...rest}>\n <InfoContainer>\n <DownloadLine />\n {fileExists ? (\n <StyledSafeLink unstyled download={filename} css={linkOverlay.raw()} to={downloadUrl} title={tooltip}>\n {title}\n </StyledSafeLink>\n ) : (\n <Text textStyle=\"label.medium\">{title}</Text>\n )}\n <Text textStyle=\"label.large\" asChild consumeCss>\n <span>({fileType?.toUpperCase()})</span>\n </Text>\n </InfoContainer>\n <Text textStyle=\"label.large\" asChild consumeCss>\n <span>{fileSize}</span>\n </Text>\n </FileContainer>\n );\n },\n);\n\nexport const FileListElement = ({ title, url, fileExists, fileType, fileSize }: FileProps) => (\n <FileListItem>\n <File title={title} url={url} fileExists={fileExists} fileType={fileType} fileSize={fileSize} />\n </FileListItem>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqCA,MAAM,kBAAA,GAAA,wBAAA,QAAwBA,eAAAA,UAAU,EACtC,MAAM;CACJ,qBAAqB;CACrB,gBAAgB;CAChB,QAAQ,EACN,gBAAgB,QACjB;CACF,EACF,CAAC;AAEF,MAAM,iBAAA,GAAA,wBAAA,QAAuB,OAAO,EAClC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,UAAU;CACV,cAAc;CACd,kBAAkB;CAClB,oBAAoB;CACpB,OAAO;CACR,EACF,CAAC;AAEF,MAAM,iBAAA,GAAA,wBAAA,QAAuB,OAAO,EAClC,MAAM;CACJ,SAAS;CACT,KAAK;CACL,YAAY;CACb,EACF,CAAC;AAEF,MAAa,QAAA,GAAA,MAAA,aACV,EAAE,OAAO,KAAK,YAAY,UAAU,UAAU,GAAG,QAAQ,QAAQ;CAChE,MAAM,EAAE,OAAA,GAAA,cAAA,iBAAsB;CAC9B,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,MAAM,IAAI,CAAC,KAAK,IAAI;CACrD,MAAM,cAAc,GAAG,IAAI;CAC3B,MAAM,UAAU,GAAG,EAAE,WAAW,CAAC,GAAG;AAEpC,QACE,iBAAA,GAAA,kBAAA,MAAC,eAAD;EAAoB;EAAK,GAAI;YAA7B,CACE,iBAAA,GAAA,kBAAA,MAAC,eAAD,EAAA,UAAA;GACE,iBAAA,GAAA,kBAAA,KAACC,YAAAA,cAAD,EAAgB,CAAA;GACf,aACC,iBAAA,GAAA,kBAAA,KAAC,gBAAD;IAAgB,UAAA;IAAS,UAAU;IAAU,KAAKC,6BAAAA,YAAY,KAAK;IAAE,IAAI;IAAa,OAAO;cAC1F;IACc,CAAA,GAEjB,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,MAAD;IAAM,WAAU;cAAgB;IAAa,CAAA;GAE/C,iBAAA,GAAA,kBAAA,KAACA,iBAAAA,MAAD;IAAM,WAAU;IAAc,SAAA;IAAQ,YAAA;cACpC,iBAAA,GAAA,kBAAA,MAAC,QAAD,EAAA,UAAA;KAAM;KAAE,UAAU,aAAa;KAAC;KAAQ,EAAA,CAAA;IACnC,CAAA;GACO,EAAA,CAAA,EAChB,iBAAA,GAAA,kBAAA,KAACA,iBAAAA,MAAD;GAAM,WAAU;GAAc,SAAA;GAAQ,YAAA;aACpC,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAA,UAAO,UAAgB,CAAA;GAClB,CAAA,CACO;;EAGrB;AAED,MAAa,mBAAmB,EAAE,OAAO,KAAK,YAAY,UAAU,eAClE,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,cAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,MAAD;CAAa;CAAY;CAAiB;CAAsB;CAAoB;CAAY,CAAA,EACnF,CAAA"}
1
+ {"version":3,"file":"File.js","names":["SafeLink","DownloadLine","linkOverlay","Text","FileListItem"],"sources":["../../src/FileList/File.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 { DownloadLine } from \"@ndla/icons\";\nimport { Text } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { linkOverlay } from \"@ndla/styled-system/patterns\";\nimport { type ComponentPropsWithRef, forwardRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { FileListItem } from \"./FileList\";\n\nexport interface FileProps extends ComponentPropsWithRef<\"div\"> {\n title: string;\n url: string;\n fileExists: boolean;\n fileType: string;\n fileSize?: string;\n}\n\nexport interface FileType {\n title: string;\n formats: FileFormat[];\n fileExists?: boolean;\n}\n\nexport interface FileFormat {\n url: string;\n fileType: string;\n tooltip: string;\n}\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n textUnderlineOffset: \"2px\",\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n});\n\nconst FileContainer = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n position: \"relative\",\n paddingBlock: \"small\",\n paddingInlineEnd: \"medium\",\n paddingInlineStart: \"small\",\n width: \"100%\",\n },\n});\n\nconst InfoContainer = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"xxsmall\",\n alignItems: \"center\",\n },\n});\n\nexport const File = forwardRef<HTMLDivElement, FileProps>(\n ({ title, url, fileExists, fileType, fileSize, ...rest }, ref) => {\n const { t } = useTranslation();\n const filename = `${title}-${url.split(\"/\").pop() ?? \"\"}`;\n const downloadUrl = `${url}?download=true`;\n const tooltip = `${t(\"download\")} ${filename}`;\n\n return (\n <FileContainer ref={ref} {...rest}>\n <InfoContainer>\n <DownloadLine />\n {fileExists ? (\n <StyledSafeLink unstyled download={filename} css={linkOverlay.raw()} to={downloadUrl} title={tooltip}>\n {title}\n </StyledSafeLink>\n ) : (\n <Text textStyle=\"label.medium\">{title}</Text>\n )}\n <Text textStyle=\"label.large\" asChild consumeCss>\n <span>({fileType?.toUpperCase()})</span>\n </Text>\n </InfoContainer>\n <Text textStyle=\"label.large\" asChild consumeCss>\n <span>{fileSize}</span>\n </Text>\n </FileContainer>\n );\n },\n);\n\nexport const FileListElement = ({ title, url, fileExists, fileType, fileSize }: FileProps) => (\n <FileListItem>\n <File title={title} url={url} fileExists={fileExists} fileType={fileType} fileSize={fileSize} />\n </FileListItem>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqCA,MAAM,kBAAA,GAAA,wBAAA,QAAwBA,eAAAA,UAAU,EACtC,MAAM;CACJ,qBAAqB;CACrB,gBAAgB;CAChB,QAAQ,EACN,gBAAgB,OAClB;AACF,EACF,CAAC;AAED,MAAM,iBAAA,GAAA,wBAAA,QAAuB,OAAO,EAClC,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BAAA,KAAC,QAAD,EAAA,UAAO,SAAe,CAAA;EAClB,CAAA,CACO;;AAEnB,CACF;AAEA,MAAa,mBAAmB,EAAE,OAAO,KAAK,YAAY,UAAU,eAClE,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,cAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,MAAD;CAAa;CAAY;CAAiB;CAAsB;CAAoB;AAAW,CAAA,EACnF,CAAA"}
@@ -8,7 +8,7 @@
8
8
  import { type ComponentPropsWithoutRef } from "react";
9
9
  interface Props extends ComponentPropsWithoutRef<"ul"> {
10
10
  }
11
- export declare const FileListWrapper: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLUListElement> & import("react").HTMLAttributes<HTMLUListElement> & import("@ark-ui/react").PolymorphicProps>, {}>;
12
- export declare const FileListItem: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLLIElement> & import("react").LiHTMLAttributes<HTMLLIElement> & import("@ark-ui/react").PolymorphicProps>, {}>;
11
+ export declare const FileListWrapper: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLUListElement> & import("react").HTMLAttributes<HTMLUListElement> & import("@ark-ui/react/factory").PolymorphicProps>, {}>;
12
+ export declare const FileListItem: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLLIElement> & import("react").LiHTMLAttributes<HTMLLIElement> & import("@ark-ui/react/factory").PolymorphicProps>, {}>;
13
13
  export declare const FileListEmbed: ({ children, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
14
14
  export {};
@@ -2,7 +2,7 @@ require("../_virtual/_rolldown/runtime.js");
2
2
  let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
3
3
  require("react");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
- let _ark_ui_react = require("@ark-ui/react");
5
+ let _ark_ui_react_factory = require("@ark-ui/react/factory");
6
6
  //#region src/FileList/FileList.tsx
7
7
  /**
8
8
  * Copyright (c) 2023-present, NDLA.
@@ -11,13 +11,13 @@ let _ark_ui_react = require("@ark-ui/react");
11
11
  * LICENSE file in the root directory of this source tree.
12
12
  *
13
13
  */
14
- const FileListWrapper = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.ul, { base: {
14
+ const FileListWrapper = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.ul, { base: {
15
15
  display: "flex",
16
16
  flexDirection: "column",
17
17
  gap: "xsmall",
18
18
  clear: "both"
19
19
  } }, { baseComponent: true });
20
- const FileListItem = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react.ark.li, { base: {
20
+ const FileListItem = (0, _ndla_styled_system_jsx.styled)(_ark_ui_react_factory.ark.li, { base: {
21
21
  listStyle: "none",
22
22
  background: "surface.infoSubtle",
23
23
  borderBlockEnd: "1px solid",
@@ -1 +1 @@
1
- {"version":3,"file":"FileList.js","names":["ark"],"sources":["../../src/FileList/FileList.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 { ark } from \"@ark-ui/react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { type ComponentPropsWithoutRef } from \"react\";\n\ninterface Props extends ComponentPropsWithoutRef<\"ul\"> {}\n\nexport const FileListWrapper = styled(\n ark.ul,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n clear: \"both\",\n },\n },\n { baseComponent: true },\n);\n\nexport const FileListItem = styled(\n ark.li,\n {\n base: {\n listStyle: \"none\",\n background: \"surface.infoSubtle\",\n borderBlockEnd: \"1px solid\",\n borderColor: \"stroke.default\",\n display: \"flex\",\n justifyContent: \"space-between\",\n\n _hover: {\n backgroundColor: \"surface.infoSubtle.hover\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const FileListEmbed = ({ children, ...rest }: Props) => {\n return (\n <FileListWrapper {...rest} data-embed-type=\"file-list\">\n {children}\n </FileListWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,mBAAA,GAAA,wBAAA,QACXA,cAAAA,IAAI,IACJ,EACE,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,OAAO;CACR,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAED,MAAa,gBAAA,GAAA,wBAAA,QACXA,cAAAA,IAAI,IACJ,EACE,MAAM;CACJ,WAAW;CACX,YAAY;CACZ,gBAAgB;CAChB,aAAa;CACb,SAAS;CACT,gBAAgB;CAEhB,QAAQ,EACN,iBAAiB,4BAClB;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAED,MAAa,iBAAiB,EAAE,UAAU,GAAG,WAAkB;AAC7D,QACE,iBAAA,GAAA,kBAAA,KAAC,iBAAD;EAAiB,GAAI;EAAM,mBAAgB;EACxC;EACe,CAAA"}
1
+ {"version":3,"file":"FileList.js","names":["ark"],"sources":["../../src/FileList/FileList.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 { ark } from \"@ark-ui/react/factory\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { type ComponentPropsWithoutRef } from \"react\";\n\ninterface Props extends ComponentPropsWithoutRef<\"ul\"> {}\n\nexport const FileListWrapper = styled(\n ark.ul,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n clear: \"both\",\n },\n },\n { baseComponent: true },\n);\n\nexport const FileListItem = styled(\n ark.li,\n {\n base: {\n listStyle: \"none\",\n background: \"surface.infoSubtle\",\n borderBlockEnd: \"1px solid\",\n borderColor: \"stroke.default\",\n display: \"flex\",\n justifyContent: \"space-between\",\n\n _hover: {\n backgroundColor: \"surface.infoSubtle.hover\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const FileListEmbed = ({ children, ...rest }: Props) => {\n return (\n <FileListWrapper {...rest} data-embed-type=\"file-list\">\n {children}\n </FileListWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,mBAAA,GAAA,wBAAA,QACXA,sBAAAA,IAAI,IACJ,EACE,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,OAAO;AACT,EACF,GACA,EAAE,eAAe,KAAK,CACxB;AAEA,MAAa,gBAAA,GAAA,wBAAA,QACXA,sBAAAA,IAAI,IACJ,EACE,MAAM;CACJ,WAAW;CACX,YAAY;CACZ,gBAAgB;CAChB,aAAa;CACb,SAAS;CACT,gBAAgB;CAEhB,QAAQ,EACN,iBAAiB,2BACnB;AACF,EACF,GACA,EAAE,eAAe,KAAK,CACxB;AAEA,MAAa,iBAAiB,EAAE,UAAU,GAAG,WAAkB;CAC7D,OACE,iBAAA,GAAA,kBAAA,KAAC,iBAAD;EAAiB,GAAI;EAAM,mBAAgB;EACxC;CACc,CAAA;AAErB"}