@ndla/ui 56.0.122-alpha.0 → 56.0.124-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/README.md +1 -1
  2. package/es/Article/Article.js +127 -0
  3. package/es/Article/Article.js.map +1 -0
  4. package/es/Article/ArticleByline.js +133 -0
  5. package/es/Article/ArticleByline.js.map +1 -0
  6. package/es/Article/ArticleFootNotes.js +40 -0
  7. package/es/Article/ArticleFootNotes.js.map +1 -0
  8. package/es/AudioPlayer/AudioPlayer.js +157 -0
  9. package/es/AudioPlayer/AudioPlayer.js.map +1 -0
  10. package/es/AudioPlayer/Controls.js +254 -0
  11. package/es/AudioPlayer/Controls.js.map +1 -0
  12. package/es/AudioPlayer/SpeechControl.js +40 -0
  13. package/es/AudioPlayer/SpeechControl.js.map +1 -0
  14. package/es/AudioPlayer/index.js +8 -0
  15. package/es/AudioPlayer/index.js.map +1 -0
  16. package/es/Breadcrumb/Breadcrumb.js +44 -0
  17. package/es/Breadcrumb/Breadcrumb.js.map +1 -0
  18. package/es/Breadcrumb/BreadcrumbItem.js +36 -0
  19. package/es/Breadcrumb/BreadcrumbItem.js.map +1 -0
  20. package/es/Breadcrumb/HomeBreadcrumb.js +44 -0
  21. package/es/Breadcrumb/HomeBreadcrumb.js.map +1 -0
  22. package/es/Breadcrumb/index.js +9 -0
  23. package/es/Breadcrumb/index.js.map +1 -0
  24. package/es/CampaignBlock/CampaignBlock.js +131 -0
  25. package/es/CampaignBlock/CampaignBlock.js.map +1 -0
  26. package/es/CodeBlock/CodeBlock.js +25 -0
  27. package/es/CodeBlock/CodeBlock.js.map +1 -0
  28. package/es/CodeBlock/codeLanguageOptions.js +114 -0
  29. package/es/CodeBlock/codeLanguageOptions.js.map +1 -0
  30. package/es/Concept/Concept.js +50 -0
  31. package/es/Concept/Concept.js.map +1 -0
  32. package/es/ContactBlock/ContactBlock.js +145 -0
  33. package/es/ContactBlock/ContactBlock.js.map +1 -0
  34. package/es/ContentTypeBadge/ContentTypeBadge.js +41 -0
  35. package/es/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
  36. package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +25 -0
  37. package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
  38. package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +25 -0
  39. package/es/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
  40. package/es/ContentTypeHero/ContentTypeHero.js +39 -0
  41. package/es/ContentTypeHero/ContentTypeHero.js.map +1 -0
  42. package/es/CopyParagraphButton/CopyParagraphButton.js +62 -0
  43. package/es/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
  44. package/es/CopyParagraphButton/index.js +8 -0
  45. package/es/CopyParagraphButton/index.js.map +1 -0
  46. package/es/Embed/AudioEmbed.js +52 -0
  47. package/es/Embed/AudioEmbed.js.map +1 -0
  48. package/es/Embed/BrightcoveEmbed.js +96 -0
  49. package/es/Embed/BrightcoveEmbed.js.map +1 -0
  50. package/es/Embed/CodeEmbed.js +61 -0
  51. package/es/Embed/CodeEmbed.js.map +1 -0
  52. package/es/Embed/ConceptEmbed.js +78 -0
  53. package/es/Embed/ConceptEmbed.js.map +1 -0
  54. package/es/Embed/ConceptInlineTriggerButton.js +40 -0
  55. package/es/Embed/ConceptInlineTriggerButton.js.map +1 -0
  56. package/es/Embed/ContentLinkEmbed.js +31 -0
  57. package/es/Embed/ContentLinkEmbed.js.map +1 -0
  58. package/es/Embed/CopyrightEmbed.js +23 -0
  59. package/es/Embed/CopyrightEmbed.js.map +1 -0
  60. package/es/Embed/EmbedErrorPlaceholder.js +43 -0
  61. package/es/Embed/EmbedErrorPlaceholder.js.map +1 -0
  62. package/es/Embed/EmbedWrapper.js +26 -0
  63. package/es/Embed/EmbedWrapper.js.map +1 -0
  64. package/es/Embed/ExternalEmbed.js +54 -0
  65. package/es/Embed/ExternalEmbed.js.map +1 -0
  66. package/es/Embed/FootnoteEmbed.js +27 -0
  67. package/es/Embed/FootnoteEmbed.js.map +1 -0
  68. package/es/Embed/GlossEmbed.js +52 -0
  69. package/es/Embed/GlossEmbed.js.map +1 -0
  70. package/es/Embed/H5pEmbed.js +38 -0
  71. package/es/Embed/H5pEmbed.js.map +1 -0
  72. package/es/Embed/IframeEmbed.js +69 -0
  73. package/es/Embed/IframeEmbed.js.map +1 -0
  74. package/es/Embed/ImageEmbed.js +180 -0
  75. package/es/Embed/ImageEmbed.js.map +1 -0
  76. package/es/Embed/InlineTriggerButton.js +25 -0
  77. package/es/Embed/InlineTriggerButton.js.map +1 -0
  78. package/es/Embed/RelatedContentEmbed.js +38 -0
  79. package/es/Embed/RelatedContentEmbed.js.map +1 -0
  80. package/es/Embed/UnknownEmbed.js +20 -0
  81. package/es/Embed/UnknownEmbed.js.map +1 -0
  82. package/es/Embed/UuDisclaimerEmbed.js +54 -0
  83. package/es/Embed/UuDisclaimerEmbed.js.map +1 -0
  84. package/es/ErrorMessage/ErrorMessage.js +54 -0
  85. package/es/ErrorMessage/ErrorMessage.js.map +1 -0
  86. package/es/ErrorMessage/index.js +8 -0
  87. package/es/ErrorMessage/index.js.map +1 -0
  88. package/es/FactBox/FactBox.js +121 -0
  89. package/es/FactBox/FactBox.js.map +1 -0
  90. package/es/FactBox/index.js +8 -0
  91. package/es/FactBox/index.js.map +1 -0
  92. package/es/FileList/File.js +76 -0
  93. package/es/FileList/File.js.map +1 -0
  94. package/es/FileList/FileList.js +32 -0
  95. package/es/FileList/FileList.js.map +1 -0
  96. package/es/FileList/PdfFile.js +28 -0
  97. package/es/FileList/PdfFile.js.map +1 -0
  98. package/es/Gloss/Gloss.js +142 -0
  99. package/es/Gloss/Gloss.js.map +1 -0
  100. package/es/Gloss/GlossExample.js +46 -0
  101. package/es/Gloss/GlossExample.js.map +1 -0
  102. package/es/Grid/Grid.js +66 -0
  103. package/es/Grid/Grid.js.map +1 -0
  104. package/es/Grid/GridParallaxItem.js +21 -0
  105. package/es/Grid/GridParallaxItem.js.map +1 -0
  106. package/es/KeyFigure/KeyFigure.js +46 -0
  107. package/es/KeyFigure/KeyFigure.js.map +1 -0
  108. package/es/LicenseByline/EmbedByline.js +132 -0
  109. package/es/LicenseByline/EmbedByline.js.map +1 -0
  110. package/es/LicenseByline/LicenseLink.js +31 -0
  111. package/es/LicenseByline/LicenseLink.js.map +1 -0
  112. package/es/LinkBlock/LinkBlock.js +74 -0
  113. package/es/LinkBlock/LinkBlock.js.map +1 -0
  114. package/es/LinkBlock/LinkBlockSection.js +23 -0
  115. package/es/LinkBlock/LinkBlockSection.js.map +1 -0
  116. package/es/Pitch/Pitch.js +62 -0
  117. package/es/Pitch/Pitch.js.map +1 -0
  118. package/es/RelatedArticleList/RelatedArticleList.js +97 -0
  119. package/es/RelatedArticleList/RelatedArticleList.js.map +1 -0
  120. package/es/RelatedArticleList/index.js +8 -0
  121. package/es/RelatedArticleList/index.js.map +1 -0
  122. package/es/ResourceBox/ResourceBox.js +74 -0
  123. package/es/ResourceBox/ResourceBox.js.map +1 -0
  124. package/es/TagSelector/TagSelector.js +100 -0
  125. package/es/TagSelector/TagSelector.js.map +1 -0
  126. package/es/ZendeskButton/ZendeskButton.js +41 -0
  127. package/es/ZendeskButton/ZendeskButton.js.map +1 -0
  128. package/es/_virtual/rolldown_runtime.js +11 -0
  129. package/es/i18n/formatNestedMessages.js +17 -0
  130. package/es/i18n/formatNestedMessages.js.map +1 -0
  131. package/es/i18n/i18n.js +29 -0
  132. package/es/i18n/i18n.js.map +1 -0
  133. package/es/i18n/useComponentTranslations.js +155 -0
  134. package/es/i18n/useComponentTranslations.js.map +1 -0
  135. package/es/index.js +65 -0
  136. package/es/locale/messages-en.js +438 -0
  137. package/es/locale/messages-en.js.map +1 -0
  138. package/es/locale/messages-nb.js +438 -0
  139. package/es/locale/messages-nb.js.map +1 -0
  140. package/es/locale/messages-nn.js +438 -0
  141. package/es/locale/messages-nn.js.map +1 -0
  142. package/es/locale/messages-se.js +438 -0
  143. package/es/locale/messages-se.js.map +1 -0
  144. package/es/model/ContentType.js +72 -0
  145. package/es/model/ContentType.js.map +1 -0
  146. package/es/model/SubjectCategories.js +25 -0
  147. package/es/model/SubjectCategories.js.map +1 -0
  148. package/es/model/SubjectTypes.js +23 -0
  149. package/es/model/SubjectTypes.js.map +1 -0
  150. package/es/model/WordClass.js +53 -0
  151. package/es/model/WordClass.js.map +1 -0
  152. package/es/model/index.js +19 -0
  153. package/es/model/index.js.map +1 -0
  154. package/es/utils/licenseAttributes.js +16 -0
  155. package/es/utils/licenseAttributes.js.map +1 -0
  156. package/es/utils/relativeUrl.js +26 -0
  157. package/es/utils/relativeUrl.js.map +1 -0
  158. package/lib/Article/Article.js +134 -0
  159. package/lib/Article/Article.js.map +1 -0
  160. package/lib/Article/ArticleByline.js +135 -0
  161. package/lib/Article/ArticleByline.js.map +1 -0
  162. package/lib/Article/ArticleFootNotes.js +41 -0
  163. package/lib/Article/ArticleFootNotes.js.map +1 -0
  164. package/lib/AudioPlayer/AudioPlayer.js +158 -0
  165. package/lib/AudioPlayer/AudioPlayer.js.map +1 -0
  166. package/lib/AudioPlayer/Controls.js +255 -0
  167. package/lib/AudioPlayer/Controls.js.map +1 -0
  168. package/lib/AudioPlayer/SpeechControl.js +41 -0
  169. package/lib/AudioPlayer/SpeechControl.js.map +1 -0
  170. package/lib/AudioPlayer/index.js +8 -0
  171. package/lib/AudioPlayer/index.js.map +1 -0
  172. package/lib/Breadcrumb/Breadcrumb.js +45 -0
  173. package/lib/Breadcrumb/Breadcrumb.js.map +1 -0
  174. package/lib/Breadcrumb/BreadcrumbItem.js +37 -0
  175. package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -0
  176. package/lib/Breadcrumb/HomeBreadcrumb.js +45 -0
  177. package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -0
  178. package/lib/Breadcrumb/index.js +9 -0
  179. package/lib/Breadcrumb/index.js.map +1 -0
  180. package/lib/CampaignBlock/CampaignBlock.js +132 -0
  181. package/lib/CampaignBlock/CampaignBlock.js.map +1 -0
  182. package/lib/CodeBlock/CodeBlock.js +26 -0
  183. package/lib/CodeBlock/CodeBlock.js.map +1 -0
  184. package/lib/CodeBlock/codeLanguageOptions.js +115 -0
  185. package/lib/CodeBlock/codeLanguageOptions.js.map +1 -0
  186. package/lib/Concept/Concept.js +51 -0
  187. package/lib/Concept/Concept.js.map +1 -0
  188. package/lib/ContactBlock/ContactBlock.js +147 -0
  189. package/lib/ContactBlock/ContactBlock.js.map +1 -0
  190. package/lib/ContentTypeBadge/ContentTypeBadge.js +43 -0
  191. package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
  192. package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +26 -0
  193. package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
  194. package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +26 -0
  195. package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
  196. package/lib/ContentTypeHero/ContentTypeHero.js +40 -0
  197. package/lib/ContentTypeHero/ContentTypeHero.js.map +1 -0
  198. package/lib/CopyParagraphButton/CopyParagraphButton.js +63 -0
  199. package/lib/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
  200. package/lib/CopyParagraphButton/index.js +8 -0
  201. package/lib/CopyParagraphButton/index.js.map +1 -0
  202. package/lib/Embed/AudioEmbed.js +53 -0
  203. package/lib/Embed/AudioEmbed.js.map +1 -0
  204. package/lib/Embed/BrightcoveEmbed.js +97 -0
  205. package/lib/Embed/BrightcoveEmbed.js.map +1 -0
  206. package/lib/Embed/CodeEmbed.js +62 -0
  207. package/lib/Embed/CodeEmbed.js.map +1 -0
  208. package/lib/Embed/ConceptEmbed.js +81 -0
  209. package/lib/Embed/ConceptEmbed.js.map +1 -0
  210. package/lib/Embed/ConceptInlineTriggerButton.js +41 -0
  211. package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -0
  212. package/lib/Embed/ContentLinkEmbed.js +32 -0
  213. package/lib/Embed/ContentLinkEmbed.js.map +1 -0
  214. package/lib/Embed/CopyrightEmbed.js +24 -0
  215. package/lib/Embed/CopyrightEmbed.js.map +1 -0
  216. package/lib/Embed/EmbedErrorPlaceholder.js +44 -0
  217. package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -0
  218. package/lib/Embed/EmbedWrapper.js +27 -0
  219. package/lib/Embed/EmbedWrapper.js.map +1 -0
  220. package/lib/Embed/ExternalEmbed.js +55 -0
  221. package/lib/Embed/ExternalEmbed.js.map +1 -0
  222. package/lib/Embed/FootnoteEmbed.js +28 -0
  223. package/lib/Embed/FootnoteEmbed.js.map +1 -0
  224. package/lib/Embed/GlossEmbed.js +53 -0
  225. package/lib/Embed/GlossEmbed.js.map +1 -0
  226. package/lib/Embed/H5pEmbed.js +39 -0
  227. package/lib/Embed/H5pEmbed.js.map +1 -0
  228. package/lib/Embed/IframeEmbed.js +70 -0
  229. package/lib/Embed/IframeEmbed.js.map +1 -0
  230. package/lib/Embed/ImageEmbed.js +183 -0
  231. package/lib/Embed/ImageEmbed.js.map +1 -0
  232. package/lib/Embed/InlineTriggerButton.js +26 -0
  233. package/lib/Embed/InlineTriggerButton.js.map +1 -0
  234. package/lib/Embed/RelatedContentEmbed.js +39 -0
  235. package/lib/Embed/RelatedContentEmbed.js.map +1 -0
  236. package/lib/Embed/UnknownEmbed.js +21 -0
  237. package/lib/Embed/UnknownEmbed.js.map +1 -0
  238. package/lib/Embed/UuDisclaimerEmbed.js +55 -0
  239. package/lib/Embed/UuDisclaimerEmbed.js.map +1 -0
  240. package/lib/ErrorMessage/ErrorMessage.js +55 -0
  241. package/lib/ErrorMessage/ErrorMessage.js.map +1 -0
  242. package/lib/ErrorMessage/index.js +8 -0
  243. package/lib/ErrorMessage/index.js.map +1 -0
  244. package/lib/FactBox/FactBox.js +122 -0
  245. package/lib/FactBox/FactBox.js.map +1 -0
  246. package/lib/FactBox/index.js +8 -0
  247. package/lib/FactBox/index.js.map +1 -0
  248. package/lib/FileList/File.js +78 -0
  249. package/lib/FileList/File.js.map +1 -0
  250. package/lib/FileList/FileList.js +35 -0
  251. package/lib/FileList/FileList.js.map +1 -0
  252. package/lib/FileList/PdfFile.js +29 -0
  253. package/lib/FileList/PdfFile.js.map +1 -0
  254. package/lib/Gloss/Gloss.js +143 -0
  255. package/lib/Gloss/Gloss.js.map +1 -0
  256. package/lib/Gloss/GlossExample.js +47 -0
  257. package/lib/Gloss/GlossExample.js.map +1 -0
  258. package/lib/Grid/Grid.js +67 -0
  259. package/lib/Grid/Grid.js.map +1 -0
  260. package/lib/Grid/GridParallaxItem.js +22 -0
  261. package/lib/Grid/GridParallaxItem.js.map +1 -0
  262. package/lib/KeyFigure/KeyFigure.js +47 -0
  263. package/lib/KeyFigure/KeyFigure.js.map +1 -0
  264. package/lib/LicenseByline/EmbedByline.js +134 -0
  265. package/lib/LicenseByline/EmbedByline.js.map +1 -0
  266. package/lib/LicenseByline/LicenseLink.js +32 -0
  267. package/lib/LicenseByline/LicenseLink.js.map +1 -0
  268. package/lib/LinkBlock/LinkBlock.js +75 -0
  269. package/lib/LinkBlock/LinkBlock.js.map +1 -0
  270. package/lib/LinkBlock/LinkBlockSection.js +24 -0
  271. package/lib/LinkBlock/LinkBlockSection.js.map +1 -0
  272. package/lib/Pitch/Pitch.js +63 -0
  273. package/lib/Pitch/Pitch.js.map +1 -0
  274. package/lib/RelatedArticleList/RelatedArticleList.js +99 -0
  275. package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -0
  276. package/lib/RelatedArticleList/index.js +8 -0
  277. package/lib/RelatedArticleList/index.js.map +1 -0
  278. package/lib/ResourceBox/ResourceBox.js +75 -0
  279. package/lib/ResourceBox/ResourceBox.js.map +1 -0
  280. package/lib/TagSelector/TagSelector.js +108 -0
  281. package/lib/TagSelector/TagSelector.js.map +1 -0
  282. package/lib/ZendeskButton/ZendeskButton.js +42 -0
  283. package/lib/ZendeskButton/ZendeskButton.js.map +1 -0
  284. package/lib/_virtual/rolldown_runtime.js +42 -0
  285. package/lib/i18n/formatNestedMessages.js +18 -0
  286. package/lib/i18n/formatNestedMessages.js.map +1 -0
  287. package/lib/i18n/i18n.js +31 -0
  288. package/lib/i18n/i18n.js.map +1 -0
  289. package/lib/i18n/useComponentTranslations.js +163 -0
  290. package/lib/i18n/useComponentTranslations.js.map +1 -0
  291. package/lib/index.js +157 -0
  292. package/lib/locale/messages-en.js +439 -0
  293. package/lib/locale/messages-en.js.map +1 -0
  294. package/lib/locale/messages-nb.js +439 -0
  295. package/lib/locale/messages-nb.js.map +1 -0
  296. package/lib/locale/messages-nn.js +439 -0
  297. package/lib/locale/messages-nn.js.map +1 -0
  298. package/lib/locale/messages-se.js +439 -0
  299. package/lib/locale/messages-se.js.map +1 -0
  300. package/lib/model/ContentType.js +94 -0
  301. package/lib/model/ContentType.js.map +1 -0
  302. package/lib/model/SubjectCategories.js +30 -0
  303. package/lib/model/SubjectCategories.js.map +1 -0
  304. package/lib/model/SubjectTypes.js +28 -0
  305. package/lib/model/SubjectTypes.js.map +1 -0
  306. package/lib/model/WordClass.js +58 -0
  307. package/lib/model/WordClass.js.map +1 -0
  308. package/lib/model/index.js +19 -0
  309. package/lib/model/index.js.map +1 -0
  310. package/lib/utils/licenseAttributes.js +17 -0
  311. package/lib/utils/licenseAttributes.js.map +1 -0
  312. package/lib/utils/relativeUrl.js +26 -0
  313. package/lib/utils/relativeUrl.js.map +1 -0
  314. package/package.json +12 -11
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RelatedArticleList.js","names":[],"sources":["../../src/RelatedArticleList/RelatedArticleList.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 { Children, type ComponentPropsWithoutRef, type ReactElement, type ReactNode, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { ExternalLinkLine } from \"@ndla/icons\";\nimport { CardContent, CardHeading, CardRoot, Text, Heading, Button } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { linkOverlay } from \"@ndla/styled-system/patterns\";\nimport { ContentTypeBadge } from \"../ContentTypeBadge/ContentTypeBadge\";\nimport { contentTypes } from \"../model/ContentType\";\nimport type { HeadingLevel } from \"../types\";\n\ninterface RelatedArticleProps {\n title: string;\n introduction: string;\n to: string;\n linkInfo?: string;\n target?: string;\n type?: string;\n}\n\nconst StyledSpan = styled(\"span\", {\n base: {\n display: \"flex\",\n gap: \"3xsmall\",\n },\n});\n\nexport const RelatedArticle = ({\n title,\n introduction,\n to,\n linkInfo = \"\",\n target = \"\",\n type = contentTypes.SUBJECT_MATERIAL,\n}: RelatedArticleProps) => {\n return (\n <CardRoot data-embed-type=\"related-article\">\n <CardContent>\n <ContentTypeBadge contentType={type} />\n <CardHeading asChild consumeCss>\n <span>\n <SafeLink\n unstyled\n to={to}\n target={target}\n rel={linkInfo ? \"noopener noreferrer\" : undefined}\n css={linkOverlay.raw()}\n >\n <StyledSpan>\n {title}\n {target === \"_blank\" && <ExternalLinkLine />}\n </StyledSpan>\n </SafeLink>\n </span>\n </CardHeading>\n <Text dangerouslySetInnerHTML={{ __html: introduction }} />\n <Text color=\"text.subtle\" textStyle=\"label.small\">\n {linkInfo}\n </Text>\n </CardContent>\n </CardRoot>\n );\n};\n\nconst HeadingWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n width: \"100%\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n alignSelf: \"flex-start\",\n },\n});\n\nconst ArticlesWrapper = styled(\"div\", {\n base: {\n display: \"grid\",\n width: \"100%\",\n gridTemplateColumns: \"repeat(2, 1fr)\",\n gap: \"medium\",\n tabletDown: {\n gridTemplateColumns: \"1fr\",\n },\n },\n});\n\nconst StyledSection = styled(\"section\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: \"medium\",\n clear: \"both\",\n },\n});\n\nconst StyledButton = styled(Button, {\n base: {\n marginBlockStart: \"xsmall\",\n },\n});\n\ninterface Props extends ComponentPropsWithoutRef<\"section\"> {\n children?: ReactElement[];\n articleCount?: number;\n headingLevel?: HeadingLevel;\n headingButtons?: ReactNode;\n}\n\nexport const RelatedArticleList = ({\n children = [],\n articleCount,\n headingLevel: HeadingElement = \"h2\",\n headingButtons,\n ...rest\n}: Props) => {\n const [expanded, setExpanded] = useState(false);\n const { t } = useTranslation();\n const childCount = useMemo(() => articleCount ?? Children.count(children), [children, articleCount]);\n const childrenToShow = useMemo(\n () => (childCount > 2 && !expanded ? children?.slice(0, 2) : children),\n [childCount, children, expanded],\n );\n\n return (\n <StyledSection {...rest} data-embed-type=\"related-content-list\">\n <HeadingWrapper>\n <Heading asChild consumeCss textStyle=\"title.large\" fontWeight=\"bold\">\n <HeadingElement>{t(\"related.title\")}</HeadingElement>\n </Heading>\n {headingButtons}\n </HeadingWrapper>\n <ArticlesWrapper>{childrenToShow}</ArticlesWrapper>\n {childCount > 2 ? (\n <StyledButton variant=\"secondary\" onClick={() => setExpanded((p) => !p)}>\n {t(`related.show${expanded ? \"Less\" : \"More\"}`)}\n </StyledButton>\n ) : null}\n </StyledSection>\n );\n};\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,aAAa,OAAO,QAAQ,EAChC,MAAM;CACJ,SAAS;CACT,KAAK;AACN,EACF,EAAC;AAEF,MAAa,iBAAiB,CAAC,EAC7B,OACA,cACA,IACA,WAAW,IACX,SAAS,IACT,OAAO,aAAa,kBACA,KAAK;AACzB,wBACE,IAAC;EAAS,mBAAgB;4BACxB,KAAC;mBACC,IAAC,oBAAiB,aAAa,OAAQ;mBACvC,IAAC;IAAY;IAAQ;8BACnB,IAAC,oCACC,IAAC;KACC;KACI;KACI;KACR,KAAK,WAAW;KAChB,KAAK,YAAY,KAAK;+BAEtB,KAAC,yBACE,OACA,WAAW,4BAAY,IAAC,qBAAmB,I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M,YAAY,CAAC,OAAO,EAAE;cACpE,GAAG,cAAc,WAAW,SAAS,OAAO,EAAE;KAClC,GACb;;GACU;AAEnB"}
@@ -0,0 +1,8 @@
1
+ import { RelatedArticle, RelatedArticleList } from "./RelatedArticleList.js";
2
+
3
+ //#region src/RelatedArticleList/index.ts
4
+ var RelatedArticleList_default = RelatedArticleList;
5
+
6
+ //#endregion
7
+ export { RelatedArticleList_default };
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/RelatedArticleList/index.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\nimport { RelatedArticle, RelatedArticleList } from \"./RelatedArticleList\";\n\nexport { RelatedArticle };\n\nexport default RelatedArticleList;\n"],"mappings":";;;AAYA,iCAAe"}
@@ -0,0 +1,74 @@
1
+ import { Heading, Image, Text } from "@ndla/primitives";
2
+ import { styled } from "@ndla/styled-system/jsx";
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
+ ] })] });
69
+ };
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"}
@@ -0,0 +1,100 @@
1
+ import { forwardRef, useEffect, useId, useRef } from "react";
2
+ import { ComboboxClearTrigger, ComboboxControl, ComboboxInput, ComboboxLabel, ComboboxRoot, ComboboxTrigger, TagsInputControl, TagsInputInput, TagsInputItem, TagsInputItemDeleteTrigger, TagsInputItemInput, TagsInputItemPreview, TagsInputItemText, TagsInputRoot } from "@ndla/primitives";
3
+ import { CloseLine } from "@ndla/icons";
4
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
+ import { contains } from "@ndla/util";
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
+ });
42
+ };
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
+ });
50
+ });
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
+ });
63
+ });
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
+ });
78
+ });
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 </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AU;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"}
@@ -0,0 +1,41 @@
1
+ import { forwardRef, useState } from "react";
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
+ });
38
+
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 };
@@ -0,0 +1,17 @@
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
+ };
14
+
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"}
@@ -0,0 +1,29 @@
1
+ import { messages_en_default } from "../locale/messages-en.js";
2
+ import { messages_nb_default } from "../locale/messages-nb.js";
3
+ import { messages_nn_default } from "../locale/messages-nn.js";
4
+ import { messages_se_default } from "../locale/messages-se.js";
5
+ import { initReactI18next } from "react-i18next";
6
+ import i18n from "i18next";
7
+
8
+ //#region src/i18n/i18n.ts
9
+ const supportedTranslationLanguages = [
10
+ "nb",
11
+ "nn",
12
+ "en",
13
+ "se"
14
+ ];
15
+ const i18nInstance = i18n.use(initReactI18next);
16
+ i18nInstance.init({
17
+ fallbackLng: "nb",
18
+ supportedLngs: supportedTranslationLanguages,
19
+ resources: {
20
+ en: { translation: messages_en_default },
21
+ nn: { translation: messages_nn_default },
22
+ nb: { translation: messages_nb_default },
23
+ se: { translation: messages_se_default }
24
+ }
25
+ });
26
+
27
+ //#endregion
28
+ export { i18nInstance, supportedTranslationLanguages };
29
+ //# sourceMappingURL=i18n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.js","names":["messagesEN","messagesNN","messagesNB","messagesSE"],"sources":["../../src/i18n/i18n.ts"],"sourcesContent":["/**\n * Copyright (c) 2021-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 i18n from \"i18next\";\nimport { initReactI18next } from \"react-i18next\";\nimport messagesEN from \"../locale/messages-en\";\nimport messagesNB from \"../locale/messages-nb\";\nimport messagesNN from \"../locale/messages-nn\";\nimport messagesSE from \"../locale/messages-se\";\n\nexport const supportedTranslationLanguages = [\"nb\", \"nn\", \"en\", \"se\"] as const;\nconst i18nInstance = i18n.use(initReactI18next);\n\ni18nInstance.init({\n fallbackLng: \"nb\",\n supportedLngs: supportedTranslationLanguages,\n resources: {\n en: {\n translation: messagesEN,\n },\n nn: {\n translation: messagesNN,\n },\n nb: {\n translation: messagesNB,\n },\n se: {\n translation: messagesSE,\n },\n },\n});\n\nexport { i18nInstance };\n"],"mappings":";;;;;;;;AAeA,MAAa,gCAAgC;CAAC;CAAM;CAAM;CAAM;AAAK;AACrE,MAAM,eAAe,KAAK,IAAI,iBAAiB;AAE/C,aAAa,KAAK;CAChB,aAAa;CACb,eAAe;CACf,WAAW;EACT,IAAI,EACF,aAAaA,oBACd;EACD,IAAI,EACF,aAAaC,oBACd;EACD,IAAI,EACF,aAAaC,oBACd;EACD,IAAI,EACF,aAAaC,oBACd;CACF;AACF,EAAC"}
@@ -0,0 +1,155 @@
1
+ import { useMemo } from "react";
2
+ import { useTranslation } from "react-i18next";
3
+
4
+ //#region src/i18n/useComponentTranslations.ts
5
+ const useTagsInputTranslations = (translations) => {
6
+ const { t } = useTranslation("translation", { keyPrefix: "component.tagsInput" });
7
+ return useMemo(() => ({
8
+ clearTriggerLabel: t("clearTriggerLabel"),
9
+ deleteTagTriggerLabel: (tag) => t("deleteTagTriggerLabel", { tag }),
10
+ tagAdded: (tag) => t("tagAdded", { tag }),
11
+ tagsPasted: (tag) => t("tagsPasted", { length: tag.length }),
12
+ tagEdited: (tag) => t("tagEdited", { tag }),
13
+ tagUpdated: (tag) => t("tagUpdated", { tag }),
14
+ tagDeleted: (tag) => t("tagDeleted", { tag }),
15
+ tagSelected: (tag) => t("tagSelected", { tag }),
16
+ ...translations
17
+ }), [t, translations]);
18
+ };
19
+ const useComboboxTranslations = (translations) => {
20
+ const { t } = useTranslation("translation", { keyPrefix: "component.combobox" });
21
+ return useMemo(() => ({
22
+ triggerLabel: t("triggerLabel"),
23
+ clearTriggerLabel: t("clearTriggerLabel"),
24
+ ...translations
25
+ }), [t, translations]);
26
+ };
27
+ const useTagSelectorTranslations = (translations) => {
28
+ const tagsInputTranslations = useTagsInputTranslations();
29
+ const comboboxTranslations = useComboboxTranslations();
30
+ return useMemo(() => ({
31
+ ...comboboxTranslations,
32
+ ...tagsInputTranslations,
33
+ ...translations
34
+ }), [
35
+ comboboxTranslations,
36
+ tagsInputTranslations,
37
+ translations
38
+ ]);
39
+ };
40
+ const usePaginationTranslations = (translations) => {
41
+ const { t } = useTranslation("translation", { keyPrefix: "component.pagination" });
42
+ return useMemo(() => ({
43
+ rootLabel: t("rootLabel"),
44
+ prevTriggerLabel: t("prevTriggerLabel"),
45
+ nextTriggerLabel: t("nextTriggerLabel"),
46
+ itemLabel: (details) => {
47
+ const lastPage = details.totalPages > 1 && details.page === details.totalPages;
48
+ return lastPage ? t("lastPage", { page: details.page }) : t("page", { page: details.page });
49
+ },
50
+ ...translations
51
+ }), [translations, t]);
52
+ };
53
+ const useImageSearchTranslations = (translations = {}) => {
54
+ const { t } = useTranslation("translation", { keyPrefix: "component.imageSearch" });
55
+ const paginationTranslations = usePaginationTranslations();
56
+ const { imagePreview, paginationTranslations: fallbackPaginationTranslations,...remaining } = translations;
57
+ return useMemo(() => ({
58
+ searchPlaceholder: t("searchPlaceholder"),
59
+ searchButtonTitle: t("searchButtonTitle"),
60
+ imagePreview: {
61
+ creatorsLabel: t("imagePreview.creatorsLabel"),
62
+ license: t("imagePreview.license"),
63
+ caption: t("imagePreview.caption"),
64
+ altText: t("imagePreview.altText"),
65
+ modelRelease: t("imagePreview.modelRelease"),
66
+ tags: t("imagePreview.tags"),
67
+ close: t("close"),
68
+ checkboxLabel: t("imagePreview.checkboxLabel"),
69
+ useImageTitle: t("imagePreview.useImageTitle"),
70
+ ...imagePreview
71
+ },
72
+ paginationTranslations: {
73
+ ...paginationTranslations,
74
+ ...fallbackPaginationTranslations
75
+ },
76
+ ...remaining
77
+ }), [
78
+ t,
79
+ paginationTranslations,
80
+ imagePreview,
81
+ fallbackPaginationTranslations,
82
+ remaining
83
+ ]);
84
+ };
85
+ const useAudioSearchTranslations = (translations = {}) => {
86
+ const { t } = useTranslation("translation", { keyPrefix: "component.audioSearch" });
87
+ const paginationTranslations = usePaginationTranslations();
88
+ const { paginationTranslations: fallbackPaginationTranslations,...remaining } = translations;
89
+ return useMemo(() => ({
90
+ searchPlaceholder: t("searchPlaceholder"),
91
+ searchButtonTitle: t("searchButtonTitle"),
92
+ useAudio: t("useAudio"),
93
+ noResults: t("noResults"),
94
+ paginationTranslations: {
95
+ ...paginationTranslations,
96
+ ...fallbackPaginationTranslations
97
+ },
98
+ ...remaining
99
+ }), [
100
+ t,
101
+ paginationTranslations,
102
+ fallbackPaginationTranslations,
103
+ remaining
104
+ ]);
105
+ };
106
+ const useVideoSearchTranslations = (translations) => {
107
+ const { t } = useTranslation("translation", { keyPrefix: "component.videoSearch" });
108
+ return useMemo(() => ({
109
+ searchPlaceholder: t("searchPlaceholder"),
110
+ searchButtonTitle: t("searchButtonTitle"),
111
+ loadMoreVideos: t("loadMoreVideos"),
112
+ noResults: t("noResults"),
113
+ is360Video: t("is360Video"),
114
+ previewVideo: t("previewVideo"),
115
+ addVideo: t("addVideo"),
116
+ close: t("close"),
117
+ ...translations
118
+ }), [t, translations]);
119
+ };
120
+ const useDatePickerTranslations = (translations) => {
121
+ const { t } = useTranslation("translation", { keyPrefix: "component.datePicker" });
122
+ return useMemo(() => ({
123
+ dayCell: (state) => {
124
+ if (state.unavailable) return t("dayCell.unavailable", { date: state.formattedDate });
125
+ else if (state.selected) return t("dayCell.selected", { date: state.formattedDate });
126
+ else return t("dayCell.select", { date: state.formattedDate });
127
+ },
128
+ nextTrigger: (view) => t(`nextTrigger.${view}`),
129
+ prevTrigger: (view) => t(`prevTrigger.${view}`),
130
+ monthSelect: t("monthSelect"),
131
+ yearSelect: t("yearSelect"),
132
+ viewTrigger: (view) => t(`viewTrigger.${view}`),
133
+ presetTrigger: (value) => {
134
+ if (Array.isArray(value)) return t("presetTrigger.range", {
135
+ start: value[0],
136
+ end: value[1]
137
+ });
138
+ else return t("presetTrigger.single", { date: value });
139
+ },
140
+ clearTrigger: t("clearTrigger"),
141
+ trigger: (open) => t(`trigger.${open ? "close" : "open"}`),
142
+ content: t("content"),
143
+ placeholder: (_locale) => {
144
+ return {
145
+ day: "dd",
146
+ month: "mm",
147
+ year: "yyyy"
148
+ };
149
+ }
150
+ }), [t, translations]);
151
+ };
152
+
153
+ //#endregion
154
+ export { useAudioSearchTranslations, useComboboxTranslations, useDatePickerTranslations, useImageSearchTranslations, usePaginationTranslations, useTagSelectorTranslations, useTagsInputTranslations, useVideoSearchTranslations };
155
+ //# sourceMappingURL=useComponentTranslations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useComponentTranslations.js","names":["translations?: Partial<TagsInputRootProps[\"translations\"]>","translations?: Partial<ComboboxRootProps<T>[\"translations\"]>","translations?: Partial<TagSelectorRootProps<T>[\"translations\"]>","translations?: Partial<PaginationRootProps[\"translations\"]>","translations: DeepPartial<ImageSearchTranslations>","translations: DeepPartial<AudioSearchTranslations>","translations?: Partial<VideoTranslations>","translations?: Partial<DatePickerRootProps[\"translations\"]>"],"sources":["../../src/i18n/useComponentTranslations.ts"],"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 { useTranslation } from \"react-i18next\";\nimport type { CollectionItem } from \"@ark-ui/react\";\nimport type { ComboboxRootProps, PaginationRootProps, TagsInputRootProps, DatePickerRootProps } from \"@ndla/primitives\";\nimport { type TagSelectorRootProps } from \"../TagSelector/TagSelector\";\nimport { useMemo } from \"react\";\n\ntype DeepPartial<T> = {\n [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];\n};\n\nexport const useTagsInputTranslations = (\n translations?: Partial<TagsInputRootProps[\"translations\"]>,\n): TagsInputRootProps[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.tagsInput\" });\n\n return useMemo(\n () => ({\n clearTriggerLabel: t(\"clearTriggerLabel\"),\n deleteTagTriggerLabel: (tag) => t(\"deleteTagTriggerLabel\", { tag }),\n tagAdded: (tag) => t(\"tagAdded\", { tag }),\n tagsPasted: (tag) => t(\"tagsPasted\", { length: tag.length }),\n tagEdited: (tag) => t(\"tagEdited\", { tag }),\n tagUpdated: (tag) => t(\"tagUpdated\", { tag }),\n tagDeleted: (tag) => t(\"tagDeleted\", { tag }),\n tagSelected: (tag) => t(\"tagSelected\", { tag }),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useComboboxTranslations = <T extends CollectionItem>(\n translations?: Partial<ComboboxRootProps<T>[\"translations\"]>,\n): ComboboxRootProps<T>[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.combobox\" });\n\n return useMemo(\n () => ({\n triggerLabel: t(\"triggerLabel\"),\n clearTriggerLabel: t(\"clearTriggerLabel\"),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useTagSelectorTranslations = <T extends CollectionItem>(\n translations?: Partial<TagSelectorRootProps<T>[\"translations\"]>,\n): TagSelectorRootProps<T>[\"translations\"] => {\n const tagsInputTranslations = useTagsInputTranslations();\n const comboboxTranslations = useComboboxTranslations();\n\n return useMemo(\n () =>\n ({\n ...comboboxTranslations,\n ...tagsInputTranslations,\n ...translations,\n }) as TagSelectorRootProps<T>[\"translations\"],\n [comboboxTranslations, tagsInputTranslations, translations],\n );\n};\n\nexport const usePaginationTranslations = (\n translations?: Partial<PaginationRootProps[\"translations\"]>,\n): PaginationRootProps[\"translations\"] => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.pagination\" });\n\n return useMemo(\n () => ({\n rootLabel: t(\"rootLabel\"),\n prevTriggerLabel: t(\"prevTriggerLabel\"),\n nextTriggerLabel: t(\"nextTriggerLabel\"),\n itemLabel: (details) => {\n const lastPage = details.totalPages > 1 && details.page === details.totalPages;\n return lastPage ? t(\"lastPage\", { page: details.page }) : t(\"page\", { page: details.page });\n },\n ...translations,\n }),\n [translations, t],\n );\n};\n\n// TODO: Deduplicate this and place it somewhere smart. Maybe core?\ninterface AudioSearchTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n useAudio: string;\n noResults: string;\n paginationTranslations: PaginationRootProps[\"translations\"];\n}\n\ninterface VideoTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n loadMoreVideos: string;\n noResults: string;\n is360Video: string;\n previewVideo: string;\n addVideo: string;\n close: string;\n}\ninterface PreviewTranslations {\n creatorsLabel: string;\n license: string;\n caption: string;\n altText: string;\n modelRelease: string;\n tags: string;\n close: string;\n checkboxLabel?: string;\n missingTitleFallback?: string;\n useImageTitle: string;\n}\n\ninterface ImageSearchTranslations {\n searchPlaceholder: string;\n searchButtonTitle: string;\n imagePreview: PreviewTranslations;\n paginationTranslations: PaginationRootProps[\"translations\"];\n}\n\nexport const useImageSearchTranslations = (\n translations: DeepPartial<ImageSearchTranslations> = {},\n): ImageSearchTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.imageSearch\" });\n const paginationTranslations = usePaginationTranslations();\n\n const { imagePreview, paginationTranslations: fallbackPaginationTranslations, ...remaining } = translations;\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n imagePreview: {\n creatorsLabel: t(\"imagePreview.creatorsLabel\"),\n license: t(\"imagePreview.license\"),\n caption: t(\"imagePreview.caption\"),\n altText: t(\"imagePreview.altText\"),\n modelRelease: t(\"imagePreview.modelRelease\"),\n tags: t(\"imagePreview.tags\"),\n close: t(\"close\"),\n checkboxLabel: t(\"imagePreview.checkboxLabel\"),\n useImageTitle: t(\"imagePreview.useImageTitle\"),\n ...imagePreview,\n },\n paginationTranslations: { ...paginationTranslations, ...fallbackPaginationTranslations },\n ...remaining,\n }),\n [t, paginationTranslations, imagePreview, fallbackPaginationTranslations, remaining],\n );\n};\n\nexport const useAudioSearchTranslations = (\n translations: DeepPartial<AudioSearchTranslations> = {},\n): AudioSearchTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.audioSearch\" });\n const paginationTranslations = usePaginationTranslations();\n\n const { paginationTranslations: fallbackPaginationTranslations, ...remaining } = translations;\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n useAudio: t(\"useAudio\"),\n noResults: t(\"noResults\"),\n paginationTranslations: { ...paginationTranslations, ...fallbackPaginationTranslations },\n ...remaining,\n }),\n [t, paginationTranslations, fallbackPaginationTranslations, remaining],\n );\n};\n\nexport const useVideoSearchTranslations = (translations?: Partial<VideoTranslations>): VideoTranslations => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.videoSearch\" });\n\n return useMemo(\n () => ({\n searchPlaceholder: t(\"searchPlaceholder\"),\n searchButtonTitle: t(\"searchButtonTitle\"),\n loadMoreVideos: t(\"loadMoreVideos\"),\n noResults: t(\"noResults\"),\n is360Video: t(\"is360Video\"),\n previewVideo: t(\"previewVideo\"),\n addVideo: t(\"addVideo\"),\n close: t(\"close\"),\n ...translations,\n }),\n [t, translations],\n );\n};\n\nexport const useDatePickerTranslations = (\n translations?: Partial<DatePickerRootProps[\"translations\"]>,\n): NonNullable<DatePickerRootProps[\"translations\"]> => {\n const { t } = useTranslation(\"translation\", { keyPrefix: \"component.datePicker\" });\n\n return useMemo(\n () => ({\n dayCell: (state) => {\n if (state.unavailable) {\n return t(\"dayCell.unavailable\", { date: state.formattedDate });\n } else if (state.selected) {\n return t(\"dayCell.selected\", { date: state.formattedDate });\n } else return t(\"dayCell.select\", { date: state.formattedDate });\n },\n nextTrigger: (view) => t(`nextTrigger.${view}`),\n prevTrigger: (view) => t(`prevTrigger.${view}`),\n monthSelect: t(\"monthSelect\"),\n yearSelect: t(\"yearSelect\"),\n viewTrigger: (view) => t(`viewTrigger.${view}`),\n presetTrigger: (value) => {\n if (Array.isArray(value)) {\n return t(\"presetTrigger.range\", { start: value[0], end: value[1] });\n } else return t(\"presetTrigger.single\", { date: value });\n },\n clearTrigger: t(\"clearTrigger\"),\n trigger: (open) => t(`trigger.${open ? \"close\" : \"open\"}`),\n content: t(\"content\"),\n placeholder: (_locale) => {\n return { day: \"dd\", month: \"mm\", year: \"yyyy\" };\n },\n }),\n [t, translations],\n );\n};\n"],"mappings":";;;;AAkBA,MAAa,2BAA2B,CACtCA,iBACuC;CACvC,MAAM,EAAE,GAAG,GAAG,eAAe,eAAe,EAAE,WAAW,sBAAuB,EAAC;AAEjF,QAAO,QACL,OAAO;EACL,mBAAmB,EAAE,oBAAoB;EACzC,uBAAuB,CAAC,QAAQ,EAAE,yBAAyB,EAAE,IAAK,EAAC;EACn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,OAAO;IAAM,MAAM;GAAQ;EAChD;CACF,IACD,CAAC,GAAG,YAAa,EAClB;AACF"}
package/es/index.js ADDED
@@ -0,0 +1,65 @@
1
+ import { LicenseLink } from "./LicenseByline/LicenseLink.js";
2
+ import { EmbedByline } from "./LicenseByline/EmbedByline.js";
3
+ import { licenseAttributes } from "./utils/licenseAttributes.js";
4
+ import { ImageEmbed_default, getCrop, getFocalPoint } from "./Embed/ImageEmbed.js";
5
+ import { InlineTriggerButton } from "./Embed/InlineTriggerButton.js";
6
+ import { AudioPlayer_default } from "./AudioPlayer/index.js";
7
+ import { AudioEmbed_default } from "./Embed/AudioEmbed.js";
8
+ import { H5pEmbed_default } from "./Embed/H5pEmbed.js";
9
+ import { ResourceBox_default } from "./ResourceBox/ResourceBox.js";
10
+ import { ExternalEmbed_default } from "./Embed/ExternalEmbed.js";
11
+ import { IframeEmbed_default } from "./Embed/IframeEmbed.js";
12
+ import { FootnoteEmbed_default } from "./Embed/FootnoteEmbed.js";
13
+ import { BrightcoveEmbed_default } from "./Embed/BrightcoveEmbed.js";
14
+ import { ContentLinkEmbed_default } from "./Embed/ContentLinkEmbed.js";
15
+ import { ContentTypeBadge, contentTypeToBadgeVariantMap } from "./ContentTypeBadge/ContentTypeBadge.js";
16
+ import { RelatedArticle } from "./RelatedArticleList/RelatedArticleList.js";
17
+ import { RelatedContentEmbed_default } from "./Embed/RelatedContentEmbed.js";
18
+ import { ConceptInlineTriggerButton } from "./Embed/ConceptInlineTriggerButton.js";
19
+ import { GlossExample_default } from "./Gloss/GlossExample.js";
20
+ import { Gloss_default } from "./Gloss/Gloss.js";
21
+ import { BlockConcept, ConceptEmbed, InlineConcept } from "./Embed/ConceptEmbed.js";
22
+ import { UnknownEmbed_default } from "./Embed/UnknownEmbed.js";
23
+ import { UuDisclaimerEmbed_default } from "./Embed/UuDisclaimerEmbed.js";
24
+ import { CopyrightEmbed_default } from "./Embed/CopyrightEmbed.js";
25
+ import { CodeBlock_default } from "./CodeBlock/CodeBlock.js";
26
+ import { codeLanguageOptions } from "./CodeBlock/codeLanguageOptions.js";
27
+ import { CodeEmbed_default } from "./Embed/CodeEmbed.js";
28
+ import { EmbedWrapper } from "./Embed/EmbedWrapper.js";
29
+ import { Concept } from "./Concept/Concept.js";
30
+ import { ArticleFootNotes } from "./Article/ArticleFootNotes.js";
31
+ import { ArticleByline, ArticleBylineAccordionItem } from "./Article/ArticleByline.js";
32
+ import { Article, ArticleContent, ArticleFooter, ArticleHGroup, ArticleHeader, ArticleTitle, ArticleWrapper } from "./Article/Article.js";
33
+ import { model_default } from "./model/index.js";
34
+ import { messages_en_default } from "./locale/messages-en.js";
35
+ import { messages_nb_default } from "./locale/messages-nb.js";
36
+ import { messages_nn_default } from "./locale/messages-nn.js";
37
+ import { messages_se_default } from "./locale/messages-se.js";
38
+ import { i18nInstance } from "./i18n/i18n.js";
39
+ import { getPossiblyRelativeUrl } from "./utils/relativeUrl.js";
40
+ import { RelatedArticleList_default } from "./RelatedArticleList/index.js";
41
+ import { ErrorMessage_default } from "./ErrorMessage/index.js";
42
+ import { FileListEmbed, FileListItem, FileListWrapper } from "./FileList/FileList.js";
43
+ import { File, FileListElement } from "./FileList/File.js";
44
+ import { PdfFile } from "./FileList/PdfFile.js";
45
+ import { FactBox_default } from "./FactBox/index.js";
46
+ import { ContentTypeHero } from "./ContentTypeHero/ContentTypeHero.js";
47
+ import { HomeBreadcrumb_default } from "./Breadcrumb/HomeBreadcrumb.js";
48
+ import { Breadcrumb_default } from "./Breadcrumb/index.js";
49
+ import { formatNestedMessages } from "./i18n/formatNestedMessages.js";
50
+ import { TagSelectorClearTrigger, TagSelectorControl, TagSelectorInput, TagSelectorInputBase, TagSelectorItemInput, TagSelectorLabel, TagSelectorRoot, TagSelectorTrigger } from "./TagSelector/TagSelector.js";
51
+ import { useAudioSearchTranslations, useComboboxTranslations, useDatePickerTranslations, useImageSearchTranslations, usePaginationTranslations, useTagSelectorTranslations, useTagsInputTranslations, useVideoSearchTranslations } from "./i18n/useComponentTranslations.js";
52
+ import { ContentTypeBlockQuote } from "./ContentTypeBlockQuote/ContentTypeBlockQuote.js";
53
+ import { ContentTypeFramedContent } from "./ContentTypeFramedContent/ContentTypeFramedContent.js";
54
+ import { CopyParagraphButton_default } from "./CopyParagraphButton/index.js";
55
+ import { Pitch } from "./Pitch/Pitch.js";
56
+ import { KeyFigure_default } from "./KeyFigure/KeyFigure.js";
57
+ import { ContactBlock, contactBlockBackgrounds } from "./ContactBlock/ContactBlock.js";
58
+ import { CampaignBlock_default } from "./CampaignBlock/CampaignBlock.js";
59
+ import { Grid } from "./Grid/Grid.js";
60
+ import { GridParallaxItem } from "./Grid/GridParallaxItem.js";
61
+ import { LinkBlock_default } from "./LinkBlock/LinkBlock.js";
62
+ import { LinkBlockSection_default } from "./LinkBlock/LinkBlockSection.js";
63
+ import { ZendeskButton } from "./ZendeskButton/ZendeskButton.js";
64
+
65
+ export { Article, ArticleByline, ArticleBylineAccordionItem, ArticleContent, ArticleFootNotes, ArticleFooter, ArticleHGroup, ArticleHeader, ArticleTitle, ArticleWrapper, AudioEmbed_default as AudioEmbed, AudioPlayer_default as AudioPlayer, BlockConcept, Breadcrumb_default as Breadcrumb, BrightcoveEmbed_default as BrightcoveEmbed, CampaignBlock_default as CampaignBlock, CodeBlock_default as CodeBlock, CodeEmbed_default as CodeEmbed, Concept, ConceptEmbed, ConceptInlineTriggerButton, ContactBlock, ContentLinkEmbed_default as ContentLinkEmbed, ContentTypeBadge, ContentTypeBlockQuote, ContentTypeFramedContent, ContentTypeHero, CopyParagraphButton_default as CopyParagraphButton, CopyrightEmbed_default as CopyrightEmbed, EmbedByline, EmbedWrapper, ErrorMessage_default as ErrorMessage, ExternalEmbed_default as ExternalEmbed, FactBox_default as FactBox, File, FileListElement, FileListEmbed, FileListItem, FileListWrapper, FootnoteEmbed_default as FootnoteEmbed, Gloss_default as Gloss, GlossExample_default as GlossExample, Grid, GridParallaxItem, H5pEmbed_default as H5pEmbed, HomeBreadcrumb_default as HomeBreadcrumb, IframeEmbed_default as IframeEmbed, ImageEmbed_default as ImageEmbed, InlineConcept, InlineTriggerButton, KeyFigure_default as KeyFigure, LicenseLink, LinkBlock_default as LinkBlock, LinkBlockSection_default as LinkBlockSection, PdfFile, Pitch, RelatedArticle, RelatedArticleList_default as RelatedArticleList, RelatedContentEmbed_default as RelatedContentEmbed, ResourceBox_default as ResourceBox, TagSelectorClearTrigger, TagSelectorControl, TagSelectorInput, TagSelectorInputBase, TagSelectorItemInput, TagSelectorLabel, TagSelectorRoot, TagSelectorTrigger, UnknownEmbed_default as UnknownEmbed, UuDisclaimerEmbed_default as UuDisclaimerEmbed, ZendeskButton, codeLanguageOptions, model_default as constants, contactBlockBackgrounds, contentTypeToBadgeVariantMap, formatNestedMessages, getCrop, getFocalPoint, getPossiblyRelativeUrl, i18nInstance, licenseAttributes, messages_en_default as messagesEN, messages_nb_default as messagesNB, messages_nn_default as messagesNN, messages_se_default as messagesSE, useAudioSearchTranslations, useComboboxTranslations, useDatePickerTranslations, useImageSearchTranslations, usePaginationTranslations, useTagSelectorTranslations, useTagsInputTranslations, useVideoSearchTranslations };