@ndla/ui 56.0.123-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 (347) hide show
  1. package/es/Article/Article.js +122 -194
  2. package/es/Article/Article.js.map +1 -0
  3. package/es/Article/ArticleByline.js +121 -170
  4. package/es/Article/ArticleByline.js.map +1 -0
  5. package/es/Article/ArticleFootNotes.js +38 -58
  6. package/es/Article/ArticleFootNotes.js.map +1 -0
  7. package/es/AudioPlayer/AudioPlayer.js +151 -212
  8. package/es/AudioPlayer/AudioPlayer.js.map +1 -0
  9. package/es/AudioPlayer/Controls.js +246 -324
  10. package/es/AudioPlayer/Controls.js.map +1 -0
  11. package/es/AudioPlayer/SpeechControl.js +36 -52
  12. package/es/AudioPlayer/SpeechControl.js.map +1 -0
  13. package/es/AudioPlayer/index.js +7 -9
  14. package/es/AudioPlayer/index.js.map +1 -0
  15. package/es/Breadcrumb/Breadcrumb.js +42 -58
  16. package/es/Breadcrumb/Breadcrumb.js.map +1 -0
  17. package/es/Breadcrumb/BreadcrumbItem.js +33 -59
  18. package/es/Breadcrumb/BreadcrumbItem.js.map +1 -0
  19. package/es/Breadcrumb/HomeBreadcrumb.js +41 -74
  20. package/es/Breadcrumb/HomeBreadcrumb.js.map +1 -0
  21. package/es/Breadcrumb/index.js +8 -10
  22. package/es/Breadcrumb/index.js.map +1 -0
  23. package/es/CampaignBlock/CampaignBlock.js +124 -173
  24. package/es/CampaignBlock/CampaignBlock.js.map +1 -0
  25. package/es/CodeBlock/CodeBlock.js +21 -31
  26. package/es/CodeBlock/CodeBlock.js.map +1 -0
  27. package/es/CodeBlock/codeLanguageOptions.js +112 -82
  28. package/es/CodeBlock/codeLanguageOptions.js.map +1 -0
  29. package/es/Concept/Concept.js +46 -68
  30. package/es/Concept/Concept.js.map +1 -0
  31. package/es/ContactBlock/ContactBlock.js +137 -191
  32. package/es/ContactBlock/ContactBlock.js.map +1 -0
  33. package/es/ContentTypeBadge/ContentTypeBadge.js +38 -47
  34. package/es/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
  35. package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +21 -28
  36. package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
  37. package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +21 -28
  38. package/es/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
  39. package/es/ContentTypeHero/ContentTypeHero.js +36 -47
  40. package/es/ContentTypeHero/ContentTypeHero.js.map +1 -0
  41. package/es/CopyParagraphButton/CopyParagraphButton.js +57 -78
  42. package/es/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
  43. package/es/CopyParagraphButton/index.js +7 -10
  44. package/es/CopyParagraphButton/index.js.map +1 -0
  45. package/es/Embed/AudioEmbed.js +49 -73
  46. package/es/Embed/AudioEmbed.js.map +1 -0
  47. package/es/Embed/BrightcoveEmbed.js +90 -127
  48. package/es/Embed/BrightcoveEmbed.js.map +1 -0
  49. package/es/Embed/CodeEmbed.js +55 -73
  50. package/es/Embed/CodeEmbed.js.map +1 -0
  51. package/es/Embed/ConceptEmbed.js +72 -117
  52. package/es/Embed/ConceptEmbed.js.map +1 -0
  53. package/es/Embed/ConceptInlineTriggerButton.js +39 -44
  54. package/es/Embed/ConceptInlineTriggerButton.js.map +1 -0
  55. package/es/Embed/ContentLinkEmbed.js +29 -49
  56. package/es/Embed/ContentLinkEmbed.js.map +1 -0
  57. package/es/Embed/CopyrightEmbed.js +21 -31
  58. package/es/Embed/CopyrightEmbed.js.map +1 -0
  59. package/es/Embed/EmbedErrorPlaceholder.js +40 -55
  60. package/es/Embed/EmbedErrorPlaceholder.js.map +1 -0
  61. package/es/Embed/EmbedWrapper.js +21 -46
  62. package/es/Embed/EmbedWrapper.js.map +1 -0
  63. package/es/Embed/ExternalEmbed.js +50 -70
  64. package/es/Embed/ExternalEmbed.js.map +1 -0
  65. package/es/Embed/FootnoteEmbed.js +25 -42
  66. package/es/Embed/FootnoteEmbed.js.map +1 -0
  67. package/es/Embed/GlossEmbed.js +49 -77
  68. package/es/Embed/GlossEmbed.js.map +1 -0
  69. package/es/Embed/H5pEmbed.js +35 -58
  70. package/es/Embed/H5pEmbed.js.map +1 -0
  71. package/es/Embed/IframeEmbed.js +65 -89
  72. package/es/Embed/IframeEmbed.js.map +1 -0
  73. package/es/Embed/ImageEmbed.js +167 -225
  74. package/es/Embed/ImageEmbed.js.map +1 -0
  75. package/es/Embed/InlineTriggerButton.js +20 -32
  76. package/es/Embed/InlineTriggerButton.js.map +1 -0
  77. package/es/Embed/RelatedContentEmbed.js +36 -53
  78. package/es/Embed/RelatedContentEmbed.js.map +1 -0
  79. package/es/Embed/UnknownEmbed.js +18 -29
  80. package/es/Embed/UnknownEmbed.js.map +1 -0
  81. package/es/Embed/UuDisclaimerEmbed.js +51 -85
  82. package/es/Embed/UuDisclaimerEmbed.js.map +1 -0
  83. package/es/ErrorMessage/ErrorMessage.js +51 -92
  84. package/es/ErrorMessage/ErrorMessage.js.map +1 -0
  85. package/es/ErrorMessage/index.js +7 -9
  86. package/es/ErrorMessage/index.js.map +1 -0
  87. package/es/FactBox/FactBox.js +114 -170
  88. package/es/FactBox/FactBox.js.map +1 -0
  89. package/es/FactBox/index.js +7 -9
  90. package/es/FactBox/index.js.map +1 -0
  91. package/es/FileList/File.js +70 -95
  92. package/es/FileList/File.js.map +1 -0
  93. package/es/FileList/FileList.js +31 -46
  94. package/es/FileList/FileList.js.map +1 -0
  95. package/es/FileList/PdfFile.js +27 -49
  96. package/es/FileList/PdfFile.js.map +1 -0
  97. package/es/Gloss/Gloss.js +133 -166
  98. package/es/Gloss/Gloss.js.map +1 -0
  99. package/es/Gloss/GlossExample.js +42 -60
  100. package/es/Gloss/GlossExample.js.map +1 -0
  101. package/es/Grid/Grid.js +63 -91
  102. package/es/Grid/Grid.js.map +1 -0
  103. package/es/Grid/GridParallaxItem.js +19 -30
  104. package/es/Grid/GridParallaxItem.js.map +1 -0
  105. package/es/KeyFigure/KeyFigure.js +44 -61
  106. package/es/KeyFigure/KeyFigure.js.map +1 -0
  107. package/es/LicenseByline/EmbedByline.js +126 -206
  108. package/es/LicenseByline/EmbedByline.js.map +1 -0
  109. package/es/LicenseByline/LicenseLink.js +28 -53
  110. package/es/LicenseByline/LicenseLink.js.map +1 -0
  111. package/es/LinkBlock/LinkBlock.js +70 -99
  112. package/es/LinkBlock/LinkBlock.js.map +1 -0
  113. package/es/LinkBlock/LinkBlockSection.js +20 -32
  114. package/es/LinkBlock/LinkBlockSection.js.map +1 -0
  115. package/es/Pitch/Pitch.js +59 -80
  116. package/es/Pitch/Pitch.js.map +1 -0
  117. package/es/RelatedArticleList/RelatedArticleList.js +91 -129
  118. package/es/RelatedArticleList/RelatedArticleList.js.map +1 -0
  119. package/es/RelatedArticleList/index.js +7 -10
  120. package/es/RelatedArticleList/index.js.map +1 -0
  121. package/es/ResourceBox/ResourceBox.js +71 -96
  122. package/es/ResourceBox/ResourceBox.js.map +1 -0
  123. package/es/TagSelector/TagSelector.js +93 -136
  124. package/es/TagSelector/TagSelector.js.map +1 -0
  125. package/es/ZendeskButton/ZendeskButton.js +38 -52
  126. package/es/ZendeskButton/ZendeskButton.js.map +1 -0
  127. package/es/_virtual/rolldown_runtime.js +11 -0
  128. package/es/i18n/formatNestedMessages.js +16 -24
  129. package/es/i18n/formatNestedMessages.js.map +1 -0
  130. package/es/i18n/i18n.js +25 -31
  131. package/es/i18n/i18n.js.map +1 -0
  132. package/es/i18n/useComponentTranslations.js +147 -203
  133. package/es/i18n/useComponentTranslations.js.map +1 -0
  134. package/es/index.js +64 -44
  135. package/es/locale/messages-en.js +435 -459
  136. package/es/locale/messages-en.js.map +1 -0
  137. package/es/locale/messages-nb.js +435 -459
  138. package/es/locale/messages-nb.js.map +1 -0
  139. package/es/locale/messages-nn.js +435 -459
  140. package/es/locale/messages-nn.js.map +1 -0
  141. package/es/locale/messages-se.js +435 -459
  142. package/es/locale/messages-se.js.map +1 -0
  143. package/es/model/ContentType.js +69 -65
  144. package/es/model/ContentType.js.map +1 -0
  145. package/es/model/SubjectCategories.js +23 -10
  146. package/es/model/SubjectCategories.js.map +1 -0
  147. package/es/model/SubjectTypes.js +21 -9
  148. package/es/model/SubjectTypes.js.map +1 -0
  149. package/es/model/WordClass.js +51 -43
  150. package/es/model/WordClass.js.map +1 -0
  151. package/es/model/index.js +16 -18
  152. package/es/model/index.js.map +1 -0
  153. package/es/utils/licenseAttributes.js +15 -17
  154. package/es/utils/licenseAttributes.js.map +1 -0
  155. package/es/utils/relativeUrl.js +21 -32
  156. package/es/utils/relativeUrl.js.map +1 -0
  157. package/lib/Article/Article.js +130 -203
  158. package/lib/Article/Article.js.map +1 -0
  159. package/lib/Article/ArticleByline.js +125 -179
  160. package/lib/Article/ArticleByline.js.map +1 -0
  161. package/lib/Article/ArticleFootNotes.js +39 -65
  162. package/lib/Article/ArticleFootNotes.js.map +1 -0
  163. package/lib/AudioPlayer/AudioPlayer.js +155 -221
  164. package/lib/AudioPlayer/AudioPlayer.js.map +1 -0
  165. package/lib/AudioPlayer/Controls.js +249 -332
  166. package/lib/AudioPlayer/Controls.js.map +1 -0
  167. package/lib/AudioPlayer/SpeechControl.js +39 -60
  168. package/lib/AudioPlayer/SpeechControl.js.map +1 -0
  169. package/lib/AudioPlayer/index.js +7 -15
  170. package/lib/AudioPlayer/index.js.map +1 -0
  171. package/lib/Breadcrumb/Breadcrumb.js +43 -65
  172. package/lib/Breadcrumb/Breadcrumb.js.map +1 -0
  173. package/lib/Breadcrumb/BreadcrumbItem.js +34 -65
  174. package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -0
  175. package/lib/Breadcrumb/HomeBreadcrumb.js +43 -82
  176. package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -0
  177. package/lib/Breadcrumb/index.js +8 -22
  178. package/lib/Breadcrumb/index.js.map +1 -0
  179. package/lib/CampaignBlock/CampaignBlock.js +128 -183
  180. package/lib/CampaignBlock/CampaignBlock.js.map +1 -0
  181. package/lib/CodeBlock/CodeBlock.js +23 -38
  182. package/lib/CodeBlock/CodeBlock.js.map +1 -0
  183. package/lib/CodeBlock/codeLanguageOptions.js +112 -87
  184. package/lib/CodeBlock/codeLanguageOptions.js.map +1 -0
  185. package/lib/Concept/Concept.js +48 -75
  186. package/lib/Concept/Concept.js.map +1 -0
  187. package/lib/ContactBlock/ContactBlock.js +141 -200
  188. package/lib/ContactBlock/ContactBlock.js.map +1 -0
  189. package/lib/ContentTypeBadge/ContentTypeBadge.js +40 -54
  190. package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
  191. package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +23 -35
  192. package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
  193. package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +23 -35
  194. package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
  195. package/lib/ContentTypeHero/ContentTypeHero.js +37 -54
  196. package/lib/ContentTypeHero/ContentTypeHero.js.map +1 -0
  197. package/lib/CopyParagraphButton/CopyParagraphButton.js +61 -87
  198. package/lib/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
  199. package/lib/CopyParagraphButton/index.js +7 -21
  200. package/lib/CopyParagraphButton/index.js.map +1 -0
  201. package/lib/Embed/AudioEmbed.js +51 -82
  202. package/lib/Embed/AudioEmbed.js.map +1 -0
  203. package/lib/Embed/BrightcoveEmbed.js +93 -138
  204. package/lib/Embed/BrightcoveEmbed.js.map +1 -0
  205. package/lib/Embed/CodeEmbed.js +59 -83
  206. package/lib/Embed/CodeEmbed.js.map +1 -0
  207. package/lib/Embed/ConceptEmbed.js +77 -127
  208. package/lib/Embed/ConceptEmbed.js.map +1 -0
  209. package/lib/Embed/ConceptInlineTriggerButton.js +39 -49
  210. package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -0
  211. package/lib/Embed/ContentLinkEmbed.js +30 -55
  212. package/lib/Embed/ContentLinkEmbed.js.map +1 -0
  213. package/lib/Embed/CopyrightEmbed.js +22 -37
  214. package/lib/Embed/CopyrightEmbed.js.map +1 -0
  215. package/lib/Embed/EmbedErrorPlaceholder.js +42 -62
  216. package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -0
  217. package/lib/Embed/EmbedWrapper.js +24 -54
  218. package/lib/Embed/EmbedWrapper.js.map +1 -0
  219. package/lib/Embed/ExternalEmbed.js +53 -79
  220. package/lib/Embed/ExternalEmbed.js.map +1 -0
  221. package/lib/Embed/FootnoteEmbed.js +26 -48
  222. package/lib/Embed/FootnoteEmbed.js.map +1 -0
  223. package/lib/Embed/GlossEmbed.js +51 -86
  224. package/lib/Embed/GlossEmbed.js.map +1 -0
  225. package/lib/Embed/H5pEmbed.js +37 -66
  226. package/lib/Embed/H5pEmbed.js.map +1 -0
  227. package/lib/Embed/IframeEmbed.js +68 -98
  228. package/lib/Embed/IframeEmbed.js.map +1 -0
  229. package/lib/Embed/ImageEmbed.js +173 -238
  230. package/lib/Embed/ImageEmbed.js.map +1 -0
  231. package/lib/Embed/InlineTriggerButton.js +23 -40
  232. package/lib/Embed/InlineTriggerButton.js.map +1 -0
  233. package/lib/Embed/RelatedContentEmbed.js +37 -59
  234. package/lib/Embed/RelatedContentEmbed.js.map +1 -0
  235. package/lib/Embed/UnknownEmbed.js +19 -35
  236. package/lib/Embed/UnknownEmbed.js.map +1 -0
  237. package/lib/Embed/UuDisclaimerEmbed.js +53 -92
  238. package/lib/Embed/UuDisclaimerEmbed.js.map +1 -0
  239. package/lib/ErrorMessage/ErrorMessage.js +53 -99
  240. package/lib/ErrorMessage/ErrorMessage.js.map +1 -0
  241. package/lib/ErrorMessage/index.js +7 -15
  242. package/lib/ErrorMessage/index.js.map +1 -0
  243. package/lib/FactBox/FactBox.js +118 -180
  244. package/lib/FactBox/FactBox.js.map +1 -0
  245. package/lib/FactBox/index.js +7 -15
  246. package/lib/FactBox/index.js.map +1 -0
  247. package/lib/FileList/File.js +75 -105
  248. package/lib/FileList/File.js.map +1 -0
  249. package/lib/FileList/FileList.js +33 -52
  250. package/lib/FileList/FileList.js.map +1 -0
  251. package/lib/FileList/PdfFile.js +27 -55
  252. package/lib/FileList/PdfFile.js.map +1 -0
  253. package/lib/Gloss/Gloss.js +138 -176
  254. package/lib/Gloss/Gloss.js.map +1 -0
  255. package/lib/Gloss/GlossExample.js +45 -68
  256. package/lib/Gloss/GlossExample.js.map +1 -0
  257. package/lib/Grid/Grid.js +64 -98
  258. package/lib/Grid/Grid.js.map +1 -0
  259. package/lib/Grid/GridParallaxItem.js +19 -36
  260. package/lib/Grid/GridParallaxItem.js.map +1 -0
  261. package/lib/KeyFigure/KeyFigure.js +45 -68
  262. package/lib/KeyFigure/KeyFigure.js.map +1 -0
  263. package/lib/LicenseByline/EmbedByline.js +130 -216
  264. package/lib/LicenseByline/EmbedByline.js.map +1 -0
  265. package/lib/LicenseByline/LicenseLink.js +29 -59
  266. package/lib/LicenseByline/LicenseLink.js.map +1 -0
  267. package/lib/LinkBlock/LinkBlock.js +73 -108
  268. package/lib/LinkBlock/LinkBlock.js.map +1 -0
  269. package/lib/LinkBlock/LinkBlockSection.js +22 -39
  270. package/lib/LinkBlock/LinkBlockSection.js.map +1 -0
  271. package/lib/Pitch/Pitch.js +61 -89
  272. package/lib/Pitch/Pitch.js.map +1 -0
  273. package/lib/RelatedArticleList/RelatedArticleList.js +96 -140
  274. package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -0
  275. package/lib/RelatedArticleList/index.js +7 -20
  276. package/lib/RelatedArticleList/index.js.map +1 -0
  277. package/lib/ResourceBox/ResourceBox.js +73 -104
  278. package/lib/ResourceBox/ResourceBox.js.map +1 -0
  279. package/lib/TagSelector/TagSelector.js +103 -145
  280. package/lib/TagSelector/TagSelector.js.map +1 -0
  281. package/lib/ZendeskButton/ZendeskButton.js +39 -58
  282. package/lib/ZendeskButton/ZendeskButton.js.map +1 -0
  283. package/lib/_virtual/rolldown_runtime.js +42 -0
  284. package/lib/i18n/formatNestedMessages.js +16 -30
  285. package/lib/i18n/formatNestedMessages.js.map +1 -0
  286. package/lib/i18n/i18n.js +28 -38
  287. package/lib/i18n/i18n.js.map +1 -0
  288. package/lib/i18n/useComponentTranslations.js +154 -215
  289. package/lib/i18n/useComponentTranslations.js.map +1 -0
  290. package/lib/index.js +156 -598
  291. package/lib/locale/messages-en.js +436 -466
  292. package/lib/locale/messages-en.js.map +1 -0
  293. package/lib/locale/messages-nb.js +436 -466
  294. package/lib/locale/messages-nb.js.map +1 -0
  295. package/lib/locale/messages-nn.js +436 -466
  296. package/lib/locale/messages-nn.js.map +1 -0
  297. package/lib/locale/messages-se.js +436 -466
  298. package/lib/locale/messages-se.js.map +1 -0
  299. package/lib/model/ContentType.js +90 -70
  300. package/lib/model/ContentType.js.map +1 -0
  301. package/lib/model/SubjectCategories.js +26 -14
  302. package/lib/model/SubjectCategories.js.map +1 -0
  303. package/lib/model/SubjectTypes.js +24 -13
  304. package/lib/model/SubjectTypes.js.map +1 -0
  305. package/lib/model/WordClass.js +55 -48
  306. package/lib/model/WordClass.js.map +1 -0
  307. package/lib/model/index.js +16 -25
  308. package/lib/model/index.js.map +1 -0
  309. package/lib/utils/licenseAttributes.js +14 -22
  310. package/lib/utils/licenseAttributes.js.map +1 -0
  311. package/lib/utils/relativeUrl.js +20 -38
  312. package/lib/utils/relativeUrl.js.map +1 -0
  313. package/package.json +12 -11
  314. package/es/Article/index.js +0 -11
  315. package/es/CampaignBlock/index.js +0 -9
  316. package/es/CodeBlock/index.js +0 -10
  317. package/es/ContactBlock/index.js +0 -9
  318. package/es/ContentTypeHero/index.js +0 -9
  319. package/es/Embed/index.js +0 -25
  320. package/es/Embed/types.js +0 -1
  321. package/es/FileList/index.js +0 -11
  322. package/es/Gloss/index.js +0 -10
  323. package/es/Grid/index.js +0 -10
  324. package/es/KeyFigure/index.js +0 -9
  325. package/es/LicenseByline/index.js +0 -10
  326. package/es/LinkBlock/index.js +0 -10
  327. package/es/Pitch/index.js +0 -9
  328. package/es/ResourceBox/index.js +0 -10
  329. package/es/i18n/index.js +0 -11
  330. package/es/types.js +0 -1
  331. package/lib/Article/index.js +0 -68
  332. package/lib/CampaignBlock/index.js +0 -13
  333. package/lib/CodeBlock/index.js +0 -20
  334. package/lib/ContactBlock/index.js +0 -18
  335. package/lib/ContentTypeHero/index.js +0 -12
  336. package/lib/Embed/index.js +0 -150
  337. package/lib/Embed/types.js +0 -5
  338. package/lib/FileList/index.js +0 -44
  339. package/lib/Gloss/index.js +0 -20
  340. package/lib/Grid/index.js +0 -19
  341. package/lib/KeyFigure/index.js +0 -13
  342. package/lib/LicenseByline/index.js +0 -19
  343. package/lib/LinkBlock/index.js +0 -20
  344. package/lib/Pitch/index.js +0 -12
  345. package/lib/ResourceBox/index.js +0 -13
  346. package/lib/i18n/index.js +0 -68
  347. package/lib/types.js +0 -5
