@ndla/ui 55.0.12-alpha.0 → 55.0.13-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.
- package/dist/all-aout.js +0 -0
- package/dist/all.css +1 -0
- package/dist/panda.buildinfo.json +170 -0
- package/dist/styles.css +686 -0
- package/es/Article/Article.js +3 -4
- package/es/Article/ArticleByline.js +9 -9
- package/es/Article/ArticleFootNotes.js +4 -4
- package/es/AudioPlayer/AudioPlayer.js +142 -163
- package/es/AudioPlayer/Controls.js +187 -203
- package/es/AudioPlayer/SpeechControl.js +13 -11
- package/es/BlogPost/BlogPost.js +85 -23
- package/es/CampaignBlock/CampaignBlock.js +3 -4
- package/es/CodeBlock/CodeBlock.js +88 -96
- package/es/ContactBlock/ContactBlock.js +54 -40
- package/es/ContentLoader/index.js +7 -7
- package/es/CopyParagraphButton/CopyParagraphButton.js +4 -4
- package/es/Embed/AudioEmbed.js +5 -9
- package/es/Embed/BrightcoveEmbed.js +12 -15
- package/es/Embed/CodeEmbed.js +58 -10
- package/es/Embed/ConceptEmbed.js +15 -20
- package/es/Embed/ContentLinkEmbed.js +1 -1
- package/es/Embed/EmbedErrorPlaceholder.js +32 -17
- package/es/Embed/ExternalEmbed.js +7 -10
- package/es/Embed/FootnoteEmbed.js +3 -3
- package/es/Embed/H5pEmbed.js +1 -2
- package/es/Embed/IframeEmbed.js +8 -9
- package/es/Embed/ImageEmbed.js +167 -122
- package/es/Embed/RelatedContentEmbed.js +8 -10
- package/es/Embed/UuDisclaimerEmbed.js +2 -2
- package/es/Embed/conceptComponents.js +9 -9
- package/es/ErrorMessage/ErrorMessage.js +1 -1
- package/es/FactBox/FactBox.js +2 -2
- package/es/FileList/File.js +1 -1
- package/es/FileList/Format.js +3 -3
- package/es/FrontpageArticle/FrontpageArticle.js +1 -1
- package/es/Gloss/Gloss.js +9 -11
- package/es/Gloss/GlossExample.js +3 -4
- package/es/Grid/Grid.js +1 -1
- package/es/Image/Image.js +7 -8
- package/es/Image/ImageLink.js +1 -1
- package/es/KeyFigure/KeyFigure.js +2 -2
- package/es/LanguageSelector/LanguageSelector.js +2 -2
- package/es/LetterFilter/LetterFilter.js +1 -1
- package/es/LicenseByline/EmbedByline.js +5 -6
- package/es/LicenseByline/LicenseDescription.js +1 -1
- package/es/LicenseByline/LicenseLink.js +1 -2
- package/es/Messages/MessageBox.js +1 -1
- package/es/Notion/Notion.js +2 -2
- package/es/Notion/NotionImage.js +12 -57
- package/es/RelatedArticleList/RelatedArticleList.js +3 -3
- package/es/ResourceBox/ResourceBox.js +12 -17
- package/es/Search/ActiveFilters.js +1 -1
- package/es/Search/ContentTypeResult.js +9 -6
- package/es/Search/ContentTypeResultStyles.js +1 -1
- package/es/Search/IsPathToHighlight.js +1 -1
- package/es/Search/SearchField.js +6 -8
- package/es/Search/SearchResult.js +14 -19
- package/es/Search/SearchResultSleeve.js +14 -16
- package/es/SnackBar/SnackbarProvider.js +8 -11
- package/es/TagSelector/TagSelector.js +1 -1
- package/es/TagSelector/ariaMessages.js +6 -6
- package/es/TreeStructure/AddFolderButton.js +4 -6
- package/es/TreeStructure/ComboboxButton.js +4 -7
- package/es/TreeStructure/FolderItem.js +12 -15
- package/es/TreeStructure/FolderItems.js +3 -3
- package/es/TreeStructure/TreeStructure.js +9 -12
- package/es/TreeStructure/helperFunctions.js +1 -1
- package/es/ZendeskButton/ZendeskButton.js +55 -0
- package/es/i18n/formatNestedMessages.js +1 -1
- package/es/index.js +2 -1
- package/es/locale/messages-en.js +9 -8
- package/es/locale/messages-nb.js +9 -8
- package/es/locale/messages-nn.js +9 -8
- package/es/locale/messages-se.js +9 -8
- package/es/locale/messages-sma.js +9 -8
- package/es/styles.css +686 -0
- package/es/utils/relativeUrl.js +3 -3
- package/lib/Article/Article.js +3 -4
- package/lib/Article/ArticleByline.js +9 -9
- package/lib/Article/ArticleFootNotes.js +4 -4
- package/lib/AudioPlayer/AudioPlayer.d.ts +1 -2
- package/lib/AudioPlayer/AudioPlayer.js +142 -162
- package/lib/AudioPlayer/Controls.js +190 -205
- package/lib/AudioPlayer/SpeechControl.js +13 -11
- package/lib/BlogPost/BlogPost.d.ts +2 -2
- package/lib/BlogPost/BlogPost.js +85 -24
- package/lib/CampaignBlock/CampaignBlock.js +3 -4
- package/lib/CodeBlock/CodeBlock.d.ts +5 -8
- package/lib/CodeBlock/CodeBlock.js +88 -96
- package/lib/ContactBlock/ContactBlock.js +55 -43
- package/lib/ContentLoader/index.js +7 -7
- package/lib/CopyParagraphButton/CopyParagraphButton.js +4 -4
- package/lib/Embed/AudioEmbed.js +5 -9
- package/lib/Embed/BrightcoveEmbed.js +12 -15
- package/lib/Embed/CodeEmbed.js +56 -8
- package/lib/Embed/ConceptEmbed.js +15 -20
- package/lib/Embed/ContentLinkEmbed.js +1 -1
- package/lib/Embed/EmbedErrorPlaceholder.d.ts +4 -3
- package/lib/Embed/EmbedErrorPlaceholder.js +32 -18
- package/lib/Embed/ExternalEmbed.js +7 -10
- package/lib/Embed/FootnoteEmbed.js +3 -3
- package/lib/Embed/H5pEmbed.js +1 -2
- package/lib/Embed/IframeEmbed.js +8 -9
- package/lib/Embed/ImageEmbed.d.ts +1 -2
- package/lib/Embed/ImageEmbed.js +167 -123
- package/lib/Embed/RelatedContentEmbed.js +8 -10
- package/lib/Embed/UuDisclaimerEmbed.js +2 -2
- package/lib/Embed/conceptComponents.js +9 -9
- package/lib/ErrorMessage/ErrorMessage.js +1 -1
- package/lib/FactBox/FactBox.js +2 -2
- package/lib/FileList/File.js +1 -1
- package/lib/FileList/Format.js +3 -3
- package/lib/FrontpageArticle/FrontpageArticle.js +1 -1
- package/lib/Gloss/Gloss.js +9 -11
- package/lib/Gloss/GlossExample.js +3 -4
- package/lib/Grid/Grid.js +1 -1
- package/lib/Image/Image.js +7 -8
- package/lib/Image/ImageLink.js +1 -1
- package/lib/KeyFigure/KeyFigure.js +2 -2
- package/lib/LanguageSelector/LanguageSelector.js +2 -2
- package/lib/LetterFilter/LetterFilter.js +1 -1
- package/lib/LicenseByline/EmbedByline.js +5 -6
- package/lib/LicenseByline/LicenseDescription.js +1 -1
- package/lib/LicenseByline/LicenseLink.js +1 -2
- package/lib/Messages/MessageBox.js +1 -1
- package/lib/Notion/Notion.js +2 -2
- package/lib/Notion/NotionImage.d.ts +1 -11
- package/lib/Notion/NotionImage.js +12 -59
- package/lib/RelatedArticleList/RelatedArticleList.js +3 -3
- package/lib/ResourceBox/ResourceBox.js +13 -18
- package/lib/Search/ActiveFilters.js +1 -1
- package/lib/Search/ContentTypeResult.js +9 -6
- package/lib/Search/ContentTypeResultStyles.js +1 -1
- package/lib/Search/IsPathToHighlight.js +1 -1
- package/lib/Search/SearchField.js +6 -8
- package/lib/Search/SearchResult.js +14 -19
- package/lib/Search/SearchResultSleeve.js +14 -16
- package/lib/SnackBar/SnackbarProvider.js +8 -11
- package/lib/TagSelector/TagSelector.js +1 -1
- package/lib/TagSelector/ariaMessages.js +6 -6
- package/lib/TreeStructure/AddFolderButton.js +4 -6
- package/lib/TreeStructure/ComboboxButton.js +4 -7
- package/lib/TreeStructure/FolderItem.js +12 -15
- package/lib/TreeStructure/FolderItems.js +3 -3
- package/lib/TreeStructure/TreeStructure.js +9 -12
- package/lib/TreeStructure/helperFunctions.js +1 -1
- package/lib/ZendeskButton/ZendeskButton.d.ts +19 -0
- package/lib/ZendeskButton/ZendeskButton.js +61 -0
- package/lib/i18n/formatNestedMessages.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +7 -0
- package/lib/locale/messages-en.d.ts +1 -0
- package/lib/locale/messages-en.js +9 -8
- package/lib/locale/messages-nb.d.ts +1 -0
- package/lib/locale/messages-nb.js +9 -8
- package/lib/locale/messages-nn.d.ts +1 -0
- package/lib/locale/messages-nn.js +9 -8
- package/lib/locale/messages-se.d.ts +1 -0
- package/lib/locale/messages-se.js +9 -8
- package/lib/locale/messages-sma.d.ts +1 -0
- package/lib/locale/messages-sma.js +9 -8
- package/lib/styles.css +686 -0
- package/lib/types.d.ts +1 -0
- package/lib/utils/relativeUrl.js +3 -3
- package/package.json +17 -12
- package/src/AudioPlayer/AudioPlayer.tsx +139 -176
- package/src/AudioPlayer/Controls.tsx +210 -250
- package/src/AudioPlayer/SpeechControl.tsx +9 -7
- package/src/BlogPost/BlogPost.tsx +82 -58
- package/src/CodeBlock/CodeBlock.stories.tsx +0 -43
- package/src/CodeBlock/CodeBlock.tsx +91 -202
- package/src/ContactBlock/ContactBlock.tsx +10 -2
- package/src/Embed/CodeEmbed.stories.tsx +95 -0
- package/src/Embed/CodeEmbed.tsx +62 -7
- package/src/Embed/ConceptEmbed.tsx +1 -9
- package/src/Embed/EmbedErrorPlaceholder.tsx +31 -28
- package/src/Embed/ImageEmbed.stories.tsx +53 -11
- package/src/Embed/ImageEmbed.tsx +162 -166
- package/src/Notion/NotionImage.tsx +4 -54
- package/src/ResourceBox/ResourceBox.tsx +3 -15
- package/src/Search/ContentTypeResult.tsx +9 -3
- package/src/Search/SearchResultSleeve.tsx +5 -2
- package/src/ZendeskButton/ZendeskButton.tsx +58 -0
- package/src/index.ts +4 -0
- package/src/locale/messages-en.ts +1 -0
- package/src/locale/messages-nb.ts +1 -0
- package/src/locale/messages-nn.ts +1 -0
- package/src/locale/messages-se.ts +1 -0
- package/src/locale/messages-sma.ts +1 -0
- package/src/types.ts +2 -0
- package/src/Image/__tests__/Image-test.tsx +0 -66
- package/src/Image/__tests__/__snapshots__/Image-test.tsx.snap +0 -194
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _styled from "@emotion/styled/base";
|
|
2
1
|
/**
|
|
3
2
|
* Copyright (c) 2023-present, NDLA.
|
|
4
3
|
*
|
|
@@ -7,35 +6,51 @@ import _styled from "@emotion/styled/base";
|
|
|
7
6
|
*
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
import { colors, spacing } from "@ndla/core";
|
|
11
9
|
import { WarningOutline } from "@ndla/icons/common";
|
|
12
|
-
import { Figure } from "
|
|
10
|
+
import { Figure } from "@ndla/primitives";
|
|
11
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
13
12
|
import { EmbedByline } from "../LicenseByline";
|
|
14
13
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
15
|
-
const ErrorPlaceholder =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
const ErrorPlaceholder = styled("div", {
|
|
15
|
+
base: {
|
|
16
|
+
display: "flex",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
justifyContent: "center",
|
|
19
|
+
backgroundColor: "surface.disabled",
|
|
20
|
+
height: "surface.xsmall",
|
|
21
|
+
"& svg": {
|
|
22
|
+
fill: "text.subtle",
|
|
23
|
+
height: "90%",
|
|
24
|
+
width: "90%"
|
|
25
|
+
},
|
|
26
|
+
"&[data-embed-type='audio']": {
|
|
27
|
+
height: "surface.3xsmall"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const StyledFigure = styled(Figure, {
|
|
32
|
+
base: {
|
|
33
|
+
"& > *:not(:first-child)": {
|
|
34
|
+
marginBlockStart: "3xsmall"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
23
38
|
const EmbedErrorPlaceholder = _ref => {
|
|
24
39
|
let {
|
|
25
40
|
type,
|
|
26
41
|
children,
|
|
27
|
-
figureType
|
|
42
|
+
figureType,
|
|
43
|
+
float
|
|
28
44
|
} = _ref;
|
|
29
45
|
return _jsxs(StyledFigure, {
|
|
30
|
-
|
|
31
|
-
|
|
46
|
+
size: figureType,
|
|
47
|
+
float: float,
|
|
48
|
+
children: [children ?? _jsx(ErrorPlaceholder, {
|
|
32
49
|
"data-embed-type": type,
|
|
33
50
|
children: _jsx(WarningOutline, {})
|
|
34
51
|
}), _jsx(EmbedByline, {
|
|
35
52
|
error: true,
|
|
36
|
-
type: type
|
|
37
|
-
topRounded: true,
|
|
38
|
-
bottomRounded: true
|
|
53
|
+
type: type
|
|
39
54
|
})]
|
|
40
55
|
});
|
|
41
56
|
};
|
|
@@ -27,7 +27,6 @@ const StyledFigure = /*#__PURE__*/_styled(Figure, {
|
|
|
27
27
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
28
28
|
});
|
|
29
29
|
const ExternalEmbed = _ref => {
|
|
30
|
-
var _data$oembed$html;
|
|
31
30
|
let {
|
|
32
31
|
embed,
|
|
33
32
|
isConcept
|
|
@@ -37,11 +36,10 @@ const ExternalEmbed = _ref => {
|
|
|
37
36
|
} = useTranslation();
|
|
38
37
|
const figRef = useRef(null);
|
|
39
38
|
useEffect(() => {
|
|
40
|
-
|
|
41
|
-
const iframe = (_figRef$current = figRef.current) === null || _figRef$current === void 0 ? void 0 : _figRef$current.querySelector("iframe");
|
|
39
|
+
const iframe = figRef.current?.querySelector("iframe");
|
|
42
40
|
if (iframe) {
|
|
43
41
|
const [width, height] = [Number.parseInt(iframe.width), Number.parseInt(iframe.height)];
|
|
44
|
-
iframe.style.aspectRatio =
|
|
42
|
+
iframe.style.aspectRatio = `${width ? width : 16}/${height ? height : 9}`;
|
|
45
43
|
iframe.width = "";
|
|
46
44
|
iframe.height = "";
|
|
47
45
|
}
|
|
@@ -56,18 +54,17 @@ const ExternalEmbed = _ref => {
|
|
|
56
54
|
data
|
|
57
55
|
} = embed;
|
|
58
56
|
if (embedData.type === "fullscreen") {
|
|
59
|
-
var _data$iframeImage$ima, _data$iframeImage, _data$iframeImage$alt, _data$iframeImage2, _embedData$title, _embedData$caption;
|
|
60
57
|
const image = {
|
|
61
|
-
src:
|
|
62
|
-
alt: embedData.alt !== undefined ? embedData.alt :
|
|
58
|
+
src: data.iframeImage?.image.imageUrl ?? "",
|
|
59
|
+
alt: embedData.alt !== undefined ? embedData.alt : data.iframeImage?.alttext?.alttext ?? ""
|
|
63
60
|
};
|
|
64
61
|
return _jsx(Figure, {
|
|
65
62
|
type: "full",
|
|
66
63
|
children: _jsx(ResourceBox, {
|
|
67
64
|
image: image,
|
|
68
|
-
title:
|
|
65
|
+
title: embedData.title ?? "",
|
|
69
66
|
url: embedData.url,
|
|
70
|
-
caption:
|
|
67
|
+
caption: embedData.caption ?? "",
|
|
71
68
|
buttonText: t("license.other.itemImage.ariaLabel")
|
|
72
69
|
})
|
|
73
70
|
});
|
|
@@ -76,7 +73,7 @@ const ExternalEmbed = _ref => {
|
|
|
76
73
|
ref: figRef,
|
|
77
74
|
type: isConcept ? "full-column" : undefined,
|
|
78
75
|
dangerouslySetInnerHTML: {
|
|
79
|
-
__html:
|
|
76
|
+
__html: data.oembed.html ?? ""
|
|
80
77
|
}
|
|
81
78
|
});
|
|
82
79
|
};
|
|
@@ -27,12 +27,12 @@ const FootnoteEmbed = _ref => {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
return _jsx(FootnoteRef, {
|
|
30
|
-
id:
|
|
30
|
+
id: `ref${embed.data.entryNum}`,
|
|
31
31
|
children: _jsx("sup", {
|
|
32
32
|
children: _jsx("a", {
|
|
33
|
-
href:
|
|
33
|
+
href: `#note${embed.data.entryNum}`,
|
|
34
34
|
target: "_self",
|
|
35
|
-
children:
|
|
35
|
+
children: `[${embed.data.entryNum}]`
|
|
36
36
|
})
|
|
37
37
|
})
|
|
38
38
|
});
|
package/es/Embed/H5pEmbed.js
CHANGED
|
@@ -34,11 +34,10 @@ const H5pEmbed = _ref => {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
if (embed.data.oembed) {
|
|
37
|
-
var _embed$data$oembed$ht;
|
|
38
37
|
return _jsx(Figure, {
|
|
39
38
|
type: isConcept ? "full-column" : undefined,
|
|
40
39
|
dangerouslySetInnerHTML: {
|
|
41
|
-
__html:
|
|
40
|
+
__html: embed.data.oembed.html ?? ""
|
|
42
41
|
}
|
|
43
42
|
});
|
|
44
43
|
}
|
package/es/Embed/IframeEmbed.js
CHANGED
|
@@ -25,7 +25,7 @@ const IframeEmbed = _ref => {
|
|
|
25
25
|
const iframe = iframeRef.current;
|
|
26
26
|
if (iframe) {
|
|
27
27
|
const [width, height] = [Number.parseInt(iframe.width), Number.parseInt(iframe.height)];
|
|
28
|
-
iframe.style.aspectRatio =
|
|
28
|
+
iframe.style.aspectRatio = `${width ? width : 16}/${height ? height : 9}`;
|
|
29
29
|
iframe.width = "";
|
|
30
30
|
iframe.height = "";
|
|
31
31
|
}
|
|
@@ -40,20 +40,19 @@ const IframeEmbed = _ref => {
|
|
|
40
40
|
data
|
|
41
41
|
} = embed;
|
|
42
42
|
if (embedData.type === "fullscreen") {
|
|
43
|
-
var _iframeImage$image$im, _embedData$title, _embedData$caption;
|
|
44
43
|
const iframeImage = embed.status === "success" ? data.iframeImage : undefined;
|
|
45
|
-
const alt = embedData.alt !== undefined ? embedData.alt : iframeImage
|
|
44
|
+
const alt = embedData.alt !== undefined ? embedData.alt : iframeImage?.alttext.alttext;
|
|
46
45
|
const image = {
|
|
47
|
-
src:
|
|
48
|
-
alt: alt
|
|
46
|
+
src: iframeImage?.image.imageUrl ?? "",
|
|
47
|
+
alt: alt ?? ""
|
|
49
48
|
};
|
|
50
49
|
return _jsx(Figure, {
|
|
51
50
|
type: "full",
|
|
52
51
|
children: _jsx(ResourceBox, {
|
|
53
52
|
image: image,
|
|
54
|
-
title:
|
|
53
|
+
title: embedData.title ?? "",
|
|
55
54
|
url: embedData.url,
|
|
56
|
-
caption:
|
|
55
|
+
caption: embedData.caption ?? "",
|
|
57
56
|
buttonText: t("license.other.itemImage.ariaLabel")
|
|
58
57
|
})
|
|
59
58
|
});
|
|
@@ -64,8 +63,8 @@ const IframeEmbed = _ref => {
|
|
|
64
63
|
title,
|
|
65
64
|
url
|
|
66
65
|
} = embedData;
|
|
67
|
-
const strippedWidth = typeof width === "number" ? width : width
|
|
68
|
-
const strippedHeight = typeof height === "number" ? height : height
|
|
66
|
+
const strippedWidth = typeof width === "number" ? width : width?.replace(/\s*px/, "");
|
|
67
|
+
const strippedHeight = typeof height === "number" ? height : height?.replace(/\s*px/, "");
|
|
69
68
|
const urlOrTitle = title || url;
|
|
70
69
|
return _jsx(Figure, {
|
|
71
70
|
type: isConcept ? "full-column" : undefined,
|