@ndla/ui 3.2.1-alpha.8 → 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.
Files changed (159) hide show
  1. package/es/AuthorInfo/AuthorInfo.js +1 -2
  2. package/lib/BackgroundImage/BackgroundImage.d.ts +11 -0
  3. package/{es/BackgroundImage/index.js → lib/BackgroundImage/index.d.ts} +1 -1
  4. package/lib/ContentLoader/index.d.ts +20 -0
  5. package/lib/Dialog/Dialog.d.ts +23 -0
  6. package/{es/Dialog/index.js → lib/Dialog/index.d.ts} +1 -1
  7. package/lib/Figure/Figure.d.ts +50 -0
  8. package/lib/Figure/FigureExpandButton.d.ts +16 -0
  9. package/lib/Figure/FigureLicense.d.ts +33 -0
  10. package/lib/Figure/FigureLicenseDialog.d.ts +29 -0
  11. package/{es/Figure/index.js → lib/Figure/index.d.ts} +1 -1
  12. package/lib/FileList/File.d.ts +7 -0
  13. package/lib/FileList/FileList.d.ts +17 -0
  14. package/{es/FileList/index.js → lib/FileList/index.d.ts} +1 -1
  15. package/lib/Hero/Hero.d.ts +26 -0
  16. package/{es/Hero/index.js → lib/Hero/index.d.ts} +1 -1
  17. package/lib/Image/Image.d.ts +25 -0
  18. package/lib/Image/ImageLink.d.ts +18 -0
  19. package/lib/Image/LazyLoadImage.d.ts +17 -0
  20. package/{es/Image/index.js → lib/Image/index.d.ts} +1 -1
  21. package/lib/InfoBox/InfoBox.d.ts +6 -0
  22. package/{src/InfoBox/index.js → lib/InfoBox/index.d.ts} +0 -0
  23. package/lib/InfoWidget/InfoWidget.d.ts +19 -0
  24. package/{es/InfoWidget/index.js → lib/InfoWidget/index.d.ts} +1 -1
  25. package/lib/Logo/Logo.d.ts +24 -0
  26. package/lib/Logo/SvgLogo.d.ts +14 -0
  27. package/{es/Logo/index.js → lib/Logo/index.d.ts} +1 -1
  28. package/lib/Masthead/Masthead.d.ts +27 -0
  29. package/{es/Masthead/index.js → lib/Masthead/index.d.ts} +1 -1
  30. package/lib/NoContentBox/NoContentBox.d.ts +14 -0
  31. package/{es/NoContentBox/index.js → lib/NoContentBox/index.d.ts} +1 -1
  32. package/lib/Portrait/Portrait.d.ts +15 -0
  33. package/{es/Portrait/index.js → lib/Portrait/index.d.ts} +1 -1
  34. package/lib/Topic/Topic.d.ts +3 -2
  35. package/lib/Translation/Translation.d.ts +14 -0
  36. package/lib/Translation/TranslationBox.d.ts +10 -0
  37. package/lib/Translation/TranslationLine.d.ts +16 -0
  38. package/{src/Translation/index.js → lib/Translation/index.d.ts} +0 -0
  39. package/lib/index.d.ts +14 -0
  40. package/lib/locale/messages-en.d.ts +4 -0
  41. package/lib/locale/messages-nb.d.ts +4 -0
  42. package/lib/locale/messages-nn.d.ts +4 -0
  43. package/lib/types.d.ts +10 -0
  44. package/package.json +6 -6
  45. package/src/Article/ArticleAuthorContent.tsx +0 -1
  46. package/src/AuthorInfo/AuthorInfo.tsx +0 -1
  47. package/src/BackgroundImage/BackgroundImage.tsx +32 -0
  48. package/src/BackgroundImage/{index.js → index.ts} +0 -0
  49. package/src/ContentLoader/{index.js → index.tsx} +20 -30
  50. package/src/Dialog/{Dialog.jsx → Dialog.tsx} +20 -32
  51. package/src/Dialog/{index.js → index.ts} +0 -0
  52. package/src/Figure/{Figure.js → Figure.tsx} +44 -54
  53. package/src/Figure/{FigureExpandButton.js → FigureExpandButton.tsx} +8 -9
  54. package/src/Figure/{FigureLicense.js → FigureLicense.tsx} +32 -30
  55. package/src/Figure/{FigureLicenseDialog.js → FigureLicenseDialog.tsx} +22 -22
  56. package/src/Figure/{index.js → index.ts} +0 -0
  57. package/src/FileList/{File.jsx → File.tsx} +8 -18
  58. package/src/FileList/FileList.tsx +36 -0
  59. package/src/FileList/{index.js → index.ts} +0 -0
  60. package/src/Hero/Hero.tsx +56 -0
  61. package/src/Hero/{index.js → index.ts} +0 -0
  62. package/src/Image/{Image.jsx → Image.tsx} +30 -30
  63. package/src/Image/{ImageLink.js → ImageLink.tsx} +11 -12
  64. package/src/Image/LazyLoadImage.tsx +40 -0
  65. package/src/Image/__tests__/__snapshots__/Image-test.jsx.snap +4 -3
  66. package/src/Image/{index.js → index.ts} +0 -0
  67. package/src/InfoBox/InfoBox.tsx +11 -0
  68. package/src/InfoBox/index.ts +1 -0
  69. package/src/InfoWidget/{InfoWidget.jsx → InfoWidget.tsx} +19 -26
  70. package/src/InfoWidget/{index.js → index.ts} +0 -0
  71. package/src/Logo/{Logo.jsx → Logo.tsx} +21 -28
  72. package/src/Logo/{SvgLogo.jsx → SvgLogo.tsx} +8 -14
  73. package/src/Logo/{index.js → index.ts} +0 -0
  74. package/src/Masthead/{Masthead.jsx → Masthead.tsx} +33 -35
  75. package/src/Masthead/{index.js → index.ts} +0 -0
  76. package/src/NoContentBox/{NoContentBox.jsx → NoContentBox.tsx} +7 -13
  77. package/src/NoContentBox/{index.js → index.ts} +0 -0
  78. package/src/Portrait/{Portrait.jsx → Portrait.tsx} +8 -14
  79. package/src/Portrait/{index.js → index.ts} +0 -0
  80. package/src/Topic/Topic.tsx +3 -2
  81. package/src/Translation/{Translation.jsx → Translation.tsx} +7 -8
  82. package/src/Translation/TranslationBox.tsx +20 -0
  83. package/src/Translation/{TranslationLine.jsx → TranslationLine.tsx} +11 -18
  84. package/{es/Translation/index.js → src/Translation/index.ts} +1 -1
  85. package/src/index-javascript.js +0 -29
  86. package/src/index.ts +35 -0
  87. package/src/locale/messages-en.ts +4 -0
  88. package/src/locale/messages-nb.ts +5 -1
  89. package/src/locale/messages-nn.ts +5 -1
  90. package/src/types.ts +12 -0
  91. package/es/BackgroundImage/BackgroundImage.js +0 -37
  92. package/es/ContentLoader/index.js +0 -96
  93. package/es/Dialog/Dialog.js +0 -82
  94. package/es/Figure/Figure.js +0 -125
  95. package/es/Figure/FigureExpandButton.js +0 -37
  96. package/es/Figure/FigureLicense.js +0 -74
  97. package/es/Figure/FigureLicenseDialog.js +0 -61
  98. package/es/FileList/File.js +0 -61
  99. package/es/FileList/FileList.js +0 -33
  100. package/es/Hero/Hero.js +0 -70
  101. package/es/Image/Image.js +0 -119
  102. package/es/Image/ImageLink.js +0 -55
  103. package/es/Image/LazyLoadImage.js +0 -56
  104. package/es/Image/shapes.js +0 -18
  105. package/es/InfoBox/InfoBox.js +0 -15
  106. package/es/InfoBox/index.js +0 -1
  107. package/es/InfoWidget/InfoWidget.js +0 -76
  108. package/es/Logo/Logo.js +0 -67
  109. package/es/Logo/SvgLogo.js +0 -62
  110. package/es/Masthead/Masthead.js +0 -88
  111. package/es/NoContentBox/NoContentBox.js +0 -35
  112. package/es/Portrait/Portrait.js +0 -41
  113. package/es/Translation/Translation.js +0 -27
  114. package/es/Translation/TranslationBox.js +0 -13
  115. package/es/Translation/TranslationLine.js +0 -48
  116. package/lib/BackgroundImage/BackgroundImage.js +0 -52
  117. package/lib/BackgroundImage/index.js +0 -13
  118. package/lib/ContentLoader/index.js +0 -102
  119. package/lib/Dialog/Dialog.js +0 -90
  120. package/lib/Dialog/index.js +0 -24
  121. package/lib/Figure/Figure.js +0 -139
  122. package/lib/Figure/FigureExpandButton.js +0 -52
  123. package/lib/Figure/FigureLicense.js +0 -88
  124. package/lib/Figure/FigureLicenseDialog.js +0 -69
  125. package/lib/Figure/index.js +0 -49
  126. package/lib/FileList/File.js +0 -77
  127. package/lib/FileList/FileList.js +0 -48
  128. package/lib/FileList/index.js +0 -21
  129. package/lib/Hero/Hero.js +0 -108
  130. package/lib/Hero/index.js +0 -55
  131. package/lib/Image/Image.js +0 -129
  132. package/lib/Image/ImageLink.js +0 -62
  133. package/lib/Image/LazyLoadImage.js +0 -61
  134. package/lib/Image/index.js +0 -38
  135. package/lib/Image/shapes.js +0 -33
  136. package/lib/InfoBox/InfoBox.js +0 -29
  137. package/lib/InfoBox/index.js +0 -15
  138. package/lib/InfoWidget/InfoWidget.js +0 -93
  139. package/lib/InfoWidget/index.js +0 -13
  140. package/lib/Logo/Logo.js +0 -93
  141. package/lib/Logo/SvgLogo.js +0 -68
  142. package/lib/Logo/index.js +0 -20
  143. package/lib/Masthead/Masthead.js +0 -106
  144. package/lib/Masthead/index.js +0 -30
  145. package/lib/NoContentBox/NoContentBox.js +0 -53
  146. package/lib/NoContentBox/index.js +0 -20
  147. package/lib/Portrait/Portrait.js +0 -55
  148. package/lib/Portrait/index.js +0 -20
  149. package/lib/Translation/Translation.js +0 -41
  150. package/lib/Translation/TranslationBox.js +0 -25
  151. package/lib/Translation/TranslationLine.js +0 -60
  152. package/lib/Translation/index.js +0 -31
  153. package/src/BackgroundImage/BackgroundImage.jsx +0 -39
  154. package/src/FileList/FileList.jsx +0 -36
  155. package/src/Hero/Hero.jsx +0 -38
  156. package/src/Image/LazyLoadImage.jsx +0 -39
  157. package/src/Image/shapes.js +0 -21
  158. package/src/InfoBox/InfoBox.jsx +0 -13
  159. package/src/Translation/TranslationBox.jsx +0 -12
