@ndla/ui 3.2.1 → 3.2.2

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 (104) hide show
  1. package/es/Article/ArticleAuthorContent.js +1 -2
  2. package/es/BackgroundImage/BackgroundImage.js +27 -0
  3. package/es/BackgroundImage/index.js +2 -0
  4. package/es/ContentLoader/index.js +83 -0
  5. package/es/Dialog/Dialog.js +64 -0
  6. package/es/Dialog/index.js +10 -0
  7. package/es/FactBox/FactBox.js +7 -11
  8. package/es/Figure/Figure.js +93 -0
  9. package/es/Figure/FigureExpandButton.js +28 -0
  10. package/es/Figure/FigureLicense.js +54 -0
  11. package/es/Figure/FigureLicenseDialog.js +43 -0
  12. package/es/Figure/index.js +12 -0
  13. package/es/FileList/File.js +48 -0
  14. package/es/FileList/FileList.js +20 -0
  15. package/es/FileList/index.js +3 -0
  16. package/es/Hero/Hero.js +64 -0
  17. package/es/Hero/index.js +8 -0
  18. package/es/Image/Image.js +96 -0
  19. package/es/Image/ImageLink.js +46 -0
  20. package/es/Image/LazyLoadImage.js +47 -0
  21. package/es/Image/index.js +11 -0
  22. package/es/InfoBox/InfoBox.js +11 -0
  23. package/es/InfoBox/index.js +1 -0
  24. package/es/InfoWidget/InfoWidget.js +57 -0
  25. package/es/InfoWidget/index.js +2 -0
  26. package/es/Logo/Logo.js +51 -0
  27. package/es/Logo/SvgLogo.js +54 -0
  28. package/es/Logo/index.js +9 -0
  29. package/es/Masthead/Masthead.js +67 -0
  30. package/es/Masthead/index.js +10 -0
  31. package/es/NoContentBox/NoContentBox.js +26 -0
  32. package/es/NoContentBox/index.js +9 -0
  33. package/es/Portrait/Portrait.js +30 -0
  34. package/es/Portrait/index.js +9 -0
  35. package/es/RelatedArticleList/RelatedArticleList.js +4 -23
  36. package/es/Topic/Topic.js +20 -20
  37. package/es/Translation/Translation.js +22 -0
  38. package/es/Translation/TranslationBox.js +17 -0
  39. package/es/Translation/TranslationLine.js +37 -0
  40. package/es/Translation/index.js +3 -0
  41. package/es/index-javascript.js +1 -18
  42. package/es/index.js +17 -0
  43. package/es/locale/messages-en.js +4 -0
  44. package/es/locale/messages-nb.js +5 -1
  45. package/es/locale/messages-nn.js +5 -1
  46. package/lib/BackgroundImage/BackgroundImage.js +40 -0
  47. package/lib/BackgroundImage/index.js +13 -0
  48. package/lib/ContentLoader/index.js +88 -0
  49. package/lib/Dialog/Dialog.d.ts +1 -1
  50. package/lib/Dialog/Dialog.js +70 -0
  51. package/lib/Dialog/index.js +24 -0
  52. package/lib/FactBox/FactBox.d.ts +16 -0
  53. package/lib/FactBox/FactBox.js +5 -11
  54. package/lib/FactBox/index.d.ts +2 -0
  55. package/lib/Figure/Figure.js +105 -0
  56. package/lib/Figure/FigureExpandButton.js +41 -0
  57. package/lib/Figure/FigureLicense.js +66 -0
  58. package/lib/Figure/FigureLicenseDialog.js +48 -0
  59. package/lib/Figure/index.js +49 -0
  60. package/lib/FileList/File.js +63 -0
  61. package/lib/FileList/FileList.js +34 -0
  62. package/lib/FileList/index.js +21 -0
  63. package/lib/Hero/Hero.js +100 -0
  64. package/lib/Hero/index.js +55 -0
  65. package/lib/Image/Image.js +105 -0
  66. package/lib/Image/ImageLink.js +50 -0
  67. package/lib/Image/LazyLoadImage.js +51 -0
  68. package/lib/Image/index.js +38 -0
  69. package/lib/InfoBox/InfoBox.js +24 -0
  70. package/lib/InfoBox/index.js +15 -0
  71. package/lib/InfoWidget/InfoWidget.js +73 -0
  72. package/lib/InfoWidget/index.js +13 -0
  73. package/lib/Logo/Logo.js +70 -0
  74. package/lib/Logo/SvgLogo.js +59 -0
  75. package/lib/Logo/index.js +20 -0
  76. package/lib/Masthead/Masthead.js +82 -0
  77. package/lib/Masthead/index.js +30 -0
  78. package/lib/NoContentBox/NoContentBox.js +43 -0
  79. package/lib/NoContentBox/index.js +20 -0
  80. package/lib/Portrait/Portrait.js +43 -0
  81. package/lib/Portrait/index.js +20 -0
  82. package/lib/RelatedArticleList/RelatedArticleList.d.ts +25 -0
  83. package/lib/RelatedArticleList/RelatedArticleList.js +2 -23
  84. package/lib/RelatedArticleList/index.d.ts +10 -0
  85. package/lib/Topic/Topic.js +20 -20
  86. package/lib/Translation/Translation.js +35 -0
  87. package/lib/Translation/TranslationBox.js +29 -0
  88. package/lib/Translation/TranslationLine.js +42 -0
  89. package/lib/Translation/index.js +31 -0
  90. package/lib/index-javascript.js +0 -230
  91. package/lib/index.d.ts +3 -0
  92. package/lib/index.js +263 -0
  93. package/lib/locale/messages-en.js +4 -0
  94. package/lib/locale/messages-nb.js +5 -1
  95. package/lib/locale/messages-nn.js +5 -1
  96. package/lib/utils/createUniversalPortal.d.ts +9 -0
  97. package/package.json +4 -4
  98. package/src/FactBox/{FactBox.jsx → FactBox.tsx} +12 -14
  99. package/src/FactBox/{index.js → index.ts} +0 -0
  100. package/src/RelatedArticleList/{RelatedArticleList.jsx → RelatedArticleList.tsx} +43 -30
  101. package/src/RelatedArticleList/{index.js → index.ts} +0 -0
  102. package/src/index-javascript.js +0 -3
  103. package/src/index.ts +6 -0
  104. package/src/utils/{createUniversalPortal.jsx → createUniversalPortal.tsx} +3 -3
