@ndla/ui 3.2.1-alpha.14 → 3.2.1
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/AuthorInfo/AuthorInfo.js +1 -2
- package/lib/BackgroundImage/BackgroundImage.d.ts +11 -0
- package/{es/BackgroundImage/index.js → lib/BackgroundImage/index.d.ts} +1 -1
- package/lib/ContentLoader/index.d.ts +20 -0
- package/lib/Dialog/Dialog.d.ts +23 -0
- package/{es/Dialog/index.js → lib/Dialog/index.d.ts} +1 -1
- package/lib/Figure/Figure.d.ts +50 -0
- package/lib/Figure/FigureExpandButton.d.ts +16 -0
- package/lib/Figure/FigureLicense.d.ts +33 -0
- package/lib/Figure/FigureLicenseDialog.d.ts +29 -0
- package/{es/Figure/index.js → lib/Figure/index.d.ts} +1 -1
- package/lib/FileList/File.d.ts +7 -0
- package/lib/FileList/FileList.d.ts +17 -0
- package/{es/FileList/index.js → lib/FileList/index.d.ts} +1 -1
- package/lib/Hero/Hero.d.ts +26 -0
- package/{es/Hero/index.js → lib/Hero/index.d.ts} +1 -1
- package/lib/Image/Image.d.ts +25 -0
- package/lib/Image/ImageLink.d.ts +18 -0
- package/lib/Image/LazyLoadImage.d.ts +17 -0
- package/{es/Image/index.js → lib/Image/index.d.ts} +1 -1
- package/lib/InfoBox/InfoBox.d.ts +6 -0
- package/{src/InfoBox/index.js → lib/InfoBox/index.d.ts} +0 -0
- package/lib/InfoWidget/InfoWidget.d.ts +19 -0
- package/{es/InfoWidget/index.js → lib/InfoWidget/index.d.ts} +1 -1
- package/lib/Logo/Logo.d.ts +24 -0
- package/lib/Logo/SvgLogo.d.ts +14 -0
- package/{es/Logo/index.js → lib/Logo/index.d.ts} +1 -1
- package/lib/Masthead/Masthead.d.ts +27 -0
- package/{es/Masthead/index.js → lib/Masthead/index.d.ts} +1 -1
- package/lib/NoContentBox/NoContentBox.d.ts +14 -0
- package/{es/NoContentBox/index.js → lib/NoContentBox/index.d.ts} +1 -1
- package/lib/Portrait/Portrait.d.ts +15 -0
- package/{es/Portrait/index.js → lib/Portrait/index.d.ts} +1 -1
- package/lib/Topic/Topic.d.ts +3 -2
- package/lib/Translation/Translation.d.ts +14 -0
- package/lib/Translation/TranslationBox.d.ts +10 -0
- package/lib/Translation/TranslationLine.d.ts +16 -0
- package/{src/Translation/index.js → lib/Translation/index.d.ts} +0 -0
- package/lib/index.d.ts +14 -0
- package/lib/locale/messages-en.d.ts +4 -0
- package/lib/locale/messages-nb.d.ts +4 -0
- package/lib/locale/messages-nn.d.ts +4 -0
- package/lib/types.d.ts +10 -0
- package/package.json +6 -6
- package/src/Article/ArticleAuthorContent.tsx +0 -1
- package/src/AuthorInfo/AuthorInfo.tsx +0 -1
- package/src/BackgroundImage/BackgroundImage.tsx +32 -0
- package/src/BackgroundImage/{index.js → index.ts} +0 -0
- package/src/ContentLoader/{index.js → index.tsx} +20 -30
- package/src/Dialog/{Dialog.jsx → Dialog.tsx} +20 -32
- package/src/Dialog/{index.js → index.ts} +0 -0
- package/src/Figure/{Figure.js → Figure.tsx} +44 -54
- package/src/Figure/{FigureExpandButton.js → FigureExpandButton.tsx} +8 -9
- package/src/Figure/{FigureLicense.js → FigureLicense.tsx} +32 -30
- package/src/Figure/{FigureLicenseDialog.js → FigureLicenseDialog.tsx} +22 -22
- package/src/Figure/{index.js → index.ts} +0 -0
- package/src/FileList/{File.jsx → File.tsx} +8 -18
- package/src/FileList/FileList.tsx +36 -0
- package/src/FileList/{index.js → index.ts} +0 -0
- package/src/Hero/Hero.tsx +56 -0
- package/src/Hero/{index.js → index.ts} +0 -0
- package/src/Image/{Image.jsx → Image.tsx} +30 -30
- package/src/Image/{ImageLink.js → ImageLink.tsx} +11 -12
- package/src/Image/LazyLoadImage.tsx +40 -0
- package/src/Image/__tests__/__snapshots__/Image-test.jsx.snap +4 -3
- package/src/Image/{index.js → index.ts} +0 -0
- package/src/InfoBox/InfoBox.tsx +11 -0
- package/src/InfoBox/index.ts +1 -0
- package/src/InfoWidget/{InfoWidget.jsx → InfoWidget.tsx} +19 -26
- package/src/InfoWidget/{index.js → index.ts} +0 -0
- package/src/Logo/{Logo.jsx → Logo.tsx} +21 -28
- package/src/Logo/{SvgLogo.jsx → SvgLogo.tsx} +8 -14
- package/src/Logo/{index.js → index.ts} +0 -0
- package/src/Masthead/{Masthead.jsx → Masthead.tsx} +33 -35
- package/src/Masthead/{index.js → index.ts} +0 -0
- package/src/NoContentBox/{NoContentBox.jsx → NoContentBox.tsx} +7 -13
- package/src/NoContentBox/{index.js → index.ts} +0 -0
- package/src/Portrait/{Portrait.jsx → Portrait.tsx} +8 -14
- package/src/Portrait/{index.js → index.ts} +0 -0
- package/src/Topic/Topic.tsx +3 -2
- package/src/Translation/{Translation.jsx → Translation.tsx} +7 -8
- package/src/Translation/TranslationBox.tsx +20 -0
- package/src/Translation/{TranslationLine.jsx → TranslationLine.tsx} +11 -18
- package/{es/Translation/index.js → src/Translation/index.ts} +1 -1
- package/src/index-javascript.js +0 -29
- package/src/index.ts +35 -0
- package/src/locale/messages-en.ts +4 -0
- package/src/locale/messages-nb.ts +5 -1
- package/src/locale/messages-nn.ts +5 -1
- package/src/types.ts +12 -0
- package/es/BackgroundImage/BackgroundImage.js +0 -37
- package/es/ContentLoader/index.js +0 -96
- package/es/Dialog/Dialog.js +0 -82
- package/es/Figure/Figure.js +0 -125
- package/es/Figure/FigureExpandButton.js +0 -37
- package/es/Figure/FigureLicense.js +0 -74
- package/es/Figure/FigureLicenseDialog.js +0 -61
- package/es/FileList/File.js +0 -61
- package/es/FileList/FileList.js +0 -33
- package/es/Hero/Hero.js +0 -70
- package/es/Image/Image.js +0 -119
- package/es/Image/ImageLink.js +0 -55
- package/es/Image/LazyLoadImage.js +0 -56
- package/es/Image/shapes.js +0 -18
- package/es/InfoBox/InfoBox.js +0 -15
- package/es/InfoBox/index.js +0 -1
- package/es/InfoWidget/InfoWidget.js +0 -76
- package/es/Logo/Logo.js +0 -67
- package/es/Logo/SvgLogo.js +0 -62
- package/es/Masthead/Masthead.js +0 -88
- package/es/NoContentBox/NoContentBox.js +0 -35
- package/es/Portrait/Portrait.js +0 -41
- package/es/Translation/Translation.js +0 -27
- package/es/Translation/TranslationBox.js +0 -13
- package/es/Translation/TranslationLine.js +0 -48
- package/lib/BackgroundImage/BackgroundImage.js +0 -52
- package/lib/BackgroundImage/index.js +0 -13
- package/lib/ContentLoader/index.js +0 -102
- package/lib/Dialog/Dialog.js +0 -90
- package/lib/Dialog/index.js +0 -24
- package/lib/Figure/Figure.js +0 -139
- package/lib/Figure/FigureExpandButton.js +0 -52
- package/lib/Figure/FigureLicense.js +0 -88
- package/lib/Figure/FigureLicenseDialog.js +0 -69
- package/lib/Figure/index.js +0 -49
- package/lib/FileList/File.js +0 -77
- package/lib/FileList/FileList.js +0 -48
- package/lib/FileList/index.js +0 -21
- package/lib/Hero/Hero.js +0 -108
- package/lib/Hero/index.js +0 -55
- package/lib/Image/Image.js +0 -129
- package/lib/Image/ImageLink.js +0 -62
- package/lib/Image/LazyLoadImage.js +0 -61
- package/lib/Image/index.js +0 -38
- package/lib/Image/shapes.js +0 -33
- package/lib/InfoBox/InfoBox.js +0 -29
- package/lib/InfoBox/index.js +0 -15
- package/lib/InfoWidget/InfoWidget.js +0 -93
- package/lib/InfoWidget/index.js +0 -13
- package/lib/Logo/Logo.js +0 -93
- package/lib/Logo/SvgLogo.js +0 -68
- package/lib/Logo/index.js +0 -20
- package/lib/Masthead/Masthead.js +0 -106
- package/lib/Masthead/index.js +0 -30
- package/lib/NoContentBox/NoContentBox.js +0 -53
- package/lib/NoContentBox/index.js +0 -20
- package/lib/Portrait/Portrait.js +0 -55
- package/lib/Portrait/index.js +0 -20
- package/lib/Translation/Translation.js +0 -41
- package/lib/Translation/TranslationBox.js +0 -25
- package/lib/Translation/TranslationLine.js +0 -60
- package/lib/Translation/index.js +0 -31
- package/src/BackgroundImage/BackgroundImage.jsx +0 -39
- package/src/FileList/FileList.jsx +0 -36
- package/src/Hero/Hero.jsx +0 -38
- package/src/Image/LazyLoadImage.jsx +0 -39
- package/src/Image/shapes.js +0 -21
- package/src/InfoBox/InfoBox.jsx +0 -13
- package/src/Translation/TranslationBox.jsx +0 -12
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
9
|
+
import React, { ReactNode } from 'react';
|
|
11
10
|
import BEMHelper from 'react-bem-helper';
|
|
12
11
|
|
|
13
12
|
const classes = new BEMHelper({
|
|
@@ -15,16 +14,16 @@ const classes = new BEMHelper({
|
|
|
15
14
|
prefix: 'c-',
|
|
16
15
|
});
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
interface Props {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
index: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const Translation = ({ children, index }: Props) => (
|
|
19
23
|
<div {...classes('')}>
|
|
20
24
|
<div {...classes('index')}>{index}</div>
|
|
21
25
|
<dl {...classes('wrapper')}>{children}</dl>
|
|
22
26
|
</div>
|
|
23
27
|
);
|
|
24
28
|
|
|
25
|
-
Translation.propTypes = {
|
|
26
|
-
index: PropTypes.number.isRequired,
|
|
27
|
-
children: PropTypes.node.isRequired,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
29
|
export default Translation;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
//@ts-ignore
|
|
3
|
+
import { ArticleTabs } from '@ndla/tabs';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
tabs: {
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
content: () => ReactNode | ReactNode;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
const TranslationBox = ({ tabs }: Props) => (
|
|
13
|
+
<div className="c-translation-box">
|
|
14
|
+
<div className="c-bodybox c-bodybox--translation">
|
|
15
|
+
<ArticleTabs tabs={tabs} />
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export default TranslationBox;
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React, {
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
9
|
+
import React, { ReactNode } from 'react';
|
|
11
10
|
import BEMHelper from 'react-bem-helper';
|
|
12
11
|
|
|
13
12
|
const classes = new BEMHelper({
|
|
@@ -15,15 +14,22 @@ const classes = new BEMHelper({
|
|
|
15
14
|
prefix: 'c-',
|
|
16
15
|
});
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
interface Props {
|
|
18
|
+
isTerm?: boolean;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
lang?: string;
|
|
21
|
+
langName?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const TranslationLine = ({ children, lang, langName, isTerm = false }: Props) => {
|
|
19
25
|
const hasLang = langName && lang;
|
|
20
26
|
const content = (
|
|
21
|
-
|
|
27
|
+
<>
|
|
22
28
|
<div {...classes('line-body')} lang={lang}>
|
|
23
29
|
{children}
|
|
24
30
|
</div>
|
|
25
31
|
{hasLang && <div {...classes('line-lang')}>{langName}</div>}
|
|
26
|
-
|
|
32
|
+
</>
|
|
27
33
|
);
|
|
28
34
|
|
|
29
35
|
if (isTerm) {
|
|
@@ -33,17 +39,4 @@ const TranslationLine = ({ children, lang, langName, isTerm }) => {
|
|
|
33
39
|
return <dd {...classes('line', hasLang ? 'lang' : '')}>{content}</dd>;
|
|
34
40
|
};
|
|
35
41
|
|
|
36
|
-
TranslationLine.propTypes = {
|
|
37
|
-
isTerm: PropTypes.bool,
|
|
38
|
-
children: PropTypes.node.isRequired,
|
|
39
|
-
lang: PropTypes.string,
|
|
40
|
-
langName: PropTypes.string,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
TranslationLine.defaultProps = {
|
|
44
|
-
isTerm: false,
|
|
45
|
-
lang: undefined,
|
|
46
|
-
langName: undefined,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
42
|
export default TranslationLine;
|
package/src/index-javascript.js
CHANGED
|
@@ -6,13 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export { InfoBox } from './InfoBox';
|
|
10
|
-
|
|
11
|
-
export { default as Logo } from './Logo';
|
|
12
9
|
export { default as Table } from './Table';
|
|
13
10
|
export { FilterList, FilterListPhone, FilterButtons } from './Filter';
|
|
14
11
|
export { default as FactBox } from './FactBox';
|
|
15
|
-
export { default as FileList, File } from './FileList';
|
|
16
12
|
|
|
17
13
|
export {
|
|
18
14
|
SearchOverlay,
|
|
@@ -51,21 +47,7 @@ export {
|
|
|
51
47
|
CompetenceGoalsDialog,
|
|
52
48
|
} from './CompetenceGoals';
|
|
53
49
|
|
|
54
|
-
export { default as NoContentBox } from './NoContentBox';
|
|
55
|
-
|
|
56
50
|
export { default as ResourcesWrapper, ResourcesTitle, ResourcesTopicTitle } from './ResourcesWrapper';
|
|
57
|
-
export {
|
|
58
|
-
SubjectMaterialHero,
|
|
59
|
-
TasksAndActivitiesHero,
|
|
60
|
-
AssessmentResourcesHero,
|
|
61
|
-
SubjectHero,
|
|
62
|
-
ExternalLearningResourcesHero,
|
|
63
|
-
SourceMaterialHero,
|
|
64
|
-
Hero,
|
|
65
|
-
NdlaFilmHero,
|
|
66
|
-
} from './Hero';
|
|
67
|
-
export { default as Masthead, MastheadItem } from './Masthead';
|
|
68
|
-
export { Figure, FigureCaption, FigureLicenseDialog, FigureExpandButton } from './Figure';
|
|
69
51
|
export {
|
|
70
52
|
MediaList,
|
|
71
53
|
MediaListItem,
|
|
@@ -77,17 +59,8 @@ export {
|
|
|
77
59
|
|
|
78
60
|
export { EmbeddedTwitter, EmbeddedFacebook, EmbeddedFacebookPage } from './Embedded';
|
|
79
61
|
|
|
80
|
-
export { default as Image, ImageLink } from './Image';
|
|
81
|
-
export { makeSrcQueryString } from './Image';
|
|
82
|
-
export { default as Portrait } from './Portrait';
|
|
83
|
-
export { Translation, TranslationLine, TranslationBox } from './Translation';
|
|
84
|
-
|
|
85
|
-
export { default as ContentLoader } from './ContentLoader';
|
|
86
|
-
|
|
87
62
|
export { DisplayOnPageYOffset } from './Animation';
|
|
88
63
|
|
|
89
|
-
export { default as InfoWidget } from './InfoWidget';
|
|
90
|
-
|
|
91
64
|
export {
|
|
92
65
|
FilmSlideshow,
|
|
93
66
|
MovieGrid,
|
|
@@ -96,5 +69,3 @@ export {
|
|
|
96
69
|
FilmMovieList,
|
|
97
70
|
AllMoviesAlphabetically,
|
|
98
71
|
} from './NDLAFilm';
|
|
99
|
-
|
|
100
|
-
export { default as Spinner } from './Spinner';
|
package/src/index.ts
CHANGED
|
@@ -24,10 +24,26 @@ export {
|
|
|
24
24
|
default as Article,
|
|
25
25
|
} from './Article';
|
|
26
26
|
|
|
27
|
+
export { default as NoContentBox } from './NoContentBox';
|
|
28
|
+
|
|
29
|
+
export { default as Masthead, MastheadItem } from './Masthead';
|
|
30
|
+
|
|
31
|
+
export { default as Portrait } from './Portrait';
|
|
32
|
+
|
|
33
|
+
export { default as ContentLoader } from './ContentLoader';
|
|
34
|
+
|
|
27
35
|
export { ErrorResourceAccessDenied, default as ErrorMessage } from './ErrorMessage';
|
|
28
36
|
|
|
37
|
+
export { default as FileList, File } from './FileList';
|
|
38
|
+
|
|
29
39
|
export { BlogPost, BlogPostWrapper } from './BlogPosts';
|
|
30
40
|
|
|
41
|
+
export { default as Logo } from './Logo';
|
|
42
|
+
|
|
43
|
+
export { InfoBox } from './InfoBox';
|
|
44
|
+
|
|
45
|
+
export { default as InfoWidget } from './InfoWidget';
|
|
46
|
+
|
|
31
47
|
export {
|
|
32
48
|
FrontpageInfo,
|
|
33
49
|
FrontpageFilm,
|
|
@@ -39,8 +55,24 @@ export {
|
|
|
39
55
|
FrontpageProgramMenu,
|
|
40
56
|
} from './Frontpage';
|
|
41
57
|
|
|
58
|
+
export { default as Image, ImageLink } from './Image';
|
|
59
|
+
export { makeSrcQueryString } from './Image';
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
SubjectMaterialHero,
|
|
63
|
+
TasksAndActivitiesHero,
|
|
64
|
+
AssessmentResourcesHero,
|
|
65
|
+
SubjectHero,
|
|
66
|
+
ExternalLearningResourcesHero,
|
|
67
|
+
SourceMaterialHero,
|
|
68
|
+
Hero,
|
|
69
|
+
NdlaFilmHero,
|
|
70
|
+
} from './Hero';
|
|
71
|
+
|
|
42
72
|
export { Footer, EditorName, FooterText, FooterAuth } from './Footer';
|
|
43
73
|
|
|
74
|
+
export { Figure, FigureCaption, FigureLicenseDialog, FigureExpandButton } from './Figure';
|
|
75
|
+
|
|
44
76
|
export { LanguageSelector } from './LanguageSelector';
|
|
45
77
|
|
|
46
78
|
export {
|
|
@@ -55,6 +87,9 @@ export {
|
|
|
55
87
|
LearningPathMobileStepInfo,
|
|
56
88
|
LearningPathMobileHeader,
|
|
57
89
|
} from './LearningPaths';
|
|
90
|
+
export { Translation, TranslationLine, TranslationBox } from './Translation';
|
|
91
|
+
|
|
92
|
+
export { default as Spinner } from './Spinner';
|
|
58
93
|
|
|
59
94
|
export { default as SearchResultSleeve } from './Search/SearchResultSleeve';
|
|
60
95
|
|
|
@@ -808,6 +808,10 @@ const messages = {
|
|
|
808
808
|
reuse: 'Use video',
|
|
809
809
|
error: 'Sorry, an error occurred while loading the video or metadata about the video.',
|
|
810
810
|
},
|
|
811
|
+
other: {
|
|
812
|
+
download: 'Download content',
|
|
813
|
+
reuse: 'Use content',
|
|
814
|
+
},
|
|
811
815
|
concept: {
|
|
812
816
|
showDescription: 'Show concept description',
|
|
813
817
|
error: {
|
|
@@ -538,7 +538,7 @@ const messages = {
|
|
|
538
538
|
es: 'Spansk',
|
|
539
539
|
zh: 'Kinesisk',
|
|
540
540
|
unknown: 'Ukjent',
|
|
541
|
-
prefixChangeLanguage: 'Velg
|
|
541
|
+
prefixChangeLanguage: 'Velg språk',
|
|
542
542
|
},
|
|
543
543
|
changeLanguage: {
|
|
544
544
|
nb: 'Endre språk til bokmål',
|
|
@@ -807,6 +807,10 @@ const messages = {
|
|
|
807
807
|
reuse: 'Bruk video',
|
|
808
808
|
error: 'Beklager, en feil oppstod ved lasting av videoen eller metadata om videoen.',
|
|
809
809
|
},
|
|
810
|
+
other: {
|
|
811
|
+
download: 'Last ned innhold',
|
|
812
|
+
reuse: 'Bruk innhold',
|
|
813
|
+
},
|
|
810
814
|
concept: {
|
|
811
815
|
showDescription: 'Vis beskrivelsen av forklaringen.',
|
|
812
816
|
error: {
|
|
@@ -539,7 +539,7 @@ const messages = {
|
|
|
539
539
|
es: 'Spansk',
|
|
540
540
|
zh: 'Kinesisk',
|
|
541
541
|
unknown: 'Ukjent',
|
|
542
|
-
prefixChangeLanguage: 'Vel
|
|
542
|
+
prefixChangeLanguage: 'Vel språk',
|
|
543
543
|
},
|
|
544
544
|
changeLanguage: {
|
|
545
545
|
nb: 'Endre språk til bokmål',
|
|
@@ -808,6 +808,10 @@ const messages = {
|
|
|
808
808
|
reuse: 'Bruk video',
|
|
809
809
|
error: 'Orsak, ein feil oppstod ved lasting av videoen eller metadata om videoen.',
|
|
810
810
|
},
|
|
811
|
+
other: {
|
|
812
|
+
download: 'Last ned innhald',
|
|
813
|
+
reuse: 'Bruk innhald',
|
|
814
|
+
},
|
|
811
815
|
concept: {
|
|
812
816
|
showDescription: 'Vis skildring av forklaringa',
|
|
813
817
|
error: {
|
package/src/types.ts
CHANGED
|
@@ -45,6 +45,18 @@ export interface License {
|
|
|
45
45
|
license: string;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
export interface ImageCrop {
|
|
49
|
+
startX: number;
|
|
50
|
+
startY: number;
|
|
51
|
+
endX: number;
|
|
52
|
+
endY: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ImageFocalPoint {
|
|
56
|
+
x: number;
|
|
57
|
+
y: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
48
60
|
export interface Copyright {
|
|
49
61
|
license: License;
|
|
50
62
|
creators: Array<Contributor>;
|
|
@@ -1,37 +0,0 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
5
|
-
import BEMHelper from 'react-bem-helper';
|
|
6
|
-
import { breakpoints } from '@ndla/util';
|
|
7
|
-
import { jsx as ___EmotionJSX } from "@emotion/core";
|
|
8
|
-
var classes = BEMHelper('c-background-image');
|
|
9
|
-
|
|
10
|
-
var BackgroundImage = function BackgroundImage(_ref) {
|
|
11
|
-
var images = _ref.images,
|
|
12
|
-
showOverlay = _ref.showOverlay;
|
|
13
|
-
return ___EmotionJSX("div", classes('', showOverlay), images && images.map(function (image) {
|
|
14
|
-
return image.types.map(function (type) {
|
|
15
|
-
return ___EmotionJSX("div", _extends({
|
|
16
|
-
key: "".concat(image.url).concat(type)
|
|
17
|
-
}, classes('background', type), {
|
|
18
|
-
style: {
|
|
19
|
-
backgroundImage: "url(".concat(image.url, ")")
|
|
20
|
-
}
|
|
21
|
-
}));
|
|
22
|
-
});
|
|
23
|
-
}));
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
BackgroundImage.propTypes = {
|
|
27
|
-
showOverlay: PropTypes.bool,
|
|
28
|
-
className: PropTypes.string,
|
|
29
|
-
images: PropTypes.arrayOf(PropTypes.shape({
|
|
30
|
-
url: PropTypes.string.isRequired,
|
|
31
|
-
types: PropTypes.arrayOf(PropTypes.oneOf(Object.keys(breakpoints))).isRequired
|
|
32
|
-
})).isRequired
|
|
33
|
-
};
|
|
34
|
-
BackgroundImage.defaultProps = {
|
|
35
|
-
showOverlay: false
|
|
36
|
-
};
|
|
37
|
-
export default BackgroundImage;
|
|
@@ -1,96 +0,0 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
16
|
-
import { uuid } from '@ndla/util';
|
|
17
|
-
import { jsx as ___EmotionJSX } from "@emotion/core";
|
|
18
|
-
|
|
19
|
-
var ContentLoader = function ContentLoader(_ref) {
|
|
20
|
-
var children = _ref.children,
|
|
21
|
-
width = _ref.width,
|
|
22
|
-
height = _ref.height,
|
|
23
|
-
preserveAspectRatio = _ref.preserveAspectRatio,
|
|
24
|
-
className = _ref.className,
|
|
25
|
-
primaryColor = _ref.primaryColor,
|
|
26
|
-
secondaryColor = _ref.secondaryColor,
|
|
27
|
-
speed = _ref.speed,
|
|
28
|
-
rest = _objectWithoutProperties(_ref, ["children", "width", "height", "preserveAspectRatio", "className", "primaryColor", "secondaryColor", "speed"]);
|
|
29
|
-
|
|
30
|
-
var idClip = uuid();
|
|
31
|
-
var idGradient = uuid();
|
|
32
|
-
return ___EmotionJSX("svg", _extends({
|
|
33
|
-
viewBox: "0 0 ".concat(width, " ").concat(height),
|
|
34
|
-
version: "1.1",
|
|
35
|
-
preserveAspectRatio: preserveAspectRatio,
|
|
36
|
-
className: className
|
|
37
|
-
}, rest), ___EmotionJSX("rect", {
|
|
38
|
-
style: {
|
|
39
|
-
fill: "url(#".concat(idGradient, ")")
|
|
40
|
-
},
|
|
41
|
-
clipPath: "url(#".concat(idClip, ")"),
|
|
42
|
-
x: "0",
|
|
43
|
-
y: "0",
|
|
44
|
-
width: width,
|
|
45
|
-
height: height
|
|
46
|
-
}), ___EmotionJSX("defs", null, ___EmotionJSX("clipPath", {
|
|
47
|
-
id: idClip
|
|
48
|
-
}, children), ___EmotionJSX("linearGradient", {
|
|
49
|
-
id: idGradient
|
|
50
|
-
}, ___EmotionJSX("stop", {
|
|
51
|
-
offset: "0%",
|
|
52
|
-
stopColor: primaryColor
|
|
53
|
-
}, ___EmotionJSX("animate", {
|
|
54
|
-
attributeName: "offset",
|
|
55
|
-
values: "-2; 1",
|
|
56
|
-
dur: "".concat(speed, "s"),
|
|
57
|
-
repeatCount: "indefinite"
|
|
58
|
-
})), ___EmotionJSX("stop", {
|
|
59
|
-
offset: "50%",
|
|
60
|
-
stopColor: secondaryColor
|
|
61
|
-
}, ___EmotionJSX("animate", {
|
|
62
|
-
attributeName: "offset",
|
|
63
|
-
values: "-1.5; 1.5",
|
|
64
|
-
dur: "".concat(speed, "s"),
|
|
65
|
-
repeatCount: "indefinite"
|
|
66
|
-
})), ___EmotionJSX("stop", {
|
|
67
|
-
offset: "100%",
|
|
68
|
-
stopColor: primaryColor
|
|
69
|
-
}, ___EmotionJSX("animate", {
|
|
70
|
-
attributeName: "offset",
|
|
71
|
-
values: "-1; 2",
|
|
72
|
-
dur: "".concat(speed, "s"),
|
|
73
|
-
repeatCount: "indefinite"
|
|
74
|
-
})))));
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
ContentLoader.propTypes = {
|
|
78
|
-
children: PropTypes.node,
|
|
79
|
-
speed: PropTypes.number,
|
|
80
|
-
width: PropTypes.number,
|
|
81
|
-
height: PropTypes.number,
|
|
82
|
-
primaryColor: PropTypes.string,
|
|
83
|
-
secondaryColor: PropTypes.string,
|
|
84
|
-
preserveAspectRatio: PropTypes.string,
|
|
85
|
-
className: PropTypes.string
|
|
86
|
-
};
|
|
87
|
-
ContentLoader.defaultProps = {
|
|
88
|
-
speed: 2,
|
|
89
|
-
width: 400,
|
|
90
|
-
height: 130,
|
|
91
|
-
primaryColor: '#f0f0f0',
|
|
92
|
-
secondaryColor: '#e0e0e0',
|
|
93
|
-
preserveAspectRatio: 'xMidYMid meet',
|
|
94
|
-
className: ''
|
|
95
|
-
};
|
|
96
|
-
export default ContentLoader;
|
package/es/Dialog/Dialog.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
18
|
-
import BEMHelper from 'react-bem-helper';
|
|
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
|
-
messages = _ref.messages,
|
|
28
|
-
id = _ref.id,
|
|
29
|
-
labelledby = _ref.labelledby,
|
|
30
|
-
label = _ref.label,
|
|
31
|
-
modifier = _ref.modifier,
|
|
32
|
-
disablePortal = _ref.disablePortal,
|
|
33
|
-
hidden = _ref.hidden,
|
|
34
|
-
onClose = _ref.onClose,
|
|
35
|
-
rest = _objectWithoutProperties(_ref, ["children", "messages", "id", "labelledby", "label", "modifier", "disablePortal", "hidden", "onClose"]);
|
|
36
|
-
|
|
37
|
-
var content = ___EmotionJSX("div", _extends({}, classes('', modifier), {
|
|
38
|
-
"data-dialog-id": id,
|
|
39
|
-
role: "dialog",
|
|
40
|
-
"aria-hidden": hidden,
|
|
41
|
-
"aria-labelledby": labelledby,
|
|
42
|
-
"aria-label": label
|
|
43
|
-
}, rest), ___EmotionJSX("div", classes('content'), ___EmotionJSX("button", _extends({}, classes('close'), {
|
|
44
|
-
type: "button",
|
|
45
|
-
onClick: function onClick() {
|
|
46
|
-
if (onClose) {
|
|
47
|
-
onClose();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}), messages.close), children), ___EmotionJSX("div", {
|
|
51
|
-
className: "o-backdrop"
|
|
52
|
-
}));
|
|
53
|
-
|
|
54
|
-
if (disablePortal) {
|
|
55
|
-
return content;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return createUniversalPortal(content, 'body');
|
|
59
|
-
};
|
|
60
|
-
Dialog.propTypes = {
|
|
61
|
-
id: PropTypes.string.isRequired,
|
|
62
|
-
labelledby: PropTypes.string,
|
|
63
|
-
label: PropTypes.string,
|
|
64
|
-
hidden: PropTypes.bool,
|
|
65
|
-
children: PropTypes.node,
|
|
66
|
-
messages: PropTypes.shape({
|
|
67
|
-
close: PropTypes.string.isRequired
|
|
68
|
-
}),
|
|
69
|
-
modifier: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
70
|
-
disablePortal: PropTypes.bool,
|
|
71
|
-
onClose: PropTypes.func
|
|
72
|
-
};
|
|
73
|
-
Dialog.defaultProps = {
|
|
74
|
-
disablePortal: false,
|
|
75
|
-
labelledby: null,
|
|
76
|
-
label: null,
|
|
77
|
-
hidden: true,
|
|
78
|
-
onClose: null,
|
|
79
|
-
messages: {
|
|
80
|
-
close: 'Lukk'
|
|
81
|
-
}
|
|
82
|
-
};
|
package/es/Figure/Figure.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
18
|
-
import BEMHelper from 'react-bem-helper';
|
|
19
|
-
import { isFunction, parseMarkdown } from '@ndla/util';
|
|
20
|
-
import { useTranslation } from 'react-i18next';
|
|
21
|
-
import { Link as LinkIcon } from '@ndla/icons/common';
|
|
22
|
-
import { LicenseByline } from '@ndla/licenses';
|
|
23
|
-
import SafeLink from '@ndla/safelink';
|
|
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'), 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.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' : null,
|
|
72
|
-
rel: link.external ? 'noopener noreferrer' : null
|
|
73
|
-
}), ___EmotionJSX("span", classes('link-text'), link.text), ___EmotionJSX(LinkIcon, null)), link.description && ___EmotionJSX("p", classes('link-description'), link.description)))));
|
|
74
|
-
};
|
|
75
|
-
FigureCaption.propTypes = {
|
|
76
|
-
figureId: PropTypes.string.isRequired,
|
|
77
|
-
id: PropTypes.string.isRequired,
|
|
78
|
-
caption: PropTypes.string,
|
|
79
|
-
reuseLabel: PropTypes.string.isRequired,
|
|
80
|
-
licenseRights: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
81
|
-
children: PropTypes.node,
|
|
82
|
-
authors: PropTypes.arrayOf(PropTypes.shape({
|
|
83
|
-
name: PropTypes.string.isRequired
|
|
84
|
-
})),
|
|
85
|
-
link: PropTypes.shape({
|
|
86
|
-
url: PropTypes.string.isRequired,
|
|
87
|
-
text: PropTypes.string.isRequired,
|
|
88
|
-
description: PropTypes.string,
|
|
89
|
-
external: PropTypes.bool
|
|
90
|
-
}),
|
|
91
|
-
locale: PropTypes.string,
|
|
92
|
-
hideFigcaption: PropTypes.bool,
|
|
93
|
-
hasLinkedVideo: PropTypes.bool
|
|
94
|
-
};
|
|
95
|
-
FigureCaption.defaultProps = {
|
|
96
|
-
link: null
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
var Figure = function Figure(_ref2) {
|
|
100
|
-
var children = _ref2.children,
|
|
101
|
-
type = _ref2.type,
|
|
102
|
-
resizeIframe = _ref2.resizeIframe,
|
|
103
|
-
rest = _objectWithoutProperties(_ref2, ["children", "type", "resizeIframe"]);
|
|
104
|
-
|
|
105
|
-
var typeClass = type === 'full-column' ? 'c-figure--full-column' : "u-float-".concat(type);
|
|
106
|
-
return ___EmotionJSX("figure", _extends({
|
|
107
|
-
"data-sizetype": type
|
|
108
|
-
}, classes('', {
|
|
109
|
-
resize: resizeIframe
|
|
110
|
-
}, typeClass), rest), isFunction(children) ? children({
|
|
111
|
-
typeClass: typeClass
|
|
112
|
-
}) : children);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
Figure.propTypes = {
|
|
116
|
-
id: PropTypes.string.isRequired,
|
|
117
|
-
children: PropTypes.oneOfType([PropTypes.node.isRequired, PropTypes.func.isRequired]).isRequired,
|
|
118
|
-
type: PropTypes.oneOf(['full', 'full-column', 'left', 'small-left', 'right', 'small-right', 'xsmall-right', 'xsmall-left']),
|
|
119
|
-
resizeIframe: PropTypes.bool,
|
|
120
|
-
noFigcaption: PropTypes.bool
|
|
121
|
-
};
|
|
122
|
-
Figure.defaultProps = {
|
|
123
|
-
type: 'full'
|
|
124
|
-
};
|
|
125
|
-
export default Figure;
|