@ndla/ui 45.0.17 → 46.0.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.
Files changed (79) hide show
  1. package/es/Article/Article.js +3 -3
  2. package/es/AudioPlayer/index.js +0 -2
  3. package/es/Embed/conceptComponents.js +15 -8
  4. package/es/Figure/Figure.js +11 -89
  5. package/es/Figure/index.js +1 -3
  6. package/es/Notion/index.js +1 -3
  7. package/es/all.css +1 -1
  8. package/es/index.js +3 -4
  9. package/lib/Article/Article.js +3 -3
  10. package/lib/AudioPlayer/index.d.ts +0 -2
  11. package/lib/AudioPlayer/index.js +0 -7
  12. package/lib/Embed/conceptComponents.js +17 -10
  13. package/lib/Figure/Figure.d.ts +0 -38
  14. package/lib/Figure/Figure.js +20 -96
  15. package/lib/Figure/index.d.ts +1 -3
  16. package/lib/Figure/index.js +2 -17
  17. package/lib/Notion/index.d.ts +0 -4
  18. package/lib/Notion/index.js +0 -14
  19. package/lib/all.css +1 -1
  20. package/lib/index.d.ts +3 -5
  21. package/lib/index.js +1 -32
  22. package/package.json +18 -22
  23. package/src/Article/Article.tsx +1 -1
  24. package/src/AudioPlayer/AudiPlayer.stories.tsx +88 -0
  25. package/src/AudioPlayer/index.ts +0 -2
  26. package/src/Embed/IframeEmbed.stories.tsx +15 -0
  27. package/src/Embed/ImageEmbed.stories.tsx +169 -2
  28. package/src/Embed/RelatedContentEmbed.stories.tsx +438 -0
  29. package/src/Embed/conceptComponents.tsx +13 -1
  30. package/src/Figure/Figure.tsx +1 -120
  31. package/src/Figure/index.ts +1 -3
  32. package/src/Notion/index.ts +0 -4
  33. package/src/index.ts +3 -13
  34. package/src/main.scss +0 -1
  35. package/es/Animation/Fade.js +0 -62
  36. package/es/Animation/index.js +0 -1
  37. package/es/AudioPlayer/initAudioPlayers.js +0 -60
  38. package/es/Dialog/Dialog.js +0 -70
  39. package/es/Dialog/index.js +0 -11
  40. package/es/Figure/FigureLicense.js +0 -72
  41. package/es/Figure/FigureLicenseDialog.js +0 -54
  42. package/es/Notion/ConceptNotion.js +0 -135
  43. package/es/Notion/FigureNotion.js +0 -93
  44. package/es/Notion/NotionVisualElement.js +0 -68
  45. package/es/utils/createUniversalPortal.js +0 -25
  46. package/lib/Animation/Fade.d.ts +0 -17
  47. package/lib/Animation/Fade.js +0 -70
  48. package/lib/Animation/index.d.ts +0 -1
  49. package/lib/Animation/index.js +0 -13
  50. package/lib/AudioPlayer/initAudioPlayers.d.ts +0 -11
  51. package/lib/AudioPlayer/initAudioPlayers.js +0 -69
  52. package/lib/Dialog/Dialog.d.ts +0 -23
  53. package/lib/Dialog/Dialog.js +0 -75
  54. package/lib/Dialog/index.d.ts +0 -10
  55. package/lib/Dialog/index.js +0 -22
  56. package/lib/Figure/FigureLicense.d.ts +0 -33
  57. package/lib/Figure/FigureLicense.js +0 -76
  58. package/lib/Figure/FigureLicenseDialog.d.ts +0 -29
  59. package/lib/Figure/FigureLicenseDialog.js +0 -57
  60. package/lib/Notion/ConceptNotion.d.ts +0 -24
  61. package/lib/Notion/ConceptNotion.js +0 -141
  62. package/lib/Notion/FigureNotion.d.ts +0 -27
  63. package/lib/Notion/FigureNotion.js +0 -97
  64. package/lib/Notion/NotionVisualElement.d.ts +0 -22
  65. package/lib/Notion/NotionVisualElement.js +0 -75
  66. package/lib/utils/createUniversalPortal.d.ts +0 -9
  67. package/lib/utils/createUniversalPortal.js +0 -32
  68. package/src/Animation/Fade.tsx +0 -46
  69. package/src/Animation/index.ts +0 -1
  70. package/src/AudioPlayer/initAudioPlayers.tsx +0 -57
  71. package/src/Dialog/Dialog.tsx +0 -80
  72. package/src/Dialog/component.dialog.scss +0 -144
  73. package/src/Dialog/index.ts +0 -13
  74. package/src/Figure/FigureLicense.tsx +0 -75
  75. package/src/Figure/FigureLicenseDialog.tsx +0 -51
  76. package/src/Notion/ConceptNotion.tsx +0 -170
  77. package/src/Notion/FigureNotion.tsx +0 -104
  78. package/src/Notion/NotionVisualElement.tsx +0 -80
  79. package/src/utils/createUniversalPortal.tsx +0 -23
