@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
package/es/Grid/Grid.js
DELETED
|
@@ -1,94 +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 { styled } from "@ndla/styled-system/jsx";
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
const GridContainer = styled("div", {
|
|
12
|
-
base: {
|
|
13
|
-
display: "grid",
|
|
14
|
-
justifyContent: "center",
|
|
15
|
-
borderRadius: "xsmall",
|
|
16
|
-
gridRowGap: "large",
|
|
17
|
-
gridColumnGap: "medium",
|
|
18
|
-
width: "100%",
|
|
19
|
-
backgroundColor: "background.subtle",
|
|
20
|
-
minWidth: "surface.xxsmall",
|
|
21
|
-
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
22
|
-
"& :not(div[data-parallax-cell='true']) > div[data-embed-type='pitch']": {
|
|
23
|
-
height: "100%",
|
|
24
|
-
"& > :last-child": {
|
|
25
|
-
marginTop: "auto"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
tabletDown: {
|
|
29
|
-
gridTemplateColumns: "repeat(1, minmax(0, 1fr))"
|
|
30
|
-
},
|
|
31
|
-
tabletToDesktop: {
|
|
32
|
-
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
33
|
-
"& > div:nth-child(3):last-child": {
|
|
34
|
-
display: "flex",
|
|
35
|
-
flexFlow: "column",
|
|
36
|
-
justifyContent: "center",
|
|
37
|
-
alignItems: "center",
|
|
38
|
-
gridColumn: "span 2"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
variants: {
|
|
43
|
-
columns: {
|
|
44
|
-
"2": {},
|
|
45
|
-
"2x2": {},
|
|
46
|
-
"3": {
|
|
47
|
-
desktop: {
|
|
48
|
-
gridTemplateColumns: "repeat(3, minmax(0, 1fr))"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"4": {
|
|
52
|
-
desktop: {
|
|
53
|
-
gridTemplateColumns: "repeat(4, minmax(0, 1fr))"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
background: {
|
|
58
|
-
white: {
|
|
59
|
-
backgroundColor: "surface.default"
|
|
60
|
-
},
|
|
61
|
-
transparent: {
|
|
62
|
-
backgroundColor: "transparent"
|
|
63
|
-
},
|
|
64
|
-
gray: {
|
|
65
|
-
backgroundColor: "background.subtle"
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
border: {
|
|
69
|
-
lightBlue: {
|
|
70
|
-
padding: "xsmall",
|
|
71
|
-
border: "1px solid",
|
|
72
|
-
borderColor: "surface.brand.2"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
export const Grid = _ref => {
|
|
78
|
-
let {
|
|
79
|
-
columns,
|
|
80
|
-
border,
|
|
81
|
-
children,
|
|
82
|
-
background = "gray",
|
|
83
|
-
...rest
|
|
84
|
-
} = _ref;
|
|
85
|
-
const amountOfColumns = children?.length === 3 ? "3" : columns;
|
|
86
|
-
return /*#__PURE__*/_jsx(GridContainer, {
|
|
87
|
-
"data-embed-type": "grid",
|
|
88
|
-
border: border === "none" ? undefined : border,
|
|
89
|
-
columns: amountOfColumns,
|
|
90
|
-
background: background,
|
|
91
|
-
...rest,
|
|
92
|
-
children: children
|
|
93
|
-
});
|
|
94
|
-
};
|
|
@@ -1,32 +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 { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
const StyledGridParallaxItem = styled("div", {
|
|
12
|
-
base: {
|
|
13
|
-
position: "relative",
|
|
14
|
-
"& > div": {
|
|
15
|
-
top: "var(--masthead-height, 0px)",
|
|
16
|
-
position: "sticky"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
export const GridParallaxItem = _ref => {
|
|
21
|
-
let {
|
|
22
|
-
children,
|
|
23
|
-
...rest
|
|
24
|
-
} = _ref;
|
|
25
|
-
return /*#__PURE__*/_jsx(StyledGridParallaxItem, {
|
|
26
|
-
...rest,
|
|
27
|
-
"data-embed-type": "grid-parallax",
|
|
28
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
29
|
-
children: children
|
|
30
|
-
})
|
|
31
|
-
});
|
|
32
|
-
};
|
package/es/Grid/index.js
DELETED
|
@@ -1,10 +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
|
-
export { Grid } from "./Grid";
|
|
10
|
-
export { GridParallaxItem } from "./GridParallaxItem";
|
|
@@ -1,63 +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 parse from "html-react-parser";
|
|
10
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
const ContentWrapper = styled("div", {
|
|
13
|
-
base: {
|
|
14
|
-
display: "flex",
|
|
15
|
-
flexDirection: "column",
|
|
16
|
-
alignItems: "center",
|
|
17
|
-
justifyContent: "center",
|
|
18
|
-
gap: "xsmall",
|
|
19
|
-
"&:not(:has(> img))": {
|
|
20
|
-
paddingBlock: "xxlarge"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
const StyledImage = styled("img", {
|
|
25
|
-
base: {
|
|
26
|
-
height: "surface.3xsmall",
|
|
27
|
-
width: "surface.3xsmall",
|
|
28
|
-
borderRadius: "xsmall"
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const TitleWrapper = styled("div", {
|
|
32
|
-
base: {
|
|
33
|
-
textStyle: "heading.large",
|
|
34
|
-
textAlign: "center"
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const SubTitleWrapper = styled("div", {
|
|
38
|
-
base: {
|
|
39
|
-
textStyle: "title.medium",
|
|
40
|
-
textAlign: "center"
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
const KeyFigure = _ref => {
|
|
44
|
-
let {
|
|
45
|
-
image,
|
|
46
|
-
title,
|
|
47
|
-
subtitle
|
|
48
|
-
} = _ref;
|
|
49
|
-
return /*#__PURE__*/_jsxs(ContentWrapper, {
|
|
50
|
-
"data-embed-type": "key-figure",
|
|
51
|
-
children: [!!image && /*#__PURE__*/_jsx(StyledImage, {
|
|
52
|
-
src: `${image?.src}?width=150`,
|
|
53
|
-
width: 150,
|
|
54
|
-
height: 150,
|
|
55
|
-
alt: image?.alt
|
|
56
|
-
}), /*#__PURE__*/_jsx(TitleWrapper, {
|
|
57
|
-
children: parse(title)
|
|
58
|
-
}), /*#__PURE__*/_jsx(SubTitleWrapper, {
|
|
59
|
-
children: parse(subtitle)
|
|
60
|
-
})]
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
export default KeyFigure;
|
package/es/KeyFigure/index.js
DELETED
|
@@ -1,212 +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 { useState } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
|
-
import { AlertLine } from "@ndla/icons";
|
|
12
|
-
import { getLicenseByAbbreviation, getLicenseCredits } from "@ndla/licenses";
|
|
13
|
-
import { Button, Text } from "@ndla/primitives";
|
|
14
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
15
|
-
import { LicenseLink } from "./LicenseLink";
|
|
16
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
|
-
const BylineWrapper = styled("figcaption", {
|
|
18
|
-
base: {
|
|
19
|
-
display: "flex",
|
|
20
|
-
flexDirection: "column",
|
|
21
|
-
paddingBlock: "xsmall",
|
|
22
|
-
textStyle: "label.medium",
|
|
23
|
-
color: "text.subtle"
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
const ErrorBylineWrapper = styled(BylineWrapper, {
|
|
27
|
-
base: {
|
|
28
|
-
border: "1px solid",
|
|
29
|
-
borderColor: "stroke.error",
|
|
30
|
-
borderRadius: "xsmall",
|
|
31
|
-
background: "surface.dangerSubtle",
|
|
32
|
-
paddingInline: "medium",
|
|
33
|
-
paddingBlock: "medium"
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
const StyledText = styled(Text, {
|
|
37
|
-
base: {
|
|
38
|
-
fontStyle: "italic"
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
const ContentWrapper = styled("div", {
|
|
42
|
-
base: {
|
|
43
|
-
display: "flex",
|
|
44
|
-
gap: "xsmall",
|
|
45
|
-
alignItems: "center",
|
|
46
|
-
textStyle: "label.medium"
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
const BaseDescription = styled("div", {
|
|
50
|
-
base: {
|
|
51
|
-
display: "inline-flex",
|
|
52
|
-
whiteSpace: "pre-wrap"
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
export const EmbedByline = _ref => {
|
|
56
|
-
let {
|
|
57
|
-
type,
|
|
58
|
-
description,
|
|
59
|
-
children,
|
|
60
|
-
visibleAlt,
|
|
61
|
-
hideCopyright,
|
|
62
|
-
...props
|
|
63
|
-
} = _ref;
|
|
64
|
-
const {
|
|
65
|
-
t
|
|
66
|
-
} = useTranslation();
|
|
67
|
-
if (props.error) {
|
|
68
|
-
const typeString = type === "h5p" ? "H5P" : t(`embed.type.${type}`).toLowerCase();
|
|
69
|
-
return /*#__PURE__*/_jsx(ErrorBylineWrapper, {
|
|
70
|
-
children: /*#__PURE__*/_jsxs(ContentWrapper, {
|
|
71
|
-
children: [/*#__PURE__*/_jsx(AlertLine, {}), /*#__PURE__*/_jsx(BaseDescription, {
|
|
72
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
73
|
-
children: t("embed.embedError", {
|
|
74
|
-
type: typeString
|
|
75
|
-
})
|
|
76
|
-
})
|
|
77
|
-
})]
|
|
78
|
-
})
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
const {
|
|
82
|
-
copyright
|
|
83
|
-
} = props;
|
|
84
|
-
const hideByline = hideCopyright && !description;
|
|
85
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
86
|
-
children: [!hideByline && /*#__PURE__*/_jsx(BylineWrapper, {
|
|
87
|
-
children: /*#__PURE__*/_jsxs("div", {
|
|
88
|
-
children: [!!hideCopyright && description, !hideCopyright && /*#__PURE__*/_jsx(LicenseContainerContent, {
|
|
89
|
-
type: type,
|
|
90
|
-
copyright: copyright,
|
|
91
|
-
children: description
|
|
92
|
-
}), children]
|
|
93
|
-
})
|
|
94
|
-
}), visibleAlt ? /*#__PURE__*/_jsx(StyledText, {
|
|
95
|
-
color: "text.subtle",
|
|
96
|
-
textStyle: "label.medium",
|
|
97
|
-
asChild: true,
|
|
98
|
-
consumeCss: true,
|
|
99
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
100
|
-
children: `Alt: ${visibleAlt}`
|
|
101
|
-
})
|
|
102
|
-
}) : null]
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
const StyledDescription = styled(BaseDescription, {
|
|
106
|
-
base: {
|
|
107
|
-
mobileWideDown: {
|
|
108
|
-
display: "grid",
|
|
109
|
-
gridTemplateColumns: "1fr auto",
|
|
110
|
-
alignItems: "center",
|
|
111
|
-
overflow: "hidden",
|
|
112
|
-
_open: {
|
|
113
|
-
display: "inline"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
const TextContent = styled("span", {
|
|
119
|
-
base: {
|
|
120
|
-
mobileWideDown: {
|
|
121
|
-
whiteSpace: "nowrap",
|
|
122
|
-
maxHeight: "large",
|
|
123
|
-
overflow: "hidden",
|
|
124
|
-
textOverflow: "ellipsis",
|
|
125
|
-
transitionProperty: "max-height",
|
|
126
|
-
transitionDuration: "slow",
|
|
127
|
-
transitionTimingFunction: "ease-in",
|
|
128
|
-
marginInlineEnd: "4xsmall",
|
|
129
|
-
_open: {
|
|
130
|
-
whiteSpace: "pre-wrap",
|
|
131
|
-
maxHeight: "none"
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
const StyledButton = styled(Button, {
|
|
137
|
-
base: {
|
|
138
|
-
mobileWide: {
|
|
139
|
-
display: "none"
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
const LicenseDescription = _ref2 => {
|
|
144
|
-
let {
|
|
145
|
-
children,
|
|
146
|
-
isOpen,
|
|
147
|
-
setIsOpen
|
|
148
|
-
} = _ref2;
|
|
149
|
-
const open = isOpen ? {
|
|
150
|
-
"data-open": ""
|
|
151
|
-
} : {};
|
|
152
|
-
const {
|
|
153
|
-
t
|
|
154
|
-
} = useTranslation();
|
|
155
|
-
const handleToggle = () => {
|
|
156
|
-
setIsOpen(!isOpen);
|
|
157
|
-
};
|
|
158
|
-
return /*#__PURE__*/_jsx(ContentWrapper, {
|
|
159
|
-
children: /*#__PURE__*/_jsxs(StyledDescription, {
|
|
160
|
-
...open,
|
|
161
|
-
children: [/*#__PURE__*/_jsx(TextContent, {
|
|
162
|
-
...open,
|
|
163
|
-
children: children
|
|
164
|
-
}), /*#__PURE__*/_jsx(StyledButton, {
|
|
165
|
-
variant: "link",
|
|
166
|
-
size: "small",
|
|
167
|
-
onClick: handleToggle,
|
|
168
|
-
children: isOpen ? `${t("audio.readLessDescriptionLabel")}` : `${t("audio.readMoreDescriptionLabel")}`
|
|
169
|
-
})]
|
|
170
|
-
})
|
|
171
|
-
});
|
|
172
|
-
};
|
|
173
|
-
export const LicenseContainerContent = _ref3 => {
|
|
174
|
-
let {
|
|
175
|
-
children,
|
|
176
|
-
copyright,
|
|
177
|
-
type
|
|
178
|
-
} = _ref3;
|
|
179
|
-
const {
|
|
180
|
-
t,
|
|
181
|
-
i18n
|
|
182
|
-
} = useTranslation();
|
|
183
|
-
const license = copyright ? getLicenseByAbbreviation(copyright.license?.license ?? "", i18n.language) : undefined;
|
|
184
|
-
const authors = getLicenseCredits(copyright);
|
|
185
|
-
const captionAuthors = Object.values(authors).find(i => i.length > 0) ?? [];
|
|
186
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
187
|
-
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
188
|
-
children: [children, ` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`, /*#__PURE__*/_jsx("span", {
|
|
189
|
-
children: captionAuthors.map(author => author.name).join(", ")
|
|
190
|
-
}), license ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
191
|
-
children: [" / ", /*#__PURE__*/_jsx(LicenseLink, {
|
|
192
|
-
license: license,
|
|
193
|
-
hideLink: !isOpen && !!children
|
|
194
|
-
})]
|
|
195
|
-
}) : null]
|
|
196
|
-
});
|
|
197
|
-
if (children) {
|
|
198
|
-
return /*#__PURE__*/_jsx(LicenseDescription, {
|
|
199
|
-
isOpen: isOpen,
|
|
200
|
-
setIsOpen: setIsOpen,
|
|
201
|
-
children: content
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
return /*#__PURE__*/_jsx(Text, {
|
|
205
|
-
textStyle: "label.medium",
|
|
206
|
-
asChild: true,
|
|
207
|
-
consumeCss: true,
|
|
208
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
209
|
-
children: content
|
|
210
|
-
})
|
|
211
|
-
});
|
|
212
|
-
};
|
|
@@ -1,56 +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 { forwardRef } from "react";
|
|
10
|
-
import { SafeLink } from "@ndla/safelink";
|
|
11
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
const StyledSafeLink = styled(SafeLink, {
|
|
14
|
-
base: {
|
|
15
|
-
color: "text.link",
|
|
16
|
-
textDecoration: "underline",
|
|
17
|
-
whiteSpace: "nowrap",
|
|
18
|
-
_hover: {
|
|
19
|
-
textDecoration: "none"
|
|
20
|
-
},
|
|
21
|
-
_focusWithin: {
|
|
22
|
-
textDecoration: "none"
|
|
23
|
-
},
|
|
24
|
-
mobileWideDown: {
|
|
25
|
-
_disabled: {
|
|
26
|
-
display: "none"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
export const LicenseLink = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
32
|
-
let {
|
|
33
|
-
license,
|
|
34
|
-
hideLink,
|
|
35
|
-
...rest
|
|
36
|
-
} = _ref;
|
|
37
|
-
const disabled = hideLink ? {
|
|
38
|
-
"data-disabled": ""
|
|
39
|
-
} : {};
|
|
40
|
-
if (license.abbreviation === "unknown") {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
if (license.url?.length) {
|
|
44
|
-
return /*#__PURE__*/_jsx(StyledSafeLink, {
|
|
45
|
-
to: license.url,
|
|
46
|
-
rel: "license",
|
|
47
|
-
...disabled,
|
|
48
|
-
...rest,
|
|
49
|
-
ref: ref,
|
|
50
|
-
children: license.abbreviation
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return /*#__PURE__*/_jsx("span", {
|
|
54
|
-
children: license.abbreviation
|
|
55
|
-
});
|
|
56
|
-
});
|
|
@@ -1,10 +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
|
-
export { EmbedByline } from "./EmbedByline";
|
|
10
|
-
export { LicenseLink } from "./LicenseLink";
|
|
@@ -1,103 +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 parse from "html-react-parser";
|
|
10
|
-
import { useMemo } from "react";
|
|
11
|
-
import { ArrowRightLine, CalendarLine } from "@ndla/icons";
|
|
12
|
-
import { Heading } from "@ndla/primitives";
|
|
13
|
-
import { SafeLink } from "@ndla/safelink";
|
|
14
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
15
|
-
import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
|
|
16
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
const InfoWrapper = styled("div", {
|
|
18
|
-
base: {
|
|
19
|
-
display: "flex",
|
|
20
|
-
flexDirection: "column",
|
|
21
|
-
gap: "xsmall"
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
const StyledSafeLink = styled(SafeLink, {
|
|
25
|
-
base: {
|
|
26
|
-
display: "flex",
|
|
27
|
-
justifyContent: "space-between",
|
|
28
|
-
alignItems: "center",
|
|
29
|
-
background: "surface.default",
|
|
30
|
-
padding: "medium",
|
|
31
|
-
border: "1px solid",
|
|
32
|
-
borderColor: "stroke.subtle",
|
|
33
|
-
borderRadius: "xsmall",
|
|
34
|
-
"& h3": {
|
|
35
|
-
textDecoration: "underline"
|
|
36
|
-
},
|
|
37
|
-
"& [data-forward]": {
|
|
38
|
-
transitionProperty: "width, height",
|
|
39
|
-
transitionTimingFunction: "ease-in-out",
|
|
40
|
-
transitionDuration: "fast"
|
|
41
|
-
},
|
|
42
|
-
_hover: {
|
|
43
|
-
"& h3": {
|
|
44
|
-
textDecoration: "none"
|
|
45
|
-
},
|
|
46
|
-
"& [data-forward]": {
|
|
47
|
-
width: "large",
|
|
48
|
-
height: "large"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
const StyledDateContainer = styled("div", {
|
|
54
|
-
base: {
|
|
55
|
-
display: "flex",
|
|
56
|
-
alignItems: "center",
|
|
57
|
-
gap: "xxsmall"
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
const StyledCalendarEd = styled(CalendarLine, {
|
|
61
|
-
base: {
|
|
62
|
-
color: "icon.strong"
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
const LinkBlock = _ref => {
|
|
66
|
-
let {
|
|
67
|
-
title,
|
|
68
|
-
articleLanguage,
|
|
69
|
-
date,
|
|
70
|
-
url,
|
|
71
|
-
path
|
|
72
|
-
} = _ref;
|
|
73
|
-
const href = getPossiblyRelativeUrl(url, path);
|
|
74
|
-
const formattedDate = useMemo(() => {
|
|
75
|
-
if (!date) return null;
|
|
76
|
-
return new Intl.DateTimeFormat(articleLanguage, {
|
|
77
|
-
timeZone: "CET",
|
|
78
|
-
day: "2-digit",
|
|
79
|
-
month: "long",
|
|
80
|
-
year: "numeric"
|
|
81
|
-
}).format(new Date(date));
|
|
82
|
-
}, [date, articleLanguage]);
|
|
83
|
-
return /*#__PURE__*/_jsxs(StyledSafeLink, {
|
|
84
|
-
to: href,
|
|
85
|
-
"data-embed-type": "link-block",
|
|
86
|
-
children: [/*#__PURE__*/_jsxs(InfoWrapper, {
|
|
87
|
-
children: [/*#__PURE__*/_jsx(Heading, {
|
|
88
|
-
asChild: true,
|
|
89
|
-
consumeCss: true,
|
|
90
|
-
textStyle: "title.medium",
|
|
91
|
-
children: /*#__PURE__*/_jsx("h3", {
|
|
92
|
-
"data-heading": true,
|
|
93
|
-
children: parse(title)
|
|
94
|
-
})
|
|
95
|
-
}), !!date && /*#__PURE__*/_jsxs(StyledDateContainer, {
|
|
96
|
-
children: [/*#__PURE__*/_jsx(StyledCalendarEd, {}), formattedDate]
|
|
97
|
-
})]
|
|
98
|
-
}), /*#__PURE__*/_jsx(ArrowRightLine, {
|
|
99
|
-
"data-forward": true
|
|
100
|
-
})]
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
export default LinkBlock;
|
|
@@ -1,35 +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 { Children } from "react";
|
|
10
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
const StyledList = styled("ul", {
|
|
13
|
-
base: {
|
|
14
|
-
display: "flex",
|
|
15
|
-
flexDirection: "column",
|
|
16
|
-
gap: "xsmall",
|
|
17
|
-
listStyle: "none"
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
const LinkBlockSection = _ref => {
|
|
21
|
-
let {
|
|
22
|
-
children,
|
|
23
|
-
...rest
|
|
24
|
-
} = _ref;
|
|
25
|
-
return /*#__PURE__*/_jsx("nav", {
|
|
26
|
-
...rest,
|
|
27
|
-
"data-embed-type": "link-block-list",
|
|
28
|
-
children: /*#__PURE__*/_jsx(StyledList, {
|
|
29
|
-
children: Children.map(children, child => /*#__PURE__*/_jsx("li", {
|
|
30
|
-
children: child
|
|
31
|
-
}))
|
|
32
|
-
})
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
export default LinkBlockSection;
|
package/es/LinkBlock/index.js
DELETED
|
@@ -1,10 +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
|
-
export { default as LinkBlock } from "./LinkBlock";
|
|
10
|
-
export { default as LinkBlockSection } from "./LinkBlockSection";
|