@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.
- package/es/Article/Article.js +3 -3
- package/es/AudioPlayer/index.js +0 -2
- package/es/Embed/conceptComponents.js +15 -8
- package/es/Figure/Figure.js +11 -89
- package/es/Figure/index.js +1 -3
- package/es/Notion/index.js +1 -3
- package/es/all.css +1 -1
- package/es/index.js +3 -4
- package/es/locale/messages-en.js +7 -2
- package/es/locale/messages-nb.js +7 -2
- package/es/locale/messages-nn.js +7 -2
- package/es/locale/messages-se.js +7 -2
- package/es/locale/messages-sma.js +7 -2
- package/lib/Article/Article.js +3 -3
- package/lib/AudioPlayer/index.d.ts +0 -2
- package/lib/AudioPlayer/index.js +0 -7
- package/lib/Embed/conceptComponents.js +17 -10
- package/lib/Figure/Figure.d.ts +0 -38
- package/lib/Figure/Figure.js +20 -96
- package/lib/Figure/index.d.ts +1 -3
- package/lib/Figure/index.js +2 -17
- package/lib/Notion/index.d.ts +0 -4
- package/lib/Notion/index.js +0 -14
- package/lib/all.css +1 -1
- package/lib/index.d.ts +3 -5
- package/lib/index.js +1 -32
- package/lib/locale/messages-en.d.ts +5 -0
- package/lib/locale/messages-en.js +7 -2
- package/lib/locale/messages-nb.d.ts +5 -0
- package/lib/locale/messages-nb.js +7 -2
- package/lib/locale/messages-nn.d.ts +5 -0
- package/lib/locale/messages-nn.js +7 -2
- package/lib/locale/messages-se.d.ts +5 -0
- package/lib/locale/messages-se.js +7 -2
- package/lib/locale/messages-sma.d.ts +5 -0
- package/lib/locale/messages-sma.js +7 -2
- package/package.json +18 -22
- package/src/Article/Article.tsx +1 -1
- package/src/AudioPlayer/AudiPlayer.stories.tsx +88 -0
- package/src/AudioPlayer/index.ts +0 -2
- package/src/Embed/IframeEmbed.stories.tsx +15 -0
- package/src/Embed/ImageEmbed.stories.tsx +169 -2
- package/src/Embed/RelatedContentEmbed.stories.tsx +438 -0
- package/src/Embed/conceptComponents.tsx +13 -1
- package/src/Figure/Figure.tsx +1 -120
- package/src/Figure/index.ts +1 -3
- package/src/Notion/index.ts +0 -4
- package/src/index.ts +3 -13
- package/src/locale/messages-en.ts +7 -2
- package/src/locale/messages-nb.ts +7 -2
- package/src/locale/messages-nn.ts +7 -2
- package/src/locale/messages-se.ts +7 -2
- package/src/locale/messages-sma.ts +7 -2
- package/src/main.scss +0 -1
- package/es/Animation/Fade.js +0 -62
- package/es/Animation/index.js +0 -1
- package/es/AudioPlayer/initAudioPlayers.js +0 -60
- package/es/Dialog/Dialog.js +0 -70
- package/es/Dialog/index.js +0 -11
- package/es/Figure/FigureLicense.js +0 -72
- package/es/Figure/FigureLicenseDialog.js +0 -54
- package/es/Notion/ConceptNotion.js +0 -135
- package/es/Notion/FigureNotion.js +0 -93
- package/es/Notion/NotionVisualElement.js +0 -68
- package/es/utils/createUniversalPortal.js +0 -25
- package/lib/Animation/Fade.d.ts +0 -17
- package/lib/Animation/Fade.js +0 -70
- package/lib/Animation/index.d.ts +0 -1
- package/lib/Animation/index.js +0 -13
- package/lib/AudioPlayer/initAudioPlayers.d.ts +0 -11
- package/lib/AudioPlayer/initAudioPlayers.js +0 -69
- package/lib/Dialog/Dialog.d.ts +0 -23
- package/lib/Dialog/Dialog.js +0 -75
- package/lib/Dialog/index.d.ts +0 -10
- package/lib/Dialog/index.js +0 -22
- package/lib/Figure/FigureLicense.d.ts +0 -33
- package/lib/Figure/FigureLicense.js +0 -76
- package/lib/Figure/FigureLicenseDialog.d.ts +0 -29
- package/lib/Figure/FigureLicenseDialog.js +0 -57
- package/lib/Notion/ConceptNotion.d.ts +0 -24
- package/lib/Notion/ConceptNotion.js +0 -141
- package/lib/Notion/FigureNotion.d.ts +0 -27
- package/lib/Notion/FigureNotion.js +0 -97
- package/lib/Notion/NotionVisualElement.d.ts +0 -22
- package/lib/Notion/NotionVisualElement.js +0 -75
- package/lib/utils/createUniversalPortal.d.ts +0 -9
- package/lib/utils/createUniversalPortal.js +0 -32
- package/src/Animation/Fade.tsx +0 -46
- package/src/Animation/index.ts +0 -1
- package/src/AudioPlayer/initAudioPlayers.tsx +0 -57
- package/src/Dialog/Dialog.tsx +0 -80
- package/src/Dialog/component.dialog.scss +0 -144
- package/src/Dialog/index.ts +0 -13
- package/src/Figure/FigureLicense.tsx +0 -75
- package/src/Figure/FigureLicenseDialog.tsx +0 -51
- package/src/Notion/ConceptNotion.tsx +0 -170
- package/src/Notion/FigureNotion.tsx +0 -104
- package/src/Notion/NotionVisualElement.tsx +0 -80
- package/src/utils/createUniversalPortal.tsx +0 -23
package/es/Figure/Figure.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
-
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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({
|
package/es/Figure/index.js
CHANGED
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
|
|
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';
|
package/es/Notion/index.js
CHANGED