@ndla/ui 34.6.2 → 34.6.4

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.
Files changed (153) hide show
  1. package/es/Article/Article.js +11 -6
  2. package/es/Aside/Aside.js +5 -2
  3. package/es/CopyParagraphButton/CopyParagraphButtonV2.js +85 -0
  4. package/es/CopyParagraphButton/index.js +2 -1
  5. package/es/Embed/AudioEmbed.js +254 -0
  6. package/es/Embed/BrightcoveEmbed.js +250 -0
  7. package/es/Embed/ConceptEmbed.js +359 -0
  8. package/es/Embed/ConceptListEmbed.js +71 -0
  9. package/es/Embed/ContentLinkEmbed.js +42 -0
  10. package/es/Embed/ExternalEmbed.js +91 -0
  11. package/es/Embed/FootnoteEmbed.js +32 -0
  12. package/es/Embed/H5pEmbed.js +87 -0
  13. package/es/Embed/IframeEmbed.js +83 -0
  14. package/es/Embed/ImageEmbed.js +322 -0
  15. package/es/Embed/RelatedContentEmbed.js +58 -0
  16. package/es/Embed/UnknownEmbed.js +27 -0
  17. package/es/Embed/conceptComponents.js +282 -0
  18. package/es/Embed/index.js +21 -0
  19. package/es/FactBox/FactBoxV2.js +90 -0
  20. package/es/FactBox/index.js +1 -0
  21. package/es/Figure/Figure.js +8 -5
  22. package/es/Figure/FigureLicenseDialogContent.js +72 -0
  23. package/es/FileList/FileListV2.js +47 -0
  24. package/es/FileList/FileV2.js +34 -0
  25. package/es/FileList/PdfFile.js +25 -0
  26. package/es/FileList/index.js +3 -0
  27. package/es/Notion/Notion.js +5 -5
  28. package/es/Notion/NotionVisualElement.js +2 -2
  29. package/es/RelatedArticleList/RelatedArticleV2.js +101 -0
  30. package/es/RelatedArticleList/index.js +2 -1
  31. package/es/Table/Table.js +95 -8
  32. package/es/all.css +1 -1
  33. package/es/index.js +5 -4
  34. package/es/locale/messages-en.js +32 -2
  35. package/es/locale/messages-nb.js +32 -2
  36. package/es/locale/messages-nn.js +32 -2
  37. package/es/locale/messages-se.js +32 -2
  38. package/es/locale/messages-sma.js +32 -2
  39. package/lib/Article/Article.d.ts +2 -1
  40. package/lib/Article/Article.js +11 -6
  41. package/lib/Aside/Aside.d.ts +2 -1
  42. package/lib/Aside/Aside.js +5 -2
  43. package/lib/CopyParagraphButton/CopyParagraphButtonV2.d.ts +14 -0
  44. package/lib/CopyParagraphButton/CopyParagraphButtonV2.js +84 -0
  45. package/lib/CopyParagraphButton/index.d.ts +2 -1
  46. package/lib/CopyParagraphButton/index.js +7 -0
  47. package/lib/Embed/AudioEmbed.d.ts +20 -0
  48. package/lib/Embed/AudioEmbed.js +252 -0
  49. package/lib/Embed/BrightcoveEmbed.d.ts +16 -0
  50. package/lib/Embed/BrightcoveEmbed.js +250 -0
  51. package/lib/Embed/ConceptEmbed.d.ts +19 -0
  52. package/lib/Embed/ConceptEmbed.js +359 -0
  53. package/lib/Embed/ConceptListEmbed.d.ts +13 -0
  54. package/lib/Embed/ConceptListEmbed.js +70 -0
  55. package/lib/Embed/ContentLinkEmbed.d.ts +14 -0
  56. package/lib/Embed/ContentLinkEmbed.js +50 -0
  57. package/lib/Embed/ExternalEmbed.d.ts +14 -0
  58. package/lib/Embed/ExternalEmbed.js +90 -0
  59. package/lib/Embed/FootnoteEmbed.d.ts +13 -0
  60. package/lib/Embed/FootnoteEmbed.js +39 -0
  61. package/lib/Embed/H5pEmbed.d.ts +14 -0
  62. package/lib/Embed/H5pEmbed.js +86 -0
  63. package/lib/Embed/IframeEmbed.d.ts +14 -0
  64. package/lib/Embed/IframeEmbed.js +91 -0
  65. package/lib/Embed/ImageEmbed.d.ts +37 -0
  66. package/lib/Embed/ImageEmbed.js +326 -0
  67. package/lib/Embed/RelatedContentEmbed.d.ts +16 -0
  68. package/lib/Embed/RelatedContentEmbed.js +64 -0
  69. package/lib/Embed/UnknownEmbed.d.ts +13 -0
  70. package/lib/Embed/UnknownEmbed.js +35 -0
  71. package/lib/Embed/conceptComponents.d.ts +32 -0
  72. package/lib/Embed/conceptComponents.js +280 -0
  73. package/lib/Embed/index.d.ts +20 -0
  74. package/lib/Embed/index.js +97 -0
  75. package/lib/FactBox/FactBoxV2.d.ts +13 -0
  76. package/lib/FactBox/FactBoxV2.js +92 -0
  77. package/lib/FactBox/index.d.ts +1 -0
  78. package/lib/FactBox/index.js +7 -0
  79. package/lib/Figure/Figure.d.ts +5 -2
  80. package/lib/Figure/Figure.js +8 -5
  81. package/lib/Figure/FigureLicenseDialogContent.d.ts +22 -0
  82. package/lib/Figure/FigureLicenseDialogContent.js +71 -0
  83. package/lib/FileList/FileListV2.d.ts +13 -0
  84. package/lib/FileList/FileListV2.js +46 -0
  85. package/lib/FileList/FileV2.d.ts +16 -0
  86. package/lib/FileList/FileV2.js +42 -0
  87. package/lib/FileList/PdfFile.d.ts +13 -0
  88. package/lib/FileList/PdfFile.js +31 -0
  89. package/lib/FileList/index.d.ts +3 -0
  90. package/lib/FileList/index.js +21 -0
  91. package/lib/Notion/Notion.js +5 -5
  92. package/lib/Notion/NotionVisualElement.d.ts +1 -1
  93. package/lib/Notion/NotionVisualElement.js +2 -2
  94. package/lib/RelatedArticleList/RelatedArticleV2.d.ts +25 -0
  95. package/lib/RelatedArticleList/RelatedArticleV2.js +101 -0
  96. package/lib/RelatedArticleList/index.d.ts +2 -1
  97. package/lib/RelatedArticleList/index.js +7 -0
  98. package/lib/Table/Table.js +98 -8
  99. package/lib/all.css +1 -1
  100. package/lib/index.d.ts +5 -4
  101. package/lib/index.js +117 -2
  102. package/lib/locale/messages-en.d.ts +30 -0
  103. package/lib/locale/messages-en.js +32 -2
  104. package/lib/locale/messages-nb.d.ts +30 -0
  105. package/lib/locale/messages-nb.js +32 -2
  106. package/lib/locale/messages-nn.d.ts +30 -0
  107. package/lib/locale/messages-nn.js +32 -2
  108. package/lib/locale/messages-se.d.ts +30 -0
  109. package/lib/locale/messages-se.js +32 -2
  110. package/lib/locale/messages-sma.d.ts +30 -0
  111. package/lib/locale/messages-sma.js +32 -2
  112. package/lib/types.d.ts +1 -1
  113. package/package.json +16 -12
  114. package/src/Article/Article.tsx +8 -3
  115. package/src/Aside/Aside.tsx +9 -1
  116. package/src/Aside/component.aside.scss +3 -0
  117. package/src/CopyParagraphButton/CopyParagraphButtonV2.tsx +84 -0
  118. package/src/CopyParagraphButton/index.tsx +2 -1
  119. package/src/Embed/AudioEmbed.tsx +249 -0
  120. package/src/Embed/BrightcoveEmbed.tsx +203 -0
  121. package/src/Embed/ConceptEmbed.tsx +403 -0
  122. package/src/Embed/ConceptListEmbed.tsx +64 -0
  123. package/src/Embed/ContentLinkEmbed.tsx +41 -0
  124. package/src/Embed/ExternalEmbed.tsx +80 -0
  125. package/src/Embed/FootnoteEmbed.tsx +30 -0
  126. package/src/Embed/H5pEmbed.tsx +74 -0
  127. package/src/Embed/IframeEmbed.tsx +84 -0
  128. package/src/Embed/ImageEmbed.tsx +314 -0
  129. package/src/Embed/RelatedContentEmbed.tsx +62 -0
  130. package/src/Embed/UnknownEmbed.tsx +27 -0
  131. package/src/Embed/conceptComponents.tsx +393 -0
  132. package/src/Embed/index.ts +21 -0
  133. package/src/FactBox/FactBoxV2.tsx +56 -0
  134. package/src/FactBox/index.ts +2 -0
  135. package/src/Figure/Figure.tsx +28 -15
  136. package/src/Figure/FigureLicenseDialogContent.tsx +80 -0
  137. package/src/Figure/component.figure.scss +0 -1
  138. package/src/FileList/FileListV2.tsx +58 -0
  139. package/src/FileList/FileV2.tsx +35 -0
  140. package/src/FileList/PdfFile.tsx +25 -0
  141. package/src/FileList/index.ts +3 -0
  142. package/src/Notion/Notion.tsx +0 -1
  143. package/src/Notion/NotionVisualElement.tsx +1 -1
  144. package/src/RelatedArticleList/RelatedArticleV2.tsx +84 -0
  145. package/src/RelatedArticleList/index.ts +2 -1
  146. package/src/Table/Table.tsx +77 -4
  147. package/src/index.ts +19 -4
  148. package/src/locale/messages-en.ts +33 -0
  149. package/src/locale/messages-nb.ts +33 -0
  150. package/src/locale/messages-nn.ts +33 -0
  151. package/src/locale/messages-se.ts +33 -0
  152. package/src/locale/messages-sma.ts +33 -0
  153. package/src/types.ts +1 -1
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _base = _interopRequireDefault(require("@emotion/styled/base"));
8
+ var _react = require("react");
9
+ var _reactI18next = require("react-i18next");
10
+ var _core = require("@ndla/core");
11
+ var _tooltip = _interopRequireDefault(require("@ndla/tooltip"));
12
+ var _common = require("@ndla/icons/common");
13
+ var _util = require("@ndla/util");
14
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
16
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
17
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
18
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
19
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
20
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
21
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
23
+ var ContainerDiv = /*#__PURE__*/(0, _base["default"])("div", {
24
+ target: "esvy8zq1",
25
+ label: "ContainerDiv"
26
+ })(process.env.NODE_ENV === "production" ? {
27
+ name: "bjn8wh",
28
+ styles: "position:relative"
29
+ } : {
30
+ name: "bjn8wh",
31
+ styles: "position:relative",
32
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvcHlQYXJhZ3JhcGhCdXR0b25WMi50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBZ0IrQiIsImZpbGUiOiJDb3B5UGFyYWdyYXBoQnV0dG9uVjIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjEtcHJlc2VudCwgTkRMQS5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBHUEx2MyBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqL1xuXG5pbXBvcnQgeyBNb3VzZUV2ZW50LCBSZWFjdE5vZGUsIHVzZUNhbGxiYWNrLCB1c2VFZmZlY3QsIHVzZU1lbW8sIHVzZVN0YXRlIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tICdyZWFjdC1pMThuZXh0JztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVk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Rpdj5cbiAgICAgIDxUb29sdGlwIHRvb2x0aXA9e3Rvb2x0aXB9PlxuICAgICAgICA8SWNvbkJ1dHRvbiBvbkNsaWNrPXtvbkNvcHlDbGlja30gYXJpYS1sYWJlbD17YCR7dG9vbHRpcH06ICR7Y29weVRleHR9YH0+XG4gICAgICAgICAgPExpbmsgLz5cbiAgICAgICAgPC9JY29uQnV0dG9uPlxuICAgICAgPC9Ub29sdGlwPlxuICAgICAgPGgyIGlkPXtzYW5pdGl6ZWRUaXRsZX0gdGFiSW5kZXg9ey0xfT5cbiAgICAgICAge2NoaWxkcmVufVxuICAgICAgPC9oMj5cbiAgICA8L0NvbnRhaW5lckRpdj5cbiAgKTtcbn07XG5cbmV4cG9ydCBkZWZhdWx0IENvcHlQYXJhZ3JhcGhCdXR0b25WMjtcbiJdfQ== */",
33
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
34
+ });
35
+ var IconButton = /*#__PURE__*/(0, _base["default"])("button", {
36
+ target: "esvy8zq0",
37
+ label: "IconButton"
38
+ })("position:absolute;left:-3em;top:0.1em;background:none;border:0;z-index:1;transition:0.2s;opacity:0;color:", _core.colors.brand.grey, ";& svg{width:30px;height:30px;}", ContainerDiv, ":hover &,&:focus,&:focus-visible,&:active{cursor:pointer;opacity:1;}" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvcHlQYXJhZ3JhcGhCdXR0b25WMi50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBbUJnQyIsImZpbGUiOiJDb3B5UGFyYWdyYXBoQnV0dG9uVjIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjEtcHJlc2VudCwgTkRMQS5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBHUEx2MyBsaWNl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JHtsb2NhdGlvbi5ob3N0bmFtZX0ke3BvcnR9JHtsb2NhdGlvbi5wYXRobmFtZX0ke2xvY2F0aW9uLnNlYXJjaH0ke25ld0hhc2h9YDtcblxuICAgIGNvcHlUZXh0VG9DbGlwYm9hcmQodXJsVG9Db3B5KTtcbiAgfSwgW3Nhbml0aXplZFRpdGxlXSk7XG5cbiAgY29uc3QgdG9vbHRpcCA9IGhhc0NvcGllZCA/IHQoJ2FydGljbGUuY29weVBhZ2VMaW5rQ29waWVkJykgOiB0KCdhcnRpY2xlLmNvcHlIZWFkZXJMaW5rJyk7XG4gIHJldHVybiAoXG4gICAgPENvbnRhaW5lckRpdj5cbiAgICAgIDxUb29sdGlwIHRvb2x0aXA9e3Rvb2x0aXB9PlxuICAgICAgICA8SWNvbkJ1dHRvbiBvbkNsaWNrPXtvbkNvcHlDbGlja30gYXJpYS1sYWJlbD17YCR7dG9vbHRpcH06ICR7Y29weVRleHR9YH0+XG4gICAgICAgICAgPExpbmsgLz5cbiAgICAgICAgPC9JY29uQnV0dG9uPlxuICAgICAgPC9Ub29sdGlwPlxuICAgICAgPGgyIGlkPXtzYW5pdGl6ZWRUaXRsZX0gdGFiSW5kZXg9ey0xfT5cbiAgICAgICAge2NoaWxkcmVufVxuICAgICAgPC9oMj5cbiAgICA8L0NvbnRhaW5lckRpdj5cbiAgKTtcbn07XG5cbmV4cG9ydCBkZWZhdWx0IENvcHlQYXJhZ3JhcGhCdXR0b25WMjtcbiJdfQ== */"));
39
+ var CopyParagraphButtonV2 = function CopyParagraphButtonV2(_ref) {
40
+ var children = _ref.children,
41
+ copyText = _ref.copyText;
42
+ var _useState = (0, _react.useState)(false),
43
+ _useState2 = _slicedToArray(_useState, 2),
44
+ hasCopied = _useState2[0],
45
+ setHasCopied = _useState2[1];
46
+ var _useTranslation = (0, _reactI18next.useTranslation)(),
47
+ t = _useTranslation.t;
48
+ var sanitizedTitle = (0, _react.useMemo)(function () {
49
+ return encodeURIComponent(copyText.replace(/ /g, '-'));
50
+ }, [copyText]);
51
+ (0, _react.useEffect)(function () {
52
+ if (hasCopied) {
53
+ setTimeout(function () {
54
+ return setHasCopied(false);
55
+ }, 3000);
56
+ }
57
+ }, [hasCopied]);
58
+ var onCopyClick = (0, _react.useCallback)(function () {
59
+ setHasCopied(true);
60
+ var _window = window,
61
+ location = _window.location;
62
+ var newHash = "#".concat(sanitizedTitle);
63
+ var port = location.port ? ":".concat(location.port) : '';
64
+ var urlToCopy = "".concat(location.protocol, "//").concat(location.hostname).concat(port).concat(location.pathname).concat(location.search).concat(newHash);
65
+ (0, _util.copyTextToClipboard)(urlToCopy);
66
+ }, [sanitizedTitle]);
67
+ var tooltip = hasCopied ? t('article.copyPageLinkCopied') : t('article.copyHeaderLink');
68
+ return (0, _jsxRuntime.jsxs)(ContainerDiv, {
69
+ children: [(0, _jsxRuntime.jsx)(_tooltip["default"], {
70
+ tooltip: tooltip,
71
+ children: (0, _jsxRuntime.jsx)(IconButton, {
72
+ onClick: onCopyClick,
73
+ "aria-label": "".concat(tooltip, ": ").concat(copyText),
74
+ children: (0, _jsxRuntime.jsx)(_common.Link, {})
75
+ })
76
+ }), (0, _jsxRuntime.jsx)("h2", {
77
+ id: sanitizedTitle,
78
+ tabIndex: -1,
79
+ children: children
80
+ })]
81
+ });
82
+ };
83
+ var _default = CopyParagraphButtonV2;
84
+ exports["default"] = _default;
@@ -6,6 +6,7 @@
6
6
  *
7
7
  */
8
8
  import CopyParagraphButton from './CopyParagraphButton';
9
+ import CopyParagraphButtonV2 from './CopyParagraphButtonV2';
9
10
  import initCopyParagraphButtons from './initCopyParagraphButtons';
10
- export { CopyParagraphButton, initCopyParagraphButtons };
11
+ export { CopyParagraphButton, initCopyParagraphButtons, CopyParagraphButtonV2 };
11
12
  export default CopyParagraphButton;
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "CopyParagraphButton", {
9
9
  return _CopyParagraphButton["default"];
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "CopyParagraphButtonV2", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _CopyParagraphButtonV["default"];
16
+ }
17
+ });
12
18
  exports["default"] = void 0;
