@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,99 +1,74 @@
1
- /**
2
- * Copyright (c) 2022-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 { breakpoints } from "@ndla/core";
10
- import { ShareBoxLine } from "@ndla/icons";
11
1
  import { Heading, Image, Text } from "@ndla/primitives";
12
- import { SafeLinkButton } from "@ndla/safelink";
13
2
  import { styled } from "@ndla/styled-system/jsx";
14
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
- const Container = styled("div", {
16
- base: {
17
- display: "flex",
18
- padding: "medium",
19
- borderRadius: "xsmall",
20
- border: "1px solid",
21
- borderColor: "stroke.default",
22
- boxShadow: "full",
23
- marginBlockEnd: "medium",
24
- gap: "medium",
25
- tabletWideDown: {
26
- padding: "xsmall"
27
- },
28
- tabletDown: {
29
- flexDirection: "column",
30
- gap: "0",
31
- padding: "0"
32
- }
33
- }
34
- });
35
- const ContentWrapper = styled("div", {
36
- base: {
37
- display: "flex",
38
- flexDirection: "column",
39
- alignItems: "flex-start",
40
- gap: "xsmall",
41
- flex: "1",
42
- tabletDown: {
43
- padding: "xsmall"
44
- }
45
- }
46
- });
47
- const StyledImage = styled(Image, {
48
- base: {
49
- objectFit: "cover",
50
- borderRadius: "xsmall",
51
- width: "fit-content",
52
- aspectRatio: "1/1",
53
- tabletDown: {
54
- width: "100%",
55
- borderRadius: "0"
56
- }
57
- }
58
- });
59
- const StyledText = styled(Text, {
60
- base: {
61
- flex: "1"
62
- }
63
- });
64
- export const ResourceBox = _ref => {
65
- let {
66
- image,
67
- title,
68
- caption,
69
- url,
70
- buttonText
71
- } = _ref;
72
- return /*#__PURE__*/_jsxs(Container, {
73
- children: [image ? /*#__PURE__*/_jsx(StyledImage, {
74
- src: image.src,
75
- alt: image.alt,
76
- sizes: `(min-width: ${breakpoints.desktop}) 150px, (max-width: ${breakpoints.tablet} ) 400px, 200px`,
77
- variant: "rounded"
78
- }) : null, /*#__PURE__*/_jsxs(ContentWrapper, {
79
- children: [/*#__PURE__*/_jsx(Heading, {
80
- textStyle: "label.large",
81
- fontWeight: "bold",
82
- asChild: true,
83
- consumeCss: true,
84
- children: /*#__PURE__*/_jsx("h3", {
85
- children: title
86
- })
87
- }), /*#__PURE__*/_jsx(StyledText, {
88
- textStyle: "body.medium",
89
- children: caption
90
- }), /*#__PURE__*/_jsxs(SafeLinkButton, {
91
- to: url,
92
- target: "_blank",
93
- variant: "secondary",
94
- children: [buttonText, /*#__PURE__*/_jsx(ShareBoxLine, {})]
95
- })]
96
- })]
97
- });
3
+ import { ShareBoxLine } from "@ndla/icons";
4
+ import { SafeLinkButton } from "@ndla/safelink";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { breakpoints } from "@ndla/core";
7
+
8
+ //#region src/ResourceBox/ResourceBox.tsx
9
+ const Container = styled("div", { base: {
10
+ display: "flex",
11
+ padding: "medium",
12
+ borderRadius: "xsmall",
13
+ border: "1px solid",
14
+ borderColor: "stroke.default",
15
+ boxShadow: "full",
16
+ marginBlockEnd: "medium",
17
+ gap: "medium",
18
+ tabletWideDown: { padding: "xsmall" },
19
+ tabletDown: {
20
+ flexDirection: "column",
21
+ gap: "0",
22
+ padding: "0"
23
+ }
24
+ } });
25
+ const ContentWrapper = styled("div", { base: {
26
+ display: "flex",
27
+ flexDirection: "column",
28
+ alignItems: "flex-start",
29
+ gap: "xsmall",
30
+ flex: "1",
31
+ tabletDown: { padding: "xsmall" }
32
+ } });
33
+ const StyledImage = styled(Image, { base: {
34
+ objectFit: "cover",
35
+ borderRadius: "xsmall",
36
+ width: "fit-content",
37
+ aspectRatio: "1/1",
38
+ tabletDown: {
39
+ width: "100%",
40
+ borderRadius: "0"
41
+ }
42
+ } });
43
+ const StyledText = styled(Text, { base: { flex: "1" } });
44
+ const ResourceBox = ({ image, title, caption, url, buttonText }) => {
45
+ return /* @__PURE__ */ jsxs(Container, { children: [image ? /* @__PURE__ */ jsx(StyledImage, {
46
+ src: image.src,
47
+ alt: image.alt,
48
+ sizes: `(min-width: ${breakpoints.desktop}) 150px, (max-width: ${breakpoints.tablet} ) 400px, 200px`,
49
+ variant: "rounded"
50
+ }) : null, /* @__PURE__ */ jsxs(ContentWrapper, { children: [
51
+ /* @__PURE__ */ jsx(Heading, {
52
+ textStyle: "label.large",
53
+ fontWeight: "bold",
54
+ asChild: true,
55
+ consumeCss: true,
56
+ children: /* @__PURE__ */ jsx("h3", { children: title })
57
+ }),
58
+ /* @__PURE__ */ jsx(StyledText, {
59
+ textStyle: "body.medium",
60
+ children: caption
61
+ }),
62
+ /* @__PURE__ */ jsxs(SafeLinkButton, {
63
+ to: url,
64
+ target: "_blank",
65
+ variant: "secondary",
66
+ children: [buttonText, /* @__PURE__ */ jsx(ShareBoxLine, {})]
67
+ })
68
+ ] })] });
98
69
  };