@@ -12,8 +12,7 @@ import BEMHelper from 'react-bem-helper';
12
12
  import { useTranslation } from 'react-i18next'; // @ts-ignore
13
13
 
14
14
  import Button from '@ndla/button';
15
- import SafeLink from '@ndla/safelink'; // @ts-ignore
16
-
15
+ import SafeLink from '@ndla/safelink';
17
16
  import Portrait from '../Portrait';
18
17
  import { jsx as ___EmotionJSX } from "@emotion/core";
19
18
  var classes = new BEMHelper({
@@ -0,0 +1,27 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import React from 'react';
4
+ import BEMHelper from 'react-bem-helper';
5
+ import { jsx as ___EmotionJSX } from "@emotion/core";
6
+ var classes = BEMHelper('c-background-image');
7
+
8
+ var BackgroundImage = function BackgroundImage(_ref) {
9
+ var images = _ref.images,
10
+ _ref$showOverlay = _ref.showOverlay,
11
+ showOverlay = _ref$showOverlay === void 0 ? false : _ref$showOverlay;
12
+ return ___EmotionJSX("div", classes('', {
13
+ showOverlay: showOverlay
14
+ }), images && images.map(function (image) {
15
+ return image.types.map(function (type) {
16
+ return ___EmotionJSX("div", _extends({
17
+ key: "".concat(image.url).concat(type)
18
+ }, classes('background', type), {
19
+ style: {
20
+ backgroundImage: "url(".concat(image.url, ")")
21
+ }
22
+ }));
23
+ });
24
+ }));
25
+ };
26
+
27
+ export default BackgroundImage;
@@ -0,0 +1,2 @@
1
+ import BackgroundImage from './BackgroundImage';
2
+ export default BackgroundImage;
@@ -0,0 +1,83 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ 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; }
4
+
5
+ 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; }
6
+
7
+ /**
8
+ * Copyright (c) 2018-present, NDLA.
9
+ *
10
+ * This source code is licensed under the GPLv3 license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ *
13
+ */
14
+ import React from 'react';
15
+ import { uuid } from '@ndla/util';
16
+ import { jsx as ___EmotionJSX } from "@emotion/core";
17
+
18
+ var ContentLoader = function ContentLoader(_ref) {
19
+ var children = _ref.children,
20
+ _ref$width = _ref.width,
21
+ width = _ref$width === void 0 ? 400 : _ref$width,
22
+ _ref$height = _ref.height,
23
+ height = _ref$height === void 0 ? 130 : _ref$height,
24
+ _ref$preserveAspectRa = _ref.preserveAspectRatio,
25
+ preserveAspectRatio = _ref$preserveAspectRa === void 0 ? 'xMidYMid meet' : _ref$preserveAspectRa,
26
+ _ref$className = _ref.className,
27
+ className = _ref$className === void 0 ? '' : _ref$className,
28
+ _ref$primaryColor = _ref.primaryColor,
29
+ primaryColor = _ref$primaryColor === void 0 ? '#f0f0f0' : _ref$primaryColor,
30
+ _ref$secondaryColor = _ref.secondaryColor,
31
+ secondaryColor = _ref$secondaryColor === void 0 ? '#e0e0e0' : _ref$secondaryColor,
32
+ _ref$speed = _ref.speed,
33
+ speed = _ref$speed === void 0 ? 2 : _ref$speed,
34
+ rest = _objectWithoutProperties(_ref, ["children", "width", "height", "preserveAspectRatio", "className", "primaryColor", "secondaryColor", "speed"]);
35
+
36
+ var idClip = uuid();
37
+ var idGradient = uuid();
38
+ return ___EmotionJSX("svg", _extends({
39
+ viewBox: "0 0 ".concat(width, " ").concat(height),
40
+ version: "1.1",
41
+ preserveAspectRatio: preserveAspectRatio,
42
+ className: className
43
+ }, rest), ___EmotionJSX("rect", {
44
+ style: {
45
+ fill: "url(#".concat(idGradient, ")")
46
+ },
47
+ clipPath: "url(#".concat(idClip, ")"),
48
+ x: "0",
49
+ y: "0",
50
+ width: width,
51
+ height: height
52
+ }), ___EmotionJSX("defs", null, ___EmotionJSX("clipPath", {
53
+ id: idClip
54
+ }, children), ___EmotionJSX("linearGradient", {
55
+ id: idGradient
56
+ }, ___EmotionJSX("stop", {
57
+ offset: "0%",
58
+ stopColor: primaryColor
59
+ }, ___EmotionJSX("animate", {
60
+ attributeName: "offset",
61
+ values: "-2; 1",
62
+ dur: "".concat(speed, "s"),
63
+ repeatCount: "indefinite"
64
+ })), ___EmotionJSX("stop", {
65
+ offset: "50%",
66
+ stopColor: secondaryColor
67
+ }, ___EmotionJSX("animate", {
68
+ attributeName: "offset",
69
+ values: "-1.5; 1.5",
70
+ dur: "".concat(speed, "s"),
71
+ repeatCount: "indefinite"
72
+ })), ___EmotionJSX("stop", {
73
+ offset: "100%",
74
+ stopColor: primaryColor
75
+ }, ___EmotionJSX("animate", {
76
+ attributeName: "offset",
77
+ values: "-1; 2",
78
+ dur: "".concat(speed, "s"),
79
+ repeatCount: "indefinite"
80
+ })))));
81
+ };
82
+
83
+ export default ContentLoader;
@@ -0,0 +1,64 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ 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; }
4
+
5
+ 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; }
6
+
7
+ /**
8
+ * Copyright (c) 2017-present, NDLA.
9
+ *
10
+ * This source code is licensed under the GPLv3 license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ *
13
+ */
14
+ // N.B These component is used to render static markup serverside
15
+ // Any interactivty is added by scripts located in the ndla-article-scripts package
16
+ import React from 'react';
17
+ import BEMHelper from 'react-bem-helper'; //@ts-ignore
18
+
19
+ import { createUniversalPortal } from '../utils/createUniversalPortal';
20
+ import { jsx as ___EmotionJSX } from "@emotion/core";
21
+ var classes = new BEMHelper({
22
+ name: 'dialog',
23
+ prefix: 'c-'
24
+ });
25
+ export var Dialog = function Dialog(_ref) {
26
+ var children = _ref.children,
27
+ _ref$messages = _ref.messages,
28
+ messages = _ref$messages === void 0 ? {
29
+ close: 'Lukk'
30
+ } : _ref$messages,
31
+ id = _ref.id,
32
+ labelledby = _ref.labelledby,
33
+ label = _ref.label,
34
+ modifier = _ref.modifier,
35
+ _ref$disablePortal = _ref.disablePortal,
36
+ disablePortal = _ref$disablePortal === void 0 ? false : _ref$disablePortal,
37
+ _ref$hidden = _ref.hidden,
38
+ hidden = _ref$hidden === void 0 ? true : _ref$hidden,
39
+ onClose = _ref.onClose,
40
+ rest = _objectWithoutProperties(_ref, ["children", "messages", "id", "labelledby", "label", "modifier", "disablePortal", "hidden", "onClose"]);
41
+
42
+ var content = ___EmotionJSX("div", _extends({}, classes('', modifier), {
43
+ "data-dialog-id": id,
44
+ role: "dialog",
45
+ "aria-hidden": hidden,
46
+ "aria-labelledby": labelledby,
47
+ "aria-label": label
48
+ }, rest), ___EmotionJSX("div", classes('content'), ___EmotionJSX("button", _extends({}, classes('close'), {
49
+ type: "button",
50
+ onClick: function onClick() {
51
+ if (onClose) {
52
+ onClose();
53
+ }
54
+ }
55
+ }), messages.close), children), ___EmotionJSX("div", {
56
+ className: "o-backdrop"
57
+ }));
58
+
59
+ if (disablePortal) {
60
+ return content;
61
+ }
62
+
63
+ return createUniversalPortal(content, 'body');
64
+ };
@@ -0,0 +1,10 @@
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;
@@ -8,15 +8,17 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
8
8
  *
