@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,184 +1,122 @@
1
- "use strict";
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
+ const react = require_rolldown_runtime.__toESM(require("react"));
3
+ const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
4
+ const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
5
+ const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
6
+ const __ndla_icons = require_rolldown_runtime.__toESM(require("@ndla/icons"));
7
+ const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
2
8
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
9
+ //#region src/FactBox/FactBox.tsx
10
+ const StyledAside = (0, __ndla_styled_system_jsx.styled)("aside", {
11
+ base: {
12
+ position: "relative",
13
+ padding: "medium",
14
+ display: "grid",
15
+ gridTemplateRows: "0fr",
16
+ transitionProperty: "grid-template-rows",
17
+ transitionDuration: "slow",
18
+ transitionTimingFunction: "ease-in-out",
19
+ justifyItems: "center",
20
+ border: "1px solid",
21
+ borderColor: "stroke.default",
22
+ borderRadius: "xsmall",
23
+ clear: "both",
24
+ _open: { gridTemplateRows: "1fr" },
25
+ _closed: { _print: {
26
+ overflow: "visible",
27
+ maxHeight: "500vh"
28
+ } },
29
+ "& > div": { minHeight: "surface.3xsmall" }
30
+ },
31
+ variants: { overflowHidden: { true: { "& > div": { overflow: "hidden" } } } }
5
32
  });
