@ndla/ui 8.2.5 → 9.0.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.
Files changed (76) hide show
  1. package/es/Article/ArticleNotions.js +9 -7
  2. package/es/Figure/Figure.js +6 -5
  3. package/es/Figure/FigureExpandButton.js +6 -6
  4. package/es/Figure/FigureOpenDialogButton.js +45 -0
  5. package/es/Figure/index.js +2 -1
  6. package/es/Image/Image.js +1 -1
  7. package/es/LearningPaths/LearningPathMobileHeader.js +3 -3
  8. package/es/MessageBox/MessageBox.js +8 -8
  9. package/es/Notion/ConceptNotion.js +79 -28
  10. package/es/Notion/FigureNotion.js +6 -7
  11. package/es/Notion/Notion.js +19 -98
  12. package/es/Notion/NotionImage.js +26 -6
  13. package/es/Notion/NotionVisualElement.js +49 -10
  14. package/es/Topic/Topic.js +21 -21
  15. package/es/all.css +1 -1
  16. package/es/index.js +2 -4
  17. package/es/locale/messages-en.js +1 -1
  18. package/es/locale/messages-nb.js +1 -1
  19. package/es/locale/messages-nn.js +1 -1
  20. package/lib/Article/ArticleNotions.d.ts +2 -1
  21. package/lib/Article/ArticleNotions.js +9 -7
  22. package/lib/Figure/Figure.d.ts +2 -1
  23. package/lib/Figure/Figure.js +6 -5
  24. package/lib/Figure/FigureExpandButton.js +6 -6
  25. package/lib/Figure/FigureOpenDialogButton.d.ts +16 -0
  26. package/lib/Figure/FigureOpenDialogButton.js +57 -0
  27. package/lib/Figure/index.d.ts +1 -0
  28. package/lib/Figure/index.js +8 -0
  29. package/lib/Image/Image.js +1 -1
  30. package/lib/LearningPaths/LearningPathMobileHeader.js +4 -4
  31. package/lib/MessageBox/MessageBox.js +9 -9
  32. package/lib/Notion/ConceptNotion.d.ts +6 -7
  33. package/lib/Notion/ConceptNotion.js +84 -30
  34. package/lib/Notion/FigureNotion.d.ts +3 -2
  35. package/lib/Notion/FigureNotion.js +9 -11
  36. package/lib/Notion/Notion.d.ts +1 -12
  37. package/lib/Notion/Notion.js +23 -105
  38. package/lib/Notion/NotionImage.d.ts +2 -1
  39. package/lib/Notion/NotionImage.js +28 -8
  40. package/lib/Notion/NotionVisualElement.d.ts +6 -7
  41. package/lib/Notion/NotionVisualElement.js +48 -18
  42. package/lib/Topic/Topic.js +21 -21
  43. package/lib/all.css +1 -1
  44. package/lib/index.d.ts +2 -4
  45. package/lib/index.js +7 -9
  46. package/lib/locale/messages-en.js +1 -1
  47. package/lib/locale/messages-nb.js +1 -1
  48. package/lib/locale/messages-nn.js +1 -1
  49. package/package.json +10 -9
  50. package/src/Article/ArticleNotions.tsx +3 -2
  51. package/src/Figure/Figure.tsx +49 -41
  52. package/src/Figure/FigureExpandButton.tsx +4 -4
  53. package/src/Figure/FigureOpenDialogButton.tsx +37 -0
  54. package/src/Figure/component.figure.scss +4 -0
  55. package/src/Figure/index.ts +1 -0
  56. package/src/Image/Image.tsx +1 -1
  57. package/src/LearningPaths/LearningPathMobileHeader.tsx +1 -1
  58. package/src/MessageBox/MessageBox.tsx +1 -1
  59. package/src/Notion/ConceptNotion.tsx +136 -37
  60. package/src/Notion/FigureNotion.tsx +7 -7
  61. package/src/Notion/Notion.tsx +7 -145
  62. package/src/Notion/NotionImage.tsx +45 -15
  63. package/src/Notion/NotionVisualElement.tsx +35 -8
  64. package/src/Topic/Topic.tsx +1 -1
  65. package/src/index.ts +3 -4
  66. package/src/locale/messages-en.ts +1 -1
  67. package/src/locale/messages-nb.ts +1 -1
  68. package/src/locale/messages-nn.ts +1 -1
  69. package/es/CloseButton/CloseButton.js +0 -46
  70. package/es/CloseButton/index.js +0 -10
  71. package/lib/CloseButton/CloseButton.d.ts +0 -10
  72. package/lib/CloseButton/CloseButton.js +0 -54
  73. package/lib/CloseButton/index.d.ts +0 -10
  74. package/lib/CloseButton/index.js +0 -26
  75. package/src/CloseButton/CloseButton.tsx +0 -36
  76. package/src/CloseButton/index.ts +0 -13