9
9
  */
10
10
  import React from 'react';
11
- import PropTypes from 'prop-types';
12
- import BEMHelper from 'react-bem-helper';
11
+ import BEMHelper from 'react-bem-helper'; //@ts-ignore
12
+
13
13
  import Button from '@ndla/button';
14
14
  import { jsx as ___EmotionJSX } from "@emotion/core";
15
15
 
16
16
  var toggleFactBox = function toggleFactBox(event) {
17
- var button = event.target;
18
- var aside = button.previousSibling.parentNode;
19
- aside.classList.toggle('expanded');
17
+ var _button$previousSibli, _aside$classList;
18
+
19
+ var button = event.currentTarget;
20
+ var aside = button === null || button === void 0 ? void 0 : (_button$previousSibli = button.previousSibling) === null || _button$previousSibli === void 0 ? void 0 : _button$previousSibli.parentElement;
21
+ aside === null || aside === void 0 ? void 0 : (_aside$classList = aside.classList) === null || _aside$classList === void 0 ? void 0 : _aside$classList.toggle('expanded');
20
22
  };
21
23
 
22
24
  var classes = new BEMHelper({
@@ -34,10 +36,4 @@ var FactBox = function FactBox(_ref) {
34
36
  })));
35
37
  };
36
38
 
37
- FactBox.propTypes = {
38
- dangerouslySetInnerHTML: PropTypes.shape({
39
- __html: PropTypes.string.isRequired
40
- }),
41
- children: PropTypes.node
42
- };
43
39
  export default FactBox;
