@ndla/ui 45.0.16 → 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 (99) 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/es/locale/messages-en.js +7 -2
  10. package/es/locale/messages-nb.js +7 -2
  11. package/es/locale/messages-nn.js +7 -2
  12. package/es/locale/messages-se.js +7 -2
  13. package/es/locale/messages-sma.js +7 -2
  14. package/lib/Article/Article.js +3 -3
  15. package/lib/AudioPlayer/index.d.ts +0 -2
  16. package/lib/AudioPlayer/index.js +0 -7
  17. package/lib/Embed/conceptComponents.js +17 -10
  18. package/lib/Figure/Figure.d.ts +0 -38
  19. package/lib/Figure/Figure.js +20 -96
  20. package/lib/Figure/index.d.ts +1 -3
  21. package/lib/Figure/index.js +2 -17
  22. package/lib/Notion/index.d.ts +0 -4
  23. package/lib/Notion/index.js +0 -14
  24. package/lib/all.css +1 -1
  25. package/lib/index.d.ts +3 -5
  26. package/lib/index.js +1 -32
  27. package/lib/locale/messages-en.d.ts +5 -0
  28. package/lib/locale/messages-en.js +7 -2
  29. package/lib/locale/messages-nb.d.ts +5 -0
  30. package/lib/locale/messages-nb.js +7 -2
  31. package/lib/locale/messages-nn.d.ts +5 -0
  32. package/lib/locale/messages-nn.js +7 -2
  33. package/lib/locale/messages-se.d.ts +5 -0
  34. package/lib/locale/messages-se.js +7 -2
  35. package/lib/locale/messages-sma.d.ts +5 -0
  36. package/lib/locale/messages-sma.js +7 -2
  37. package/package.json +18 -22
  38. package/src/Article/Article.tsx +1 -1
  39. package/src/AudioPlayer/AudiPlayer.stories.tsx +88 -0
  40. package/src/AudioPlayer/index.ts +0 -2
  41. package/src/Embed/IframeEmbed.stories.tsx +15 -0
  42. package/src/Embed/ImageEmbed.stories.tsx +169 -2
  43. package/src/Embed/RelatedContentEmbed.stories.tsx +438 -0
  44. package/src/Embed/conceptComponents.tsx +13 -1
  45. package/src/Figure/Figure.tsx +1 -120
  46. package/src/Figure/index.ts +1 -3
  47. package/src/Notion/index.ts +0 -4
  48. package/src/index.ts +3 -13
  49. package/src/locale/messages-en.ts +7 -2
  50. package/src/locale/messages-nb.ts +7 -2
  51. package/src/locale/messages-nn.ts +7 -2
  52. package/src/locale/messages-se.ts +7 -2
  53. package/src/locale/messages-sma.ts +7 -2
  54. package/src/main.scss +0 -1
  55. package/es/Animation/Fade.js +0 -62
  56. package/es/Animation/index.js +0 -1
  57. package/es/AudioPlayer/initAudioPlayers.js +0 -60
  58. package/es/Dialog/Dialog.js +0 -70
  59. package/es/Dialog/index.js +0 -11
  60. package/es/Figure/FigureLicense.js +0 -72
  61. package/es/Figure/FigureLicenseDialog.js +0 -54
  62. package/es/Notion/ConceptNotion.js +0 -135
  63. package/es/Notion/FigureNotion.js +0 -93
  64. package/es/Notion/NotionVisualElement.js +0 -68
  65. package/es/utils/createUniversalPortal.js +0 -25
  66. package/lib/Animation/Fade.d.ts +0 -17
  67. package/lib/Animation/Fade.js +0 -70
  68. package/lib/Animation/index.d.ts +0 -1
  69. package/lib/Animation/index.js +0 -13
  70. package/lib/AudioPlayer/initAudioPlayers.d.ts +0 -11
  71. package/lib/AudioPlayer/initAudioPlayers.js +0 -69
  72. package/lib/Dialog/Dialog.d.ts +0 -23
  73. package/lib/Dialog/Dialog.js +0 -75
  74. package/lib/Dialog/index.d.ts +0 -10
  75. package/lib/Dialog/index.js +0 -22
  76. package/lib/Figure/FigureLicense.d.ts +0 -33
  77. package/lib/Figure/FigureLicense.js +0 -76
  78. package/lib/Figure/FigureLicenseDialog.d.ts +0 -29
  79. package/lib/Figure/FigureLicenseDialog.js +0 -57
  80. package/lib/Notion/ConceptNotion.d.ts +0 -24
  81. package/lib/Notion/ConceptNotion.js +0 -141
  82. package/lib/Notion/FigureNotion.d.ts +0 -27
  83. package/lib/Notion/FigureNotion.js +0 -97
  84. package/lib/Notion/NotionVisualElement.d.ts +0 -22
  85. package/lib/Notion/NotionVisualElement.js +0 -75
  86. package/lib/utils/createUniversalPortal.d.ts +0 -9
  87. package/lib/utils/createUniversalPortal.js +0 -32
  88. package/src/Animation/Fade.tsx +0 -46
  89. package/src/Animation/index.ts +0 -1
  90. package/src/AudioPlayer/initAudioPlayers.tsx +0 -57
  91. package/src/Dialog/Dialog.tsx +0 -80
  92. package/src/Dialog/component.dialog.scss +0 -144
  93. package/src/Dialog/index.ts +0 -13
  94. package/src/Figure/FigureLicense.tsx +0 -75
  95. package/src/Figure/FigureLicenseDialog.tsx +0 -51
  96. package/src/Notion/ConceptNotion.tsx +0 -170
  97. package/src/Notion/FigureNotion.tsx +0 -104
  98. package/src/Notion/NotionVisualElement.tsx +0 -80
  99. package/src/utils/createUniversalPortal.tsx +0 -23