@@ -1,212 +1,132 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
1
+ import { LicenseLink } from "./LicenseLink.js";
9
2
  import { useState } from "react";
3
+ import { Button, Text } from "@ndla/primitives";
4
+ import { styled } from "@ndla/styled-system/jsx";
10
5
  import { useTranslation } from "react-i18next";
11
6
  import { AlertLine } from "@ndla/icons";
12
7
  import { getLicenseByAbbreviation, getLicenseCredits } from "@ndla/licenses";
13
- import { Button, Text } from "@ndla/primitives";
14
- import { styled } from "@ndla/styled-system/jsx";
15
- import { LicenseLink } from "./LicenseLink";
16
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
17
- const BylineWrapper = styled("figcaption", {
18
- base: {
19
- display: "flex",
20
- flexDirection: "column",
21
- paddingBlock: "xsmall",
22
- textStyle: "label.medium",
23
- color: "text.subtle"
24
- }
25
- });
26
- const ErrorBylineWrapper = styled(BylineWrapper, {
27
- base: {
28
- border: "1px solid",
29
- borderColor: "stroke.error",
30
- borderRadius: "xsmall",
31
- background: "surface.dangerSubtle",
32
- paddingInline: "medium",
33
- paddingBlock: "medium"
34
- }
35
- });
36
- const StyledText = styled(Text, {
37
- base: {
38
- fontStyle: "italic"
39
- }
40
- });
41
- const ContentWrapper = styled("div", {
42
- base: {
43
- display: "flex",
44
- gap: "xsmall",
45
- alignItems: "center",
46
- textStyle: "label.medium"
47
- }
48
- });
49
- const BaseDescription = styled("div", {
50
- base: {
51
- display: "inline-flex",
52
- whiteSpace: "pre-wrap"
53
- }
54
- });
55
- export const EmbedByline = _ref => {
56
- let {
57
- type,
58
- description,
59
- children,
60
- visibleAlt,
61
- hideCopyright,
62
- ...props
63
- } = _ref;
64
- const {
65
- t
66
- } = useTranslation();
67
- if (props.error) {
68
- const typeString = type === "h5p" ? "H5P" : t(`embed.type.${type}`).toLowerCase();
69
- return /*#__PURE__*/_jsx(ErrorBylineWrapper, {
70
- children: /*#__PURE__*/_jsxs(ContentWrapper, {
71
- children: [/*#__PURE__*/_jsx(AlertLine, {}), /*#__PURE__*/_jsx(BaseDescription, {
72
- children: /*#__PURE__*/_jsx("span", {
73
- children: t("embed.embedError", {
74
- type: typeString
75
- })
76
- })
77
- })]
78
- })
79
- });
80
- }
81
- const {
82
- copyright
83
- } = props;
84
- const hideByline = hideCopyright && !description;
85
- return /*#__PURE__*/_jsxs(_Fragment, {
86
- children: [!hideByline && /*#__PURE__*/_jsx(BylineWrapper, {
87
- children: /*#__PURE__*/_jsxs("div", {
88
- children: [!!hideCopyright && description, !hideCopyright && /*#__PURE__*/_jsx(LicenseContainerContent, {
89
- type: type,
90
- copyright: copyright,
91
- children: description
92
- }), children]
93
- })
94
- }), visibleAlt ? /*#__PURE__*/_jsx(StyledText, {
95
- color: "text.subtle",
96
- textStyle: "label.medium",
97
- asChild: true,
98
- consumeCss: true,
99
- children: /*#__PURE__*/_jsx("span", {
100
- children: `Alt: ${visibleAlt}`
101
- })
102
- }) : null]
103
- });
8
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
+
10
+ //#region src/LicenseByline/EmbedByline.tsx
11
+ const BylineWrapper = styled("figcaption", { base: {
12
+ display: "flex",
13
+ flexDirection: "column",
14
+ paddingBlock: "xsmall",
15
+ textStyle: "label.medium",
16
+ color: "text.subtle"
17
+ } });
18
+ const ErrorBylineWrapper = styled(BylineWrapper, { base: {
19
+ border: "1px solid",
20
+ borderColor: "stroke.error",
21
+ borderRadius: "xsmall",
22
+ background: "surface.dangerSubtle",
23
+ paddingInline: "medium",
24
+ paddingBlock: "medium"
25
+ } });
26
+ const StyledText = styled(Text, { base: { fontStyle: "italic" } });
27
+ const ContentWrapper = styled("div", { base: {
28
+ display: "flex",
29
+ gap: "xsmall",
30
+ alignItems: "center",
31
+ textStyle: "label.medium"
32
+ } });
33
+ const BaseDescription = styled("div", { base: {
34
+ display: "inline-flex",
35
+ whiteSpace: "pre-wrap"
36
+ } });
37
+ const EmbedByline = ({ type, description, children, visibleAlt, hideCopyright,...props }) => {
38
+ const { t } = useTranslation();
39
+ if (props.error) {
40
+ const typeString = type === "h5p" ? "H5P" : t(`embed.type.${type}`).toLowerCase();
41
+ return /* @__PURE__ */ jsx(ErrorBylineWrapper, { children: /* @__PURE__ */ jsxs(ContentWrapper, { children: [/* @__PURE__ */ jsx(AlertLine, {}), /* @__PURE__ */ jsx(BaseDescription, { children: /* @__PURE__ */ jsx("span", { children: t("embed.embedError", { type: typeString }) }) })] }) });
42
+ }
43
+ const { copyright } = props;
44
+ const hideByline = hideCopyright && !description;
45
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [!hideByline && /* @__PURE__ */ jsx(BylineWrapper, { children: /* @__PURE__ */ jsxs("div", { children: [
46
+ !!hideCopyright && description,
47
+ !hideCopyright && /* @__PURE__ */ jsx(LicenseContainerContent, {
48
+ type,
49
+ copyright,
50
+ children: description
51
+ }),
52
+ children
53
+ ] }) }), visibleAlt ? /* @__PURE__ */ jsx(StyledText, {
54
+ color: "text.subtle",
55
+ textStyle: "label.medium",
56
+ asChild: true,
57
+ consumeCss: true,
58
+ children: /* @__PURE__ */ jsx("span", { children: `Alt: ${visibleAlt}` })
59
+ }) : null] });
104
60
  };
