@ndla/ui 56.0.122-alpha.0 → 56.0.124-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 (314) hide show
  1. package/README.md +1 -1
  2. package/es/Article/Article.js +127 -0
  3. package/es/Article/Article.js.map +1 -0
  4. package/es/Article/ArticleByline.js +133 -0
  5. package/es/Article/ArticleByline.js.map +1 -0
  6. package/es/Article/ArticleFootNotes.js +40 -0
  7. package/es/Article/ArticleFootNotes.js.map +1 -0
  8. package/es/AudioPlayer/AudioPlayer.js +157 -0
  9. package/es/AudioPlayer/AudioPlayer.js.map +1 -0
  10. package/es/AudioPlayer/Controls.js +254 -0
  11. package/es/AudioPlayer/Controls.js.map +1 -0
  12. package/es/AudioPlayer/SpeechControl.js +40 -0
  13. package/es/AudioPlayer/SpeechControl.js.map +1 -0
  14. package/es/AudioPlayer/index.js +8 -0
  15. package/es/AudioPlayer/index.js.map +1 -0
  16. package/es/Breadcrumb/Breadcrumb.js +44 -0
  17. package/es/Breadcrumb/Breadcrumb.js.map +1 -0
  18. package/es/Breadcrumb/BreadcrumbItem.js +36 -0
  19. package/es/Breadcrumb/BreadcrumbItem.js.map +1 -0
  20. package/es/Breadcrumb/HomeBreadcrumb.js +44 -0
  21. package/es/Breadcrumb/HomeBreadcrumb.js.map +1 -0
  22. package/es/Breadcrumb/index.js +9 -0
  23. package/es/Breadcrumb/index.js.map +1 -0
  24. package/es/CampaignBlock/CampaignBlock.js +131 -0
  25. package/es/CampaignBlock/CampaignBlock.js.map +1 -0
  26. package/es/CodeBlock/CodeBlock.js +25 -0
  27. package/es/CodeBlock/CodeBlock.js.map +1 -0
  28. package/es/CodeBlock/codeLanguageOptions.js +114 -0
  29. package/es/CodeBlock/codeLanguageOptions.js.map +1 -0
  30. package/es/Concept/Concept.js +50 -0
  31. package/es/Concept/Concept.js.map +1 -0
  32. package/es/ContactBlock/ContactBlock.js +145 -0
  33. package/es/ContactBlock/ContactBlock.js.map +1 -0
  34. package/es/ContentTypeBadge/ContentTypeBadge.js +41 -0
  35. package/es/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
  36. package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +25 -0
  37. package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
  38. package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +25 -0
  39. package/es/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
  40. package/es/ContentTypeHero/ContentTypeHero.js +39 -0
  41. package/es/ContentTypeHero/ContentTypeHero.js.map +1 -0
  42. package/es/CopyParagraphButton/CopyParagraphButton.js +62 -0
  43. package/es/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
  44. package/es/CopyParagraphButton/index.js +8 -0
  45. package/es/CopyParagraphButton/index.js.map +1 -0
  46. package/es/Embed/AudioEmbed.js +52 -0
  47. package/es/Embed/AudioEmbed.js.map +1 -0
  48. package/es/Embed/BrightcoveEmbed.js +96 -0
  49. package/es/Embed/BrightcoveEmbed.js.map +1 -0
  50. package/es/Embed/CodeEmbed.js +61 -0
  51. package/es/Embed/CodeEmbed.js.map +1 -0
  52. package/es/Embed/ConceptEmbed.js +78 -0
  53. package/es/Embed/ConceptEmbed.js.map +1 -0
  54. package/es/Embed/ConceptInlineTriggerButton.js +40 -0
  55. package/es/Embed/ConceptInlineTriggerButton.js.map +1 -0
  56. package/es/Embed/ContentLinkEmbed.js +31 -0
  57. package/es/Embed/ContentLinkEmbed.js.map +1 -0
  58. package/es/Embed/CopyrightEmbed.js +23 -0
  59. package/es/Embed/CopyrightEmbed.js.map +1 -0
  60. package/es/Embed/EmbedErrorPlaceholder.js +43 -0
  61. package/es/Embed/EmbedErrorPlaceholder.js.map +1 -0
  62. package/es/Embed/EmbedWrapper.js +26 -0
  63. package/es/Embed/EmbedWrapper.js.map +1 -0
  64. package/es/Embed/ExternalEmbed.js +54 -0
  65. package/es/Embed/ExternalEmbed.js.map +1 -0
  66. package/es/Embed/FootnoteEmbed.js +27 -0
  67. package/es/Embed/FootnoteEmbed.js.map +1 -0
  68. package/es/Embed/GlossEmbed.js +52 -0
  69. package/es/Embed/GlossEmbed.js.map +1 -0
  70. package/es/Embed/H5pEmbed.js +38 -0
  71. package/es/Embed/H5pEmbed.js.map +1 -0
  72. package/es/Embed/IframeEmbed.js +69 -0
  73. package/es/Embed/IframeEmbed.js.map +1 -0
  74. package/es/Embed/ImageEmbed.js +180 -0
  75. package/es/Embed/ImageEmbed.js.map +1 -0
  76. package/es/Embed/InlineTriggerButton.js +25 -0
  77. package/es/Embed/InlineTriggerButton.js.map +1 -0
  78. package/es/Embed/RelatedContentEmbed.js +38 -0
  79. package/es/Embed/RelatedContentEmbed.js.map +1 -0
  80. package/es/Embed/UnknownEmbed.js +20 -0
  81. package/es/Embed/UnknownEmbed.js.map +1 -0
  82. package/es/Embed/UuDisclaimerEmbed.js +54 -0
  83. package/es/Embed/UuDisclaimerEmbed.js.map +1 -0
  84. package/es/ErrorMessage/ErrorMessage.js +54 -0
  85. package/es/ErrorMessage/ErrorMessage.js.map +1 -0
  86. package/es/ErrorMessage/index.js +8 -0
  87. package/es/ErrorMessage/index.js.map +1 -0
  88. package/es/FactBox/FactBox.js +121 -0
  89. package/es/FactBox/FactBox.js.map +1 -0
  90. package/es/FactBox/index.js +8 -0
  91. package/es/FactBox/index.js.map +1 -0
  92. package/es/FileList/File.js +76 -0
  93. package/es/FileList/File.js.map +1 -0
  94. package/es/FileList/FileList.js +32 -0
  95. package/es/FileList/FileList.js.map +1 -0
  96. package/es/FileList/PdfFile.js +28 -0
  97. package/es/FileList/PdfFile.js.map +1 -0
  98. package/es/Gloss/Gloss.js +142 -0
  99. package/es/Gloss/Gloss.js.map +1 -0
  100. package/es/Gloss/GlossExample.js +46 -0
  101. package/es/Gloss/GlossExample.js.map +1 -0
  102. package/es/Grid/Grid.js +66 -0
  103. package/es/Grid/Grid.js.map +1 -0
  104. package/es/Grid/GridParallaxItem.js +21 -0
  105. package/es/Grid/GridParallaxItem.js.map +1 -0
  106. package/es/KeyFigure/KeyFigure.js +46 -0
  107. package/es/KeyFigure/KeyFigure.js.map +1 -0
  108. package/es/LicenseByline/EmbedByline.js +132 -0
  109. package/es/LicenseByline/EmbedByline.js.map +1 -0
  110. package/es/LicenseByline/LicenseLink.js +31 -0
  111. package/es/LicenseByline/LicenseLink.js.map +1 -0
  112. package/es/LinkBlock/LinkBlock.js +74 -0
  113. package/es/LinkBlock/LinkBlock.js.map +1 -0
  114. package/es/LinkBlock/LinkBlockSection.js +23 -0
  115. package/es/LinkBlock/LinkBlockSection.js.map +1 -0
  116. package/es/Pitch/Pitch.js +62 -0
  117. package/es/Pitch/Pitch.js.map +1 -0
  118. package/es/RelatedArticleList/RelatedArticleList.js +97 -0
  119. package/es/RelatedArticleList/RelatedArticleList.js.map +1 -0
  120. package/es/RelatedArticleList/index.js +8 -0
  121. package/es/RelatedArticleList/index.js.map +1 -0
  122. package/es/ResourceBox/ResourceBox.js +74 -0
  123. package/es/ResourceBox/ResourceBox.js.map +1 -0
  124. package/es/TagSelector/TagSelector.js +100 -0
  125. package/es/TagSelector/TagSelector.js.map +1 -0
  126. package/es/ZendeskButton/ZendeskButton.js +41 -0
  127. package/es/ZendeskButton/ZendeskButton.js.map +1 -0
  128. package/es/_virtual/rolldown_runtime.js +11 -0
  129. package/es/i18n/formatNestedMessages.js +17 -0
  130. package/es/i18n/formatNestedMessages.js.map +1 -0
  131. package/es/i18n/i18n.js +29 -0
  132. package/es/i18n/i18n.js.map +1 -0
  133. package/es/i18n/useComponentTranslations.js +155 -0
  134. package/es/i18n/useComponentTranslations.js.map +1 -0
  135. package/es/index.js +65 -0
  136. package/es/locale/messages-en.js +438 -0
  137. package/es/locale/messages-en.js.map +1 -0
  138. package/es/locale/messages-nb.js +438 -0
  139. package/es/locale/messages-nb.js.map +1 -0
  140. package/es/locale/messages-nn.js +438 -0
  141. package/es/locale/messages-nn.js.map +1 -0
  142. package/es/locale/messages-se.js +438 -0
  143. package/es/locale/messages-se.js.map +1 -0
  144. package/es/model/ContentType.js +72 -0
  145. package/es/model/ContentType.js.map +1 -0
  146. package/es/model/SubjectCategories.js +25 -0
  147. package/es/model/SubjectCategories.js.map +1 -0
  148. package/es/model/SubjectTypes.js +23 -0
  149. package/es/model/SubjectTypes.js.map +1 -0
  150. package/es/model/WordClass.js +53 -0
  151. package/es/model/WordClass.js.map +1 -0
  152. package/es/model/index.js +19 -0
  153. package/es/model/index.js.map +1 -0
  154. package/es/utils/licenseAttributes.js +16 -0
  155. package/es/utils/licenseAttributes.js.map +1 -0
  156. package/es/utils/relativeUrl.js +26 -0
  157. package/es/utils/relativeUrl.js.map +1 -0
  158. package/lib/Article/Article.js +134 -0
  159. package/lib/Article/Article.js.map +1 -0
  160. package/lib/Article/ArticleByline.js +135 -0
  161. package/lib/Article/ArticleByline.js.map +1 -0
  162. package/lib/Article/ArticleFootNotes.js +41 -0
  163. package/lib/Article/ArticleFootNotes.js.map +1 -0
  164. package/lib/AudioPlayer/AudioPlayer.js +158 -0
  165. package/lib/AudioPlayer/AudioPlayer.js.map +1 -0
  166. package/lib/AudioPlayer/Controls.js +255 -0
  167. package/lib/AudioPlayer/Controls.js.map +1 -0
  168. package/lib/AudioPlayer/SpeechControl.js +41 -0
  169. package/lib/AudioPlayer/SpeechControl.js.map +1 -0
  170. package/lib/AudioPlayer/index.js +8 -0
  171. package/lib/AudioPlayer/index.js.map +1 -0
  172. package/lib/Breadcrumb/Breadcrumb.js +45 -0
  173. package/lib/Breadcrumb/Breadcrumb.js.map +1 -0
  174. package/lib/Breadcrumb/BreadcrumbItem.js +37 -0
  175. package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -0
  176. package/lib/Breadcrumb/HomeBreadcrumb.js +45 -0
  177. package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -0
  178. package/lib/Breadcrumb/index.js +9 -0
  179. package/lib/Breadcrumb/index.js.map +1 -0
  180. package/lib/CampaignBlock/CampaignBlock.js +132 -0
  181. package/lib/CampaignBlock/CampaignBlock.js.map +1 -0
  182. package/lib/CodeBlock/CodeBlock.js +26 -0
  183. package/lib/CodeBlock/CodeBlock.js.map +1 -0
  184. package/lib/CodeBlock/codeLanguageOptions.js +115 -0
  185. package/lib/CodeBlock/codeLanguageOptions.js.map +1 -0
  186. package/lib/Concept/Concept.js +51 -0
  187. package/lib/Concept/Concept.js.map +1 -0
  188. package/lib/ContactBlock/ContactBlock.js +147 -0
  189. package/lib/ContactBlock/ContactBlock.js.map +1 -0
  190. package/lib/ContentTypeBadge/ContentTypeBadge.js +43 -0
  191. package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
  192. package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +26 -0
  193. package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
  194. package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +26 -0
  195. package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
  196. package/lib/ContentTypeHero/ContentTypeHero.js +40 -0
  197. package/lib/ContentTypeHero/ContentTypeHero.js.map +1 -0
  198. package/lib/CopyParagraphButton/CopyParagraphButton.js +63 -0
  199. package/lib/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
  200. package/lib/CopyParagraphButton/index.js +8 -0
  201. package/lib/CopyParagraphButton/index.js.map +1 -0
  202. package/lib/Embed/AudioEmbed.js +53 -0
  203. package/lib/Embed/AudioEmbed.js.map +1 -0
  204. package/lib/Embed/BrightcoveEmbed.js +97 -0
  205. package/lib/Embed/BrightcoveEmbed.js.map +1 -0
  206. package/lib/Embed/CodeEmbed.js +62 -0
  207. package/lib/Embed/CodeEmbed.js.map +1 -0
  208. package/lib/Embed/ConceptEmbed.js +81 -0
  209. package/lib/Embed/ConceptEmbed.js.map +1 -0
  210. package/lib/Embed/ConceptInlineTriggerButton.js +41 -0
  211. package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -0
  212. package/lib/Embed/ContentLinkEmbed.js +32 -0
  213. package/lib/Embed/ContentLinkEmbed.js.map +1 -0
  214. package/lib/Embed/CopyrightEmbed.js +24 -0
  215. package/lib/Embed/CopyrightEmbed.js.map +1 -0
  216. package/lib/Embed/EmbedErrorPlaceholder.js +44 -0
  217. package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -0
  218. package/lib/Embed/EmbedWrapper.js +27 -0
  219. package/lib/Embed/EmbedWrapper.js.map +1 -0
  220. package/lib/Embed/ExternalEmbed.js +55 -0
  221. package/lib/Embed/ExternalEmbed.js.map +1 -0
  222. package/lib/Embed/FootnoteEmbed.js +28 -0
  223. package/lib/Embed/FootnoteEmbed.js.map +1 -0
  224. package/lib/Embed/GlossEmbed.js +53 -0
  225. package/lib/Embed/GlossEmbed.js.map +1 -0
  226. package/lib/Embed/H5pEmbed.js +39 -0
  227. package/lib/Embed/H5pEmbed.js.map +1 -0
  228. package/lib/Embed/IframeEmbed.js +70 -0
  229. package/lib/Embed/IframeEmbed.js.map +1 -0
  230. package/lib/Embed/ImageEmbed.js +183 -0
  231. package/lib/Embed/ImageEmbed.js.map +1 -0
  232. package/lib/Embed/InlineTriggerButton.js +26 -0
  233. package/lib/Embed/InlineTriggerButton.js.map +1 -0
  234. package/lib/Embed/RelatedContentEmbed.js +39 -0
  235. package/lib/Embed/RelatedContentEmbed.js.map +1 -0
  236. package/lib/Embed/UnknownEmbed.js +21 -0
  237. package/lib/Embed/UnknownEmbed.js.map +1 -0
  238. package/lib/Embed/UuDisclaimerEmbed.js +55 -0
  239. package/lib/Embed/UuDisclaimerEmbed.js.map +1 -0
  240. package/lib/ErrorMessage/ErrorMessage.js +55 -0
  241. package/lib/ErrorMessage/ErrorMessage.js.map +1 -0
  242. package/lib/ErrorMessage/index.js +8 -0
  243. package/lib/ErrorMessage/index.js.map +1 -0
  244. package/lib/FactBox/FactBox.js +122 -0
  245. package/lib/FactBox/FactBox.js.map +1 -0
  246. package/lib/FactBox/index.js +8 -0
  247. package/lib/FactBox/index.js.map +1 -0
  248. package/lib/FileList/File.js +78 -0
  249. package/lib/FileList/File.js.map +1 -0
  250. package/lib/FileList/FileList.js +35 -0
  251. package/lib/FileList/FileList.js.map +1 -0
  252. package/lib/FileList/PdfFile.js +29 -0
  253. package/lib/FileList/PdfFile.js.map +1 -0
  254. package/lib/Gloss/Gloss.js +143 -0
  255. package/lib/Gloss/Gloss.js.map +1 -0
  256. package/lib/Gloss/GlossExample.js +47 -0
  257. package/lib/Gloss/GlossExample.js.map +1 -0
  258. package/lib/Grid/Grid.js +67 -0
  259. package/lib/Grid/Grid.js.map +1 -0
  260. package/lib/Grid/GridParallaxItem.js +22 -0
  261. package/lib/Grid/GridParallaxItem.js.map +1 -0
  262. package/lib/KeyFigure/KeyFigure.js +47 -0
  263. package/lib/KeyFigure/KeyFigure.js.map +1 -0
  264. package/lib/LicenseByline/EmbedByline.js +134 -0
  265. package/lib/LicenseByline/EmbedByline.js.map +1 -0
  266. package/lib/LicenseByline/LicenseLink.js +32 -0
  267. package/lib/LicenseByline/LicenseLink.js.map +1 -0
  268. package/lib/LinkBlock/LinkBlock.js +75 -0
  269. package/lib/LinkBlock/LinkBlock.js.map +1 -0
  270. package/lib/LinkBlock/LinkBlockSection.js +24 -0
  271. package/lib/LinkBlock/LinkBlockSection.js.map +1 -0
  272. package/lib/Pitch/Pitch.js +63 -0
  273. package/lib/Pitch/Pitch.js.map +1 -0
  274. package/lib/RelatedArticleList/RelatedArticleList.js +99 -0
  275. package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -0
  276. package/lib/RelatedArticleList/index.js +8 -0
  277. package/lib/RelatedArticleList/index.js.map +1 -0
  278. package/lib/ResourceBox/ResourceBox.js +75 -0
  279. package/lib/ResourceBox/ResourceBox.js.map +1 -0
  280. package/lib/TagSelector/TagSelector.js +108 -0
  281. package/lib/TagSelector/TagSelector.js.map +1 -0
  282. package/lib/ZendeskButton/ZendeskButton.js +42 -0
  283. package/lib/ZendeskButton/ZendeskButton.js.map +1 -0
  284. package/lib/_virtual/rolldown_runtime.js +42 -0
  285. package/lib/i18n/formatNestedMessages.js +18 -0
  286. package/lib/i18n/formatNestedMessages.js.map +1 -0
  287. package/lib/i18n/i18n.js +31 -0
  288. package/lib/i18n/i18n.js.map +1 -0
  289. package/lib/i18n/useComponentTranslations.js +163 -0
  290. package/lib/i18n/useComponentTranslations.js.map +1 -0
  291. package/lib/index.js +157 -0
  292. package/lib/locale/messages-en.js +439 -0
  293. package/lib/locale/messages-en.js.map +1 -0
  294. package/lib/locale/messages-nb.js +439 -0
  295. package/lib/locale/messages-nb.js.map +1 -0
  296. package/lib/locale/messages-nn.js +439 -0
  297. package/lib/locale/messages-nn.js.map +1 -0
  298. package/lib/locale/messages-se.js +439 -0
  299. package/lib/locale/messages-se.js.map +1 -0
  300. package/lib/model/ContentType.js +94 -0
  301. package/lib/model/ContentType.js.map +1 -0
  302. package/lib/model/SubjectCategories.js +30 -0
  303. package/lib/model/SubjectCategories.js.map +1 -0
  304. package/lib/model/SubjectTypes.js +28 -0
  305. package/lib/model/SubjectTypes.js.map +1 -0
  306. package/lib/model/WordClass.js +58 -0
  307. package/lib/model/WordClass.js.map +1 -0
  308. package/lib/model/index.js +19 -0
  309. package/lib/model/index.js.map +1 -0
  310. package/lib/utils/licenseAttributes.js +17 -0
  311. package/lib/utils/licenseAttributes.js.map +1 -0
  312. package/lib/utils/relativeUrl.js +26 -0
  313. package/lib/utils/relativeUrl.js.map +1 -0
  314. package/package.json +12 -11
