@ndla/ui 56.0.18-alpha.0 → 56.0.19-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 +4 -0
- 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 +19 -10
- 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 +61 -0
- package/es/index.js +7 -5
- package/es/locale/messages-en.js +23 -1
- package/es/locale/messages-nb.js +23 -1
- package/es/locale/messages-nn.js +71 -49
- package/es/locale/messages-se.js +23 -1
- package/es/locale/messages-sma.js +23 -1
- 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 +1 -0
- package/lib/Concept/Concept.js +4 -0
- 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 +1 -0
- package/lib/Embed/ConceptEmbed.js +19 -10
- 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 +64 -2
- package/lib/index.d.ts +6 -4
- package/lib/index.js +38 -6
- package/lib/locale/messages-en.d.ts +22 -0
- package/lib/locale/messages-en.js +23 -1
- package/lib/locale/messages-nb.d.ts +22 -0
- package/lib/locale/messages-nb.js +23 -1
- package/lib/locale/messages-nn.d.ts +22 -0
- package/lib/locale/messages-nn.js +71 -49
- package/lib/locale/messages-se.d.ts +22 -0
- package/lib/locale/messages-se.js +23 -1
- package/lib/locale/messages-sma.d.ts +22 -0
- package/lib/locale/messages-sma.js +23 -1
- 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 +6 -2
- 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 +17 -10
- 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 +78 -0
- package/src/index.ts +8 -2
- package/src/locale/messages-en.ts +24 -1
- package/src/locale/messages-nb.ts +24 -1
- package/src/locale/messages-nn.ts +72 -49
- package/src/locale/messages-se.ts +24 -1
- package/src/locale/messages-sma.ts +24 -1
- 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/es/styles.css
CHANGED
|
@@ -93,10 +93,6 @@
|
|
|
93
93
|
display: flex;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
.gap_xxlarge {
|
|
97
|
-
gap: var(--spacing-xxlarge);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
96
|
.c_text\.default {
|
|
101
97
|
color: var(--colors-text-default);
|
|
102
98
|
}
|
|
@@ -121,6 +117,10 @@
|
|
|
121
117
|
padding-block-start: var(--spacing-xxlarge);
|
|
122
118
|
}
|
|
123
119
|
|
|
120
|
+
.gap_xxlarge {
|
|
121
|
+
gap: var(--spacing-xxlarge);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
124
|
.min-h_xxlarge {
|
|
125
125
|
min-height: var(--sizes-xxlarge);
|
|
126
126
|
}
|
|
@@ -326,10 +326,18 @@
|
|
|
326
326
|
text-decoration: underline;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
+
.d_grid {
|
|
330
|
+
display: grid;
|
|
331
|
+
}
|
|
332
|
+
|
|
329
333
|
.h_215px {
|
|
330
334
|
height: 215px;
|
|
331
335
|
}
|
|
332
336
|
|
|
337
|
+
.min-w_270px {
|
|
338
|
+
min-width: 270px;
|
|
339
|
+
}
|
|
340
|
+
|
|
333
341
|
.bd-l_4px_solid {
|
|
334
342
|
border-left: 4px solid;
|
|
335
343
|
}
|
|
@@ -438,6 +446,10 @@
|
|
|
438
446
|
width: var(--sizes-surface-xlarge);
|
|
439
447
|
}
|
|
440
448
|
|
|
449
|
+
.max-h_50vh {
|
|
450
|
+
max-height: 50vh;
|
|
451
|
+
}
|
|
452
|
+
|
|
441
453
|
.c_text\.error {
|
|
442
454
|
color: var(--colors-text-error);
|
|
443
455
|
}
|
|
@@ -539,14 +551,6 @@
|
|
|
539
551
|
margin-block-start: var(--spacing-3xsmall);
|
|
540
552
|
}
|
|
541
553
|
|
|
542
|
-
.d_grid {
|
|
543
|
-
display: grid;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
.max-w_surface\.4xlarge {
|
|
547
|
-
max-width: var(--sizes-surface-4xlarge);
|
|
548
|
-
}
|
|
549
|
-
|
|
550
554
|
.w_surface\.3xsmall {
|
|
551
555
|
width: var(--sizes-surface-3xsmall);
|
|
552
556
|
}
|
|
@@ -678,12 +682,12 @@
|
|
|
678
682
|
align-items: flex-end;
|
|
679
683
|
}
|
|
680
684
|
|
|
681
|
-
.
|
|
682
|
-
|
|
685
|
+
.grid-tc_1fr {
|
|
686
|
+
grid-template-columns: 1fr;
|
|
683
687
|
}
|
|
684
688
|
|
|
685
|
-
.
|
|
686
|
-
|
|
689
|
+
.fw_bold {
|
|
690
|
+
font-weight: var(--font-weights-bold);
|
|
687
691
|
}
|
|
688
692
|
|
|
689
693
|
.bd-l-c_stroke\.default {
|
|
@@ -722,6 +726,10 @@
|
|
|
722
726
|
top: calc(var(--spacing-4xsmall) * -1);
|
|
723
727
|
}
|
|
724
728
|
|
|
729
|
+
.ov-y_auto {
|
|
730
|
+
overflow-y: auto;
|
|
731
|
+
}
|
|
732
|
+
|
|
725
733
|
.bg-c_surface\.disabled {
|
|
726
734
|
background-color: var(--colors-surface-disabled);
|
|
727
735
|
}
|
|
@@ -900,14 +908,6 @@
|
|
|
900
908
|
padding-block-end: var(--spacing-5xlarge);
|
|
901
909
|
}
|
|
902
910
|
|
|
903
|
-
.\[\&\[data-align\=\"center\"\]\]\:ta_center[data-align="center"] {
|
|
904
|
-
text-align: center;
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
.\[\&\:has\(span\[dir\=\"rtl\"\]\)\]\:direction_rtl:has(span[dir="rtl"]) {
|
|
908
|
-
direction: rtl;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
911
|
.\[\&_img\]\:w_100\% img {
|
|
912
912
|
width: 100%;
|
|
913
913
|
}
|
|
@@ -1448,9 +1448,6 @@
|
|
|
1448
1448
|
}
|
|
1449
1449
|
|
|
1450
1450
|
@media screen and (min-width: 29.75rem) {
|
|
1451
|
-
.mobileWide\:h_340px {
|
|
1452
|
-
height: 340px;
|
|
1453
|
-
}
|
|
1454
1451
|
.mobileWide\:d_none {
|
|
1455
1452
|
display: none;
|
|
1456
1453
|
}
|
|
@@ -1465,6 +1462,9 @@
|
|
|
1465
1462
|
@media screen and (min-width: 37.5625rem) {
|
|
1466
1463
|
.tablet\:px_medium {
|
|
1467
1464
|
padding-inline: var(--spacing-medium);
|
|
1465
|
+
}
|
|
1466
|
+
.tablet\:h_265px {
|
|
1467
|
+
height: 265px;
|
|
1468
1468
|
}
|
|
1469
1469
|
.tablet\:h_26px {
|
|
1470
1470
|
height: 26px;
|
|
@@ -1544,8 +1544,8 @@
|
|
|
1544
1544
|
.tabletWide\:max-w_532px {
|
|
1545
1545
|
max-width: 532px;
|
|
1546
1546
|
}
|
|
1547
|
-
.tabletWide\:
|
|
1548
|
-
|
|
1547
|
+
.tabletWide\:h_340px {
|
|
1548
|
+
height: 340px;
|
|
1549
1549
|
}
|
|
1550
1550
|
.tabletWide\:d_block {
|
|
1551
1551
|
display: block;
|
|
@@ -1570,6 +1570,12 @@
|
|
|
1570
1570
|
}
|
|
1571
1571
|
.tabletWide\:jc_space-between {
|
|
1572
1572
|
justify-content: space-between;
|
|
1573
|
+
}
|
|
1574
|
+
.tabletWide\:grid-tc_minmax\(230px\,_455px\)_auto {
|
|
1575
|
+
grid-template-columns: minmax(230px, 455px) auto;
|
|
1576
|
+
}
|
|
1577
|
+
.tabletWide\:grid-tc_auto_minmax\(230px\,_455px\) {
|
|
1578
|
+
grid-template-columns: auto minmax(230px, 455px);
|
|
1573
1579
|
}
|
|
1574
1580
|
}
|
|
1575
1581
|
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { getLicenseByAbbreviation, isCreativeCommonsLicense } from "@ndla/licenses";
|
|
10
|
+
export const licenseAttributes = (license, lang, url) => {
|
|
11
|
+
const licenseAbbr = getLicenseByAbbreviation(license ? license : "", lang);
|
|
12
|
+
const licenseProps = isCreativeCommonsLicense(licenseAbbr.rights) ? {
|
|
13
|
+
"xmlns:cc": "https://creativecommons.org/ns#",
|
|
14
|
+
"xmlns:dct": "http://purl.org/dc/terms/",
|
|
15
|
+
about: url ?? undefined
|
|
16
|
+
} : {};
|
|
17
|
+
return licenseProps;
|
|
18
|
+
};
|
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,6 @@ export interface ConceptProps extends ComponentPropsWithRef<"figure"> {
|
|
|
14
14
|
lang?: string;
|
|
15
15
|
title?: string;
|
|
16
16
|
children?: ReactNode;
|
|
17
|
+
source?: string;
|
|
17
18
|
}
|
|
18
19
|
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,14 @@ const Concept = exports.Concept = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref
|
|
|
44
45
|
lang,
|
|
45
46
|
children,
|
|
46
47
|
title,
|
|
48
|
+
source,
|
|
47
49
|
...rest
|
|
48
50
|
} = _ref;
|
|
51
|
+
const licenseProps = (0, _licenseAttributes.licenseAttributes)(copyright?.license?.license, lang, source);
|
|
49
52
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledFigure, {
|
|
50
53
|
ref: ref,
|
|
51
54
|
...rest,
|
|
55
|
+
...licenseProps,
|
|
52
56
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(ContentWrapper, {
|
|
53
57
|
lang: lang,
|
|
54
58
|
children: [!!title && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -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, {
|
|
@@ -19,6 +19,7 @@ interface Props extends BaseProps {
|
|
|
19
19
|
export declare const ConceptEmbed: ({ embed, renderContext, lang }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export interface InlineConceptProps extends ConceptProps, BaseProps {
|
|
21
21
|
linkText?: string;
|
|
22
|
+
source?: string;
|
|
22
23
|
}
|
|
23
24
|
export declare const InlineConcept: import("react").ForwardRefExoticComponent<Omit<InlineConceptProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
24
25
|
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,7 +25,9 @@ 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 => {
|
|
@@ -65,6 +68,7 @@ const ConceptEmbed = _ref => {
|
|
|
65
68
|
visualElement: visualElement,
|
|
66
69
|
lang: lang,
|
|
67
70
|
title: concept.title.title,
|
|
71
|
+
source: concept.source,
|
|
68
72
|
children: parsedContent
|
|
69
73
|
});
|
|
70
74
|
}
|
|
@@ -73,6 +77,7 @@ const ConceptEmbed = _ref => {
|
|
|
73
77
|
visualElement: visualElement,
|
|
74
78
|
lang: lang,
|
|
75
79
|
title: renderContext === "embed" ? undefined : concept.title.title,
|
|
80
|
+
source: concept.source,
|
|
76
81
|
children: parsedContent
|
|
77
82
|
});
|
|
78
83
|
};
|
|
@@ -85,23 +90,27 @@ const InlineConcept = exports.InlineConcept = /*#__PURE__*/(0, _react.forwardRef
|
|
|
85
90
|
lang,
|
|
86
91
|
children,
|
|
87
92
|
title,
|
|
93
|
+
source,
|
|
88
94
|
...rest
|
|
89
95
|
} = _ref2;
|
|
90
96
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.PopoverRoot, {
|
|
91
97
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.PopoverTrigger, {
|
|
92
98
|
asChild: true,
|
|
99
|
+
ref: ref,
|
|
100
|
+
...rest,
|
|
93
101
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InlineTriggerButton.InlineTriggerButton, {
|
|
94
|
-
...rest,
|
|
95
|
-
ref: ref,
|
|
96
102
|
children: linkText
|
|
97
103
|
})
|
|
98
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
99
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Portal, {
|
|
105
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledPopoverContent, {
|
|
106
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Concept.Concept, {
|
|
107
|
+
copyright: copyright,
|
|
108
|
+
visualElement: visualElement,
|
|
109
|
+
lang: lang,
|
|
110
|
+
title: title,
|
|
111
|
+
source: source,
|
|
112
|
+
children: children
|
|
113
|
+
})
|
|
105
114
|
})
|
|
106
115
|
})]
|
|
107
116
|
});
|
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 {};
|