@ndla/ui 36.0.2 → 37.0.1
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/es/Article/Article.js +7 -13
- package/es/Article/ArticleByline.js +79 -123
- package/es/Article/ArticleFootNotes.js +16 -11
- package/es/AudioPlayer/AudioPlayer.js +33 -35
- package/es/AudioPlayer/initAudioPlayers.js +6 -1
- package/es/ContentTypeBadge/ContentTypeBadge.js +27 -6
- package/es/Embed/AudioEmbed.js +44 -188
- package/es/Embed/BrightcoveEmbed.js +32 -127
- package/es/Embed/ConceptEmbed.js +53 -75
- package/es/Embed/EmbedErrorPlaceholder.js +41 -0
- package/es/Embed/ExternalEmbed.js +5 -12
- package/es/Embed/H5pEmbed.js +5 -15
- package/es/Embed/IframeEmbed.js +4 -4
- package/es/Embed/ImageEmbed.js +41 -153
- package/es/Embed/RelatedContentEmbed.js +3 -3
- package/es/Embed/conceptComponents.js +62 -228
- package/es/Embed/types.js +1 -0
- package/es/KeyFigure/KeyFigure.js +57 -0
- package/es/{KeyPerformanceIndicator → KeyFigure}/index.js +1 -1
- package/es/LicenseByline/EmbedByline.js +33 -8
- package/es/LicenseByline/LicenseDescription.js +16 -14
- package/es/List/OrderedList.js +48 -0
- package/es/List/UnOrderedList.js +36 -0
- package/es/List/index.js +10 -0
- package/es/Navigation/NavigationBox.js +41 -48
- package/es/Navigation/NavigationHeading.js +18 -29
- package/es/Notion/Notion.js +5 -5
- package/es/Resource/ListResource.js +9 -9
- package/es/Resource/resourceComponents.js +12 -11
- package/es/Typography/Heading.js +38 -0
- package/es/Typography/index.js +9 -0
- package/es/all.css +1 -1
- package/es/index.js +4 -2
- package/es/locale/messages-en.js +6 -2
- package/es/locale/messages-nb.js +6 -2
- package/es/locale/messages-nn.js +6 -2
- package/es/locale/messages-se.js +6 -2
- package/es/locale/messages-sma.js +6 -2
- package/es/model/ContentType.js +7 -1
- package/lib/Article/Article.d.ts +1 -3
- package/lib/Article/Article.js +7 -13
- package/lib/Article/ArticleByline.d.ts +3 -5
- package/lib/Article/ArticleByline.js +83 -126
- package/lib/Article/ArticleFootNotes.js +16 -11
- package/lib/AudioPlayer/AudioPlayer.d.ts +1 -2
- package/lib/AudioPlayer/AudioPlayer.js +33 -36
- package/lib/AudioPlayer/initAudioPlayers.d.ts +1 -0
- package/lib/AudioPlayer/initAudioPlayers.js +9 -3
- package/lib/ContentTypeBadge/ContentTypeBadge.js +27 -6
- package/lib/Embed/AudioEmbed.d.ts +3 -2
- package/lib/Embed/AudioEmbed.js +53 -192
- package/lib/Embed/BrightcoveEmbed.d.ts +3 -1
- package/lib/Embed/BrightcoveEmbed.js +32 -126
- package/lib/Embed/ConceptEmbed.d.ts +7 -2
- package/lib/Embed/ConceptEmbed.js +51 -73
- package/lib/Embed/EmbedErrorPlaceholder.d.ts +17 -0
- package/lib/Embed/EmbedErrorPlaceholder.js +48 -0
- package/lib/Embed/ExternalEmbed.js +5 -11
- package/lib/Embed/H5pEmbed.js +5 -14
- package/lib/Embed/IframeEmbed.d.ts +2 -2
- package/lib/Embed/IframeEmbed.js +4 -4
- package/lib/Embed/ImageEmbed.d.ts +3 -10
- package/lib/Embed/ImageEmbed.js +48 -161
- package/lib/Embed/RelatedContentEmbed.js +3 -3
- package/lib/Embed/conceptComponents.d.ts +4 -2
- package/lib/Embed/conceptComponents.js +67 -231
- package/lib/Embed/index.d.ts +1 -0
- package/lib/Embed/types.d.ts +14 -0
- package/lib/Embed/types.js +5 -0
- package/lib/KeyFigure/KeyFigure.d.ts +10 -0
- package/lib/KeyFigure/KeyFigure.js +62 -0
- package/lib/KeyFigure/index.d.ts +1 -0
- package/lib/KeyFigure/index.js +13 -0
- package/lib/LicenseByline/EmbedByline.d.ts +10 -2
- package/lib/LicenseByline/EmbedByline.js +32 -7
- package/lib/LicenseByline/LicenseDescription.d.ts +3 -1
- package/lib/LicenseByline/LicenseDescription.js +14 -13
- package/lib/List/OrderedList.d.ts +15 -0
- package/lib/List/OrderedList.js +56 -0
- package/lib/List/UnOrderedList.d.ts +10 -0
- package/lib/List/UnOrderedList.js +43 -0
- package/lib/List/index.d.ts +9 -0
- package/lib/List/index.js +20 -0
- package/lib/Navigation/NavigationBox.js +40 -47
- package/lib/Navigation/NavigationHeading.js +17 -28
- package/lib/Notion/Notion.js +5 -5
- package/lib/Resource/ListResource.js +8 -8
- package/lib/Resource/resourceComponents.js +12 -11
- package/lib/Typography/Heading.d.ts +26 -0
- package/lib/Typography/Heading.js +45 -0
- package/lib/Typography/index.d.ts +8 -0
- package/lib/Typography/index.js +13 -0
- package/lib/all.css +1 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.js +23 -3
- package/lib/locale/messages-en.d.ts +4 -0
- package/lib/locale/messages-en.js +6 -2
- package/lib/locale/messages-nb.d.ts +4 -0
- package/lib/locale/messages-nb.js +6 -2
- package/lib/locale/messages-nn.d.ts +4 -0
- package/lib/locale/messages-nn.js +6 -2
- package/lib/locale/messages-se.d.ts +4 -0
- package/lib/locale/messages-se.js +6 -2
- package/lib/locale/messages-sma.d.ts +4 -0
- package/lib/locale/messages-sma.js +6 -2
- package/lib/model/ContentType.d.ts +1 -0
- package/lib/model/ContentType.js +9 -2
- package/package.json +15 -15
- package/src/Article/Article.tsx +1 -8
- package/src/Article/ArticleByline.tsx +78 -127
- package/src/Article/ArticleFootNotes.tsx +33 -10
- package/src/Article/component.article.scss +1 -52
- package/src/Article/component.footnotes.scss +2 -2
- package/src/Aside/component.aside.scss +3 -3
- package/src/AudioPlayer/AudioPlayer.tsx +11 -24
- package/src/AudioPlayer/initAudioPlayers.tsx +7 -2
- package/src/ContentTypeBadge/ContentTypeBadge.tsx +29 -6
- package/src/ContentTypeBadge/component.content-type-badge.scss +9 -3
- package/src/Dialog/component.dialog.scss +4 -5
- package/src/Embed/AudioEmbed.stories.tsx +5 -3
- package/src/Embed/AudioEmbed.tsx +45 -192
- package/src/Embed/BrightcoveEmbed.stories.tsx +5 -1
- package/src/Embed/BrightcoveEmbed.tsx +24 -98
- package/src/Embed/ConceptEmbed.stories.tsx +5 -0
- package/src/Embed/ConceptEmbed.tsx +43 -54
- package/src/Embed/EmbedErrorPlaceholder.tsx +59 -0
- package/src/Embed/ExternalEmbed.stories.tsx +86 -0
- package/src/Embed/ExternalEmbed.tsx +3 -8
- package/src/Embed/H5pEmbed.stories.tsx +92 -0
- package/src/Embed/H5pEmbed.tsx +3 -11
- package/src/Embed/IframeEmbed.stories.tsx +130 -0
- package/src/Embed/IframeEmbed.tsx +3 -3
- package/src/Embed/ImageEmbed.stories.tsx +3 -1
- package/src/Embed/ImageEmbed.tsx +21 -116
- package/src/Embed/RelatedContentEmbed.tsx +3 -1
- package/src/Embed/conceptComponents.tsx +67 -257
- package/src/Embed/index.ts +1 -0
- package/src/Embed/types.ts +12 -0
- package/src/FactBox/component.factbox.scss +3 -3
- package/src/Figure/component.figure-license.scss +4 -4
- package/src/Figure/component.figure.scss +1 -1
- package/src/KeyFigure/KeyFigure.stories.tsx +36 -0
- package/src/{KeyPerformanceIndicator/KeyPerformanceIndicator.tsx → KeyFigure/KeyFigure.tsx} +9 -7
- package/src/{KeyPerformanceIndicator → KeyFigure}/index.ts +1 -1
- package/src/LicenseByline/EmbedByline.stories.tsx +1 -0
- package/src/LicenseByline/EmbedByline.tsx +57 -9
- package/src/LicenseByline/LicenseDescription.tsx +9 -3
- package/src/List/OrderedList.tsx +115 -0
- package/src/List/UnOrderedList.tsx +49 -0
- package/src/List/index.ts +10 -0
- package/src/MediaList/component.medialist.scss +2 -2
- package/src/Navigation/NavigationBox.tsx +10 -14
- package/src/Navigation/NavigationHeading.tsx +15 -24
- package/src/Notion/Notion.tsx +1 -1
- package/src/RelatedArticleList/component.related-articles.scss +3 -13
- package/src/Resource/ListResource.tsx +6 -2
- package/src/Resource/resourceComponents.tsx +4 -2
- package/src/Table/component.tables.scss +0 -46
- package/src/Translation/component.translation.scss +3 -5
- package/src/Typography/Heading.tsx +96 -0
- package/src/Typography/index.ts +9 -0
- package/src/index.ts +5 -1
- package/src/locale/messages-en.ts +4 -0
- package/src/locale/messages-nb.ts +4 -0
- package/src/locale/messages-nn.ts +4 -0
- package/src/locale/messages-se.ts +4 -0
- package/src/locale/messages-sma.ts +4 -0
- package/src/model/ContentType.ts +7 -0
- package/es/KeyPerformanceIndicator/KeyPerformanceIndicator.js +0 -57
- package/lib/KeyPerformanceIndicator/KeyPerformanceIndicator.d.ts +0 -8
- package/lib/KeyPerformanceIndicator/KeyPerformanceIndicator.js +0 -62
- package/lib/KeyPerformanceIndicator/index.d.ts +0 -1
- package/lib/KeyPerformanceIndicator/index.js +0 -13
- package/src/KeyPerformanceIndicator/KeyPerformanceIndicator.stories.tsx +0 -79
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] = void 0;
|
|
6
|
+
exports.truncateDescription = exports["default"] = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
9
|
+
var _shave = _interopRequireDefault(require("shave"));
|
|
9
10
|
var _Controls = _interopRequireDefault(require("./Controls"));
|
|
10
11
|
var _SpeechControl = _interopRequireDefault(require("./SpeechControl"));
|
|
11
|
-
var _AudioPlayer = require("./AudioPlayer");
|
|
12
12
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
14
|
/**
|
|
@@ -19,6 +19,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
+
var truncateDescription = function truncateDescription(el, readMoreLabel) {
|
|
23
|
+
(0, _shave["default"])(el, 90, {
|
|
24
|
+
character: "... <a href=\"#\" onclick=\"(function(e){e.preventDefault(); const parentNode = e.target.parentNode; parentNode.nextSibling.style.display = 'inline'; parentNode.remove();return false;})(arguments[0]);return false;\">".concat(readMoreLabel, "</a>")
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
exports.truncateDescription = truncateDescription;
|
|
22
28
|
var forEachElement = function forEachElement(selector, callback) {
|
|
23
29
|
var nodeList = document.querySelectorAll(selector);
|
|
24
30
|
for (var i = 0; i < nodeList.length; i += 1) {
|
|
@@ -46,7 +52,7 @@ var initAudioPlayers = function initAudioPlayers(locale) {
|
|
|
46
52
|
});
|
|
47
53
|
forEachElement('[data-audio-player-description]', function (el) {
|
|
48
54
|
var readMoreLabel = el.getAttribute('data-read-more-text');
|
|
49
|
-
|
|
55
|
+
truncateDescription(el, readMoreLabel);
|
|
50
56
|
});
|
|
51
57
|
forEachElement('[data-audio-text-button-id]', function (el) {
|
|
52
58
|
var id = el.getAttribute('data-audio-text-button-id');
|
|
@@ -8,6 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
9
9
|
var _contentType = require("@ndla/icons/contentType");
|
|
10
10
|
var _action = require("@ndla/icons/action");
|
|
11
|
+
var _editor = require("@ndla/icons/editor");
|
|
11
12
|
var contentTypes = _interopRequireWildcard(require("../model/ContentType"));
|
|
12
13
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
13
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -33,12 +34,7 @@ var ContentTypeBadge = function ContentTypeBadge(_ref) {
|
|
|
33
34
|
border = _ref$border === void 0 ? true : _ref$border,
|
|
34
35
|
className = _ref.className;
|
|
35
36
|
var modifiers = [type, size];
|
|
36
|
-
|
|
37
|
-
modifiers.push('background');
|
|
38
|
-
}
|
|
39
|
-
if (border) {
|
|
40
|
-
modifiers.push('border');
|
|
41
|
-
}
|
|
37
|
+
var embedResource = false;
|
|
42
38
|
var icon = null;
|
|
43
39
|
switch (type) {
|
|
44
40
|
case contentTypes.SUBJECT_MATERIAL:
|
|
@@ -84,9 +80,34 @@ var ContentTypeBadge = function ContentTypeBadge(_ref) {
|
|
|
84
80
|
case contentTypes.MULTIDISCIPLINARY_TOPIC:
|
|
85
81
|
icon = (0, _jsxRuntime.jsx)(_contentType.MultidisciplinaryTopic, {});
|
|
86
82
|
break;
|
|
83
|
+
case contentTypes.resourceTypeMapping.image:
|
|
84
|
+
icon = (0, _jsxRuntime.jsx)(_editor.Media, {});
|
|
85
|
+
embedResource = true;
|
|
86
|
+
break;
|
|
87
|
+
case contentTypes.resourceTypeMapping.audio:
|
|
88
|
+
icon = (0, _jsxRuntime.jsx)(_editor.SquareAudio, {});
|
|
89
|
+
embedResource = true;
|
|
90
|
+
break;
|
|
91
|
+
case contentTypes.resourceTypeMapping.video:
|
|
92
|
+
icon = (0, _jsxRuntime.jsx)(_editor.SquareVideo, {});
|
|
93
|
+
embedResource = true;
|
|
94
|
+
break;
|
|
95
|
+
case contentTypes.resourceTypeMapping.concept:
|
|
96
|
+
icon = (0, _jsxRuntime.jsx)(_editor.Concept, {});
|
|
97
|
+
embedResource = true;
|
|
98
|
+
break;
|
|
87
99
|
default:
|
|
88
100
|
break;
|
|
89
101
|
}
|
|
102
|
+
if (embedResource) {
|
|
103
|
+
modifiers.push('embed-resource');
|
|
104
|
+
}
|
|
105
|
+
if (background || embedResource) {
|
|
106
|
+
modifiers.push('background');
|
|
107
|
+
}
|
|
108
|
+
if (border) {
|
|
109
|
+
modifiers.push('border');
|
|
110
|
+
}
|
|
90
111
|
return (0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, classes('', modifiers, className)), {}, {
|
|
91
112
|
children: icon
|
|
92
113
|
}));
|
|
@@ -7,14 +7,15 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { AudioMetaData } from '@ndla/types-embed';
|
|
9
9
|
import { Author } from './ImageEmbed';
|
|
10
|
+
import { HeartButtonType } from './types';
|
|
10
11
|
interface Props {
|
|
11
12
|
embed: AudioMetaData;
|
|
12
|
-
|
|
13
|
+
heartButton?: HeartButtonType;
|
|
13
14
|
}
|
|
14
15
|
export declare const getFirstNonEmptyLicenseCredits: (authors: {
|
|
15
16
|
creators: Author[];
|
|
16
17
|
rightsholders: Author[];
|
|
17
18
|
processors: Author[];
|
|
18
19
|
}) => Author[];
|
|
19
|
-
declare const AudioEmbed: ({ embed,
|
|
20
|
+
declare const AudioEmbed: ({ embed, heartButton: HeartButton }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
20
21
|
export default AudioEmbed;
|
package/lib/Embed/AudioEmbed.js
CHANGED
|
@@ -4,30 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getFirstNonEmptyLicenseCredits = exports["default"] = void 0;
|
|
7
|
-
var _licenses = require("@ndla/licenses");
|
|
8
|
-
var _modal = require("@ndla/modal");
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var _reactI18next = require("react-i18next");
|
|
11
7
|
var _remarkable = require("remarkable");
|
|
12
|
-
var _button = require("@ndla/button");
|
|
13
|
-
var _safelink = require("@ndla/safelink");
|
|
14
8
|
var _AudioPlayer = _interopRequireDefault(require("../AudioPlayer"));
|
|
15
9
|
var _Figure = require("../Figure");
|
|
16
|
-
var
|
|
10
|
+
var _LicenseByline = require("../LicenseByline");
|
|
11
|
+
var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
|
|
17
12
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
18
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
*/ //@ts-ignore
|
|
14
|
+
/**
|
|
15
|
+
* Copyright (c) 2023-present, NDLA.
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
//@ts-ignore
|
|
23
|
+
|
|
31
24
|
var getFirstNonEmptyLicenseCredits = function getFirstNonEmptyLicenseCredits(authors) {
|
|
32
25
|
var _Object$values$find;
|
|
33
26
|
return (_Object$values$find = Object.values(authors).find(function (i) {
|
|
@@ -44,38 +37,29 @@ var renderMarkdown = function renderMarkdown(text) {
|
|
|
44
37
|
}
|
|
45
38
|
});
|
|
46
39
|
};
|
|
40
|
+
var imageMetaToMockEmbed = function imageMetaToMockEmbed(imageMeta) {
|
|
41
|
+
var _imageMeta$data$image, _imageMeta$data$image2, _imageMeta$data$image3, _imageMeta$data$image4;
|
|
42
|
+
return {
|
|
43
|
+
resource: 'image',
|
|
44
|
+
status: 'success',
|
|
45
|
+
// Make sure the seq is unused. It's rarely used, but it's nice to ensure uniqueness.
|
|
46
|
+
seq: imageMeta.seq + 0.1,
|
|
47
|
+
// We check that this exists where the function is used.
|
|
48
|
+
data: imageMeta.data.imageMeta,
|
|
49
|
+
embedData: {
|
|
50
|
+
resource: 'image',
|
|
51
|
+
resourceId: ((_imageMeta$data$image = imageMeta.data.imageMeta) === null || _imageMeta$data$image === void 0 ? void 0 : (_imageMeta$data$image2 = _imageMeta$data$image.id) === null || _imageMeta$data$image2 === void 0 ? void 0 : _imageMeta$data$image2.toString()) || '',
|
|
52
|
+
alt: (_imageMeta$data$image3 = (_imageMeta$data$image4 = imageMeta.data.imageMeta) === null || _imageMeta$data$image4 === void 0 ? void 0 : _imageMeta$data$image4.alttext.alttext) !== null && _imageMeta$data$image3 !== void 0 ? _imageMeta$data$image3 : ''
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
47
56
|
var AudioEmbed = function AudioEmbed(_ref) {
|
|
48
|
-
var _data$podcastMeta
|
|
57
|
+
var _data$manuscript, _data$podcastMeta, _data$podcastMeta$int, _data$podcastMeta2;
|
|
49
58
|
var embed = _ref.embed,
|
|
50
|
-
|
|
51
|
-
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
52
|
-
t = _useTranslation.t,
|
|
53
|
-
i18n = _useTranslation.i18n;
|
|
54
|
-
var _useState = (0, _react.useState)(false),
|
|
55
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
56
|
-
isOpen = _useState2[0],
|
|
57
|
-
setIsOpen = _useState2[1];
|
|
59
|
+
HeartButton = _ref.heartButton;
|
|
58
60
|
if (embed.status === 'error') {
|
|
59
|
-
return (0, _jsxRuntime.
|
|
60
|
-
|
|
61
|
-
fill: "#8A8888",
|
|
62
|
-
height: "50",
|
|
63
|
-
viewBox: "0 0 24 12",
|
|
64
|
-
width: "100%",
|
|
65
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
66
|
-
style: {
|
|
67
|
-
backgroundColor: '#EFF0F2'
|
|
68
|
-
},
|
|
69
|
-
children: [(0, _jsxRuntime.jsx)("path", {
|
|
70
|
-
d: "M0 0h24v24H0V0z",
|
|
71
|
-
fill: "none"
|
|
72
|
-
}), (0, _jsxRuntime.jsx)("path", {
|
|
73
|
-
transform: "scale(0.3) translate(28, 8.5)",
|
|
74
|
-
d: "M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
|
75
|
-
})]
|
|
76
|
-
}), (0, _jsxRuntime.jsx)("figcaption", {
|
|
77
|
-
children: t('audio.error.caption')
|
|
78
|
-
})]
|
|
61
|
+
return (0, _jsxRuntime.jsx)(_EmbedErrorPlaceholder["default"], {
|
|
62
|
+
type: embed.embedData.type === 'standard' ? 'audio' : 'podcast'
|
|
79
63
|
});
|
|
80
64
|
}
|
|
81
65
|
var data = embed.data,
|
|
@@ -92,166 +76,43 @@ var AudioEmbed = function AudioEmbed(_ref) {
|
|
|
92
76
|
title: data.series.title.title,
|
|
93
77
|
url: "/podkast/".concat(data.series.id)
|
|
94
78
|
} : undefined;
|
|
95
|
-
var textVersion = data.manuscript && renderMarkdown(data.manuscript.manuscript);
|
|
96
|
-
var
|
|
97
|
-
var coverPhoto = (_data$podcastMeta2 = data.podcastMeta) === null || _data$podcastMeta2 === void 0 ? void 0 : _data$podcastMeta2.coverPhoto;
|
|
79
|
+
var textVersion = (_data$manuscript = data.manuscript) !== null && _data$manuscript !== void 0 && _data$manuscript.manuscript.length ? renderMarkdown(data.manuscript.manuscript) : undefined;
|
|
80
|
+
var coverPhoto = (_data$podcastMeta = data.podcastMeta) === null || _data$podcastMeta === void 0 ? void 0 : _data$podcastMeta.coverPhoto;
|
|
98
81
|
var img = coverPhoto && {
|
|
99
82
|
url: coverPhoto.url,
|
|
100
83
|
alt: coverPhoto.altText
|
|
101
84
|
};
|
|
102
|
-
var authors = (0, _licenses.getLicenseCredits)(data.copyright);
|
|
103
|
-
var license = (0, _licenses.getLicenseByAbbreviation)(data.copyright.license.license, i18n.language);
|
|
104
|
-
var contributors = (0, _licenses.getGroupedContributorDescriptionList)(data.copyright, i18n.language).map(function (item) {
|
|
105
|
-
return {
|
|
106
|
-
name: item.description,
|
|
107
|
-
type: item.label
|
|
108
|
-
};
|
|
109
|
-
});
|
|
110
85
|
var figureId = "figure-".concat(seq, "-").concat(data.id);
|
|
111
|
-
var copyString = data.audioType === 'podcast' ? (0, _licenses.figureApa7CopyString)(data.title.title, undefined, data.audioFile.url, articlePath, data.copyright, data.copyright.license.license, '', function (id) {
|
|
112
|
-
return t(id);
|
|
113
|
-
}, i18n.language) : undefined;
|
|
114
|
-
var captionAuthors = getFirstNonEmptyLicenseCredits(authors);
|
|
115
86
|
return (0, _jsxRuntime.jsxs)(_Figure.Figure, {
|
|
116
87
|
id: figureId,
|
|
117
88
|
type: "full",
|
|
118
89
|
children: [(0, _jsxRuntime.jsx)(_AudioPlayer["default"], {
|
|
119
|
-
description:
|
|
90
|
+
description: (_data$podcastMeta$int = (_data$podcastMeta2 = data.podcastMeta) === null || _data$podcastMeta2 === void 0 ? void 0 : _data$podcastMeta2.introduction) !== null && _data$podcastMeta$int !== void 0 ? _data$podcastMeta$int : '',
|
|
120
91
|
img: img,
|
|
121
92
|
src: data.audioFile.url,
|
|
122
93
|
textVersion: textVersion,
|
|
123
94
|
title: data.title.title,
|
|
124
95
|
subtitle: subtitle
|
|
125
|
-
}), (0, _jsxRuntime.jsx)(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}), (0, _jsxRuntime.jsx)(_modal.ModalV2, {
|
|
141
|
-
controlled: true,
|
|
142
|
-
isOpen: isOpen,
|
|
143
|
-
onClose: function onClose() {
|
|
144
|
-
return setIsOpen(false);
|
|
145
|
-
},
|
|
146
|
-
labelledBy: "license-dialog-rules-heading",
|
|
147
|
-
children: function children(close) {
|
|
148
|
-
return (0, _jsxRuntime.jsx)(_FigureLicenseDialogContent.FigureLicenseDialogContent, {
|
|
149
|
-
onClose: close,
|
|
150
|
-
title: data.title.title,
|
|
151
|
-
license: license,
|
|
152
|
-
authors: contributors,
|
|
153
|
-
origin: data.copyright.origin,
|
|
154
|
-
locale: i18n.language,
|
|
155
|
-
type: "audio",
|
|
156
|
-
children: data.copyright.license.license !== 'COPYRIGHT' && (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
157
|
-
children: [copyString && (0, _jsxRuntime.jsx)(_button.CopyButton, {
|
|
158
|
-
variant: "outline",
|
|
159
|
-
copyNode: t('license.hasCopiedTitle'),
|
|
160
|
-
onClick: function onClick() {
|
|
161
|
-
return navigator.clipboard.writeText(copyString);
|
|
162
|
-
},
|
|
163
|
-
children: t('license.copyTitle')
|
|
164
|
-
}), (0, _jsxRuntime.jsx)(_safelink.SafeLinkButton, {
|
|
165
|
-
download: true,
|
|
166
|
-
to: data.audioFile.url,
|
|
167
|
-
variant: "outline",
|
|
168
|
-
children: t('audio.download')
|
|
169
|
-
})]
|
|
170
|
-
})
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}), data.imageMeta && (0, _jsxRuntime.jsx)(ImageLicense, {
|
|
174
|
-
title: data.imageMeta.title.title,
|
|
175
|
-
imageUrl: data.imageMeta.imageUrl,
|
|
96
|
+
}), (0, _jsxRuntime.jsx)(_LicenseByline.EmbedByline, {
|
|
97
|
+
error: false,
|
|
98
|
+
type: embedData.type === 'standard' ? 'audio' : 'podcast',
|
|
99
|
+
topRounded: false,
|
|
100
|
+
bottomRounded: !data.imageMeta,
|
|
101
|
+
copyright: embed.data.copyright,
|
|
102
|
+
children: HeartButton && (0, _jsxRuntime.jsx)(HeartButton, {
|
|
103
|
+
embed: embed
|
|
104
|
+
})
|
|
105
|
+
}), data.imageMeta && (0, _jsxRuntime.jsx)(_LicenseByline.EmbedByline, {
|
|
106
|
+
error: false,
|
|
107
|
+
first: false,
|
|
108
|
+
type: "image",
|
|
109
|
+
topRounded: false,
|
|
110
|
+
bottomRounded: true,
|
|
176
111
|
copyright: data.imageMeta.copyright,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
var ImageLicense = function ImageLicense(_ref2) {
|
|
182
|
-
var articlePath = _ref2.articlePath,
|
|
183
|
-
title = _ref2.title,
|
|
184
|
-
imageUrl = _ref2.imageUrl,
|
|
185
|
-
copyright = _ref2.copyright;
|
|
186
|
-
var _useTranslation2 = (0, _reactI18next.useTranslation)(),
|
|
187
|
-
t = _useTranslation2.t,
|
|
188
|
-
i18n = _useTranslation2.i18n;
|
|
189
|
-
var _useState3 = (0, _react.useState)(false),
|
|
190
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
191
|
-
isOpen = _useState4[0],
|
|
192
|
-
setIsOpen = _useState4[1];
|
|
193
|
-
var copyString = (0, _licenses.figureApa7CopyString)(title, undefined, imageUrl, articlePath, copyright, copyright.license.license, undefined, function (id) {
|
|
194
|
-
return t(id);
|
|
195
|
-
}, i18n.language);
|
|
196
|
-
var license = (0, _licenses.getLicenseByAbbreviation)(copyright.license.license, i18n.language);
|
|
197
|
-
var authors = (0, _licenses.getLicenseCredits)(copyright);
|
|
198
|
-
var contributors = (0, _licenses.getGroupedContributorDescriptionList)(copyright, i18n.language).map(function (item) {
|
|
199
|
-
return {
|
|
200
|
-
name: item.description,
|
|
201
|
-
type: item.label
|
|
202
|
-
};
|
|
203
|
-
});
|
|
204
|
-
var captionAuthors = getFirstNonEmptyLicenseCredits(authors);
|
|
205
|
-
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
206
|
-
children: (0, _jsxRuntime.jsx)(_Figure.FigureCaption, {
|
|
207
|
-
figureId: "",
|
|
208
|
-
id: "",
|
|
209
|
-
licenseRights: license.rights,
|
|
210
|
-
modalButton: (0, _jsxRuntime.jsx)(_button.ButtonV2, {
|
|
211
|
-
variant: "outline",
|
|
212
|
-
shape: "pill",
|
|
213
|
-
size: "small",
|
|
214
|
-
onClick: function onClick() {
|
|
215
|
-
return setIsOpen(true);
|
|
216
|
-
},
|
|
217
|
-
children: t('image.reuse')
|
|
218
|
-
}),
|
|
219
|
-
authors: captionAuthors,
|
|
220
|
-
locale: i18n.language,
|
|
221
|
-
children: (0, _jsxRuntime.jsx)(_modal.ModalV2, {
|
|
222
|
-
controlled: true,
|
|
223
|
-
isOpen: isOpen,
|
|
224
|
-
onClose: function onClose() {
|
|
225
|
-
return setIsOpen(false);
|
|
226
|
-
},
|
|
227
|
-
children: function children(close) {
|
|
228
|
-
return (0, _jsxRuntime.jsx)(_FigureLicenseDialogContent.FigureLicenseDialogContent, {
|
|
229
|
-
onClose: close,
|
|
230
|
-
title: title,
|
|
231
|
-
license: license,
|
|
232
|
-
authors: contributors,
|
|
233
|
-
origin: copyright.origin,
|
|
234
|
-
locale: i18n.language,
|
|
235
|
-
type: "image",
|
|
236
|
-
children: copyright.license.license !== 'COPYRIGHTED' && (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
237
|
-
children: [copyString && (0, _jsxRuntime.jsx)(_button.CopyButton, {
|
|
238
|
-
variant: "outline",
|
|
239
|
-
copyNode: t('license.hasCopiedTitle'),
|
|
240
|
-
onClick: function onClick() {
|
|
241
|
-
return navigator.clipboard.writeText(copyString);
|
|
242
|
-
},
|
|
243
|
-
children: t('license.copyTitle')
|
|
244
|
-
}), (0, _jsxRuntime.jsx)(_safelink.SafeLinkButton, {
|
|
245
|
-
download: true,
|
|
246
|
-
to: imageUrl,
|
|
247
|
-
variant: "outline",
|
|
248
|
-
children: t('image.download')
|
|
249
|
-
})]
|
|
250
|
-
})
|
|
251
|
-
});
|
|
252
|
-
}
|
|
112
|
+
children: HeartButton && (0, _jsxRuntime.jsx)(HeartButton, {
|
|
113
|
+
embed: imageMetaToMockEmbed(embed)
|
|
253
114
|
})
|
|
254
|
-
})
|
|
115
|
+
})]
|
|
255
116
|
});
|
|
256
117
|
};
|
|
257
118
|
var _default = AudioEmbed;
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import { BrightcoveMetaData } from '@ndla/types-embed';
|
|
9
|
+
import { HeartButtonType } from './types';
|
|
9
10
|
interface Props {
|
|
10
11
|
embed: BrightcoveMetaData;
|
|
11
12
|
isConcept?: boolean;
|
|
13
|
+
heartButton?: HeartButtonType;
|
|
12
14
|
}
|
|
13
15
|
export declare const makeIframeString: (url: string, width: string | number, height: string | number, title?: string) => string;
|
|
14
16
|
export declare const isNumeric: (value: any) => boolean;
|
|
15
|
-
declare const BrightcoveEmbed: ({ embed, isConcept }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare const BrightcoveEmbed: ({ embed, isConcept, heartButton: HeartButton }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
16
18
|
export default BrightcoveEmbed;
|