@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.
- package/es/Article/ArticleAuthorContent.js +1 -2
- package/es/BackgroundImage/BackgroundImage.js +27 -0
- package/es/BackgroundImage/index.js +2 -0
- package/es/ContentLoader/index.js +83 -0
- package/es/Dialog/Dialog.js +64 -0
- package/es/Dialog/index.js +10 -0
- package/es/FactBox/FactBox.js +7 -11
- package/es/Figure/Figure.js +93 -0
- package/es/Figure/FigureExpandButton.js +28 -0
- package/es/Figure/FigureLicense.js +54 -0
- package/es/Figure/FigureLicenseDialog.js +43 -0
- package/es/Figure/index.js +12 -0
- package/es/FileList/File.js +48 -0
- package/es/FileList/FileList.js +20 -0
- package/es/FileList/index.js +3 -0
- package/es/Hero/Hero.js +64 -0
- package/es/Hero/index.js +8 -0
- package/es/Image/Image.js +96 -0
- package/es/Image/ImageLink.js +46 -0
- package/es/Image/LazyLoadImage.js +47 -0
- package/es/Image/index.js +11 -0
- package/es/InfoBox/InfoBox.js +11 -0
- package/es/InfoBox/index.js +1 -0
- package/es/InfoWidget/InfoWidget.js +57 -0
- package/es/InfoWidget/index.js +2 -0
- package/es/Logo/Logo.js +51 -0
- package/es/Logo/SvgLogo.js +54 -0
- package/es/Logo/index.js +9 -0
- package/es/Masthead/Masthead.js +67 -0
- package/es/Masthead/index.js +10 -0
- package/es/NoContentBox/NoContentBox.js +26 -0
- package/es/NoContentBox/index.js +9 -0
- package/es/Portrait/Portrait.js +30 -0
- package/es/Portrait/index.js +9 -0
- package/es/RelatedArticleList/RelatedArticleList.js +4 -23
- package/es/Topic/Topic.js +20 -20
- package/es/Translation/Translation.js +22 -0
- package/es/Translation/TranslationBox.js +17 -0
- package/es/Translation/TranslationLine.js +37 -0
- package/es/Translation/index.js +3 -0
- package/es/index-javascript.js +1 -18
- package/es/index.js +17 -0
- package/es/locale/messages-en.js +4 -0
- package/es/locale/messages-nb.js +5 -1
- package/es/locale/messages-nn.js +5 -1
- package/lib/BackgroundImage/BackgroundImage.js +40 -0
- package/lib/BackgroundImage/index.js +13 -0
- package/lib/ContentLoader/index.js +88 -0
- package/lib/Dialog/Dialog.d.ts +1 -1
- package/lib/Dialog/Dialog.js +70 -0
- package/lib/Dialog/index.js +24 -0
- package/lib/FactBox/FactBox.d.ts +16 -0
- package/lib/FactBox/FactBox.js +5 -11
- package/lib/FactBox/index.d.ts +2 -0
- package/lib/Figure/Figure.js +105 -0
- package/lib/Figure/FigureExpandButton.js +41 -0
- package/lib/Figure/FigureLicense.js +66 -0
- package/lib/Figure/FigureLicenseDialog.js +48 -0
- package/lib/Figure/index.js +49 -0
- package/lib/FileList/File.js +63 -0
- package/lib/FileList/FileList.js +34 -0
- package/lib/FileList/index.js +21 -0
- package/lib/Hero/Hero.js +100 -0
- package/lib/Hero/index.js +55 -0
- package/lib/Image/Image.js +105 -0
- package/lib/Image/ImageLink.js +50 -0
- package/lib/Image/LazyLoadImage.js +51 -0
- package/lib/Image/index.js +38 -0
- package/lib/InfoBox/InfoBox.js +24 -0
- package/lib/InfoBox/index.js +15 -0
- package/lib/InfoWidget/InfoWidget.js +73 -0
- package/lib/InfoWidget/index.js +13 -0
- package/lib/Logo/Logo.js +70 -0
- package/lib/Logo/SvgLogo.js +59 -0
- package/lib/Logo/index.js +20 -0
- package/lib/Masthead/Masthead.js +82 -0
- package/lib/Masthead/index.js +30 -0
- package/lib/NoContentBox/NoContentBox.js +43 -0
- package/lib/NoContentBox/index.js +20 -0
- package/lib/Portrait/Portrait.js +43 -0
- package/lib/Portrait/index.js +20 -0
- package/lib/RelatedArticleList/RelatedArticleList.d.ts +25 -0
- package/lib/RelatedArticleList/RelatedArticleList.js +2 -23
- package/lib/RelatedArticleList/index.d.ts +10 -0
- package/lib/Topic/Topic.js +20 -20
- package/lib/Translation/Translation.js +35 -0
- package/lib/Translation/TranslationBox.js +29 -0
- package/lib/Translation/TranslationLine.js +42 -0
- package/lib/Translation/index.js +31 -0
- package/lib/index-javascript.js +0 -230
- package/lib/index.d.ts +3 -0
- package/lib/index.js +263 -0
- package/lib/locale/messages-en.js +4 -0
- package/lib/locale/messages-nb.js +5 -1
- package/lib/locale/messages-nn.js +5 -1
- package/lib/utils/createUniversalPortal.d.ts +9 -0
- package/package.json +4 -4
- package/src/FactBox/{FactBox.jsx → FactBox.tsx} +12 -14
- package/src/FactBox/{index.js → index.ts} +0 -0
- package/src/RelatedArticleList/{RelatedArticleList.jsx → RelatedArticleList.tsx} +43 -30
- package/src/RelatedArticleList/{index.js → index.ts} +0 -0
- package/src/index-javascript.js +0 -3
- package/src/index.ts +6 -0
- package/src/utils/{createUniversalPortal.jsx → createUniversalPortal.tsx} +3 -3
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
import React from 'react';
|
|
9
|
+
import BEMHelper from 'react-bem-helper';
|
|
10
|
+
import { jsx as ___EmotionJSX } from "@emotion/core";
|
|
11
|
+
var classes = new BEMHelper({
|
|
12
|
+
name: 'translation',
|
|
13
|
+
prefix: 'c-'
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
var Translation = function Translation(_ref) {
|
|
17
|
+
var children = _ref.children,
|
|
18
|
+
index = _ref.index;
|
|
19
|
+
return ___EmotionJSX("div", classes(''), ___EmotionJSX("div", classes('index'), index), ___EmotionJSX("dl", classes('wrapper'), children));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default Translation;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react'; //@ts-ignore
|
|
2
|
+
|
|
3
|
+
import { ArticleTabs } from '@ndla/tabs';
|
|
4
|
+
import { jsx as ___EmotionJSX } from "@emotion/core";
|
|
5
|
+
|
|
6
|
+
var TranslationBox = function TranslationBox(_ref) {
|
|
7
|
+
var tabs = _ref.tabs;
|
|
8
|
+
return ___EmotionJSX("div", {
|
|
9
|
+
className: "c-translation-box"
|
|
10
|
+
}, ___EmotionJSX("div", {
|
|
11
|
+
className: "c-bodybox c-bodybox--translation"
|
|
12
|
+
}, ___EmotionJSX(ArticleTabs, {
|
|
13
|
+
tabs: tabs
|
|
14
|
+
})));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default TranslationBox;
|
|
@@ -0,0 +1,37 @@
|
|
|
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) 2016-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
|
+
import React from 'react';
|
|
11
|
+
import BEMHelper from 'react-bem-helper';
|
|
12
|
+
import { jsx as ___EmotionJSX } from "@emotion/core";
|
|
13
|
+
var classes = new BEMHelper({
|
|
14
|
+
name: 'translation',
|
|
15
|
+
prefix: 'c-'
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
var TranslationLine = function TranslationLine(_ref) {
|
|
19
|
+
var children = _ref.children,
|
|
20
|
+
lang = _ref.lang,
|
|
21
|
+
langName = _ref.langName,
|
|
22
|
+
_ref$isTerm = _ref.isTerm,
|
|
23
|
+
isTerm = _ref$isTerm === void 0 ? false : _ref$isTerm;
|
|
24
|
+
var hasLang = langName && lang;
|
|
25
|
+
|
|
26
|
+
var content = ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", _extends({}, classes('line-body'), {
|
|
27
|
+
lang: lang
|
|
28
|
+
}), children), hasLang && ___EmotionJSX("div", classes('line-lang'), langName));
|
|
29
|
+
|
|
30
|
+
if (isTerm) {
|
|
31
|
+
return ___EmotionJSX("dt", classes('line', hasLang ? 'lang' : ''), content);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return ___EmotionJSX("dd", classes('line', hasLang ? 'lang' : ''), content);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default TranslationLine;
|
package/es/index-javascript.js
CHANGED
|
@@ -5,32 +5,15 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
export { InfoBox } from './InfoBox';
|
|
9
|
-
export { default as Logo } from './Logo';
|
|
10
8
|
export { default as Table } from './Table';
|
|
11
9
|
export { FilterList, FilterListPhone, FilterButtons } from './Filter';
|
|
12
|
-
export { default as FactBox } from './FactBox';
|
|
13
|
-
export { default as FileList, File } from './FileList';
|
|
14
10
|
export { SearchOverlay, SearchField, SearchPage, SearchResult, SearchResultAuthor, SearchResultList, SearchResultItem, SearchFilter, SearchFilterList, SearchPopoverFilter, ActiveFilters, ToggleSearchButton } from './Search';
|
|
15
11
|
export { default as ContentTypeBadge, SubjectMaterialBadge, TasksAndActivitiesBadge, AssessmentResourcesBadge, LearningPathBadge, SubjectBadge, ExternalLearningResourcesBadge, SourceMaterialBadge } from './ContentTypeBadge';
|
|
16
|
-
export { createUniversalPortal } from './utils/createUniversalPortal';
|
|
17
12
|
export { default as TopicIntroductionList } from './TopicIntroductionList';
|
|
18
13
|
export { default as TopicMenu, TopicMenuButton } from './TopicMenu';
|
|
19
|
-
export { default as RelatedArticleList, RelatedArticle } from './RelatedArticleList';
|
|
20
14
|
export { default as CompetenceGoals, CompetenceGoalList, CompetenceGoalListHeading, CompetenceGoal, CompetenceGoalsDialog } from './CompetenceGoals';
|
|
21
|
-
export { default as NoContentBox } from './NoContentBox';
|
|
22
15
|
export { default as ResourcesWrapper, ResourcesTitle, ResourcesTopicTitle } from './ResourcesWrapper';
|
|
23
|
-
export { SubjectMaterialHero, TasksAndActivitiesHero, AssessmentResourcesHero, SubjectHero, ExternalLearningResourcesHero, SourceMaterialHero, Hero, NdlaFilmHero } from './Hero';
|
|
24
|
-
export { default as Masthead, MastheadItem } from './Masthead';
|
|
25
|
-
export { Figure, FigureCaption, FigureLicenseDialog, FigureExpandButton } from './Figure';
|
|
26
16
|
export { MediaList, MediaListItem, MediaListItemBody, MediaListItemActions, MediaListItemImage, MediaListItemMeta } from './MediaList';
|
|
27
17
|
export { EmbeddedTwitter, EmbeddedFacebook, EmbeddedFacebookPage } from './Embedded';
|
|
28
|
-
export { default as Image, ImageLink } from './Image';
|
|
29
|
-
export { makeSrcQueryString } from './Image';
|
|
30
|
-
export { default as Portrait } from './Portrait';
|
|
31
|
-
export { Translation, TranslationLine, TranslationBox } from './Translation';
|
|
32
|
-
export { default as ContentLoader } from './ContentLoader';
|
|
33
18
|
export { DisplayOnPageYOffset } from './Animation';
|
|
34
|
-
export {
|
|
35
|
-
export { FilmSlideshow, MovieGrid, AboutNdlaFilm, FilmMovieSearch, FilmMovieList, AllMoviesAlphabetically } from './NDLAFilm';
|
|
36
|
-
export { default as Spinner } from './Spinner';
|
|
19
|
+
export { FilmSlideshow, MovieGrid, AboutNdlaFilm, FilmMovieSearch, FilmMovieList, AllMoviesAlphabetically } from './NDLAFilm';
|
package/es/index.js
CHANGED
|
@@ -11,12 +11,29 @@
|
|
|
11
11
|
/** @ts-ignore */
|
|
12
12
|
export * from './index-javascript';
|
|
13
13
|
export { ArticleByline, ArticleContent, ArticleFootNotes, ArticleIntroduction, ArticleTitle, ArticleWrapper, ArticleHeaderWrapper, ArticleSideBar, default as Article } from './Article';
|
|
14
|
+
export { createUniversalPortal } from './utils/createUniversalPortal';
|
|
15
|
+
export { default as NoContentBox } from './NoContentBox';
|
|
16
|
+
export { default as Masthead, MastheadItem } from './Masthead';
|
|
17
|
+
export { default as Portrait } from './Portrait';
|
|
18
|
+
export { default as ContentLoader } from './ContentLoader';
|
|
19
|
+
export { default as RelatedArticleList, RelatedArticle } from './RelatedArticleList';
|
|
14
20
|
export { ErrorResourceAccessDenied, default as ErrorMessage } from './ErrorMessage';
|
|
21
|
+
export { default as FileList, File } from './FileList';
|
|
15
22
|
export { BlogPost, BlogPostWrapper } from './BlogPosts';
|
|
23
|
+
export { default as Logo } from './Logo';
|
|
24
|
+
export { InfoBox } from './InfoBox';
|
|
25
|
+
export { default as InfoWidget } from './InfoWidget';
|
|
16
26
|
export { FrontpageInfo, FrontpageFilm, FrontpageToolbox, FrontpageMultidisciplinarySubject, FrontpageHeader, FrontpageSubjectIllustration, FrontpageSearch, FrontpageProgramMenu } from './Frontpage';
|
|
27
|
+
export { default as FactBox } from './FactBox';
|
|
28
|
+
export { default as Image, ImageLink } from './Image';
|
|
29
|
+
export { makeSrcQueryString } from './Image';
|
|
30
|
+
export { SubjectMaterialHero, TasksAndActivitiesHero, AssessmentResourcesHero, SubjectHero, ExternalLearningResourcesHero, SourceMaterialHero, Hero, NdlaFilmHero } from './Hero';
|
|
17
31
|
export { Footer, EditorName, FooterText, FooterAuth } from './Footer';
|
|
32
|
+
export { Figure, FigureCaption, FigureLicenseDialog, FigureExpandButton } from './Figure';
|
|
18
33
|
export { LanguageSelector } from './LanguageSelector';
|
|
19
34
|
export { LearningPathWrapper, LearningPathContent, LearningPathMenu, LearningPathSticky, LearningPathInformation, LearningPathStickySibling, LearningPathStickyPlaceholder, LearningPathLastStepNavigation, LearningPathMobileStepInfo, LearningPathMobileHeader } from './LearningPaths';
|
|
35
|
+
export { Translation, TranslationLine, TranslationBox } from './Translation';
|
|
36
|
+
export { default as Spinner } from './Spinner';
|
|
20
37
|
export { default as SearchResultSleeve } from './Search/SearchResultSleeve';
|
|
21
38
|
export { default as ContentTypeResult } from './Search/ContentTypeResult';
|
|
22
39
|
export { SearchFieldForm } from './Search/SearchFieldForm';
|
package/es/locale/messages-en.js
CHANGED
|
@@ -774,6 +774,10 @@ var messages = _objectSpread(_objectSpread({
|
|
|
774
774
|
reuse: 'Use video',
|
|
775
775
|
error: 'Sorry, an error occurred while loading the video or metadata about the video.'
|
|
776
776
|
},
|
|
777
|
+
other: {
|
|
778
|
+
download: 'Download content',
|
|
779
|
+
reuse: 'Use content'
|
|
780
|
+
},
|
|
777
781
|
concept: {
|
|
778
782
|
showDescription: 'Show concept description',
|
|
779
783
|
error: {
|
package/es/locale/messages-nb.js
CHANGED
|
@@ -510,7 +510,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
510
510
|
es: 'Spansk',
|
|
511
511
|
zh: 'Kinesisk',
|
|
512
512
|
unknown: 'Ukjent',
|
|
513
|
-
prefixChangeLanguage: 'Velg
|
|
513
|
+
prefixChangeLanguage: 'Velg språk'
|
|
514
514
|
},
|
|
515
515
|
changeLanguage: {
|
|
516
516
|
nb: 'Endre språk til bokmål',
|
|
@@ -774,6 +774,10 @@ var messages = _objectSpread(_objectSpread({
|
|
|
774
774
|
reuse: 'Bruk video',
|
|
775
775
|
error: 'Beklager, en feil oppstod ved lasting av videoen eller metadata om videoen.'
|
|
776
776
|
},
|
|
777
|
+
other: {
|
|
778
|
+
download: 'Last ned innhold',
|
|
779
|
+
reuse: 'Bruk innhold'
|
|
780
|
+
},
|
|
777
781
|
concept: {
|
|
778
782
|
showDescription: 'Vis beskrivelsen av forklaringen.',
|
|
779
783
|
error: {
|
package/es/locale/messages-nn.js
CHANGED
|
@@ -510,7 +510,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
510
510
|
es: 'Spansk',
|
|
511
511
|
zh: 'Kinesisk',
|
|
512
512
|
unknown: 'Ukjent',
|
|
513
|
-
prefixChangeLanguage: 'Vel
|
|
513
|
+
prefixChangeLanguage: 'Vel språk'
|
|
514
514
|
},
|
|
515
515
|
changeLanguage: {
|
|
516
516
|
nb: 'Endre språk til bokmål',
|
|
@@ -774,6 +774,10 @@ var messages = _objectSpread(_objectSpread({
|
|
|
774
774
|
reuse: 'Bruk video',
|
|
775
775
|
error: 'Orsak, ein feil oppstod ved lasting av videoen eller metadata om videoen.'
|
|
776
776
|
},
|
|
777
|
+
other: {
|
|
778
|
+
download: 'Last ned innhald',
|
|
779
|
+
reuse: 'Bruk innhald'
|
|
780
|
+
},
|
|
777
781
|
concept: {
|
|
778
782
|
showDescription: 'Vis skildring av forklaringa',
|
|
779
783
|
error: {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
11
|
+
|
|
12
|
+
var _core = require("@emotion/core");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
var classes = (0, _reactBemHelper["default"])('c-background-image');
|
|
19
|
+
|
|
20
|
+
var BackgroundImage = function BackgroundImage(_ref) {
|
|
21
|
+
var images = _ref.images,
|
|
22
|
+
_ref$showOverlay = _ref.showOverlay,
|
|
23
|
+
showOverlay = _ref$showOverlay === void 0 ? false : _ref$showOverlay;
|
|
24
|
+
return (0, _core.jsx)("div", classes('', {
|
|
25
|
+
showOverlay: showOverlay
|
|
26
|
+
}), images && images.map(function (image) {
|
|
27
|
+
return image.types.map(function (type) {
|
|
28
|
+
return (0, _core.jsx)("div", _extends({
|
|
29
|
+
key: "".concat(image.url).concat(type)
|
|
30
|
+
}, classes('background', type), {
|
|
31
|
+
style: {
|
|
32
|
+
backgroundImage: "url(".concat(image.url, ")")
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
});
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var _default = BackgroundImage;
|
|
40
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _BackgroundImage = _interopRequireDefault(require("./BackgroundImage"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _BackgroundImage["default"];
|
|
13
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _util = require("@ndla/util");
|
|
11
|
+
|
|
12
|
+
var _core = require("@emotion/core");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
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); }
|
|
17
|
+
|
|
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
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
var ContentLoader = function ContentLoader(_ref) {
|
|
23
|
+
var children = _ref.children,
|
|
24
|
+
_ref$width = _ref.width,
|
|
25
|
+
width = _ref$width === void 0 ? 400 : _ref$width,
|
|
26
|
+
_ref$height = _ref.height,
|
|
27
|
+
height = _ref$height === void 0 ? 130 : _ref$height,
|
|
28
|
+
_ref$preserveAspectRa = _ref.preserveAspectRatio,
|
|
29
|
+
preserveAspectRatio = _ref$preserveAspectRa === void 0 ? 'xMidYMid meet' : _ref$preserveAspectRa,
|
|
30
|
+
_ref$className = _ref.className,
|
|
31
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
32
|
+
_ref$primaryColor = _ref.primaryColor,
|
|
33
|
+
primaryColor = _ref$primaryColor === void 0 ? '#f0f0f0' : _ref$primaryColor,
|
|
34
|
+
_ref$secondaryColor = _ref.secondaryColor,
|
|
35
|
+
secondaryColor = _ref$secondaryColor === void 0 ? '#e0e0e0' : _ref$secondaryColor,
|
|
36
|
+
_ref$speed = _ref.speed,
|
|
37
|
+
speed = _ref$speed === void 0 ? 2 : _ref$speed,
|
|
38
|
+
rest = _objectWithoutProperties(_ref, ["children", "width", "height", "preserveAspectRatio", "className", "primaryColor", "secondaryColor", "speed"]);
|
|
39
|
+
|
|
40
|
+
var idClip = (0, _util.uuid)();
|
|
41
|
+
var idGradient = (0, _util.uuid)();
|
|
42
|
+
return (0, _core.jsx)("svg", _extends({
|
|
43
|
+
viewBox: "0 0 ".concat(width, " ").concat(height),
|
|
44
|
+
version: "1.1",
|
|
45
|
+
preserveAspectRatio: preserveAspectRatio,
|
|
46
|
+
className: className
|
|
47
|
+
}, rest), (0, _core.jsx)("rect", {
|
|
48
|
+
style: {
|
|
49
|
+
fill: "url(#".concat(idGradient, ")")
|
|
50
|
+
},
|
|
51
|
+
clipPath: "url(#".concat(idClip, ")"),
|
|
52
|
+
x: "0",
|
|
53
|
+
y: "0",
|
|
54
|
+
width: width,
|
|
55
|
+
height: height
|
|
56
|
+
}), (0, _core.jsx)("defs", null, (0, _core.jsx)("clipPath", {
|
|
57
|
+
id: idClip
|
|
58
|
+
}, children), (0, _core.jsx)("linearGradient", {
|
|
59
|
+
id: idGradient
|
|
60
|
+
}, (0, _core.jsx)("stop", {
|
|
61
|
+
offset: "0%",
|
|
62
|
+
stopColor: primaryColor
|
|
63
|
+
}, (0, _core.jsx)("animate", {
|
|
64
|
+
attributeName: "offset",
|
|
65
|
+
values: "-2; 1",
|
|
66
|
+
dur: "".concat(speed, "s"),
|
|
67
|
+
repeatCount: "indefinite"
|
|
68
|
+
})), (0, _core.jsx)("stop", {
|
|
69
|
+
offset: "50%",
|
|
70
|
+
stopColor: secondaryColor
|
|
71
|
+
}, (0, _core.jsx)("animate", {
|
|
72
|
+
attributeName: "offset",
|
|
73
|
+
values: "-1.5; 1.5",
|
|
74
|
+
dur: "".concat(speed, "s"),
|
|
75
|
+
repeatCount: "indefinite"
|
|
76
|
+
})), (0, _core.jsx)("stop", {
|
|
77
|
+
offset: "100%",
|
|
78
|
+
stopColor: primaryColor
|
|
79
|
+
}, (0, _core.jsx)("animate", {
|
|
80
|
+
attributeName: "offset",
|
|
81
|
+
values: "-1; 2",
|
|
82
|
+
dur: "".concat(speed, "s"),
|
|
83
|
+
repeatCount: "indefinite"
|
|
84
|
+
})))));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
var _default = ContentLoader;
|
|
88
|
+
exports["default"] = _default;
|
package/lib/Dialog/Dialog.d.ts
CHANGED
|
@@ -19,5 +19,5 @@ interface Props {
|
|
|
19
19
|
disablePortal?: boolean;
|
|
20
20
|
onClose?: () => void;
|
|
21
21
|
}
|
|
22
|
-
export declare const Dialog: ({ children, messages, id, labelledby, label, modifier, disablePortal, hidden, onClose, ...rest }: Props) =>
|
|
22
|
+
export declare const Dialog: ({ children, messages, id, labelledby, label, modifier, disablePortal, hidden, onClose, ...rest }: Props) => JSX.Element;
|
|
23
23
|
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Dialog = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
11
|
+
|
|
12
|
+
var _createUniversalPortal = require("../utils/createUniversalPortal");
|
|
13
|
+
|
|
14
|
+
var _core = require("@emotion/core");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
var classes = new _reactBemHelper["default"]({
|
|
25
|
+
name: 'dialog',
|
|
26
|
+
prefix: 'c-'
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
var Dialog = function Dialog(_ref) {
|
|
30
|
+
var children = _ref.children,
|
|
31
|
+
_ref$messages = _ref.messages,
|
|
32
|
+
messages = _ref$messages === void 0 ? {
|
|
33
|
+
close: 'Lukk'
|
|
34
|
+
} : _ref$messages,
|
|
35
|
+
id = _ref.id,
|
|
36
|
+
labelledby = _ref.labelledby,
|
|
37
|
+
label = _ref.label,
|
|
38
|
+
modifier = _ref.modifier,
|
|
39
|
+
_ref$disablePortal = _ref.disablePortal,
|
|
40
|
+
disablePortal = _ref$disablePortal === void 0 ? false : _ref$disablePortal,
|
|
41
|
+
_ref$hidden = _ref.hidden,
|
|
42
|
+
hidden = _ref$hidden === void 0 ? true : _ref$hidden,
|
|
43
|
+
onClose = _ref.onClose,
|
|
44
|
+
rest = _objectWithoutProperties(_ref, ["children", "messages", "id", "labelledby", "label", "modifier", "disablePortal", "hidden", "onClose"]);
|
|
45
|
+
|
|
46
|
+
var content = (0, _core.jsx)("div", _extends({}, classes('', modifier), {
|
|
47
|
+
"data-dialog-id": id,
|
|
48
|
+
role: "dialog",
|
|
49
|
+
"aria-hidden": hidden,
|
|
50
|
+
"aria-labelledby": labelledby,
|
|
51
|
+
"aria-label": label
|
|
52
|
+
}, rest), (0, _core.jsx)("div", classes('content'), (0, _core.jsx)("button", _extends({}, classes('close'), {
|
|
53
|
+
type: "button",
|
|
54
|
+
onClick: function onClick() {
|
|
55
|
+
if (onClose) {
|
|
56
|
+
onClose();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}), messages.close), children), (0, _core.jsx)("div", {
|
|
60
|
+
className: "o-backdrop"
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
if (disablePortal) {
|
|
64
|
+
return content;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return (0, _createUniversalPortal.createUniversalPortal)(content, 'body');
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
exports.Dialog = Dialog;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
|
|
14
|
+
var _Dialog = require("./Dialog");
|
|
15
|
+
|
|
16
|
+
/**
|
|
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
|
+
*/
|
|
23
|
+
var _default = _Dialog.Dialog;
|
|
24
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
import { ReactNode } from 'react';
|
|
9
|
+
interface Props {
|
|
10
|
+
dangerouslySetInnerHTML?: {
|
|
11
|
+
__html: string;
|
|
12
|
+
};
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare const FactBox: ({ children, dangerouslySetInnerHTML }: Props) => JSX.Element;
|
|
16
|
+
export default FactBox;
|
package/lib/FactBox/FactBox.js
CHANGED
|
@@ -7,8 +7,6 @@ exports["default"] = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
13
11
|
|
|
14
12
|
var _button = _interopRequireDefault(require("@ndla/button"));
|
|
@@ -20,9 +18,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
20
18
|
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); }
|
|
21
19
|
|
|
22
20
|
var toggleFactBox = function toggleFactBox(event) {
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
var _button$previousSibli, _aside$classList;
|
|
22
|
+
|
|
23
|
+
var button = event.currentTarget;
|
|
24
|
+
var aside = button === null || button === void 0 ? void 0 : (_button$previousSibli = button.previousSibling) === null || _button$previousSibli === void 0 ? void 0 : _button$previousSibli.parentElement;
|
|
25
|
+
aside === null || aside === void 0 ? void 0 : (_aside$classList = aside.classList) === null || _aside$classList === void 0 ? void 0 : _aside$classList.toggle('expanded');
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
var classes = new _reactBemHelper["default"]({
|
|
@@ -40,11 +40,5 @@ var FactBox = function FactBox(_ref) {
|
|
|
40
40
|
})));
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
FactBox.propTypes = {
|
|
44
|
-
dangerouslySetInnerHTML: _propTypes["default"].shape({
|
|
45
|
-
__html: _propTypes["default"].string.isRequired
|
|
46
|
-
}),
|
|
47
|
-
children: _propTypes["default"].node
|
|
48
|
-
};
|
|
49
43
|
var _default = FactBox;
|
|
50
44
|
exports["default"] = _default;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.FigureCaption = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
11
|
+
|
|
12
|
+
var _util = require("@ndla/util");
|
|
13
|
+
|
|
14
|
+
var _reactI18next = require("react-i18next");
|
|
15
|
+
|
|
16
|
+
var _common = require("@ndla/icons/common");
|
|
17
|
+
|
|
18
|
+
var _licenses = require("@ndla/licenses");
|
|
19
|
+
|
|
20
|
+
var _safelink = _interopRequireDefault(require("@ndla/safelink"));
|
|
21
|
+
|
|
22
|
+
var _button = _interopRequireDefault(require("@ndla/button"));
|
|
23
|
+
|
|
24
|
+
var _core = require("@emotion/core");
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
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); }
|
|
33
|
+
|
|
34
|
+
var classes = new _reactBemHelper["default"]({
|
|
35
|
+
name: 'figure',
|
|
36
|
+
prefix: 'c-'
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
var FigureCaption = function FigureCaption(_ref) {
|
|
40
|
+
var figureId = _ref.figureId,
|
|
41
|
+
id = _ref.id,
|
|
42
|
+
children = _ref.children,
|
|
43
|
+
caption = _ref.caption,
|
|
44
|
+
authors = _ref.authors,
|
|
45
|
+
reuseLabel = _ref.reuseLabel,
|
|
46
|
+
licenseRights = _ref.licenseRights,
|
|
47
|
+
locale = _ref.locale,
|
|
48
|
+
link = _ref.link,
|
|
49
|
+
hideFigcaption = _ref.hideFigcaption,
|
|
50
|
+
hasLinkedVideo = _ref.hasLinkedVideo;
|
|
51
|
+
|
|
52
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
53
|
+
t = _useTranslation.t;
|
|
54
|
+
|
|
55
|
+
return (0, _core.jsx)("figcaption", classes('caption', hideFigcaption ? 'hidden-caption' : undefined), caption ? (0, _core.jsx)("div", classes('info'), (0, _util.parseMarkdown)(caption)) : null, (0, _core.jsx)("footer", classes('byline'), (0, _core.jsx)("div", classes('byline-licenselist'), (0, _core.jsx)(_licenses.LicenseByline, {
|
|
56
|
+
licenseRights: licenseRights,
|
|
57
|
+
locale: locale,
|
|
58
|
+
marginRight: true
|
|
59
|
+
}, (0, _core.jsx)("div", classes('byline-author-buttons'), (0, _core.jsx)("span", classes('byline-authors'), authors === null || authors === void 0 ? void 0 : authors.map(function (author) {
|
|
60
|
+
return author.name;
|
|
61
|
+
}).join(', ')), (0, _core.jsx)("div", null, (0, _core.jsx)(_button["default"], {
|
|
62
|
+
borderShape: "rounded",
|
|
63
|
+
outline: true,
|
|
64
|
+
size: "small",
|
|
65
|
+
type: "button",
|
|
66
|
+
"data-dialog-trigger-id": id,
|
|
67
|
+
"data-dialog-source-id": figureId
|
|
68
|
+
}, reuseLabel), hasLinkedVideo && (0, _core.jsx)(_button["default"], _extends({
|
|
69
|
+
borderShape: "rounded",
|
|
70
|
+
outline: true,
|
|
71
|
+
size: "small",
|
|
72
|
+
type: "button"
|
|
73
|
+
}, classes('toggleAlternativeVideo')), (0, _core.jsx)("span", {
|
|
74
|
+
className: "original"
|
|
75
|
+
}, t('figure.button.alternative')), (0, _core.jsx)("span", {
|
|
76
|
+
className: "alternative hidden"
|
|
77
|
+
}, t('figure.button.original')))), children)), link && (0, _core.jsx)("div", classes('link-wrapper'), (0, _core.jsx)(_safelink["default"], _extends({
|
|
78
|
+
to: link.url
|
|
79
|
+
}, classes('link'), {
|
|
80
|
+
target: link.external ? '_blank' : undefined,
|
|
81
|
+
rel: link.external ? 'noopener noreferrer' : undefined
|
|
82
|
+
}), (0, _core.jsx)("span", classes('link-text'), link.text), (0, _core.jsx)(_common.Link, null)), link.description && (0, _core.jsx)("p", classes('link-description'), link.description)))));
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
exports.FigureCaption = FigureCaption;
|
|
86
|
+
|
|
87
|
+
var Figure = function Figure(_ref2) {
|
|
88
|
+
var children = _ref2.children,
|
|
89
|
+
_ref2$type = _ref2.type,
|
|
90
|
+
type = _ref2$type === void 0 ? 'full' : _ref2$type,
|
|
91
|
+
resizeIframe = _ref2.resizeIframe,
|
|
92
|
+
rest = _objectWithoutProperties(_ref2, ["children", "type", "resizeIframe"]);
|
|
93
|
+
|
|
94
|
+
var typeClass = type === 'full-column' ? 'c-figure--full-column' : "u-float-".concat(type);
|
|
95
|
+
return (0, _core.jsx)("figure", _extends({
|
|
96
|
+
"data-sizetype": type
|
|
97
|
+
}, classes('', {
|
|
98
|
+
resize: !!resizeIframe
|
|
99
|
+
}, typeClass), rest), (0, _util.isFunction)(children) ? children({
|
|
100
|
+
typeClass: typeClass
|
|
101
|
+
}) : children);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
var _default = Figure;
|
|
105
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FigureExpandButton = FigureExpandButton;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _common = require("@ndla/icons/common");
|
|
11
|
+
|
|
12
|
+
var _action = require("@ndla/icons/action");
|
|
13
|
+
|
|
14
|
+
var _core = require("@emotion/core");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Copyright (c) 2019-present, NDLA.
|
|
20
|
+
*
|
|
21
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
22
|
+
* LICENSE file in the root directory of this source tree.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
function FigureExpandButton(_ref) {
|
|
26
|
+
var messages = _ref.messages,
|
|
27
|
+
typeClass = _ref.typeClass;
|
|
28
|
+
return (0, _core.jsx)("button", {
|
|
29
|
+
className: "c-figure__fullscreen-btn",
|
|
30
|
+
type: "button",
|
|
31
|
+
"data-figure-button": true,
|
|
32
|
+
"data-classtype": typeClass,
|
|
33
|
+
"data-aria": messages.zoomImageButtonLabel,
|
|
34
|
+
"data-ariaexpanded": messages.zoomOutImageButtonLabel,
|
|
35
|
+
"aria-label": messages.zoomImageButtonLabel
|
|
36
|
+
}, (0, _core.jsx)(_common.ArrowCollapse, {
|
|
37
|
+
className: "expanded-icon"
|
|
38
|
+
}), (0, _core.jsx)(_action.ExpandTwoArrows, {
|
|
39
|
+
className: "contracted-icon"
|
|
40
|
+
}));
|
|
41
|
+
}
|