@ndla/ui 56.0.18-alpha.0 → 56.0.20-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 (115) hide show
  1. package/dist/panda.buildinfo.json +10 -8
  2. package/dist/styles.css +35 -29
  3. package/es/Article/Article.js +3 -3
  4. package/es/Article/ArticleByline.js +5 -4
  5. package/es/Article/index.js +1 -2
  6. package/es/AudioPlayer/AudioPlayer.js +1 -1
  7. package/es/CampaignBlock/CampaignBlock.js +25 -13
  8. package/es/Concept/Concept.js +7 -1
  9. package/es/ContactBlock/ContactBlock.js +0 -1
  10. package/es/ContentTypeBadge/ContentTypeBadgeNew.js +0 -3
  11. package/es/ContentTypeHero/ContentTypeHero.js +2 -8
  12. package/es/Embed/AudioEmbed.js +3 -0
  13. package/es/Embed/BrightcoveEmbed.js +5 -1
  14. package/es/Embed/ConceptEmbed.js +23 -11
  15. package/es/Embed/ConceptListEmbed.js +2 -1
  16. package/es/Embed/ImageEmbed.js +3 -0
  17. package/es/Embed/index.js +1 -0
  18. package/es/FileList/FileList.js +5 -1
  19. package/es/FileList/PdfFile.js +6 -1
  20. package/es/FileList/index.js +1 -1
  21. package/es/Grid/Grid.js +0 -1
  22. package/es/LicenseByline/EmbedByline.js +4 -1
  23. package/es/TreeStructure/TreeStructure.js +0 -2
  24. package/es/i18n/index.js +1 -1
  25. package/es/i18n/useComponentTranslations.js +62 -0
  26. package/es/index.js +7 -5
  27. package/es/locale/messages-en.js +31 -5
  28. package/es/locale/messages-nb.js +31 -5
  29. package/es/locale/messages-nn.js +79 -53
  30. package/es/locale/messages-se.js +31 -5
  31. package/es/locale/messages-sma.js +31 -5
  32. package/es/styles.css +35 -29
  33. package/es/utils/licenseAttributes.js +18 -0
  34. package/lib/Article/Article.js +3 -3
  35. package/lib/Article/ArticleByline.js +5 -4
  36. package/lib/Article/index.d.ts +0 -1
  37. package/lib/Article/index.js +1 -8
  38. package/lib/AudioPlayer/AudioPlayer.js +1 -1
  39. package/lib/CampaignBlock/CampaignBlock.js +25 -13
  40. package/lib/Concept/Concept.d.ts +2 -0
  41. package/lib/Concept/Concept.js +7 -1
  42. package/lib/ContactBlock/ContactBlock.js +0 -1
  43. package/lib/ContentTypeBadge/ContentTypeBadgeNew.js +0 -3
  44. package/lib/ContentTypeHero/ContentTypeHero.js +2 -7
  45. package/lib/Embed/AudioEmbed.js +3 -0
  46. package/lib/Embed/BrightcoveEmbed.d.ts +2 -1
  47. package/lib/Embed/BrightcoveEmbed.js +5 -1
  48. package/lib/Embed/ConceptEmbed.d.ts +3 -1
  49. package/lib/Embed/ConceptEmbed.js +23 -11
  50. package/lib/Embed/ConceptListEmbed.js +2 -1
  51. package/lib/Embed/ImageEmbed.js +3 -0
  52. package/lib/Embed/index.d.ts +1 -0
  53. package/lib/Embed/index.js +7 -0
  54. package/lib/FileList/FileList.d.ts +3 -1
  55. package/lib/FileList/FileList.js +5 -1
  56. package/lib/FileList/PdfFile.js +6 -1
  57. package/lib/FileList/index.d.ts +1 -1
  58. package/lib/FileList/index.js +6 -0
  59. package/lib/Grid/Grid.js +0 -1
  60. package/lib/LicenseByline/EmbedByline.js +4 -1
  61. package/lib/TreeStructure/TreeStructure.js +0 -2
  62. package/lib/i18n/index.d.ts +1 -1
  63. package/lib/i18n/index.js +12 -0
  64. package/lib/i18n/useComponentTranslations.d.ts +31 -0
  65. package/lib/i18n/useComponentTranslations.js +65 -2
  66. package/lib/index.d.ts +6 -4
  67. package/lib/index.js +38 -6
  68. package/lib/locale/messages-en.d.ts +26 -0
  69. package/lib/locale/messages-en.js +31 -5
  70. package/lib/locale/messages-nb.d.ts +26 -0
  71. package/lib/locale/messages-nb.js +31 -5
  72. package/lib/locale/messages-nn.d.ts +26 -0
  73. package/lib/locale/messages-nn.js +79 -53
  74. package/lib/locale/messages-se.d.ts +26 -0
  75. package/lib/locale/messages-se.js +31 -5
  76. package/lib/locale/messages-sma.d.ts +26 -0
  77. package/lib/locale/messages-sma.js +31 -5
  78. package/lib/styles.css +35 -29
  79. package/lib/utils/licenseAttributes.d.ts +16 -0
  80. package/lib/utils/licenseAttributes.js +25 -0
  81. package/package.json +8 -8
  82. package/src/Article/Article.tsx +7 -6
  83. package/src/Article/ArticleByline.tsx +2 -3
  84. package/src/Article/index.ts +0 -2
  85. package/src/AudioPlayer/AudioPlayer.tsx +5 -3
  86. package/src/CampaignBlock/CampaignBlock.tsx +23 -12
  87. package/src/Concept/Concept.tsx +8 -3
  88. package/src/ContactBlock/ContactBlock.tsx +0 -1
  89. package/src/ContentTypeBadge/ContentTypeBadgeNew.tsx +0 -3
  90. package/src/ContentTypeHero/ContentTypeHero.tsx +2 -7
  91. package/src/Embed/AudioEmbed.tsx +4 -1
  92. package/src/Embed/BrightcoveEmbed.tsx +6 -3
  93. package/src/Embed/ConceptEmbed.tsx +21 -11
  94. package/src/Embed/ConceptListEmbed.tsx +1 -0
  95. package/src/Embed/ImageEmbed.tsx +4 -0
  96. package/src/Embed/index.ts +1 -0
  97. package/src/FileList/FileList.tsx +16 -10
  98. package/src/FileList/PdfFile.tsx +8 -2
  99. package/src/FileList/index.ts +1 -1
  100. package/src/Grid/Grid.tsx +0 -1
  101. package/src/LicenseByline/EmbedByline.tsx +2 -1
  102. package/src/TreeStructure/TreeStructure.tsx +0 -1
  103. package/src/i18n/index.ts +2 -0
  104. package/src/i18n/useComponentTranslations.ts +79 -0
  105. package/src/index.ts +8 -2
  106. package/src/locale/messages-en.ts +30 -3
  107. package/src/locale/messages-nb.ts +30 -3
  108. package/src/locale/messages-nn.ts +78 -51
  109. package/src/locale/messages-se.ts +30 -3
  110. package/src/locale/messages-sma.ts +30 -3
  111. package/src/utils/licenseAttributes.ts +23 -0
  112. package/es/Article/ArticleParagraph.js +0 -23
  113. package/lib/Article/ArticleParagraph.d.ts +0 -13
  114. package/lib/Article/ArticleParagraph.js +0 -30
  115. package/src/Article/ArticleParagraph.tsx +0 -27
