@ndla/ui 56.0.27-alpha.0 → 56.0.29-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 (37) hide show
  1. package/dist/panda.buildinfo.json +8 -5
  2. package/dist/styles.css +28 -17
  3. package/es/AudioPlayer/AudioPlayer.js +6 -1
  4. package/es/Concept/Concept.js +0 -3
  5. package/es/Embed/ImageEmbed.js +0 -2
  6. package/es/Embed/index.js +0 -1
  7. package/es/FactBox/FactBox.js +10 -7
  8. package/es/LicenseByline/EmbedByline.js +1 -0
  9. package/es/RelatedArticleList/RelatedArticleList.js +10 -1
  10. package/es/index.js +1 -1
  11. package/es/styles.css +28 -17
  12. package/lib/AudioPlayer/AudioPlayer.js +6 -1
  13. package/lib/Concept/Concept.js +0 -3
  14. package/lib/Embed/ImageEmbed.js +0 -2
  15. package/lib/Embed/index.d.ts +0 -1
  16. package/lib/Embed/index.js +0 -7
  17. package/lib/FactBox/FactBox.js +10 -7
  18. package/lib/LicenseByline/EmbedByline.js +1 -0
  19. package/lib/RelatedArticleList/RelatedArticleList.js +10 -1
  20. package/lib/index.d.ts +1 -1
  21. package/lib/index.js +0 -6
  22. package/lib/styles.css +28 -17
  23. package/package.json +8 -10
  24. package/src/AudioPlayer/AudioPlayer.tsx +8 -2
  25. package/src/Concept/Concept.tsx +0 -2
  26. package/src/Embed/ImageEmbed.tsx +0 -1
  27. package/src/Embed/RelatedContentEmbed.stories.tsx +3 -0
  28. package/src/Embed/RelatedContentEmbed.tsx +1 -1
  29. package/src/Embed/index.ts +0 -1
  30. package/src/FactBox/FactBox.tsx +10 -7
  31. package/src/LicenseByline/EmbedByline.tsx +1 -0
  32. package/src/RelatedArticleList/RelatedArticleList.tsx +12 -1
  33. package/src/index.ts +0 -1
  34. package/es/Embed/ConceptListEmbed.js +0 -76
  35. package/lib/Embed/ConceptListEmbed.d.ts +0 -14
  36. package/lib/Embed/ConceptListEmbed.js +0 -82
  37. package/src/Embed/ConceptListEmbed.tsx +0 -68
@@ -65,6 +65,7 @@
65
65
  "maxWidth]___[value:surface.xlarge",
66
66
  "whiteSpace]___[value:pre-wrap]___[cond:& span > *",
67
67
  "alignSelf]___[value:flex-start",
68
+ "marginInlineStart]___[value:3xsmall",
68
69
  "borderBottomRadius]___[value:xsmall",
69
70
  "justifyContent]___[value:center",
70
71
  "paddingInline]___[value:medium",
@@ -244,8 +245,6 @@
244
245
  "width]___[value:surface.xlarge",
245
246
  "maxHeight]___[value:50vh",
246
247
  "overflowY]___[value:auto",
247
- "display]___[value:block]___[cond:& li",
248
- "color]___[value:text.error",
249
248
  "backgroundColor]___[value:surface.disabled",
250
249
  "fill]___[value:text.subtle]___[cond:& svg",
251
250
  "height]___[value:90%]___[cond:& svg",
@@ -304,14 +303,17 @@
304
303
  "marginBlock]___[value:xxlarge",
305
304
  "marginTop]___[value:3xsmall",
306
305
  "marginLeft]___[value:3xsmall",
307
- "transitionProperty]___[value:max-height",
306
+ "gridTemplateRows]___[value:0fr",
307
+ "transitionProperty]___[value:grid-template-rows",
308
308
  "transitionDuration]___[value:slow",
309
309
  "transitionTimingFunction]___[value:ease-in-out",
310
- "maxHeight]___[value:surface.xxsmall",
310
+ "justifyItems]___[value:center",
311
311
  "clear]___[value:both",
312
+ "gridTemplateRows]___[value:1fr]___[cond:_open",
312
313
  "overflow]___[value:visible]___[cond:_closed<___>_print",
313
314
  "maxHeight]___[value:500vh]___[cond:_closed<___>_print",
314
- "maxHeight]___[value:500vh]___[cond:_open",
315
+ "minHeight]___[value:surface.3xsmall]___[cond:& > div",
316
+ "overflow]___[value:hidden]___[cond:& > div",
315
317
  "marginBlockStart]___[value:0]___[cond:& :first-child",
316
318
  "content]___[value:\"\"]___[cond:_after",
317
319
  "textAlign]___[value:center]___[cond:_after",
@@ -409,6 +411,7 @@
409
411
  "transitionProperty]___[value:max-height]___[cond:mobileWideDown",
410
412
  "transitionDuration]___[value:slow]___[cond:mobileWideDown",
411
413
  "transitionTimingFunction]___[value:ease-in]___[cond:mobileWideDown",
414
+ "marginInlineEnd]___[value:4xsmall]___[cond:mobileWideDown",
412
415
  "whiteSpace]___[value:pre-wrap]___[cond:mobileWideDown<___>_open",
413
416
  "maxHeight]___[value:none]___[cond:mobileWideDown<___>_open",
414
417
  "display]___[value:none]___[cond:mobileWide",
package/dist/styles.css CHANGED
@@ -210,6 +210,10 @@
210
210
  max-width: var(--sizes-surface-xlarge);
211
211
  }
212
212
 
213
+ .ms_3xsmall {
214
+ margin-inline-start: var(--spacing-3xsmall);
215
+ }
216
+
213
217
  .bdr-b_xsmall {
214
218
  border-bottom-left-radius: var(--radii-xsmall);
215
219
  border-bottom-right-radius: var(--radii-xsmall);
@@ -463,10 +467,6 @@
463
467
  max-height: 50vh;
464
468
  }
465
469
 
466
- .c_text\.error {
467
- color: var(--colors-text-error);
468
- }
469
-
470
470
  .p_0 {
471
471
  padding: 0;
472
472
  }
@@ -511,10 +511,6 @@
511
511
  margin-block: var(--spacing-xxlarge);
512
512
  }
513
513
 
514
- .max-h_surface\.xxsmall {
515
- max-height: var(--sizes-surface-xxsmall);
516
- }
517
-
518
514
  .clear_both {
519
515
  clear: both;
520
516
  }