@@ -1,117 +1,41 @@
1
1
  "use strict";
2
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); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.default = exports.FigureCaption = void 0;
7
+ exports.default = void 0;
7
8
  var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
8
9
  var _util = require("@ndla/util");
9
- var _common = require("@ndla/icons/common");
10
- var _notion = require("@ndla/notion");
11
- var _safelink = _interopRequireDefault(require("@ndla/safelink"));
12
- var _button = require("@ndla/button");
13
- var _reactDeviceDetect = require("react-device-detect");
14
10
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
15
11
  var _excluded = ["children", "type", "resizeIframe", "className"];
12
+ /**
13
+ * Copyright (c) 2016-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 components is used to render static markup serverside
16
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
- 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); }
18
- 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; }
19
- 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; }
20
21
  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; }
21
22
  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; }
22
23
  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; }
23
24
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
24
- 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); } /**
25
- * Copyright (c) 2016-present, NDLA.
26
- *
27
- * This source code is licensed under the GPLv3 license found in the
28
- * LICENSE file in the root directory of this source tree.
29
- *
30
- */ // N.B These components is used to render static markup serverside
31
- // Any interactivty is added by scripts located in the ndla-article-scripts package
25
+ 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); }
26
+ 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; }
27
+ 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; }
32
28
  var classes = new _reactBemHelper.default({
33
29
  name: 'figure',
34
30
  prefix: 'c-'
35
31
  });