99
- export default ResourceBox;
70
+ var ResourceBox_default = ResourceBox;
71
+
72
+ //#endregion
73
+ export { ResourceBox_default };
74
+ //# sourceMappingURL=ResourceBox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceBox.js","names":[],"sources":["../../src/ResourceBox/ResourceBox.tsx"],"sourcesContent":["/**\n * Copyright (c) 2022-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { breakpoints } from \"@ndla/core\";\nimport { ShareBoxLine } from \"@ndla/icons\";\nimport { Heading, Image, Text } from \"@ndla/primitives\";\nimport { SafeLinkButton } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst Container = styled(\"div\", {\n base: {\n display: \"flex\",\n padding: \"medium\",\n borderRadius: \"xsmall\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n boxShadow: \"full\",\n marginBlockEnd: \"medium\",\n gap: \"medium\",\n tabletWideDown: {\n padding: \"xsmall\",\n },\n tabletDown: {\n flexDirection: \"column\",\n gap: \"0\",\n padding: \"0\",\n },\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n gap: \"xsmall\",\n flex: \"1\",\n tabletDown: {\n padding: \"xsmall\",\n },\n },\n});\n\nconst StyledImage = styled(Image, {\n base: {\n objectFit: \"cover\",\n borderRadius: \"xsmall\",\n width: \"fit-content\",\n aspectRatio: \"1/1\",\n tabletDown: {\n width: \"100%\",\n borderRadius: \"0\",\n },\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n flex: \"1\",\n },\n});\n\ninterface ImageMeta {\n src: string | undefined;\n alt: string;\n}\n\ninterface Props {\n image?: ImageMeta;\n title: string;\n caption: string;\n url: string;\n buttonText: string;\n}\n\nexport const ResourceBox = ({ image, title, caption, url, buttonText }: Props) => {\n return (\n <Container>\n {image ? (\n <StyledImage\n src={image.src}\n alt={image.alt}\n sizes={`(min-width: ${breakpoints.desktop}) 150px, (max-width: ${breakpoints.tablet} ) 400px, 200px`}\n variant=\"rounded\"\n />\n ) : null}\n <ContentWrapper>\n <Heading textStyle=\"label.large\" fontWeight=\"bold\" asChild consumeCss>\n <h3>{title}</h3>\n </Heading>\n <StyledText textStyle=\"body.medium\">{caption}</StyledText>\n <SafeLinkButton to={url} target=\"_blank\" variant=\"secondary\">\n {buttonText}\n <ShareBoxLine />\n </SafeLinkButton>\n </ContentWrapper>\n </Container>\n );\n};\n\nexport default ResourceBox;\n"],"mappings":";;;;;;;;AAcA,MAAM,YAAY,OAAO,OAAO,EAC9B,MAAM;CACJ,SAAS;CACT,SAAS;CACT,cAAc;CACd,QAAQ;CACR,aAAa;CACb,WAAW;CACX,gBAAgB;CAChB,KAAK;CACL,gBAAgB,EACd,SAAS,SACV;CACD,YAAY;EACV,eAAe;EACf,KAAK;EACL,SAAS;CACV;AACF,EACF,EAAC;AAEF,MAAM,iBAAiB,OAAO,OAAO,EACnC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,YAAY;CACZ,KAAK;CACL,MAAM;CACN,YAAY,EACV,SAAS,SACV;AACF,EACF,EAAC;AAEF,MAAM,cAAc,OAAO,OAAO,EAChC,MAAM;CACJ,WAAW;CACX,cAAc;CACd,OAAO;CACP,aAAa;CACb,YAAY;EACV,OAAO;EACP,cAAc;CACf;AACF,EACF,EAAC;AAEF,MAAM,aAAa,OAAO,MAAM,EAC9B,MAAM,EACJ,MAAM,IACP,EACF,EAAC;AAeF,MAAa,cAAc,CAAC,EAAE,OAAO,OAAO,SAAS,KAAK,YAAmB,KAAK;AAChF,wBACE,KAAC,wBACE,wBACC,IAAC;EACC,KAAK,MAAM;EACX,KAAK,MAAM;EACX,QAAQ,cAAc,YAAY,QAAQ,uBAAuB,YAAY,OAAO;EACpF,SAAQ;GACR,GACA,sBACJ,KAAC;kBACC,IAAC;GAAQ,WAAU;GAAc,YAAW;GAAO;GAAQ;6BACzD,IAAC,kBAAI,QAAW;IACR;kBACV,IAAC;GAAW,WAAU;aAAe;IAAqB;kBAC1D,KAAC;GAAe,IAAI;GAAK,QAAO;GAAS,SAAQ;cAC9C,4BACD,IAAC,iBAAe;IACD;KACF,IACP;AAEf;AAED,0BAAe"}
@@ -1,143 +1,100 @@
1
- /**
2
- * Copyright (c) 2024-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, useEffect, useId, useRef } from "react";
10
- import { useTagsInputContext, useComboboxContext } from "@ark-ui/react";
2
+ import { ComboboxClearTrigger, ComboboxControl, ComboboxInput, ComboboxLabel, ComboboxRoot, ComboboxTrigger, TagsInputControl, TagsInputInput, TagsInputItem, TagsInputItemDeleteTrigger, TagsInputItemInput, TagsInputItemPreview, TagsInputItemText, TagsInputRoot } from "@ndla/primitives";
11
3
  import { CloseLine } from "@ndla/icons";
12
- import { ComboboxClearTrigger, ComboboxControl, ComboboxInput, ComboboxLabel, ComboboxRoot, ComboboxTrigger, TagsInputControl, TagsInputInput, TagsInputItem, TagsInputItemDeleteTrigger, TagsInputItemPreview, TagsInputItemText, TagsInputRoot, TagsInputItemInput } from "@ndla/primitives";
4
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
5
  import { contains } from "@ndla/util";
14
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
15
- export const TagSelectorRoot = _ref => {
16
- let {
17
- allowCustomValue = true,
18
- multiple = true,
19
- selectionBehavior = "clear",
20
- editable,
21
- addOnPaste = false,
22
- onValueChange,
23
- children,
24
- value,
25
- translations,
26
- ...rest
27
- } = _ref;
28
- const ids = {
29
- root: useId(),
30
- input: useId(),
31
- control: useId()
32
- };
33
- const controlRef = useRef(undefined);
34
- useEffect(() => {
35
- if (!controlRef.current) {
36
- controlRef.current = document.getElementById(ids.control);
37
- }
38
- }, [ids.control]);
39
- return /*#__PURE__*/_jsx(ComboboxRoot, {
40
- ids: ids,
41
- asChild: true,
42
- allowCustomValue: allowCustomValue,
43
- multiple: multiple,
44
- selectionBehavior: selectionBehavior,
45
- onValueChange: onValueChange,
46
- translations: translations,
47
- onPointerDownOutside: event => {
48
- if (contains(controlRef.current, event.detail.originalEvent.target)) {
49
- event.preventDefault();
50
- }
51
- },
52
- value: value,
53
- ...rest,
54
- children: /*#__PURE__*/_jsx(TagSelectorTagsInputRoot, {
55
- ids: ids,
56
- value: value,
57
- editable: editable,
58
- onValueChange: onValueChange,
59
- addOnPaste: addOnPaste,
60
- translations: translations,
61
- children: children
62
- })
63
- });
6
+ import { useComboboxContext, useTagsInputContext } from "@ark-ui/react";
7
+
8
+ //#region src/TagSelector/TagSelector.tsx
9
+ const TagSelectorRoot = ({ allowCustomValue = true, multiple = true, selectionBehavior = "clear", editable, addOnPaste = false, onValueChange, children, value, translations,...rest }) => {
10
+ const ids = {
11
+ root: useId(),
12
+ input: useId(),
13
+ control: useId()
14
+ };
15
+ const controlRef = useRef(void 0);
16
+ useEffect(() => {
17
+ if (!controlRef.current) controlRef.current = document.getElementById(ids.control);
18
+ }, [ids.control]);
19
+ return /* @__PURE__ */ jsx(ComboboxRoot, {
20
+ ids,
21
+ asChild: true,
22
+ allowCustomValue,
23
+ multiple,
24
+ selectionBehavior,
25
+ onValueChange,
26
+ translations,
27
+ onPointerDownOutside: (event) => {
28
+ if (contains(controlRef.current, event.detail.originalEvent.target)) event.preventDefault();
29
+ },
30
+ value,
31
+ ...rest,
32
+ children: /* @__PURE__ */ jsx(TagSelectorTagsInputRoot, {
33
+ ids,
34
+ value,
35
+ editable,
36
+ onValueChange,
37
+ addOnPaste,
38
+ translations,
39
+ children
40
+ })
41
+ });
64
42
  };