@@ -793,9 +789,13 @@
793
789
  margin-left: var(--spacing-3xsmall);
794
790
  }
795
791
 
796
- .trs-prop_max-height {
797
- --transition-prop: max-height;
798
- transition-property: max-height;
792
+ .grid-tr_0fr {
793
+ grid-template-rows: 0fr;
794
+ }
795
+
796
+ .trs-prop_grid-template-rows {
797
+ --transition-prop: grid-template-rows;
798
+ transition-property: grid-template-rows;
799
799
  }
800
800
 
801
801
  .trs-dur_slow {
@@ -808,6 +808,10 @@
808
808
  transition-timing-function: ease-in-out;
809
809
  }
810
810
 
811
+ .justify-items_center {
812
+ justify-items: center;
813
+ }
814
+
811
815
  .bottom_-medium {
812
816
  bottom: calc(var(--spacing-medium) * -1);
813
817
  }
@@ -1048,10 +1052,6 @@
1048
1052
  margin-block-start: var(--spacing-xsmall);
1049
1053
  }
1050
1054
 
1051
- .\[\&_li\]\:d_block li {
1052
- display: block;
1053
- }
1054
-
1055
1055
  .\[\&_svg\]\:fill_text\.subtle svg {
1056
1056
  fill: var(--colors-text-subtle);
1057
1057
  }
@@ -1092,8 +1092,12 @@
1092
1092
  color: var(--colors-text-strong);
1093
1093
  }
1094
1094
 
1095
- .open\:max-h_500vh:is([open], [data-open], [data-state="open"]) {
1096
- max-height: 500vh;
1095
+ .\[\&_\>_div\]\:min-h_surface\.3xsmall > div {
1096
+ min-height: var(--sizes-surface-3xsmall);
1097
+ }
1098
+
1099
+ .\[\&_\>_div\]\:ov_hidden > div {
1100
+ overflow: hidden;
1097
1101
  }
1098
1102
 
1099
1103
  .\[\&_\:first-child\]\:mbs_0 :first-child {
@@ -1246,6 +1250,10 @@
1246
1250
  margin-top: 0;
1247
1251
  }
1248
1252
 
1253
+ .open\:grid-tr_1fr:is([open], [data-open], [data-state="open"]) {
1254
+ grid-template-rows: 1fr;
1255
+ }
1256
+
1249
1257
  .after\:content_\"\"::after {
1250
1258
  content: "";
1251
1259
  }
@@ -1725,6 +1733,9 @@
1725
1733
  }
1726
1734
  .mobileWideDown\:tov_ellipsis {
1727
1735
  text-overflow: ellipsis;
1736
+ }
1737
+ .mobileWideDown\:me_4xsmall {
1738
+ margin-inline-end: var(--spacing-4xsmall);
1728
1739
  }
1729
1740
  .mobileWideDown\:cg_3xsmall {
1730
1741
  column-gap: var(--spacing-3xsmall);
@@ -114,6 +114,11 @@ const TextVersionButton = styled(Button, {
114
114
  alignSelf: "flex-start"
115
115
  }
116
116
  });
117
+ const ShowMoreButton = styled(Button, {
118
+ base: {
119
+ marginInlineStart: "3xsmall"
120
+ }
121
+ });
117
122
  const DESCRIPTION_MAX_LENGTH = 200;
118
123
  const AudioPlayer = _ref => {
119
124
  let {
@@ -174,7 +179,7 @@ const AudioPlayer = _ref => {
174
179
  }), !!textVersion && !img && textVersionButton]
