@ndla/ui 55.0.13-alpha.0 → 55.0.15-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 (337) hide show
  1. package/dist/panda.buildinfo.json +142 -1
  2. package/dist/styles.css +597 -0
  3. package/es/Article/ArticleByline.js +7 -7
  4. package/es/Article/ArticleParagraph.js +11 -13
  5. package/es/AudioPlayer/AudioPlayer.js +1 -0
  6. package/es/CampaignBlock/CampaignBlock.js +103 -68
  7. package/es/Concept/Concept.js +69 -0
  8. package/es/ContactBlock/ContactBlock.js +17 -17
  9. package/es/ContentTypeBadge/ContentTypeBadgeNew.js +48 -0
  10. package/es/Embed/AudioEmbed.js +1 -2
  11. package/es/Embed/BrightcoveEmbed.js +13 -25
  12. package/es/Embed/ConceptEmbed.js +57 -301
  13. package/es/Embed/ConceptListEmbed.js +18 -24
  14. package/es/Embed/ContentLinkEmbed.js +10 -10
  15. package/es/Embed/CopyrightEmbed.js +3 -21
  16. package/es/Embed/ExternalEmbed.js +10 -18
  17. package/es/Embed/FootnoteEmbed.js +11 -8
  18. package/es/Embed/GlossEmbed.js +68 -0
  19. package/es/Embed/H5pEmbed.js +19 -19
  20. package/es/Embed/IframeEmbed.js +9 -6
  21. package/es/Embed/InlineTriggerButton.js +70 -0
  22. package/es/Embed/UnknownEmbed.js +9 -9
  23. package/es/Embed/UuDisclaimerEmbed.js +14 -25
  24. package/es/Embed/index.js +1 -3
  25. package/es/ErrorMessage/ErrorMessage.js +41 -22
  26. package/es/ErrorMessage/ErrorResourceAccessDenied.js +8 -6
  27. package/es/FactBox/FactBox.js +118 -47
  28. package/es/FileList/PdfFile.js +23 -5
  29. package/es/Gloss/Gloss.js +116 -86
  30. package/es/Gloss/GlossExample.js +49 -51
  31. package/es/LicenseByline/EmbedByline.js +143 -33
  32. package/es/LicenseByline/LicenseLink.js +16 -9
  33. package/es/LicenseByline/index.js +2 -2
  34. package/es/LinkBlock/LinkBlock.js +61 -33
  35. package/es/LinkBlock/LinkBlockSection.js +9 -6
  36. package/es/Logo/Logo.js +1 -30
  37. package/es/RelatedArticleList/RelatedArticleList.js +70 -87
  38. package/es/ResourceBox/ResourceBox.js +65 -37
  39. package/es/TagSelector/TagSelector.js +124 -131
  40. package/es/i18n/index.js +2 -1
  41. package/es/i18n/useComponentTranslations.js +83 -0
  42. package/es/index.js +4 -12
  43. package/es/locale/messages-en.js +30 -4
  44. package/es/locale/messages-nb.js +30 -4
  45. package/es/locale/messages-nn.js +30 -4
  46. package/es/locale/messages-se.js +30 -4
  47. package/es/locale/messages-sma.js +30 -4
  48. package/es/model/ContentType.js +3 -0
  49. package/es/styles.css +597 -0
  50. package/lib/Article/ArticleByline.js +8 -8
  51. package/lib/Article/ArticleParagraph.js +12 -14
  52. package/lib/AudioPlayer/AudioPlayer.js +1 -0
  53. package/lib/CampaignBlock/CampaignBlock.d.ts +2 -2
  54. package/lib/CampaignBlock/CampaignBlock.js +106 -68
  55. package/lib/Concept/Concept.d.ts +18 -0
  56. package/lib/Concept/Concept.js +75 -0
  57. package/lib/ContactBlock/ContactBlock.js +18 -18
  58. package/lib/ContentTypeBadge/ContentTypeBadgeNew.d.ts +17 -0
  59. package/lib/ContentTypeBadge/ContentTypeBadgeNew.js +56 -0
  60. package/lib/Embed/AudioEmbed.js +2 -3
  61. package/lib/Embed/BrightcoveEmbed.d.ts +1 -2
  62. package/lib/Embed/BrightcoveEmbed.js +16 -26
  63. package/lib/Embed/ConceptEmbed.d.ts +15 -21
  64. package/lib/Embed/ConceptEmbed.js +58 -301
  65. package/lib/Embed/ConceptListEmbed.js +21 -26
  66. package/lib/Embed/ContentLinkEmbed.js +10 -11
  67. package/lib/Embed/CopyrightEmbed.js +5 -22
  68. package/lib/Embed/ExternalEmbed.d.ts +1 -2
  69. package/lib/Embed/ExternalEmbed.js +13 -19
  70. package/lib/Embed/FootnoteEmbed.js +11 -9
  71. package/lib/Embed/GlossEmbed.d.ts +13 -0
  72. package/lib/Embed/GlossEmbed.js +76 -0
  73. package/lib/Embed/H5pEmbed.d.ts +1 -2
  74. package/lib/Embed/H5pEmbed.js +21 -19
  75. package/lib/Embed/IframeEmbed.d.ts +1 -2
  76. package/lib/Embed/IframeEmbed.js +11 -8
  77. package/lib/Embed/InlineTriggerButton.d.ts +11 -0
  78. package/lib/Embed/InlineTriggerButton.js +76 -0
  79. package/lib/Embed/UnknownEmbed.js +9 -10
  80. package/lib/Embed/UuDisclaimerEmbed.js +16 -26
  81. package/lib/Embed/index.d.ts +2 -3
  82. package/lib/Embed/index.js +2 -9
  83. package/lib/ErrorMessage/ErrorMessage.js +40 -23
  84. package/lib/ErrorMessage/ErrorResourceAccessDenied.js +7 -6
  85. package/lib/FactBox/FactBox.d.ts +0 -1
  86. package/lib/FactBox/FactBox.js +119 -46
  87. package/lib/FileList/PdfFile.js +23 -5
  88. package/lib/Gloss/Gloss.d.ts +10 -2
  89. package/lib/Gloss/Gloss.js +116 -85
  90. package/lib/Gloss/GlossExample.d.ts +3 -5
  91. package/lib/Gloss/GlossExample.js +49 -52
  92. package/lib/LicenseByline/EmbedByline.d.ts +2 -4
  93. package/lib/LicenseByline/EmbedByline.js +145 -35
  94. package/lib/LicenseByline/LicenseLink.d.ts +2 -2
  95. package/lib/LicenseByline/LicenseLink.js +16 -9
  96. package/lib/LicenseByline/index.d.ts +2 -2
  97. package/lib/LicenseByline/index.js +4 -5
  98. package/lib/LinkBlock/LinkBlock.js +62 -34
  99. package/lib/LinkBlock/LinkBlockSection.js +9 -7
  100. package/lib/Logo/Logo.d.ts +1 -3
  101. package/lib/Logo/Logo.js +2 -30
  102. package/lib/RelatedArticleList/RelatedArticleList.d.ts +4 -4
  103. package/lib/RelatedArticleList/RelatedArticleList.js +74 -90
  104. package/lib/ResourceBox/ResourceBox.js +64 -37
  105. package/lib/TagSelector/TagSelector.d.ts +27 -12
  106. package/lib/TagSelector/TagSelector.js +126 -131
  107. package/lib/i18n/index.d.ts +1 -0
  108. package/lib/i18n/index.js +20 -1
  109. package/lib/i18n/useComponentTranslations.d.ts +14 -0
  110. package/lib/i18n/useComponentTranslations.js +93 -0
  111. package/lib/index.d.ts +5 -15
  112. package/lib/index.js +70 -102
  113. package/lib/locale/messages-en.d.ts +26 -0
  114. package/lib/locale/messages-en.js +30 -4
  115. package/lib/locale/messages-nb.d.ts +26 -0
  116. package/lib/locale/messages-nb.js +30 -4
  117. package/lib/locale/messages-nn.d.ts +26 -0
  118. package/lib/locale/messages-nn.js +30 -4
  119. package/lib/locale/messages-se.d.ts +26 -0
  120. package/lib/locale/messages-se.js +30 -4
  121. package/lib/locale/messages-sma.d.ts +26 -0
  122. package/lib/locale/messages-sma.js +30 -4
  123. package/lib/model/ContentType.d.ts +3 -0
  124. package/lib/model/ContentType.js +4 -1
  125. package/lib/styles.css +597 -0
  126. package/package.json +11 -13
  127. package/src/Article/ArticleByline.tsx +1 -1
  128. package/src/Article/ArticleParagraph.tsx +11 -9
  129. package/src/AudioPlayer/AudioPlayer.tsx +1 -0
  130. package/src/CampaignBlock/CampaignBlock.tsx +92 -55
  131. package/src/Concept/Concept.stories.tsx +142 -0
  132. package/src/Concept/Concept.tsx +73 -0
  133. package/src/ContactBlock/ContactBlock.tsx +1 -1
  134. package/src/ContentTypeBadge/ContentTypeBadgeNew.stories.tsx +70 -0
  135. package/src/ContentTypeBadge/ContentTypeBadgeNew.tsx +69 -0
  136. package/src/Embed/AudioEmbed.tsx +2 -2
  137. package/src/Embed/BrightcoveEmbed.stories.tsx +0 -3
  138. package/src/Embed/BrightcoveEmbed.tsx +18 -20
  139. package/src/Embed/ConceptEmbed.stories.tsx +1 -105
  140. package/src/Embed/ConceptEmbed.tsx +60 -385
  141. package/src/Embed/ConceptListEmbed.tsx +20 -19
  142. package/src/Embed/ContentLinkEmbed.tsx +8 -10
  143. package/src/Embed/CopyrightEmbed.tsx +1 -11
  144. package/src/Embed/ExternalEmbed.tsx +14 -17
  145. package/src/Embed/FootnoteEmbed.stories.tsx +2 -5
  146. package/src/Embed/FootnoteEmbed.tsx +13 -16
  147. package/src/Embed/GlossEmbed.stories.tsx +140 -0
  148. package/src/Embed/GlossEmbed.tsx +64 -0
  149. package/src/Embed/H5pEmbed.tsx +22 -16
  150. package/src/Embed/IframeEmbed.tsx +12 -6
  151. package/src/Embed/InlineTriggerButton.tsx +72 -0
  152. package/src/Embed/UnknownEmbed.tsx +6 -7
  153. package/src/Embed/UuDisclaimerEmbed.stories.tsx +4 -4
  154. package/src/Embed/UuDisclaimerEmbed.tsx +17 -25
  155. package/src/Embed/index.ts +2 -3
  156. package/src/ErrorMessage/ErrorMessage.tsx +40 -29
  157. package/src/ErrorMessage/ErrorResourceAccessDenied.tsx +8 -6
  158. package/src/FactBox/FactBox.tsx +115 -115
  159. package/src/FactBox/Factbox.stories.tsx +43 -27
  160. package/src/FileList/FileList.stories.tsx +6 -1
  161. package/src/FileList/PdfFile.tsx +22 -5
  162. package/src/Gloss/Gloss.stories.tsx +107 -1
  163. package/src/Gloss/Gloss.tsx +143 -156
  164. package/src/Gloss/GlossExample.tsx +51 -77
  165. package/src/LicenseByline/EmbedByline.stories.tsx +9 -4
  166. package/src/LicenseByline/EmbedByline.tsx +139 -53
  167. package/src/LicenseByline/LicenseLink.tsx +15 -15
  168. package/src/LicenseByline/index.tsx +2 -2
  169. package/src/LinkBlock/LinkBlock.stories.tsx +8 -10
  170. package/src/LinkBlock/LinkBlock.tsx +54 -59
  171. package/src/LinkBlock/LinkBlockSection.tsx +9 -12
  172. package/src/Logo/Logo.stories.tsx +0 -1
  173. package/src/Logo/Logo.tsx +2 -30
  174. package/src/RelatedArticleList/RelatedArticleList.tsx +69 -88
  175. package/src/ResourceBox/ResourceBox.tsx +63 -59
  176. package/src/TagSelector/TagSelector.stories.tsx +92 -68
  177. package/src/TagSelector/TagSelector.tsx +161 -126
  178. package/src/i18n/index.ts +5 -0
  179. package/src/i18n/useComponentTranslations.ts +72 -0
  180. package/src/index.ts +23 -19
  181. package/src/locale/messages-en.ts +28 -2
  182. package/src/locale/messages-nb.ts +28 -2
  183. package/src/locale/messages-nn.ts +28 -2
  184. package/src/locale/messages-se.ts +28 -2
  185. package/src/locale/messages-sma.ts +28 -2
  186. package/src/model/ContentType.ts +3 -0
  187. package/es/DefinitionList/DefinitionDescription.js +0 -28
  188. package/es/DefinitionList/DefinitionTerm.js +0 -28
  189. package/es/DefinitionList/index.js +0 -10
  190. package/es/Embed/conceptComponents.js +0 -155
  191. package/es/ExpandableBox/ExpandableBox.js +0 -29
  192. package/es/ExpandableBox/index.js +0 -9
  193. package/es/Figure/Figure.js +0 -73
  194. package/es/Figure/index.js +0 -9
  195. package/es/FramedContent/FramedContent.js +0 -28
  196. package/es/FramedContent/index.js +0 -10
  197. package/es/Image/Image.js +0 -99
  198. package/es/Image/ImageLink.js +0 -39
  199. package/es/Image/index.js +0 -12
  200. package/es/LetterFilter/LetterFilter.js +0 -54
  201. package/es/LetterFilter/alphabet.js +0 -9
  202. package/es/LetterFilter/index.js +0 -10
  203. package/es/LicenseByline/LicenseDescription.js +0 -63
  204. package/es/List/OrderedList.js +0 -41
  205. package/es/List/UnOrderedList.js +0 -28
  206. package/es/List/index.js +0 -10
  207. package/es/Notion/Notion.js +0 -76
  208. package/es/Notion/NotionImage.js +0 -46
  209. package/es/Notion/index.js +0 -9
  210. package/es/Table/Table.js +0 -141
  211. package/es/Table/index.js +0 -11
  212. package/es/TagSelector/Control.js +0 -28
  213. package/es/TagSelector/DropdownIndicator.js +0 -60
  214. package/es/TagSelector/Input.js +0 -22
  215. package/es/TagSelector/Menu.js +0 -27
  216. package/es/TagSelector/MenuList.js +0 -28
  217. package/es/TagSelector/Option.js +0 -60
  218. package/es/TagSelector/SelectContainer.js +0 -27
  219. package/es/TagSelector/ValueButton.js +0 -53
  220. package/es/TagSelector/ariaMessages.js +0 -94
  221. package/es/TagSelector/index.js +0 -10
  222. package/es/TagSelector/types.js +0 -1
  223. package/lib/DefinitionList/DefinitionDescription.d.ts +0 -10
  224. package/lib/DefinitionList/DefinitionDescription.js +0 -35
  225. package/lib/DefinitionList/DefinitionTerm.d.ts +0 -10
  226. package/lib/DefinitionList/DefinitionTerm.js +0 -35
  227. package/lib/DefinitionList/index.d.ts +0 -9
  228. package/lib/DefinitionList/index.js +0 -20
  229. package/lib/Embed/conceptComponents.d.ts +0 -40
  230. package/lib/Embed/conceptComponents.js +0 -163
  231. package/lib/ExpandableBox/ExpandableBox.d.ts +0 -15
  232. package/lib/ExpandableBox/ExpandableBox.js +0 -37
  233. package/lib/ExpandableBox/index.d.ts +0 -8
  234. package/lib/ExpandableBox/index.js +0 -18
  235. package/lib/Figure/Figure.d.ts +0 -16
  236. package/lib/Figure/Figure.js +0 -81
  237. package/lib/Figure/index.d.ts +0 -9
  238. package/lib/Figure/index.js +0 -13
  239. package/lib/FramedContent/FramedContent.d.ts +0 -12
  240. package/lib/FramedContent/FramedContent.js +0 -35
  241. package/lib/FramedContent/index.d.ts +0 -9
  242. package/lib/FramedContent/index.js +0 -16
  243. package/lib/Image/Image.d.ts +0 -38
  244. package/lib/Image/Image.js +0 -105
  245. package/lib/Image/ImageLink.d.ts +0 -18
  246. package/lib/Image/ImageLink.js +0 -44
  247. package/lib/Image/index.d.ts +0 -12
  248. package/lib/Image/index.js +0 -30
  249. package/lib/LetterFilter/LetterFilter.d.ts +0 -14
  250. package/lib/LetterFilter/LetterFilter.js +0 -61
  251. package/lib/LetterFilter/alphabet.d.ts +0 -8
  252. package/lib/LetterFilter/alphabet.js +0 -15
  253. package/lib/LetterFilter/index.d.ts +0 -9
  254. package/lib/LetterFilter/index.js +0 -16
  255. package/lib/LicenseByline/LicenseDescription.d.ts +0 -15
  256. package/lib/LicenseByline/LicenseDescription.js +0 -70
  257. package/lib/List/OrderedList.d.ts +0 -16
  258. package/lib/List/OrderedList.js +0 -48
  259. package/lib/List/UnOrderedList.d.ts +0 -10
  260. package/lib/List/UnOrderedList.js +0 -35
  261. package/lib/List/index.d.ts +0 -9
  262. package/lib/List/index.js +0 -20
  263. package/lib/Notion/Notion.d.ts +0 -20
  264. package/lib/Notion/Notion.js +0 -82
  265. package/lib/Notion/NotionImage.d.ts +0 -13
  266. package/lib/Notion/NotionImage.js +0 -54
  267. package/lib/Notion/index.d.ts +0 -8
  268. package/lib/Notion/index.js +0 -13
  269. package/lib/Table/Table.d.ts +0 -19
  270. package/lib/Table/Table.js +0 -145
  271. package/lib/Table/index.d.ts +0 -10
  272. package/lib/Table/index.js +0 -23
  273. package/lib/TagSelector/Control.d.ts +0 -11
  274. package/lib/TagSelector/Control.js +0 -35
  275. package/lib/TagSelector/DropdownIndicator.d.ts +0 -11
  276. package/lib/TagSelector/DropdownIndicator.js +0 -64
  277. package/lib/TagSelector/Input.d.ts +0 -12
  278. package/lib/TagSelector/Input.js +0 -29
  279. package/lib/TagSelector/Menu.d.ts +0 -12
  280. package/lib/TagSelector/Menu.js +0 -34
  281. package/lib/TagSelector/MenuList.d.ts +0 -16
  282. package/lib/TagSelector/MenuList.js +0 -35
  283. package/lib/TagSelector/Option.d.ts +0 -12
  284. package/lib/TagSelector/Option.js +0 -67
  285. package/lib/TagSelector/SelectContainer.d.ts +0 -11
  286. package/lib/TagSelector/SelectContainer.js +0 -34
  287. package/lib/TagSelector/ValueButton.d.ts +0 -20
  288. package/lib/TagSelector/ValueButton.js +0 -60
  289. package/lib/TagSelector/ariaMessages.d.ts +0 -16
  290. package/lib/TagSelector/ariaMessages.js +0 -101
  291. package/lib/TagSelector/index.d.ts +0 -11
  292. package/lib/TagSelector/index.js +0 -13
  293. package/lib/TagSelector/types.d.ts +0 -11
  294. package/lib/TagSelector/types.js +0 -5
  295. package/src/DefinitionList/DefinitionDescription.tsx +0 -26
  296. package/src/DefinitionList/DefinitionTerm.tsx +0 -26
  297. package/src/DefinitionList/index.tsx +0 -10
  298. package/src/Embed/conceptComponents.tsx +0 -293
  299. package/src/ExpandableBox/ExpandableBox.stories.tsx +0 -41
  300. package/src/ExpandableBox/ExpandableBox.tsx +0 -23
  301. package/src/ExpandableBox/index.ts +0 -9
  302. package/src/Figure/Figure.tsx +0 -167
  303. package/src/Figure/index.ts +0 -11
  304. package/src/FramedContent/FramedContent.stories.tsx +0 -152
  305. package/src/FramedContent/FramedContent.tsx +0 -26
  306. package/src/FramedContent/index.ts +0 -10
  307. package/src/Image/Image.stories.tsx +0 -61
  308. package/src/Image/Image.tsx +0 -147
  309. package/src/Image/ImageLink.tsx +0 -37
  310. package/src/Image/index.ts +0 -14
  311. package/src/LetterFilter/LetterFilter.stories.tsx +0 -29
  312. package/src/LetterFilter/LetterFilter.tsx +0 -78
  313. package/src/LetterFilter/alphabet.ts +0 -39
  314. package/src/LetterFilter/index.ts +0 -11
  315. package/src/LicenseByline/LicenseDescription.tsx +0 -100
  316. package/src/List/OrderedList.stories.tsx +0 -135
  317. package/src/List/OrderedList.tsx +0 -158
  318. package/src/List/UnOrderedList.tsx +0 -43
  319. package/src/List/UnorderedList.stories.tsx +0 -72
  320. package/src/List/index.ts +0 -10
  321. package/src/Notion/Notion.tsx +0 -96
  322. package/src/Notion/NotionImage.tsx +0 -64
  323. package/src/Notion/index.ts +0 -9
  324. package/src/Table/Table.stories.tsx +0 -738
  325. package/src/Table/Table.tsx +0 -284
  326. package/src/Table/index.ts +0 -12
  327. package/src/TagSelector/Control.tsx +0 -34
  328. package/src/TagSelector/DropdownIndicator.tsx +0 -55
  329. package/src/TagSelector/Input.tsx +0 -31
  330. package/src/TagSelector/Menu.tsx +0 -38
  331. package/src/TagSelector/MenuList.tsx +0 -30
  332. package/src/TagSelector/Option.tsx +0 -58
  333. package/src/TagSelector/SelectContainer.tsx +0 -31
  334. package/src/TagSelector/ValueButton.tsx +0 -47
  335. package/src/TagSelector/ariaMessages.ts +0 -96
  336. package/src/TagSelector/index.ts +0 -14
  337. package/src/TagSelector/types.ts +0 -12