36
- var FigureCaption = function FigureCaption(_ref) {
37
- var figureId = _ref.figureId,
38
- id = _ref.id,
39
- modalButton = _ref.modalButton,
40
- children = _ref.children,
41
- caption = _ref.caption,
42
- authors = _ref.authors,
43
- reuseLabel = _ref.reuseLabel,
44
- licenseRights = _ref.licenseRights,
45
- locale = _ref.locale,
46
- link = _ref.link,
47
- hideFigcaption = _ref.hideFigcaption,
48
- hasLinkedVideo = _ref.hasLinkedVideo,
49
- hideIconsAndAuthors = _ref.hideIconsAndAuthors,
50
- linkedVideoMessages = _ref.linkedVideoMessages,
51
- linkedVideoButton = _ref.linkedVideoButton,
52
- className = _ref.className;
53
- return (0, _jsxRuntime.jsxs)("figcaption", _objectSpread(_objectSpread({}, classes('caption', hideFigcaption && !_reactDeviceDetect.isMobile ? 'hidden-caption' : undefined, className)), {}, {
54
- children: [caption ? (0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, classes('info')), {}, {
55
- children: (0, _util.parseMarkdown)(caption)
56
- })) : null, (0, _jsxRuntime.jsx)("footer", _objectSpread(_objectSpread({}, classes('byline')), {}, {
57
- children: (0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, classes('byline-licenselist')), {}, {
58
- children: [(0, _jsxRuntime.jsx)(_notion.LicenseByline, {
59
- licenseRights: hideIconsAndAuthors ? [] : licenseRights,
60
- locale: locale,
61
- marginRight: true,
62
- children: (0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, classes('byline-author-buttons', hideIconsAndAuthors ? 'no-siblings' : undefined)), {}, {
63
- children: [!hideIconsAndAuthors && (0, _jsxRuntime.jsx)("span", _objectSpread(_objectSpread({}, classes('byline-authors')), {}, {
64
- children: authors === null || authors === void 0 ? void 0 : authors.map(function (author) {
65
- return author.name;
66
- }).join(', ')
67
- })), (0, _jsxRuntime.jsxs)("div", {
68
- children: [modalButton ? modalButton : (0, _jsxRuntime.jsx)(_button.ButtonV2, {
69
- shape: "pill",
70
- variant: "outline",
71
- size: "small",
72
- "data-dialog-trigger-id": id,
73
- "data-dialog-source-id": figureId,
74
- children: reuseLabel
75
- }), hasLinkedVideo && (linkedVideoButton ? linkedVideoButton : (0, _jsxRuntime.jsxs)(_button.ButtonV2, _objectSpread(_objectSpread({
76
- shape: "pill",
77
- variant: "outline",
78
- size: "small"
79
- }, classes('toggleAlternativeVideo')), {}, {
80
- children: [(0, _jsxRuntime.jsx)("span", {
81
- className: "original",
82
- children: linkedVideoMessages === null || linkedVideoMessages === void 0 ? void 0 : linkedVideoMessages.alternative
83
- }), (0, _jsxRuntime.jsx)("span", {
84
- className: "alternative hidden",
85
- children: linkedVideoMessages === null || linkedVideoMessages === void 0 ? void 0 : linkedVideoMessages.original
86
- })]
87
- })))]
88
- }), children]
89
- }))
90
- }), link && (0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, classes('link-wrapper')), {}, {
91
- children: [(0, _jsxRuntime.jsxs)(_safelink.default, _objectSpread(_objectSpread({
92
- to: link.url
93
- }, classes('link')), {}, {
94
- target: link.external ? '_blank' : undefined,
95
- rel: link.external ? 'noopener noreferrer' : undefined,
96
- children: [(0, _jsxRuntime.jsx)("span", _objectSpread(_objectSpread({}, classes('link-text')), {}, {
97
- children: link.text
98
- })), (0, _jsxRuntime.jsx)(_common.Link, {})]
99
- })), link.description && (0, _jsxRuntime.jsx)("p", _objectSpread(_objectSpread({}, classes('link-description')), {}, {
100
- children: link.description
101
- }))]
102
- }))]
103
- }))
104
- }))]
105
- }));
106
- };
107
- exports.FigureCaption = FigureCaption;
108
- var Figure = function Figure(_ref2) {
109
- var children = _ref2.children,
110
- _ref2$type = _ref2.type,
111
- type = _ref2$type === void 0 ? 'full' : _ref2$type,
112
- resizeIframe = _ref2.resizeIframe,
113
- className = _ref2.className,
114
- rest = _objectWithoutProperties(_ref2, _excluded);
32
+ var Figure = function Figure(_ref) {
33
+ var children = _ref.children,
34
+ _ref$type = _ref.type,
35
+ type = _ref$type === void 0 ? 'full' : _ref$type,
36
+ resizeIframe = _ref.resizeIframe,
37
+ className = _ref.className,
38
+ rest = _objectWithoutProperties(_ref, _excluded);
115
39
  var typeClass = type === 'full-column' ? 'c-figure--full-column' : "u-float-".concat(type);
116
40
  var right = ['small-right', 'xsmall-right'].includes(type);
117
41
  return (0, _jsxRuntime.jsx)("figure", _objectSpread(_objectSpread(_objectSpread({
@@ -5,9 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import Figure, { FigureCaption } from './Figure';
9
- export { Figure, FigureCaption };
10
- export { FigureLicenseDialog } from './FigureLicenseDialog';
8
+ export { default as Figure } from './Figure';
11
9
  export { FigureExpandButton } from './FigureExpandButton';
12
10
  export { FigureBylineExpandButton } from './FigureBylineExpandButton';
13
11
  export { FigureOpenDialogButton } from './FigureOpenDialogButton';
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
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
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -16,34 +15,20 @@ Object.defineProperty(exports, "FigureBylineExpandButton", {
16
15
  return _FigureBylineExpandButton.FigureBylineExpandButton;
17
16
  }
18
17
  });
19
- Object.defineProperty(exports, "FigureCaption", {
20
- enumerable: true,
21
- get: function get() {
22
- return _Figure.FigureCaption;
23
- }
24
- });
25
18
  Object.defineProperty(exports, "FigureExpandButton", {
26
19
  enumerable: true,
27
20
  get: function get() {
28
21
  return _FigureExpandButton.FigureExpandButton;
29
22
  }
30
23
  });
31
- Object.defineProperty(exports, "FigureLicenseDialog", {
32
- enumerable: true,
33
- get: function get() {
34
- return _FigureLicenseDialog.FigureLicenseDialog;
35
- }
36
- });
37
24
  Object.defineProperty(exports, "FigureOpenDialogButton", {
38
25
  enumerable: true,
39
26
  get: function get() {
40
27
  return _FigureOpenDialogButton.FigureOpenDialogButton;
41
28
  }
42
29
  });
43
- var _Figure = _interopRequireWildcard(require("./Figure"));
44
- var _FigureLicenseDialog = require("./FigureLicenseDialog");
30
+ var _Figure = _interopRequireDefault(require("./Figure"));
45
31
  var _FigureExpandButton = require("./FigureExpandButton");
46
32
  var _FigureBylineExpandButton = require("./FigureBylineExpandButton");
47
33
  var _FigureOpenDialogButton = require("./FigureOpenDialogButton");
48
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
49
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
34
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,5 +1 @@
1
- export { default as ConceptNotion } from './ConceptNotion';
2
1
  export { default as Notion } from './Notion';
3
- export { default as NotionVisualElement } from './NotionVisualElement';
4
- export type { NotionVisualElementType } from './NotionVisualElement';
5
- export type { ConceptNotionType } from './ConceptNotion';
@@ -3,25 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "ConceptNotion", {
7
- enumerable: true,
8
- get: function get() {
9
- return _ConceptNotion.default;
10
- }
11
- });
12
6
  Object.defineProperty(exports, "Notion", {
13
7
  enumerable: true,
14
8
  get: function get() {
15
9
  return _Notion.default;
16
10
  }
17
11
  });
18
- Object.defineProperty(exports, "NotionVisualElement", {
19
- enumerable: true,
20
- get: function get() {
21
- return _NotionVisualElement.default;
22
- }
23
- });
24
- var _ConceptNotion = _interopRequireDefault(require("./ConceptNotion"));
25
12
  var _Notion = _interopRequireDefault(require("./Notion"));
26
- var _NotionVisualElement = _interopRequireDefault(require("./NotionVisualElement"));
27
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }