@ndla/ui 56.0.121-alpha.0 → 56.0.122-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/lib/i18n/index.d.ts +1 -1
- package/lib/i18n/useComponentTranslations.d.ts +2 -1
- package/lib/index.d.ts +1 -1
- package/lib/locale/messages-en.d.ts +34 -0
- package/lib/locale/messages-nb.d.ts +34 -0
- package/lib/locale/messages-nn.d.ts +34 -0
- package/lib/locale/messages-se.d.ts +34 -0
- package/package.json +6 -5
- package/src/Article/ArticleByline.tsx +1 -1
- package/src/i18n/index.ts +1 -0
- package/src/i18n/useComponentTranslations.ts +36 -1
- package/src/index.ts +1 -0
- package/src/locale/messages-en.ts +34 -0
- package/src/locale/messages-nb.ts +34 -0
- package/src/locale/messages-nn.ts +34 -0
- package/src/locale/messages-se.ts +34 -0
- package/es/Article/Article.js +0 -199
- package/es/Article/ArticleByline.js +0 -182
- package/es/Article/ArticleFootNotes.js +0 -60
- package/es/Article/index.js +0 -11
- package/es/AudioPlayer/AudioPlayer.js +0 -218
- package/es/AudioPlayer/Controls.js +0 -332
- package/es/AudioPlayer/SpeechControl.js +0 -56
- package/es/AudioPlayer/index.js +0 -10
- package/es/Breadcrumb/Breadcrumb.js +0 -60
- package/es/Breadcrumb/BreadcrumbItem.js +0 -62
- package/es/Breadcrumb/HomeBreadcrumb.js +0 -77
- package/es/Breadcrumb/index.js +0 -11
- package/es/CampaignBlock/CampaignBlock.js +0 -180
- package/es/CampaignBlock/index.js +0 -9
- package/es/CodeBlock/CodeBlock.js +0 -35
- package/es/CodeBlock/codeLanguageOptions.js +0 -84
- package/es/CodeBlock/index.js +0 -10
- package/es/Concept/Concept.js +0 -72
- package/es/ContactBlock/ContactBlock.js +0 -199
- package/es/ContactBlock/index.js +0 -9
- package/es/ContentTypeBadge/ContentTypeBadge.js +0 -50
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +0 -32
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +0 -32
- package/es/ContentTypeHero/ContentTypeHero.js +0 -50
- package/es/ContentTypeHero/index.js +0 -9
- package/es/CopyParagraphButton/CopyParagraphButton.js +0 -83
- package/es/CopyParagraphButton/index.js +0 -11
- package/es/Embed/AudioEmbed.js +0 -76
- package/es/Embed/BrightcoveEmbed.js +0 -133
- package/es/Embed/CodeEmbed.js +0 -79
- package/es/Embed/ConceptEmbed.js +0 -123
- package/es/Embed/ConceptInlineTriggerButton.js +0 -45
- package/es/Embed/ContentLinkEmbed.js +0 -51
- package/es/Embed/CopyrightEmbed.js +0 -33
- package/es/Embed/EmbedErrorPlaceholder.js +0 -58
- package/es/Embed/EmbedWrapper.js +0 -51
- package/es/Embed/ExternalEmbed.js +0 -74
- package/es/Embed/FootnoteEmbed.js +0 -44
- package/es/Embed/GlossEmbed.js +0 -80
- package/es/Embed/H5pEmbed.js +0 -61
- package/es/Embed/IframeEmbed.js +0 -93
- package/es/Embed/ImageEmbed.js +0 -238
- package/es/Embed/InlineTriggerButton.js +0 -37
- package/es/Embed/RelatedContentEmbed.js +0 -55
- package/es/Embed/UnknownEmbed.js +0 -31
- package/es/Embed/UuDisclaimerEmbed.js +0 -88
- package/es/Embed/index.js +0 -25
- package/es/Embed/types.js +0 -1
- package/es/ErrorMessage/ErrorMessage.js +0 -95
- package/es/ErrorMessage/index.js +0 -10
- package/es/FactBox/FactBox.js +0 -177
- package/es/FactBox/index.js +0 -10
- package/es/FileList/File.js +0 -101
- package/es/FileList/FileList.js +0 -47
- package/es/FileList/PdfFile.js +0 -50
- package/es/FileList/index.js +0 -11
- package/es/Gloss/Gloss.js +0 -175
- package/es/Gloss/GlossExample.js +0 -64
- package/es/Gloss/index.js +0 -10
- package/es/Grid/Grid.js +0 -94
- package/es/Grid/GridParallaxItem.js +0 -32
- package/es/Grid/index.js +0 -10
- package/es/KeyFigure/KeyFigure.js +0 -63
- package/es/KeyFigure/index.js +0 -9
- package/es/LicenseByline/EmbedByline.js +0 -212
- package/es/LicenseByline/LicenseLink.js +0 -56
- package/es/LicenseByline/index.js +0 -10
- package/es/LinkBlock/LinkBlock.js +0 -103
- package/es/LinkBlock/LinkBlockSection.js +0 -35
- package/es/LinkBlock/index.js +0 -10
- package/es/Pitch/Pitch.js +0 -83
- package/es/Pitch/index.js +0 -9
- package/es/RelatedArticleList/RelatedArticleList.js +0 -135
- package/es/RelatedArticleList/index.js +0 -11
- package/es/ResourceBox/ResourceBox.js +0 -99
- package/es/ResourceBox/index.js +0 -10
- package/es/TagSelector/TagSelector.js +0 -143
- package/es/ZendeskButton/ZendeskButton.js +0 -55
- package/es/i18n/formatNestedMessages.js +0 -25
- package/es/i18n/i18n.js +0 -35
- package/es/i18n/index.js +0 -11
- package/es/i18n/useComponentTranslations.js +0 -164
- package/es/index.js +0 -45
- package/es/locale/messages-en.js +0 -428
- package/es/locale/messages-nb.js +0 -428
- package/es/locale/messages-nn.js +0 -428
- package/es/locale/messages-se.js +0 -428
- package/es/model/ContentType.js +0 -68
- package/es/model/SubjectCategories.js +0 -12
- package/es/model/SubjectTypes.js +0 -11
- package/es/model/WordClass.js +0 -45
- package/es/model/index.js +0 -21
- package/es/types.js +0 -1
- package/es/utils/licenseAttributes.js +0 -18
- package/es/utils/relativeUrl.js +0 -37
- package/lib/Article/Article.js +0 -207
- package/lib/Article/ArticleByline.js +0 -189
- package/lib/Article/ArticleFootNotes.js +0 -67
- package/lib/Article/index.js +0 -68
- package/lib/AudioPlayer/AudioPlayer.js +0 -224
- package/lib/AudioPlayer/Controls.js +0 -338
- package/lib/AudioPlayer/SpeechControl.js +0 -62
- package/lib/AudioPlayer/index.js +0 -16
- package/lib/Breadcrumb/Breadcrumb.js +0 -67
- package/lib/Breadcrumb/BreadcrumbItem.js +0 -68
- package/lib/Breadcrumb/HomeBreadcrumb.js +0 -84
- package/lib/Breadcrumb/index.js +0 -23
- package/lib/CampaignBlock/CampaignBlock.js +0 -187
- package/lib/CampaignBlock/index.js +0 -13
- package/lib/CodeBlock/CodeBlock.js +0 -41
- package/lib/CodeBlock/codeLanguageOptions.js +0 -90
- package/lib/CodeBlock/index.js +0 -20
- package/lib/Concept/Concept.js +0 -78
- package/lib/ContactBlock/ContactBlock.js +0 -206
- package/lib/ContactBlock/index.js +0 -18
- package/lib/ContentTypeBadge/ContentTypeBadge.js +0 -57
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +0 -38
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +0 -38
- package/lib/ContentTypeHero/ContentTypeHero.js +0 -57
- package/lib/ContentTypeHero/index.js +0 -12
- package/lib/CopyParagraphButton/CopyParagraphButton.js +0 -89
- package/lib/CopyParagraphButton/index.js +0 -22
- package/lib/Embed/AudioEmbed.js +0 -84
- package/lib/Embed/BrightcoveEmbed.js +0 -142
- package/lib/Embed/CodeEmbed.js +0 -86
- package/lib/Embed/ConceptEmbed.js +0 -131
- package/lib/Embed/ConceptInlineTriggerButton.js +0 -51
- package/lib/Embed/ContentLinkEmbed.js +0 -57
- package/lib/Embed/CopyrightEmbed.js +0 -39
- package/lib/Embed/EmbedErrorPlaceholder.js +0 -64
- package/lib/Embed/EmbedWrapper.js +0 -57
- package/lib/Embed/ExternalEmbed.js +0 -81
- package/lib/Embed/FootnoteEmbed.js +0 -50
- package/lib/Embed/GlossEmbed.js +0 -88
- package/lib/Embed/H5pEmbed.js +0 -68
- package/lib/Embed/IframeEmbed.js +0 -100
- package/lib/Embed/ImageEmbed.js +0 -248
- package/lib/Embed/InlineTriggerButton.js +0 -43
- package/lib/Embed/RelatedContentEmbed.js +0 -61
- package/lib/Embed/UnknownEmbed.js +0 -37
- package/lib/Embed/UuDisclaimerEmbed.js +0 -94
- package/lib/Embed/index.js +0 -150
- package/lib/Embed/types.js +0 -5
- package/lib/ErrorMessage/ErrorMessage.js +0 -101
- package/lib/ErrorMessage/index.js +0 -16
- package/lib/FactBox/FactBox.js +0 -184
- package/lib/FactBox/index.js +0 -16
- package/lib/FileList/File.js +0 -108
- package/lib/FileList/FileList.js +0 -54
- package/lib/FileList/PdfFile.js +0 -57
- package/lib/FileList/index.js +0 -44
- package/lib/Gloss/Gloss.js +0 -181
- package/lib/Gloss/GlossExample.js +0 -70
- package/lib/Gloss/index.js +0 -20
- package/lib/Grid/Grid.js +0 -101
- package/lib/Grid/GridParallaxItem.js +0 -39
- package/lib/Grid/index.js +0 -19
- package/lib/KeyFigure/KeyFigure.js +0 -70
- package/lib/KeyFigure/index.js +0 -13
- package/lib/LicenseByline/EmbedByline.js +0 -220
- package/lib/LicenseByline/LicenseLink.js +0 -62
- package/lib/LicenseByline/index.js +0 -19
- package/lib/LinkBlock/LinkBlock.js +0 -110
- package/lib/LinkBlock/LinkBlockSection.js +0 -41
- package/lib/LinkBlock/index.js +0 -20
- package/lib/Pitch/Pitch.js +0 -91
- package/lib/Pitch/index.js +0 -12
- package/lib/RelatedArticleList/RelatedArticleList.js +0 -143
- package/lib/RelatedArticleList/index.js +0 -21
- package/lib/ResourceBox/ResourceBox.js +0 -106
- package/lib/ResourceBox/index.js +0 -13
- package/lib/TagSelector/TagSelector.js +0 -150
- package/lib/ZendeskButton/ZendeskButton.js +0 -61
- package/lib/i18n/formatNestedMessages.js +0 -32
- package/lib/i18n/i18n.js +0 -41
- package/lib/i18n/index.js +0 -62
- package/lib/i18n/useComponentTranslations.js +0 -176
- package/lib/index.js +0 -593
- package/lib/locale/messages-en.js +0 -435
- package/lib/locale/messages-nb.js +0 -435
- package/lib/locale/messages-nn.js +0 -435
- package/lib/locale/messages-se.js +0 -435
- package/lib/model/ContentType.js +0 -74
- package/lib/model/SubjectCategories.js +0 -18
- package/lib/model/SubjectTypes.js +0 -17
- package/lib/model/WordClass.js +0 -51
- package/lib/model/index.js +0 -28
- package/lib/types.js +0 -5
- package/lib/utils/licenseAttributes.js +0 -25
- package/lib/utils/relativeUrl.js +0 -44
|
@@ -1,51 +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 { Text } from "@ndla/primitives";
|
|
11
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
const ContentLinkEmbed = _ref => {
|
|
13
|
-
let {
|
|
14
|
-
embed,
|
|
15
|
-
isOembed,
|
|
16
|
-
children
|
|
17
|
-
} = _ref;
|
|
18
|
-
const {
|
|
19
|
-
t
|
|
20
|
-
} = useTranslation();
|
|
21
|
-
if (embed.status === "error") {
|
|
22
|
-
return /*#__PURE__*/_jsx(Text, {
|
|
23
|
-
color: "text.error",
|
|
24
|
-
asChild: true,
|
|
25
|
-
consumeCss: true,
|
|
26
|
-
children: /*#__PURE__*/_jsxs("span", {
|
|
27
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
28
|
-
children: `${t("embed.linkError")}: `
|
|
29
|
-
}), children]
|
|
30
|
-
})
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
const {
|
|
34
|
-
embedData,
|
|
35
|
-
data
|
|
36
|
-
} = embed;
|
|
37
|
-
if (embedData.openIn === "new-context" || isOembed) {
|
|
38
|
-
return /*#__PURE__*/_jsx("a", {
|
|
39
|
-
href: data.path,
|
|
40
|
-
"data-embed-type": "content-link",
|
|
41
|
-
target: "_blank",
|
|
42
|
-
rel: "noopener noreferrer",
|
|
43
|
-
children: children
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return /*#__PURE__*/_jsx("a", {
|
|
47
|
-
href: data.path,
|
|
48
|
-
children: children
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
export default ContentLinkEmbed;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2024-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 { styled } from "@ndla/styled-system/jsx";
|
|
10
|
-
import { EmbedByline } from "../LicenseByline";
|
|
11
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
const StyledCopyrightContent = styled("div", {
|
|
13
|
-
base: {
|
|
14
|
-
marginBlockEnd: "xsmall"
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
const CopyrightEmbed = _ref => {
|
|
18
|
-
let {
|
|
19
|
-
embed,
|
|
20
|
-
children
|
|
21
|
-
} = _ref;
|
|
22
|
-
return /*#__PURE__*/_jsxs("figure", {
|
|
23
|
-
"data-embed-type": "copyright",
|
|
24
|
-
children: [/*#__PURE__*/_jsx(StyledCopyrightContent, {
|
|
25
|
-
"data-copyright-content": "",
|
|
26
|
-
children: children
|
|
27
|
-
}), /*#__PURE__*/_jsx(EmbedByline, {
|
|
28
|
-
type: "copyright",
|
|
29
|
-
copyright: embed.embedData.copyright
|
|
30
|
-
})]
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
export default CopyrightEmbed;
|
|
@@ -1,58 +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 { ErrorWarningLine } from "@ndla/icons";
|
|
10
|
-
import { Figure } from "@ndla/primitives";
|
|
11
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
12
|
-
import { EmbedByline } from "../LicenseByline";
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
const ErrorPlaceholder = styled("div", {
|
|
15
|
-
base: {
|
|
16
|
-
display: "flex",
|
|
17
|
-
alignItems: "center",
|
|
18
|
-
justifyContent: "center",
|
|
19
|
-
background: "background.subtle",
|
|
20
|
-
height: "surface.xsmall",
|
|
21
|
-
border: "1px solid",
|
|
22
|
-
borderColor: "stroke.default",
|
|
23
|
-
borderRadius: "xsmall",
|
|
24
|
-
"& svg": {
|
|
25
|
-
height: "5xlarge",
|
|
26
|
-
width: "5xlarge",
|
|
27
|
-
fill: "stroke.default"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const StyledFigure = styled(Figure, {
|
|
32
|
-
base: {
|
|
33
|
-
"& > *:not(:first-child)": {
|
|
34
|
-
marginBlockStart: "3xsmall"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
const EmbedErrorPlaceholder = _ref => {
|
|
39
|
-
let {
|
|
40
|
-
type,
|
|
41
|
-
children,
|
|
42
|
-
figureType,
|
|
43
|
-
float
|
|
44
|
-
} = _ref;
|
|
45
|
-
return /*#__PURE__*/_jsxs(StyledFigure, {
|
|
46
|
-
size: figureType,
|
|
47
|
-
float: float,
|
|
48
|
-
"data-embed-type": type,
|
|
49
|
-
children: [children ?? /*#__PURE__*/_jsx(ErrorPlaceholder, {
|
|
50
|
-
"data-embed-type": type,
|
|
51
|
-
children: /*#__PURE__*/_jsx(ErrorWarningLine, {})
|
|
52
|
-
}), /*#__PURE__*/_jsx(EmbedByline, {
|
|
53
|
-
error: true,
|
|
54
|
-
type: type
|
|
55
|
-
})]
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
export default EmbedErrorPlaceholder;
|
package/es/Embed/EmbedWrapper.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2024-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 { forwardRef } from "react";
|
|
10
|
-
import { ark } from "@ark-ui/react";
|
|
11
|
-
import { css, cva } from "@ndla/styled-system/css";
|
|
12
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
const embedWrapperRecipe = cva({
|
|
15
|
-
base: {
|
|
16
|
-
position: "relative"
|
|
17
|
-
},
|
|
18
|
-
defaultVariants: {
|
|
19
|
-
noClear: false
|
|
20
|
-
},
|
|
21
|
-
variants: {
|
|
22
|
-
noClear: {
|
|
23
|
-
true: {
|
|
24
|
-
"& + [data-embed-wrapper]": {
|
|
25
|
-
clear: "both"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
false: {
|
|
29
|
-
clear: "both"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const StyledEmbedWrapper = styled(ark.div, {}, {
|
|
35
|
-
baseComponent: true
|
|
36
|
-
});
|
|
37
|
-
export const EmbedWrapper = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
38
|
-
let {
|
|
39
|
-
noClear,
|
|
40
|
-
css: cssProp,
|
|
41
|
-
...props
|
|
42
|
-
} = _ref;
|
|
43
|
-
return /*#__PURE__*/_jsx(StyledEmbedWrapper, {
|
|
44
|
-
css: css.raw(embedWrapperRecipe.raw({
|
|
45
|
-
noClear
|
|
46
|
-
}), cssProp),
|
|
47
|
-
"data-embed-wrapper": "",
|
|
48
|
-
...props,
|
|
49
|
-
ref: ref
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1,74 +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 { useEffect, useRef } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
|
-
import { Figure } from "@ndla/primitives";
|
|
12
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
13
|
-
import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
|
|
14
|
-
import { ResourceBox } from "../ResourceBox";
|
|
15
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
const StyledFigure = styled(Figure, {
|
|
17
|
-
base: {
|
|
18
|
-
"& iframe": {
|
|
19
|
-
height: "auto",
|
|
20
|
-
width: "100%"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
const ExternalEmbed = _ref => {
|
|
25
|
-
let {
|
|
26
|
-
embed
|
|
27
|
-
} = _ref;
|
|
28
|
-
const {
|
|
29
|
-
t
|
|
30
|
-
} = useTranslation();
|
|
31
|
-
const figRef = useRef(null);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
const iframe = figRef.current?.querySelector("iframe");
|
|
34
|
-
if (iframe) {
|
|
35
|
-
const [width, height] = [Number.parseInt(iframe.width), Number.parseInt(iframe.height)];
|
|
36
|
-
iframe.style.aspectRatio = `${width ? width : 16}/${height ? height : 9}`;
|
|
37
|
-
iframe.width = "";
|
|
38
|
-
iframe.height = "";
|
|
39
|
-
}
|
|
40
|
-
}, []);
|
|
41
|
-
if (embed.status === "error") {
|
|
42
|
-
return /*#__PURE__*/_jsx(EmbedErrorPlaceholder, {
|
|
43
|
-
type: "external"
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
const {
|
|
47
|
-
embedData,
|
|
48
|
-
data
|
|
49
|
-
} = embed;
|
|
50
|
-
if (embedData.type === "fullscreen") {
|
|
51
|
-
const image = {
|
|
52
|
-
src: data.iframeImage?.image.imageUrl,
|
|
53
|
-
alt: embedData.alt !== undefined ? embedData.alt : data.iframeImage?.alttext?.alttext ?? ""
|
|
54
|
-
};
|
|
55
|
-
return /*#__PURE__*/_jsx(Figure, {
|
|
56
|
-
"data-embed-type": "external",
|
|
57
|
-
children: /*#__PURE__*/_jsx(ResourceBox, {
|
|
58
|
-
image: image,
|
|
59
|
-
title: embedData.title ?? "",
|
|
60
|
-
url: embedData.url,
|
|
61
|
-
caption: embedData.caption ?? "",
|
|
62
|
-
buttonText: t("license.other.itemImage.ariaLabel")
|
|
63
|
-
})
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return /*#__PURE__*/_jsx(StyledFigure, {
|
|
67
|
-
"data-embed-type": "external",
|
|
68
|
-
ref: figRef,
|
|
69
|
-
dangerouslySetInnerHTML: {
|
|
70
|
-
__html: data?.oembed?.html ?? ""
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
export default ExternalEmbed;
|
|
@@ -1,44 +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 { styled } from "@ndla/styled-system/jsx";
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
const StyledSup = styled("sup", {
|
|
13
|
-
base: {
|
|
14
|
-
"& a": {
|
|
15
|
-
textStyle: "label.xsmall",
|
|
16
|
-
marginInlineStart: "1"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
const FootnoteEmbed = _ref => {
|
|
21
|
-
let {
|
|
22
|
-
embed
|
|
23
|
-
} = _ref;
|
|
24
|
-
const {
|
|
25
|
-
t
|
|
26
|
-
} = useTranslation();
|
|
27
|
-
if (embed.status === "error") {
|
|
28
|
-
return /*#__PURE__*/_jsx("div", {
|
|
29
|
-
children: t("error")
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return /*#__PURE__*/_jsx("span", {
|
|
33
|
-
id: `ref${embed.data.entryNum}`,
|
|
34
|
-
"data-embed-type": "footnote",
|
|
35
|
-
children: /*#__PURE__*/_jsx(StyledSup, {
|
|
36
|
-
children: /*#__PURE__*/_jsx("a", {
|
|
37
|
-
href: `#note${embed.data.entryNum}`,
|
|
38
|
-
target: "_self",
|
|
39
|
-
children: `[${embed.data.entryNum}]`
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
export default FootnoteEmbed;
|
package/es/Embed/GlossEmbed.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2024-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 { useRef } from "react";
|
|
10
|
-
import { Portal } from "@ark-ui/react";
|
|
11
|
-
import { Figure, PopoverContent, PopoverRoot, PopoverTrigger } from "@ndla/primitives";
|
|
12
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
13
|
-
import { ConceptInlineTriggerButton } from "./ConceptInlineTriggerButton";
|
|
14
|
-
import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
|
|
15
|
-
import { Gloss } from "../Gloss";
|
|
16
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
const StyledPopoverContent = styled(PopoverContent, {
|
|
18
|
-
base: {
|
|
19
|
-
width: "surface.xlarge"
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
export const GlossEmbed = _ref => {
|
|
23
|
-
let {
|
|
24
|
-
embed
|
|
25
|
-
} = _ref;
|
|
26
|
-
const contentRef = useRef(null);
|
|
27
|
-
if (embed.status === "error" && embed.embedData.type === "inline") {
|
|
28
|
-
return /*#__PURE__*/_jsx("span", {
|
|
29
|
-
children: embed.embedData.linkText
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
if (embed.status === "error" || !embed.data.concept.glossData) {
|
|
33
|
-
return /*#__PURE__*/_jsx(EmbedErrorPlaceholder, {
|
|
34
|
-
type: "gloss"
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
const {
|
|
38
|
-
concept,
|
|
39
|
-
visualElement
|
|
40
|
-
} = embed.data;
|
|
41
|
-
const audio = visualElement?.status === "success" && visualElement.resource === "audio" ? {
|
|
42
|
-
src: visualElement.data.audioFile.url,
|
|
43
|
-
title: visualElement.data.title.title
|
|
44
|
-
} : undefined;
|
|
45
|
-
if (embed.embedData.type === "inline") {
|
|
46
|
-
return /*#__PURE__*/_jsxs(PopoverRoot, {
|
|
47
|
-
initialFocusEl: () => contentRef.current,
|
|
48
|
-
children: [/*#__PURE__*/_jsx(PopoverTrigger, {
|
|
49
|
-
asChild: true,
|
|
50
|
-
children: /*#__PURE__*/_jsx(ConceptInlineTriggerButton, {
|
|
51
|
-
children: embed.embedData.linkText
|
|
52
|
-
})
|
|
53
|
-
}), /*#__PURE__*/_jsx(Portal, {
|
|
54
|
-
children: /*#__PURE__*/_jsx(StyledPopoverContent, {
|
|
55
|
-
ref: contentRef,
|
|
56
|
-
children: /*#__PURE__*/_jsx(Figure, {
|
|
57
|
-
children: /*#__PURE__*/_jsx(Gloss, {
|
|
58
|
-
glossData: concept.glossData,
|
|
59
|
-
title: concept.title,
|
|
60
|
-
audio: audio,
|
|
61
|
-
exampleIds: embed.embedData.exampleIds,
|
|
62
|
-
exampleLangs: embed.embedData.exampleLangs
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
})]
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return /*#__PURE__*/_jsx(Figure, {
|
|
70
|
-
"data-embed-type": "gloss",
|
|
71
|
-
children: /*#__PURE__*/_jsx(Gloss, {
|
|
72
|
-
glossData: concept.glossData,
|
|
73
|
-
title: concept.title,
|
|
74
|
-
audio: audio,
|
|
75
|
-
exampleIds: embed.embedData.exampleIds,
|
|
76
|
-
exampleLangs: embed.embedData.exampleLangs,
|
|
77
|
-
variant: "bordered"
|
|
78
|
-
})
|
|
79
|
-
});
|
|
80
|
-
};
|
package/es/Embed/H5pEmbed.js
DELETED
|
@@ -1,61 +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 EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
const StyledFigure = styled(Figure, {
|
|
15
|
-
base: {
|
|
16
|
-
"& iframe": {
|
|
17
|
-
height: "auto",
|
|
18
|
-
width: "100%"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const FigureOembed = styled(Figure, {
|
|
23
|
-
base: {
|
|
24
|
-
width: "100%",
|
|
25
|
-
"& iframe": {
|
|
26
|
-
width: "100%"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
const H5pEmbed = _ref => {
|
|
31
|
-
let {
|
|
32
|
-
embed
|
|
33
|
-
} = _ref;
|
|
34
|
-
const {
|
|
35
|
-
t
|
|
36
|
-
} = useTranslation();
|
|
37
|
-
if (embed.status === "error") {
|
|
38
|
-
return /*#__PURE__*/_jsx(EmbedErrorPlaceholder, {
|
|
39
|
-
type: "h5p"
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
if (embed.data.oembed) {
|
|
43
|
-
return /*#__PURE__*/_jsx(FigureOembed, {
|
|
44
|
-
"data-embed-type": "h5p",
|
|
45
|
-
dangerouslySetInnerHTML: {
|
|
46
|
-
__html: embed.data.oembed.html ?? ""
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
const title = embed.embedData.title?.trim() ? embed.embedData.title : embed.data.h5pLicenseInformation?.h5p.title?.trim() ? embed.data.h5pLicenseInformation.h5p.title : embed.embedData.url;
|
|
51
|
-
const titleWithPrefix = `${t("embed.type.h5p")}: ${title}`;
|
|
52
|
-
return /*#__PURE__*/_jsx(StyledFigure, {
|
|
53
|
-
"data-embed-type": "h5p",
|
|
54
|
-
children: /*#__PURE__*/_jsx("iframe", {
|
|
55
|
-
title: titleWithPrefix,
|
|
56
|
-
"aria-label": titleWithPrefix,
|
|
57
|
-
src: embed.embedData.url
|
|
58
|
-
})
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
export default H5pEmbed;
|
package/es/Embed/IframeEmbed.js
DELETED
|
@@ -1,93 +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 { useEffect, useRef } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
|
-
import { Figure } from "@ndla/primitives";
|
|
12
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
13
|
-
import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
|
|
14
|
-
import { ResourceBox } from "../ResourceBox";
|
|
15
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
const StyledIframe = styled("iframe", {
|
|
17
|
-
base: {
|
|
18
|
-
width: "100%",
|
|
19
|
-
border: 0
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const StyledFigure = styled(Figure, {
|
|
23
|
-
base: {
|
|
24
|
-
clear: "both"
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
const IframeEmbed = _ref => {
|
|
28
|
-
let {
|
|
29
|
-
embed
|
|
30
|
-
} = _ref;
|
|
31
|
-
const {
|
|
32
|
-
t
|
|
33
|
-
} = useTranslation();
|
|
34
|
-
const iframeRef = useRef(null);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
const iframe = iframeRef.current;
|
|
37
|
-
if (iframe) {
|
|
38
|
-
const [width, height] = [Number.parseInt(iframe.width), Number.parseInt(iframe.height)];
|
|
39
|
-
iframe.style.aspectRatio = `${width ? width : 16}/${height ? height : 9}`;
|
|
40
|
-
iframe.width = "";
|
|
41
|
-
iframe.height = "";
|
|
42
|
-
}
|
|
43
|
-
}, []);
|
|
44
|
-
if (embed.status === "error") {
|
|
45
|
-
return /*#__PURE__*/_jsx(EmbedErrorPlaceholder, {
|
|
46
|
-
type: "external"
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
const {
|
|
50
|
-
embedData,
|
|
51
|
-
data
|
|
52
|
-
} = embed;
|
|
53
|
-
if (embedData.type === "fullscreen") {
|
|
54
|
-
const iframeImage = embed.status === "success" ? data.iframeImage : undefined;
|
|
55
|
-
const alt = embedData.alt !== undefined ? embedData.alt : iframeImage?.alttext.alttext;
|
|
56
|
-
const image = {
|
|
57
|
-
src: iframeImage?.image.imageUrl,
|
|
58
|
-
alt: alt ?? ""
|
|
59
|
-
};
|
|
60
|
-
return /*#__PURE__*/_jsx(StyledFigure, {
|
|
61
|
-
"data-embed-type": "iframe",
|
|
62
|
-
children: /*#__PURE__*/_jsx(ResourceBox, {
|
|
63
|
-
image: image,
|
|
64
|
-
title: embedData.title ?? "",
|
|
65
|
-
url: embedData.url,
|
|
66
|
-
caption: embedData.caption ?? "",
|
|
67
|
-
buttonText: t("license.other.itemImage.ariaLabel")
|
|
68
|
-
})
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
const {
|
|
72
|
-
width,
|
|
73
|
-
height,
|
|
74
|
-
url
|
|
75
|
-
} = embedData;
|
|
76
|
-
const strippedWidth = typeof width === "number" ? width : width?.replace(/\s*px/, "");
|
|
77
|
-
const strippedHeight = typeof height === "number" ? height : height?.replace(/\s*px/, "");
|
|
78
|
-
const title = `${t("embed.type.external")}: ${embedData.title?.trim() ? embedData.title : url}`;
|
|
79
|
-
return /*#__PURE__*/_jsx(StyledFigure, {
|
|
80
|
-
"data-embed-type": "iframe",
|
|
81
|
-
children: /*#__PURE__*/_jsx(StyledIframe, {
|
|
82
|
-
ref: iframeRef,
|
|
83
|
-
title: title,
|
|
84
|
-
"aria-label": title,
|
|
85
|
-
src: url,
|
|
86
|
-
width: strippedWidth,
|
|
87
|
-
height: strippedHeight,
|
|
88
|
-
allow: "fullscreen; encrypted-media",
|
|
89
|
-
loading: "lazy"
|
|
90
|
-
})
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
export default IframeEmbed;
|