@@ -6,23 +6,20 @@
6
6
  *
7
7
  */
8
8
 
9
- import { ReactNode } from "react";
9
+ import { ReactNode, useState } from "react";
10
10
  import { useTranslation } from "react-i18next";
11
- import styled from "@emotion/styled";
12
- import { colors, fonts, misc, spacing } from "@ndla/core";
13
11
  import { WarningOutline } from "@ndla/icons/common";
14
12
  import { getLicenseByAbbreviation, getLicenseCredits } from "@ndla/licenses";
13
+ import { Button, Text } from "@ndla/primitives";
14
+ import { styled } from "@ndla/styled-system/jsx";
15
15
  import { ICopyright as ArticleCopyright } from "@ndla/types-backend/article-api";
16
16
  import { ICopyright as AudioCopyright } from "@ndla/types-backend/audio-api";
17
17
  import { IDraftCopyright as ConceptCopyright } from "@ndla/types-backend/concept-api";
18
18
  import { ICopyright as ImageCopyright } from "@ndla/types-backend/image-api";
19
19
  import { BrightcoveCopyright } from "@ndla/types-embed";
20
- import LicenseDescription from "./LicenseDescription";
21
- import LicenseLink from "./LicenseLink";
20
+ import { LicenseLink } from "./LicenseLink";
22
21
 