@@ -1,39 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import BEMHelper from 'react-bem-helper';
4
-
5
- import { breakpoints } from '@ndla/util';
6
-
7
- const classes = BEMHelper('c-background-image');
8
-
9
- const BackgroundImage = ({ images, showOverlay }) => (
10
- <div {...classes('', showOverlay)}>
11
- {images &&
12
- images.map((image) =>
13
- image.types.map((type) => (
14
- <div
15
- key={`${image.url}${type}`}
16
- {...classes('background', type)}
17
- style={{ backgroundImage: `url(${image.url})` }}
18
- />
19
- )),
20
- )}
21
- </div>
22
- );
23
-
24
- BackgroundImage.propTypes = {
25
- showOverlay: PropTypes.bool,
26
- className: PropTypes.string,
27
- images: PropTypes.arrayOf(
28
- PropTypes.shape({
29
- url: PropTypes.string.isRequired,
30
- types: PropTypes.arrayOf(PropTypes.oneOf(Object.keys(breakpoints))).isRequired,
31
- }),
32
- ).isRequired,
33
- };
34
-
35
- BackgroundImage.defaultProps = {
36
- showOverlay: false,
37
- };
38
-
39
- export default BackgroundImage;
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import BEMHelper from 'react-bem-helper';
4
- import File from './File';
5
-
6
- const classes = BEMHelper('c-file-list');
7
-
8
- const FileList = ({ files, heading, id }) => (
9
- <section {...classes()}>
10
- <h1 {...classes('heading')}>{heading}</h1>
11
- <ul {...classes('files')}>
12
- {files.map((file) => (
13
- <File key={`file-${id}-${file.title}`} file={file} id={id} />
14
- ))}
15
- </ul>
16
- </section>
17
- );
18
-
19
- FileList.propTypes = {
20
- id: PropTypes.string.isRequired,
21
- heading: PropTypes.string.isRequired,
22
- files: PropTypes.arrayOf(
23
- PropTypes.shape({
24
- title: PropTypes.string.isRequired,
25
- formats: PropTypes.arrayOf(
26
- PropTypes.shape({
27
- url: PropTypes.string.isRequired,
28
- fileType: PropTypes.string.isRequired,
29
- tooltip: PropTypes.string.isRequired,
30
- }),
31
- ).isRequired,
32
- }),
33
- ).isRequired,
34
- };
35
-
36
- export default FileList;
package/src/Hero/Hero.jsx DELETED
@@ -1,38 +0,0 @@
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
-
9
- import React from 'react';
10
- import PropTypes from 'prop-types';
11
- import BEMHelper from 'react-bem-helper';
12
- import { ContentTypeShape } from '../shapes';
13
-
14
- import * as contentTypes from '../model/ContentType';
15
-
16
- const classes = new BEMHelper({
17
- name: 'hero',
18
- prefix: 'c-',
19
- });
20
-
21
- export const Hero = ({ children, contentType }) => <div {...classes('', contentType)}>{children || null}</div>;
22
-
23
- Hero.propTypes = {
24
- contentType: ContentTypeShape,
25
- children: PropTypes.node,
26
- };
27
-
28
- export const SubjectMaterialHero = (props) => <Hero contentType={contentTypes.SUBJECT_MATERIAL} {...props} />;
29
- export const TasksAndActivitiesHero = (props) => <Hero contentType={contentTypes.TASKS_AND_ACTIVITIES} {...props} />;
30
- export const AssessmentResourcesHero = (props) => <Hero contentType={contentTypes.ASSESSMENT_RESOURCES} {...props} />;
31
- export const SubjectHero = (props) => <Hero contentType={contentTypes.SUBJECT} {...props} />;
32
- export const ExternalLearningResourcesHero = (props) => (
33
- <Hero contentType={contentTypes.EXTERNAL_LEARNING_RESOURCES} {...props} />
34
- );
35
- export const SourceMaterialHero = (props) => <Hero contentType={contentTypes.SOURCE_MATERIAL} {...props} />;
36
- export const NdlaFilmHero = ({ hasImage, ...rest }) => (
37
- <Hero {...rest} contentType={hasImage ? 'ndla-film has-image' : 'ndla-film'} />
38
- );
@@ -1,39 +0,0 @@
1
- /**
2
- * Copyright (c) 2017-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
-
9
- import React from 'react';
10
- import PropTypes from 'prop-types';
11
-
12
- // Lazyload image with lazysizes (https://github.com/aFarkas/lazysizes)
13
- const LazyLoadImage = ({ alt, src, srcSet, lazyLoadSrc, sizes, ...rest }) => [
14
- <noscript key="noscript">
15
- <img alt={alt} src={`${src}`} srcSet={srcSet} sizes={sizes} {...rest} />
16
- </noscript>,
17
- <img
18
- alt={alt}
19
- key="img"
20
- style={{ width: '100%' }}
21
- className="lazyload"
22
- src={lazyLoadSrc}
23
- data-src={src}
24
- data-src-set={srcSet}
25
- data-sizes={sizes}
26
- {...rest}
27
- />,
28
- ];
29
-
30
- LazyLoadImage.propTypes = {
31
- alt: PropTypes.string.isRequired,
32
- src: PropTypes.string.isRequired,
33
- sizes: PropTypes.string,
34
- contentType: PropTypes.string,
35
- srcSet: PropTypes.string,
36
- lazyLoadSrc: PropTypes.string.isRequired,
37
- };
38
-
39
- export default LazyLoadImage;
@@ -1,21 +0,0 @@
1
- /**
2
- * Copyright (c) 2019-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
-
9
- import PropTypes from 'prop-types';
10
-
11
- export const CropShape = PropTypes.shape({
12
- startX: PropTypes.number.isRequired,
13
- startY: PropTypes.number.isRequired,
14
- endX: PropTypes.number.isRequired,
15
- endY: PropTypes.number.isRequired,
16
- });
17
-
18
- export const FocalPointShape = PropTypes.shape({
19
- x: PropTypes.number.isRequired,
20
- y: PropTypes.number.isRequired,
21
- });
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import BEMHelper from 'react-bem-helper';
4
-
5
- const classes = BEMHelper('c-info-box');
6
-
7
- const InfoBox = ({ children }) => <div {...classes()}>{children}</div>;
8
-
9
- InfoBox.propTypes = {
10
- children: PropTypes.node.isRequired,
11
- };
12
-
13
- export default InfoBox;
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { ArticleTabs } from '@ndla/tabs';
3
-
4
- const TranslationBox = (props) => (
5
- <div className="c-translation-box">
6
- <div className="c-bodybox c-bodybox--translation">
7
- <ArticleTabs {...props} />
8
- </div>
9
- </div>
10
- );
11
-
12
- export default TranslationBox;