@ndla/ui 56.0.84-alpha.0 → 56.0.86-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.
@@ -179,6 +179,7 @@
179
179
  "opacity]___[value:0",
180
180
  "cursor]___[value:pointer",
181
181
  "opacity]___[value:1]___[cond:&:focus, &:focus-visible, &:active",
182
+ "clear]___[value:both",
182
183
  "marginBlockStart]___[value:3xsmall",
183
184
  "border]___[value:0",
184
185
  "height]___[value:auto",
@@ -215,7 +216,6 @@
215
216
  "fill]___[value:stroke.default]___[cond:& svg",
216
217
  "marginBlockStart]___[value:3xsmall]___[cond:& > *:not(:first-child)",
217
218
  "clear]___[value:both]___[cond:& + [data-embed-wrapper]",
218
- "clear]___[value:both",
219
219
  "height]___[value:auto]___[cond:& iframe",
220
220
  "width]___[value:100%]___[cond:& iframe",
221
221
  "textStyle]___[value:label.xsmall]___[cond:& a",
package/dist/styles.css CHANGED
@@ -393,6 +393,10 @@
393
393
  cursor: pointer;
394
394
  }
395
395
 
396
+ .clear_both {
397
+ clear: both;
398
+ }
399
+
396
400
  .mbs_3xsmall {
397
401
  margin-block-start: var(--spacing-3xsmall);
398
402
  }
@@ -437,10 +441,6 @@
437
441
  background: var(--colors-background-subtle);
438
442
  }
439
443
 
440
- .clear_both {
441
- clear: both;
442
- }
443
-
444
444
  .z_docked {
445
445
  z-index: var(--z-index-docked);
446
446
  }
@@ -7,11 +7,17 @@
7
7
  */
8
8
 
9
9
  import { Figure } from "@ndla/primitives";
10
+ import { styled } from "@ndla/styled-system/jsx";
10
11
  import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
11
12
  import AudioPlayer from "../AudioPlayer";
12
13
  import { EmbedByline } from "../LicenseByline";
13
14
  import { licenseAttributes } from "../utils/licenseAttributes";
14
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
+ const StyledFigure = styled(Figure, {
17
+ base: {
18
+ clear: "both"
19
+ }
20
+ });
15
21
  export const getFirstNonEmptyLicenseCredits = authors => Object.values(authors).find(i => i.length > 0) ?? [];