23
22
  interface BaseProps {
24
- topRounded?: boolean;
25
- bottomRounded?: boolean;
26
23
  description?: ReactNode;
27
24
  children?: ReactNode;
28
25
  visibleAlt?: string;
@@ -74,49 +71,63 @@ export type EmbedBylineTypeProps =
74
71
 
75
72
  type Props = EmbedBylineTypeProps | EmbedBylineErrorProps;
76
73
 
77
- const BylineWrapper = styled.figcaption`
78
- display: flex;
79
- flex-direction: column;
80
- font-family: ${fonts.sans};
81
- ${fonts.sizes("16px", "26px")};
82
- padding: ${spacing.small} 0;
83
- background-color: ${colors.white};
84
- &[data-top-rounded="true"] {
85
- border-top-right-radius: ${misc.borderRadius};
86
- border-top-left-radius: ${misc.borderRadius};
87
- }
88
-
89
- &[data-bottom-rounded="true"] {
90
- border-bottom-right-radius: ${misc.borderRadius};
91
- border-bottom-left-radius: ${misc.borderRadius};
92
- }
93
-
94
- &[data-error="true"] {
95
- border: none;
96
- background-color: ${colors.support.redLightest};
97
- padding: ${spacing.nsmall} ${spacing.normal};
98
- ${fonts.sizes("18px", "24px")};
99
- }
100
- `;
101
-
102
- const StyledSpan = styled.span`
103
- font-style: italic;
104
- color: grey;
105
- font-family: ${fonts.sans};
106
- ${fonts.sizes("16px", "26px")};
107
- `;
108
-
109
- const EmbedByline = ({ type, topRounded, bottomRounded, description, children, visibleAlt, ...props }: Props) => {
74
+ const BylineWrapper = styled("figcaption", {
75
+ base: {
76
+ display: "flex",
77
+ flexDirection: "column",
78
+ paddingBlock: "xsmall",
79
+ background: "surface.default",
80
+ textStyle: "label.medium",
81
+ },
82
+ });
83
+
84
+ const ErrorBylineWrapper = styled(BylineWrapper, {
85
+ base: {
86
+ border: "1px solid",
87
+ borderColor: "stroke.error",
88
+ borderRadius: "xsmall",
89
+ background: "surface.dangerSubtle",
90
+ paddingInline: "medium",
91
+ paddingBlock: "medium",
92
+ },
93
+ });
94
+
95
+ const StyledText = styled(Text, {
96
+ base: {
97
+ fontStyle: "italic",
98
+ },
99
+ });
100
+
101
+ const ContentWrapper = styled("div", {
102
+ base: {
103
+ display: "flex",
104
+ gap: "xsmall",
105
+ alignItems: "center",
106
+ textStyle: "label.medium",
107
+ },
108
+ });
109
+
110
+ const BaseDescription = styled("div", {
111
+ base: {
112
+ display: "inline-flex",
113
+ whiteSpace: "pre-wrap",
114
+ },
115
+ });
116
+
117
+ export const EmbedByline = ({ type, description, children, visibleAlt, ...props }: Props) => {
110
118
  const { t } = useTranslation();
111
119
 
112
120
  if (props.error) {
113
121
  const typeString = type === "h5p" ? "H5P" : t(`embed.type.${type}`).toLowerCase();
114
122
  return (
115
- <BylineWrapper data-top-rounded={topRounded} data-bottom-rounded={bottomRounded} data-error={true}>
116
- <LicenseDescription warningByline={props.error} icon={<WarningOutline />}>
117
- {t("embed.embedError", { type: typeString })}
118
- </LicenseDescription>
119
- </BylineWrapper>
123
+ <ErrorBylineWrapper>
124
+ <ContentWrapper>
125
+ <WarningOutline />
126
+ <BaseDescription>
127
+ <span>{t("embed.embedError", { type: typeString })}</span>
128
+ </BaseDescription>
129
+ </ContentWrapper>
130
+ </ErrorBylineWrapper>
120
131
  );
121
132
  }
122
133
 
@@ -132,7 +143,11 @@ const EmbedByline = ({ type, topRounded, bottomRounded, description, children, v
132
143
  {children}
133
144
  </div>
134
145
  </BylineWrapper>
135
- {visibleAlt ? <StyledSpan>{`Alt: ${visibleAlt}`}</StyledSpan> : null}
146
+ {visibleAlt ? (
147
+ <StyledText color="text.subtle" textStyle="label.medium" asChild consumeCss>
148
+ <span>{`Alt: ${visibleAlt}`}</span>
149
+ </StyledText>
150
+ ) : null}
136
151
  </>
137
152
  );
138
153
  };
@@ -143,16 +158,79 @@ interface LicenseContainerProps {
143
158
  type: Props["type"];
144
159
  }
145
160
 
161
+ const StyledDescription = styled(BaseDescription, {
162
+ base: {
163
+ mobileWideDown: {
164
+ display: "grid",
165
+ gridTemplateColumns: "1fr auto",
166
+ alignItems: "center",
167
+ overflow: "hidden",
168
+ _open: {
169
+ display: "inline",
170
+ },
171
+ },
172
+ },
173
+ });
174
+
175
+ const TextContent = styled("span", {
176
+ base: {
177
+ mobileWideDown: {
178
+ whiteSpace: "nowrap",
179
+ maxHeight: "large",
180
+ overflow: "hidden",
181
+ textOverflow: "ellipsis",
182
+ transitionProperty: "max-height",
183
+ transitionDuration: "slow",
184
+ transitionTimingFunction: "ease-in",
185
+ _open: {
186
+ whiteSpace: "pre-wrap",
187
+ maxHeight: "none",
188
+ },
189
+ },
190
+ },
191
+ });
192
+
193
+ const StyledButton = styled(Button, {
194
+ base: {
195
+ mobileWide: {
196
+ display: "none",
197
+ },
198
+ },
199
+ });
200
+
201
+ interface LicenseDescriptionProps {
202
+ children?: ReactNode;
203
+ }
204
+
205
+ const LicenseDescription = ({ children }: LicenseDescriptionProps) => {
206
+ const [isOpen, setIsOpen] = useState(false);
207
+ const open = isOpen ? { "data-open": "" } : {};
208
+ const { t } = useTranslation();
209
+
210
+ const handleToggle = () => {
211
+ setIsOpen(!isOpen);
212
+ };
213
+
214
+ return (
215
+ <ContentWrapper>
216
+ <StyledDescription {...open}>
217
+ <TextContent {...open}>{children}</TextContent>
218
+ <StyledButton variant="link" size="small" onClick={handleToggle}>
219
+ {isOpen ? `${t("audio.readLessDescriptionLabel")}` : `${t("audio.readMoreDescriptionLabel")}`}
220
+ </StyledButton>
221
+ </StyledDescription>
222
+ </ContentWrapper>
223
+ );
224
+ };
225
+
146
226
  export const LicenseContainerContent = ({ children, copyright, type }: LicenseContainerProps) => {
147
227
  const { t, i18n } = useTranslation();
148
228
  const license = copyright ? getLicenseByAbbreviation(copyright.license?.license ?? "", i18n.language) : undefined;
149
229
  const authors = getLicenseCredits(copyright);
150
230
  const captionAuthors = Object.values(authors).find((i) => i.length > 0) ?? [];
151
231
 
152
- const Component = children ? LicenseDescription : "span";
153
-
154
- return (
155
- <Component>
232
+ const content = (
233
+ <>
156
234
  {children}
157
235
  {` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`}
158
236
  {captionAuthors.map((author) => author.name).join(", ")}
@@ -162,8 +240,16 @@ export const LicenseContainerContent = ({ children, copyright, type }: LicenseCo
162
240
  <LicenseLink license={license} />
163
241
  </>
164
242
  ) : null}
165
- </Component>
243
+ </>
166
244
  );
167
- };
168
245
 
169
- export default EmbedByline;
246
+ if (children) {
247
+ return <LicenseDescription>{content}</LicenseDescription>;
248
+ }
249
+
250
+ return (
251
+ <Text textStyle="label.medium" asChild consumeCss>
252
+ <span>{content}</span>
253
+ </Text>
254
+ );
255
+ };
@@ -6,27 +6,29 @@
6
6
  *
7
7
  */
8
8
 
9
- import styled from "@emotion/styled";
10
- import { colors } from "@ndla/core";
11
9
  import { LicenseLocaleType } from "@ndla/licenses";
12
10
  import { SafeLink } from "@ndla/safelink";
11
+ import { styled } from "@ndla/styled-system/jsx";
13
12
 
14
13
  interface Props {
15
14
  license: LicenseLocaleType;
16
15
  }
17
16
 
18
- const StyledSafeLink = styled(SafeLink)`
19
- color: ${colors.brand.primary};
20
- text-decoration: underline;
21
- white-space: nowrap;
22
- box-shadow: none;
23
- &:hover,
24
- &:focus-within {
25
- text-decoration: none;
26
- }
27
- `;
17
+ const StyledSafeLink = styled(SafeLink, {
18
+ base: {
19
+ color: "primary",
20
+ textDecoration: "underline",
21
+ whiteSpace: "nowrap",
22
+ _hover: {
23
+ textDecoration: "none",
24
+ },
25
+ _focusWithin: {
26
+ textDecoration: "none",
27
+ },
28
+ },
29
+ });
28
30
 
29
- const LicenseLink = ({ license }: Props) => {
31
+ export const LicenseLink = ({ license }: Props) => {
30
32
  if (license.abbreviation === "unknown") {
31
33
  return null;
32
34
  }
@@ -39,5 +41,3 @@ const LicenseLink = ({ license }: Props) => {
39
41
  }
40
42
  return <span>{license.abbreviation}</span>;
41
43
  };
42
-
43
- export default LicenseLink;
@@ -6,5 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- export { default as EmbedByline } from "./EmbedByline";
10
- export { default as LicenseLink } from "./LicenseLink";
9
+ export { EmbedByline } from "./EmbedByline";
10
+ export { LicenseLink } from "./LicenseLink";
@@ -14,19 +14,17 @@ export default {
14
14
  title: "Components/Link Block",
15
15
  component: LinkBlock,
16
16
  tags: ["autodocs"],
17
- args: {},
17
+ args: {
18
+ title: "Redaksjonell <em>medarbeider</em> i faget spansk 2",
19
+ articleLanguage: "nb",
20
+ date: "05. mars 2023",
21
+ url: "",
22
+ },
18
23
  } as Meta<typeof LinkBlock>;
19
24
 
20
- const args = {
21
- title: "Redaksjonell <em>medarbeider</em> i faget spansk 2",
22
- articleLanguage: "nb",
23
- date: "05. mars 2023",
24
- url: "",
25
- };
25
+ export const AnnouncementExample: StoryObj<typeof LinkBlock> = {};
26
26
 
27
- export const AnnouncementExample: StoryObj<typeof LinkBlock> = { args };
28
-
29
- export const LinkList: StoryFn<typeof LinkBlock> = () => (
27
+ export const LinkList: StoryFn<typeof LinkBlock> = (args) => (
30
28
  <LinkBlockSection>
31
29
  <LinkBlock {...args} />
32
30
  <LinkBlock {...args} />
@@ -10,69 +10,64 @@ import { format } from "date-fns";
10
10
  import { enGB, nb, nn } from "date-fns/locale";
11
11
  import parse from "html-react-parser";
12
12
  import { useMemo } from "react";
13
- import styled from "@emotion/styled";
14
- import { breakpoints, colors, spacing, mq } from "@ndla/core";
15
13
  import { Forward, CalendarEd } from "@ndla/icons/common";
14
+ import { Heading } from "@ndla/primitives";
16
15
  import { SafeLink } from "@ndla/safelink";
16
+ import { styled } from "@ndla/styled-system/jsx";
17
17
  import { LinkBlockEmbedData } from "@ndla/types-embed";
18
- import { Heading } from "@ndla/typography";
19
18
  import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
20
19
 
21
- const StyledForward = styled(Forward)`
22
- margin: 0 ${spacing.nsmall};
23
- min-width: ${spacing.normal};
24
- min-height: ${spacing.normal};
25
- `;
20
+ const InfoWrapper = styled("div", {
21
+ base: {
22
+ display: "flex",
23
+ flexDirection: "column",
24
+ gap: "xsmall",
25
+ },
26
+ });
26
27
 
27
- const InfoWrapper = styled.div`
28
- display: flex;
29
- flex-direction: column;
30
- gap: ${spacing.small};
31
- `;
28
+ const StyledSafeLink = styled(SafeLink, {
29
+ base: {
30
+ display: "flex",
31
+ justifyContent: "space-between",
32
+ alignItems: "center",
33
+ background: "surface.default",
34
+ padding: "medium",
35
+ border: "1px solid",
36
+ // TODO: Check if this is correct. Not part of design. Also check if this should have border-radius.
37
+ borderColor: "stroke.default",
38
+ "& h3": {
39
+ textDecoration: "underline",
40
+ },
41
+ "& [data-forward]": {
42
+ transitionProperty: "width, height",
43
+ transitionTimingFunction: "ease-in-out",
44
+ transitionDuration: "fast",
45
+ },
46
+ _hover: {
47
+ "& h3": {
48
+ textDecoration: "none",
49
+ },
50
+ "& [data-forward]": {
51
+ width: "large",
52
+ height: "large",
53
+ },
54
+ },
55
+ },
56
+ });
32
57
 
33
- const StyledSafeLink = styled(SafeLink)`
34
- display: flex;
35
- justify-content: space-between;
36
- align-items: center;
37
- box-shadow: none;
38
- color: inherit;
39
- background-color: ${colors.white};
40
- border: 1px solid ${colors.brand.lighter};
41
- padding: ${spacing.normal};
42
- ${mq.range({ from: breakpoints.tabletWide })} {
43
- &:hover {
44
- & ${InfoWrapper} :first-child {
45
- text-decoration: underline;
46
- }
47
- & ${StyledForward} {
48
- width: 32px;
49
- height: 32px;
50
- }
51
- }
52
- &:focus-visible {
53
- border: 2px solid ${colors.brand.dark};
54
- }
55
- }
56
- ${mq.range({ until: breakpoints.tabletWide })} {
57
- & ${InfoWrapper} :first-child {
58
- text-decoration: underline;
59
- }
60
- :active :first-child {
61
- text-decoration: none;
62
- }
63
- }
64
- `;
58
+ const StyledDateContainer = styled("div", {
59
+ base: {
60
+ display: "flex",
61
+ alignItems: "center",
62
+ gap: "xxsmall",
63
+ },
64
+ });
65
65
 
66
- const StyledDateContainer = styled.div`
67
- display: flex;
68
- align-items: center;
69
- padding-top: ${spacing.xsmall};
70
- gap: ${spacing.small};
71
- `;
72
-
73
- const StyledCalenderEd = styled(CalendarEd)`
74
- color: ${colors.icon.iconBlue};
75
- `;
66
+ const StyledCalendarEd = styled(CalendarEd, {
67
+ base: {
68
+ color: "icon.strong",
69
+ },
70
+ });
76
71
 
77
72
  interface Props extends Omit<LinkBlockEmbedData, "resource"> {
78
73
  path?: string;
@@ -89,17 +84,17 @@ const LinkBlock = ({ title, articleLanguage, date, url, path }: Props) => {
89
84
  return (
90
85
  <StyledSafeLink to={href}>
91
86
  <InfoWrapper>
92
- <Heading element="h3" margin="none" headingStyle="h3">
93
- {parse(title)}
87
+ <Heading asChild consumeCss textStyle="title.medium">
88
+ <h3 data-heading>{parse(title)}</h3>
94
89
  </Heading>
95
90
  {date && (
96
91
  <StyledDateContainer>
97
- <StyledCalenderEd />
92
+ <StyledCalendarEd />
98
93
  {formattedDate}
99
94
  </StyledDateContainer>
100
95
  )}
101
96
  </InfoWrapper>
102
- <StyledForward />
97
+ <Forward data-forward />
103
98
  </StyledSafeLink>
104
99
  );
105
100
  };
@@ -7,23 +7,20 @@
7
7
  */
8
8
 
9
9
  import { Children, HTMLAttributes, ReactNode } from "react";
10
- import styled from "@emotion/styled";
11
- import { spacing } from "@ndla/core";
10
+ import { styled } from "@ndla/styled-system/jsx";
12
11
 
13
12
  interface Props extends HTMLAttributes<HTMLElement> {
14
13
  children: ReactNode;
15
14
  }
16
15
 
17
- const StyledList = styled.ul`
18
- display: flex;
19
- flex-direction: column;
20
- gap: ${spacing.small};
21
- list-style: none;
22
- padding: 0px;
23
- li {
24
- padding: 0px;
25
- }
26
- `;
16
+ const StyledList = styled("ul", {
17
+ base: {
18
+ display: "flex",
19
+ flexDirection: "column",
20
+ gap: "xsmall",
21
+ listStyle: "none",
22
+ },
23
+ });
27
24
 
28
25
  const LinkBlockSection = ({ children, ...rest }: Props) => {
29
26
  return (
@@ -24,7 +24,6 @@ export default {
24
24
  inlineStories: true,
25
25
  },
26
26
  args: {
27
- cssModifier: "large",
28
27
  name: true,
29
28
  label: "Nasjonal digital læringsarena",
30
29
  },
package/src/Logo/Logo.tsx CHANGED
@@ -6,11 +6,7 @@
6
6
  *
7
7
  */
8
8
 
9
- /** @jsxImportSource @emotion/react */
10
- import { useMemo } from "react";
11
- import { SerializedStyles, css } from "@emotion/react";
12
9
  import styled from "@emotion/styled";
13
- import { colors } from "@ndla/core";
14
10
  import { SafeLink } from "@ndla/safelink";
15
11
  import SvgLogo from "./SvgLogo";
16
12
 
@@ -24,8 +20,6 @@ interface Props {
24
20
  };
25
21
  label: string;
26
22
  locale?: string;
27
- cssModifier?: string;
28
- large?: boolean;
29
23
  name?: boolean;
30
24
  color?: string;
31
25
  }
@@ -39,29 +33,7 @@ const StyledLogoWrapper = styled.div`
39
33
  position: relative;
40
34
  `;
41
35
 
42
- const modifierStyles: Record<string, SerializedStyles> = {
43
- large: css`
44
- width: 287px;
45
- `,
46
- white: css`
47
- svg {
48
- fill: ${colors.white};
49
- }
50
- `,
51
- };
52
-
53
- export const Logo = ({ name = true, to, cssModifier, color, large = false, locale, label }: Props) => {
54
- const modifiers = useMemo(() => {
55
- const mods = [];
56
- if (large) {
57
- mods.push(modifierStyles.large);
58
- }
59
- if (cssModifier && modifierStyles[cssModifier]) {
60
- mods.push(modifierStyles[cssModifier]);
61
- }
62
- return mods;
63
- }, [large, cssModifier]);
64
-
36
+ export const Logo = ({ name = true, to, color, locale, label }: Props) => {
65
37
  const logo = to ? (
66
38
  <SafeLink to={to} aria-label={label} title={label}>
67
39
  <SvgLogo name={name} color={color} locale={locale} />
@@ -69,7 +41,7 @@ export const Logo = ({ name = true, to, cssModifier, color, large = false, local
69
41
  ) : (
70
42
  <SvgLogo name={name} color={color} locale={locale} />
71
43
  );
72
- return <StyledLogoWrapper css={modifiers}>{logo}</StyledLogoWrapper>;
44
+ return <StyledLogoWrapper>{logo}</StyledLogoWrapper>;
73
45
  };
74
46
 
75
47
  export default Logo;