@@ -5,7 +5,6 @@
5
5
  "background]___[value:background.default",
6
6
  "display]___[value:flex",
7
7
  "flexDirection]___[value:column",
8
- "gap]___[value:xxlarge",
9
8
  "color]___[value:text.default",
10
9
  "alignItems]___[value:center",
11
10
  "width]___[value:100%",
@@ -19,6 +18,7 @@
19
18
  "overflowWrap]___[value:anywhere]___[cond:& h1",
20
19
  "gap]___[value:medium",
21
20
  "paddingBlockStart]___[value:xxlarge",
21
+ "gap]___[value:xxlarge",
22
22
  "paddingBlockEnd]___[value:5xlarge]___[cond:& > :is(:last-child)",
23
23
  "minHeight]___[value:xxlarge",
24
24
  "marginBlockStart]___[value:medium",
@@ -33,8 +33,6 @@
33
33
  "flexDirection]___[value:row]___[cond:tabletWide",
34
34
  "gap]___[value:xsmall",
35
35
  "listStyle]___[value:none",
36
- "textAlign]___[value:center]___[cond:&[data-align=\"center\"]",
37
- "direction]___[value:rtl]___[cond:&:has(span[dir=\"rtl\"])",
38
36
  "border]___[value:1px solid",
39
37
  "borderColor]___[value:stroke.default",
40
38
  "borderRadius]___[value:xsmall",
@@ -122,11 +120,15 @@
122
120
  "textDecoration]___[value:none]___[cond:_hover",
123
121
  "textDecoration]___[value:none]___[cond:_focusVisible",
124
122
  "display]___[value:none]___[cond:tabletDown",
123
+ "display]___[value:grid",
124
+ "gridTemplateColumns]___[value:1fr",
125
+ "gridTemplateColumns]___[value:minmax(230px, 455px) auto]___[cond:tabletWide",
126
+ "gridTemplateColumns]___[value:auto minmax(230px, 455px)]___[cond:tabletWide",
125
127
  "fontWeight]___[value:bold",
