@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,12 +1,12 @@
1
- var _excluded = ["children", "type", "resizeIframe", "className"];
2
1
  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
- 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
- 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; }
2
+ var _excluded = ["children", "type", "resizeIframe", "className"];
5
3
  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; }
6
4
  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; }
7
5
  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; }
8
6
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
9
7
  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); }
8
+ 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; }
9
+ 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; }
10
10
  /**
11
11
  * Copyright (c) 2016-present, NDLA.
12
12
  *
@@ -16,99 +16,21 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
16
16
  */
17
17
 
18
18
  // N.B These components is used to render static markup serverside
19
- // Any interactivty is added by scripts located in the ndla-article-scripts package
20
19
 
21
20
  import BEMHelper from 'react-bem-helper';
22
- import { isFunction as isFunctionHelper, parseMarkdown } from '@ndla/util';
23
- import { Link as LinkIcon } from '@ndla/icons/common';
24
- import { LicenseByline } from '@ndla/notion';
25
- import SafeLink from '@ndla/safelink';
26
- import { ButtonV2 } from '@ndla/button';
27
- import { isMobile } from 'react-device-detect';
21
+ import { isFunction as isFunctionHelper } from '@ndla/util';
28
22
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
29
- import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
30
23
  var classes = new BEMHelper({
31
24
  name: 'figure',
32
25
  prefix: 'c-'
33
26
  });
34
- export var FigureCaption = function FigureCaption(_ref) {
35
- var figureId = _ref.figureId,
36
- id = _ref.id,
37
- modalButton = _ref.modalButton,
38
- children = _ref.children,
39
- caption = _ref.caption,
40
- authors = _ref.authors,
41
- reuseLabel = _ref.reuseLabel,
42
- licenseRights = _ref.licenseRights,
43
- locale = _ref.locale,
44
- link = _ref.link,
45
- hideFigcaption = _ref.hideFigcaption,
46
- hasLinkedVideo = _ref.hasLinkedVideo,
47
- hideIconsAndAuthors = _ref.hideIconsAndAuthors,
48
- linkedVideoMessages = _ref.linkedVideoMessages,
49
- linkedVideoButton = _ref.linkedVideoButton,
50
- className = _ref.className;
51
- return _jsxs("figcaption", _objectSpread(_objectSpread({}, classes('caption', hideFigcaption && !isMobile ? 'hidden-caption' : undefined, className)), {}, {
52
- children: [caption ? _jsx("div", _objectSpread(_objectSpread({}, classes('info')), {}, {
53
- children: parseMarkdown(caption)
54
- })) : null, _jsx("footer", _objectSpread(_objectSpread({}, classes('byline')), {}, {
55
- children: _jsxs("div", _objectSpread(_objectSpread({}, classes('byline-licenselist')), {}, {
56
- children: [_jsx(LicenseByline, {
57
- licenseRights: hideIconsAndAuthors ? [] : licenseRights,
58
- locale: locale,
59
- marginRight: true,
60
- children: _jsxs("div", _objectSpread(_objectSpread({}, classes('byline-author-buttons', hideIconsAndAuthors ? 'no-siblings' : undefined)), {}, {
61
- children: [!hideIconsAndAuthors && _jsx("span", _objectSpread(_objectSpread({}, classes('byline-authors')), {}, {
62
- children: authors === null || authors === void 0 ? void 0 : authors.map(function (author) {
63
- return author.name;
64
- }).join(', ')
65
- })), _jsxs("div", {
66
- children: [modalButton ? modalButton : _jsx(ButtonV2, {
67
- shape: "pill",
68
- variant: "outline",
69
- size: "small",
70
- "data-dialog-trigger-id": id,
71
- "data-dialog-source-id": figureId,
72
- children: reuseLabel
73
- }), hasLinkedVideo && (linkedVideoButton ? linkedVideoButton : _jsxs(ButtonV2, _objectSpread(_objectSpread({
74
- shape: "pill",
75
- variant: "outline",
76
- size: "small"
77
- }, classes('toggleAlternativeVideo')), {}, {
78
- children: [_jsx("span", {
79
- className: "original",
80
- children: linkedVideoMessages === null || linkedVideoMessages === void 0 ? void 0 : linkedVideoMessages.alternative
81
- }), _jsx("span", {
82
- className: "alternative hidden",
83
- children: linkedVideoMessages === null || linkedVideoMessages === void 0 ? void 0 : linkedVideoMessages.original
84
- })]
85
- })))]
86
- }), children]
87
- }))
88
- }), link && _jsxs("div", _objectSpread(_objectSpread({}, classes('link-wrapper')), {}, {
89
- children: [_jsxs(SafeLink, _objectSpread(_objectSpread({
90
- to: link.url
91
- }, classes('link')), {}, {
92
- target: link.external ? '_blank' : undefined,
93
- rel: link.external ? 'noopener noreferrer' : undefined,
94
- children: [_jsx("span", _objectSpread(_objectSpread({}, classes('link-text')), {}, {
95
- children: link.text
96
- })), _jsx(LinkIcon, {})]
97
- })), link.description && _jsx("p", _objectSpread(_objectSpread({}, classes('link-description')), {}, {
98
- children: link.description
99
- }))]
100
- }))]
101
- }))
102
- }))]
103
- }));
104
- };
105
- var Figure = function Figure(_ref2) {
106
- var children = _ref2.children,
107
- _ref2$type = _ref2.type,
108
- type = _ref2$type === void 0 ? 'full' : _ref2$type,
109
- resizeIframe = _ref2.resizeIframe,
110
- className = _ref2.className,
111
- rest = _objectWithoutProperties(_ref2, _excluded);
27
+ var Figure = function Figure(_ref) {
28
+ var children = _ref.children,
29
+ _ref$type = _ref.type,
30
+ type = _ref$type === void 0 ? 'full' : _ref$type,
31
+ resizeIframe = _ref.resizeIframe,
32
+ className = _ref.className,
33
+ rest = _objectWithoutProperties(_ref, _excluded);
112
34
  var typeClass = type === 'full-column' ? 'c-figure--full-column' : "u-float-".concat(type);
113
35
  var right = ['small-right', 'xsmall-right'].includes(type);
114
36
  return _jsx("figure", _objectSpread(_objectSpread(_objectSpread({
@@ -6,9 +6,7 @@
6
6
  *
7
7
  */
8
8
 
9
- import Figure, { FigureCaption } from './Figure';
10
- export { Figure, FigureCaption };
11
- export { FigureLicenseDialog } from './FigureLicenseDialog';
9
+ export { default as Figure } from './Figure';
12
10
  export { FigureExpandButton } from './FigureExpandButton';
13
11
  export { FigureBylineExpandButton } from './FigureBylineExpandButton';
14
12
  export { FigureOpenDialogButton } from './FigureOpenDialogButton';
@@ -1,3 +1 @@
1
- export { default as ConceptNotion } from './ConceptNotion';
2
- export { default as Notion } from './Notion';
3
- export { default as NotionVisualElement } from './NotionVisualElement';
1
+ export { default as Notion } from './Notion';