@@ -0,0 +1,54 @@
1
+ import "react";
2
+ import { Text } from "@ndla/primitives";
3
+ import { styled } from "@ndla/styled-system/jsx";
4
+ import { SafeLink } from "@ndla/safelink";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+
7
+ //#region src/ErrorMessage/ErrorMessage.tsx
8
+ const StyledErrorMessage = styled("article", { base: {
9
+ textAlign: "center",
10
+ "& a": { color: "text.strong" },
11
+ "& h1": { marginTop: "0" }
12
+ } });
13
+ const IllustrationWrapper = styled("div", { base: {
14
+ display: "flex",
15
+ justifyContent: "center",
16
+ marginBottom: "medium",
17
+ tablet: { marginTop: "xxlarge" }
18
+ } });
19
+ const Description = styled(Text, { base: {
20
+ marginBottom: "medium",
21
+ tablet: { marginBottom: "xxlarge" }
22
+ } });
23
+ const CustomElementWrapper = styled("div", { base: { marginBlock: "xxlarge" } });
24
+ const MessageWrapper = styled("div", { base: { marginTop: "3xsmall" } });
25
+ const ErrorMessage = ({ children, messages, illustration, illustrationElement, customElement }) => /* @__PURE__ */ jsxs(StyledErrorMessage, { children: [
26
+ !!illustration && /* @__PURE__ */ jsx(IllustrationWrapper, { children: /* @__PURE__ */ jsx("img", {
27
+ src: illustration.url,
28
+ alt: illustration.altText
29
+ }) }),
30
+ !!illustrationElement && /* @__PURE__ */ jsx(IllustrationWrapper, { children: illustrationElement }),
31
+ /* @__PURE__ */ jsx("h1", { children: messages.title }),
32
+ !!messages.description && /* @__PURE__ */ jsx(Description, { children: messages.description }),
33
+ !!customElement && /* @__PURE__ */ jsx(CustomElementWrapper, { children: customElement }),
34
+ !!messages.linksTitle && /* @__PURE__ */ jsx("h2", { children: messages.linksTitle }),
35
+ !!messages.back && /* @__PURE__ */ jsx(SafeLink, {
36
+ to: `/#${encodeURI(messages.back)}`,
37
+ onClick: () => window.history.back(),
38
+ children: messages.back
39
+ }),
40
+ !!messages.goToFrontPage && /* @__PURE__ */ jsx(MessageWrapper, { children: /* @__PURE__ */ jsx(SafeLink, {
41
+ to: "/",
42
+ children: messages.goToFrontPage
43
+ }) }),
44
+ !!messages.logInFailed && /* @__PURE__ */ jsx(MessageWrapper, { children: /* @__PURE__ */ jsx(SafeLink, {
45
+ to: "/minndla",
46
+ children: messages.logInFailed
47
+ }) }),
48
+ children
49
+ ] });
50
+ var ErrorMessage_default = ErrorMessage;
51
+
52
+ //#endregion
53
+ export { ErrorMessage_default };
54
+ //# sourceMappingURL=ErrorMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorMessage.js","names":[],"sources":["../../src/ErrorMessage/ErrorMessage.tsx"],"sourcesContent":["/**\n * Copyright (c) 2019-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ReactNode } from \"react\";\nimport { Text } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\n// TODO: This has not been redesignet yet. This is just a rewrite of the previous design in panda\n\nconst StyledErrorMessage = styled(\"article\", {\n base: {\n textAlign: \"center\",\n \"& a\": {\n color: \"text.strong\",\n },\n \"& h1\": {\n marginTop: \"0\",\n },\n },\n});\n\nconst IllustrationWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n justifyContent: \"center\",\n marginBottom: \"medium\",\n tablet: {\n marginTop: \"xxlarge\",\n },\n },\n});\n\nconst Description = styled(Text, {\n base: {\n marginBottom: \"medium\",\n tablet: {\n marginBottom: \"xxlarge\",\n },\n },\n});\n\nconst CustomElementWrapper = styled(\"div\", {\n base: {\n marginBlock: \"xxlarge\",\n },\n});\n\nconst MessageWrapper = styled(\"div\", {\n base: {\n marginTop: \"3xsmall\",\n },\n});\n\ninterface Props {\n messages: {\n title: string;\n description?: string;\n linksTitle?: string;\n back?: string;\n goToFrontPage?: string;\n logInFailed?: string;\n };\n illustration?: {\n url: string;\n altText: string;\n };\n illustrationElement?: ReactNode;\n customElement?: ReactNode;\n children?: ReactNode;\n}\nexport const ErrorMessage = ({ children, messages, illustration, illustrationElement, customElement }: Props) => (\n <StyledErrorMessage>\n {!!illustration && (\n <IllustrationWrapper>\n <img src={illustration.url} alt={illustration.altText} />\n </IllustrationWrapper>\n )}\n {!!illustrationElement && <IllustrationWrapper>{illustrationElement}</IllustrationWrapper>}\n <h1>{messages.title}</h1>\n {!!messages.description && <Description>{messages.description}</Description>}\n {!!customElement && <CustomElementWrapper>{customElement}</CustomElementWrapper>}\n {!!messages.linksTitle && <h2>{messages.linksTitle}</h2>}\n {!!messages.back && (\n <SafeLink to={`/#${encodeURI(messages.back)}`} onClick={() => window.history.back()}>\n {messages.back}\n </SafeLink>\n )}\n {!!messages.goToFrontPage && (\n <MessageWrapper>\n <SafeLink to=\"/\">{messages.goToFrontPage}</SafeLink>\n </MessageWrapper>\n )}\n {!!messages.logInFailed && (\n <MessageWrapper>\n <SafeLink to=\"/minndla\">{messages.logInFailed}</SafeLink>\n </MessageWrapper>\n )}\n {children}\n </StyledErrorMessage>\n);\n\nexport default ErrorMessage;\n"],"mappings":";;;;;;;AAeA,MAAM,qBAAqB,OAAO,WAAW,EAC3C,MAAM;CACJ,WAAW;CACX,OAAO,EACL,OAAO,cACR;CACD,QAAQ,EACN,WAAW,IACZ;AACF,EACF,EAAC;AAEF,MAAM,sBAAsB,OAAO,OAAO,EACxC,MAAM;CACJ,SAAS;CACT,gBAAgB;CAChB,cAAc;CACd,QAAQ,EACN,WAAW,UACZ;AACF,EACF,EAAC;AAEF,MAAM,cAAc,OAAO,MAAM,EAC/B,MAAM;CACJ,cAAc;CACd,QAAQ,EACN,cAAc,UACf;AACF,EACF,EAAC;AAEF,MAAM,uBAAuB,OAAO,OAAO,EACzC,MAAM,EACJ,aAAa,UACd,EACF,EAAC;AAEF,MAAM,iBAAiB,OAAO,OAAO,EACnC,MAAM,EACJ,WAAW,UACZ,EACF,EAAC;AAmBF,MAAa,eAAe,CAAC,EAAE,UAAU,UAAU,cAAc,qBAAqB,eAAsB,qBAC1G,KAAC;GACI,gCACD,IAAC,iDACC,IAAC;EAAI,KAAK,aAAa;EAAK,KAAK,aAAa;GAAW,GACrC;GAErB,uCAAuB,IAAC,iCAAqB,sBAA0C;iBAC1F,IAAC,kBAAI,SAAS,QAAW;GACtB,SAAS,+BAAe,IAAC,yBAAa,SAAS,cAA0B;GACzE,iCAAiB,IAAC,kCAAsB,gBAAqC;GAC7E,SAAS,8BAAc,IAAC,kBAAI,SAAS,aAAgB;GACrD,SAAS,wBACV,IAAC;EAAS,KAAK,IAAI,UAAU,SAAS,KAAK,CAAC;EAAG,SAAS,MAAM,OAAO,QAAQ,MAAM;YAChF,SAAS;GACD;GAEV,SAAS,iCACV,IAAC,4CACC,IAAC;EAAS,IAAG;YAAK,SAAS;GAAyB,GACrC;GAEhB,SAAS,+BACV,IAAC,4CACC,IAAC;EAAS,IAAG;YAAY,SAAS;GAAuB,GAC1C;CAElB;IACkB;AAGvB,2BAAe"}
@@ -0,0 +1,8 @@
1
+ import { ErrorMessage_default } from "./ErrorMessage.js";
2
+
3
+ //#region src/ErrorMessage/index.ts
4
+ var ErrorMessage_default$1 = ErrorMessage_default;
5
+
6
+ //#endregion
7
+ export { ErrorMessage_default$1 as ErrorMessage_default };
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["ErrorMessage"],"sources":["../../src/ErrorMessage/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2019-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport ErrorMessage from \"./ErrorMessage\";\n\nexport default ErrorMessage;\n"],"mappings":";;;AAUA,6BAAeA"}
@@ -0,0 +1,121 @@
1
+ import React, { forwardRef, useCallback, useEffect, useId, useMemo, useState } from "react";
2
+ import { IconButton } from "@ndla/primitives";
3
+ import { styled } from "@ndla/styled-system/jsx";
4
+ import { useTranslation } from "react-i18next";
5
+ import { ArrowDownShortLine } from "@ndla/icons";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+
8
+ //#region src/FactBox/FactBox.tsx
9
+ const StyledAside = styled("aside", {
10
+ base: {
11
+ position: "relative",
12
+ padding: "medium",
13
+ display: "grid",
14
+ gridTemplateRows: "0fr",
15
+ transitionProperty: "grid-template-rows",
16
+ transitionDuration: "slow",
17
+ transitionTimingFunction: "ease-in-out",
18
+ justifyItems: "center",
19
+ border: "1px solid",
20
+ borderColor: "stroke.default",
21
+ borderRadius: "xsmall",
22
+ clear: "both",
23
+ _open: { gridTemplateRows: "1fr" },
24
+ _closed: { _print: {
25
+ overflow: "visible",
26
+ maxHeight: "500vh"
27
+ } },
28
+ "& > div": { minHeight: "surface.3xsmall" }
29
+ },
30
+ variants: { overflowHidden: { true: { "& > div": { overflow: "hidden" } } } }
31
+ });
32
+ const StyledContent = styled("div", { base: {
33
+ position: "relative",
34
+ width: "100%",
35
+ "& :first-child": { marginBlockStart: "0" },
36
+ _after: {
37
+ content: "\"\"",
38
+ textAlign: "center",
39
+ position: "absolute",
40
+ inset: "0",
41
+ transitionProperty: "opacity",
42
+ transitionDuration: "slow",
43
+ transitionTimingFunction: "ease-in-out",
44
+ gradientFrom: "surface.default/20",
45
+ gradientTo: "surface.default/95",
46
+ backgroundGradient: "to-b",
47
+ opacity: "1",
48
+ zIndex: "base",
49
+ pointerEvents: "none"
50
+ },
51
+ _print: {
52
+ overflow: "visible",
53
+ _after: { display: "none" }
54
+ },
55
+ _open: {
56
+ paddingBlockEnd: "xsmall",
57
+ _after: { opacity: "0" }
58
+ }
59
+ } });
60
+ const StyledIconButton = styled(IconButton, { base: {
61
+ position: "absolute",
62
+ bottom: "-medium",
63
+ zIndex: "base",
64
+ "& svg": {
65
+ transitionProperty: "transform",
66
+ transitionTimingFunction: "ease-in-out",
67
+ transitionDuration: "fast"
68
+ },
69
+ _open: { "& svg": { transform: "rotate(180deg)" } },
70
+ _print: { display: "none" }
71
+ } });
72
+ const FactBox = forwardRef(({ children, open, onOpenChange, defaultOpen = false,...rest }, ref) => {
73
+ const { t } = useTranslation();
74
+ const [state, setState] = useState(defaultOpen ? "open" : "closed");
75
+ const [overflowHidden, setOverflowHidden] = useState(!defaultOpen);
76
+ const contentId = useId();
77
+ const inertAttribute = useMemo(() => {
78
+ return state === "closed" ? { inert: typeof React.use === "function" ? true : "" } : {};
79
+ }, [state]);
80
+ useEffect(() => {
81
+ if (open !== void 0) setState(open ? "open" : "closed");
82
+ }, [open]);
83
+ const onClick = useCallback(() => {
84
+ const newState = state === "open" ? "closed" : "open";
85
+ setState(newState);
86
+ onOpenChange?.(newState === "open");
87
+ }, [state, onOpenChange]);
88
+ return /* @__PURE__ */ jsxs(StyledAside, {
89
+ "data-state": state,
90
+ "data-embed-type": "factbox",
91
+ ...rest,
92
+ ref,
93
+ overflowHidden,
94
+ onTransitionStart: (e) => {
95
+ if (e.target === e.currentTarget && state === "closed") setOverflowHidden(true);
96
+ },
97
+ onTransitionEnd: (e) => {
98
+ if (e.target === e.currentTarget && state === "open") setOverflowHidden(false);
99
+ },
100
+ children: [/* @__PURE__ */ jsx(StyledIconButton, {
101
+ "data-state": state,
102
+ onClick,
103
+ contentEditable: false,
104
+ "aria-expanded": state === "open",
105
+ "aria-controls": contentId,
106
+ "aria-label": t(`factbox.${state === "open" ? "close" : "open"}`),
107
+ children: /* @__PURE__ */ jsx(ArrowDownShortLine, {})
108
+ }), /* @__PURE__ */ jsx(StyledContent, {
109
+ id: contentId,
110
+ "data-state": state,
111
+ "aria-hidden": state === "closed",
112
+ ...inertAttribute,
113
+ children
114
+ })]
115
+ });
116
+ });
117
+ var FactBox_default = FactBox;
118
+
119
+ //#endregion
120
+ export { FactBox_default };
121
+ //# sourceMappingURL=FactBox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FactBox.js","names":[],"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 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\";\nimport { ArrowDownShortLine } from \"@ndla/icons\";\nimport { IconButton } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\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 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 _closed: {\n _print: {\n overflow: \"visible\",\n maxHeight: \"500vh\",\n },\n },\n \"& > div\": {\n minHeight: \"surface.3xsmall\",\n },\n },\n variants: {\n overflowHidden: {\n true: {\n \"& > div\": {\n overflow: \"hidden\",\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 _after: {\n content: '\"\"',\n textAlign: \"center\",\n position: \"absolute\",\n inset: \"0\",\n transitionProperty: \"opacity\",\n transitionDuration: \"slow\",\n transitionTimingFunction: \"ease-in-out\",\n gradientFrom: \"surface.default/20\",\n gradientTo: \"surface.default/95\",\n backgroundGradient: \"to-b\",\n opacity: \"1\",\n zIndex: \"base\",\n pointerEvents: \"none\",\n },\n _print: {\n overflow: \"visible\",\n _after: {\n display: \"none\",\n },\n },\n _open: {\n paddingBlockEnd: \"xsmall\",\n _after: {\n opacity: \"0\",\n },\n },\n },\n});\n\nconst StyledIconButton = styled(IconButton, {\n base: {\n position: \"absolute\",\n bottom: \"-medium\",\n zIndex: \"base\",\n \"& svg\": {\n transitionProperty: \"transform\",\n transitionTimingFunction: \"ease-in-out\",\n transitionDuration: \"fast\",\n },\n _open: {\n \"& svg\": {\n transform: \"rotate(180deg)\",\n },\n },\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\nconst 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 <StyledIconButton\n data-state={state}\n onClick={onClick}\n contentEditable={false}\n aria-expanded={state === \"open\"}\n aria-controls={contentId}\n aria-label={t(`factbox.${state === \"open\" ? \"close\" : \"open\"}`)}\n >\n <ArrowDownShortLine />\n </StyledIconButton>\n <StyledContent id={contentId} data-state={state} aria-hidden={state === \"closed\"} {...inertAttribute}>\n {children}\n </StyledContent>\n </StyledAside>\n );\n },\n);\n\nexport default FactBox;\n"],"mappings":";;;;;;;;AA8BA,MAAM,cAAc,OAAO,SAAS;CAClC,MAAM;EACJ,UAAU;EACV,SAAS;EACT,SAAS;EACT,kBAAkB;EAClB,oBAAoB;EACpB,oBAAoB;EACpB,0BAA0B;EAC1B,cAAc;EACd,QAAQ;EACR,aAAa;EACb,cAAc;EACd,OAAO;EACP,OAAO,EACL,kBAAkB,MACnB;EACD,SAAS,EACP,QAAQ;GACN,UAAU;GACV,WAAW;EACZ,EACF;EACD,WAAW,EACT,WAAW,kBACZ;CACF;CACD,UAAU,EACR,gBAAgB,EACd,MAAM,EACJ,WAAW,EACT,UAAU,SACX,EACF,EACF,EACF;AACF,EAAC;AAEF,MAAM,gBAAgB,OAAO,OAAO,EAClC,MAAM;CACJ,UAAU;CACV,OAAO;CAEP,kBAAkB,EAChB,kBAAkB,IACnB;CACD,QAAQ;EACN,SAAS;EACT,WAAW;EACX,UAAU;EACV,OAAO;EACP,oBAAoB;EACpB,oBAAoB;EACpB,0BAA0B;EAC1B,cAAc;EACd,YAAY;EACZ,oBAAoB;EACpB,SAAS;EACT,QAAQ;EACR,eAAe;CAChB;CACD,QAAQ;EACN,UAAU;EACV,QAAQ,EACN,SAAS,OACV;CACF;CACD,OAAO;EACL,iBAAiB;EACjB,QAAQ,EACN,SAAS,IACV;CACF;AACF,EACF,EAAC;AAEF,MAAM,mBAAmB,OAAO,YAAY,EAC1C,MAAM;CACJ,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,SAAS;EACP,oBAAoB;EACpB,0BAA0B;EAC1B,oBAAoB;CACrB;CACD,OAAO,EACL,SAAS,EACP,WAAW,iBACZ,EACF;CACD,QAAQ,EACN,SAAS,OACV;AACF,EACF,EAAC;AAIF,MAAM,UAAU,WACd,CAAC,EAAE,UAAU,MAAM,cAAc,cAAc,MAAO,GAAG,MAAM,EAAE,QAAQ;CACvE,MAAM,EAAE,GAAG,GAAG,gBAAgB;CAC9B,MAAM,CAAC,OAAO,SAAS,GAAG,SAA4B,cAAc,SAAS,SAAS;CACtF,MAAM,CAAC,gBAAgB,kBAAkB,GAAG,UAAU,YAAY;CAClE,MAAM,YAAY,OAAO;CAIzB,MAAM,iBAAiB,QAAQ,MAAM;AACnC,SAAO,UAAU,WAAW,EAAE,cAAc,MAAM,QAAQ,aAAa,OAAO,GAAI,IAAG,CAAE;CACxF,GAAE,CAAC,KAAM,EAAC;AAEX,WAAU,MAAM;AACd,MAAI,gBACF,UAAS,OAAO,SAAS,SAAS;CAErC,GAAE,CAAC,IAAK,EAAC;CAEV,MAAM,UAAU,YAAY,MAAM;EAChC,MAAM,WAAW,UAAU,SAAS,WAAW;AAC/C,WAAS,SAAS;AAClB,iBAAe,aAAa,OAAO;CACpC,GAAE,CAAC,OAAO,YAAa,EAAC;AAEzB,wBACE,KAAC;EACC,cAAY;EACZ,mBAAgB;EAChB,GAAI;EACC;EACW;EAChB,mBAAmB,CAAC,MAAM;AACxB,OAAI,EAAE,WAAW,EAAE,iBAAiB,UAAU,SAC5C,mBAAkB,KAAK;EAE1B;EACD,iBAAiB,CAAC,MAAM;AACtB,OAAI,EAAE,WAAW,EAAE,iBAAiB,UAAU,OAC5C,mBAAkB,MAAM;EAE3B;6BAED,IAAC;GACC,cAAY;GACH;GACT,iBAAiB;GACjB,iBAAe,UAAU;GACzB,iBAAe;GACf,cAAY,GAAG,UAAU,UAAU,SAAS,UAAU,OAAO,EAAE;6BAE/D,IAAC,uBAAqB;IACL,kBACnB,IAAC;GAAc,IAAI;GAAW,cAAY;GAAO,eAAa,UAAU;GAAU,GAAI;GACnF;IACa;GACJ;AAEjB,EACF;AAED,sBAAe"}
@@ -0,0 +1,8 @@
1
+ import { FactBox_default } from "./FactBox.js";
2
+
3
+ //#region src/FactBox/index.ts
4
+ var FactBox_default$1 = FactBox_default;
5
+
6
+ //#endregion
7
+ export { FactBox_default$1 as FactBox_default };
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["FactBox"],"sources":["../../src/FactBox/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2018-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 FactBox from \"./FactBox\";\n\nexport default FactBox;\n"],"mappings":";;;AAUA,wBAAeA"}
@@ -0,0 +1,76 @@
1
+ import { FileListItem } from "./FileList.js";
2
+ import { forwardRef } from "react";
3
+ import { Text } from "@ndla/primitives";
4
+ import { HStack, styled } from "@ndla/styled-system/jsx";
5
+ import { useTranslation } from "react-i18next";
6
+ import { DownloadLine } from "@ndla/icons";
7
+ import { SafeLink } from "@ndla/safelink";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { linkOverlay } from "@ndla/styled-system/patterns";
10
+
11
+ //#region src/FileList/File.tsx
12
+ const StyledSafeLink = styled(SafeLink, { base: {
13
+ textUnderlineOffset: "2px",
14
+ textDecoration: "underline",
15
+ _hover: { textDecoration: "none" }
16
+ } });
17
+ const StyledHStack = styled(HStack, { base: {
18
+ position: "relative",
19
+ paddingBlock: "small",
20
+ paddingInlineEnd: "medium",
21
+ paddingInlineStart: "small",
22
+ width: "100%"
23
+ } });
24
+ const File = forwardRef(({ title, url, fileExists, fileType, fileSize,...rest }, ref) => {
25
+ const { t } = useTranslation();
26
+ const filename = `${title}-${url.split("/").pop() ?? ""}`;
27
+ const downloadUrl = `${url}?download=${filename}`;
28
+ const tooltip = `${t("download")} ${filename}`;
29
+ return /* @__PURE__ */ jsxs(StyledHStack, {
30
+ justify: "space-between",
31
+ ref,
32
+ ...rest,
33
+ children: [/* @__PURE__ */ jsxs(HStack, {
34
+ gap: "xxsmall",
35
+ children: [
36
+ /* @__PURE__ */ jsx(DownloadLine, {}),
37
+ fileExists ? /* @__PURE__ */ jsx(StyledSafeLink, {
38
+ unstyled: true,
39
+ css: linkOverlay.raw(),
40
+ to: downloadUrl,
41
+ title: tooltip,
42
+ children: title
43
+ }) : /* @__PURE__ */ jsx(Text, {
44
+ textStyle: "label.medium",
45
+ children: title
46
+ }),
47
+ /* @__PURE__ */ jsx(Text, {
48
+ textStyle: "label.large",
49
+ asChild: true,
50
+ consumeCss: true,
51
+ children: /* @__PURE__ */ jsxs("span", { children: [
52
+ "(",
53
+ fileType?.toUpperCase(),
54
+ ")"
55
+ ] })
56
+ })
57
+ ]
58
+ }), /* @__PURE__ */ jsx(Text, {
59
+ textStyle: "label.large",
60
+ asChild: true,
61
+ consumeCss: true,
62
+ children: /* @__PURE__ */ jsx("span", { children: fileSize })
63
+ })]
64
+ });
65
+ });
66
+ const FileListElement = ({ title, url, fileExists, fileType, fileSize }) => /* @__PURE__ */ jsx(FileListItem, { children: /* @__PURE__ */ jsx(File, {
67
+ title,
68
+ url,
69
+ fileExists,
70
+ fileType,
71
+ fileSize
72
+ }) });
73
+
74
+ //#endregion
75
+ export { File, FileListElement };
76
+ //# sourceMappingURL=File.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"File.js","names":[],"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 { type ComponentPropsWithRef, forwardRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { DownloadLine } from \"@ndla/icons\";\nimport { Text } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { HStack, styled } from \"@ndla/styled-system/jsx\";\nimport { linkOverlay } from \"@ndla/styled-system/patterns\";\nimport { FileListItem } from \".\";\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 StyledHStack = styled(HStack, {\n base: {\n position: \"relative\",\n paddingBlock: \"small\",\n paddingInlineEnd: \"medium\",\n paddingInlineStart: \"small\",\n width: \"100%\",\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=${filename}`;\n const tooltip = `${t(\"download\")} ${filename}`;\n\n return (\n <StyledHStack justify=\"space-between\" ref={ref} {...rest}>\n <HStack gap=\"xxsmall\">\n <DownloadLine />\n {fileExists ? (\n <StyledSafeLink unstyled 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 </HStack>\n <Text textStyle=\"label.large\" asChild consumeCss>\n <span>{fileSize}</span>\n </Text>\n </StyledHStack>\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,iBAAiB,OAAO,UAAU,EACtC,MAAM;CACJ,qBAAqB;CACrB,gBAAgB;CAChB,QAAQ,EACN,gBAAgB,OACjB;AACF,EACF,EAAC;AAEF,MAAM,eAAe,OAAO,QAAQ,EAClC,MAAM;CACJ,UAAU;CACV,cAAc;CACd,kBAAkB;CAClB,oBAAoB;CACpB,OAAO;AACR,EACF,EAAC;AAEF,MAAa,OAAO,WAClB,CAAC,EAAE,OAAO,KAAK,YAAY,UAAU,SAAU,GAAG,MAAM,EAAE,QAAQ;CAChE,MAAM,EAAE,GAAG,GAAG,gBAAgB;CAC9B,MAAM,YAAY,EAAE,MAAM,GAAG,IAAI,MAAM,IAAI,CAAC,KAAK,IAAI,GAAG;CACxD,MAAM,eAAe,EAAE,IAAI,YAAY,SAAS;CAChD,MAAM,WAAW,EAAE,EAAE,WAAW,CAAC,GAAG,SAAS;AAE7C,wBACE,KAAC;EAAa,SAAQ;EAAqB;EAAK,GAAI;6BAClD,KAAC;GAAO,KAAI;;oBACV,IAAC,iBAAe;IACf,6BACC,IAAC;KAAe;KAAS,KAAK,YAAY,KAAK;KAAE,IAAI;KAAa,OAAO;eACtE;MACc,mBAEjB,IAAC;KAAK,WAAU;eAAgB;MAAa;oBAE/C,IAAC;KAAK,WAAU;KAAc;KAAQ;+BACpC,KAAC;MAAK;MAAE,UAAU,aAAa;MAAC;SAAQ;MACnC;;IACA,kBACT,IAAC;GAAK,WAAU;GAAc;GAAQ;6BACpC,IAAC,oBAAM,WAAgB;IAClB;GACM;AAElB,EACF;AAED,MAAa,kBAAkB,CAAC,EAAE,OAAO,KAAK,YAAY,UAAU,UAAqB,qBACvF,IAAC,0CACC,IAAC;CAAY;CAAY;CAAiB;CAAsB;CAAoB;EAAY,GACnF"}
@@ -0,0 +1,32 @@
1
+ import "react";
2
+ import { styled } from "@ndla/styled-system/jsx";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { ark } from "@ark-ui/react";
5
+
6
+ //#region src/FileList/FileList.tsx
7
+ const FileListWrapper = styled(ark.ul, { base: {
8
+ display: "flex",
9
+ flexDirection: "column",
10
+ gap: "xsmall",
11
+ clear: "both"
12
+ } }, { baseComponent: true });
13
+ const FileListItem = styled(ark.li, { base: {
14
+ listStyle: "none",
15
+ background: "surface.infoSubtle",
16
+ borderBlockEnd: "1px solid",
17
+ borderColor: "stroke.default",
18
+ display: "flex",
19
+ justifyContent: "space-between",
20
+ _hover: { backgroundColor: "surface.infoSubtle.hover" }
21
+ } }, { baseComponent: true });
22
+ const FileListEmbed = ({ children,...rest }) => {
23
+ return /* @__PURE__ */ jsx(FileListWrapper, {
24
+ ...rest,
25
+ "data-embed-type": "file-list",
26
+ children
27
+ });
28
+ };
29
+
30
+ //#endregion
31
+ export { FileListEmbed, FileListItem, FileListWrapper };
32
+ //# sourceMappingURL=FileList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileList.js","names":[],"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 { type ComponentPropsWithoutRef } from \"react\";\nimport { ark } from \"@ark-ui/react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\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,kBAAkB,OAC7B,IAAI,IACJ,EACE,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,OAAO;AACR,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,eAAe,OAC1B,IAAI,IACJ,EACE,MAAM;CACJ,WAAW;CACX,YAAY;CACZ,gBAAgB;CAChB,aAAa;CACb,SAAS;CACT,gBAAgB;CAEhB,QAAQ,EACN,iBAAiB,2BAClB;AACF,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,gBAAgB,CAAC,EAAE,SAAU,GAAG,MAAa,KAAK;AAC7D,wBACE,IAAC;EAAgB,GAAI;EAAM,mBAAgB;EACxC;GACe;AAErB"}
@@ -0,0 +1,28 @@
1
+ import { Figure, Heading } from "@ndla/primitives";
2
+ import { styled } from "@ndla/styled-system/jsx";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+
5
+ //#region src/FileList/PdfFile.tsx
6
+ const StyledIframe = styled("iframe", { base: { width: "100%" } });
7
+ const StyledListElement = styled("li", { base: { listStyle: "none" } });
8
+ const StyledFigure = styled(Figure, { base: {
9
+ display: "flex",
10
+ flexDirection: "column",
11
+ gap: "xsmall"
12
+ } });
13
+ const PdfFile = ({ title, url }) => {
14
+ return /* @__PURE__ */ jsx(StyledListElement, { children: /* @__PURE__ */ jsxs(StyledFigure, { children: [/* @__PURE__ */ jsx(Heading, {
15
+ asChild: true,
16
+ consumeCss: true,
17
+ textStyle: "title.medium",
18
+ children: /* @__PURE__ */ jsx("h4", { children: title })
19
+ }), /* @__PURE__ */ jsx(StyledIframe, {
20
+ title,
21
+ height: "1050",
22
+ src: url
23
+ })] }) });
24
+ };
25
+
26
+ //#endregion
27
+ export { PdfFile };
28
+ //# sourceMappingURL=PdfFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PdfFile.js","names":[],"sources":["../../src/FileList/PdfFile.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 { Heading, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\ninterface Props {\n title: string;\n url: string;\n}\n\nconst StyledIframe = styled(\"iframe\", {\n base: {\n width: \"100%\",\n },\n});\n\nconst StyledListElement = styled(\"li\", {\n base: {\n listStyle: \"none\",\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n});\n\nexport const PdfFile = ({ title, url }: Props) => {\n return (\n <StyledListElement>\n <StyledFigure>\n <Heading asChild consumeCss textStyle=\"title.medium\">\n <h4>{title}</h4>\n </Heading>\n <StyledIframe title={title} height=\"1050\" src={url} />\n </StyledFigure>\n </StyledListElement>\n );\n};\n"],"mappings":";;;;;AAgBA,MAAM,eAAe,OAAO,UAAU,EACpC,MAAM,EACJ,OAAO,OACR,EACF,EAAC;AAEF,MAAM,oBAAoB,OAAO,MAAM,EACrC,MAAM,EACJ,WAAW,OACZ,EACF,EAAC;AAEF,MAAM,eAAe,OAAO,QAAQ,EAClC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;AACN,EACF,EAAC;AAEF,MAAa,UAAU,CAAC,EAAE,OAAO,KAAY,KAAK;AAChD,wBACE,IAAC,+CACC,KAAC,2CACC,IAAC;EAAQ;EAAQ;EAAW,WAAU;4BACpC,IAAC,kBAAI,QAAW;GACR,kBACV,IAAC;EAAoB;EAAO,QAAO;EAAO,KAAK;GAAO,IACzC,GACG;AAEvB"}
@@ -0,0 +1,142 @@
1
+ import { SpeechControl_default } from "../AudioPlayer/SpeechControl.js";
2
+ import { GlossExample_default } from "./GlossExample.js";
3
+ import { useMemo } from "react";
4
+ import { AccordionItem, AccordionItemContent, AccordionItemIndicator, AccordionRoot, IconButton, Text } from "@ndla/primitives";
5
+ import { styled } from "@ndla/styled-system/jsx";
6
+ import { useTranslation } from "react-i18next";
7
+ import { ArrowDownShortLine } from "@ndla/icons";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { AccordionItemTrigger as AccordionItemTrigger$1 } from "@ark-ui/react";
10
+
11
+ //#region src/Gloss/Gloss.tsx
12
+ const getFilteredExamples = (glossData, exampleIds, exampleLangs) => {
13
+ if (exampleIds !== void 0 || exampleLangs !== void 0) {
14
+ const exampleIdsList = exampleIds?.toString()?.split(",") ?? [];
15
+ const exampleLangsList = exampleLangs?.split(",") ?? [];
16
+ const filteredExamples = glossData?.examples?.map((examples, i) => {
17
+ if (exampleIdsList.includes(i.toString())) return examples.filter((e) => exampleLangsList.includes(e.language));
18
+ return [];
19
+ }) ?? [];
20
+ const examplesWithoutEmpty = filteredExamples.filter((el) => !!el.length);
21
+ return examplesWithoutEmpty;
22
+ }
23
+ return glossData?.examples ?? [];
24
+ };
25
+ const Container = styled("div", { base: {
26
+ display: "flex",
27
+ alignItems: "center",
28
+ justifyContent: "space-between"
29
+ } });
30
+ const TextWrapper = styled("div", { base: {
31
+ display: "flex",
32
+ gap: "small"
33
+ } });
34
+ const StyledAccordionItemContent = styled(AccordionItemContent, { base: { paddingInline: "0" } });
35
+ const StyledContainer = styled(Container, { base: { marginBlockStart: "3xsmall" } });
36
+ const StyledAccordionItem = styled(AccordionItem, {
37
+ base: {
38
+ paddingBlock: "small",
39
+ paddingInline: "medium"
40
+ },
41
+ defaultVariants: { variant: "simple" },
42
+ variants: { variant: {
43
+ simple: {},
44
+ bordered: {
45
+ border: "1px solid",
46
+ borderColor: "stroke.subtle",
47
+ borderRadius: "xsmall"
48
+ }
49
+ } }
50
+ });
51
+ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }) => {
52
+ const { t } = useTranslation();
53
+ const filteredExamples = useMemo(() => getFilteredExamples(glossData, exampleIds, exampleLangs), [
54
+ exampleIds,
55
+ exampleLangs,
56
+ glossData
57
+ ]);
58
+ if (!glossData) return null;
59
+ return /* @__PURE__ */ jsx(AccordionRoot, {
60
+ multiple: true,
61
+ variant: "clean",
62
+ children: /* @__PURE__ */ jsxs(StyledAccordionItem, {
63
+ value: "gloss",
64
+ variant,
65
+ children: [
66
+ /* @__PURE__ */ jsxs(Container, { children: [/* @__PURE__ */ jsxs(TextWrapper, { children: [
67
+ /* @__PURE__ */ jsx(Text, {
68
+ textStyle: "label.medium",
69
+ fontWeight: "bold",
70
+ asChild: true,
71
+ consumeCss: true,
72
+ lang: glossData.originalLanguage,
73
+ children: /* @__PURE__ */ jsx("span", { children: glossData.gloss })
74
+ }),
75
+ !!glossData.transcriptions.traditional && /* @__PURE__ */ jsx(Text, {
76
+ textStyle: "label.medium",
77
+ asChild: true,
78
+ consumeCss: true,
79
+ children: /* @__PURE__ */ jsx("span", {
80
+ "aria-label": t("gloss.transcriptions.traditional"),
81
+ lang: glossData.originalLanguage,
82
+ children: glossData.transcriptions.traditional
83
+ }, t("gloss.transcriptions.traditional"))
84
+ }),
85
+ !!glossData.transcriptions.pinyin && /* @__PURE__ */ jsx(Text, {
86
+ textStyle: "label.medium",
87
+ asChild: true,
88
+ consumeCss: true,
89
+ children: /* @__PURE__ */ jsx("span", {
90
+ "data-pinyin": "",
91
+ "aria-label": t("gloss.transcriptions.pinyin"),
92
+ lang: glossData.originalLanguage,
93
+ children: glossData.transcriptions.pinyin
94
+ }, t("gloss.transcriptions.pinyin"))
95
+ }),
96
+ !!glossData.wordClass && /* @__PURE__ */ jsx(Text, {
97
+ textStyle: "label.medium",
98
+ asChild: true,
99
+ consumeCss: true,
100
+ children: /* @__PURE__ */ jsx("span", {
101
+ "aria-label": t("gloss.wordClass"),
102
+ children: t(`wordClass.${glossData.wordClass}`).toLowerCase()
103
+ })
104
+ })
105
+ ] }), !!audio?.src && /* @__PURE__ */ jsx(SpeechControl_default, {
106
+ src: audio.src,
107
+ title: audio.title,
108
+ type: "gloss"
109
+ })] }),
110
+ /* @__PURE__ */ jsxs(StyledContainer, { children: [/* @__PURE__ */ jsx(Text, {
111
+ textStyle: "label.medium",
112
+ asChild: true,
113
+ consumeCss: true,
114
+ children: /* @__PURE__ */ jsx("span", {
115
+ lang: title.language,
116
+ children: title.title
117
+ })
118
+ }), !!filteredExamples.length && /* @__PURE__ */ jsx(AccordionItemTrigger$1, {
119
+ asChild: true,
120
+ children: /* @__PURE__ */ jsx(IconButton, {
121
+ variant: "tertiary",
122
+ "aria-label": t("gloss.showExamples"),
123
+ title: t("gloss.showExamples"),
124
+ children: /* @__PURE__ */ jsx(AccordionItemIndicator, {
125
+ asChild: true,
126
+ children: /* @__PURE__ */ jsx(ArrowDownShortLine, { size: "medium" })
127
+ })
128
+ })
129
+ })] }),
130
+ /* @__PURE__ */ jsx(StyledAccordionItemContent, { children: filteredExamples.map((examples, index) => /* @__PURE__ */ jsx(GlossExample_default, {
131
+ examples,
132
+ originalLanguage: glossData.originalLanguage
133
+ }, `gloss-example-${index}`)) })
134
+ ]
135
+ })
136
+ });
137
+ };
138
+ var Gloss_default = Gloss;
139
+
140
+ //#endregion
141
+ export { Gloss_default };
142
+ //# sourceMappingURL=Gloss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Gloss.js","names":["glossData: IGlossDataDTO | undefined","exampleIds: string | undefined","exampleLangs: string | undefined","SpeechControl","AccordionItemTrigger","GlossExample"],"sources":["../../src/Gloss/Gloss.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 { useMemo } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { AccordionItemTrigger } from \"@ark-ui/react\";\nimport { ArrowDownShortLine } from \"@ndla/icons\";\nimport {\n AccordionItem,\n AccordionItemContent,\n AccordionItemIndicator,\n AccordionRoot,\n IconButton,\n Text,\n} from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledVariantProps } from \"@ndla/styled-system/types\";\nimport type { IGlossDataDTO, IGlossExampleDTO } from \"@ndla/types-backend/concept-api\";\nimport GlossExample from \"./GlossExample\";\nimport SpeechControl from \"../AudioPlayer/SpeechControl\";\n\n// TODO: Figure out padding between bordered and simple variant.\n// The design says that the content above the accordion content should have enough padding to align with the accordion content.\n// When a gloss is bordered there's way too much padding.\n\nconst getFilteredExamples = (\n glossData: IGlossDataDTO | undefined,\n exampleIds: string | undefined,\n exampleLangs: string | undefined,\n): IGlossExampleDTO[][] => {\n if (exampleIds !== undefined || exampleLangs !== undefined) {\n const exampleIdsList = exampleIds?.toString()?.split(\",\") ?? [];\n const exampleLangsList = exampleLangs?.split(\",\") ?? [];\n\n const filteredExamples =\n glossData?.examples?.map((examples, i) => {\n if (exampleIdsList.includes(i.toString())) {\n return examples.filter((e) => exampleLangsList.includes(e.language));\n }\n return [];\n }) ?? [];\n const examplesWithoutEmpty = filteredExamples.filter((el) => !!el.length);\n return examplesWithoutEmpty;\n }\n return glossData?.examples ?? [];\n};\n\nconst Container = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n },\n});\n\nconst TextWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"small\",\n },\n});\n\nconst StyledAccordionItemContent = styled(AccordionItemContent, {\n base: {\n paddingInline: \"0\",\n },\n});\n\nconst StyledContainer = styled(Container, {\n base: {\n marginBlockStart: \"3xsmall\",\n },\n});\n\nconst StyledAccordionItem = styled(AccordionItem, {\n base: {\n paddingBlock: \"small\",\n paddingInline: \"medium\",\n },\n defaultVariants: {\n variant: \"simple\",\n },\n variants: {\n variant: {\n simple: {},\n bordered: {\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n borderRadius: \"xsmall\",\n },\n },\n },\n});\n\ntype GlossVariantProps = StyledVariantProps<typeof StyledAccordionItem>;\n\nexport interface Props {\n title: {\n title: string;\n language: string;\n };\n glossData?: IGlossDataDTO;\n audio?: {\n title: string;\n src?: string;\n };\n exampleIds?: string;\n exampleLangs?: string;\n}\n\nconst Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }: Props & GlossVariantProps) => {\n const { t } = useTranslation();\n\n const filteredExamples = useMemo(\n () => getFilteredExamples(glossData, exampleIds, exampleLangs),\n [exampleIds, exampleLangs, glossData],\n );\n\n if (!glossData) return null;\n\n return (\n <AccordionRoot multiple variant=\"clean\">\n <StyledAccordionItem value=\"gloss\" variant={variant}>\n <Container>\n <TextWrapper>\n <Text textStyle=\"label.medium\" fontWeight=\"bold\" asChild consumeCss lang={glossData.originalLanguage}>\n <span>{glossData.gloss}</span>\n </Text>\n {!!glossData.transcriptions.traditional && (\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span\n key={t(\"gloss.transcriptions.traditional\")}\n aria-label={t(\"gloss.transcriptions.traditional\")}\n lang={glossData.originalLanguage}\n >\n {glossData.transcriptions.traditional}\n </span>\n </Text>\n )}\n {!!glossData.transcriptions.pinyin && (\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span\n data-pinyin=\"\"\n key={t(\"gloss.transcriptions.pinyin\")}\n aria-label={t(\"gloss.transcriptions.pinyin\")}\n lang={glossData.originalLanguage}\n >\n {glossData.transcriptions.pinyin}\n </span>\n </Text>\n )}\n {!!glossData.wordClass && (\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span aria-label={t(\"gloss.wordClass\")}>{t(`wordClass.${glossData.wordClass}`).toLowerCase()}</span>\n </Text>\n )}\n </TextWrapper>\n {!!audio?.src && <SpeechControl src={audio.src} title={audio.title} type=\"gloss\" />}\n </Container>\n <StyledContainer>\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span lang={title.language}>{title.title}</span>\n </Text>\n {!!filteredExamples.length && (\n <AccordionItemTrigger asChild>\n <IconButton variant=\"tertiary\" aria-label={t(\"gloss.showExamples\")} title={t(\"gloss.showExamples\")}>\n <AccordionItemIndicator asChild>\n <ArrowDownShortLine size=\"medium\" />\n </AccordionItemIndicator>\n </IconButton>\n </AccordionItemTrigger>\n )}\n </StyledContainer>\n <StyledAccordionItemContent>\n {filteredExamples.map((examples, index) => (\n <GlossExample\n key={`gloss-example-${index}`}\n examples={examples}\n originalLanguage={glossData.originalLanguage}\n />\n ))}\n </StyledAccordionItemContent>\n </StyledAccordionItem>\n </AccordionRoot>\n );\n};\n\nexport default Gloss;\n"],"mappings":";;;;;;;;;;;AA8BA,MAAM,sBAAsB,CAC1BA,WACAC,YACAC,iBACyB;AACzB,KAAI,yBAA4B,yBAA4B;EAC1D,MAAM,iBAAiB,YAAY,UAAU,EAAE,MAAM,IAAI,IAAI,CAAE;EAC/D,MAAM,mBAAmB,cAAc,MAAM,IAAI,IAAI,CAAE;EAEvD,MAAM,mBACJ,WAAW,UAAU,IAAI,CAAC,UAAU,MAAM;AACxC,OAAI,eAAe,SAAS,EAAE,UAAU,CAAC,CACvC,QAAO,SAAS,OAAO,CAAC,MAAM,iBAAiB,SAAS,EAAE,SAAS,CAAC;AAEtE,UAAO,CAAE;EACV,EAAC,IAAI,CAAE;EACV,MAAM,uBAAuB,iBAAiB,OAAO,CAAC,SAAS,GAAG,OAAO;AACzE,SAAO;CACR;AACD,QAAO,WAAW,YAAY,CAAE;AACjC;AAED,MAAM,YAAY,OAAO,OAAO,EAC9B,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,gBAAgB;AACjB,EACF,EAAC;AAEF,MAAM,cAAc,OAAO,OAAO,EAChC,MAAM;CACJ,SAAS;CACT,KAAK;AACN,EACF,EAAC;AAEF,MAAM,6BAA6B,OAAO,sBAAsB,EAC9D,MAAM,EACJ,eAAe,IAChB,EACF,EAAC;AAEF,MAAM,kBAAkB,OAAO,WAAW,EACxC,MAAM,EACJ,kBAAkB,UACnB,EACF,EAAC;AAEF,MAAM,sBAAsB,OAAO,eAAe;CAChD,MAAM;EACJ,cAAc;EACd,eAAe;CAChB;CACD,iBAAiB,EACf,SAAS,SACV;CACD,UAAU,EACR,SAAS;EACP,QAAQ,CAAE;EACV,UAAU;GACR,QAAQ;GACR,aAAa;GACb,cAAc;EACf;CACF,EACF;AACF,EAAC;AAkBF,MAAM,QAAQ,CAAC,EAAE,OAAO,WAAW,OAAO,YAAY,cAAc,SAAoC,KAAK;CAC3G,MAAM,EAAE,GAAG,GAAG,gBAAgB;CAE9B,MAAM,mBAAmB,QACvB,MAAM,oBAAoB,WAAW,YAAY,aAAa,EAC9D;EAAC;EAAY;EAAc;CAAU,EACtC;AAED,MAAK,UAAW,QAAO;AAEvB,wBACE,IAAC;EAAc;EAAS,SAAQ;4BAC9B,KAAC;GAAoB,OAAM;GAAiB;;oBAC1C,KAAC,wCACC,KAAC;qBACC,IAAC;MAAK,WAAU;MAAe,YAAW;MAAO;MAAQ;MAAW,MAAM,UAAU;gCAClF,IAAC,oBAAM,UAAU,QAAa;OACzB;OACJ,UAAU,eAAe,+BAC1B,IAAC;MAAK,WAAU;MAAe;MAAQ;gCACrC,IAAC;OAEC,cAAY,EAAE,mCAAmC;OACjD,MAAM,UAAU;iBAEf,UAAU,eAAe;SAJrB,EAAE,mCAAmC,CAKrC;OACF;OAEN,UAAU,eAAe,0BAC1B,IAAC;MAAK,WAAU;MAAe;MAAQ;gCACrC,IAAC;OACC,eAAY;OAEZ,cAAY,EAAE,8BAA8B;OAC5C,MAAM,UAAU;iBAEf,UAAU,eAAe;SAJrB,EAAE,8BAA8B,CAKhC;OACF;OAEN,UAAU,6BACX,IAAC;MAAK,WAAU;MAAe;MAAQ;gCACrC,IAAC;OAAK,cAAY,EAAE,kBAAkB;iBAAG,GAAG,YAAY,UAAU,UAAU,EAAE,CAAC,aAAa;QAAQ;OAC/F;QAEG,IACX,OAAO,uBAAO,IAACC;KAAc,KAAK,MAAM;KAAK,OAAO,MAAM;KAAO,MAAK;MAAU,IACzE;oBACZ,KAAC,8CACC,IAAC;KAAK,WAAU;KAAe;KAAQ;+BACrC,IAAC;MAAK,MAAM,MAAM;gBAAW,MAAM;OAAa;MAC3C,IACJ,iBAAiB,0BAClB,IAACC;KAAqB;+BACpB,IAAC;MAAW,SAAQ;MAAW,cAAY,EAAE,qBAAqB;MAAE,OAAO,EAAE,qBAAqB;gCAChG,IAAC;OAAuB;iCACtB,IAAC,sBAAmB,MAAK,WAAW;QACb;OACd;MACQ,IAET;oBAClB,IAAC,wCACE,iBAAiB,IAAI,CAAC,UAAU,0BAC/B,IAACC;KAEW;KACV,kBAAkB,UAAU;QAFtB,gBAAgB,MAAM,EAG5B,CACF,GACyB;;IACT;GACR;AAEnB;AAED,oBAAe"}
@@ -0,0 +1,46 @@
1
+ import { Fragment } from "react";
2
+ import { Text } from "@ndla/primitives";
3
+ import { styled } from "@ndla/styled-system/jsx";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+
6
+ //#region src/Gloss/GlossExample.tsx
7
+ const StyledGlossExample = styled("div", { base: {
8
+ borderTop: "1px solid",
9
+ borderColor: "stroke.subtle",
10
+ paddingBlock: "xsmall",
11
+ paddingInline: "medium",
12
+ _first: {
13
+ background: "surface.brand.1.subtle",
14
+ borderColor: "stroke.default",
15
+ "& p": { fontWeight: "bold" }
16
+ }
17
+ } });
18
+ const PinyinText = styled(Text, { base: { fontStyle: "italic" } });
19
+ const GlossExample = ({ examples, originalLanguage }) => {
20
+ return /* @__PURE__ */ jsx("div", { children: examples.map((examples$1, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
21
+ /* @__PURE__ */ jsx(StyledGlossExample, {
22
+ lang: examples$1.language,
23
+ children: /* @__PURE__ */ jsx(Text, {
24
+ textStyle: "label.medium",
25
+ lang: examples$1.language,
26
+ children: examples$1.example
27
+ })
28
+ }),
29
+ !!examples$1.transcriptions.pinyin && /* @__PURE__ */ jsx(StyledGlossExample, { children: /* @__PURE__ */ jsx(PinyinText, {
30
+ "data-pinyin": "",
31
+ lang: originalLanguage,
32
+ textStyle: "label.medium",
33
+ children: examples$1.transcriptions?.pinyin
34
+ }) }),
35
+ !!examples$1.transcriptions?.traditional && /* @__PURE__ */ jsx(StyledGlossExample, { children: /* @__PURE__ */ jsx(Text, {
36
+ textStyle: "label.medium",
37
+ lang: originalLanguage,
38
+ children: examples$1.transcriptions.traditional
39
+ }) })
40
+ ] }, index)) });
41
+ };
42
+ var GlossExample_default = GlossExample;
43
+
44
+ //#endregion
45
+ export { GlossExample_default };
46
+ //# sourceMappingURL=GlossExample.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlossExample.js","names":["examples"],"sources":["../../src/Gloss/GlossExample.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 { Fragment } from \"react\";\nimport { Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { IGlossExampleDTO } from \"@ndla/types-backend/concept-api\";\n\ninterface Props {\n examples: IGlossExampleDTO[];\n originalLanguage: string | undefined;\n}\n\nconst StyledGlossExample = styled(\"div\", {\n base: {\n borderTop: \"1px solid\",\n borderColor: \"stroke.subtle\",\n paddingBlock: \"xsmall\",\n paddingInline: \"medium\",\n _first: {\n background: \"surface.brand.1.subtle\",\n borderColor: \"stroke.default\",\n \"& p\": {\n fontWeight: \"bold\",\n },\n },\n },\n});\n\nconst PinyinText = styled(Text, {\n base: {\n fontStyle: \"italic\",\n },\n});\n\nconst GlossExample = ({ examples, originalLanguage }: Props) => {\n return (\n <div>\n {examples.map((examples, index) => (\n <Fragment key={index}>\n <StyledGlossExample lang={examples.language}>\n <Text textStyle=\"label.medium\" lang={examples.language}>\n {examples.example}\n </Text>\n </StyledGlossExample>\n {!!examples.transcriptions.pinyin && (\n <StyledGlossExample>\n <PinyinText data-pinyin=\"\" lang={originalLanguage} textStyle=\"label.medium\">\n {examples.transcriptions?.pinyin}\n </PinyinText>\n </StyledGlossExample>\n )}\n {!!examples.transcriptions?.traditional && (\n <StyledGlossExample>\n <Text textStyle=\"label.medium\" lang={originalLanguage}>\n {examples.transcriptions.traditional}\n </Text>\n </StyledGlossExample>\n )}\n </Fragment>\n ))}\n </div>\n );\n};\n\nexport default GlossExample;\n"],"mappings":";;;;;;AAkBA,MAAM,qBAAqB,OAAO,OAAO,EACvC,MAAM;CACJ,WAAW;CACX,aAAa;CACb,cAAc;CACd,eAAe;CACf,QAAQ;EACN,YAAY;EACZ,aAAa;EACb,OAAO,EACL,YAAY,OACb;CACF;AACF,EACF,EAAC;AAEF,MAAM,aAAa,OAAO,MAAM,EAC9B,MAAM,EACJ,WAAW,SACZ,EACF,EAAC;AAEF,MAAM,eAAe,CAAC,EAAE,UAAU,kBAAyB,KAAK;AAC9D,wBACE,IAAC,mBACE,SAAS,IAAI,CAACA,YAAU,0BACvB,KAAC;kBACC,IAAC;GAAmB,MAAMA,WAAS;6BACjC,IAAC;IAAK,WAAU;IAAe,MAAMA,WAAS;cAC3CA,WAAS;KACL;IACY;IAClBA,WAAS,eAAe,0BACzB,IAAC,gDACC,IAAC;GAAW,eAAY;GAAG,MAAM;GAAkB,WAAU;aAC1DA,WAAS,gBAAgB;IACf,GACM;IAEpBA,WAAS,gBAAgB,+BAC1B,IAAC,gDACC,IAAC;GAAK,WAAU;GAAe,MAAM;aAClCA,WAAS,eAAe;IACpB,GACY;MAlBV,MAoBJ,CACX,GACE;AAET;AAED,2BAAe"}