126
- "alignSelf]___[value:center",
127
128
  "height]___[value:215px",
128
- "height]___[value:340px]___[cond:mobileWide",
129
- "width]___[value:auto]___[cond:tabletWide",
129
+ "height]___[value:265px]___[cond:tablet",
130
+ "height]___[value:340px]___[cond:tabletWide",
131
+ "minWidth]___[value:270px",
130
132
  "display]___[value:block]___[cond:tabletWide",
131
133
  "overflow]___[value:hidden]___[cond:tabletWide",
132
134
  "position]___[value:relative]___[cond:tabletWide",
@@ -234,6 +236,8 @@
234
236
  "textStyle]___[value:label.large",
235
237
  "marginBlockStart]___[value:xsmall]___[cond:& > *:not(:where(:first-child))",
236
238
  "width]___[value:surface.xlarge",
239
+ "maxHeight]___[value:50vh",
240
+ "overflowY]___[value:auto",
237
241
  "display]___[value:block]___[cond:& li",
238
242
  "color]___[value:text.error",
239
243
  "backgroundColor]___[value:surface.disabled",
@@ -348,11 +352,9 @@
348
352
  "borderColor]___[value:stroke.default]___[cond:_first",
349
353
  "fontWeight]___[value:bold]___[cond:_first<___>& p",
350
354
  "fontStyle]___[value:italic",
351
- "display]___[value:grid",
352
355
  "gridRowGap]___[value:large",
353
356
  "gridColumnGap]___[value:medium",
354
357
  "backgroundColor]___[value:background.subtle",
355
- "maxWidth]___[value:surface.4xlarge",
356
358
  "gridTemplateColumns]___[value:repeat(2, minmax(0, 1fr))",
357
359
  "gridTemplateColumns]___[value:repeat(1, minmax(0, 1fr))]___[cond:tabletDown",
358
360
  "gridTemplateColumns]___[value:repeat(2, minmax(0, 1fr))]___[cond:tabletToDesktop",
package/dist/styles.css CHANGED
@@ -93,10 +93,6 @@
93
93
  display: flex;
94
94
  }
95
95
 
96
- .gap_xxlarge {
97
- gap: var(--spacing-xxlarge);
98
- }
99
-
100
96
  .c_text\.default {
101
97
  color: var(--colors-text-default);
102
98
  }
@@ -121,6 +117,10 @@
121
117
  padding-block-start: var(--spacing-xxlarge);
122
118
  }
123
119
 
120
+ .gap_xxlarge {
121
+ gap: var(--spacing-xxlarge);
122
+ }
123
+
124
124
  .min-h_xxlarge {
125
125
  min-height: var(--sizes-xxlarge);
126
126
  }
@@ -326,10 +326,18 @@
326
326
  text-decoration: underline;
327
327
  }
328
328
 
329
+ .d_grid {
330
+ display: grid;
331
+ }
332
+
329
333
  .h_215px {
330
334
  height: 215px;
331
335
  }
332
336
 
337
+ .min-w_270px {
338
+ min-width: 270px;
339
+ }
340
+
333
341
  .bd-l_4px_solid {
334
342
  border-left: 4px solid;
335
343
  }
@@ -438,6 +446,10 @@
438
446
  width: var(--sizes-surface-xlarge);
439
447
  }
440
448
 
449
+ .max-h_50vh {
450
+ max-height: 50vh;
451
+ }
452
+
441
453
  .c_text\.error {
442
454
  color: var(--colors-text-error);
443
455
  }
@@ -539,14 +551,6 @@
539
551
  margin-block-start: var(--spacing-3xsmall);
540
552
  }
541
553
 
542
- .d_grid {
543
- display: grid;
544
- }
545
-
546
- .max-w_surface\.4xlarge {
547
- max-width: var(--sizes-surface-4xlarge);
548
- }
549
-
550
554
  .w_surface\.3xsmall {
551
555
  width: var(--sizes-surface-3xsmall);
552
556
  }
@@ -678,12 +682,12 @@
678
682
  align-items: flex-end;
679
683
  }
680
684
 