105
- const StyledDescription = styled(BaseDescription, {
106
- base: {
107
- mobileWideDown: {
108
- display: "grid",
109
- gridTemplateColumns: "1fr auto",
110
- alignItems: "center",
111
- overflow: "hidden",
112
- _open: {
113
- display: "inline"
114
- }
115
- }
116
- }
117
- });
118
- const TextContent = styled("span", {
119
- base: {
120
- mobileWideDown: {
121
- whiteSpace: "nowrap",
122
- maxHeight: "large",
123
- overflow: "hidden",
124
- textOverflow: "ellipsis",
125
- transitionProperty: "max-height",
126
- transitionDuration: "slow",
127
- transitionTimingFunction: "ease-in",
128
- marginInlineEnd: "4xsmall",
129
- _open: {
130
- whiteSpace: "pre-wrap",
131
- maxHeight: "none"
132
- }
133
- }
134
- }
135
- });
136
- const StyledButton = styled(Button, {
137
- base: {
138
- mobileWide: {
139
- display: "none"
140
- }
141
- }
142
- });
143
- const LicenseDescription = _ref2 => {
144
- let {
145
- children,
146
- isOpen,
147
- setIsOpen
148
- } = _ref2;
149
- const open = isOpen ? {
150
- "data-open": ""
151
- } : {};
152
- const {
153
- t
154
- } = useTranslation();
155
- const handleToggle = () => {
156
- setIsOpen(!isOpen);
157
- };
158
- return /*#__PURE__*/_jsx(ContentWrapper, {
159
- children: /*#__PURE__*/_jsxs(StyledDescription, {
160
- ...open,
161
- children: [/*#__PURE__*/_jsx(TextContent, {
162
- ...open,
163
- children: children
164
- }), /*#__PURE__*/_jsx(StyledButton, {
165
- variant: "link",
166
- size: "small",
167
- onClick: handleToggle,
168
- children: isOpen ? `${t("audio.readLessDescriptionLabel")}` : `${t("audio.readMoreDescriptionLabel")}`
169
- })]
170
- })
171
- });
61
+ const StyledDescription = styled(BaseDescription, { base: { mobileWideDown: {
62
+ display: "grid",
63
+ gridTemplateColumns: "1fr auto",
64
+ alignItems: "center",
65
+ overflow: "hidden",
66
+ _open: { display: "inline" }
67
+ } } });
68
+ const TextContent = styled("span", { base: { mobileWideDown: {
69
+ whiteSpace: "nowrap",
70
+ maxHeight: "large",
71
+ overflow: "hidden",
72
+ textOverflow: "ellipsis",
73
+ transitionProperty: "max-height",
74
+ transitionDuration: "slow",
75
+ transitionTimingFunction: "ease-in",
76
+ marginInlineEnd: "4xsmall",
77
+ _open: {
78
+ whiteSpace: "pre-wrap",
79
+ maxHeight: "none"
80
+ }
81
+ } } });
82
+ const StyledButton = styled(Button, { base: { mobileWide: { display: "none" } } });
83
+ const LicenseDescription = ({ children, isOpen, setIsOpen }) => {
84
+ const open = isOpen ? { "data-open": "" } : {};
85
+ const { t } = useTranslation();
86
+ const handleToggle = () => {
87
+ setIsOpen(!isOpen);
88
+ };
89
+ return /* @__PURE__ */ jsx(ContentWrapper, { children: /* @__PURE__ */ jsxs(StyledDescription, {
90
+ ...open,
91
+ children: [/* @__PURE__ */ jsx(TextContent, {
92
+ ...open,
93
+ children
94
+ }), /* @__PURE__ */ jsx(StyledButton, {
95
+ variant: "link",
96
+ size: "small",
97
+ onClick: handleToggle,
98
+ children: isOpen ? `${t("audio.readLessDescriptionLabel")}` : `${t("audio.readMoreDescriptionLabel")}`
99
+ })]
100
+ }) });
172
101
  };
173
- export const LicenseContainerContent = _ref3 => {
174
- let {
175
- children,
176
- copyright,
177
- type
178
- } = _ref3;
179
- const {
180
- t,
181
- i18n
182
- } = useTranslation();
183
- const license = copyright ? getLicenseByAbbreviation(copyright.license?.license ?? "", i18n.language) : undefined;
184
- const authors = getLicenseCredits(copyright);
185
- const captionAuthors = Object.values(authors).find(i => i.length > 0) ?? [];
186
- const [isOpen, setIsOpen] = useState(false);
187
- const content = /*#__PURE__*/_jsxs(_Fragment, {
188
- children: [children, ` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`, /*#__PURE__*/_jsx("span", {
189
- children: captionAuthors.map(author => author.name).join(", ")
190
- }), license ? /*#__PURE__*/_jsxs(_Fragment, {
191
- children: [" / ", /*#__PURE__*/_jsx(LicenseLink, {
192
- license: license,
193
- hideLink: !isOpen && !!children
194
- })]
195
- }) : null]
196
- });
197
- if (children) {
198
- return /*#__PURE__*/_jsx(LicenseDescription, {
199
- isOpen: isOpen,
200
- setIsOpen: setIsOpen,
201
- children: content
202
- });
203
- }
204
- return /*#__PURE__*/_jsx(Text, {
205
- textStyle: "label.medium",
206
- asChild: true,
207
- consumeCss: true,
208
- children: /*#__PURE__*/_jsx("span", {
209
- children: content
210
- })
211
- });
212
- };
102
+ const LicenseContainerContent = ({ children, copyright, type }) => {
103
+ const { t, i18n } = useTranslation();
104
+ const license = copyright ? getLicenseByAbbreviation(copyright.license?.license ?? "", i18n.language) : void 0;
105
+ const authors = getLicenseCredits(copyright);
106
+ const captionAuthors = Object.values(authors).find((i) => i.length > 0) ?? [];
107
+ const [isOpen, setIsOpen] = useState(false);
108
+ const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
109
+ children,
110
+ ` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`,
111
+ /* @__PURE__ */ jsx("span", { children: captionAuthors.map((author) => author.name).join(", ") }),
112
+ license ? /* @__PURE__ */ jsxs(Fragment$1, { children: [" / ", /* @__PURE__ */ jsx(LicenseLink, {
113
+ license,
114
+ hideLink: !isOpen && !!children
115
+ })] }) : null
116
+ ] });
117
+ if (children) return /* @__PURE__ */ jsx(LicenseDescription, {
118
+ isOpen,
119
+ setIsOpen,
120
+ children: content
121
+ });
122
+ return /* @__PURE__ */ jsx(Text, {
123
+ textStyle: "label.medium",
124
+ asChild: true,
125
+ consumeCss: true,
126
+ children: /* @__PURE__ */ jsx("span", { children: content })
127
+ });
128
+ };
129
+
130
+ //#endregion
131
+ export { EmbedByline, LicenseContainerContent };
132
+ //# sourceMappingURL=EmbedByline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmbedByline.js","names":[],"sources":["../../src/LicenseByline/EmbedByline.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 Dispatch, type ReactNode, type SetStateAction, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { AlertLine } from \"@ndla/icons\";\nimport { getLicenseByAbbreviation, getLicenseCredits } from \"@ndla/licenses\";\nimport { Button, Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { ICopyrightDTO as ArticleCopyright } from \"@ndla/types-backend/article-api\";\nimport type { ICopyrightDTO as AudioCopyright } from \"@ndla/types-backend/audio-api\";\nimport type { IDraftCopyrightDTO as ConceptCopyright } from \"@ndla/types-backend/concept-api\";\nimport type { ICopyrightDTO as ImageCopyright } from \"@ndla/types-backend/image-api\";\nimport type { BrightcoveCopyright } from \"@ndla/types-embed\";\nimport { LicenseLink } from \"./LicenseLink\";\n\ninterface BaseProps {\n description?: ReactNode;\n children?: ReactNode;\n visibleAlt?: string;\n error?: true | false;\n hideDescription?: boolean;\n hideCopyright?: boolean;\n}\n\nexport interface EmbedBylineErrorProps extends BaseProps {\n type: EmbedBylineTypeProps[\"type\"] | \"h5p\" | \"external\" | \"code\";\n error: true;\n}\n\ninterface ImageProps extends BaseProps {\n type: \"image\";\n copyright: ImageCopyright | undefined;\n}\n\ninterface BrightcoveProps extends BaseProps {\n type: \"video\";\n copyright: BrightcoveCopyright | undefined;\n}\n\ninterface AudioProps extends BaseProps {\n type: \"audio\";\n copyright: AudioCopyright | undefined;\n}\n\ninterface PodcastProps extends BaseProps {\n type: \"podcast\";\n copyright: AudioCopyright | undefined;\n}\n\ninterface ConceptProps extends BaseProps {\n type: \"concept\" | \"gloss\";\n copyright: ConceptCopyright | undefined;\n}\n\ninterface CopyrightProps extends BaseProps {\n type: \"copyright\";\n copyright: ArticleCopyright | undefined;\n}\n\nexport type EmbedBylineTypeProps =\n | ImageProps\n | BrightcoveProps\n | AudioProps\n | PodcastProps\n | ConceptProps\n | CopyrightProps;\n\ntype Props = EmbedBylineTypeProps | EmbedBylineErrorProps;\n\nconst BylineWrapper = styled(\"figcaption\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n paddingBlock: \"xsmall\",\n textStyle: \"label.medium\",\n color: \"text.subtle\",\n },\n});\n\nconst ErrorBylineWrapper = styled(BylineWrapper, {\n base: {\n border: \"1px solid\",\n borderColor: \"stroke.error\",\n borderRadius: \"xsmall\",\n background: \"surface.dangerSubtle\",\n paddingInline: \"medium\",\n paddingBlock: \"medium\",\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n fontStyle: \"italic\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"xsmall\",\n alignItems: \"center\",\n textStyle: \"label.medium\",\n },\n});\n\nconst BaseDescription = styled(\"div\", {\n base: {\n display: \"inline-flex\",\n whiteSpace: \"pre-wrap\",\n },\n});\n\nexport const EmbedByline = ({ type, description, children, visibleAlt, hideCopyright, ...props }: Props) => {\n const { t } = useTranslation();\n\n if (props.error) {\n const typeString = type === \"h5p\" ? \"H5P\" : t(`embed.type.${type}`).toLowerCase();\n return (\n <ErrorBylineWrapper>\n <ContentWrapper>\n <AlertLine />\n <BaseDescription>\n <span>{t(\"embed.embedError\", { type: typeString })}</span>\n </BaseDescription>\n </ContentWrapper>\n </ErrorBylineWrapper>\n );\n }\n\n const { copyright } = props;\n const hideByline = hideCopyright && !description;\n\n return (\n <>\n {!hideByline && (\n <BylineWrapper>\n <div>\n {!!hideCopyright && description}\n {!hideCopyright && (\n <LicenseContainerContent type={type} copyright={copyright}>\n {description}\n </LicenseContainerContent>\n )}\n {children}\n </div>\n </BylineWrapper>\n )}\n {visibleAlt ? (\n <StyledText color=\"text.subtle\" textStyle=\"label.medium\" asChild consumeCss>\n <span>{`Alt: ${visibleAlt}`}</span>\n </StyledText>\n ) : null}\n </>\n );\n};\n\ninterface LicenseContainerProps {\n children?: ReactNode;\n copyright: EmbedBylineTypeProps[\"copyright\"];\n type: Props[\"type\"];\n}\n\nconst StyledDescription = styled(BaseDescription, {\n base: {\n mobileWideDown: {\n display: \"grid\",\n gridTemplateColumns: \"1fr auto\",\n alignItems: \"center\",\n overflow: \"hidden\",\n _open: {\n display: \"inline\",\n },\n },\n },\n});\n\nconst TextContent = styled(\"span\", {\n base: {\n mobileWideDown: {\n whiteSpace: \"nowrap\",\n maxHeight: \"large\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n transitionProperty: \"max-height\",\n transitionDuration: \"slow\",\n transitionTimingFunction: \"ease-in\",\n marginInlineEnd: \"4xsmall\",\n _open: {\n whiteSpace: \"pre-wrap\",\n maxHeight: \"none\",\n },\n },\n },\n});\n\nconst StyledButton = styled(Button, {\n base: {\n mobileWide: {\n display: \"none\",\n },\n },\n});\n\ninterface LicenseDescriptionProps {\n children?: ReactNode;\n isOpen: boolean;\n setIsOpen: Dispatch<SetStateAction<boolean>>;\n}\n\nconst LicenseDescription = ({ children, isOpen, setIsOpen }: LicenseDescriptionProps) => {\n const open = isOpen ? { \"data-open\": \"\" } : {};\n const { t } = useTranslation();\n\n const handleToggle = () => {\n setIsOpen(!isOpen);\n };\n\n return (\n <ContentWrapper>\n <StyledDescription {...open}>\n <TextContent {...open}>{children}</TextContent>\n <StyledButton variant=\"link\" size=\"small\" onClick={handleToggle}>\n {isOpen ? `${t(\"audio.readLessDescriptionLabel\")}` : `${t(\"audio.readMoreDescriptionLabel\")}`}\n </StyledButton>\n </StyledDescription>\n </ContentWrapper>\n );\n};\n\nexport const LicenseContainerContent = ({ children, copyright, type }: LicenseContainerProps) => {\n const { t, i18n } = useTranslation();\n const license = copyright ? getLicenseByAbbreviation(copyright.license?.license ?? \"\", i18n.language) : undefined;\n const authors = getLicenseCredits(copyright);\n const captionAuthors = Object.values(authors).find((i) => i.length > 0) ?? [];\n const [isOpen, setIsOpen] = useState<boolean>(false);\n\n const content = (\n <>\n {children}\n {` ${t(`embed.type.${type}`)}${captionAuthors.length ? \": \" : \"\"}`}\n <span>{captionAuthors.map((author) => author.name).join(\", \")}</span>\n {license ? (\n <>\n {\" / \"}\n {<LicenseLink license={license} hideLink={!isOpen && !!children} />}\n </>\n ) : null}\n </>\n );\n\n if (children) {\n return (\n <LicenseDescription isOpen={isOpen} setIsOpen={setIsOpen}>\n {content}\n </LicenseDescription>\n );\n }\n\n return (\n <Text textStyle=\"label.medium\" asChild consumeCss>\n <span>{content}</span>\n </Text>\n );\n};\n"],"mappings":"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"}
@@ -1,56 +1,31 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
1
  import { forwardRef } from "react";
