@ndla/ui 56.0.18-alpha.0 → 56.0.20-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/panda.buildinfo.json +10 -8
- package/dist/styles.css +35 -29
- package/es/Article/Article.js +3 -3
- package/es/Article/ArticleByline.js +5 -4
- package/es/Article/index.js +1 -2
- package/es/AudioPlayer/AudioPlayer.js +1 -1
- package/es/CampaignBlock/CampaignBlock.js +25 -13
- package/es/Concept/Concept.js +7 -1
- package/es/ContactBlock/ContactBlock.js +0 -1
- package/es/ContentTypeBadge/ContentTypeBadgeNew.js +0 -3
- package/es/ContentTypeHero/ContentTypeHero.js +2 -8
- package/es/Embed/AudioEmbed.js +3 -0
- package/es/Embed/BrightcoveEmbed.js +5 -1
- package/es/Embed/ConceptEmbed.js +23 -11
- package/es/Embed/ConceptListEmbed.js +2 -1
- package/es/Embed/ImageEmbed.js +3 -0
- package/es/Embed/index.js +1 -0
- package/es/FileList/FileList.js +5 -1
- package/es/FileList/PdfFile.js +6 -1
- package/es/FileList/index.js +1 -1
- package/es/Grid/Grid.js +0 -1
- package/es/LicenseByline/EmbedByline.js +4 -1
- package/es/TreeStructure/TreeStructure.js +0 -2
- package/es/i18n/index.js +1 -1
- package/es/i18n/useComponentTranslations.js +62 -0
- package/es/index.js +7 -5
- package/es/locale/messages-en.js +31 -5
- package/es/locale/messages-nb.js +31 -5
- package/es/locale/messages-nn.js +79 -53
- package/es/locale/messages-se.js +31 -5
- package/es/locale/messages-sma.js +31 -5
- package/es/styles.css +35 -29
- package/es/utils/licenseAttributes.js +18 -0
- package/lib/Article/Article.js +3 -3
- package/lib/Article/ArticleByline.js +5 -4
- package/lib/Article/index.d.ts +0 -1
- package/lib/Article/index.js +1 -8
- package/lib/AudioPlayer/AudioPlayer.js +1 -1
- package/lib/CampaignBlock/CampaignBlock.js +25 -13
- package/lib/Concept/Concept.d.ts +2 -0
- package/lib/Concept/Concept.js +7 -1
- package/lib/ContactBlock/ContactBlock.js +0 -1
- package/lib/ContentTypeBadge/ContentTypeBadgeNew.js +0 -3
- package/lib/ContentTypeHero/ContentTypeHero.js +2 -7
- package/lib/Embed/AudioEmbed.js +3 -0
- package/lib/Embed/BrightcoveEmbed.d.ts +2 -1
- package/lib/Embed/BrightcoveEmbed.js +5 -1
- package/lib/Embed/ConceptEmbed.d.ts +3 -1
- package/lib/Embed/ConceptEmbed.js +23 -11
- package/lib/Embed/ConceptListEmbed.js +2 -1
- package/lib/Embed/ImageEmbed.js +3 -0
- package/lib/Embed/index.d.ts +1 -0
- package/lib/Embed/index.js +7 -0
- package/lib/FileList/FileList.d.ts +3 -1
- package/lib/FileList/FileList.js +5 -1
- package/lib/FileList/PdfFile.js +6 -1
- package/lib/FileList/index.d.ts +1 -1
- package/lib/FileList/index.js +6 -0
- package/lib/Grid/Grid.js +0 -1
- package/lib/LicenseByline/EmbedByline.js +4 -1
- package/lib/TreeStructure/TreeStructure.js +0 -2
- package/lib/i18n/index.d.ts +1 -1
- package/lib/i18n/index.js +12 -0
- package/lib/i18n/useComponentTranslations.d.ts +31 -0
- package/lib/i18n/useComponentTranslations.js +65 -2
- package/lib/index.d.ts +6 -4
- package/lib/index.js +38 -6
- package/lib/locale/messages-en.d.ts +26 -0
- package/lib/locale/messages-en.js +31 -5
- package/lib/locale/messages-nb.d.ts +26 -0
- package/lib/locale/messages-nb.js +31 -5
- package/lib/locale/messages-nn.d.ts +26 -0
- package/lib/locale/messages-nn.js +79 -53
- package/lib/locale/messages-se.d.ts +26 -0
- package/lib/locale/messages-se.js +31 -5
- package/lib/locale/messages-sma.d.ts +26 -0
- package/lib/locale/messages-sma.js +31 -5
- package/lib/styles.css +35 -29
- package/lib/utils/licenseAttributes.d.ts +16 -0
- package/lib/utils/licenseAttributes.js +25 -0
- package/package.json +8 -8
- package/src/Article/Article.tsx +7 -6
- package/src/Article/ArticleByline.tsx +2 -3
- package/src/Article/index.ts +0 -2
- package/src/AudioPlayer/AudioPlayer.tsx +5 -3
- package/src/CampaignBlock/CampaignBlock.tsx +23 -12
- package/src/Concept/Concept.tsx +8 -3
- package/src/ContactBlock/ContactBlock.tsx +0 -1
- package/src/ContentTypeBadge/ContentTypeBadgeNew.tsx +0 -3
- package/src/ContentTypeHero/ContentTypeHero.tsx +2 -7
- package/src/Embed/AudioEmbed.tsx +4 -1
- package/src/Embed/BrightcoveEmbed.tsx +6 -3
- package/src/Embed/ConceptEmbed.tsx +21 -11
- package/src/Embed/ConceptListEmbed.tsx +1 -0
- package/src/Embed/ImageEmbed.tsx +4 -0
- package/src/Embed/index.ts +1 -0
- package/src/FileList/FileList.tsx +16 -10
- package/src/FileList/PdfFile.tsx +8 -2
- package/src/FileList/index.ts +1 -1
- package/src/Grid/Grid.tsx +0 -1
- package/src/LicenseByline/EmbedByline.tsx +2 -1
- package/src/TreeStructure/TreeStructure.tsx +0 -1
- package/src/i18n/index.ts +2 -0
- package/src/i18n/useComponentTranslations.ts +79 -0
- package/src/index.ts +8 -2
- package/src/locale/messages-en.ts +30 -3
- package/src/locale/messages-nb.ts +30 -3
- package/src/locale/messages-nn.ts +78 -51
- package/src/locale/messages-se.ts +30 -3
- package/src/locale/messages-sma.ts +30 -3
- package/src/utils/licenseAttributes.ts +23 -0
- package/es/Article/ArticleParagraph.js +0 -23
- package/lib/Article/ArticleParagraph.d.ts +0 -13
- package/lib/Article/ArticleParagraph.js +0 -30
- package/src/Article/ArticleParagraph.tsx +0 -27
package/lib/Article/Article.js
CHANGED
|
@@ -39,7 +39,6 @@ const StyledArticleWrapper = (0, _jsx2.styled)(_react2.ark.article, {
|
|
|
39
39
|
background: "background.default",
|
|
40
40
|
display: "flex",
|
|
41
41
|
flexDirection: "column",
|
|
42
|
-
gap: "xxlarge",
|
|
43
42
|
color: "text.default",
|
|
44
43
|
alignItems: "center",
|
|
45
44
|
width: "100%",
|
|
@@ -118,7 +117,7 @@ const ArticleTitle = _ref2 => {
|
|
|
118
117
|
} = _ref2;
|
|
119
118
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ArticleHeader, {
|
|
120
119
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(ArticleHGroup, {
|
|
121
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledStack, {
|
|
120
|
+
children: [(!!contentType || !!heartButton) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledStack, {
|
|
122
121
|
justify: "space-between",
|
|
123
122
|
align: "center",
|
|
124
123
|
direction: "row",
|
|
@@ -127,9 +126,10 @@ const ArticleTitle = _ref2 => {
|
|
|
127
126
|
contentType: contentType
|
|
128
127
|
}), heartButton]
|
|
129
128
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Heading, {
|
|
130
|
-
textStyle: "heading.
|
|
129
|
+
textStyle: "heading.medium",
|
|
131
130
|
id: id,
|
|
132
131
|
lang: lang,
|
|
132
|
+
property: "dct:title",
|
|
133
133
|
children: title
|
|
134
134
|
})]
|
|
135
135
|
}), !!introduction && /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
|
|
@@ -31,9 +31,6 @@ const Wrapper = (0, _jsx2.styled)("div", {
|
|
|
31
31
|
borderColor: "stroke.subtle"
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
|
|
35
|
-
// TODO: This is designed with 24px of inline padding. If you do this, most bylines will break into two lines.
|
|
36
|
-
// Should reconsider.
|
|
37
34
|
const TextWrapper = (0, _jsx2.styled)("div", {
|
|
38
35
|
base: {
|
|
39
36
|
display: "flex",
|
|
@@ -136,7 +133,11 @@ const ArticleByline = _ref => {
|
|
|
136
133
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(LicenseWrapper, {
|
|
137
134
|
children: [license && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LicenseLink.LicenseLink, {
|
|
138
135
|
license: license
|
|
139
|
-
}), showPrimaryContributors &&
|
|
136
|
+
}), showPrimaryContributors &&
|
|
137
|
+
/*#__PURE__*/
|
|
138
|
+
//eslint-disable-next-line react/no-unknown-property
|
|
139
|
+
(0, _jsxRuntime.jsxs)("span", {
|
|
140
|
+
property: "cc:attributionName",
|
|
140
141
|
children: [authors.length > 0 && `${t("article.authorsLabel", {
|
|
141
142
|
names: renderContributors(authors, t),
|
|
142
143
|
interpolation: {
|
package/lib/Article/index.d.ts
CHANGED
|
@@ -8,4 +8,3 @@
|
|
|
8
8
|
export { Article, ArticleWrapper, ArticleHeader, ArticleFooter, ArticleTitle, ArticleHGroup, ArticleContent, } from "./Article";
|
|
9
9
|
export { ArticleByline, ArticleBylineAccordionItem } from "./ArticleByline";
|
|
10
10
|
export { ArticleFootNotes } from "./ArticleFootNotes";
|
|
11
|
-
export { ArticleParagraph } from "./ArticleParagraph";
|
package/lib/Article/index.js
CHANGED
|
@@ -51,12 +51,6 @@ Object.defineProperty(exports, "ArticleHeader", {
|
|
|
51
51
|
return _Article.ArticleHeader;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
Object.defineProperty(exports, "ArticleParagraph", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _ArticleParagraph.ArticleParagraph;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
54
|
Object.defineProperty(exports, "ArticleTitle", {
|
|
61
55
|
enumerable: true,
|
|
62
56
|
get: function () {
|
|
@@ -71,5 +65,4 @@ Object.defineProperty(exports, "ArticleWrapper", {
|
|
|
71
65
|
});
|
|
72
66
|
var _Article = require("./Article");
|
|
73
67
|
var _ArticleByline = require("./ArticleByline");
|
|
74
|
-
var _ArticleFootNotes = require("./ArticleFootNotes");
|
|
75
|
-
var _ArticleParagraph = require("./ArticleParagraph");
|
|
68
|
+
var _ArticleFootNotes = require("./ArticleFootNotes");
|
|
@@ -180,7 +180,7 @@ const AudioPlayer = _ref => {
|
|
|
180
180
|
}), !!textVersion && !img && textVersionButton]
|
|
181
181
|
}), description && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Text, {
|
|
182
182
|
textStyle: "body.medium",
|
|
183
|
-
children: [showFullDescription || description.length < DESCRIPTION_MAX_LENGTH ? description : `${truncatedDescription}...`, /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Button, {
|
|
183
|
+
children: [showFullDescription || description.length < DESCRIPTION_MAX_LENGTH ? description : `${truncatedDescription}...`, description.length > DESCRIPTION_MAX_LENGTH && /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Button, {
|
|
184
184
|
variant: "link",
|
|
185
185
|
onClick: () => setShowFullDescription(p => !p),
|
|
186
186
|
children: t(`audio.${showFullDescription ? "readLessDescriptionLabel" : "readMoreDescriptionLabel"}`)
|
|
@@ -22,20 +22,32 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
22
22
|
|
|
23
23
|
const Container = (0, _jsx2.styled)("div", {
|
|
24
24
|
base: {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
display: "grid",
|
|
26
|
+
gridTemplateColumns: "1fr",
|
|
27
27
|
gap: "medium",
|
|
28
|
-
flexDirection: "column",
|
|
29
28
|
border: "1px solid",
|
|
30
29
|
borderColor: "stroke.default",
|
|
31
30
|
backgroundColor: "background.default",
|
|
32
31
|
borderRadius: "xsmall",
|
|
33
32
|
boxShadow: "full",
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
overflow: "hidden"
|
|
34
|
+
},
|
|
35
|
+
variants: {
|
|
36
|
+
imageSide: {
|
|
37
|
+
left: {
|
|
38
|
+
tabletWide: {
|
|
39
|
+
gridTemplateColumns: "minmax(230px, 455px) auto" //required for campaign block in myNdla
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
right: {
|
|
43
|
+
tabletWide: {
|
|
44
|
+
gridTemplateColumns: "auto minmax(230px, 455px)" //required for campaign block in myNdla
|
|
45
|
+
}
|
|
46
|
+
}
|
|
38
47
|
}
|
|
48
|
+
},
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
imageSide: "left"
|
|
39
51
|
}
|
|
40
52
|
});
|
|
41
53
|
const LinkText = (0, _jsx2.styled)(_primitives.Text, {
|
|
@@ -61,29 +73,28 @@ const LinkHeader = (0, _jsx2.styled)(_primitives.Text, {
|
|
|
61
73
|
});
|
|
62
74
|
const StyledImg = (0, _jsx2.styled)("img", {
|
|
63
75
|
base: {
|
|
64
|
-
alignSelf: "center",
|
|
65
76
|
objectFit: "cover",
|
|
66
77
|
width: "100%",
|
|
67
78
|
height: "215px",
|
|
68
|
-
|
|
69
|
-
height: "
|
|
79
|
+
tablet: {
|
|
80
|
+
height: "265px"
|
|
70
81
|
},
|
|
71
82
|
tabletWide: {
|
|
72
|
-
|
|
83
|
+
height: "340px"
|
|
73
84
|
}
|
|
74
85
|
}
|
|
75
86
|
});
|
|
76
87
|
const ContentWrapper = (0, _jsx2.styled)("div", {
|
|
77
88
|
base: {
|
|
78
89
|
width: "100%",
|
|
79
|
-
position: "relative",
|
|
80
90
|
display: "flex",
|
|
81
91
|
flexDirection: "column",
|
|
82
92
|
gap: "medium",
|
|
83
93
|
alignItems: "flex-start",
|
|
84
94
|
justifyContent: "center",
|
|
85
95
|
paddingBlock: "medium",
|
|
86
|
-
paddingInline: "medium"
|
|
96
|
+
paddingInline: "medium",
|
|
97
|
+
minWidth: "270px" //required for campaign block in myNdla
|
|
87
98
|
}
|
|
88
99
|
});
|
|
89
100
|
const StyledText = (0, _jsx2.styled)(_primitives.Text, {
|
|
@@ -135,6 +146,7 @@ const CampaignBlock = _ref2 => {
|
|
|
135
146
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
136
147
|
className: className,
|
|
137
148
|
"data-embed-type": "campaign-block",
|
|
149
|
+
imageSide: imageSide,
|
|
138
150
|
children: [imageSide === "left" && imageComponent, /*#__PURE__*/(0, _jsxRuntime.jsxs)(ContentWrapper, {
|
|
139
151
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(MaybeLinkText, {
|
|
140
152
|
url: url?.url,
|
package/lib/Concept/Concept.d.ts
CHANGED
|
@@ -14,5 +14,7 @@ export interface ConceptProps extends ComponentPropsWithRef<"figure"> {
|
|
|
14
14
|
lang?: string;
|
|
15
15
|
title?: string;
|
|
16
16
|
children?: ReactNode;
|
|
17
|
+
source?: string;
|
|
18
|
+
previewAlt?: boolean;
|
|
17
19
|
}
|
|
18
20
|
export declare const Concept: import("react").ForwardRefExoticComponent<Omit<ConceptProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
package/lib/Concept/Concept.js
CHANGED
|
@@ -9,6 +9,7 @@ var _primitives = require("@ndla/primitives");
|
|
|
9
9
|
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
10
10
|
var _Embed = require("../Embed");
|
|
11
11
|
var _EmbedByline = require("../LicenseByline/EmbedByline");
|
|
12
|
+
var _licenseAttributes = require("../utils/licenseAttributes");
|
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
14
|
/**
|
|
14
15
|
* Copyright (c) 2024-present, NDLA.
|
|
@@ -44,11 +45,15 @@ const Concept = exports.Concept = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref
|
|
|
44
45
|
lang,
|
|
45
46
|
children,
|
|
46
47
|
title,
|
|
48
|
+
source,
|
|
49
|
+
previewAlt,
|
|
47
50
|
...rest
|
|
48
51
|
} = _ref;
|
|
52
|
+
const licenseProps = (0, _licenseAttributes.licenseAttributes)(copyright?.license?.license, lang, source);
|
|
49
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledFigure, {
|
|
50
54
|
ref: ref,
|
|
51
55
|
...rest,
|
|
56
|
+
...licenseProps,
|
|
52
57
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(ContentWrapper, {
|
|
53
58
|
lang: lang,
|
|
54
59
|
children: [!!title && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -58,7 +63,8 @@ const Concept = exports.Concept = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref
|
|
|
58
63
|
}), children]
|
|
59
64
|
}), visualElement?.resource === "image" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Embed.ImageEmbed, {
|
|
60
65
|
embed: visualElement,
|
|
61
|
-
lang: lang
|
|
66
|
+
lang: lang,
|
|
67
|
+
previewAlt: previewAlt
|
|
62
68
|
}) : visualElement?.resource === "brightcove" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Embed.BrightcoveEmbed, {
|
|
63
69
|
embed: visualElement
|
|
64
70
|
}) : visualElement?.resource === "h5p" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Embed.H5pEmbed, {
|
|
@@ -27,12 +27,9 @@ const contentTypeToBadgeVariantMap = exports.contentTypeToBadgeVariantMap = {
|
|
|
27
27
|
[contentTypes.SOURCE_MATERIAL]: "brand1",
|
|
28
28
|
[contentTypes.LEARNING_PATH]: "brand3",
|
|
29
29
|
[contentTypes.TOPIC]: "neutral",
|
|
30
|
-
// TODO: Verify this color
|
|
31
30
|
[contentTypes.MULTIDISCIPLINARY]: "neutral",
|
|
32
31
|
[contentTypes.CONCEPT]: "brand1",
|
|
33
|
-
// TODO: Verify this color
|
|
34
32
|
[contentTypes.EXTERNAL]: "brand2",
|
|
35
|
-
// TODO: Verify resourceEmbedTypeMapping colors
|
|
36
33
|
[contentTypes.IMAGE]: "brand1",
|
|
37
34
|
[contentTypes.AUDIO]: "brand1",
|
|
38
35
|
[contentTypes.PODCAST]: "brand1",
|
|
@@ -18,23 +18,18 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
// TODO: Figure out what to do with frontpage articles. If anything...
|
|
22
|
-
// Also, verify all of these colors.
|
|
23
21
|
const contentTypeToHeroMap = exports.contentTypeToHeroMap = {
|
|
24
22
|
[contentTypes.SUBJECT_MATERIAL]: "primary",
|
|
25
|
-
[contentTypes.TASKS_AND_ACTIVITIES]: "
|
|
23
|
+
[contentTypes.TASKS_AND_ACTIVITIES]: "brand2Bold",
|
|
26
24
|
[contentTypes.ASSESSMENT_RESOURCES]: "brand2",
|
|
27
25
|
// This will never happen
|
|
28
26
|
[contentTypes.SUBJECT]: "primary",
|
|
29
27
|
[contentTypes.SOURCE_MATERIAL]: "brand1",
|
|
30
28
|
// This will never happen
|
|
31
29
|
[contentTypes.LEARNING_PATH]: "primary",
|
|
32
|
-
// TODO: This needs a color
|
|
33
30
|
[contentTypes.TOPIC]: "neutral",
|
|
34
|
-
|
|
35
|
-
[contentTypes.MULTIDISCIPLINARY]: "brand4",
|
|
31
|
+
[contentTypes.MULTIDISCIPLINARY]: "primary",
|
|
36
32
|
[contentTypes.CONCEPT]: "brand1Subtle",
|
|
37
|
-
// TODO: No clue what this'll be. Maybe unused?
|
|
38
33
|
[contentTypes.EXTERNAL]: "primary",
|
|
39
34
|
[contentTypes.IMAGE]: "primary",
|
|
40
35
|
[contentTypes.AUDIO]: "primary",
|
package/lib/Embed/AudioEmbed.js
CHANGED
|
@@ -8,6 +8,7 @@ var _primitives = require("@ndla/primitives");
|
|
|
8
8
|
var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
|
|
9
9
|
var _AudioPlayer = _interopRequireDefault(require("../AudioPlayer"));
|
|
10
10
|
var _LicenseByline = require("../LicenseByline");
|
|
11
|
+
var _licenseAttributes = require("../utils/licenseAttributes");
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
/**
|
|
@@ -51,9 +52,11 @@ const AudioEmbed = _ref => {
|
|
|
51
52
|
url: coverPhoto.url,
|
|
52
53
|
alt: coverPhoto.altText
|
|
53
54
|
};
|
|
55
|
+
const licenseProps = (0, _licenseAttributes.licenseAttributes)(data.copyright.license.license, lang, embedData.url);
|
|
54
56
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Figure, {
|
|
55
57
|
lang: lang,
|
|
56
58
|
"data-embed-type": type,
|
|
59
|
+
...licenseProps,
|
|
57
60
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AudioPlayer.default, {
|
|
58
61
|
description: data.podcastMeta?.introduction ?? "",
|
|
59
62
|
img: img,
|
|
@@ -10,8 +10,9 @@ import { RenderContext } from "./types";
|
|
|
10
10
|
interface Props {
|
|
11
11
|
embed: BrightcoveMetaData;
|
|
12
12
|
renderContext?: RenderContext;
|
|
13
|
+
lang?: string;
|
|
13
14
|
}
|
|
14
15
|
export declare const makeIframeString: (url: string, width: string | number, height: string | number, title?: string) => string;
|
|
15
16
|
export declare const isNumeric: (value: any) => boolean;
|
|
16
|
-
declare const BrightcoveEmbed: ({ embed, renderContext }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare const BrightcoveEmbed: ({ embed, renderContext, lang }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
export default BrightcoveEmbed;
|
|
@@ -11,6 +11,7 @@ var _primitives = require("@ndla/primitives");
|
|
|
11
11
|
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
12
12
|
var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
|
|
13
13
|
var _LicenseByline = require("../LicenseByline");
|
|
14
|
+
var _licenseAttributes = require("../utils/licenseAttributes");
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
17
|
/**
|
|
@@ -58,7 +59,8 @@ const getIframeProps = (data, sources) => {
|
|
|
58
59
|
const BrightcoveEmbed = _ref => {
|
|
59
60
|
let {
|
|
60
61
|
embed,
|
|
61
|
-
renderContext = "article"
|
|
62
|
+
renderContext = "article",
|
|
63
|
+
lang
|
|
62
64
|
} = _ref;
|
|
63
65
|
const [showOriginalVideo, setShowOriginalVideo] = (0, _react.useState)(true);
|
|
64
66
|
const {
|
|
@@ -107,8 +109,10 @@ const BrightcoveEmbed = _ref => {
|
|
|
107
109
|
...embedData,
|
|
108
110
|
videoid: linkedVideoId
|
|
109
111
|
}, data.sources) : undefined;
|
|
112
|
+
const licenseProps = (0, _licenseAttributes.licenseAttributes)(data?.copyright?.license.license, lang, embedData.pageUrl);
|
|
110
113
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Figure, {
|
|
111
114
|
"data-embed-type": "brightcove",
|
|
115
|
+
...licenseProps,
|
|
112
116
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
113
117
|
className: "brightcove-video",
|
|
114
118
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(BrightcoveIframe, {
|
|
@@ -12,13 +12,15 @@ import { ConceptProps } from "../Concept/Concept";
|
|
|
12
12
|
interface BaseProps {
|
|
13
13
|
renderContext?: RenderContext;
|
|
14
14
|
lang?: string;
|
|
15
|
+
previewAlt?: boolean;
|
|
15
16
|
}
|
|
16
17
|
interface Props extends BaseProps {
|
|
17
18
|
embed: ConceptMetaData;
|
|
18
19
|
}
|
|
19
|
-
export declare const ConceptEmbed: ({ embed, renderContext, lang }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const ConceptEmbed: ({ embed, renderContext, lang, previewAlt }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
21
|
export interface InlineConceptProps extends ConceptProps, BaseProps {
|
|
21
22
|
linkText?: string;
|
|
23
|
+
source?: string;
|
|
22
24
|
}
|
|
23
25
|
export declare const InlineConcept: import("react").ForwardRefExoticComponent<Omit<InlineConceptProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
24
26
|
export interface BlockConceptProps extends ConceptProps {
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.InlineConcept = exports.ConceptEmbed = exports.BlockConcept = void 0;
|
|
7
7
|
var _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
|
|
8
8
|
var _react = require("react");
|
|
9
|
+
var _react2 = require("@ark-ui/react");
|
|
9
10
|
var _primitives = require("@ndla/primitives");
|
|
10
11
|
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
11
12
|
var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
|
|
@@ -24,14 +25,17 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
24
25
|
|
|
25
26
|
const StyledPopoverContent = (0, _jsx2.styled)(_primitives.PopoverContent, {
|
|
26
27
|
base: {
|
|
27
|
-
width: "surface.xlarge"
|
|
28
|
+
width: "surface.xlarge",
|
|
29
|
+
maxHeight: "50vh",
|
|
30
|
+
overflowY: "auto"
|
|
28
31
|
}
|
|
29
32
|
});
|
|
30
33
|
const ConceptEmbed = _ref => {
|
|
31
34
|
let {
|
|
32
35
|
embed,
|
|
33
36
|
renderContext,
|
|
34
|
-
lang
|
|
37
|
+
lang,
|
|
38
|
+
previewAlt
|
|
35
39
|
} = _ref;
|
|
36
40
|
const parsedContent = (0, _react.useMemo)(() => {
|
|
37
41
|
if (embed.status === "error" || !embed.data.concept.content) return undefined;
|
|
@@ -60,19 +64,23 @@ const ConceptEmbed = _ref => {
|
|
|
60
64
|
}
|
|
61
65
|
if (embed.embedData.type === "inline") {
|
|
62
66
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(InlineConcept, {
|
|
67
|
+
previewAlt: previewAlt,
|
|
63
68
|
linkText: embed.embedData.linkText,
|
|
64
69
|
copyright: concept.copyright,
|
|
65
70
|
visualElement: visualElement,
|
|
66
71
|
lang: lang,
|
|
67
72
|
title: concept.title.title,
|
|
73
|
+
source: concept.source,
|
|
68
74
|
children: parsedContent
|
|
69
75
|
});
|
|
70
76
|
}
|
|
71
77
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockConcept, {
|
|
78
|
+
previewAlt: previewAlt,
|
|
72
79
|
copyright: concept.copyright,
|
|
73
80
|
visualElement: visualElement,
|
|
74
81
|
lang: lang,
|
|
75
82
|
title: renderContext === "embed" ? undefined : concept.title.title,
|
|
83
|
+
source: concept.source,
|
|
76
84
|
children: parsedContent
|
|
77
85
|
});
|
|
78
86
|
};
|
|
@@ -85,23 +93,27 @@ const InlineConcept = exports.InlineConcept = /*#__PURE__*/(0, _react.forwardRef
|
|
|
85
93
|
lang,
|
|
86
94
|
children,
|
|
87
95
|
title,
|
|
96
|
+
source,
|
|
88
97
|
...rest
|
|
89
98
|
} = _ref2;
|
|
90
99
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.PopoverRoot, {
|
|
91
100
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.PopoverTrigger, {
|
|
92
101
|
asChild: true,
|
|
102
|
+
ref: ref,
|
|
103
|
+
...rest,
|
|
93
104
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InlineTriggerButton.InlineTriggerButton, {
|
|
94
|
-
...rest,
|
|
95
|
-
ref: ref,
|
|
96
105
|
children: linkText
|
|
97
106
|
})
|
|
98
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
99
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Portal, {
|
|
108
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledPopoverContent, {
|
|
109
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Concept.Concept, {
|
|
110
|
+
copyright: copyright,
|
|
111
|
+
visualElement: visualElement,
|
|
112
|
+
lang: lang,
|
|
113
|
+
title: title,
|
|
114
|
+
source: source,
|
|
115
|
+
children: children
|
|
116
|
+
})
|
|
105
117
|
})
|
|
106
118
|
})]
|
|
107
119
|
});
|
package/lib/Embed/ImageEmbed.js
CHANGED
|
@@ -13,6 +13,7 @@ var _primitives = require("@ndla/primitives");
|
|
|
13
13
|
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
14
14
|
var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
|
|
15
15
|
var _LicenseByline = require("../LicenseByline");
|
|
16
|
+
var _licenseAttributes = require("../utils/licenseAttributes");
|
|
16
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
19
|
/**
|
|
@@ -233,12 +234,14 @@ const ImageEmbed = _ref => {
|
|
|
233
234
|
const toggleImageSize = () => {
|
|
234
235
|
setImageSizes(sizes => !sizes ? expandedSizes : undefined);
|
|
235
236
|
};
|
|
237
|
+
const licenseProps = (0, _licenseAttributes.licenseAttributes)(data.copyright.license.license, lang, embedData.url);
|
|
236
238
|
|
|
237
239
|
// TODO: Check how this works with `children`. Will only be important for ED
|
|
238
240
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledFigure, {
|
|
239
241
|
float: figureProps?.float,
|
|
240
242
|
size: imageSizes ? "full" : figureProps?.size ?? "medium",
|
|
241
243
|
"data-embed-type": "image",
|
|
244
|
+
...licenseProps,
|
|
242
245
|
children: [children, /*#__PURE__*/(0, _jsxRuntime.jsxs)(ImageWrapper, {
|
|
243
246
|
border: embedData.border === "true",
|
|
244
247
|
expandable: !!figureProps?.float,
|
package/lib/Embed/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
export { default as ImageEmbed, getCrop, getFocalPoint } from "./ImageEmbed";
|
|
9
|
+
export { InlineTriggerButton } from "./InlineTriggerButton";
|
|
9
10
|
export { default as AudioEmbed } from "./AudioEmbed";
|
|
10
11
|
export { default as H5pEmbed } from "./H5pEmbed";
|
|
11
12
|
export { default as ExternalEmbed } from "./ExternalEmbed";
|
package/lib/Embed/index.js
CHANGED
|
@@ -87,6 +87,12 @@ Object.defineProperty(exports, "InlineConcept", {
|
|
|
87
87
|
return _ConceptEmbed.InlineConcept;
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
|
+
Object.defineProperty(exports, "InlineTriggerButton", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _InlineTriggerButton.InlineTriggerButton;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
90
96
|
Object.defineProperty(exports, "RelatedContentEmbed", {
|
|
91
97
|
enumerable: true,
|
|
92
98
|
get: function () {
|
|
@@ -118,6 +124,7 @@ Object.defineProperty(exports, "getFocalPoint", {
|
|
|
118
124
|
}
|
|
119
125
|
});
|
|
120
126
|
var _ImageEmbed = _interopRequireWildcard(require("./ImageEmbed"));
|
|
127
|
+
var _InlineTriggerButton = require("./InlineTriggerButton");
|
|
121
128
|
var _AudioEmbed = _interopRequireDefault(require("./AudioEmbed"));
|
|
122
129
|
var _H5pEmbed = _interopRequireDefault(require("./H5pEmbed"));
|
|
123
130
|
var _ExternalEmbed = _interopRequireDefault(require("./ExternalEmbed"));
|
|
@@ -9,6 +9,8 @@ import { ComponentPropsWithoutRef } from "react";
|
|
|
9
9
|
interface Props extends ComponentPropsWithoutRef<"div"> {
|
|
10
10
|
}
|
|
11
11
|
export declare const FileListWrapper: import("@ndla/styled-system/types").StyledComponent<"div", {}>;
|
|
12
|
-
export declare const FileListItem: import("@ndla/styled-system/types").StyledComponent<"
|
|
12
|
+
export declare const FileListItem: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
|
|
13
|
+
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
14
|
+
} & import("@ark-ui/react").PolymorphicProps>, {}>;
|
|
13
15
|
export declare const FileListEmbed: ({ children, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
16
|
export {};
|
package/lib/FileList/FileList.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.FileListWrapper = exports.FileListItem = exports.FileListEmbed = void 0;
|
|
7
7
|
var _reactI18next = require("react-i18next");
|
|
8
|
+
var _react = require("@ark-ui/react");
|
|
8
9
|
var _primitives = require("@ndla/primitives");
|
|
9
10
|
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -23,8 +24,9 @@ const FileListWrapper = exports.FileListWrapper = (0, _jsx2.styled)("div", {
|
|
|
23
24
|
gap: "xsmall"
|
|
24
25
|
}
|
|
25
26
|
});
|
|
26
|
-
const FileListItem = exports.FileListItem = (0, _jsx2.styled)(
|
|
27
|
+
const FileListItem = exports.FileListItem = (0, _jsx2.styled)(_react.ark.li, {
|
|
27
28
|
base: {
|
|
29
|
+
listStyle: "none",
|
|
28
30
|
background: "surface.infoSubtle",
|
|
29
31
|
borderBlockEnd: "1px solid",
|
|
30
32
|
borderColor: "stroke.default",
|
|
@@ -34,6 +36,8 @@ const FileListItem = exports.FileListItem = (0, _jsx2.styled)("li", {
|
|
|
34
36
|
backgroundColor: "surface.infoSubtle.hover"
|
|
35
37
|
}
|
|
36
38
|
}
|
|
39
|
+
}, {
|
|
40
|
+
baseComponent: true
|
|
37
41
|
});
|
|
38
42
|
const FileListEmbed = _ref => {
|
|
39
43
|
let {
|
package/lib/FileList/PdfFile.js
CHANGED
|
@@ -20,6 +20,11 @@ const StyledIframe = (0, _jsx2.styled)("iframe", {
|
|
|
20
20
|
width: "100%"
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
+
const StyledListElement = (0, _jsx2.styled)("li", {
|
|
24
|
+
base: {
|
|
25
|
+
listStyle: "none"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
23
28
|
const StyledFigure = (0, _jsx2.styled)(_primitives.Figure, {
|
|
24
29
|
base: {
|
|
25
30
|
display: "flex",
|
|
@@ -32,7 +37,7 @@ const PdfFile = _ref => {
|
|
|
32
37
|
title,
|
|
33
38
|
url
|
|
34
39
|
} = _ref;
|
|
35
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledListElement, {
|
|
36
41
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledFigure, {
|
|
37
42
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Heading, {
|
|
38
43
|
asChild: true,
|
package/lib/FileList/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
export { FileListEmbed, FileListItem } from "./FileList";
|
|
8
|
+
export { FileListEmbed, FileListItem, FileListWrapper } from "./FileList";
|
|
9
9
|
export { File, FileListElement } from "./File";
|
|
10
10
|
export { PdfFile } from "./PdfFile";
|
package/lib/FileList/index.js
CHANGED
|
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "FileListItem", {
|
|
|
27
27
|
return _FileList.FileListItem;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "FileListWrapper", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _FileList.FileListWrapper;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
30
36
|
Object.defineProperty(exports, "PdfFile", {
|
|
31
37
|
enumerable: true,
|
|
32
38
|
get: function () {
|
package/lib/Grid/Grid.js
CHANGED
|
@@ -23,7 +23,6 @@ const GridContainer = (0, _jsx2.styled)("div", {
|
|
|
23
23
|
gridColumnGap: "medium",
|
|
24
24
|
width: "100%",
|
|
25
25
|
backgroundColor: "background.subtle",
|
|
26
|
-
maxWidth: "surface.4xlarge",
|
|
27
26
|
minWidth: "surface.xxsmall",
|
|
28
27
|
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
29
28
|
tabletDown: {
|
|
@@ -187,7 +187,10 @@ const LicenseContainerContent = _ref3 => {
|
|
|
187
187
|
const authors = (0, _licenses.getLicenseCredits)(copyright);
|
|
188
188
|
const captionAuthors = Object.values(authors).find(i => i.length > 0) ?? [];
|
|
189
189
|
const content = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
190
|
-
children: [children, ` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`,
|
|
190
|
+
children: [children, ` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
191
|
+
property: "cc:attributionName",
|
|
192
|
+
children: captionAuthors.map(author => author.name).join(", ")
|
|
193
|
+
}), license ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
191
194
|
children: [" / ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_LicenseLink.LicenseLink, {
|
|
192
195
|
license: license
|
|
193
196
|
})]
|
|
@@ -257,8 +257,6 @@ const TreeStructureItem = _ref2 => {
|
|
|
257
257
|
} = (0, _react2.usePopoverContext)();
|
|
258
258
|
const containsResource = targetResource && folder.resources.some(resource => resource.resourceId === targetResource.resourceId);
|
|
259
259
|
const FolderIcon = folder.status === "shared" ? StyledFolderUserLine : StyledFolderLine;
|
|
260
|
-
|
|
261
|
-
// TODO: Pressing enter selects the item and closes the popover immediately. Do we actually want this? Old behavior.
|
|
262
260
|
const onKeyDown = (0, _react.useCallback)(e => {
|
|
263
261
|
if (e.key === "Enter") {
|
|
264
262
|
setOpen(false);
|
package/lib/i18n/index.d.ts
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { i18nInstance } from "./i18n";
|
|
9
9
|
export { formatNestedMessages } from "./formatNestedMessages";
|
|
10
|
-
export { useComboboxTranslations, useTagSelectorTranslations, useTagsInputTranslations, usePaginationTranslations, } from "./useComponentTranslations";
|
|
10
|
+
export { useComboboxTranslations, useTagSelectorTranslations, useTagsInputTranslations, usePaginationTranslations, useAudioSearchTranslations, useImageSearchTranslations, } from "./useComponentTranslations";
|
package/lib/i18n/index.js
CHANGED
|
@@ -15,12 +15,24 @@ Object.defineProperty(exports, "i18nInstance", {
|
|
|
15
15
|
return _i18n.i18nInstance;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "useAudioSearchTranslations", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _useComponentTranslations.useAudioSearchTranslations;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(exports, "useComboboxTranslations", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function () {
|
|
21
27
|
return _useComponentTranslations.useComboboxTranslations;
|
|
22
28
|
}
|
|
23
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "useImageSearchTranslations", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _useComponentTranslations.useImageSearchTranslations;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
24
36
|
Object.defineProperty(exports, "usePaginationTranslations", {
|
|
25
37
|
enumerable: true,
|
|
26
38
|
get: function () {
|