6
- exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactI18next = require("react-i18next");
9
- var _icons = require("@ndla/icons");
10
- var _primitives = require("@ndla/primitives");
11
- var _jsx2 = require("@ndla/styled-system/jsx");
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
- /**
15
- * Copyright (c) 2016-present, NDLA.
16
- *
17
- * This source code is licensed under the GPLv3 license found in the
18
- * LICENSE file in the root directory of this source tree.
19
- *
20
- */
21
-
22
- const StyledAside = (0, _jsx2.styled)("aside", {
23
- base: {
24
- position: "relative",
25
- padding: "medium",
26
- display: "grid",
27
- gridTemplateRows: "0fr",
28
- transitionProperty: "grid-template-rows",
29
- transitionDuration: "slow",
30
- transitionTimingFunction: "ease-in-out",
31
- justifyItems: "center",
32
- border: "1px solid",
33
- borderColor: "stroke.default",
34
- borderRadius: "xsmall",
35
- clear: "both",
36
- _open: {
37
- gridTemplateRows: "1fr"
38
- },
39
- _closed: {
40
- _print: {
41
- overflow: "visible",
42
- maxHeight: "500vh"
43
- }
44
- },
45
- "& > div": {
46
- minHeight: "surface.3xsmall"
47
- }
48
- },
49
- variants: {
50
- overflowHidden: {
51
- true: {
52
- "& > div": {
53
- overflow: "hidden"
54
- }
55
- }
56
- }
57
- }
58
- });
59
- const StyledContent = (0, _jsx2.styled)("div", {
60
- base: {
61
- position: "relative",
62
- width: "100%",
63
- // Reset the top margin of the very first child.
64
- "& :first-child": {
65
- marginBlockStart: "0"
66
- },
67
- _after: {
68
- content: '""',
69
- textAlign: "center",
70
- position: "absolute",
71
- inset: "0",
72
- transitionProperty: "opacity",
73
- transitionDuration: "slow",
74
- transitionTimingFunction: "ease-in-out",
75
- gradientFrom: "surface.default/20",
76
- gradientTo: "surface.default/95",
77
- backgroundGradient: "to-b",
78
- opacity: "1",
79
- zIndex: "base",
80
- pointerEvents: "none"
81
- },
82
- _print: {
83
- overflow: "visible",
84
- _after: {
85
- display: "none"
86
- }
87
- },
88
- _open: {
89
- paddingBlockEnd: "xsmall",
90
- _after: {
91
- opacity: "0"
92
- }
93
- }
94
- }
95
- });
96
- const StyledIconButton = (0, _jsx2.styled)(_primitives.IconButton, {
97
- base: {
98
- position: "absolute",
99
- bottom: "-medium",
100
- zIndex: "base",
101
- "& svg": {
102
- transitionProperty: "transform",
103
- transitionTimingFunction: "ease-in-out",
104
- transitionDuration: "fast"
105
- },
106
- _open: {
107
- "& svg": {
108
- transform: "rotate(180deg)"
109
- }
110
- },
111
- _print: {
112
- display: "none"
113
- }
114
- }
33
+ const StyledContent = (0, __ndla_styled_system_jsx.styled)("div", { base: {
34
+ position: "relative",
35
+ width: "100%",
36
+ "& :first-child": { marginBlockStart: "0" },
37
+ _after: {
38
+ content: "\"\"",
39
+ textAlign: "center",
40
+ position: "absolute",
41
+ inset: "0",
42
+ transitionProperty: "opacity",
43
+ transitionDuration: "slow",
44
+ transitionTimingFunction: "ease-in-out",
45
+ gradientFrom: "surface.default/20",
46
+ gradientTo: "surface.default/95",
47
+ backgroundGradient: "to-b",
48
+ opacity: "1",
49
+ zIndex: "base",
50
+ pointerEvents: "none"
51
+ },
52
+ _print: {
53
+ overflow: "visible",
54
+ _after: { display: "none" }
55
+ },
56
+ _open: {
57
+ paddingBlockEnd: "xsmall",
58
+ _after: { opacity: "0" }
59
+ }
60
+ } });
61
+ const StyledIconButton = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.IconButton, { base: {
62
+ position: "absolute",
63
+ bottom: "-medium",
64
+ zIndex: "base",
65
+ "& svg": {
66
+ transitionProperty: "transform",
67
+ transitionTimingFunction: "ease-in-out",
68
+ transitionDuration: "fast"
69
+ },
70
+ _open: { "& svg": { transform: "rotate(180deg)" } },
71
+ _print: { display: "none" }
72
+ } });
73
+ const FactBox = (0, react.forwardRef)(({ children, open, onOpenChange, defaultOpen = false,...rest }, ref) => {
74
+ const { t } = (0, react_i18next.useTranslation)();
75
+ const [state, setState] = (0, react.useState)(defaultOpen ? "open" : "closed");
76
+ const [overflowHidden, setOverflowHidden] = (0, react.useState)(!defaultOpen);
77
+ const contentId = (0, react.useId)();
78
+ const inertAttribute = (0, react.useMemo)(() => {
79
+ return state === "closed" ? { inert: typeof react.default.use === "function" ? true : "" } : {};
80
+ }, [state]);
81
+ (0, react.useEffect)(() => {
82
+ if (open !== void 0) setState(open ? "open" : "closed");
83
+ }, [open]);
84
+ const onClick = (0, react.useCallback)(() => {
85
+ const newState = state === "open" ? "closed" : "open";
86
+ setState(newState);
87
+ onOpenChange?.(newState === "open");
88
+ }, [state, onOpenChange]);
89
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledAside, {
90
+ "data-state": state,
91
+ "data-embed-type": "factbox",
92
+ ...rest,
93
+ ref,
94
+ overflowHidden,
95
+ onTransitionStart: (e) => {
96
+ if (e.target === e.currentTarget && state === "closed") setOverflowHidden(true);
97
+ },
98
+ onTransitionEnd: (e) => {
99
+ if (e.target === e.currentTarget && state === "open") setOverflowHidden(false);
100
+ },
101
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledIconButton, {
102
+ "data-state": state,
103
+ onClick,
104
+ contentEditable: false,
105
+ "aria-expanded": state === "open",
106
+ "aria-controls": contentId,
107
+ "aria-label": t(`factbox.${state === "open" ? "close" : "open"}`),
108
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_icons.ArrowDownShortLine, {})
109
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledContent, {
110
+ id: contentId,
111
+ "data-state": state,
112
+ "aria-hidden": state === "closed",
113
+ ...inertAttribute,
114
+ children
115
+ })]
116
+ });
115
117
  });
118
+ var FactBox_default = FactBox;
116
119
 