@@ -5,11 +5,10 @@
5
5
  * LICENSE file in the root directory of this source tree. *
6
6
  */
7
7
 
8
- import Button from '@ndla/button';
9
8
  import { getGroupedContributorDescriptionList, getLicenseByAbbreviation } from '@ndla/licenses';
10
9
  import React, { ReactNode } from 'react';
11
10
  import { useTranslation } from 'react-i18next';
12
- import { Figure, FigureCaption, FigureLicenseDialog } from '..';
11
+ import { Figure, FigureCaption, FigureLicenseDialog } from '../Figure';
13
12
  import { Copyright } from '../types';
14
13
 
15
14
  interface Props {
@@ -17,11 +16,12 @@ interface Props {
17
16
  figureId: string;
18
17
  children: ReactNode | ((params: { typeClass: string }) => ReactNode);
19
18
  id: string;
20
- title: string;
19
+ title?: string;
21
20
  copyright?: Partial<Copyright>;
22
21
  licenseString: string;
23
22
  type: 'video' | 'h5p' | 'image' | 'concept';
24
23
  hideFigCaption?: boolean;
24
+ hideIconsAndAuthors?: boolean;
25
25
  }
26
26
 
27
27
  const FigureNotion = ({
@@ -34,6 +34,7 @@ const FigureNotion = ({
34
34
  title,
35
35
  type,
36
36
  hideFigCaption,
37
+ hideIconsAndAuthors,
37
38
  }: Props) => {
38
39
  const { t, i18n } = useTranslation();
39
40
  const license = getLicenseByAbbreviation(licenseString, i18n.language);
@@ -59,7 +60,8 @@ const FigureNotion = ({
59
60
  id={id}
60
61
  reuseLabel={t(`${type}.reuse`)}
61
62
  authors={contributors}
62
- licenseRights={license.rights}>
63
+ licenseRights={license.rights}
64
+ hideIconsAndAuthors={hideIconsAndAuthors}>
63
65
  <FigureLicenseDialog
64
66
  id={id}
65
67
  authors={contributors}
@@ -73,9 +75,7 @@ const FigureNotion = ({
73
75
  source: t('source'),
74
76
  learnAboutLicenses: t('license.learnMore'),
75
77
  title: t('title'),
76
- }}>
77
- {type === 'image' && <Button outline>{t('license.copyTitle')}</Button>}
78
- </FigureLicenseDialog>
78
+ }}></FigureLicenseDialog>
79
79
  </FigureCaption>
80
80
  )}
81
81
  </>
@@ -5,17 +5,11 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
-
8
+ import React, { Fragment, ReactNode } from 'react';
9
9
  import styled from '@emotion/styled';
10
10
  import { useTranslation } from 'react-i18next';
11
11
  import { parseMarkdown } from '@ndla/util';
12
- import React, { Fragment, ReactNode } from 'react';
13
- import { keyframes } from '@emotion/core';
14
- import Button from '@ndla/button';
15
- import { animations, breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
16
- import { CursorClick } from '@ndla/icons/action';
17
- import { Play, ArrowCollapse } from '@ndla/icons/common';
18
- import { ImageCrop, ImageFocalPoint, makeSrcQueryString } from '../Image';
12
+ import { breakpoints, fonts, mq, spacing } from '@ndla/core';
19
13
 
20
14
  const NotionContainer = styled.div``;
21
15
 
@@ -26,11 +20,7 @@ const ContentWrapper = styled.div`
26
20
  }
27
21
  .c-figure {
28
22
  margin: 0;
29
- position: relative !important;
30
- left: 0 !important;
31
- width: 25% !important;
32
23
  padding: 0 0 0 20px;
33
- float: right;
34
24
  &.expanded {
35
25
  width: 100% !important;
36
26
  padding: 0;
@@ -44,114 +34,21 @@ const ContentWrapper = styled.div`
44
34
  `;
45
35
  const TextWrapper = styled.div<{ hasVisualElement: boolean }>`
46
36
  width: ${(props) => (props.hasVisualElement ? '75%' : '100%')};
37
+
47
38
  ${mq.range({ until: breakpoints.tabletWide })} {
48
39
  width: 100%;
49
40
  }
50
- font-family: ${fonts.serif};
41
+ font-family: ${fonts.sans};
51
42
  ${fonts.sizes('18px', '28px')};
52
43
  ${ContentWrapper} .c-figure.expanded + & {
53
44
  width: 100%;
54
45
  }
55
46
  `;
56
47
 
57
- const ImageElement = styled.img``;
58
-
59
- const fadeInMediaKeyframe = keyframes`
60
- 0% {
61
- opacity: 0;
62
- height: auto;
63
- }
64
- 100% {
65
- opacity: 1;
66
- }
67
- `;
68
- const fadeOutMediaKeyframe = keyframes`
69
- 0% {
70
- opacity: 1;
71
- height: auto;
72
- }
73
- 100% {
74
- opacity: 0;
75
- height:0;
76
- overflow: hidden;
77
- }
78
- `;
79
-
80
- const ImageWrapper = styled.div`
81
- float: right;
82
- width: 25%;
83
- padding-left: ${spacing.normal};
84
- position: relative;
85
-
86
- ${mq.range({ until: breakpoints.tabletWide })} {
87
- width: 100%;
88
- padding-left: 0;
89
- }
90
- `;
91
-
92
- const ExpandVisualElementButton = styled(Button)`
93
- position: absolute;
94
- right: 8px;
95
- bottom: 8px;
96
- transition: all ${animations.durations.normal};
97
- &,
98
- &:focus,
99
- &:active {
100
- background-color: rgba(255, 255, 255, 0.65);
101
- }
102
-
103
- color: ${colors.brand.primary};
104
- border-radius: 50%;
105
- border: 0;
106
- width: 40px;
107
- height: 40px;
108
- display: inline-flex;
109
- justify-content: center;
110
- align-items: center;
111
-
112
- svg {
113
- transition: transform ${animations.durations.normal} ease-out;
114
- }
115
- ${ContentWrapper}:hover & {
116
- background-color: #fff;
117
- svg {
118
- transform: scale(1.2);
119
- }
120
- }
121
- `;
122
-
123
- const ExpandIcon = styled.span`
124
- ${ExpandVisualElementButton}.expanded & {
125
- display: none;
126
- }
127
- `;
128
- const CollapseIcon = styled.span`
129
- display: none;
130
- ${ExpandVisualElementButton}.expanded & {
131
- display: inline-block;
132
- }
133
- `;
134
-
135
48
  const ClearWrapper = styled.div`
136
49
  clear: both;
137
50
  `;
138
51
 
139
- const MediaContainer = styled.div`
140
- opacity: 0;
141
- height: 0;
142
- overflow: hidden;
143
- &.expanded {
144
- animation-name: ${fadeInMediaKeyframe};
145
- animation-duration: 2.8s;
146
- opacity: 1;
147
- height: auto;
148
- }
149
- &.fadeOut {
150
- animation-name: ${fadeOutMediaKeyframe};
151
- animation-duration: 2.8s;
152
- }
153
- `;
154
-
155
52
  const LabelsContainer = styled.div`
156
53
  display: flex;
157
54
  align-items: center;
@@ -160,23 +57,12 @@ const LabelsContainer = styled.div`
160
57
  margin: ${spacing.small} 0;
161
58
  `;
162
59
 
163
- type VisualElementProps = {
164
- type: 'video' | 'other';
165
- element: ReactNode;
166
- metaImage?: {
167
- url: string;
168
- alt: string;
169
- crop?: ImageCrop;
170
- focalPoint?: ImageFocalPoint;
171
- };
172
- };
173
-
174
60
  export type NotionProps = {
175
61
  id: string | number;
176
62
  labels?: string[];
177
63
  text: ReactNode;
178
64
  title: string;
179
- visualElement?: VisualElementProps;
65
+ visualElement: ReactNode;
180
66
  imageElement?: ReactNode;
181
67
  children?: ReactNode;
182
68
  };
@@ -186,34 +72,10 @@ const Notion = ({ id, labels = [], text, title, visualElement, imageElement, chi
186
72
 
187
73
  return (
188
74
  <NotionContainer>
189
- {visualElement && <MediaContainer id={`notion-media-${id}`}>{visualElement.element}</MediaContainer>}
190
75
  <ContentWrapper>
191
76
  {imageElement}
192
- {visualElement && visualElement.metaImage && (
193
- <ImageWrapper>
194
- <ImageElement
195
- src={`${visualElement.metaImage.url}?${makeSrcQueryString(
196
- 400,
197
- visualElement.metaImage.crop,
198
- visualElement.metaImage.focalPoint,
199
- )}`}
200
- alt={visualElement.metaImage.alt}
201
- />
202
- <ExpandVisualElementButton
203
- stripped
204
- data-notion-expand-media={true}
205
- data-notion-media-id={`notion-media-${id}`}>
206
- <ExpandIcon>
207
- {visualElement.type === 'video' && <Play style={{ width: '24px', height: '24px' }} />}
208
- {visualElement.type === 'other' && <CursorClick style={{ width: '24px', height: '24px' }} />}
209
- </ExpandIcon>
210
- <CollapseIcon>
211
- <ArrowCollapse style={{ width: '24px', height: '24px' }} />
212
- </CollapseIcon>
213
- </ExpandVisualElementButton>
214
- </ImageWrapper>
215
- )}
216
- <TextWrapper hasVisualElement={!!(imageElement || visualElement?.metaImage)}>
77
+ {visualElement}
78
+ <TextWrapper hasVisualElement={!!(imageElement || visualElement)}>
217
79
  {parseMarkdown(`**${title}** \u2013 ${text}`, 'body')}
218
80
  {!!labels.length && (
219
81
  <LabelsContainer>
@@ -6,17 +6,45 @@
6
6
  */
7
7
 
8
8
  import React from 'react';
9
+ import styled from '@emotion/styled';
10
+ import { animations, breakpoints, mq, spacing } from '@ndla/core';
9
11
  import { useTranslation } from 'react-i18next';
10
- import { Image, FigureExpandButton } from '..';
12
+ import Image from '../Image';
13
+ import { FigureOpenDialogButton } from '../Figure';
11
14
  import { Copyright } from '../types';
12
15
  import FigureNotion from './FigureNotion';
16
+
17
+ const StyledImageWrapper = styled.div`
18
+ overflow: hidden;
19
+ width: 260px;
20
+ padding-top: ${spacing.small};
21
+ ${mq.range({ until: breakpoints.tabletWide })} {
22
+ margin: 0 auto;
23
+ }
24
+ `;
25
+
26
+ const StyledImage = styled(Image)`
27
+ object-fit: cover;
28
+ max-height: 162px;
29
+ transition: transform ${animations.durations.fast};
30
+ &:hover {
31
+ transform: scale(1.1);
32
+ opacity: 1.1;
33
+ transition-duration: 0.5s;
34
+ }
35
+ ${mq.range({ until: breakpoints.tabletWide })} {
36
+ min-width: 260px;
37
+ }
38
+ `;
39
+
13
40
  interface Props {
41
+ type?: 'image' | 'video' | 'h5p' | 'iframe' | 'external';
14
42
  id: string;
15
43
  src: string;
16
44
  alt: string;
17
45
  imageCopyright?: Partial<Copyright>;
18
46
  }
19
- export const NotionImage = ({ id, src, alt, imageCopyright }: Props) => {
47
+ export const NotionImage = ({ id, src, alt, imageCopyright, type }: Props) => {
20
48
  const { t } = useTranslation();
21
49
 
22
50
  const imageId = `image-${id}`;
@@ -32,19 +60,21 @@ export const NotionImage = ({ id, src, alt, imageCopyright }: Props) => {
32
60
  licenseString={imageCopyright?.license?.license ?? ''}
33
61
  type={'image'}>
34
62
  {({ typeClass }) => (
35
- <Image
36
- alt={alt}
37
- src={src}
38
- expandButton={
39
- <FigureExpandButton
40
- typeClass={typeClass}
41
- messages={{
42
- zoomImageButtonLabel: t('license.images.itemImage.zoomImageButtonLabel'),
43
- zoomOutImageButtonLabel: t('license.image.itemImage.zoomOutImageButtonLabel'),
44
- }}
45
- />
46
- }
47
- />
63
+ <StyledImageWrapper>
64
+ <StyledImage
65
+ alt={alt}
66
+ src={src}
67
+ expandButton={
68
+ <FigureOpenDialogButton
69
+ type={type}
70
+ messages={{
71
+ zoomImageButtonLabel: t('license.images.itemImage.zoomImageButtonLabel'),
72
+ zoomOutImageButtonLabel: t('license.image.itemImage.zoomOutImageButtonLabel'),
73
+ }}
74
+ />
75
+ }
76
+ />
77
+ </StyledImageWrapper>
48
78
  )}
49
79
  </FigureNotion>
50
80
  );
@@ -4,12 +4,24 @@
4
4
  * This source code is licensed under the GPLv3 license found in the
5
5
  * LICENSE file in the root directory of this source tree. *
6
6
  */
7
-
8
- import React from 'react';
7
+ import { css } from '@emotion/core';
8
+ import styled from '@emotion/styled';
9
+ import React, { ReactNode } from 'react';
9
10
  import { Copyright } from '../types';
10
11
  import FigureNotion from './FigureNotion';
11
12
 
13
+ const StyledIframe = styled.iframe<{ type: string }>`
14
+ ${(props) =>
15
+ props.type === 'video'
16
+ ? css`
17
+ min-height: 400px;
18
+ `
19
+ : ''}
20
+ `;
21
+
12
22
  export type NotionVisualElementType = {
23
+ element?: ReactNode;
24
+ type?: 'video' | 'image' | 'h5p';
13
25
  resource?: string;
14
26
  title?: string;
15
27
  url?: string;
@@ -22,17 +34,28 @@ export type NotionVisualElementType = {
22
34
 
23
35
  interface Props {
24
36
  visualElement: NotionVisualElementType;
37
+ id: string;
38
+ figureId: string;
25
39
  }
40
+ const supportedEmbedTypes = ['brightcove', 'h5p', 'iframe', 'external', 'image'];
26
41
 
27
- const supportedEmbedTypes = ['brightcove', 'h5p', 'iframe', 'external'];
28
- const NotionVisualElement = ({ visualElement }: Props) => {
29
- const id = '1';
30
- const figureId = 'figure-1';
42
+ const getType = (resource: string) => {
43
+ if (resource === 'brightcove') {
44
+ return 'video';
45
+ }
46
+ if (resource === 'image') {
47
+ return 'image';
48
+ }
49
+ return 'h5p';
50
+ };
51
+
52
+ const NotionVisualElement = ({ visualElement, id, figureId }: Props) => {
31
53
  if (!visualElement.resource || !supportedEmbedTypes.includes(visualElement.resource)) {
32
54
  return <p>Embed type is not supported!</p>;
33
55
  }
34
56
 
35
- const type = visualElement.resource === 'brightcove' ? 'video' : 'h5p';
57
+ const type = getType(visualElement.resource);
58
+
36
59
  return (
37
60
  <FigureNotion
38
61
  resizeIframe
@@ -42,7 +65,11 @@ const NotionVisualElement = ({ visualElement }: Props) => {
42
65
  copyright={visualElement.copyright}
43
66
  licenseString={visualElement.copyright?.license?.license ?? ''}
44
67
  type={type}>
45
- <iframe title={visualElement.title} src={visualElement.url} />
68
+ {visualElement.image?.src ? (
69
+ <img src={visualElement.image?.src} alt={visualElement.image.alt} />
70
+ ) : (
71
+ <StyledIframe type={type} src={visualElement.url} title={visualElement.title} />
72
+ )}
46
73
  </FigureNotion>
47
74
  );
48
75
  };
@@ -277,7 +277,7 @@ const Topic = ({
277
277
  <ShowVisualElementWrapper>
278
278
  <TopicHeaderImage
279
279
  src={`${topic.image.url}?${makeSrcQueryString(
280
- 400,
280
+ 800,
281
281
  topic.image.crop,
282
282
  topic.image.focalPoint,
283
283
  )}`}
package/src/index.ts CHANGED
@@ -65,8 +65,7 @@ export {
65
65
 
66
66
  export { default as FactBox } from './FactBox';
67
67
 
68
- export { default as Image, ImageLink } from './Image';
69
- export { makeSrcQueryString } from './Image';
68
+ export { default as Image, ImageLink, makeSrcQueryString } from './Image';
70
69
 
71
70
  export {
72
71
  SubjectMaterialHero,
@@ -81,7 +80,7 @@ export {
81
80
 
82
81
  export { Footer, EditorName, FooterText, FooterAuth } from './Footer';
83
82
 
84
- export { Figure, FigureCaption, FigureLicenseDialog, FigureExpandButton } from './Figure';
83
+ export { Figure, FigureCaption, FigureLicenseDialog, FigureExpandButton, FigureOpenDialogButton } from './Figure';
85
84
 
86
85
  export { LanguageSelector } from './LanguageSelector';
87
86
 
@@ -119,7 +118,6 @@ export { MessageBox, MessageBoxTag, MessageBoxType } from './MessageBox';
119
118
 
120
119
  export { ResourceBox } from './ResourceBox';
121
120
 
122
- export { default as CloseButton } from './CloseButton';
123
121
  export { default as AudioPlayer, initAudioPlayers } from './AudioPlayer';
124
122
 
125
123
  export { NavigationHeading, NavigationBox, NavigationTopicAbout } from './Navigation';
@@ -220,4 +218,5 @@ export { default as CopyParagraphButton } from './CopyParagraphButton';
220
218
 
221
219
  export { default as ContentPlaceholder } from './ContentPlaceholder';
222
220
  export { Notion, ConceptNotion } from './Notion';
221
+
223
222
  export { BannerCard } from './BannerCard';
@@ -413,7 +413,7 @@ const messages = {
413
413
  images: 'Images',
414
414
  audio: 'Audio',
415
415
  video: 'Video',
416
- h5p: 'H5P',
416
+ h5p: 'h5p',
417
417
  files: 'Files',
418
418
  embedlink: 'Embedded link',
419
419
  other: 'Other content',
@@ -426,7 +426,7 @@ const messages = {
426
426
  images: 'Bilder',
427
427
  audio: 'Lyd',
428
428
  video: 'Video',
429
- h5p: 'H5P',
429
+ h5p: 'h5p',
430
430
  files: 'Filer',
431
431
  embedlink: 'Innbyggingslenke',
432
432
  concept: 'Forklaringer',
@@ -427,7 +427,7 @@ const messages = {
427
427
  images: 'Bilete',
428
428
  audio: 'Lyd',
429
429
  video: 'Video',
430
- h5p: 'H5P',
430
+ h5p: 'h5p',
431
431
  files: 'Filer',
432
432
  embedlink: 'Innbyggingslenke',
433
433
  other: 'Anna innhald',
@@ -1,46 +0,0 @@
1
- import _styled from "@emotion/styled-base";
2
-
3
- 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); }
4
-
5
- function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
6
-
7
- /**
8
- * Copyright (c) 2022-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 { Cross } from '@ndla/icons/action';
16
- import { useTranslation } from 'react-i18next';
17
- import { colors } from '@ndla/core';
18
- import { jsx as ___EmotionJSX } from "@emotion/core";
19
-
20
- var StyledButton = _styled("button", {
21
- target: "e4bzt4x0",
22
- label: "StyledButton"
23
- })(process.env.NODE_ENV === "production" ? {
24
- name: "1x6nvfn",
25
- styles: "background-color:transparent;border:none;display:flex;cursor:pointer;"
26
- } : {
27
- name: "1x6nvfn",
28
- styles: "background-color:transparent;border:none;display:flex;cursor:pointer;",
29
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNsb3NlQnV0dG9uLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFha0MiLCJmaWxlIjoiQ2xvc2VCdXR0b24udHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjItcHJlc2VudCwgTkRMQS5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBHUEx2MyBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqL1xuaW1wb3J0IFJlYWN0LCB7IEJ1dHRvbkhUTUxBdHRyaWJ1dGVzIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgQ3Jvc3MgfSBmcm9tICdAbmRsYS9pY29ucy9hY3Rpb24nO1xuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tICdyZWFjdC1pMThuZXh0JztcbmltcG9ydCB7IGNvbG9ycyB9IGZyb20gJ0BuZGxhL2NvcmUnO1xuXG5jb25zdCBTdHlsZWRCdXR0b24gPSBzdHlsZWQuYnV0dG9uYFxuICBiYWNrZ3JvdW5kLWNvbG9yOiB0cmFuc3BhcmVudDtcbiAgYm9yZGVyOiBub25lO1xuICBkaXNwbGF5OiBmbGV4O1xuICBjdXJzb3I6IHBvaW50ZXI7XG5gO1xuXG5jb25zdCBTdHlsZWRDcm9zcyA9IHN0eWxlZChDcm9zcylgXG4gIGhlaWdodDogMjRweDtcbiAgd2lkdGg6IDI0cHg7XG4gIGNvbG9yOiAke2NvbG9ycy50ZXh0LnByaW1hcnl9O1xuYDtcblxuZXhwb3J0IGNvbnN0IENsb3NlQnV0dG9uID0gKHByb3BzOiBCdXR0b25IVE1MQXR0cmlidXRlczxIVE1MQnV0dG9uRWxlbWVudD4pID0+IHtcbiAgY29uc3QgeyB0IH0gPSB1c2VUcmFuc2xhdGlvbigpO1xuICByZXR1cm4gKFxuICAgIDxTdHlsZWRCdXR0b24gYXJpYS1sYWJlbD17dCgnY2xvc2UnKX0gey4uLnByb3BzfT5cbiAgICAgIDxTdHlsZWRDcm9zcyAvPlxuICAgIDwvU3R5bGVkQnV0dG9uPlxuICApO1xufTtcblxuZXhwb3J0IGRlZmF1bHQgQ2xvc2VCdXR0b247XG4iXX0= */",
30
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
31
- });
32
-
33
- var StyledCross = /*#__PURE__*/_styled(Cross, {
34
- target: "e4bzt4x1",
35
- label: "StyledCross"
36
- })("height:24px;width:24px;color:", colors.text.primary, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNsb3NlQnV0dG9uLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFvQmlDIiwiZmlsZSI6IkNsb3NlQnV0dG9uLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSAyMDIyLXByZXNlbnQsIE5ETEEuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgR1BMdjMgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBp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1xuIl19 */"));
37
-
38
- export var CloseButton = function CloseButton(props) {
39
- var _useTranslation = useTranslation(),
40
- t = _useTranslation.t;
41
-
42
- return ___EmotionJSX(StyledButton, _extends({
43
- "aria-label": t('close')
44
- }, props), ___EmotionJSX(StyledCross, null));
45
- };
46
- export default CloseButton;
@@ -1,10 +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
- import CloseButton from './CloseButton';
9
- export { CloseButton };
10
- export default CloseButton;
@@ -1,10 +0,0 @@
1
- /**
2
- * Copyright (c) 2022-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 { ButtonHTMLAttributes } from 'react';
9
- export declare const CloseButton: (props: ButtonHTMLAttributes<HTMLButtonElement>) => JSX.Element;
10
- export default CloseButton;
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = exports.CloseButton = void 0;
7
-
8
- var _styledBase = _interopRequireDefault(require("@emotion/styled-base"));
9
-
10
- var _react = _interopRequireDefault(require("react"));
11
-
12
- var _action = require("@ndla/icons/action");
13
-
14
- var _reactI18next = require("react-i18next");
15
-
16
- var _core = require("@ndla/core");
17
-
18
- var _core2 = require("@emotion/core");
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
-
22
- 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); }
23
-
24
- function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
25
-
26
- var StyledButton = (0, _styledBase["default"])("button", {
27
- target: "e4bzt4x0",
28
- label: "StyledButton"
29
- })(process.env.NODE_ENV === "production" ? {
30
- name: "1x6nvfn",
31
- styles: "background-color:transparent;border:none;display:flex;cursor:pointer;"
32
- } : {
33
- name: "1x6nvfn",
34
- styles: "background-color:transparent;border:none;display:flex;cursor:pointer;",
35
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNsb3NlQnV0dG9uLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFha0MiLCJmaWxlIjoiQ2xvc2VCdXR0b24udHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjItcHJlc2VudCwgTkRMQS5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBHUEx2MyBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqL1xuaW1wb3J0IFJlYWN0LCB7IEJ1dHRvbkhUTUxBdHRyaWJ1dGVzIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgQ3Jvc3MgfSBmcm9tICdAbmRsYS9pY29ucy9hY3Rpb24nO1xuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tICdyZWFjdC1pMThuZXh0JztcbmltcG9ydCB7IGNvbG9ycyB9IGZyb20gJ0BuZGxhL2NvcmUnO1xuXG5jb25zdCBTdHlsZWRCdXR0b24gPSBzdHlsZWQuYnV0dG9uYFxuICBiYWNrZ3JvdW5kLWNvbG9yOiB0cmFuc3BhcmVudDtcbiAgYm9yZGVyOiBub25lO1xuICBkaXNwbGF5OiBmbGV4O1xuICBjdXJzb3I6IHBvaW50ZXI7XG5gO1xuXG5jb25zdCBTdHlsZWRDcm9zcyA9IHN0eWxlZChDcm9zcylgXG4gIGhlaWdodDogMjRweDtcbiAgd2lkdGg6IDI0cHg7XG4gIGNvbG9yOiAke2NvbG9ycy50ZXh0LnByaW1hcnl9O1xuYDtcblxuZXhwb3J0IGNvbnN0IENsb3NlQnV0dG9uID0gKHByb3BzOiBCdXR0b25IVE1MQXR0cmlidXRlczxIVE1MQnV0dG9uRWxlbWVudD4pID0+IHtcbiAgY29uc3QgeyB0IH0gPSB1c2VUcmFuc2xhdGlvbigpO1xuICByZXR1cm4gKFxuICAgIDxTdHlsZWRCdXR0b24gYXJpYS1sYWJlbD17dCgnY2xvc2UnKX0gey4uLnByb3BzfT5cbiAgICAgIDxTdHlsZWRDcm9zcyAvPlxuICAgIDwvU3R5bGVkQnV0dG9uPlxuICApO1xufTtcblxuZXhwb3J0IGRlZmF1bHQgQ2xvc2VCdXR0b247XG4iXX0= */",
36
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
37
- });
38
- var StyledCross = ( /*#__PURE__*/0, _styledBase["default"])(_action.Cross, {
39
- target: "e4bzt4x1",
40
- label: "StyledCross"
41
- })("height:24px;width:24px;color:", _core.colors.text.primary, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNsb3NlQnV0dG9uLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFvQmlDIiwiZmlsZSI6IkNsb3NlQnV0dG9uLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSAyMDIyLXByZXNlbnQsIE5ETEEuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgR1BMdjMgbGljZW5zZSBmb3VuZC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V4cG9ydCBkZWZhdWx0IENsb3NlQnV0dG9uO1xuIl19 */"));
42
-
43
- var CloseButton = function CloseButton(props) {
44
- var _useTranslation = (0, _reactI18next.useTranslation)(),
45
- t = _useTranslation.t;
46
-
47
- return (0, _core2.jsx)(StyledButton, _extends({
48
- "aria-label": t('close')
49
- }, props), (0, _core2.jsx)(StyledCross, null));
50
- };
51
-
52
- exports.CloseButton = CloseButton;
53
- var _default = CloseButton;
54
- exports["default"] = _default;
@@ -1,10 +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
- import CloseButton from './CloseButton';
9
- export { CloseButton };
10
- export default CloseButton;
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "CloseButton", {
7
- enumerable: true,
8
- get: function get() {
9
- return _CloseButton["default"];
10
- }
11
- });
12
- exports["default"] = void 0;
13
-
14
- var _CloseButton = _interopRequireDefault(require("./CloseButton"));
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
- var _default = _CloseButton["default"];
26
- exports["default"] = _default;