@@ -0,0 +1,93 @@
1
+ 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; }
2
+
3
+ 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; }
4
+
5
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
+
7
+ /**
8
+ * Copyright (c) 2016-present, NDLA.
9
+ *
10
+ * This source code is licensed under the GPLv3 license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ *
13
+ */
14
+ // N.B These component is used to render static markup serverside
15
+ // Any interactivty is added by scripts located in the ndla-article-scripts package
16
+ import React from 'react';
17
+ import BEMHelper from 'react-bem-helper';
18
+ import { isFunction, parseMarkdown } from '@ndla/util';
19
+ import { useTranslation } from 'react-i18next';
20
+ import { Link as LinkIcon } from '@ndla/icons/common';
21
+ import { LicenseByline } from '@ndla/licenses';
22
+ import SafeLink from '@ndla/safelink'; //@ts-ignore
23
+
24
+ import Button from '@ndla/button';
25
+ import { jsx as ___EmotionJSX } from "@emotion/core";
26
+ var classes = new BEMHelper({
27
+ name: 'figure',
28
+ prefix: 'c-'
29
+ });
30
+ export var FigureCaption = function FigureCaption(_ref) {
31
+ var figureId = _ref.figureId,
32
+ id = _ref.id,
33
+ children = _ref.children,
34
+ caption = _ref.caption,
35
+ authors = _ref.authors,
36
+ reuseLabel = _ref.reuseLabel,
37
+ licenseRights = _ref.licenseRights,
38
+ locale = _ref.locale,
39
+ link = _ref.link,
40
+ hideFigcaption = _ref.hideFigcaption,
41
+ hasLinkedVideo = _ref.hasLinkedVideo;
42
+
43
+ var _useTranslation = useTranslation(),
44
+ t = _useTranslation.t;
45
+
46
+ return ___EmotionJSX("figcaption", classes('caption', hideFigcaption ? 'hidden-caption' : undefined), caption ? ___EmotionJSX("div", classes('info'), parseMarkdown(caption)) : null, ___EmotionJSX("footer", classes('byline'), ___EmotionJSX("div", classes('byline-licenselist'), ___EmotionJSX(LicenseByline, {
47
+ licenseRights: licenseRights,
48
+ locale: locale,
49
+ marginRight: true
50
+ }, ___EmotionJSX("div", classes('byline-author-buttons'), ___EmotionJSX("span", classes('byline-authors'), authors === null || authors === void 0 ? void 0 : authors.map(function (author) {
51
+ return author.name;
52
+ }).join(', ')), ___EmotionJSX("div", null, ___EmotionJSX(Button, {
53
+ borderShape: "rounded",
54
+ outline: true,
55
+ size: "small",
56
+ type: "button",
57
+ "data-dialog-trigger-id": id,
58
+ "data-dialog-source-id": figureId
59
+ }, reuseLabel), hasLinkedVideo && ___EmotionJSX(Button, _extends({
60
+ borderShape: "rounded",
61
+ outline: true,
62
+ size: "small",
63
+ type: "button"
64
+ }, classes('toggleAlternativeVideo')), ___EmotionJSX("span", {
65
+ className: "original"
66
+ }, t('figure.button.alternative')), ___EmotionJSX("span", {
67
+ className: "alternative hidden"
68
+ }, t('figure.button.original')))), children)), link && ___EmotionJSX("div", classes('link-wrapper'), ___EmotionJSX(SafeLink, _extends({
69
+ to: link.url
70
+ }, classes('link'), {
71
+ target: link.external ? '_blank' : undefined,
72
+ rel: link.external ? 'noopener noreferrer' : undefined
73
+ }), ___EmotionJSX("span", classes('link-text'), link.text), ___EmotionJSX(LinkIcon, null)), link.description && ___EmotionJSX("p", classes('link-description'), link.description)))));
74
+ };
75
+
76
+ var Figure = function Figure(_ref2) {
77
+ var children = _ref2.children,
78
+ _ref2$type = _ref2.type,
79
+ type = _ref2$type === void 0 ? 'full' : _ref2$type,
80
+ resizeIframe = _ref2.resizeIframe,
81
+ rest = _objectWithoutProperties(_ref2, ["children", "type", "resizeIframe"]);
82
+
83
+ var typeClass = type === 'full-column' ? 'c-figure--full-column' : "u-float-".concat(type);
84
+ return ___EmotionJSX("figure", _extends({
85
+ "data-sizetype": type
86
+ }, classes('', {
87
+ resize: !!resizeIframe
88
+ }, typeClass), rest), isFunction(children) ? children({
89
+ typeClass: typeClass
90
+ }) : children);
91
+ };
92
+
93
+ export default Figure;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright (c) 2019-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 React from 'react';
9
+ import { ArrowCollapse } from '@ndla/icons/common';
10
+ import { ExpandTwoArrows } from '@ndla/icons/action';
11
+ import { jsx as ___EmotionJSX } from "@emotion/core";
12
+ export function FigureExpandButton(_ref) {
13
+ var messages = _ref.messages,
14
+ typeClass = _ref.typeClass;
15
+ return ___EmotionJSX("button", {
16
+ className: "c-figure__fullscreen-btn",
17
+ type: "button",
18
+ "data-figure-button": true,
19
+ "data-classtype": typeClass,
20
+ "data-aria": messages.zoomImageButtonLabel,
21
+ "data-ariaexpanded": messages.zoomOutImageButtonLabel,
22
+ "aria-label": messages.zoomImageButtonLabel
23
+ }, ___EmotionJSX(ArrowCollapse, {
24
+ className: "expanded-icon"
25
+ }), ___EmotionJSX(ExpandTwoArrows, {
26
+ className: "contracted-icon"
27
+ }));
28
+ }
@@ -0,0 +1,54 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ /**
4
+ * Copyright (c) 2018-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
+ */
10
+ // N.B This component is used to render static markup serverside
11
+ // Any interactivty is added by scripts located in the ndla-article-scripts package
12
+ import React from 'react';
13
+ import BEMHelper from 'react-bem-helper';
14
+ import { uuid } from '@ndla/util';
15
+ import { LicenseDescription } from '@ndla/licenses';
16
+ import { jsx as ___EmotionJSX } from "@emotion/core";
17
+ export var classLicenses = new BEMHelper({
18
+ name: 'figure-license',
19
+ prefix: 'c-'
20
+ });
21
+ export var FigureLicenseCta = function FigureLicenseCta(_ref) {
22
+ var children = _ref.children,
23
+ messages = _ref.messages,
24
+ authors = _ref.authors,
25
+ origin = _ref.origin,
26
+ title = _ref.title;
27
+ return ___EmotionJSX("div", classLicenses('cta-wrapper'), ___EmotionJSX("ul", classLicenses('list'), title && ___EmotionJSX("li", classLicenses('item'), "".concat(messages.title, ": ").concat(title)), authors === null || authors === void 0 ? void 0 : authors.map(function (author) {
28
+ return ___EmotionJSX("li", _extends({
29
+ key: uuid()
30
+ }, classLicenses('item')), "".concat(author.type, ": ").concat(author.name));
31
+ }), origin && ___EmotionJSX("li", classLicenses('item'), messages.source, ":", ' ', origin.startsWith('http') ? ___EmotionJSX("a", {
32
+ href: origin,
33
+ target: "_blank",
34
+ rel: "noopener noreferrer"
35
+ }, origin) : origin)), ___EmotionJSX("div", classLicenses('cta-block'), children));
36
+ };
37
+ export var FigureLicenseByline = function FigureLicenseByline(_ref2) {
38
+ var messages = _ref2.messages,
39
+ license = _ref2.license,
40
+ locale = _ref2.locale;
41
+ return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(LicenseDescription, {
42
+ key: "byline",
43
+ highlightCC: true,
44
+ locale: locale,
45
+ messages: messages,
46
+ licenseRights: license.rights
47
+ }), ",", ___EmotionJSX("a", _extends({
48
+ key: "link"
49
+ }, classLicenses('link'), {
50
+ target: "_blank",
51
+ rel: "noopener noreferrer",
52
+ href: license.url
53
+ }), license.linkText));
54
+ };
@@ -0,0 +1,43 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ /**
4
+ * Copyright (c) 2017-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
+ */
10
+ // N.B This component is used to render static markup serverside
11
+ // Any interactivty is added by scripts located in the ndla-article-scripts package
12
+ import React from 'react'; //@ts-ignore
13
+
14
+ import Dialog from '../Dialog';
15
+ import { classLicenses, FigureLicenseByline, FigureLicenseCta } from './FigureLicense';
16
+ import { jsx as ___EmotionJSX } from "@emotion/core";
17
+ export var FigureLicenseDialog = function FigureLicenseDialog(_ref) {
18
+ var children = _ref.children,
19
+ messages = _ref.messages,
20
+ id = _ref.id,
21
+ authors = _ref.authors,
22
+ origin = _ref.origin,
23
+ title = _ref.title,
24
+ locale = _ref.locale,
25
+ license = _ref.license;
26
+ var headingLabelId = "heading-".concat(id);
27
+ return ___EmotionJSX(Dialog, {
28
+ id: id,
29
+ labelledby: headingLabelId,
30
+ messages: messages
31
+ }, ___EmotionJSX("div", classLicenses(), ___EmotionJSX("h3", _extends({
32
+ id: headingLabelId
33
+ }, classLicenses('title')), messages.rulesForUse), ___EmotionJSX(FigureLicenseByline, {
34
+ license: license,
35
+ messages: messages,
36
+ locale: locale
37
+ }), ___EmotionJSX(FigureLicenseCta, {
38
+ authors: authors,
39
+ title: title,
40
+ origin: origin,
41
+ messages: messages
42
+ }, children)));
43
+ };
@@ -0,0 +1,12 @@
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 Figure, { FigureCaption } from './Figure';
9
+ export { Figure, FigureCaption };
10
+ export { FigureLicenseDialog } from './FigureLicenseDialog';
11
+ export { FigureExpandButton } from './FigureExpandButton';
12
+ export { FigureBylineExpandButton } from './FigureBylineExpandButton';
@@ -0,0 +1,48 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import React from 'react';
4
+ import BEMHelper from 'react-bem-helper';
5
+ import { Download } from '@ndla/icons/common';
6
+ import SafeLink from '@ndla/safelink';
7
+ import { jsx as ___EmotionJSX } from "@emotion/core";
8
+ var classes = BEMHelper('c-file-list');
9
+
10
+ var renderFormat = function renderFormat(format, title, isPrimary, id, isDeadLink) {
11
+ var titleWithFormat = "".concat(title, " (").concat(format.fileType.toUpperCase(), ")");
12
+ var formatId = "".concat(id, "_").concat(format.fileType);
13
+
14
+ if (isDeadLink) {
15
+ return ___EmotionJSX("span", {
16
+ key: format.url
17
+ }, ___EmotionJSX(Download, null), ___EmotionJSX("span", null, isPrimary ? titleWithFormat : "(".concat(format.fileType.toUpperCase(), ")")), ___EmotionJSX("span", _extends({}, classes('tooltip'), {
18
+ "aria-hidden": true,
19
+ role: "tooltip",
20
+ id: formatId
21
+ }), ___EmotionJSX("span", classes('tooltip-text'), format.tooltip)));
22
+ }
23
+
24
+ return ___EmotionJSX(SafeLink, _extends({}, classes('link'), {
25
+ key: format.url,
26
+ to: format.url,
27
+ target: "_blank",
28
+ "aria-label": titleWithFormat,
29
+ "aria-describedby": formatId
30
+ }), ___EmotionJSX(Download, null), ___EmotionJSX("span", classes('link-text'), ___EmotionJSX("span", null, isPrimary ? titleWithFormat : "(".concat(format.fileType.toUpperCase(), ")"))), ___EmotionJSX("span", _extends({}, classes('tooltip'), {
31
+ "aria-hidden": true,
32
+ role: "tooltip",
33
+ id: formatId
34
+ }), ___EmotionJSX("span", classes('tooltip-text'), format.tooltip)));
35
+ };
36
+
37
+ var File = function File(_ref) {
38
+ var file = _ref.file,
39
+ id = _ref.id;
40
+ var formatLinks = file.formats.map(function (format, index) {
41
+ return renderFormat(format, file.title, index === 0, id, !file.fileExists);
42
+ });
43
+ return ___EmotionJSX("li", _extends({}, classes('item'), {
44
+ key: file.title
45
+ }), formatLinks);
46
+ };
47
+
48
+ export default File;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import BEMHelper from 'react-bem-helper';
3
+ import File from './File';
4
+ import { jsx as ___EmotionJSX } from "@emotion/core";
5
+ var classes = BEMHelper('c-file-list');
6
+
7
+ var FileList = function FileList(_ref) {
8
+ var files = _ref.files,
9
+ heading = _ref.heading,
10
+ id = _ref.id;
11
+ return ___EmotionJSX("section", classes(), ___EmotionJSX("h1", classes('heading'), heading), ___EmotionJSX("ul", classes('files'), files.map(function (file) {
12
+ return ___EmotionJSX(File, {
13
+ key: "file-".concat(id, "-").concat(file.title),
14
+ file: file,
15
+ id: id
16
+ });
17
+ })));
18
+ };
19
+
20
+ export default FileList;
@@ -0,0 +1,3 @@
1
+ import FileList from './FileList';
2
+ export { default as File } from './File';
3
+ export default FileList;
@@ -0,0 +1,64 @@
1
+ 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; }
2
+
3
+ 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; }
4
+
5
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
+
7
+ /**
8
+ * Copyright (c) 2016-present, NDLA.
9
+ *
10
+ * This source code is licensed under the GPLv3 license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ *
13
+ */
14
+ import React from 'react';
15
+ import BEMHelper from 'react-bem-helper';
16
+ import * as contentTypes from '../model/ContentType';
17
+ import { jsx as ___EmotionJSX } from "@emotion/core";
18
+ var classes = new BEMHelper({
19
+ name: 'hero',
20
+ prefix: 'c-'
21
+ });
22
+ export var Hero = function Hero(_ref) {
23
+ var children = _ref.children,
24
+ contentType = _ref.contentType;
25
+ return ___EmotionJSX("div", classes('', contentType), children || null);
26
+ };
27
+ export var SubjectMaterialHero = function SubjectMaterialHero(props) {
28
+ return ___EmotionJSX(Hero, _extends({
29
+ contentType: contentTypes.SUBJECT_MATERIAL
30
+ }, props));
31
+ };
32
+ export var TasksAndActivitiesHero = function TasksAndActivitiesHero(props) {
33
+ return ___EmotionJSX(Hero, _extends({
34
+ contentType: contentTypes.TASKS_AND_ACTIVITIES
35
+ }, props));
36
+ };
37
+ export var AssessmentResourcesHero = function AssessmentResourcesHero(props) {
38
+ return ___EmotionJSX(Hero, _extends({
39
+ contentType: contentTypes.ASSESSMENT_RESOURCES
40
+ }, props));
41
+ };
42
+ export var SubjectHero = function SubjectHero(props) {
43
+ return ___EmotionJSX(Hero, _extends({
44
+ contentType: contentTypes.SUBJECT
45
+ }, props));
46
+ };
47
+ export var ExternalLearningResourcesHero = function ExternalLearningResourcesHero(props) {
48
+ return ___EmotionJSX(Hero, _extends({
49
+ contentType: contentTypes.EXTERNAL_LEARNING_RESOURCES
50
+ }, props));
51
+ };
52
+ export var SourceMaterialHero = function SourceMaterialHero(props) {
53
+ return ___EmotionJSX(Hero, _extends({
54
+ contentType: contentTypes.SOURCE_MATERIAL
55
+ }, props));
56
+ };
57
+ export var NdlaFilmHero = function NdlaFilmHero(_ref2) {
58
+ var hasImage = _ref2.hasImage,
59
+ rest = _objectWithoutProperties(_ref2, ["hasImage"]);
60
+
61
+ return ___EmotionJSX(Hero, _extends({}, rest, {
62
+ contentType: hasImage ? 'ndla-film has-image' : 'ndla-film'
63
+ }));
64
+ };
@@ -0,0 +1,8 @@
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
+ export { SubjectMaterialHero, TasksAndActivitiesHero, AssessmentResourcesHero, SubjectHero, ExternalLearningResourcesHero, SourceMaterialHero, Hero, NdlaFilmHero } from './Hero';