65
- const TagSelectorTagsInputRoot = /*#__PURE__*/forwardRef((props, ref) => {
66
- const comboboxApi = useComboboxContext();
67
- return /*#__PURE__*/_jsx(TagsInputRoot, {
68
- ref: ref,
69
- onInputValueChange: details => comboboxApi.setInputValue(details.inputValue),
70
- ...props
71
- });
43
+ const TagSelectorTagsInputRoot = forwardRef((props, ref) => {
44
+ const comboboxApi = useComboboxContext();
45
+ return /* @__PURE__ */ jsx(TagsInputRoot, {
46
+ ref,
47
+ onInputValueChange: (details) => comboboxApi.setInputValue(details.inputValue),
48
+ ...props
49
+ });
72
50
  });
73
- export const TagSelectorLabel = ComboboxLabel;
74
- export const TagSelectorItemInput = TagsInputItemInput;
75
- export const TagSelectorTrigger = ComboboxTrigger;
76
- export const TagSelectorControl = /*#__PURE__*/forwardRef((_ref2, ref) => {
77
- let {
78
- children,
79
- ...props
80
- } = _ref2;
81
- return /*#__PURE__*/_jsx(ComboboxControl, {
82
- ref: ref,
83
- asChild: true,
84
- children: /*#__PURE__*/_jsx(TagsInputControl, {
85
- ...props,
86
- children: children
87
- })
88
- });
51
+ const TagSelectorLabel = ComboboxLabel;
52
+ const TagSelectorItemInput = TagsInputItemInput;
53
+ const TagSelectorTrigger = ComboboxTrigger;
54
+ const TagSelectorControl = forwardRef(({ children,...props }, ref) => {
55
+ return /* @__PURE__ */ jsx(ComboboxControl, {
56
+ ref,
57
+ asChild: true,
58
+ children: /* @__PURE__ */ jsx(TagsInputControl, {
59
+ ...props,
60
+ children
61
+ })
62
+ });
89
63
  });
90
- export const TagSelectorClearTrigger = ComboboxClearTrigger;
91
- // If you need to modify the TagsInputItem, you can use this.
92
- export const TagSelectorInputBase = /*#__PURE__*/forwardRef((_ref3, ref) => {
93
- let {
94
- children,
95
- ...props
96
- } = _ref3;
97
- const tagsApi = useTagsInputContext();
98
- return /*#__PURE__*/_jsx(ComboboxInput, {
99
- ref: ref,
100
- asChild: true,
101
- children: /*#__PURE__*/_jsx(TagsInputInput, {
102
- onKeyDown: event => {
103
- if (event.key === "Enter") {
104
- tagsApi.addValue(tagsApi.inputValue);
105
- }
106
- },
107
- ...props,
108
- children: children
109
- })
110
- });
64
+ const TagSelectorClearTrigger = ComboboxClearTrigger;
65
+ const TagSelectorInputBase = forwardRef(({ children,...props }, ref) => {
66
+ const tagsApi = useTagsInputContext();
67
+ return /* @__PURE__ */ jsx(ComboboxInput, {
68
+ ref,
69
+ asChild: true,
70
+ children: /* @__PURE__ */ jsx(TagsInputInput, {
71
+ onKeyDown: (event) => {
72
+ if (event.key === "Enter") tagsApi.addValue(tagsApi.inputValue);
73
+ },
74
+ ...props,
75
+ children
76
+ })
77
+ });
111
78
  });
112
- export const TagSelectorInput = /*#__PURE__*/forwardRef((_ref4, ref) => {
113
- let {
114
- children,
115
- ...props
116
- } = _ref4;
117
- const tagsApi = useTagsInputContext();
118
- return /*#__PURE__*/_jsxs(_Fragment, {
119
- children: [tagsApi.value.map((value, index) => /*#__PURE__*/_jsxs(TagsInputItem, {
120
- index: index,
121
- value: value,
122
- children: [/*#__PURE__*/_jsxs(TagsInputItemPreview, {
123
- children: [/*#__PURE__*/_jsx(TagsInputItemText, {
124
- children: value
125
- }), /*#__PURE__*/_jsx(TagsInputItemDeleteTrigger, {
126
- children: /*#__PURE__*/_jsx(CloseLine, {})
127
- })]
128
- }), /*#__PURE__*/_jsx(TagsInputItemInput, {})]
129
- }, value)), /*#__PURE__*/_jsx(ComboboxInput, {
130
- ref: ref,
131
- asChild: true,
132
- children: /*#__PURE__*/_jsx(TagsInputInput, {
133
- onKeyDown: event => {
134
- if (event.key === "Enter") {
135
- tagsApi.addValue(tagsApi.inputValue);
136
- }
137
- },
138
- ...props,
139
- children: children
140
- })
141
- })]
142
- });
143
- });
79
+ const TagSelectorInput = forwardRef(({ children,...props }, ref) => {
80
+ const tagsApi = useTagsInputContext();
81
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [tagsApi.value.map((value, index) => /* @__PURE__ */ jsxs(TagsInputItem, {
82
+ index,
83
+ value,
84
+ children: [/* @__PURE__ */ jsxs(TagsInputItemPreview, { children: [/* @__PURE__ */ jsx(TagsInputItemText, { children: value }), /* @__PURE__ */ jsx(TagsInputItemDeleteTrigger, { children: /* @__PURE__ */ jsx(CloseLine, {}) })] }), /* @__PURE__ */ jsx(TagsInputItemInput, {})]
85
+ }, value)), /* @__PURE__ */ jsx(ComboboxInput, {
86
+ ref,
87
+ asChild: true,
88
+ children: /* @__PURE__ */ jsx(TagsInputInput, {
89
+ onKeyDown: (event) => {
90
+ if (event.key === "Enter") tagsApi.addValue(tagsApi.inputValue);
91
+ },
92
+ ...props,
93
+ children
94
+ })
95
+ })] });
96
+ });
97
+
98
+ //#endregion
99
+ export { TagSelectorClearTrigger, TagSelectorControl, TagSelectorInput, TagSelectorInputBase, TagSelectorItemInput, TagSelectorLabel, TagSelectorRoot, TagSelectorTrigger };
100
+ //# sourceMappingURL=TagSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TagSelector.js","names":[],"sources":["../../src/TagSelector/TagSelector.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { forwardRef, useEffect, useId, useRef } from \"react\";\nimport { type CollectionItem, useTagsInputContext, useComboboxContext } from \"@ark-ui/react\";\nimport { CloseLine } from \"@ndla/icons\";\nimport {\n ComboboxClearTrigger,\n ComboboxControl,\n type ComboboxControlProps,\n ComboboxInput,\n type ComboboxInputProps,\n ComboboxLabel,\n ComboboxRoot,\n type ComboboxRootProps,\n ComboboxTrigger,\n TagsInputControl,\n type TagsInputControlProps,\n TagsInputInput,\n type TagsInputInputProps,\n TagsInputItem,\n TagsInputItemDeleteTrigger,\n TagsInputItemPreview,\n TagsInputItemText,\n TagsInputRoot,\n type TagsInputRootProps,\n TagsInputItemInput,\n} from \"@ndla/primitives\";\nimport { contains } from \"@ndla/util\";\n\nexport type TagSelectorRootProps<T extends CollectionItem> = ComboboxRootProps<T> & TagsInputRootProps;\n\nexport const TagSelectorRoot = <T extends CollectionItem>({\n allowCustomValue = true,\n multiple = true,\n selectionBehavior = \"clear\",\n editable,\n addOnPaste = false,\n onValueChange,\n children,\n value,\n translations,\n ...rest\n}: TagSelectorRootProps<T>) => {\n const ids = {\n root: useId(),\n input: useId(),\n control: useId(),\n };\n\n const controlRef = useRef<HTMLDivElement | undefined>(undefined);\n\n useEffect(() => {\n if (!controlRef.current) {\n controlRef.current = document.getElementById(ids.control) as HTMLDivElement | undefined;\n }\n }, [ids.control]);\n\n return (\n <ComboboxRoot\n ids={ids}\n asChild\n allowCustomValue={allowCustomValue}\n multiple={multiple}\n selectionBehavior={selectionBehavior}\n onValueChange={onValueChange}\n translations={translations}\n onPointerDownOutside={(event) => {\n if (contains(controlRef.current, event.detail.originalEvent.target)) {\n event.preventDefault();\n }\n }}\n value={value}\n {...rest}\n >\n <TagSelectorTagsInputRoot\n ids={ids}\n value={value}\n editable={editable}\n onValueChange={onValueChange}\n addOnPaste={addOnPaste}\n translations={translations}\n >\n {children}\n </TagSelectorTagsInputRoot>\n </ComboboxRoot>\n );\n};\n\nconst TagSelectorTagsInputRoot = forwardRef<HTMLDivElement, TagsInputRootProps>((props, ref) => {\n const comboboxApi = useComboboxContext();\n return (\n <TagsInputRoot\n ref={ref}\n onInputValueChange={(details) => comboboxApi.setInputValue(details.inputValue)}\n {...props}\n />\n );\n});\n\nexport type TagSelectorControlProps = ComboboxControlProps & TagsInputControlProps;\n\nexport const TagSelectorLabel = ComboboxLabel;\n\nexport const TagSelectorItemInput = TagsInputItemInput;\n\nexport const TagSelectorTrigger = ComboboxTrigger;\n\nexport const TagSelectorControl = forwardRef<HTMLDivElement, TagSelectorControlProps>(({ children, ...props }, ref) => {\n return (\n <ComboboxControl ref={ref} asChild>\n <TagsInputControl {...props}>{children}</TagsInputControl>\n </ComboboxControl>\n );\n});\n\nexport const TagSelectorClearTrigger = ComboboxClearTrigger;\n\nexport type TagSelectorInputProps = ComboboxInputProps & TagsInputInputProps;\n\n// If you need to modify the TagsInputItem, you can use this.\nexport const TagSelectorInputBase = forwardRef<HTMLInputElement, TagSelectorInputProps>(\n ({ children, ...props }, ref) => {\n const tagsApi = useTagsInputContext();\n\n return (\n <ComboboxInput ref={ref} asChild>\n <TagsInputInput\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n tagsApi.addValue(tagsApi.inputValue);\n }\n }}\n {...props}\n >\n {children}\n </TagsInputInput>\n </ComboboxInput>\n );\n },\n);\n\nexport const TagSelectorInput = forwardRef<HTMLInputElement, TagSelectorInputProps>(({ children, ...props }, ref) => {\n const tagsApi = useTagsInputContext();\n\n return (\n <>\n {tagsApi.value.map((value, index) => (\n <TagsInputItem index={index} value={value} key={value}>\n <TagsInputItemPreview>\n <TagsInputItemText>{value}</TagsInputItemText>\n <TagsInputItemDeleteTrigger>\n <CloseLine />\n </TagsInputItemDeleteTrigger>\n </TagsInputItemPreview>\n <TagsInputItemInput />\n </TagsInputItem>\n ))}\n <ComboboxInput ref={ref} asChild>\n <TagsInputInput\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n tagsApi.addValue(tagsApi.inputValue);\n }\n }}\n {...props}\n >\n {children}\n </TagsInputInput>\n </ComboboxInput>\n </>\n );\n});\n"],"mappings":";;;;;;;;AAqCA,MAAa,kBAAkB,CAA2B,EACxD,mBAAmB,MACnB,WAAW,MACX,oBAAoB,SACpB,UACA,aAAa,OACb,eACA,UACA,OACA,aACA,GAAG,MACqB,KAAK;CAC7B,MAAM,MAAM;EACV,MAAM,OAAO;EACb,OAAO,OAAO;EACd,SAAS,OAAO;CACjB;CAED,MAAM,aAAa,cAA6C;AAEhE,WAAU,MAAM;AACd,OAAK,WAAW,QACd,YAAW,UAAU,SAAS,eAAe,IAAI,QAAQ;CAE5D,GAAE,CAAC,IAAI,OAAQ,EAAC;AAEjB,wBACE,IAAC;EACM;EACL;EACkB;EACR;EACS;EACJ;EACD;EACd,sBAAsB,CAAC,UAAU;AAC/B,OAAI,SAAS,WAAW,SAAS,MAAM,OAAO,cAAc,OAAO,CACjE,OAAM,gBAAgB;EAEzB;EACM;EACP,GAAI;4BAEJ,IAAC;GACM;GACE;GACG;GACK;GACH;GACE;GAEb;IACwB;GACd;AAElB;AAED,MAAM,2BAA2B,WAA+C,CAAC,OAAO,QAAQ;CAC9F,MAAM,cAAc,oBAAoB;AACxC,wBACE,IAAC;EACM;EACL,oBAAoB,CAAC,YAAY,YAAY,cAAc,QAAQ,WAAW;EAC9E,GAAI;GACJ;AAEL,EAAC;AAIF,MAAa,mBAAmB;AAEhC,MAAa,uBAAuB;AAEpC,MAAa,qBAAqB;AAElC,MAAa,qBAAqB,WAAoD,CAAC,EAAE,SAAU,GAAG,OAAO,EAAE,QAAQ;AACrH,wBACE,IAAC;EAAqB;EAAK;4BACzB,IAAC;GAAiB,GAAI;GAAQ;IAA4B;GAC1C;AAErB,EAAC;AAEF,MAAa,0BAA0B;AAKvC,MAAa,uBAAuB,WAClC,CAAC,EAAE,SAAU,GAAG,OAAO,EAAE,QAAQ;CAC/B,MAAM,UAAU,qBAAqB;AAErC,wBACE,IAAC;EAAmB;EAAK;4BACvB,IAAC;GACC,WAAW,CAAC,UAAU;AACpB,QAAI,MAAM,QAAQ,QAChB,SAAQ,SAAS,QAAQ,WAAW;GAEvC;GACD,GAAI;GAEH;IACc;GACH;AAEnB,EACF;AAED,MAAa,mBAAmB,WAAoD,CAAC,EAAE,SAAU,GAAG,OAAO,EAAE,QAAQ;CACnH,MAAM,UAAU,qBAAqB;AAErC,wBACE,8BACG,QAAQ,MAAM,IAAI,CAAC,OAAO,0BACzB,KAAC;EAAqB;EAAc;6BAClC,KAAC,mDACC,IAAC,+BAAmB,QAA0B,kBAC9C,IAAC,wDACC,IAAC,cAAY,GACc,IACR,kBACvB,IAAC,uBAAqB;IAPwB,MAQhC,CAChB,kBACF,IAAC;EAAmB;EAAK;4BACvB,IAAC;GACC,WAAW,CAAC,UAAU;AACpB,QAAI,MAAM,QAAQ,QAChB,SAAQ,SAAS,QAAQ,WAAW;GAEvC;GACD,GAAI;GAEH;IACc;GACH,IACf;AAEN,EAAC"}
@@ -1,55 +1,41 @@
1
- /**
2
- * Copyright (c) 2024-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, useState } from "react";
10
2
  import { Button } from "@ndla/primitives";
3
+ import { jsx } from "react/jsx-runtime";
4
+
5
+ //#region src/ZendeskButton/ZendeskButton.tsx
6
+ const ZendeskButton = forwardRef(({ locale, variant = "secondary", widgetKey, children,...rest }, ref) => {
7
+ const [loading, setLoading] = useState(false);
8
+ const handleClick = () => {
9
+ if (window && !window.zE) {
10
+ setLoading(true);
11
+ const script = document.createElement("script");
12
+ script.id = "ze-snippet";
13
+ script.type = "text/javascript";
14
+ script.async = true;
15
+ script.onload = () => {
16
+ if (window.zE) {
17
+ window.zE("webWidget", "setLocale", locale);
18
+ window.zE("webWidget:on", "close", () => {
19
+ setLoading(false);
20
+ });
21
+ window.zE("webWidget", "open");
22
+ }
23
+ };
24
+ script.src = `https://static.zdassets.com/ekr/snippet.js?key=${widgetKey}`;
25
+ document.body.appendChild(script);
26
+ } else if (window?.zE) window.zE("webWidget", "open");
27
+ };
28
+ return /* @__PURE__ */ jsx(Button, {
29
+ onClick: handleClick,
30
+ variant,
31
+ id: "zendeskButton",
32
+ disabled: loading,
33
+ ...rest,
34
+ ref,
35
+ children
36
+ });
37
+ });
11
38
 
12
- // TODO: Let's consider abandoning `disabled` on the button here. It should instead just open/close the widget based on its current state.
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- export const ZendeskButton = /*#__PURE__*/forwardRef((_ref, ref) => {
15
- let {
16
- locale,
17
- variant = "secondary",
18
- widgetKey,
19
- children,
20
- ...rest
21
- } = _ref;
22
- const [loading, setLoading] = useState(false);
23
- const handleClick = () => {
24
- if (window && !window.zE) {
25
- setLoading(true);
26
- // Asynchronously load zendesk scripts for better performance
27
- const script = document.createElement("script");
28
- script.id = "ze-snippet";
29
- script.type = "text/javascript";
30
- script.async = true;
31
- script.onload = () => {
32
- if (window.zE) {
33
- window.zE("webWidget", "setLocale", locale);
34
- window.zE("webWidget:on", "close", () => {
35
- setLoading(false);
36
- });
37
- window.zE("webWidget", "open");
38
- }
39
- };
40
- script.src = `https://static.zdassets.com/ekr/snippet.js?key=${widgetKey}`;
41
- document.body.appendChild(script);
42
- } else if (window?.zE) {
43
- window.zE("webWidget", "open");
44
- }
45
- };
46
- return /*#__PURE__*/_jsx(Button, {
47
- onClick: handleClick,
48
- variant: variant,
49
- id: "zendeskButton",
50
- disabled: loading,
51
- ...rest,
52
- ref: ref,
53
- children: children
54
- });
55
- });
39
+ //#endregion
40
+ export { ZendeskButton };
41
+ //# sourceMappingURL=ZendeskButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ZendeskButton.js","names":[],"sources":["../../src/ZendeskButton/ZendeskButton.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { forwardRef, useState } from \"react\";\nimport { Button, type ButtonProps } from \"@ndla/primitives\";\n\n// TODO: Let's consider abandoning `disabled` on the button here. It should instead just open/close the widget based on its current state.\n\nexport interface ZendeskButtonProps extends ButtonProps {\n widgetKey: string;\n locale: string;\n}\n\ndeclare global {\n interface Window {\n zE: (modifier: string, action: string, callback?: (() => void) | string) => void;\n }\n}\n\nexport const ZendeskButton = forwardRef<HTMLButtonElement, ZendeskButtonProps>(\n ({ locale, variant = \"secondary\", widgetKey, children, ...rest }, ref) => {\n const [loading, setLoading] = useState(false);\n const handleClick = () => {\n if (window && !window.zE) {\n setLoading(true);\n // Asynchronously load zendesk scripts for better performance\n const script = document.createElement(\"script\");\n script.id = \"ze-snippet\";\n script.type = \"text/javascript\";\n script.async = true;\n script.onload = () => {\n if (window.zE) {\n window.zE(\"webWidget\", \"setLocale\", locale);\n window.zE(\"webWidget:on\", \"close\", () => {\n setLoading(false);\n });\n window.zE(\"webWidget\", \"open\");\n }\n };\n script.src = `https://static.zdassets.com/ekr/snippet.js?key=${widgetKey}`;\n document.body.appendChild(script);\n } else if (window?.zE) {\n window.zE(\"webWidget\", \"open\");\n }\n };\n\n return (\n <Button onClick={handleClick} variant={variant} id=\"zendeskButton\" disabled={loading} {...rest} ref={ref}>\n {children}\n </Button>\n );\n },\n);\n"],"mappings":";;;;;AAwBA,MAAa,gBAAgB,WAC3B,CAAC,EAAE,QAAQ,UAAU,aAAa,WAAW,SAAU,GAAG,MAAM,EAAE,QAAQ;CACxE,MAAM,CAAC,SAAS,WAAW,GAAG,SAAS,MAAM;CAC7C,MAAM,cAAc,MAAM;AACxB,MAAI,WAAW,OAAO,IAAI;AACxB,cAAW,KAAK;GAEhB,MAAM,SAAS,SAAS,cAAc,SAAS;AAC/C,UAAO,KAAK;AACZ,UAAO,OAAO;AACd,UAAO,QAAQ;AACf,UAAO,SAAS,MAAM;AACpB,QAAI,OAAO,IAAI;AACb,YAAO,GAAG,aAAa,aAAa,OAAO;AAC3C,YAAO,GAAG,gBAAgB,SAAS,MAAM;AACvC,iBAAW,MAAM;KAClB,EAAC;AACF,YAAO,GAAG,aAAa,OAAO;IAC/B;GACF;AACD,UAAO,OAAO,iDAAiD,UAAU;AACzE,YAAS,KAAK,YAAY,OAAO;EAClC,WAAU,QAAQ,GACjB,QAAO,GAAG,aAAa,OAAO;CAEjC;AAED,wBACE,IAAC;EAAO,SAAS;EAAsB;EAAS,IAAG;EAAgB,UAAU;EAAS,GAAI;EAAW;EAClG;GACM;AAEZ,EACF"}
@@ -0,0 +1,11 @@
1
+ //#region rolldown:runtime
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (target, all) => {
4
+ for (var name in all) __defProp(target, name, {
5
+ get: all[name],
6
+ enumerable: true
7
+ });
8
+ };
9
+
10
+ //#endregion
11
+ export { __export };
@@ -1,25 +1,17 @@
1
- /**
2
- * Copyright (c) 2017-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
- */
1
+ //#region src/i18n/formatNestedMessages.ts
2
+ const formatNestedMessages = (phrases, formattedMessages = {}, prefix = "") => {
3
+ const messages = formattedMessages;
4
+ Object.keys(phrases).forEach((key) => {
5
+ const value = phrases[key];
6
+ if ({}.hasOwnProperty.call(phrases, key)) {
7
+ const keyWithPrefix = prefix ? `${prefix}.${key}` : key;
8
+ if (typeof value === "object") formatNestedMessages(value, formattedMessages, keyWithPrefix);
9
+ else messages[keyWithPrefix] = value;
10
+ }
11
+ });
12
+ return messages;
13
+ };
8
14
 
9
- export const formatNestedMessages = function (phrases) {
10
- let formattedMessages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
11
- let prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
12
- const messages = formattedMessages;
13
- Object.keys(phrases).forEach(key => {
14
- const value = phrases[key];
15
- if ({}.hasOwnProperty.call(phrases, key)) {
16
- const keyWithPrefix = prefix ? `${prefix}.${key}` : key;
17
- if (typeof value === "object") {
18
- formatNestedMessages(value, formattedMessages, keyWithPrefix);
19
- } else {
20
- messages[keyWithPrefix] = value;
21
- }
22
- }
23
- });
24
- return messages;
25
- };
15
+ //#endregion
16
+ export { formatNestedMessages };
17
+ //# sourceMappingURL=formatNestedMessages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatNestedMessages.js","names":["phrases: Phrases","formattedMessages: FormattedMessages","prefix: string"],"sources":["../../src/i18n/formatNestedMessages.ts"],"sourcesContent":["/**\n * Copyright (c) 2017-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\ninterface Phrases {\n [key: string]: string | Phrases;\n}\n\ninterface FormattedMessages {\n [key: string]: string;\n}\n\nexport const formatNestedMessages = (\n phrases: Phrases,\n formattedMessages: FormattedMessages = {},\n prefix: string = \"\",\n) => {\n const messages = formattedMessages;\n\n Object.keys(phrases).forEach((key) => {\n const value = phrases[key];\n if ({}.hasOwnProperty.call(phrases, key)) {\n const keyWithPrefix = prefix ? `${prefix}.${key}` : key;\n if (typeof value === \"object\") {\n formatNestedMessages(value, formattedMessages, keyWithPrefix);\n } else {\n messages[keyWithPrefix] = value;\n }\n }\n });\n\n return messages;\n};\n"],"mappings":";AAgBA,MAAa,uBAAuB,CAClCA,SACAC,oBAAuC,CAAE,GACzCC,SAAiB,OACd;CACH,MAAM,WAAW;AAEjB,QAAO,KAAK,QAAQ,CAAC,QAAQ,CAAC,QAAQ;EACpC,MAAM,QAAQ,QAAQ;AACtB,MAAI,CAAE,EAAC,eAAe,KAAK,SAAS,IAAI,EAAE;GACxC,MAAM,gBAAgB,UAAU,EAAE,OAAO,GAAG,IAAI,IAAI;AACpD,cAAW,UAAU,SACnB,sBAAqB,OAAO,mBAAmB,cAAc;OAE7D,UAAS,iBAAiB;EAE7B;CACF,EAAC;AAEF,QAAO;AACR"}