10
- import { SafeLink } from "@ndla/safelink";
11
2
  import { styled } from "@ndla/styled-system/jsx";
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- const StyledSafeLink = styled(SafeLink, {
14
- base: {
15
- color: "text.link",
16
- textDecoration: "underline",
17
- whiteSpace: "nowrap",
18
- _hover: {
19
- textDecoration: "none"
20
- },
21
- _focusWithin: {
22
- textDecoration: "none"
23
- },
24
- mobileWideDown: {
25
- _disabled: {
26
- display: "none"
27
- }
28
- }
29
- }
3
+ import { SafeLink } from "@ndla/safelink";
4
+ import { jsx } from "react/jsx-runtime";
5
+
6
+ //#region src/LicenseByline/LicenseLink.tsx
7
+ const StyledSafeLink = styled(SafeLink, { base: {
8
+ color: "text.link",
9
+ textDecoration: "underline",
10
+ whiteSpace: "nowrap",
11
+ _hover: { textDecoration: "none" },
12
+ _focusWithin: { textDecoration: "none" },
13
+ mobileWideDown: { _disabled: { display: "none" } }
14
+ } });
15
+ const LicenseLink = forwardRef(({ license, hideLink,...rest }, ref) => {
16
+ const disabled = hideLink ? { "data-disabled": "" } : {};
17
+ if (license.abbreviation === "unknown") return null;
18
+ if (license.url?.length) return /* @__PURE__ */ jsx(StyledSafeLink, {
19
+ to: license.url,
20
+ rel: "license",
21
+ ...disabled,
22
+ ...rest,
23
+ ref,
24
+ children: license.abbreviation
25
+ });
26
+ return /* @__PURE__ */ jsx("span", { children: license.abbreviation });
30
27
  });
31
- export const LicenseLink = /*#__PURE__*/forwardRef((_ref, ref) => {
32
- let {
33
- license,
34
- hideLink,
35
- ...rest
36
- } = _ref;
37
- const disabled = hideLink ? {
38
- "data-disabled": ""
39
- } : {};
40
- if (license.abbreviation === "unknown") {
41
- return null;
42
- }
43
- if (license.url?.length) {
44
- return /*#__PURE__*/_jsx(StyledSafeLink, {
45
- to: license.url,
46
- rel: "license",
47
- ...disabled,
48
- ...rest,
49
- ref: ref,
50
- children: license.abbreviation
51
- });
52
- }
53
- return /*#__PURE__*/_jsx("span", {
54
- children: license.abbreviation
55
- });
56
- });
28
+
29
+ //#endregion
30
+ export { LicenseLink };
31
+ //# sourceMappingURL=LicenseLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LicenseLink.js","names":[],"sources":["../../src/LicenseByline/LicenseLink.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 { forwardRef } from \"react\";\nimport type { LicenseLocaleType } from \"@ndla/licenses\";\nimport { SafeLink, type SafeLinkProps } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\ninterface Props extends Omit<SafeLinkProps, \"to\"> {\n license: LicenseLocaleType;\n hideLink?: boolean;\n}\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n color: \"text.link\",\n textDecoration: \"underline\",\n whiteSpace: \"nowrap\",\n _hover: {\n textDecoration: \"none\",\n },\n _focusWithin: {\n textDecoration: \"none\",\n },\n mobileWideDown: {\n _disabled: {\n display: \"none\",\n },\n },\n },\n});\n\nexport const LicenseLink = forwardRef<HTMLAnchorElement, Props>(({ license, hideLink, ...rest }, ref) => {\n const disabled = hideLink ? { \"data-disabled\": \"\" } : {};\n if (license.abbreviation === \"unknown\") {\n return null;\n }\n if (license.url?.length) {\n return (\n <StyledSafeLink to={license.url} rel=\"license\" {...disabled} {...rest} ref={ref}>\n {license.abbreviation}\n </StyledSafeLink>\n );\n }\n return <span>{license.abbreviation}</span>;\n});\n"],"mappings":";;;;;;AAkBA,MAAM,iBAAiB,OAAO,UAAU,EACtC,MAAM;CACJ,OAAO;CACP,gBAAgB;CAChB,YAAY;CACZ,QAAQ,EACN,gBAAgB,OACjB;CACD,cAAc,EACZ,gBAAgB,OACjB;CACD,gBAAgB,EACd,WAAW,EACT,SAAS,OACV,EACF;AACF,EACF,EAAC;AAEF,MAAa,cAAc,WAAqC,CAAC,EAAE,SAAS,SAAU,GAAG,MAAM,EAAE,QAAQ;CACvG,MAAM,WAAW,WAAW,EAAE,iBAAiB,GAAI,IAAG,CAAE;AACxD,KAAI,QAAQ,iBAAiB,UAC3B,QAAO;AAET,KAAI,QAAQ,KAAK,OACf,wBACE,IAAC;EAAe,IAAI,QAAQ;EAAK,KAAI;EAAU,GAAI;EAAU,GAAI;EAAW;YACzE,QAAQ;GACM;AAGrB,wBAAO,IAAC,oBAAM,QAAQ,eAAoB;AAC3C,EAAC"}
@@ -1,103 +1,74 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import parse from "html-react-parser";
1
+ import { getPossiblyRelativeUrl } from "../utils/relativeUrl.js";
10
2
  import { useMemo } from "react";
11
- import { ArrowRightLine, CalendarLine } from "@ndla/icons";
12
3
  import { Heading } from "@ndla/primitives";
13
- import { SafeLink } from "@ndla/safelink";
14
4
  import { styled } from "@ndla/styled-system/jsx";
15
- import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
16
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
- const InfoWrapper = styled("div", {
18
- base: {
19
- display: "flex",
20
- flexDirection: "column",
21
- gap: "xsmall"
22
- }
23
- });
24
- const StyledSafeLink = styled(SafeLink, {
25
- base: {
26
- display: "flex",
27
- justifyContent: "space-between",
28
- alignItems: "center",
29
- background: "surface.default",
30
- padding: "medium",
31
- border: "1px solid",
32
- borderColor: "stroke.subtle",
33
- borderRadius: "xsmall",
34
- "& h3": {
35
- textDecoration: "underline"
36
- },
37
- "& [data-forward]": {
38
- transitionProperty: "width, height",
39
- transitionTimingFunction: "ease-in-out",
40
- transitionDuration: "fast"
41
- },
42
- _hover: {
43
- "& h3": {
44
- textDecoration: "none"
45
- },
46
- "& [data-forward]": {
47
- width: "large",
48
- height: "large"
49
- }
50
- }
51
- }
52
- });
53
- const StyledDateContainer = styled("div", {
54
- base: {
55
- display: "flex",
56
- alignItems: "center",
57
- gap: "xxsmall"
58
- }
59
- });
60
- const StyledCalendarEd = styled(CalendarLine, {
61
- base: {
62
- color: "icon.strong"
63
- }
64
- });
65
- const LinkBlock = _ref => {
66
- let {
67
- title,
68
- articleLanguage,
69
- date,
70
- url,
71
- path
72
- } = _ref;
73
- const href = getPossiblyRelativeUrl(url, path);
74
- const formattedDate = useMemo(() => {
75
- if (!date) return null;
76
- return new Intl.DateTimeFormat(articleLanguage, {
77
- timeZone: "CET",
78
- day: "2-digit",
79
- month: "long",
80
- year: "numeric"
81
- }).format(new Date(date));
82
- }, [date, articleLanguage]);
83
- return /*#__PURE__*/_jsxs(StyledSafeLink, {
84
- to: href,
85
- "data-embed-type": "link-block",
86
- children: [/*#__PURE__*/_jsxs(InfoWrapper, {
87
- children: [/*#__PURE__*/_jsx(Heading, {
88
- asChild: true,
89
- consumeCss: true,
90
- textStyle: "title.medium",
91
- children: /*#__PURE__*/_jsx("h3", {
92
- "data-heading": true,
93
- children: parse(title)
94
- })
95
- }), !!date && /*#__PURE__*/_jsxs(StyledDateContainer, {
96
- children: [/*#__PURE__*/_jsx(StyledCalendarEd, {}), formattedDate]
97
- })]
98
- }), /*#__PURE__*/_jsx(ArrowRightLine, {
99
- "data-forward": true
100
- })]
101
- });
5
+ import parse from "html-react-parser";
6
+ import { ArrowRightLine, CalendarLine } from "@ndla/icons";
7
+ import { SafeLink } from "@ndla/safelink";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+
10
+ //#region src/LinkBlock/LinkBlock.tsx
11
+ const InfoWrapper = styled("div", { base: {
12
+ display: "flex",
13
+ flexDirection: "column",
14
+ gap: "xsmall"
15
+ } });
16
+ const StyledSafeLink = styled(SafeLink, { base: {
17
+ display: "flex",
18
+ justifyContent: "space-between",
19
+ alignItems: "center",
20
+ background: "surface.default",
21
+ padding: "medium",
22
+ border: "1px solid",
23
+ borderColor: "stroke.subtle",
24
+ borderRadius: "xsmall",
25
+ "& h3": { textDecoration: "underline" },
26
+ "& [data-forward]": {
27
+ transitionProperty: "width, height",
28
+ transitionTimingFunction: "ease-in-out",
29
+ transitionDuration: "fast"
30
+ },
31
+ _hover: {
32
+ "& h3": { textDecoration: "none" },
33
+ "& [data-forward]": {
34
+ width: "large",
35
+ height: "large"
36
+ }
37
+ }
38
+ } });
39
+ const StyledDateContainer = styled("div", { base: {
40
+ display: "flex",
41
+ alignItems: "center",
42
+ gap: "xxsmall"
43
+ } });
44
+ const StyledCalendarEd = styled(CalendarLine, { base: { color: "icon.strong" } });
45
+ const LinkBlock = ({ title, articleLanguage, date, url, path }) => {
46
+ const href = getPossiblyRelativeUrl(url, path);
47
+ const formattedDate = useMemo(() => {
48
+ if (!date) return null;
49
+ return new Intl.DateTimeFormat(articleLanguage, {
50
+ timeZone: "CET",
51
+ day: "2-digit",
52
+ month: "long",
53
+ year: "numeric"
54
+ }).format(new Date(date));
55
+ }, [date, articleLanguage]);
56
+ return /* @__PURE__ */ jsxs(StyledSafeLink, {
57
+ to: href,
58
+ "data-embed-type": "link-block",
59
+ children: [/* @__PURE__ */ jsxs(InfoWrapper, { children: [/* @__PURE__ */ jsx(Heading, {
60
+ asChild: true,
61
+ consumeCss: true,
62
+ textStyle: "title.medium",
63
+ children: /* @__PURE__ */ jsx("h3", {
64
+ "data-heading": true,
65
+ children: parse(title)
66
+ })
67
+ }), !!date && /* @__PURE__ */ jsxs(StyledDateContainer, { children: [/* @__PURE__ */ jsx(StyledCalendarEd, {}), formattedDate] })] }), /* @__PURE__ */ jsx(ArrowRightLine, { "data-forward": true })]
68
+ });
102
69
  };
103
- export default LinkBlock;
70
+ var LinkBlock_default = LinkBlock;
71
+
72
+ //#endregion
73
+ export { LinkBlock_default };
74
+ //# sourceMappingURL=LinkBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkBlock.js","names":[],"sources":["../../src/LinkBlock/LinkBlock.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport parse from \"html-react-parser\";\nimport { useMemo } from \"react\";\nimport { ArrowRightLine, CalendarLine } from \"@ndla/icons\";\nimport { Heading } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { LinkBlockEmbedData } from \"@ndla/types-embed\";\nimport { getPossiblyRelativeUrl } from \"../utils/relativeUrl\";\n\nconst InfoWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n});\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n background: \"surface.default\",\n padding: \"medium\",\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n borderRadius: \"xsmall\",\n \"& h3\": {\n textDecoration: \"underline\",\n },\n \"& [data-forward]\": {\n transitionProperty: \"width, height\",\n transitionTimingFunction: \"ease-in-out\",\n transitionDuration: \"fast\",\n },\n _hover: {\n \"& h3\": {\n textDecoration: \"none\",\n },\n \"& [data-forward]\": {\n width: \"large\",\n height: \"large\",\n },\n },\n },\n});\n\nconst StyledDateContainer = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"xxsmall\",\n },\n});\n\nconst StyledCalendarEd = styled(CalendarLine, {\n base: {\n color: \"icon.strong\",\n },\n});\n\ninterface Props extends Omit<LinkBlockEmbedData, \"resource\"> {\n path?: string;\n articleLanguage?: string;\n}\n\nconst LinkBlock = ({ title, articleLanguage, date, url, path }: Props) => {\n const href = getPossiblyRelativeUrl(url, path);\n const formattedDate = useMemo(() => {\n if (!date) return null;\n return new Intl.DateTimeFormat(articleLanguage, {\n timeZone: \"CET\",\n day: \"2-digit\",\n month: \"long\",\n year: \"numeric\",\n }).format(new Date(date));\n }, [date, articleLanguage]);\n return (\n <StyledSafeLink to={href} data-embed-type=\"link-block\">\n <InfoWrapper>\n <Heading asChild consumeCss textStyle=\"title.medium\">\n <h3 data-heading>{parse(title)}</h3>\n </Heading>\n {!!date && (\n <StyledDateContainer>\n <StyledCalendarEd />\n {formattedDate}\n </StyledDateContainer>\n )}\n </InfoWrapper>\n <ArrowRightLine data-forward />\n </StyledSafeLink>\n );\n};\n\nexport default LinkBlock;\n"],"mappings":";;;;;;;;;;AAiBA,MAAM,cAAc,OAAO,OAAO,EAChC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;AACN,EACF,EAAC;AAEF,MAAM,iBAAiB,OAAO,UAAU,EACtC,MAAM;CACJ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,aAAa;CACb,cAAc;CACd,QAAQ,EACN,gBAAgB,YACjB;CACD,oBAAoB;EAClB,oBAAoB;EACpB,0BAA0B;EAC1B,oBAAoB;CACrB;CACD,QAAQ;EACN,QAAQ,EACN,gBAAgB,OACjB;EACD,oBAAoB;GAClB,OAAO;GACP,QAAQ;EACT;CACF;AACF,EACF,EAAC;AAEF,MAAM,sBAAsB,OAAO,OAAO,EACxC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,KAAK;AACN,EACF,EAAC;AAEF,MAAM,mBAAmB,OAAO,cAAc,EAC5C,MAAM,EACJ,OAAO,cACR,EACF,EAAC;AAOF,MAAM,YAAY,CAAC,EAAE,OAAO,iBAAiB,MAAM,KAAK,MAAa,KAAK;CACxE,MAAM,OAAO,uBAAuB,KAAK,KAAK;CAC9C,MAAM,gBAAgB,QAAQ,MAAM;AAClC,OAAK,KAAM,QAAO;AAClB,SAAO,IAAI,KAAK,eAAe,iBAAiB;GAC9C,UAAU;GACV,KAAK;GACL,OAAO;GACP,MAAM;EACP,GAAE,OAAO,IAAI,KAAK,MAAM;CAC1B,GAAE,CAAC,MAAM,eAAgB,EAAC;AAC3B,wBACE,KAAC;EAAe,IAAI;EAAM,mBAAgB;6BACxC,KAAC,0CACC,IAAC;GAAQ;GAAQ;GAAW,WAAU;6BACpC,IAAC;IAAG;cAAc,MAAM,MAAM;KAAM;IAC5B,IACP,wBACD,KAAC,kDACC,IAAC,qBAAmB,EACnB,iBACmB,IAEZ,kBACd,IAAC,kBAAe,uBAAe;GAChB;AAEpB;AAED,wBAAe"}