681
- .fw_bold {
682
- font-weight: var(--font-weights-bold);
685
+ .grid-tc_1fr {
686
+ grid-template-columns: 1fr;
683
687
  }
684
688
 
685
- .as_center {
686
- align-self: center;
689
+ .fw_bold {
690
+ font-weight: var(--font-weights-bold);
687
691
  }
688
692
 
689
693
  .bd-l-c_stroke\.default {
@@ -722,6 +726,10 @@
722
726
  top: calc(var(--spacing-4xsmall) * -1);
723
727
  }
724
728
 
729
+ .ov-y_auto {
730
+ overflow-y: auto;
731
+ }
732
+
725
733
  .bg-c_surface\.disabled {
726
734
  background-color: var(--colors-surface-disabled);
727
735
  }
@@ -900,14 +908,6 @@
900
908
  padding-block-end: var(--spacing-5xlarge);
901
909
  }
902
910
 
903
- .\[\&\[data-align\=\"center\"\]\]\:ta_center[data-align="center"] {
904
- text-align: center;
905
- }
906
-
907
- .\[\&\:has\(span\[dir\=\"rtl\"\]\)\]\:direction_rtl:has(span[dir="rtl"]) {
908
- direction: rtl;
909
- }
910
-
911
911
  .\[\&_img\]\:w_100\% img {
912
912
  width: 100%;
913
913
  }
@@ -1448,9 +1448,6 @@
1448
1448
  }
1449
1449
 
1450
1450
  @media screen and (min-width: 29.75rem) {
1451
- .mobileWide\:h_340px {
1452
- height: 340px;
1453
- }
1454
1451
  .mobileWide\:d_none {
1455
1452
  display: none;
1456
1453
  }
@@ -1465,6 +1462,9 @@
1465
1462
  @media screen and (min-width: 37.5625rem) {
1466
1463
  .tablet\:px_medium {
1467
1464
  padding-inline: var(--spacing-medium);
1465
+ }
1466
+ .tablet\:h_265px {
1467
+ height: 265px;
1468
1468
  }
1469
1469
  .tablet\:h_26px {
1470
1470
  height: 26px;
@@ -1544,8 +1544,8 @@
1544
1544
  .tabletWide\:max-w_532px {
1545
1545
  max-width: 532px;
1546
1546
  }
1547
- .tabletWide\:w_auto {
1548
- width: auto;
1547
+ .tabletWide\:h_340px {
1548
+ height: 340px;
1549
1549
  }
1550
1550
  .tabletWide\:d_block {
1551
1551
  display: block;
@@ -1570,6 +1570,12 @@
1570
1570
  }
1571
1571
  .tabletWide\:jc_space-between {
1572
1572
  justify-content: space-between;
1573
+ }
1574
+ .tabletWide\:grid-tc_minmax\(230px\,_455px\)_auto {
1575
+ grid-template-columns: minmax(230px, 455px) auto;
1576
+ }
1577
+ .tabletWide\:grid-tc_auto_minmax\(230px\,_455px\) {
1578
+ grid-template-columns: auto minmax(230px, 455px);
1573
1579
  }
1574
1580
  }
1575
1581
 
@@ -33,7 +33,6 @@ const StyledArticleWrapper = styled(ark.article, {
33
33
  background: "background.default",
34
34
  display: "flex",
35
35
  flexDirection: "column",
36
- gap: "xxlarge",
37
36
  color: "text.default",
38
37
  alignItems: "center",
39
38
  width: "100%",
@@ -112,7 +111,7 @@ export const ArticleTitle = _ref2 => {
112
111
  } = _ref2;
113
112
  return /*#__PURE__*/_jsxs(ArticleHeader, {
114
113
  children: [/*#__PURE__*/_jsxs(ArticleHGroup, {
115
- children: [/*#__PURE__*/_jsxs(StyledStack, {
114
+ children: [(!!contentType || !!heartButton) && /*#__PURE__*/_jsxs(StyledStack, {
116
115
  justify: "space-between",
117
116
  align: "center",
118
117
  direction: "row",
@@ -121,9 +120,10 @@ export const ArticleTitle = _ref2 => {
121
120
  contentType: contentType
122
121
  }), heartButton]
123
122
  }), /*#__PURE__*/_jsx(Heading, {
124
- textStyle: "heading.large",
123
+ textStyle: "heading.medium",
125
124
  id: id,
126
125
  lang: lang,
126
+ property: "dct:title",
127
127
  children: title
128
128
  })]
129
129
  }), !!introduction && /*#__PURE__*/_jsx(Text, {
@@ -25,9 +25,6 @@ const Wrapper = styled("div", {
25
25
  borderColor: "stroke.subtle"
26
26
  }
27
27
  });
28
-
29
- // TODO: This is designed with 24px of inline padding. If you do this, most bylines will break into two lines.
30
- // Should reconsider.
31
28
  const TextWrapper = styled("div", {
32
29
  base: {
33
30
  display: "flex",
@@ -130,7 +127,11 @@ export const ArticleByline = _ref => {
130
127
  children: [/*#__PURE__*/_jsxs(LicenseWrapper, {
131
128
  children: [license && /*#__PURE__*/_jsx(LicenseLink, {
132
129
  license: license
133
- }), showPrimaryContributors && /*#__PURE__*/_jsxs("span", {
130
+ }), showPrimaryContributors &&
131
+ /*#__PURE__*/
132
+ //eslint-disable-next-line react/no-unknown-property
133
+ _jsxs("span", {
134
+ property: "cc:attributionName",
134
135
  children: [authors.length > 0 && `${t("article.authorsLabel", {
135
136
  names: renderContributors(authors, t),
136
137
  interpolation: {
@@ -8,5 +8,4 @@
8
8
 
9
9
  export { Article, ArticleWrapper, ArticleHeader, ArticleFooter, ArticleTitle, ArticleHGroup, ArticleContent } from "./Article";
10
10
  export { ArticleByline, ArticleBylineAccordionItem } from "./ArticleByline";
11
- export { ArticleFootNotes } from "./ArticleFootNotes";
12
- export { ArticleParagraph } from "./ArticleParagraph";
11
+ export { ArticleFootNotes } from "./ArticleFootNotes";
@@ -174,7 +174,7 @@ const AudioPlayer = _ref => {
174
174
  }), !!textVersion && !img && textVersionButton]
175
175
  }), description && /*#__PURE__*/_jsxs(Text, {
176
176
  textStyle: "body.medium",
177
- children: [showFullDescription || description.length < DESCRIPTION_MAX_LENGTH ? description : `${truncatedDescription}...`, /*#__PURE__*/_jsx(Button, {
177
+ children: [showFullDescription || description.length < DESCRIPTION_MAX_LENGTH ? description : `${truncatedDescription}...`, description.length > DESCRIPTION_MAX_LENGTH && /*#__PURE__*/_jsx(Button, {
178
178
  variant: "link",
179
179
  onClick: () => setShowFullDescription(p => !p),
180
180
  children: t(`audio.${showFullDescription ? "readLessDescriptionLabel" : "readMoreDescriptionLabel"}`)
@@ -15,20 +15,32 @@ import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
15
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
16
  const Container = styled("div", {
17
17
  base: {
18
- width: "100%",
19
- display: "flex",
18
+ display: "grid",
19
+ gridTemplateColumns: "1fr",
20
20
  gap: "medium",
21
- flexDirection: "column",
22
21
  border: "1px solid",
23
22
  borderColor: "stroke.default",
24
23
  backgroundColor: "background.default",
25
24
  borderRadius: "xsmall",
26
25
  boxShadow: "full",
27
- marginBlockEnd: "4xsmall",
28
- overflow: "hidden",
29
- tabletWide: {
30
- flexDirection: "row"
26
+ overflow: "hidden"
27
+ },
28
+ variants: {
29
+ imageSide: {
30
+ left: {
31
+ tabletWide: {
32
+ gridTemplateColumns: "minmax(230px, 455px) auto" //required for campaign block in myNdla
33
+ }
34
+ },
35
+ right: {
36
+ tabletWide: {
37
+ gridTemplateColumns: "auto minmax(230px, 455px)" //required for campaign block in myNdla
38
+ }
39
+ }
31
40
  }
41
+ },
42
+ defaultVariants: {
43
+ imageSide: "left"
32
44
  }
33
45
  });
34
46
  const LinkText = styled(Text, {
@@ -54,29 +66,28 @@ const LinkHeader = styled(Text, {
54
66
  });
55
67
  const StyledImg = styled("img", {
56
68
  base: {
57
- alignSelf: "center",
58
69
  objectFit: "cover",
59
70
  width: "100%",
60
71
  height: "215px",
61
- mobileWide: {
62
- height: "340px"
72
+ tablet: {
73
+ height: "265px"
63
74
  },
64
75
  tabletWide: {
65
- width: "auto"
76
+ height: "340px"
66
77
  }
67
78
  }
68
79
  });
69
80
  const ContentWrapper = styled("div", {
70
81
  base: {
71
82
  width: "100%",
72
- position: "relative",
73
83
  display: "flex",
74
84
  flexDirection: "column",
75
85
  gap: "medium",
76
86
  alignItems: "flex-start",
77
87
  justifyContent: "center",
78
88
  paddingBlock: "medium",
79
- paddingInline: "medium"
89
+ paddingInline: "medium",
90
+ minWidth: "270px" //required for campaign block in myNdla
80
91
  }
81
92
  });
82
93
  const StyledText = styled(Text, {
@@ -128,6 +139,7 @@ const CampaignBlock = _ref2 => {
128
139
  return /*#__PURE__*/_jsxs(Container, {
129
140
  className: className,
130
141
  "data-embed-type": "campaign-block",
142
+ imageSide: imageSide,
131
143
  children: [imageSide === "left" && imageComponent, /*#__PURE__*/_jsxs(ContentWrapper, {
132
144
  children: [/*#__PURE__*/_jsx(MaybeLinkText, {
133
145
  url: url?.url,
@@ -11,6 +11,7 @@ import { Figure } from "@ndla/primitives";
11
11
  import { styled } from "@ndla/styled-system/jsx";
12
12
  import { BrightcoveEmbed, ExternalEmbed, H5pEmbed, IframeEmbed, ImageEmbed } from "../Embed";
13
13
  import { EmbedByline } from "../LicenseByline/EmbedByline";
14
+ import { licenseAttributes } from "../utils/licenseAttributes";
14
15
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
15
16
  const StyledFigure = styled(Figure, {
16
17
  base: {
@@ -38,11 +39,15 @@ export const Concept = /*#__PURE__*/forwardRef((_ref, ref) => {
38
39
  lang,
39
40
  children,
40
41
  title,
42
+ source,
43
+ previewAlt,
41
44
  ...rest
42
45
  } = _ref;
46
+ const licenseProps = licenseAttributes(copyright?.license?.license, lang, source);
43
47
  return /*#__PURE__*/_jsxs(StyledFigure, {
44
48
  ref: ref,
45
49
  ...rest,
50
+ ...licenseProps,
46
51
  children: [/*#__PURE__*/_jsxs(ContentWrapper, {
47
52
  lang: lang,
48
53
  children: [!!title && /*#__PURE__*/_jsxs(_Fragment, {
@@ -52,7 +57,8 @@ export const Concept = /*#__PURE__*/forwardRef((_ref, ref) => {
52
57
  }), children]
53
58
  }), visualElement?.resource === "image" ? /*#__PURE__*/_jsx(ImageEmbed, {
54
59
  embed: visualElement,
55
- lang: lang
60
+ lang: lang,
61
+ previewAlt: previewAlt
56
62
  }) : visualElement?.resource === "brightcove" ? /*#__PURE__*/_jsx(BrightcoveEmbed, {
57
63
  embed: visualElement
58
64
  }) : visualElement?.resource === "h5p" ? /*#__PURE__*/_jsx(H5pEmbed, {
@@ -37,7 +37,6 @@ const StyledWrapper = styled("div", {
37
37
  alignItems: "center",
38
38
  justifyContent: "space-between",
39
39
  boxShadow: "full",
40
- marginBlockEnd: "4xsmall",
41
40
  border: "1px solid",
42
41
  gap: "medium",
43
42
  position: "relative",
@@ -19,12 +19,9 @@ export const contentTypeToBadgeVariantMap = {
19
19
  [contentTypes.SOURCE_MATERIAL]: "brand1",
20
20
  [contentTypes.LEARNING_PATH]: "brand3",
21
21
  [contentTypes.TOPIC]: "neutral",
22
- // TODO: Verify this color
23
22
  [contentTypes.MULTIDISCIPLINARY]: "neutral",
24
23
  [contentTypes.CONCEPT]: "brand1",
25
- // TODO: Verify this color
26
24
  [contentTypes.EXTERNAL]: "brand2",
27
- // TODO: Verify resourceEmbedTypeMapping colors
28
25
  [contentTypes.IMAGE]: "brand1",
29
26
  [contentTypes.AUDIO]: "brand1",
30
27
  [contentTypes.PODCAST]: "brand1",
@@ -9,25 +9,19 @@
9
9
  import { forwardRef } from "react";
10
10
  import { Hero } from "@ndla/primitives";
11
11
  import * as contentTypes from "../model/ContentType";
12
-
13
- // TODO: Figure out what to do with frontpage articles. If anything...
14
- // Also, verify all of these colors.
15
12
  import { jsx as _jsx } from "react/jsx-runtime";
16
13
  export const contentTypeToHeroMap = {
17
14
  [contentTypes.SUBJECT_MATERIAL]: "primary",
18
- [contentTypes.TASKS_AND_ACTIVITIES]: "brand2Strong",
15
+ [contentTypes.TASKS_AND_ACTIVITIES]: "brand2Bold",
19
16
  [contentTypes.ASSESSMENT_RESOURCES]: "brand2",
20
17
  // This will never happen
21
18
  [contentTypes.SUBJECT]: "primary",
22
19
  [contentTypes.SOURCE_MATERIAL]: "brand1",
23
20
  // This will never happen
24
21
  [contentTypes.LEARNING_PATH]: "primary",
25
- // TODO: This needs a color
26
22
  [contentTypes.TOPIC]: "neutral",
27
- // TODO: This is just taken from thin air.
28
- [contentTypes.MULTIDISCIPLINARY]: "brand4",
23
+ [contentTypes.MULTIDISCIPLINARY]: "primary",
29
24
  [contentTypes.CONCEPT]: "brand1Subtle",
30
- // TODO: No clue what this'll be. Maybe unused?
31
25
  [contentTypes.EXTERNAL]: "primary",
32
26
  [contentTypes.IMAGE]: "primary",
33
27
  [contentTypes.AUDIO]: "primary",
@@ -10,6 +10,7 @@ import { Figure } from "@ndla/primitives";
10
10
  import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
11
11
  import AudioPlayer from "../AudioPlayer";
12
12
  import { EmbedByline } from "../LicenseByline";
13
+ import { licenseAttributes } from "../utils/licenseAttributes";
13
14
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
15
  export const getFirstNonEmptyLicenseCredits = authors => Object.values(authors).find(i => i.length > 0) ?? [];
15
16
  const AudioEmbed = _ref => {
@@ -43,9 +44,11 @@ const AudioEmbed = _ref => {
43
44
  url: coverPhoto.url,
44
45
  alt: coverPhoto.altText
45
46
  };
47
+ const licenseProps = licenseAttributes(data.copyright.license.license, lang, embedData.url);
46
48
  return /*#__PURE__*/_jsxs(Figure, {
47
49
  lang: lang,
48
50
  "data-embed-type": type,
51
+ ...licenseProps,
49
52
  children: [/*#__PURE__*/_jsx(AudioPlayer, {
50
53
  description: data.podcastMeta?.introduction ?? "",
51
54
  img: img,
@@ -13,6 +13,7 @@ import { Button, Figure } from "@ndla/primitives";
13
13
  import { styled } from "@ndla/styled-system/jsx";
14
14
  import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
15
15
  import { EmbedByline } from "../LicenseByline";
16
+ import { licenseAttributes } from "../utils/licenseAttributes";
16
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
18
  const LinkedVideoButton = styled(Button, {
18
19
  base: {
@@ -49,7 +50,8 @@ const getIframeProps = (data, sources) => {
49
50
  const BrightcoveEmbed = _ref => {
50
51
  let {
51
52
  embed,
52
- renderContext = "article"
53
+ renderContext = "article",
54
+ lang
53
55
  } = _ref;
54
56
  const [showOriginalVideo, setShowOriginalVideo] = useState(true);
55
57
  const {
@@ -98,8 +100,10 @@ const BrightcoveEmbed = _ref => {
98
100
  ...embedData,
99
101
  videoid: linkedVideoId
100
102
  }, data.sources) : undefined;
103
+ const licenseProps = licenseAttributes(data?.copyright?.license.license, lang, embedData.pageUrl);
101
104
  return /*#__PURE__*/_jsxs(Figure, {
102
105
  "data-embed-type": "brightcove",
106
+ ...licenseProps,
103
107
  children: [/*#__PURE__*/_jsx("div", {
104
108
  className: "brightcove-video",
105
109
  children: /*#__PURE__*/_jsx(BrightcoveIframe, {
@@ -8,6 +8,7 @@
8
8
 
9
9
  import parse from "html-react-parser";
10
10
  import { forwardRef, useMemo } from "react";
11
+ import { Portal } from "@ark-ui/react";
11
12
  import { PopoverContent, PopoverRoot, PopoverTrigger } from "@ndla/primitives";
12
13
  import { styled } from "@ndla/styled-system/jsx";
13
14
  import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
@@ -17,14 +18,17 @@ import { Concept } from "../Concept/Concept";
17
18
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
19
  const StyledPopoverContent = styled(PopoverContent, {
19
20
  base: {
20
- width: "surface.xlarge"
21
+ width: "surface.xlarge",
22
+ maxHeight: "50vh",
23
+ overflowY: "auto"
21
24
  }
22
25
  });
23
26
  export const ConceptEmbed = _ref => {
24
27
  let {
25
28
  embed,
26
29
  renderContext,
27
- lang
30
+ lang,
31
+ previewAlt
28
32
  } = _ref;
29
33
  const parsedContent = useMemo(() => {
30
34
  if (embed.status === "error" || !embed.data.concept.content) return undefined;
@@ -53,19 +57,23 @@ export const ConceptEmbed = _ref => {
53
57
  }
54
58
  if (embed.embedData.type === "inline") {
55
59
  return /*#__PURE__*/_jsx(InlineConcept, {
60
+ previewAlt: previewAlt,
56
61
  linkText: embed.embedData.linkText,
57
62
  copyright: concept.copyright,
58
63
  visualElement: visualElement,
59
64
  lang: lang,
60
65
  title: concept.title.title,
66
+ source: concept.source,
61
67
  children: parsedContent
62
68
  });
63
69
  }
64
70
  return /*#__PURE__*/_jsx(BlockConcept, {
71
+ previewAlt: previewAlt,
65
72
  copyright: concept.copyright,
66
73
  visualElement: visualElement,
67
74
  lang: lang,
68
75
  title: renderContext === "embed" ? undefined : concept.title.title,
76
+ source: concept.source,
69
77
  children: parsedContent
70
78
  });
71
79
  };
@@ -77,23 +85,27 @@ export const InlineConcept = /*#__PURE__*/forwardRef((_ref2, ref) => {
77
85
  lang,
78
86
  children,
79
87
  title,
88
+ source,
80
89
  ...rest
81
90
  } = _ref2;
82
91
  return /*#__PURE__*/_jsxs(PopoverRoot, {
83
92
  children: [/*#__PURE__*/_jsx(PopoverTrigger, {
84
93
  asChild: true,
94
+ ref: ref,
95
+ ...rest,
85
96
  children: /*#__PURE__*/_jsx(InlineTriggerButton, {
86
- ...rest,
87
- ref: ref,
88
97
  children: linkText
89
98
  })
90
- }), /*#__PURE__*/_jsx(StyledPopoverContent, {
91
- children: /*#__PURE__*/_jsx(Concept, {
92
- copyright: copyright,
93
- visualElement: visualElement,
94
- lang: lang,
95
- title: title,
96
- children: children
99
+ }), /*#__PURE__*/_jsx(Portal, {
100
+ children: /*#__PURE__*/_jsx(StyledPopoverContent, {
101
+ children: /*#__PURE__*/_jsx(Concept, {
102
+ copyright: copyright,
103
+ visualElement: visualElement,
104
+ lang: lang,
105
+ title: title,
106
+ source: source,
107
+ children: children
108
+ })
97
109
  })
98
110
  })]
99
111
  });
@@ -63,7 +63,8 @@ const ConceptListEmbed = _ref => {
63
63
  content: concept.content.content,
64
64
  copyright: concept.copyright,
65
65
  visualElement: visualElement,
66
- lang: lang
66
+ lang: lang,
67
+ source: concept.source
67
68
  })
68
69
  }, concept.id);
69
70
  })
@@ -15,6 +15,7 @@ import { Figure, Image } from "@ndla/primitives";
15
15
  import { styled } from "@ndla/styled-system/jsx";
16
16
  import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
17
17
  import { EmbedByline } from "../LicenseByline";
18
+ import { licenseAttributes } from "../utils/licenseAttributes";
18
19
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
20
  export const getLicenseCredits = copyright => {
20
21
  return {
@@ -223,12 +224,14 @@ const ImageEmbed = _ref => {
223
224
  const toggleImageSize = () => {
224
225
  setImageSizes(sizes => !sizes ? expandedSizes : undefined);
225
226
  };
227
+ const licenseProps = licenseAttributes(data.copyright.license.license, lang, embedData.url);
226
228
 
227
229
  // TODO: Check how this works with `children`. Will only be important for ED
228
230
  return /*#__PURE__*/_jsxs(StyledFigure, {
229
231
  float: figureProps?.float,
230
232
  size: imageSizes ? "full" : figureProps?.size ?? "medium",
231
233
  "data-embed-type": "image",
234
+ ...licenseProps,
232
235
  children: [children, /*#__PURE__*/_jsxs(ImageWrapper, {
233
236
  border: embedData.border === "true",
234
237
  expandable: !!figureProps?.float,
package/es/Embed/index.js CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  export { default as ImageEmbed, getCrop, getFocalPoint } from "./ImageEmbed";
10
+ export { InlineTriggerButton } from "./InlineTriggerButton";
10
11
  export { default as AudioEmbed } from "./AudioEmbed";
11
12
  export { default as H5pEmbed } from "./H5pEmbed";
12
13
  export { default as ExternalEmbed } from "./ExternalEmbed";
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  import { useTranslation } from "react-i18next";
10
+ import { ark } from "@ark-ui/react";
10
11
  import { Heading } from "@ndla/primitives";
11
12
  import { styled } from "@ndla/styled-system/jsx";
12
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -17,8 +18,9 @@ export const FileListWrapper = styled("div", {
17
18
  gap: "xsmall"
18
19
  }
19
20
  });
20
- export const FileListItem = styled("li", {
21
+ export const FileListItem = styled(ark.li, {
21
22
  base: {
23
+ listStyle: "none",
22
24
  background: "surface.infoSubtle",
23
25
  borderBlockEnd: "1px solid",
24
26
  borderColor: "stroke.default",
@@ -28,6 +30,8 @@ export const FileListItem = styled("li", {
28
30
  backgroundColor: "surface.infoSubtle.hover"
29
31
  }
30
32
  }
33
+ }, {
34
+ baseComponent: true
31
35
  });
32
36
  export const FileListEmbed = _ref => {
33
37
  let {