117
- // TODO: Consider moving the open trigger depending on whether the content is open or closed.
118
-
119
- const FactBox = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
120
- let {
121
- children,
122
- open,
123
- onOpenChange,
124
- defaultOpen = false,
125
- ...rest
126
- } = _ref;
127
- const {
128
- t
129
- } = (0, _reactI18next.useTranslation)();
130
- const [state, setState] = (0, _react.useState)(defaultOpen ? "open" : "closed");
131
- const [overflowHidden, setOverflowHidden] = (0, _react.useState)(!defaultOpen);
132
- const contentId = (0, _react.useId)();
133
- // 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.
134
- // When running in React 18, we need to use an empty string instead of true.
135
- // TODO: Remove this hack once we upgrade to React 19 as a peer dep.
136
- const inertAttribute = (0, _react.useMemo)(() => {
137
- return state === "closed" ? {
138
- inert: typeof _react.default.use === "function" ? true : ""
139
- } : {};
140
- }, [state]);
141
- (0, _react.useEffect)(() => {
142
- if (open !== undefined) {
143
- setState(open ? "open" : "closed");
144
- }
145
- }, [open]);
146
- const onClick = (0, _react.useCallback)(() => {
147
- const newState = state === "open" ? "closed" : "open";
148
- setState(newState);
149
- onOpenChange?.(newState === "open");
150
- }, [state, onOpenChange]);
151
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledAside, {
152
- "data-state": state,
153
- "data-embed-type": "factbox",
154
- ...rest,
155
- ref: ref,
156
- overflowHidden: overflowHidden,
157
- onTransitionStart: e => {
158
- if (e.target === e.currentTarget && state === "closed") {
159
- setOverflowHidden(true);
160
- }
161
- },
162
- onTransitionEnd: e => {
163
- if (e.target === e.currentTarget && state === "open") {
164
- setOverflowHidden(false);
165
- }
166
- },
167
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StyledIconButton, {
168
- "data-state": state,
169
- onClick: onClick,
170
- contentEditable: false,
171
- "aria-expanded": state === "open",
172
- "aria-controls": contentId,
173
- "aria-label": t(`factbox.${state === "open" ? "close" : "open"}`),
174
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ArrowDownShortLine, {})
175
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledContent, {
176
- id: contentId,
177
- "data-state": state,
178
- "aria-hidden": state === "closed",
179
- ...inertAttribute,
180
- children: children
181
- })]
182
- });
183
- });
184
- var _default = exports.default = FactBox;
120
+ //#endregion
121
+ exports.FactBox_default = FactBox_default;
122
+ //# sourceMappingURL=FactBox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FactBox.js","names":["IconButton","React","ArrowDownShortLine"],"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,qCAAO,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,qCAAO,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,qCAAOA,8BAAY,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,sBACd,CAAC,EAAE,UAAU,MAAM,cAAc,cAAc,MAAO,GAAG,MAAM,EAAE,QAAQ;CACvE,MAAM,EAAE,GAAG,GAAG,mCAAgB;CAC9B,MAAM,CAAC,OAAO,SAAS,GAAG,oBAA4B,cAAc,SAAS,SAAS;CACtF,MAAM,CAAC,gBAAgB,kBAAkB,GAAG,qBAAU,YAAY;CAClE,MAAM,YAAY,kBAAO;CAIzB,MAAM,iBAAiB,mBAAQ,MAAM;AACnC,SAAO,UAAU,WAAW,EAAE,cAAcC,cAAM,QAAQ,aAAa,OAAO,GAAI,IAAG,CAAE;CACxF,GAAE,CAAC,KAAM,EAAC;AAEX,sBAAU,MAAM;AACd,MAAI,gBACF,UAAS,OAAO,SAAS,SAAS;CAErC,GAAE,CAAC,IAAK,EAAC;CAEV,MAAM,UAAU,uBAAY,MAAM;EAChC,MAAM,WAAW,UAAU,SAAS,WAAW;AAC/C,WAAS,SAAS;AAClB,iBAAe,aAAa,OAAO;CACpC,GAAE,CAAC,OAAO,YAAa,EAAC;AAEzB,wBACE,4BAAC;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,2BAAC;GACC,cAAY;GACH;GACT,iBAAiB;GACjB,iBAAe,UAAU;GACzB,iBAAe;GACf,cAAY,GAAG,UAAU,UAAU,SAAS,UAAU,OAAO,EAAE;6BAE/D,2BAACC,oCAAqB;IACL,kBACnB,2BAAC;GAAc,IAAI;GAAW,cAAY;GAAO,eAAa,UAAU;GAAU,GAAI;GACnF;IACa;GACJ;AAEjB,EACF;AAED,sBAAe"}
@@ -1,16 +1,8 @@
1
- "use strict";
1
+ const require_FactBox = require('./FactBox.js');
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _FactBox = _interopRequireDefault(require("./FactBox"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- /**
10
- * Copyright (c) 2018-present, NDLA.
11
- *
12
- * This source code is licensed under the GPLv3 license found in the
13
- * LICENSE file in the root directory of this source tree.
14
- *
15
- */
16
- var _default = exports.default = _FactBox.default;
3
+ //#region src/FactBox/index.ts
4
+ var FactBox_default$1 = require_FactBox.FactBox_default;
5
+
6
+ //#endregion
7
+ exports.FactBox_default = FactBox_default$1;
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"}
@@ -1,108 +1,78 @@
1
- "use strict";
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
+ const require_FileList = require('./FileList.js');
3
+ const react = require_rolldown_runtime.__toESM(require("react"));
4
+ const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
5
+ const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
6
+ const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
7
+ const __ndla_icons = require_rolldown_runtime.__toESM(require("@ndla/icons"));
8
+ const __ndla_safelink = require_rolldown_runtime.__toESM(require("@ndla/safelink"));
9
+ const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
10
+ const __ndla_styled_system_patterns = require_rolldown_runtime.__toESM(require("@ndla/styled-system/patterns"));
2
11
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
12
+ //#region src/FileList/File.tsx
13
+ const StyledSafeLink = (0, __ndla_styled_system_jsx.styled)(__ndla_safelink.SafeLink, { base: {
14
+ textUnderlineOffset: "2px",
15
+ textDecoration: "underline",
16
+ _hover: { textDecoration: "none" }
17
+ } });
18
+ const StyledHStack = (0, __ndla_styled_system_jsx.styled)(__ndla_styled_system_jsx.HStack, { base: {
19
+ position: "relative",
20
+ paddingBlock: "small",
21
+ paddingInlineEnd: "medium",
22
+ paddingInlineStart: "small",
23
+ width: "100%"
24
+ } });
25
+ const File = (0, react.forwardRef)(({ title, url, fileExists, fileType, fileSize,...rest }, ref) => {
26
+ const { t } = (0, react_i18next.useTranslation)();
27
+ const filename = `${title}-${url.split("/").pop() ?? ""}`;
28
+ const downloadUrl = `${url}?download=${filename}`;
29
+ const tooltip = `${t("download")} ${filename}`;
30
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledHStack, {
31
+ justify: "space-between",
32
+ ref,
33
+ ...rest,
34
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__ndla_styled_system_jsx.HStack, {
35
+ gap: "xxsmall",
36
+ children: [
37
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_icons.DownloadLine, {}),
38
+ fileExists ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledSafeLink, {
39
+ unstyled: true,
40
+ css: __ndla_styled_system_patterns.linkOverlay.raw(),
41
+ to: downloadUrl,
42
+ title: tooltip,
43
+ children: title
44
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
45
+ textStyle: "label.medium",
46
+ children: title
47
+ }),
48
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
49
+ textStyle: "label.large",
50
+ asChild: true,
51
+ consumeCss: true,
52
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
53
+ "(",
54
+ fileType?.toUpperCase(),
55
+ ")"
56
+ ] })
57
+ })
58
+ ]
59
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
60
+ textStyle: "label.large",
61
+ asChild: true,
62
+ consumeCss: true,
63
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: fileSize })
64
+ })]
65
+ });
5
66
  });