@@ -1,68 +0,0 @@
1
- import _styled from "@emotion/styled/base";
2
- 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)."; }
3
- /**
4
- * Copyright (c) 2022-present, NDLA.
5
- *
6
- * This source code is licensed under the GPLv3 license found in the
7
- * LICENSE file in the root directory of this source tree. *
8
- */
9
- import { css } from '@emotion/react';
10
- import FigureNotion from './FigureNotion';
11
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
- var _ref = process.env.NODE_ENV === "production" ? {
13
- name: "1xdnj1g-StyledIframe",
14
- styles: "min-height:400px;label:StyledIframe;"
15
- } : {
16
- name: "1xdnj1g-StyledIframe",
17
- styles: "min-height:400px;label:StyledIframe;",
18
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIk5vdGlvblZpc3VhbEVsZW1lbnQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWVXIiwiZmlsZSI6Ik5vdGlvblZpc3VhbEVsZW1lbnQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjItcHJlc2VudCwgTkRMQS5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBHUEx2MyBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLiAqXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IFJlYWN0T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WxFbGVtZW50LmltYWdlPy5zcmN9IGFsdD17dmlzdWFsRWxlbWVudC5pbWFnZS5hbHR9IC8+XG4gICAgICApIDogKFxuICAgICAgICA8U3R5bGVkSWZyYW1lIGFsbG93RnVsbFNjcmVlbiB0eXBlPXt0eXBlfSBzcmM9e3Zpc3VhbEVsZW1lbnQudXJsfSB0aXRsZT17dmlzdWFsRWxlbWVudC50aXRsZX0gLz5cbiAgICAgICl9XG4gICAgPC9GaWd1cmVOb3Rpb24+XG4gICk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBOb3Rpb25WaXN1YWxFbGVtZW50O1xuIl19 */",
19
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
20
- };
21
- var StyledIframe = /*#__PURE__*/_styled("iframe", {
22
- target: "e1hql2mu0",
23
- label: "StyledIframe"
24
- })(function (props) {
25
- return props.type === 'video' ? _ref : '';
26
- }, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIk5vdGlvblZpc3VhbEVsZW1lbnQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVlvRCIsImZpbGUiOiJOb3Rpb25WaXN1YWxFbGVtZW50LnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSAyMDIyLXByZXNlbnQsIE5ETEEuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgR1BMdjMgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS4gKlxuICovXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5pb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ICAgICA8aW1nIHNyYz17dmlzdWFsRWxlbWVudC5pbWFnZT8uc3JjfSBhbHQ9e3Zpc3VhbEVsZW1lbnQuaW1hZ2UuYWx0fSAvPlxuICAgICAgKSA6IChcbiAgICAgICAgPFN0eWxlZElmcmFtZSBhbGxvd0Z1bGxTY3JlZW4gdHlwZT17dHlwZX0gc3JjPXt2aXN1YWxFbGVtZW50LnVybH0gdGl0bGU9e3Zpc3VhbEVsZW1lbnQudGl0bGV9IC8+XG4gICAgICApfVxuICAgIDwvRmlndXJlTm90aW9uPlxuICApO1xufTtcblxuZXhwb3J0IGRlZmF1bHQgTm90aW9uVmlzdWFsRWxlbWVudDtcbiJdfQ== */"));
27
- var supportedEmbedTypes = ['brightcove', 'h5p', 'iframe', 'external', 'image'];
28
- var getType = function getType(resource) {
29
- if (resource === 'brightcove') {
30
- return 'video';
31
- }
32
- if (resource === 'image' || resource === 'h5p') {
33
- return resource;
34
- }
35
- return 'other';
36
- };
37
- var NotionVisualElement = function NotionVisualElement(_ref2) {
38
- var _visualElement$title, _visualElement$copyri, _visualElement$copyri2, _visualElement$copyri3, _visualElement$image, _visualElement$image2;
39
- var visualElement = _ref2.visualElement,
40
- id = _ref2.id,
41
- figureId = _ref2.figureId;
42
- if (!visualElement.resource || !supportedEmbedTypes.includes(visualElement.resource)) {
43
- return _jsx("p", {
44
- children: "Embed type is not supported!"
45
- });
46
- }
47
- var type = getType(visualElement.resource);
48
- return _jsx(FigureNotion, {
49
- resizeIframe: true,
50
- id: id,
51
- figureId: figureId,
52
- title: (_visualElement$title = visualElement.title) !== null && _visualElement$title !== void 0 ? _visualElement$title : '',
53
- copyright: visualElement.copyright,
54
- licenseString: (_visualElement$copyri = (_visualElement$copyri2 = visualElement.copyright) === null || _visualElement$copyri2 === void 0 ? void 0 : (_visualElement$copyri3 = _visualElement$copyri2.license) === null || _visualElement$copyri3 === void 0 ? void 0 : _visualElement$copyri3.license) !== null && _visualElement$copyri !== void 0 ? _visualElement$copyri : '',
55
- licenseButtons: visualElement.licenseButtons,
56
- type: type,
57
- children: (_visualElement$image = visualElement.image) !== null && _visualElement$image !== void 0 && _visualElement$image.src ? _jsx("img", {
58
- src: (_visualElement$image2 = visualElement.image) === null || _visualElement$image2 === void 0 ? void 0 : _visualElement$image2.src,
59
- alt: visualElement.image.alt
60
- }) : _jsx(StyledIframe, {
61
- allowFullScreen: true,
62
- type: type,
63
- src: visualElement.url,
64
- title: visualElement.title
65
- })
66
- });
67
- };
68
- export default NotionVisualElement;
@@ -1,25 +0,0 @@
1
- /**
2
- * Copyright (c) 2016-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
- // N.B This helper is intended to be used in https://github.com/ndlano/article-converter. It is not a general soultion for using portals in SSR applications.
10
-
11
- import ReactDOM from 'react-dom';
12
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
- function canUseDOM() {
14
- return !!(typeof window !== 'undefined' && window.document && !window.document.hidden); // window.document.hidden === jsdom check
15
- }
16
-
17
- export function createUniversalPortal(children, selector) {
18
- if (!canUseDOM()) {
19
- return _jsx("div", {
20
- "data-react-universal-portal": true,
21
- children: children
22
- });
23
- }
24
- return /*#__PURE__*/ReactDOM.createPortal(children, document.querySelector(selector));
25
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Copyright (c) 2022-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 { ReactNode } from 'react';
9
- interface Props {
10
- children: ReactNode;
11
- delay?: number;
12
- timeout?: number;
13
- exitDelay?: number;
14
- show: boolean;
15
- }
16
- declare const Fade: ({ show, delay, timeout, exitDelay, children }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
17
- export default Fade;
@@ -1,70 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = require("react");
8
- var _framerMotion = require("framer-motion");
9
- var _uniqueId = _interopRequireDefault(require("lodash/uniqueId"));
10
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- /**
13
- * Copyright (c) 2022-present, NDLA.
14
- *
15
- * This source code is licensed under the GPLv3 license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- *
18
- */
19
-
20
- var animations = function animations(duration, delayIn, delayOut) {
21
- return {
22
- open: {
23
- opacity: 1,
24
- transition: {
25
- delay: delayIn / 1000,
26
- ease: 'easeInOut',
27
- duration: duration / 1000
28
- }
29
- },
30
- closed: {
31
- opacity: 0,
32
- transition: {
33
- delay: delayOut / 1000,
34
- ease: 'easeInOut',
35
- duration: duration / 1000
36
- }
37
- }
38
- };
39
- };
40
- var defaultTimeout = 300;
41
- var Fade = function Fade(_ref) {
42
- var show = _ref.show,
43
- _ref$delay = _ref.delay,
44
- delay = _ref$delay === void 0 ? 0 : _ref$delay,
45
- _ref$timeout = _ref.timeout,
46
- timeout = _ref$timeout === void 0 ? defaultTimeout : _ref$timeout,
47
- _ref$exitDelay = _ref.exitDelay,
48
- exitDelay = _ref$exitDelay === void 0 ? 0 : _ref$exitDelay,
49
- children = _ref.children;
50
- var id = (0, _react.useMemo)(function () {
51
- return (0, _uniqueId.default)();
52
- }, []);
53
- var variants = (0, _react.useMemo)(function () {
54
- return animations(timeout, delay, exitDelay);
55
- }, [timeout, delay, exitDelay]);
56
- return (0, _jsxRuntime.jsx)(_framerMotion.LazyMotion, {
57
- features: _framerMotion.domAnimation,
58
- children: (0, _jsxRuntime.jsx)(_framerMotion.AnimatePresence, {
59
- children: show && (0, _jsxRuntime.jsx)(_framerMotion.m.div, {
60
- initial: "closed",
61
- animate: "open",
62
- exit: "closed",
63
- variants: variants,
64
- children: children
65
- }, id)
66
- })
67
- });
68
- };
69
- var _default = Fade;
70
- exports.default = _default;
@@ -1 +0,0 @@
1
- export { default as Fade } from './Fade';
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Fade", {
7
- enumerable: true,
8
- get: function get() {
9
- return _Fade.default;
10
- }
11
- });
12
- var _Fade = _interopRequireDefault(require("./Fade"));
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,11 +0,0 @@
1
- /**
2
- * Copyright (c) 2021-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 { Locale } from '../types';
9
- export declare const truncateDescription: (el: HTMLElement, readMoreLabel: string | null) => void;
10
- declare const initAudioPlayers: (locale: Locale) => void;
11
- export default initAudioPlayers;
@@ -1,69 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.truncateDescription = exports.default = void 0;
7
- var _reactDom = _interopRequireDefault(require("react-dom"));
8
- var _shave = _interopRequireDefault(require("shave"));
9
- var _Controls = _interopRequireDefault(require("./Controls"));
10
- var _SpeechControl = _interopRequireDefault(require("./SpeechControl"));
11
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- /**
14
- * Copyright (c) 2021-present, NDLA.
15
- *
16
- * This source code is licensed under the GPLv3 license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- *
19
- */
20
-
21
- var truncateDescription = function truncateDescription(el, readMoreLabel) {
22
- (0, _shave.default)(el, 90, {
23
- 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>")
24
- });
25
- };
26
- exports.truncateDescription = truncateDescription;
27
- var forEachElement = function forEachElement(selector, callback) {
28
- var nodeList = document.querySelectorAll(selector);
29
- for (var i = 0; i < nodeList.length; i += 1) {
30
- callback(nodeList[i], i);
31
- }
32
- };
33
- var initAudioPlayers = function initAudioPlayers(locale) {
34
- forEachElement('[data-audio-player]', function (el) {
35
- var src = el.getAttribute('data-src');
36
- var title = el.getAttribute('data-title');
37
- var speech = el.getAttribute('data-speech');
38
- if (src && title) {
39
- if (speech) {
40
- // eslint-disable-next-line react/no-deprecated
41
- _reactDom.default.hydrate((0, _jsxRuntime.jsx)(_SpeechControl.default, {
42
- src: src,
43
- title: title
44
- }), el);
45
- } else {
46
- // eslint-disable-next-line react/no-deprecated
47
- _reactDom.default.hydrate((0, _jsxRuntime.jsx)(_Controls.default, {
48
- src: src,
49
- title: title
50
- }), el);
51
- }
52
- }
53
- });
54
- forEachElement('[data-audio-player-description]', function (el) {
55
- var readMoreLabel = el.getAttribute('data-read-more-text');
56
- truncateDescription(el, readMoreLabel);
57
- });
58
- forEachElement('[data-audio-text-button-id]', function (el) {
59
- var id = el.getAttribute('data-audio-text-button-id');
60
- if (id) {
61
- el.onclick = function () {
62
- var _document, _document$getElementB;
63
- return (_document = document) === null || _document === void 0 ? void 0 : (_document$getElementB = _document.getElementById(id)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.toggleAttribute('hidden');
64
- };
65
- }
66
- });
67
- };
68
- var _default = initAudioPlayers;
69
- exports.default = _default;
@@ -1,23 +0,0 @@
1
- /**
2
- * Copyright (c) 2017-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 { ReactNode } from 'react';
9
- interface Props {
10
- id: string;
11
- labelledby?: string;
12
- label?: string;
13
- hidden?: boolean;
14
- children?: ReactNode;
15
- messages?: {
16
- close: string;
17
- };
18
- modifier?: string | string[];
19
- disablePortal?: boolean;
20
- onClose?: () => void;
21
- }
22
- export declare const Dialog: ({ children, messages, id, labelledby, label, modifier, disablePortal, hidden, onClose, ...rest }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
23
- export {};
@@ -1,75 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.Dialog = void 0;
8
- var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
9
- var _createUniversalPortal = require("../utils/createUniversalPortal");
10
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
11
- var _excluded = ["children", "messages", "id", "labelledby", "label", "modifier", "disablePortal", "hidden", "onClose"];
12
- /**
13
- * Copyright (c) 2017-present, NDLA.
14
- *
15
- * This source code is licensed under the GPLv3 license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- *
18
- */
19
- // N.B These component is used to render static markup serverside
20
- // Any interactivty is added by scripts located in the ndla-article-scripts package
21
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
24
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
26
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
27
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
28
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
29
- var classes = new _reactBemHelper.default({
30
- name: 'dialog',
31
- prefix: 'c-'
32
- });
33
- var Dialog = function Dialog(_ref) {
34
- var children = _ref.children,
35
- _ref$messages = _ref.messages,
36
- messages = _ref$messages === void 0 ? {
37
- close: 'Lukk'
38
- } : _ref$messages,
39
- id = _ref.id,
40
- labelledby = _ref.labelledby,
41
- label = _ref.label,
42
- modifier = _ref.modifier,
43
- _ref$disablePortal = _ref.disablePortal,
44
- disablePortal = _ref$disablePortal === void 0 ? false : _ref$disablePortal,
45
- _ref$hidden = _ref.hidden,
46
- hidden = _ref$hidden === void 0 ? true : _ref$hidden,
47
- onClose = _ref.onClose,
48
- rest = _objectWithoutProperties(_ref, _excluded);
49
- var content = (0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread(_objectSpread({}, classes('', modifier)), {}, {
50
- "data-dialog-id": id,
51
- role: "dialog",
52
- "aria-hidden": hidden,
53
- "aria-labelledby": labelledby,
54
- "aria-label": label
55
- }, rest), {}, {
56
- children: [(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, classes('content')), {}, {
57
- children: [(0, _jsxRuntime.jsx)("button", _objectSpread(_objectSpread({}, classes('close')), {}, {
58
- type: "button",
59
- onClick: function onClick() {
60
- if (onClose) {
61
- onClose();
62
- }
63
- },
64
- children: messages.close
65
- })), children]
66
- })), (0, _jsxRuntime.jsx)("div", {
67
- className: "o-backdrop"
68
- })]
69
- }));
70
- if (disablePortal) {
71
- return content;
72
- }
73
- return (0, _createUniversalPortal.createUniversalPortal)(content, 'body');
74
- };
75
- exports.Dialog = Dialog;
@@ -1,10 +0,0 @@
1
- /**
2
- * Copyright (c) 2017-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 { Dialog } from './Dialog';
9
- export { Dialog };
10
- export default Dialog;
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Dialog", {
7
- enumerable: true,
8
- get: function get() {
9
- return _Dialog.Dialog;
10
- }
11
- });
12
- exports.default = void 0;
13
- var _Dialog = require("./Dialog");
14
- /**
15
- * Copyright (c) 2017-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
- var _default = _Dialog.Dialog;
22
- exports.default = _default;
@@ -1,33 +0,0 @@
1
- /**
2
- * Copyright (c) 2018-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 { ReactNode } from 'react';
9
- import BEMHelper from 'react-bem-helper';
10
- import { FigureLicense } from './Figure';
11
- import { Contributor } from '../types';
12
- export declare const classLicenses: BEMHelper<BEMHelper.ReturnObject>;
13
- interface FigureLicenseCtaProps {
14
- children?: ReactNode;
15
- origin?: string;
16
- authors?: Contributor[];
17
- messages: {
18
- source: string;
19
- title: string;
20
- };
21
- title?: string;
22
- }
23
- export declare const FigureLicenseCta: ({ children, messages, authors, origin, title }: FigureLicenseCtaProps) => import("@emotion/react/jsx-runtime").JSX.Element;
24
- interface Props {
25
- messages: {
26
- modelPremission?: string;
27
- learnAboutLicenses: string;
28
- };
29
- license: FigureLicense;
30
- locale: string;
31
- }
32
- export declare const FigureLicenseByline: ({ messages, license, locale }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
33
- export {};
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.classLicenses = exports.FigureLicenseCta = exports.FigureLicenseByline = void 0;
7
- var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
8
- var _util = require("@ndla/util");
9
- var _notion = require("@ndla/notion");
10
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
13
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
17
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**
18
- * Copyright (c) 2018-present, NDLA.
19
- *
20
- * This source code is licensed under the GPLv3 license found in the
21
- * LICENSE file in the root directory of this source tree.
22
- *
23
- */ // N.B This component is used to render static markup serverside
24
- // Any interactivty is added by scripts located in the ndla-article-scripts package
25
- var classLicenses = new _reactBemHelper.default({
26
- name: 'figure-license',
27
- prefix: 'c-'
28
- });
29
- exports.classLicenses = classLicenses;
30
- var FigureLicenseCta = function FigureLicenseCta(_ref) {
31
- var children = _ref.children,
32
- messages = _ref.messages,
33
- authors = _ref.authors,
34
- origin = _ref.origin,
35
- title = _ref.title;
36
- return (0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, classLicenses('cta-wrapper')), {}, {
37
- children: [(0, _jsxRuntime.jsxs)("ul", _objectSpread(_objectSpread({}, classLicenses('list')), {}, {
38
- children: [title && (0, _jsxRuntime.jsx)("li", _objectSpread(_objectSpread({}, classLicenses('item')), {}, {
39
- children: "".concat(messages.title, ": ").concat(title)
40
- })), authors === null || authors === void 0 ? void 0 : authors.map(function (author) {
41
- return (0, _jsxRuntime.jsx)("li", _objectSpread(_objectSpread({}, classLicenses('item')), {}, {
42
- children: "".concat(author.type, ": ").concat(author.name)
43
- }), (0, _util.uuid)());
44
- }), origin && (0, _jsxRuntime.jsxs)("li", _objectSpread(_objectSpread({}, classLicenses('item')), {}, {
45
- children: [messages.source, ":", ' ', origin.startsWith('http') ? (0, _jsxRuntime.jsx)("a", {
46
- href: origin,
47
- target: "_blank",
48
- rel: "noopener noreferrer",
49
- children: origin
50
- }) : origin]
51
- }))]
52
- })), (0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, classLicenses('cta-block')), {}, {
53
- children: children
54
- }))]
55
- }));
56
- };
57
- exports.FigureLicenseCta = FigureLicenseCta;
58
- var FigureLicenseByline = function FigureLicenseByline(_ref2) {
59
- var messages = _ref2.messages,
60
- license = _ref2.license,
61
- locale = _ref2.locale;
62
- return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
63
- children: [(0, _jsxRuntime.jsx)(_notion.LicenseDescription, {
64
- highlightCC: true,
65
- locale: locale,
66
- messages: messages,
67
- licenseRights: license.rights
68
- }, "byline"), (0, _jsxRuntime.jsx)("a", _objectSpread(_objectSpread({}, classLicenses('link')), {}, {
69
- target: "_blank",
70
- rel: "noopener noreferrer",
71
- href: license.url,
72
- children: license.linkText
73
- }), "link")]
74
- });
75
- };
76
- exports.FigureLicenseByline = FigureLicenseByline;
@@ -1,29 +0,0 @@
1
- /**
2
- * Copyright (c) 2017-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 { ReactNode } from 'react';
9
- import { FigureLicense } from './Figure';
10
- import { Contributor } from '../types';
11
- export declare const FigureLicenseDialog: ({ children, messages, id, authors, origin, title, locale, license }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
12
- interface Props {
13
- id: string;
14
- children?: ReactNode;
15
- origin?: string;
16
- authors?: Contributor[];
17
- messages: {
18
- modelPremission?: string;
19
- close: string;
20
- rulesForUse: string;
21
- source: string;
22
- learnAboutLicenses: string;
23
- title: string;
24
- };
25
- title?: string;
26
- license: FigureLicense;
27
- locale: string;
28
- }
29
- export {};
@@ -1,57 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.FigureLicenseDialog = void 0;
7
- var _Dialog = _interopRequireDefault(require("../Dialog"));
8
- var _FigureLicense = require("./FigureLicense");
9
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
16
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**
17
- * Copyright (c) 2017-present, NDLA.
18
- *
19
- * This source code is licensed under the GPLv3 license found in the
20
- * LICENSE file in the root directory of this source tree.
21
- *
22
- */ // N.B This component is used to render static markup serverside
23
- // Any interactivty is added by scripts located in the ndla-article-scripts package
24
- var FigureLicenseDialog = function FigureLicenseDialog(_ref) {
25
- var children = _ref.children,
26
- messages = _ref.messages,
27
- id = _ref.id,
28
- authors = _ref.authors,
29
- origin = _ref.origin,
30
- title = _ref.title,
31
- locale = _ref.locale,
32
- license = _ref.license;
33
- var headingLabelId = "heading-".concat(id);
34
- return (0, _jsxRuntime.jsx)(_Dialog.default, {
35
- id: id,
36
- labelledby: headingLabelId,
37
- messages: messages,
38
- children: (0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, (0, _FigureLicense.classLicenses)()), {}, {
39
- children: [(0, _jsxRuntime.jsx)("h1", _objectSpread(_objectSpread({
40
- id: headingLabelId
41
- }, (0, _FigureLicense.classLicenses)('title')), {}, {
42
- children: messages.rulesForUse
43
- })), (0, _jsxRuntime.jsx)(_FigureLicense.FigureLicenseByline, {
44
- license: license,
45
- messages: messages,
46
- locale: locale
47
- }), (0, _jsxRuntime.jsx)(_FigureLicense.FigureLicenseCta, {
48
- authors: authors,
49
- title: title,
50
- origin: origin,
51
- messages: messages,
52
- children: children
53
- })]
54
- }))
55
- });
56
- };
57
- exports.FigureLicenseDialog = FigureLicenseDialog;