175
180
  }), description && /*#__PURE__*/_jsxs(Text, {
176
181
  textStyle: "body.medium",
177
- children: [showFullDescription || description.length < DESCRIPTION_MAX_LENGTH ? description : `${truncatedDescription}...`, description.length > DESCRIPTION_MAX_LENGTH && /*#__PURE__*/_jsx(Button, {
182
+ children: [showFullDescription || description.length < DESCRIPTION_MAX_LENGTH ? description : `${truncatedDescription}...`, description.length > DESCRIPTION_MAX_LENGTH && /*#__PURE__*/_jsx(ShowMoreButton, {
178
183
  variant: "link",
179
184
  onClick: () => setShowFullDescription(p => !p),
180
185
  children: t(`audio.${showFullDescription ? "readLessDescriptionLabel" : "readMoreDescriptionLabel"}`)
@@ -29,9 +29,6 @@ const ContentWrapper = styled("div", {
29
29
  }
30
30
  }
31
31
  });
32
-
33
- // TODO: Figure out if we need to support headerButtons.
34
-
35
32
  export const Concept = /*#__PURE__*/forwardRef((_ref, ref) => {
36
33
  let {
37
34
  copyright,
@@ -201,8 +201,6 @@ const ImageEmbed = _ref => {
201
201
  };
202
202
  const licenseProps = licenseAttributes(data.copyright.license.license, lang, embedData.url);
203
203
  const figureSize = figureProps?.float ? figureProps?.size ?? "medium" : "full";
204
-
205
- // TODO: Check how this works with `children`. Will only be important for ED
206
204
  return /*#__PURE__*/_jsxs(StyledFigure, {
207
205
  float: figureProps?.float,
208
206
  size: imageSizes ? "full" : figureSize,
package/es/Embed/index.js CHANGED
@@ -17,7 +17,6 @@ export { default as BrightcoveEmbed } from "./BrightcoveEmbed";
17
17
  export { default as ContentLinkEmbed } from "./ContentLinkEmbed";
18
18
  export { default as RelatedContentEmbed } from "./RelatedContentEmbed";
19
19
  export { ConceptEmbed, InlineConcept, BlockConcept } from "./ConceptEmbed";
20
- export { default as ConceptListEmbed } from "./ConceptListEmbed";
21
20
  export { default as UnknownEmbed } from "./UnknownEmbed";
22
21
  export { default as UuDisclaimerEmbed } from "./UuDisclaimerEmbed";
23
22
  export { default as CopyrightEmbed } from "./CopyrightEmbed";
@@ -14,27 +14,30 @@ import { styled } from "@ndla/styled-system/jsx";
14
14
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
15
  const StyledAside = styled("aside", {
16
16
  base: {
17
- display: "flex",
18
- flexDirection: "column",
19
- alignItems: "center",
20
17
  position: "relative",
21
18
  padding: "medium",
22
- transitionProperty: "max-height",
19
+ display: "grid",
20
+ gridTemplateRows: "0fr",
21
+ transitionProperty: "grid-template-rows",
23
22
  transitionDuration: "slow",
24
23
  transitionTimingFunction: "ease-in-out",
24
+ justifyItems: "center",
25
25
  border: "1px solid",
26
26
  borderColor: "stroke.default",
27
27
  borderRadius: "xsmall",
28
- maxHeight: "surface.xxsmall",
29
28
  clear: "both",
29
+ _open: {
30
+ gridTemplateRows: "1fr"
31
+ },
30
32
  _closed: {
31
33
  _print: {
32
34
  overflow: "visible",
33
35
  maxHeight: "500vh"
34
36
  }
35
37
  },
36
- _open: {
37
- maxHeight: "500vh"
38
+ "& > div": {
39
+ minHeight: "surface.3xsmall",
40
+ overflow: "hidden"
38
41
  }
39
42
  }
40
43
  });
@@ -127,6 +127,7 @@ const TextContent = styled("span", {
127
127
  transitionProperty: "max-height",
128
128
  transitionDuration: "slow",
129
129
  transitionTimingFunction: "ease-in",
130
+ marginInlineEnd: "4xsmall",
130
131
  _open: {
131
132
  whiteSpace: "pre-wrap",
132
133
  maxHeight: "none"
@@ -8,6 +8,7 @@
8
8
 
9
9
  import { Children, useMemo, useState } from "react";
10
10
  import { useTranslation } from "react-i18next";
11
+ import { ExternalLinkLine } from "@ndla/icons/common";
11
12
  import { CardContent, CardHeading, CardRoot, Text, Heading, Button } from "@ndla/primitives";
12
13
  import { SafeLink } from "@ndla/safelink";
13
14
  import { styled } from "@ndla/styled-system/jsx";
@@ -15,6 +16,12 @@ import { linkOverlay } from "@ndla/styled-system/patterns";
15
16
  import { ContentTypeBadge } from "../ContentTypeBadge/ContentTypeBadgeNew";
16
17
  import { contentTypes } from "../model/ContentType";
17
18
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
+ const StyledSpan = styled("span", {
20
+ base: {
21
+ display: "flex",
22
+ gap: "3xsmall"
23
+ }
24
+ });
18
25
  export const RelatedArticle = _ref => {
19
26
  let {
20
27
  title,
@@ -39,7 +46,9 @@ export const RelatedArticle = _ref => {
39
46
  target: target,
40
47
  rel: linkInfo ? "noopener noreferrer" : undefined,
41
48
  css: linkOverlay.raw(),
42
- children: title
49
+ children: /*#__PURE__*/_jsxs(StyledSpan, {
50
+ children: [title, target === "_blank" && /*#__PURE__*/_jsx(ExternalLinkLine, {})]
51
+ })
43
52
  })
44
53
  })
45
54
  }), /*#__PURE__*/_jsx(Text, {
package/es/index.js CHANGED
@@ -10,7 +10,7 @@
10
10
  // Move components to this file when they are migrated to typescript
11
11
 
12
12
  export { Concept } from "./Concept/Concept";
13
- export { ImageEmbed, getCrop, getFocalPoint, AudioEmbed, H5pEmbed, ExternalEmbed, IframeEmbed, FootnoteEmbed, BrightcoveEmbed, ContentLinkEmbed, RelatedContentEmbed, ConceptEmbed, ConceptListEmbed, UnknownEmbed, InlineConcept, BlockConcept, UuDisclaimerEmbed, CopyrightEmbed, CodeEmbed, InlineTriggerButton } from "./Embed";
13
+ export { ImageEmbed, getCrop, getFocalPoint, AudioEmbed, H5pEmbed, ExternalEmbed, IframeEmbed, FootnoteEmbed, BrightcoveEmbed, ContentLinkEmbed, RelatedContentEmbed, ConceptEmbed, UnknownEmbed, InlineConcept, BlockConcept, UuDisclaimerEmbed, CopyrightEmbed, CodeEmbed, InlineTriggerButton } from "./Embed";
14
14
  export { LicenseLink, EmbedByline } from "./LicenseByline";
15
15
  export { ArticleByline, ArticleBylineAccordionItem, ArticleFootNotes, ArticleWrapper, Article, ArticleFooter, ArticleHeader, ArticleContent, ArticleHGroup, ArticleTitle } from "./Article";
16
16
  export { getPossiblyRelativeUrl } from "./utils/relativeUrl";
package/es/styles.css CHANGED
@@ -210,6 +210,10 @@
210
210
  max-width: var(--sizes-surface-xlarge);
211
211
  }
212
212
 
213
+ .ms_3xsmall {
214
+ margin-inline-start: var(--spacing-3xsmall);
215
+ }
216
+
213
217
  .bdr-b_xsmall {
214
218
  border-bottom-left-radius: var(--radii-xsmall);
215
219
  border-bottom-right-radius: var(--radii-xsmall);
@@ -463,10 +467,6 @@
463
467
  max-height: 50vh;
464
468
  }
465
469
 
466
- .c_text\.error {
467
- color: var(--colors-text-error);
468
- }
469
-
470
470
  .p_0 {
471
471
  padding: 0;
472
472
  }
@@ -511,10 +511,6 @@
511
511
  margin-block: var(--spacing-xxlarge);
512
512
  }
513
513
 
514
- .max-h_surface\.xxsmall {
515
- max-height: var(--sizes-surface-xxsmall);
516
- }
517
-
518
514
  .clear_both {
519
515
  clear: both;
520
516
  }
@@ -793,9 +789,13 @@
793
789
  margin-left: var(--spacing-3xsmall);
794
790
  }
795
791
 
796
- .trs-prop_max-height {
797
- --transition-prop: max-height;
798
- transition-property: max-height;
792
+ .grid-tr_0fr {
793
+ grid-template-rows: 0fr;
794
+ }
795
+
796
+ .trs-prop_grid-template-rows {
797
+ --transition-prop: grid-template-rows;
798
+ transition-property: grid-template-rows;
799
799
  }
800
800
 
801
801
  .trs-dur_slow {
@@ -808,6 +808,10 @@
808
808
  transition-timing-function: ease-in-out;
809
809
  }
810
810
 
811
+ .justify-items_center {
812
+ justify-items: center;
813
+ }
814
+
811
815
  .bottom_-medium {
812
816
  bottom: calc(var(--spacing-medium) * -1);
813
817
  }
@@ -1048,10 +1052,6 @@
1048
1052
  margin-block-start: var(--spacing-xsmall);
1049
1053
  }
1050
1054
 
1051
- .\[\&_li\]\:d_block li {
1052
- display: block;
1053
- }
1054
-
1055
1055
  .\[\&_svg\]\:fill_text\.subtle svg {
1056
1056
  fill: var(--colors-text-subtle);
1057
1057
  }
@@ -1092,8 +1092,12 @@
1092
1092
  color: var(--colors-text-strong);
1093
1093
  }
1094
1094
 
1095
- .open\:max-h_500vh:is([open], [data-open], [data-state="open"]) {
1096
- max-height: 500vh;
1095
+ .\[\&_\>_div\]\:min-h_surface\.3xsmall > div {
1096
+ min-height: var(--sizes-surface-3xsmall);
1097
+ }
1098
+
1099
+ .\[\&_\>_div\]\:ov_hidden > div {
1100
+ overflow: hidden;
1097
1101
  }
1098
1102
 
1099
1103
  .\[\&_\:first-child\]\:mbs_0 :first-child {
@@ -1246,6 +1250,10 @@
1246
1250
  margin-top: 0;
1247
1251
  }
1248
1252
 
1253
+ .open\:grid-tr_1fr:is([open], [data-open], [data-state="open"]) {
1254
+ grid-template-rows: 1fr;
1255
+ }
1256
+
1249
1257
  .after\:content_\"\"::after {
1250
1258
  content: "";
1251
1259
  }
@@ -1725,6 +1733,9 @@
1725
1733
  }
1726
1734
  .mobileWideDown\:tov_ellipsis {
1727
1735
  text-overflow: ellipsis;
1736
+ }
1737
+ .mobileWideDown\:me_4xsmall {
1738
+ margin-inline-end: var(--spacing-4xsmall);
1728
1739
  }
1729
1740
  .mobileWideDown\:cg_3xsmall {
1730
1741
  column-gap: var(--spacing-3xsmall);
@@ -120,6 +120,11 @@ const TextVersionButton = (0, _jsx2.styled)(_primitives.Button, {
120
120
  alignSelf: "flex-start"
121
121
  }
122
122
  });
123
+ const ShowMoreButton = (0, _jsx2.styled)(_primitives.Button, {
124
+ base: {
125
+ marginInlineStart: "3xsmall"
126
+ }
127
+ });
123
128
  const DESCRIPTION_MAX_LENGTH = 200;
124
129
  const AudioPlayer = _ref => {
125
130
  let {
@@ -180,7 +185,7 @@ const AudioPlayer = _ref => {
180
185
  }), !!textVersion && !img && textVersionButton]
181
186
  }), description && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Text, {
182
187
  textStyle: "body.medium",
183
- children: [showFullDescription || description.length < DESCRIPTION_MAX_LENGTH ? description : `${truncatedDescription}...`, description.length > DESCRIPTION_MAX_LENGTH && /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Button, {
188
+ children: [showFullDescription || description.length < DESCRIPTION_MAX_LENGTH ? description : `${truncatedDescription}...`, description.length > DESCRIPTION_MAX_LENGTH && /*#__PURE__*/(0, _jsxRuntime.jsx)(ShowMoreButton, {
184
189
  variant: "link",
185
190
  onClick: () => setShowFullDescription(p => !p),
186
191
  children: t(`audio.${showFullDescription ? "readLessDescriptionLabel" : "readMoreDescriptionLabel"}`)
@@ -35,9 +35,6 @@ const ContentWrapper = (0, _jsx2.styled)("div", {
35
35
  }
36
36
  }
37
37
  });
38
-
39
- // TODO: Figure out if we need to support headerButtons.
40
-
41
38
  const Concept = exports.Concept = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
42
39
  let {
43
40
  copyright,
@@ -211,8 +211,6 @@ const ImageEmbed = _ref => {
211
211
  };
212
212
  const licenseProps = (0, _licenseAttributes.licenseAttributes)(data.copyright.license.license, lang, embedData.url);
213
213
  const figureSize = figureProps?.float ? figureProps?.size ?? "medium" : "full";
214
-
215
- // TODO: Check how this works with `children`. Will only be important for ED
216
214
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledFigure, {
217
215
  float: figureProps?.float,
218
216
  size: imageSizes ? "full" : figureSize,
@@ -17,7 +17,6 @@ export { default as ContentLinkEmbed } from "./ContentLinkEmbed";
17
17
  export { default as RelatedContentEmbed } from "./RelatedContentEmbed";
18
18
  export { ConceptEmbed, InlineConcept, BlockConcept } from "./ConceptEmbed";
19
19
  export type { InlineConceptProps, BlockConceptProps } from "./ConceptEmbed";
20
- export { default as ConceptListEmbed } from "./ConceptListEmbed";
21
20
  export { default as UnknownEmbed } from "./UnknownEmbed";
22
21
  export { default as UuDisclaimerEmbed } from "./UuDisclaimerEmbed";
23
22
  export { default as CopyrightEmbed } from "./CopyrightEmbed";
@@ -33,12 +33,6 @@ Object.defineProperty(exports, "ConceptEmbed", {
33
33
  return _ConceptEmbed.ConceptEmbed;
34
34
  }
35
35
  });
36
- Object.defineProperty(exports, "ConceptListEmbed", {
37
- enumerable: true,
38
- get: function () {
39
- return _ConceptListEmbed.default;
40
- }
41
- });
42
36
  Object.defineProperty(exports, "ContentLinkEmbed", {
43
37
  enumerable: true,
44
38
  get: function () {
@@ -134,7 +128,6 @@ var _BrightcoveEmbed = _interopRequireDefault(require("./BrightcoveEmbed"));
134
128
  var _ContentLinkEmbed = _interopRequireDefault(require("./ContentLinkEmbed"));
135
129
  var _RelatedContentEmbed = _interopRequireDefault(require("./RelatedContentEmbed"));
136
130
  var _ConceptEmbed = require("./ConceptEmbed");
137
- var _ConceptListEmbed = _interopRequireDefault(require("./ConceptListEmbed"));
138
131
  var _UnknownEmbed = _interopRequireDefault(require("./UnknownEmbed"));
139
132
  var _UuDisclaimerEmbed = _interopRequireDefault(require("./UuDisclaimerEmbed"));
140
133
  var _CopyrightEmbed = _interopRequireDefault(require("./CopyrightEmbed"));
@@ -20,27 +20,30 @@ var _jsxRuntime = require("react/jsx-runtime");
20
20
 
21
21
  const StyledAside = (0, _jsx2.styled)("aside", {
22
22
  base: {
23
- display: "flex",
24
- flexDirection: "column",
25
- alignItems: "center",
26
23
  position: "relative",
27
24
  padding: "medium",
28
- transitionProperty: "max-height",
25
+ display: "grid",
26
+ gridTemplateRows: "0fr",
27
+ transitionProperty: "grid-template-rows",
29
28
  transitionDuration: "slow",
30
29
  transitionTimingFunction: "ease-in-out",
30
+ justifyItems: "center",
31
31
  border: "1px solid",
32
32
  borderColor: "stroke.default",
33
33
  borderRadius: "xsmall",
34
- maxHeight: "surface.xxsmall",
35
34
  clear: "both",
35
+ _open: {
36
+ gridTemplateRows: "1fr"
37
+ },
36
38
  _closed: {
37
39
  _print: {
38
40
  overflow: "visible",
39
41
  maxHeight: "500vh"
40
42
  }
41
43
  },
42
- _open: {
43
- maxHeight: "500vh"
44
+ "& > div": {
45
+ minHeight: "surface.3xsmall",
46
+ overflow: "hidden"
44
47
  }
45
48
  }
46
49
  });
@@ -134,6 +134,7 @@ const TextContent = (0, _jsx2.styled)("span", {
134
134
  transitionProperty: "max-height",
135
135
  transitionDuration: "slow",
136
136
  transitionTimingFunction: "ease-in",
137
+ marginInlineEnd: "4xsmall",
137
138
  _open: {
138
139
  whiteSpace: "pre-wrap",
139
140
  maxHeight: "none"
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.RelatedArticleList = exports.RelatedArticle = void 0;
7
7
  var _react = require("react");
8
8
  var _reactI18next = require("react-i18next");
9
+ var _common = require("@ndla/icons/common");
9
10
  var _primitives = require("@ndla/primitives");
10
11
  var _safelink = require("@ndla/safelink");
11
12
  var _jsx2 = require("@ndla/styled-system/jsx");
@@ -21,6 +22,12 @@ var _jsxRuntime = require("react/jsx-runtime");
21
22
  *
22
23
  */
23
24
 
25
+ const StyledSpan = (0, _jsx2.styled)("span", {
26
+ base: {
27
+ display: "flex",
28
+ gap: "3xsmall"
29
+ }
30
+ });
24
31
  const RelatedArticle = _ref => {
25
32
  let {
26
33
  title,
@@ -45,7 +52,9 @@ const RelatedArticle = _ref => {
45
52
  target: target,
46
53
  rel: linkInfo ? "noopener noreferrer" : undefined,
47
54
  css: _patterns.linkOverlay.raw(),
48
- children: title
55
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledSpan, {
56
+ children: [title, target === "_blank" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_common.ExternalLinkLine, {})]
57
+ })
49
58
  })
50
59
  })
51
60
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
package/lib/index.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
  export { Concept } from "./Concept/Concept";
9
- export { ImageEmbed, getCrop, getFocalPoint, AudioEmbed, H5pEmbed, ExternalEmbed, IframeEmbed, FootnoteEmbed, BrightcoveEmbed, ContentLinkEmbed, RelatedContentEmbed, ConceptEmbed, ConceptListEmbed, UnknownEmbed, InlineConcept, BlockConcept, UuDisclaimerEmbed, CopyrightEmbed, CodeEmbed, InlineTriggerButton, } from "./Embed";
9
+ export { ImageEmbed, getCrop, getFocalPoint, AudioEmbed, H5pEmbed, ExternalEmbed, IframeEmbed, FootnoteEmbed, BrightcoveEmbed, ContentLinkEmbed, RelatedContentEmbed, ConceptEmbed, UnknownEmbed, InlineConcept, BlockConcept, UuDisclaimerEmbed, CopyrightEmbed, CodeEmbed, InlineTriggerButton, } from "./Embed";
10
10
  export { LicenseLink, EmbedByline } from "./LicenseByline";
11
11
  export { ArticleByline, ArticleBylineAccordionItem, ArticleFootNotes, ArticleWrapper, Article, ArticleFooter, ArticleHeader, ArticleContent, ArticleHGroup, ArticleTitle, } from "./Article";
12
12
  export { getPossiblyRelativeUrl } from "./utils/relativeUrl";
package/lib/index.js CHANGED
@@ -141,12 +141,6 @@ Object.defineProperty(exports, "ConceptEmbed", {
141
141
  return _Embed.ConceptEmbed;
142
142
  }
143
143
  });
144
- Object.defineProperty(exports, "ConceptListEmbed", {
145
- enumerable: true,
146
- get: function () {
147
- return _Embed.ConceptListEmbed;
148
- }
149
- });
150
144
  Object.defineProperty(exports, "ContactBlock", {
151
145
  enumerable: true,
152
146
  get: function () {
package/lib/styles.css CHANGED
@@ -210,6 +210,10 @@
210
210
  max-width: var(--sizes-surface-xlarge);
211
211
  }
212
212
 
213
+ .ms_3xsmall {
214
+ margin-inline-start: var(--spacing-3xsmall);
215
+ }
216
+
213
217
  .bdr-b_xsmall {
214
218
  border-bottom-left-radius: var(--radii-xsmall);
215
219
  border-bottom-right-radius: var(--radii-xsmall);
@@ -463,10 +467,6 @@
463
467
  max-height: 50vh;
464
468
  }
465
469
 
466
- .c_text\.error {
467
- color: var(--colors-text-error);
468
- }
469
-
470
470
  .p_0 {
471
471
  padding: 0;
472
472
  }
@@ -511,10 +511,6 @@
511
511
  margin-block: var(--spacing-xxlarge);
512
512
  }
513
513
 
514
- .max-h_surface\.xxsmall {
515
- max-height: var(--sizes-surface-xxsmall);
516
- }
517
-
518
514
  .clear_both {
519
515
  clear: both;
520
516
  }
@@ -793,9 +789,13 @@
793
789
  margin-left: var(--spacing-3xsmall);
794
790
  }
795
791
 
796
- .trs-prop_max-height {
797
- --transition-prop: max-height;
798
- transition-property: max-height;
792
+ .grid-tr_0fr {
793
+ grid-template-rows: 0fr;
794
+ }
795
+
796
+ .trs-prop_grid-template-rows {
797
+ --transition-prop: grid-template-rows;
798
+ transition-property: grid-template-rows;
799
799
  }
800
800
 
801
801
  .trs-dur_slow {
@@ -808,6 +808,10 @@
808
808
  transition-timing-function: ease-in-out;
809
809
  }
810
810
 
811
+ .justify-items_center {
812
+ justify-items: center;
813
+ }
814
+
811
815
  .bottom_-medium {
812
816
  bottom: calc(var(--spacing-medium) * -1);
813
817
  }
@@ -1048,10 +1052,6 @@
1048
1052
  margin-block-start: var(--spacing-xsmall);
1049
1053
  }
1050
1054
 
1051
- .\[\&_li\]\:d_block li {
1052
- display: block;
1053
- }
1054
-
1055
1055
  .\[\&_svg\]\:fill_text\.subtle svg {
1056
1056
  fill: var(--colors-text-subtle);
1057
1057
  }
@@ -1092,8 +1092,12 @@
1092
1092
  color: var(--colors-text-strong);
1093
1093
  }
1094
1094
 
1095
- .open\:max-h_500vh:is([open], [data-open], [data-state="open"]) {
1096
- max-height: 500vh;
1095
+ .\[\&_\>_div\]\:min-h_surface\.3xsmall > div {
1096
+ min-height: var(--sizes-surface-3xsmall);
1097
+ }
1098
+
1099
+ .\[\&_\>_div\]\:ov_hidden > div {
1100
+ overflow: hidden;
1097
1101
  }
1098
1102
 
1099
1103
  .\[\&_\:first-child\]\:mbs_0 :first-child {
@@ -1246,6 +1250,10 @@
1246
1250
  margin-top: 0;
1247
1251
  }
1248
1252
 
1253
+ .open\:grid-tr_1fr:is([open], [data-open], [data-state="open"]) {
1254
+ grid-template-rows: 1fr;
1255
+ }
1256
+
1249
1257
  .after\:content_\"\"::after {
1250
1258
  content: "";
1251
1259
  }
@@ -1725,6 +1733,9 @@
1725
1733
  }
1726
1734
  .mobileWideDown\:tov_ellipsis {
1727
1735
  text-overflow: ellipsis;
1736
+ }
1737
+ .mobileWideDown\:me_4xsmall {
1738
+ margin-inline-end: var(--spacing-4xsmall);
1728
1739
  }
1729
1740
  .mobileWideDown\:cg_3xsmall {
1730
1741
  column-gap: var(--spacing-3xsmall);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "56.0.27-alpha.0",
3
+ "version": "56.0.29-alpha.0",
4
4
  "description": "UI component library for NDLA",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -34,18 +34,16 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@ndla/core": "^5.0.2",
37
- "@ndla/icons": "^8.0.18-alpha.0",
37
+ "@ndla/icons": "^8.0.20-alpha.0",
38
38
  "@ndla/licenses": "^8.0.3-alpha.0",
39
- "@ndla/primitives": "^1.0.24-alpha.0",
40
- "@ndla/safelink": "^7.0.24-alpha.0",
41
- "@ndla/styled-system": "^0.0.20",
39
+ "@ndla/primitives": "^1.0.26-alpha.0",
40
+ "@ndla/safelink": "^7.0.26-alpha.0",
41
+ "@ndla/styled-system": "^0.0.22",
42
42
  "@ndla/util": "^4.1.0",
43
43
  "html-react-parser": "^5.1.8",
44
44
  "i18next-browser-languagedetector": "^7.1.0"
45
45
  },
46
46
  "peerDependencies": {
47
- "@emotion/react": "^11.10.4",
48
- "@emotion/styled": "^11.10.4",
49
47
  "i18next": "^23.11.5",
50
48
  "react": ">= 18",
51
49
  "react-dom": ">= 18",
@@ -53,9 +51,9 @@
53
51
  "react-router-dom": "> 6.0.0"
54
52
  },
55
53
  "devDependencies": {
56
- "@ndla/preset-panda": "^0.0.28",
54
+ "@ndla/preset-panda": "^0.0.30",
57
55
  "@ndla/types-backend": "^0.2.86",
58
- "@ndla/types-embed": "^5.0.1-alpha.0",
56
+ "@ndla/types-embed": "^5.0.2-alpha.0",
59
57
  "@pandacss/dev": "^0.46.0",
60
58
  "css-loader": "^6.7.3",
61
59
  "mini-css-extract-plugin": "^2.7.5",
@@ -66,5 +64,5 @@
66
64
  "publishConfig": {
67
65
  "access": "public"
68
66
  },
69
- "gitHead": "45c12a953606ca3eb14c8d09c25401c8bc24ed22"
67
+ "gitHead": "92e263c72d707da94f33fb1aae9ea8e586b29b6e"
70
68
  }
@@ -122,6 +122,12 @@ const TextVersionButton = styled(Button, {
122
122
  },
123
123
  });
124
124
 
125
+ const ShowMoreButton = styled(Button, {
126
+ base: {
127
+ marginInlineStart: "3xsmall",
128
+ },
129
+ });
130
+
125
131
  const DESCRIPTION_MAX_LENGTH = 200;
126
132
 
127
133
  type Props = {
@@ -191,9 +197,9 @@ const AudioPlayer = ({ src, title, subtitle, speech, description, img, textVersi
191
197
  ? description
192
198
  : `${truncatedDescription}...`}
193
199
  {description.length > DESCRIPTION_MAX_LENGTH && (
194
- <Button variant="link" onClick={() => setShowFullDescription((p) => !p)}>
200
+ <ShowMoreButton variant="link" onClick={() => setShowFullDescription((p) => !p)}>
195
201
  {t(`audio.${showFullDescription ? "readLessDescriptionLabel" : "readMoreDescriptionLabel"}`)}
196
- </Button>
202
+ </ShowMoreButton>
197
203
  )}
198
204
  </Text>
199
205
  )}
@@ -43,8 +43,6 @@ const ContentWrapper = styled("div", {
43
43
  },
44
44
  });
45
45
 
46
- // TODO: Figure out if we need to support headerButtons.
47
-
48
46
  export const Concept = forwardRef<HTMLElement, ConceptProps>(
49
47
  ({ copyright, visualElement, lang, children, title, source, previewAlt, ...rest }, ref) => {
50
48
  const licenseProps = licenseAttributes(copyright?.license?.license, lang, source);
@@ -226,7 +226,6 @@ const ImageEmbed = ({ embed, previewAlt, lang, renderContext = "article", childr
226
226
 
227
227
  const figureSize = figureProps?.float ? figureProps?.size ?? "medium" : "full";
228
228
 
229
- // TODO: Check how this works with `children`. Will only be important for ED
230
229
  return (
231
230
  <StyledFigure
232
231
  float={figureProps?.float}
@@ -386,6 +386,7 @@ const linkEmbed1: RelatedContentMetaData = {
386
386
  resource: "related-content",
387
387
  title: "Test",
388
388
  url: "https://example.com",
389
+ urlDomain: "example.com",
389
390
  },
390
391
  data: undefined,
391
392
  status: "success",
@@ -397,6 +398,7 @@ const linkEmbed2: RelatedContentMetaData = {
397
398
  resource: "related-content",
398
399
  title: "NDLA",
399
400
  url: "https://ndla.no",
401
+ urlDomain: "ndla.no",
400
402
  },
401
403
  data: undefined,
402
404
  status: "success",
@@ -408,6 +410,7 @@ const linkEmbed3: RelatedContentMetaData = {
408
410
  resource: "related-content",
409
411
  title: "Valg av tillitselev fra klassen",
410
412
  url: "https://xn--elevrd-mua.no",
413
+ urlDomain: "elevråd.no",
411
414
  },
412
415
  data: undefined,
413
416
  status: "success",
@@ -50,7 +50,7 @@ const RelatedContentEmbed = ({ embed, isOembed, subject, ndlaFrontendDomain }: P
50
50
  introduction=""
51
51
  to={embedData.url}
52
52
  target="_blank"
53
- type={"external"}
53
+ type="external"
54
54
  linkInfo={`${t("related.linkInfo")} ${embedData.urlDomain}`}
55
55
  />
56
56
  );
@@ -18,7 +18,6 @@ export { default as ContentLinkEmbed } from "./ContentLinkEmbed";
18
18
  export { default as RelatedContentEmbed } from "./RelatedContentEmbed";
19
19
  export { ConceptEmbed, InlineConcept, BlockConcept } from "./ConceptEmbed";
20
20
  export type { InlineConceptProps, BlockConceptProps } from "./ConceptEmbed";
21
- export { default as ConceptListEmbed } from "./ConceptListEmbed";
22
21
  export { default as UnknownEmbed } from "./UnknownEmbed";
23
22
  export { default as UuDisclaimerEmbed } from "./UuDisclaimerEmbed";
24
23
  export { default as CopyrightEmbed } from "./CopyrightEmbed";
@@ -21,27 +21,30 @@ interface Props extends ComponentProps<"aside"> {
21
21
 
22
22
  const StyledAside = styled("aside", {
23
23
  base: {
24
- display: "flex",
25
- flexDirection: "column",
26
- alignItems: "center",
27
24
  position: "relative",
28
25
  padding: "medium",
29
- transitionProperty: "max-height",
26
+ display: "grid",
27
+ gridTemplateRows: "0fr",
28
+ transitionProperty: "grid-template-rows",
30
29
  transitionDuration: "slow",
31
30
  transitionTimingFunction: "ease-in-out",
31
+ justifyItems: "center",
32
32
  border: "1px solid",
33
33
  borderColor: "stroke.default",
34
34
  borderRadius: "xsmall",
35
- maxHeight: "surface.xxsmall",
36
35
  clear: "both",
36
+ _open: {
37
+ gridTemplateRows: "1fr",
38
+ },
37
39
  _closed: {
38
40
  _print: {
39
41
  overflow: "visible",
40
42
  maxHeight: "500vh",
41
43
  },
42
44
  },
43
- _open: {
44
- maxHeight: "500vh",
45
+ "& > div": {
46
+ minHeight: "surface.3xsmall",
47
+ overflow: "hidden",
45
48
  },
46
49
  },
47
50
  });
@@ -197,6 +197,7 @@ const TextContent = styled("span", {
197
197
  transitionProperty: "max-height",
198
198
  transitionDuration: "slow",
199
199
  transitionTimingFunction: "ease-in",
200
+ marginInlineEnd: "4xsmall",
200
201
  _open: {
201
202
  whiteSpace: "pre-wrap",
202
203
  maxHeight: "none",
@@ -8,6 +8,7 @@
8
8
 
9
9
  import { Children, ComponentPropsWithoutRef, ReactNode, useMemo, useState } from "react";
10
10
  import { useTranslation } from "react-i18next";
11
+ import { ExternalLinkLine } from "@ndla/icons/common";
11
12
  import { CardContent, CardHeading, CardRoot, Text, Heading, Button } from "@ndla/primitives";
12
13
  import { SafeLink } from "@ndla/safelink";
13
14
  import { styled } from "@ndla/styled-system/jsx";
@@ -25,6 +26,13 @@ interface RelatedArticleProps {
25
26
  type?: string;
26
27
  }
27
28
 
29
+ const StyledSpan = styled("span", {
30
+ base: {
31
+ display: "flex",
32
+ gap: "3xsmall",
33
+ },
34
+ });
35
+
28
36
  export const RelatedArticle = ({
29
37
  title,
30
38
  introduction,
@@ -46,7 +54,10 @@ export const RelatedArticle = ({
46
54
  rel={linkInfo ? "noopener noreferrer" : undefined}
47
55
  css={linkOverlay.raw()}
48
56
  >
49
- {title}
57
+ <StyledSpan>
58
+ {title}
59
+ {target === "_blank" && <ExternalLinkLine />}
60
+ </StyledSpan>
50
61
  </SafeLink>
51
62
  </span>
52
63
  </CardHeading>
package/src/index.ts CHANGED
@@ -24,7 +24,6 @@ export {
24
24
  ContentLinkEmbed,
25
25
  RelatedContentEmbed,
26
26
  ConceptEmbed,
27
- ConceptListEmbed,
28
27
  UnknownEmbed,
29
28
  InlineConcept,
30
29
  BlockConcept,
@@ -1,76 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import { useTranslation } from "react-i18next";
10
- import { Figure } from "@ndla/primitives";
11
- import { styled } from "@ndla/styled-system/jsx";
12
- import { BlockConcept } from "./ConceptEmbed";
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- // TODO: Find out if we're actually still going to use this.
15
- // If we are, we need to re-add some margin between the list items. We should also probably parse the concept content to HTML, like we do in ConceptEmbed.
16
-
17
- const ConceptList = styled("div", {
18
- base: {
19
- "& li": {
20
- display: "block"
21
- }
22
- }
23
- });
24
- const StyledSpan = styled("span", {
25
- base: {
26
- color: "text.error"
27
- }
28
- });
29
- const ConceptListEmbed = _ref => {
30
- let {
31
- embed,
32
- lang
33
- } = _ref;
34
- const {
35
- t
36
- } = useTranslation();
37
- if (embed.status === "error") {
38
- return /*#__PURE__*/_jsx(StyledSpan, {
39
- children: t("embed.conceptListError")
40
- });
41
- }
42
- const {
43
- embedData,
44
- data
45
- } = embed;
46
- return /*#__PURE__*/_jsx("div", {
47
- "data-embed-type": "concept-list",
48
- children: /*#__PURE__*/_jsxs(Figure, {
49
- children: [embedData.title && /*#__PURE__*/_jsx("h2", {
50
- lang: lang,
51
- children: embedData.title
52
- }), /*#__PURE__*/_jsx(ConceptList, {
53
- children: /*#__PURE__*/_jsx("ul", {
54
- lang: lang,
55
- children: data.concepts.map(_ref2 => {
56
- let {
57
- concept,
58
- visualElement
59
- } = _ref2;
60
- return /*#__PURE__*/_jsx("li", {
61
- children: /*#__PURE__*/_jsx(BlockConcept, {
62
- title: concept.title.title,
63
- content: concept.content.content,
64
- copyright: concept.copyright,
65
- visualElement: visualElement,
66
- lang: lang,
67
- source: concept.source
68
- })
69
- }, concept.id);
70
- })
71
- })
72
- })]
73
- })
74
- });
75
- };
76
- export default ConceptListEmbed;
@@ -1,14 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import { ConceptListMetaData } from "@ndla/types-embed";
9
- interface Props {
10
- embed: ConceptListMetaData;
11
- lang?: string;
12
- }
13
- declare const ConceptListEmbed: ({ embed, lang }: Props) => import("react/jsx-runtime").JSX.Element;
14
- export default ConceptListEmbed;
@@ -1,82 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _reactI18next = require("react-i18next");
8
- var _primitives = require("@ndla/primitives");
9
- var _jsx2 = require("@ndla/styled-system/jsx");
10
- var _ConceptEmbed = require("./ConceptEmbed");
11
- var _jsxRuntime = require("react/jsx-runtime");
12
- /**
13
- * Copyright (c) 2023-present, NDLA.
14
- *
15
- * This source code is licensed under the GPLv3 license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- *
18
- */
19
-
20
- // TODO: Find out if we're actually still going to use this.
21
- // If we are, we need to re-add some margin between the list items. We should also probably parse the concept content to HTML, like we do in ConceptEmbed.
22
-
23
- const ConceptList = (0, _jsx2.styled)("div", {
24
- base: {
25
- "& li": {
26
- display: "block"
27
- }
28
- }
29
- });
30
- const StyledSpan = (0, _jsx2.styled)("span", {
31
- base: {
32
- color: "text.error"
33
- }
34
- });
35
- const ConceptListEmbed = _ref => {
36
- let {
37
- embed,
38
- lang
39
- } = _ref;
40
- const {
41
- t
42
- } = (0, _reactI18next.useTranslation)();
43
- if (embed.status === "error") {
44
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSpan, {
45
- children: t("embed.conceptListError")
46
- });
47
- }
48
- const {
49
- embedData,
50
- data
51
- } = embed;
52
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
53
- "data-embed-type": "concept-list",
54
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Figure, {
55
- children: [embedData.title && /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
56
- lang: lang,
57
- children: embedData.title
58
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ConceptList, {
59
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
60
- lang: lang,
61
- children: data.concepts.map(_ref2 => {
62
- let {
63
- concept,
64
- visualElement
65
- } = _ref2;
66
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
67
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConceptEmbed.BlockConcept, {
68
- title: concept.title.title,
69
- content: concept.content.content,
70
- copyright: concept.copyright,
71
- visualElement: visualElement,
72
- lang: lang,
73
- source: concept.source
74
- })
75
- }, concept.id);
76
- })
77
- })
78
- })]
79
- })
80
- });
81
- };
82
- var _default = exports.default = ConceptListEmbed;
@@ -1,68 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import { useTranslation } from "react-i18next";
10
- import { Figure } from "@ndla/primitives";
11
- import { styled } from "@ndla/styled-system/jsx";
12
- import { ConceptListMetaData } from "@ndla/types-embed";
13
- import { BlockConcept } from "./ConceptEmbed";
14
-
15
- interface Props {
16
- embed: ConceptListMetaData;
17
- lang?: string;
18
- }
19
-
20
- // TODO: Find out if we're actually still going to use this.
21
- // If we are, we need to re-add some margin between the list items. We should also probably parse the concept content to HTML, like we do in ConceptEmbed.
22
-
23
- const ConceptList = styled("div", {
24
- base: {
25
- "& li": {
26
- display: "block",
27
- },
28
- },
29
- });
30
-
31
- const StyledSpan = styled("span", {
32
- base: {
33
- color: "text.error",
34
- },
35
- });
36
-
37
- const ConceptListEmbed = ({ embed, lang }: Props) => {
38
- const { t } = useTranslation();
39
- if (embed.status === "error") {
40
- return <StyledSpan>{t("embed.conceptListError")}</StyledSpan>;
41
- }
42
- const { embedData, data } = embed;
43
- return (
44
- <div data-embed-type="concept-list">
45
- <Figure>
46
- {embedData.title && <h2 lang={lang}>{embedData.title}</h2>}
47
- <ConceptList>
48
- <ul lang={lang}>
49
- {data.concepts.map(({ concept, visualElement }) => (
50
- <li key={concept.id}>
51
- <BlockConcept
52
- title={concept.title.title}
53
- content={concept.content.content}
54
- copyright={concept.copyright}
55
- visualElement={visualElement}
56
- lang={lang}
57
- source={concept.source}
58
- />
59
- </li>
60
- ))}
61
- </ul>
62
- </ConceptList>
63
- </Figure>
64
- </div>
65
- );
66
- };
67
-
68
- export default ConceptListEmbed;