6
- exports.FileListElement = exports.File = void 0;
7
- var _react = require("react");
8
- var _reactI18next = require("react-i18next");
9
- var _icons = require("@ndla/icons");
10
- var _primitives = require("@ndla/primitives");
11
- var _safelink = require("@ndla/safelink");
12
- var _jsx2 = require("@ndla/styled-system/jsx");
13
- var _patterns = require("@ndla/styled-system/patterns");
14
- var _ = require(".");
15
- var _jsxRuntime = require("react/jsx-runtime");
16
- /**
17
- * Copyright (c) 2023-present, NDLA.
18
- *
19
- * This source code is licensed under the GPLv3 license found in the
20
- * LICENSE file in the root directory of this source tree.
21
- *
22
- */
67
+ const FileListElement = ({ title, url, fileExists, fileType, fileSize }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FileList.FileListItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(File, {
68
+ title,
69
+ url,
70
+ fileExists,
71
+ fileType,
72
+ fileSize
73
+ }) });
23
74
 
24
- const StyledSafeLink = (0, _jsx2.styled)(_safelink.SafeLink, {
25
- base: {
26
- textUnderlineOffset: "2px",
27
- textDecoration: "underline",
28
- _hover: {
29
- textDecoration: "none"
30
- }
31
- }
32
- });
33
- const StyledHStack = (0, _jsx2.styled)(_jsx2.HStack, {
34
- base: {
35
- position: "relative",
36
- paddingBlock: "small",
37
- paddingInlineEnd: "medium",
38
- paddingInlineStart: "small",
39
- width: "100%"
40
- }
41
- });
42
- const File = exports.File = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
43
- let {
44
- title,
45
- url,
46
- fileExists,
47
- fileType,
48
- fileSize,
49
- ...rest
50
- } = _ref;
51
- const {
52
- t
53
- } = (0, _reactI18next.useTranslation)();
54
- const filename = `${title}-${url.split("/").pop() ?? ""}`;
55
- const downloadUrl = `${url}?download=${filename}`;
56
- const tooltip = `${t("download")} ${filename}`;
57
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledHStack, {
58
- justify: "space-between",
59
- ref: ref,
60
- ...rest,
61
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsx2.HStack, {
62
- gap: "xxsmall",
63
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.DownloadLine, {}), fileExists ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSafeLink, {
64
- unstyled: true,
65
- css: _patterns.linkOverlay.raw(),
66
- to: downloadUrl,
67
- title: tooltip,
68
- children: title
69
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
70
- textStyle: "label.medium",
71
- children: title
72
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
73
- textStyle: "label.large",
74
- asChild: true,
75
- consumeCss: true,
76
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
77
- children: ["(", fileType?.toUpperCase(), ")"]
78
- })
79
- })]
80
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
81
- textStyle: "label.large",
82
- asChild: true,
83
- consumeCss: true,
84
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
85
- children: fileSize
86
- })
87
- })]
88
- });
89
- });
90
- const FileListElement = _ref2 => {
91
- let {
92
- title,
93
- url,
94
- fileExists,
95
- fileType,
96
- fileSize
97
- } = _ref2;
98
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.FileListItem, {
99
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(File, {
100
- title: title,
101
- url: url,
102
- fileExists: fileExists,
103
- fileType: fileType,
104
- fileSize: fileSize
105
- })
106
- });
107
- };
108
- exports.FileListElement = FileListElement;
75
+ //#endregion
76
+ exports.File = File;
77
+ exports.FileListElement = FileListElement;
78
+ //# sourceMappingURL=File.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"File.js","names":["SafeLink","HStack","DownloadLine","Text","FileListItem"],"sources":["../../src/FileList/File.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { 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,qCAAOA,0BAAU,EACtC,MAAM;CACJ,qBAAqB;CACrB,gBAAgB;CAChB,QAAQ,EACN,gBAAgB,OACjB;AACF,EACF,EAAC;AAEF,MAAM,eAAe,qCAAOC,iCAAQ,EAClC,MAAM;CACJ,UAAU;CACV,cAAc;CACd,kBAAkB;CAClB,oBAAoB;CACpB,OAAO;AACR,EACF,EAAC;AAEF,MAAa,OAAO,sBAClB,CAAC,EAAE,OAAO,KAAK,YAAY,UAAU,SAAU,GAAG,MAAM,EAAE,QAAQ;CAChE,MAAM,EAAE,GAAG,GAAG,mCAAgB;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,4BAAC;EAAa,SAAQ;EAAqB;EAAK,GAAI;6BAClD,4BAACA;GAAO,KAAI;;oBACV,2BAACC,8BAAe;IACf,6BACC,2BAAC;KAAe;KAAS,KAAK,0CAAY,KAAK;KAAE,IAAI;KAAa,OAAO;eACtE;MACc,mBAEjB,2BAACC;KAAK,WAAU;eAAgB;MAAa;oBAE/C,2BAACA;KAAK,WAAU;KAAc;KAAQ;+BACpC,4BAAC;MAAK;MAAE,UAAU,aAAa;MAAC;SAAQ;MACnC;;IACA,kBACT,2BAACA;GAAK,WAAU;GAAc;GAAQ;6BACpC,2BAAC,oBAAM,WAAgB;IAClB;GACM;AAElB,EACF;AAED,MAAa,kBAAkB,CAAC,EAAE,OAAO,KAAK,YAAY,UAAU,UAAqB,qBACvF,2BAACC,2DACC,2BAAC;CAAY;CAAY;CAAiB;CAAsB;CAAoB;EAAY,GACnF"}
@@ -1,54 +1,35 @@
1
- "use strict";
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
+ const react = require_rolldown_runtime.__toESM(require("react"));
3
+ const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
4
+ const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
5
+ const __ark_ui_react = require_rolldown_runtime.__toESM(require("@ark-ui/react"));
2
6
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.FileListWrapper = exports.FileListItem = exports.FileListEmbed = void 0;
7
- var _react = require("@ark-ui/react");
8
- var _jsx2 = require("@ndla/styled-system/jsx");
9
- var _jsxRuntime = require("react/jsx-runtime");
10
- /**
11
- * Copyright (c) 2023-present, NDLA.
12
- *
13
- * This source code is licensed under the GPLv3 license found in the
14
- * LICENSE file in the root directory of this source tree.
15
- *
16
- */
17
-
18
- const FileListWrapper = exports.FileListWrapper = (0, _jsx2.styled)(_react.ark.ul, {
19
- base: {
20
- display: "flex",
21
- flexDirection: "column",
22
- gap: "xsmall",
23
- clear: "both"
24
- }
25
- }, {
26
- baseComponent: true
27
- });
28
- const FileListItem = exports.FileListItem = (0, _jsx2.styled)(_react.ark.li, {
29
- base: {
30
- listStyle: "none",
31
- background: "surface.infoSubtle",
32
- borderBlockEnd: "1px solid",
33
- borderColor: "stroke.default",
34
- display: "flex",
35
- justifyContent: "space-between",
36
- _hover: {
37
- backgroundColor: "surface.infoSubtle.hover"
38
- }
39
- }
40
- }, {
41
- baseComponent: true
42
- });
43
- const FileListEmbed = _ref => {
44
- let {
45
- children,
46
- ...rest
47
- } = _ref;
48
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(FileListWrapper, {
49
- ...rest,
50
- "data-embed-type": "file-list",
51
- children: children
52
- });
7
+ //#region src/FileList/FileList.tsx
8
+ const FileListWrapper = (0, __ndla_styled_system_jsx.styled)(__ark_ui_react.ark.ul, { base: {
9
+ display: "flex",
10
+ flexDirection: "column",
11
+ gap: "xsmall",
12
+ clear: "both"
13
+ } }, { baseComponent: true });
14
+ const FileListItem = (0, __ndla_styled_system_jsx.styled)(__ark_ui_react.ark.li, { base: {
15
+ listStyle: "none",
16
+ background: "surface.infoSubtle",
17
+ borderBlockEnd: "1px solid",
18
+ borderColor: "stroke.default",
19
+ display: "flex",
20
+ justifyContent: "space-between",
21
+ _hover: { backgroundColor: "surface.infoSubtle.hover" }
22
+ } }, { baseComponent: true });
23
+ const FileListEmbed = ({ children,...rest }) => {
24
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileListWrapper, {
25
+ ...rest,
26
+ "data-embed-type": "file-list",
27
+ children
28
+ });
53
29
  };
54
- exports.FileListEmbed = FileListEmbed;
30
+
31
+ //#endregion
32
+ exports.FileListEmbed = FileListEmbed;
33
+ exports.FileListItem = FileListItem;
34
+ exports.FileListWrapper = FileListWrapper;
35
+ //# sourceMappingURL=FileList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileList.js","names":["ark"],"sources":["../../src/FileList/FileList.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { 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,qCAC7BA,mBAAI,IACJ,EACE,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,OAAO;AACR,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,eAAe,qCAC1BA,mBAAI,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,2BAAC;EAAgB,GAAI;EAAM,mBAAgB;EACxC;GACe;AAErB"}