13
19
  Object.defineProperty(exports, "initCopyParagraphButtons", {
14
20
  enumerable: true,
@@ -17,6 +23,7 @@ Object.defineProperty(exports, "initCopyParagraphButtons", {
17
23
  }
18
24
  });
19
25
  var _CopyParagraphButton = _interopRequireDefault(require("./CopyParagraphButton"));
26
+ var _CopyParagraphButtonV = _interopRequireDefault(require("./CopyParagraphButtonV2"));
20
27
  var _initCopyParagraphButtons = _interopRequireDefault(require("./initCopyParagraphButtons"));
21
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
22
29
  /**
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) 2023-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import { AudioMetaData } from '@ndla/types-embed';
9
+ import { Author } from './ImageEmbed';
10
+ interface Props {
11
+ embed: AudioMetaData;
12
+ articlePath?: string;
13
+ }
14
+ export declare const getFirstNonEmptyLicenseCredits: (authors: {
15
+ creators: Author[];
16
+ rightsholders: Author[];
17
+ processors: Author[];
18
+ }) => Author[];
19
+ declare const AudioEmbed: ({ embed, articlePath }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
20
+ export default AudioEmbed;
@@ -0,0 +1,252 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
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
+ var _remarkable = require("remarkable");
12
+ var _button = require("@ndla/button");
13
+ var _safelink = require("@ndla/safelink");
14
+ var _AudioPlayer = _interopRequireDefault(require("../AudioPlayer"));
15
+ var _Figure = require("../Figure");
16
+ var _FigureLicenseDialogContent = require("../Figure/FigureLicenseDialogContent");
17
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
22
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
23
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
24
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
+ var getFirstNonEmptyLicenseCredits = function getFirstNonEmptyLicenseCredits(authors) {
26
+ var _Object$values$find;
27
+ return (_Object$values$find = Object.values(authors).find(function (i) {
28
+ return i.length > 0;
29
+ })) !== null && _Object$values$find !== void 0 ? _Object$values$find : [];
30
+ };
31
+ exports.getFirstNonEmptyLicenseCredits = getFirstNonEmptyLicenseCredits;
32
+ var renderMarkdown = function renderMarkdown(text) {
33
+ var md = new _remarkable.Remarkable();
34
+ var rendered = md.render(text);
35
+ return (0, _jsxRuntime.jsx)("span", {
36
+ dangerouslySetInnerHTML: {
37
+ __html: rendered
38
+ }
39
+ });
40
+ };
41
+ var AudioEmbed = function AudioEmbed(_ref) {
42
+ var _data$podcastMeta$int, _data$podcastMeta, _data$podcastMeta2;
43
+ var embed = _ref.embed,
44
+ articlePath = _ref.articlePath;
45
+ var _useTranslation = (0, _reactI18next.useTranslation)(),
46
+ t = _useTranslation.t,
47
+ i18n = _useTranslation.i18n;
48
+ var _useState = (0, _react.useState)(false),
49
+ _useState2 = _slicedToArray(_useState, 2),
50
+ isOpen = _useState2[0],
51
+ setIsOpen = _useState2[1];
52
+ if (embed.status === 'error') {
53
+ return (0, _jsxRuntime.jsxs)(_Figure.Figure, {
54
+ children: [(0, _jsxRuntime.jsxs)("svg", {
55
+ fill: "#8A8888",
56
+ height: "50",
57
+ viewBox: "0 0 24 12",
58
+ width: "100%",
59
+ xmlns: "http://www.w3.org/2000/svg",
60
+ style: {
61
+ backgroundColor: '#EFF0F2'
62
+ },
63
+ children: [(0, _jsxRuntime.jsx)("path", {
64
+ d: "M0 0h24v24H0V0z",
65
+ fill: "none"
66
+ }), (0, _jsxRuntime.jsx)("path", {
67
+ transform: "scale(0.3) translate(28, 8.5)",
68
+ 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"
69
+ })]
70
+ }), (0, _jsxRuntime.jsx)("figcaption", {
71
+ children: t('audio.error.caption')
72
+ })]
73
+ });
74
+ }
75
+ var data = embed.data,
76
+ embedData = embed.embedData,
77
+ seq = embed.seq;
78
+ if (embedData.type === 'minimal') {
79
+ return (0, _jsxRuntime.jsx)(_AudioPlayer["default"], {
80
+ speech: true,
81
+ src: data.audioFile.url,
82
+ title: data.title.title
83
+ });
84
+ }
85
+ var subtitle = data.series ? {
86
+ title: data.series.title.title,
87
+ url: "/podkast/".concat(data.series.id)
88
+ } : undefined;
89
+ var textVersion = data.manuscript && renderMarkdown(data.manuscript.manuscript);
90
+ var description = renderMarkdown((_data$podcastMeta$int = (_data$podcastMeta = data.podcastMeta) === null || _data$podcastMeta === void 0 ? void 0 : _data$podcastMeta.introduction) !== null && _data$podcastMeta$int !== void 0 ? _data$podcastMeta$int : '');
91
+ var coverPhoto = (_data$podcastMeta2 = data.podcastMeta) === null || _data$podcastMeta2 === void 0 ? void 0 : _data$podcastMeta2.coverPhoto;
92
+ var img = coverPhoto && {
93
+ url: coverPhoto.url,
94
+ alt: coverPhoto.altText
95
+ };
96
+ var authors = (0, _licenses.getLicenseCredits)(data.copyright);
97
+ var license = (0, _licenses.getLicenseByAbbreviation)(data.copyright.license.license, i18n.language);
98
+ var contributors = (0, _licenses.getGroupedContributorDescriptionList)(data.copyright, i18n.language).map(function (item) {
99
+ return {
100
+ name: item.description,
101
+ type: item.label
102
+ };
103
+ });
104
+ var figureId = "figure-".concat(seq, "-").concat(data.id);
105
+ var copyString = data.audioType === 'podcast' ? (0, _licenses.figureApa7CopyString)(data.title.title, undefined, data.audioFile.url, articlePath, data.copyright, data.copyright.license.license, '', function (id) {
106
+ return t(id);
107
+ }, i18n.language) : undefined;
108
+ var captionAuthors = getFirstNonEmptyLicenseCredits(authors);
109
+ return (0, _jsxRuntime.jsxs)(_Figure.Figure, {
110
+ id: figureId,
111
+ type: "full",
112
+ children: [(0, _jsxRuntime.jsx)(_AudioPlayer["default"], {
113
+ description: description,
114
+ img: img,
115
+ src: data.audioFile.url,
116
+ textVersion: textVersion,
117
+ title: data.title.title,
118
+ subtitle: subtitle
119
+ }), (0, _jsxRuntime.jsx)(_Figure.FigureCaption, {
120
+ id: "",
121
+ figureId: "",
122
+ modalButton: (0, _jsxRuntime.jsx)(_button.ButtonV2, {
123
+ variant: "outline",
124
+ shape: "pill",
125
+ size: "small",
126
+ onClick: function onClick() {
127
+ return setIsOpen(true);
128
+ },
129
+ children: t('audio.reuse')
130
+ }),
131
+ licenseRights: license.rights,
132
+ authors: captionAuthors,
133
+ locale: i18n.language
134
+ }), (0, _jsxRuntime.jsx)(_modal.ModalV2, {
135
+ controlled: true,
136
+ isOpen: isOpen,
137
+ onClose: function onClose() {
138
+ return setIsOpen(false);
139
+ },
140
+ labelledBy: "license-dialog-rules-heading",
141
+ children: function children(close) {
142
+ return (0, _jsxRuntime.jsx)(_FigureLicenseDialogContent.FigureLicenseDialogContent, {
143
+ onClose: close,
144
+ title: data.title.title,
145
+ license: license,
146
+ authors: contributors,
147
+ origin: data.copyright.origin,
148
+ locale: i18n.language,
149
+ type: "audio",
150
+ children: data.copyright.license.license !== 'COPYRIGHT' && (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
151
+ children: [copyString && (0, _jsxRuntime.jsx)(_button.CopyButton, {
152
+ variant: "outline",
153
+ copyNode: t('license.hasCopiedTitle'),
154
+ onClick: function onClick() {
155
+ return navigator.clipboard.writeText(copyString);
156
+ },
157
+ children: t('license.copyTitle')
158
+ }), (0, _jsxRuntime.jsx)(_safelink.SafeLinkButton, {
159
+ download: true,
160
+ to: data.audioFile.url,
161
+ variant: "outline",
162
+ children: t('audio.download')
163
+ })]
164
+ })
165
+ });
166
+ }
167
+ }), data.imageMeta && (0, _jsxRuntime.jsx)(ImageLicense, {
168
+ title: data.imageMeta.title.title,
169
+ imageUrl: data.imageMeta.imageUrl,
170
+ copyright: data.imageMeta.copyright,
171
+ articlePath: articlePath
172
+ })]
173
+ });
174
+ };
175
+ var ImageLicense = function ImageLicense(_ref2) {
176
+ var articlePath = _ref2.articlePath,
177
+ title = _ref2.title,
178
+ imageUrl = _ref2.imageUrl,
179
+ copyright = _ref2.copyright;
180
+ var _useTranslation2 = (0, _reactI18next.useTranslation)(),
181
+ t = _useTranslation2.t,
182
+ i18n = _useTranslation2.i18n;
183
+ var _useState3 = (0, _react.useState)(false),
184
+ _useState4 = _slicedToArray(_useState3, 2),
185
+ isOpen = _useState4[0],
186
+ setIsOpen = _useState4[1];
187
+ var copyString = (0, _licenses.figureApa7CopyString)(title, undefined, imageUrl, articlePath, copyright, copyright.license.license, undefined, function (id) {
188
+ return t(id);
189
+ }, i18n.language);
190
+ var license = (0, _licenses.getLicenseByAbbreviation)(copyright.license.license, i18n.language);
191
+ var authors = (0, _licenses.getLicenseCredits)(copyright);
192
+ var contributors = (0, _licenses.getGroupedContributorDescriptionList)(copyright, i18n.language).map(function (item) {
193
+ return {
194
+ name: item.description,
195
+ type: item.label
196
+ };
197
+ });
198
+ var captionAuthors = getFirstNonEmptyLicenseCredits(authors);
199
+ return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
200
+ children: (0, _jsxRuntime.jsx)(_Figure.FigureCaption, {
201
+ figureId: "",
202
+ id: "",
203
+ licenseRights: license.rights,
204
+ modalButton: (0, _jsxRuntime.jsx)(_button.ButtonV2, {
205
+ variant: "outline",
206
+ shape: "pill",
207
+ size: "small",
208
+ onClick: function onClick() {
209
+ return setIsOpen(true);
210
+ },
211
+ children: t('image.reuse')
212
+ }),
213
+ authors: captionAuthors,
214
+ locale: i18n.language,
215
+ children: (0, _jsxRuntime.jsx)(_modal.ModalV2, {
216
+ controlled: true,
217
+ isOpen: isOpen,
218
+ onClose: function onClose() {
219
+ return setIsOpen(false);
220
+ },
221
+ children: function children(close) {
222
+ return (0, _jsxRuntime.jsx)(_FigureLicenseDialogContent.FigureLicenseDialogContent, {
223
+ onClose: close,
224
+ title: title,
225
+ license: license,
226
+ authors: contributors,
227
+ origin: copyright.origin,
228
+ locale: i18n.language,
229
+ type: "image",
230
+ children: copyright.license.license !== 'COPYRIGHTED' && (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
231
+ children: [copyString && (0, _jsxRuntime.jsx)(_button.CopyButton, {
232
+ variant: "outline",
233
+ copyNode: t('license.hasCopiedTitle'),
234
+ onClick: function onClick() {
235
+ return navigator.clipboard.writeText(copyString);
236
+ },
237
+ children: t('license.copyTitle')
238
+ }), (0, _jsxRuntime.jsx)(_safelink.SafeLinkButton, {
239
+ download: true,
240
+ to: imageUrl,
241
+ variant: "outline",
242
+ children: t('image.download')
243
+ })]
244
+ })
245
+ });
246
+ }
247
+ })
248
+ })
249
+ });
250
+ };
251
+ var _default = AudioEmbed;
252
+ exports["default"] = _default;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright (c) 2023-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import { BrightcoveMetaData } from '@ndla/types-embed';
9
+ interface Props {
10
+ embed: BrightcoveMetaData;
11
+ isConcept?: boolean;
12
+ }
13
+ export declare const makeIframeString: (url: string, width: string | number, height: string | number, title?: string) => string;
14
+ export declare const isNumeric: (value: any) => boolean;
15
+ declare const BrightcoveEmbed: ({ embed, isConcept }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
16
+ export default BrightcoveEmbed;