16
22
  const AudioEmbed = _ref => {
17
23
  let {
@@ -45,7 +51,7 @@ const AudioEmbed = _ref => {
45
51
  alt: coverPhoto.altText
46
52
  };
47
53
  const licenseProps = licenseAttributes(data.copyright.license.license, lang, embedData.url);
48
- return /*#__PURE__*/_jsxs(Figure, {
54
+ return /*#__PURE__*/_jsxs(StyledFigure, {
49
55
  lang: lang,
50
56
  "data-embed-type": type,
51
57
  ...licenseProps,
@@ -49,7 +49,7 @@ const ExternalEmbed = _ref => {
49
49
  } = embed;
50
50
  if (embedData.type === "fullscreen") {
51
51
  const image = {
52
- src: data.iframeImage?.image.imageUrl ?? "",
52
+ src: data.iframeImage?.image.imageUrl,
53
53
  alt: embedData.alt !== undefined ? embedData.alt : data.iframeImage?.alttext?.alttext ?? ""
54
54
  };
55
55
  return /*#__PURE__*/_jsx(Figure, {
@@ -19,6 +19,11 @@ const StyledIframe = styled("iframe", {
19
19
  border: 0
20
20
  }
21
21
  });
22
+ const StyledFigure = styled(Figure, {
23
+ base: {
24
+ clear: "both"
25
+ }
26
+ });
22
27
  const IframeEmbed = _ref => {
23
28
  let {
24
29
  embed
@@ -49,10 +54,10 @@ const IframeEmbed = _ref => {
49
54
  const iframeImage = embed.status === "success" ? data.iframeImage : undefined;
50
55
  const alt = embedData.alt !== undefined ? embedData.alt : iframeImage?.alttext.alttext;
51
56
  const image = {
52
- src: iframeImage?.image.imageUrl ?? "",
57
+ src: iframeImage?.image.imageUrl,
53
58
  alt: alt ?? ""
54
59
  };
55
- return /*#__PURE__*/_jsx(Figure, {
60
+ return /*#__PURE__*/_jsx(StyledFigure, {
56
61
  "data-embed-type": "iframe",
57
62
  children: /*#__PURE__*/_jsx(ResourceBox, {
58
63
  image: image,
@@ -72,7 +77,7 @@ const IframeEmbed = _ref => {
72
77
  const strippedWidth = typeof width === "number" ? width : width?.replace(/\s*px/, "");
73
78
  const strippedHeight = typeof height === "number" ? height : height?.replace(/\s*px/, "");
74
79
  const urlOrTitle = title || url;
75
- return /*#__PURE__*/_jsx(Figure, {
80
+ return /*#__PURE__*/_jsx(StyledFigure, {
76
81
  "data-embed-type": "iframe",
77
82
  children: /*#__PURE__*/_jsx(StyledIframe, {
78
83
  ref: iframeRef,
@@ -37,6 +37,11 @@ const StyledSafeLink = styled(SafeLink, {
37
37
  }
38
38
  }
39
39
  });
40
+ const Wrapper = styled("div", {
41
+ base: {
42
+ clear: "both"
43
+ }
44
+ });
40
45
  const UuDisclaimerEmbed = _ref => {
41
46
  let {
42
47
  embed,
@@ -55,7 +60,7 @@ const UuDisclaimerEmbed = _ref => {
55
60
  rel: "noopener noreferrer",
56
61
  children: data.disclaimerLink.text
57
62
  }) : null;
58
- return /*#__PURE__*/_jsxs("div", {
63
+ return /*#__PURE__*/_jsxs(Wrapper, {
59
64
  role: "region",
60
65
  "data-embed-type": "uu-disclaimer",
61
66
  children: [/*#__PURE__*/_jsxs(StyledMessageBox, {
@@ -88,7 +88,8 @@ const StyledSection = styled("section", {
88
88
  display: "flex",
89
89
  flexDirection: "column",
90
90
  alignItems: "center",
91
- gap: "medium"
91
+ gap: "medium",
92
+ clear: "both"
92
93
  }
93
94
  });
94
95
  const StyledButton = styled(Button, {
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getFirstNonEmptyLicenseCredits = exports.default = void 0;
7
7
  var _primitives = require("@ndla/primitives");
8
+ var _jsx2 = require("@ndla/styled-system/jsx");
8
9
  var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
9
10
  var _AudioPlayer = _interopRequireDefault(require("../AudioPlayer"));
10
11
  var _LicenseByline = require("../LicenseByline");
@@ -19,6 +20,11 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
19
20
  *
20
21
  */
21
22
 
23
+ const StyledFigure = (0, _jsx2.styled)(_primitives.Figure, {
24
+ base: {
25
+ clear: "both"
26
+ }
27
+ });
22
28
  const getFirstNonEmptyLicenseCredits = authors => Object.values(authors).find(i => i.length > 0) ?? [];
23
29
  exports.getFirstNonEmptyLicenseCredits = getFirstNonEmptyLicenseCredits;
24
30
  const AudioEmbed = _ref => {
@@ -53,7 +59,7 @@ const AudioEmbed = _ref => {
53
59
  alt: coverPhoto.altText
54
60
  };
55
61
  const licenseProps = (0, _licenseAttributes.licenseAttributes)(data.copyright.license.license, lang, embedData.url);
56
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Figure, {
62
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledFigure, {
57
63
  lang: lang,
58
64
  "data-embed-type": type,
59
65
  ...licenseProps,
@@ -56,7 +56,7 @@ const ExternalEmbed = _ref => {
56
56
  } = embed;
57
57
  if (embedData.type === "fullscreen") {
58
58
  const image = {
59
- src: data.iframeImage?.image.imageUrl ?? "",
59
+ src: data.iframeImage?.image.imageUrl,
60
60
  alt: embedData.alt !== undefined ? embedData.alt : data.iframeImage?.alttext?.alttext ?? ""
61
61
  };
62
62
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Figure, {
@@ -26,6 +26,11 @@ const StyledIframe = (0, _jsx2.styled)("iframe", {
26
26
  border: 0
27
27
  }
28
28
  });
29
+ const StyledFigure = (0, _jsx2.styled)(_primitives.Figure, {
30
+ base: {
31
+ clear: "both"
32
+ }
33
+ });
29
34
  const IframeEmbed = _ref => {
30
35
  let {
31
36
  embed
@@ -56,10 +61,10 @@ const IframeEmbed = _ref => {
56
61
  const iframeImage = embed.status === "success" ? data.iframeImage : undefined;
57
62
  const alt = embedData.alt !== undefined ? embedData.alt : iframeImage?.alttext.alttext;
58
63
  const image = {
59
- src: iframeImage?.image.imageUrl ?? "",
64
+ src: iframeImage?.image.imageUrl,
60
65
  alt: alt ?? ""
61
66
  };
62
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Figure, {
67
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFigure, {
63
68
  "data-embed-type": "iframe",
64
69
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResourceBox.ResourceBox, {
65
70
  image: image,
@@ -79,7 +84,7 @@ const IframeEmbed = _ref => {
79
84
  const strippedWidth = typeof width === "number" ? width : width?.replace(/\s*px/, "");
80
85
  const strippedHeight = typeof height === "number" ? height : height?.replace(/\s*px/, "");
81
86
  const urlOrTitle = title || url;
82
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Figure, {
87
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFigure, {
83
88
  "data-embed-type": "iframe",
84
89
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledIframe, {
85
90
  ref: iframeRef,
@@ -43,6 +43,11 @@ const StyledSafeLink = (0, _jsx2.styled)(_safelink.SafeLink, {
43
43
  }
44
44
  }
45
45
  });
46
+ const Wrapper = (0, _jsx2.styled)("div", {
47
+ base: {
48
+ clear: "both"
49
+ }
50
+ });
46
51
  const UuDisclaimerEmbed = _ref => {
47
52
  let {
48
53
  embed,
@@ -61,7 +66,7 @@ const UuDisclaimerEmbed = _ref => {
61
66
  rel: "noopener noreferrer",
62
67
  children: data.disclaimerLink.text
63
68
  }) : null;
64
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
69
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
65
70
  role: "region",
66
71
  "data-embed-type": "uu-disclaimer",
67
72
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledMessageBox, {
@@ -95,7 +95,8 @@ const StyledSection = (0, _jsx2.styled)("section", {
95
95
  display: "flex",
96
96
  flexDirection: "column",
97
97
  alignItems: "center",
98
- gap: "medium"
98
+ gap: "medium",
99
+ clear: "both"
99
100
  }
100
101
  });
101
102
  const StyledButton = (0, _jsx2.styled)(_primitives.Button, {
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
  interface ImageMeta {
9
- src: string;
9
+ src: string | undefined;
10
10
  alt: string;
11
11
  }
12
12
  interface Props {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "56.0.84-alpha.0",
3
+ "version": "56.0.86-alpha.0",
4
4
  "description": "UI component library for NDLA",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -33,11 +33,11 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@ndla/core": "^5.0.3",
36
- "@ndla/icons": "^8.0.48-alpha.0",
36
+ "@ndla/icons": "^8.0.49-alpha.0",
37
37
  "@ndla/licenses": "^8.0.6-alpha.0",
38
- "@ndla/primitives": "^1.0.67-alpha.0",
39
- "@ndla/safelink": "^7.0.68-alpha.0",
40
- "@ndla/styled-system": "^0.0.29",
38
+ "@ndla/primitives": "^1.0.69-alpha.0",
39
+ "@ndla/safelink": "^7.0.70-alpha.0",
40
+ "@ndla/styled-system": "^0.0.30",
41
41
  "@ndla/util": "^5.0.5-alpha.0",
42
42
  "html-react-parser": "^5.1.19",
43
43
  "i18next-browser-languagedetector": "^7.1.0"
@@ -50,13 +50,13 @@
50
50
  "react-router-dom": "> 6.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@ndla/preset-panda": "^0.0.48",
53
+ "@ndla/preset-panda": "^0.0.49",
54
54
  "@ndla/types-backend": "^1.0.1",
55
- "@ndla/types-embed": "^5.0.6-alpha.0",
55
+ "@ndla/types-embed": "^5.0.7-alpha.0",
56
56
  "@pandacss/dev": "^0.48.0"
57
57
  },
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "14e44312c9dd32cc892dac71c60b3569c2b3dfc8"
61
+ "gitHead": "ed6699652dec494cf9cf12712316ba5f4036438a"
62
62
  }
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  import { Figure } from "@ndla/primitives";
10
+ import { styled } from "@ndla/styled-system/jsx";
10
11
  import type { AudioMetaData } from "@ndla/types-embed";
11
12
  import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
12
13
  import type { Author } from "./ImageEmbed";
@@ -14,6 +15,12 @@ import AudioPlayer from "../AudioPlayer";
14
15
  import { EmbedByline } from "../LicenseByline";
15
16
  import { licenseAttributes } from "../utils/licenseAttributes";
16
17
 
18
+ const StyledFigure = styled(Figure, {
19
+ base: {
20
+ clear: "both",
21
+ },
22
+ });
23
+
17
24
  interface Props {
18
25
  embed: AudioMetaData;
19
26
  lang?: string;
@@ -46,7 +53,7 @@ const AudioEmbed = ({ embed, lang }: Props) => {
46
53
  const licenseProps = licenseAttributes(data.copyright.license.license, lang, embedData.url);
47
54
 
48
55
  return (
49
- <Figure lang={lang} data-embed-type={type} {...licenseProps}>
56
+ <StyledFigure lang={lang} data-embed-type={type} {...licenseProps}>
50
57
  <AudioPlayer
51
58
  description={data.podcastMeta?.introduction ?? ""}
52
59
  img={img}
@@ -64,7 +71,7 @@ const AudioEmbed = ({ embed, lang }: Props) => {
64
71
  type={data.audioType === "standard" ? "audio" : "podcast"}
65
72
  copyright={embed.data.copyright}
66
73
  />
67
- </Figure>
74
+ </StyledFigure>
68
75
  );
69
76
  };
70
77
 
@@ -105,7 +105,7 @@ const visuallyInterpretedEmbedMetaData: BrightcoveMetaData = {
105
105
  src: "https://cf-images.eu-west-1.prod.boltdns.net/v1/static/4806596774001/a09bcb7b-ffe1-4c3a-98ea-bf997340a8cd/23f01e33-413e-418c-a4de-2c87c8b05c26/1280x720/match/image.jpg",
106
106
  },
107
107
  },
108
- link: { text: "6242635463001" },
108
+ link: { text: "6242635463001", url: "" },
109
109
  long_description: null,
110
110
  name: "Frivillighet i helse og omsorgstjenesten (synstolket)",
111
111
  published_at: "2021-03-25T11:40:38.476Z",
@@ -49,7 +49,7 @@ const ExternalEmbed = ({ embed }: Props) => {
49
49
 
50
50
  if (embedData.type === "fullscreen") {
51
51
  const image = {
52
- src: data.iframeImage?.image.imageUrl ?? "",
52
+ src: data.iframeImage?.image.imageUrl,
53
53
  alt: embedData.alt !== undefined ? embedData.alt : (data.iframeImage?.alttext?.alttext ?? ""),
54
54
  };
55
55
  return (
@@ -25,6 +25,12 @@ const StyledIframe = styled("iframe", {
25
25
  },
26
26
  });
27
27
 
28
+ const StyledFigure = styled(Figure, {
29
+ base: {
30
+ clear: "both",
31
+ },
32
+ });
33
+
28
34
  const IframeEmbed = ({ embed }: Props) => {
29
35
  const { t } = useTranslation();
30
36
  const iframeRef = useRef<HTMLIFrameElement>(null);
@@ -48,9 +54,9 @@ const IframeEmbed = ({ embed }: Props) => {
48
54
  if (embedData.type === "fullscreen") {
49
55
  const iframeImage = embed.status === "success" ? data.iframeImage : undefined;
50
56
  const alt = embedData.alt !== undefined ? embedData.alt : iframeImage?.alttext.alttext;
51
- const image = { src: iframeImage?.image.imageUrl ?? "", alt: alt ?? "" };
57
+ const image = { src: iframeImage?.image.imageUrl, alt: alt ?? "" };
52
58
  return (
53
- <Figure data-embed-type="iframe">
59
+ <StyledFigure data-embed-type="iframe">
54
60
  <ResourceBox
55
61
  image={image}
56
62
  title={embedData.title ?? ""}
@@ -58,7 +64,7 @@ const IframeEmbed = ({ embed }: Props) => {
58
64
  caption={embedData.caption ?? ""}
59
65
  buttonText={t("license.other.itemImage.ariaLabel")}
60
66
  />
61
- </Figure>
67
+ </StyledFigure>
62
68
  );
63
69
  }
64
70
 
@@ -69,7 +75,7 @@ const IframeEmbed = ({ embed }: Props) => {
69
75
  const urlOrTitle = title || url;
70
76
 
71
77
  return (
72
- <Figure data-embed-type="iframe">
78
+ <StyledFigure data-embed-type="iframe">
73
79
  <StyledIframe
74
80
  ref={iframeRef}
75
81
  title={urlOrTitle}
@@ -80,7 +86,7 @@ const IframeEmbed = ({ embed }: Props) => {
80
86
  allow="fullscreen; encrypted-media"
81
87
  loading="lazy"
82
88
  />
83
- </Figure>
89
+ </StyledFigure>
84
90
  );
85
91
  };
86
92
 
@@ -45,6 +45,12 @@ const StyledSafeLink = styled(SafeLink, {
45
45
  },
46
46
  });
47
47
 
48
+ const Wrapper = styled("div", {
49
+ base: {
50
+ clear: "both",
51
+ },
52
+ });
53
+
48
54
  const UuDisclaimerEmbed = ({ embed, children }: Props) => {
49
55
  if (embed.status === "error") {
50
56
  return null;
@@ -59,7 +65,7 @@ const UuDisclaimerEmbed = ({ embed, children }: Props) => {
59
65
  ) : null;
60
66
 
61
67
  return (
62
- <div role="region" data-embed-type="uu-disclaimer">
68
+ <Wrapper role="region" data-embed-type="uu-disclaimer">
63
69
  <StyledMessageBox variant="warning" contentEditable={false}>
64
70
  <InformationLine />
65
71
  <Disclaimer>
@@ -68,7 +74,7 @@ const UuDisclaimerEmbed = ({ embed, children }: Props) => {
68
74
  </Disclaimer>
69
75
  </StyledMessageBox>
70
76
  <div data-uu-content="">{children}</div>
71
- </div>
77
+ </Wrapper>
72
78
  );
73
79
  };
74
80
 
@@ -98,6 +98,7 @@ const StyledSection = styled("section", {
98
98
  flexDirection: "column",
99
99
  alignItems: "center",
100
100
  gap: "medium",
101
+ clear: "both",
101
102
  },
102
103
  });
103
104
 
@@ -66,7 +66,7 @@ const StyledText = styled(Text, {
66
66
  });
67
67
 
68
68
  interface ImageMeta {
69
- src: string;
69
+ src: string | undefined;
70
70
  alt: string;
71
71
  }
72
72