@ndla/ui 45.0.16 → 46.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Article/Article.js +3 -3
- package/es/AudioPlayer/index.js +0 -2
- package/es/Embed/conceptComponents.js +15 -8
- package/es/Figure/Figure.js +11 -89
- package/es/Figure/index.js +1 -3
- package/es/Notion/index.js +1 -3
- package/es/all.css +1 -1
- package/es/index.js +3 -4
- package/es/locale/messages-en.js +7 -2
- package/es/locale/messages-nb.js +7 -2
- package/es/locale/messages-nn.js +7 -2
- package/es/locale/messages-se.js +7 -2
- package/es/locale/messages-sma.js +7 -2
- package/lib/Article/Article.js +3 -3
- package/lib/AudioPlayer/index.d.ts +0 -2
- package/lib/AudioPlayer/index.js +0 -7
- package/lib/Embed/conceptComponents.js +17 -10
- package/lib/Figure/Figure.d.ts +0 -38
- package/lib/Figure/Figure.js +20 -96
- package/lib/Figure/index.d.ts +1 -3
- package/lib/Figure/index.js +2 -17
- package/lib/Notion/index.d.ts +0 -4
- package/lib/Notion/index.js +0 -14
- package/lib/all.css +1 -1
- package/lib/index.d.ts +3 -5
- package/lib/index.js +1 -32
- package/lib/locale/messages-en.d.ts +5 -0
- package/lib/locale/messages-en.js +7 -2
- package/lib/locale/messages-nb.d.ts +5 -0
- package/lib/locale/messages-nb.js +7 -2
- package/lib/locale/messages-nn.d.ts +5 -0
- package/lib/locale/messages-nn.js +7 -2
- package/lib/locale/messages-se.d.ts +5 -0
- package/lib/locale/messages-se.js +7 -2
- package/lib/locale/messages-sma.d.ts +5 -0
- package/lib/locale/messages-sma.js +7 -2
- package/package.json +18 -22
- package/src/Article/Article.tsx +1 -1
- package/src/AudioPlayer/AudiPlayer.stories.tsx +88 -0
- package/src/AudioPlayer/index.ts +0 -2
- package/src/Embed/IframeEmbed.stories.tsx +15 -0
- package/src/Embed/ImageEmbed.stories.tsx +169 -2
- package/src/Embed/RelatedContentEmbed.stories.tsx +438 -0
- package/src/Embed/conceptComponents.tsx +13 -1
- package/src/Figure/Figure.tsx +1 -120
- package/src/Figure/index.ts +1 -3
- package/src/Notion/index.ts +0 -4
- package/src/index.ts +3 -13
- package/src/locale/messages-en.ts +7 -2
- package/src/locale/messages-nb.ts +7 -2
- package/src/locale/messages-nn.ts +7 -2
- package/src/locale/messages-se.ts +7 -2
- package/src/locale/messages-sma.ts +7 -2
- package/src/main.scss +0 -1
- package/es/Animation/Fade.js +0 -62
- package/es/Animation/index.js +0 -1
- package/es/AudioPlayer/initAudioPlayers.js +0 -60
- package/es/Dialog/Dialog.js +0 -70
- package/es/Dialog/index.js +0 -11
- package/es/Figure/FigureLicense.js +0 -72
- package/es/Figure/FigureLicenseDialog.js +0 -54
- package/es/Notion/ConceptNotion.js +0 -135
- package/es/Notion/FigureNotion.js +0 -93
- package/es/Notion/NotionVisualElement.js +0 -68
- package/es/utils/createUniversalPortal.js +0 -25
- package/lib/Animation/Fade.d.ts +0 -17
- package/lib/Animation/Fade.js +0 -70
- package/lib/Animation/index.d.ts +0 -1
- package/lib/Animation/index.js +0 -13
- package/lib/AudioPlayer/initAudioPlayers.d.ts +0 -11
- package/lib/AudioPlayer/initAudioPlayers.js +0 -69
- package/lib/Dialog/Dialog.d.ts +0 -23
- package/lib/Dialog/Dialog.js +0 -75
- package/lib/Dialog/index.d.ts +0 -10
- package/lib/Dialog/index.js +0 -22
- package/lib/Figure/FigureLicense.d.ts +0 -33
- package/lib/Figure/FigureLicense.js +0 -76
- package/lib/Figure/FigureLicenseDialog.d.ts +0 -29
- package/lib/Figure/FigureLicenseDialog.js +0 -57
- package/lib/Notion/ConceptNotion.d.ts +0 -24
- package/lib/Notion/ConceptNotion.js +0 -141
- package/lib/Notion/FigureNotion.d.ts +0 -27
- package/lib/Notion/FigureNotion.js +0 -97
- package/lib/Notion/NotionVisualElement.d.ts +0 -22
- package/lib/Notion/NotionVisualElement.js +0 -75
- package/lib/utils/createUniversalPortal.d.ts +0 -9
- package/lib/utils/createUniversalPortal.js +0 -32
- package/src/Animation/Fade.tsx +0 -46
- package/src/Animation/index.ts +0 -1
- package/src/AudioPlayer/initAudioPlayers.tsx +0 -57
- package/src/Dialog/Dialog.tsx +0 -80
- package/src/Dialog/component.dialog.scss +0 -144
- package/src/Dialog/index.ts +0 -13
- package/src/Figure/FigureLicense.tsx +0 -75
- package/src/Figure/FigureLicenseDialog.tsx +0 -51
- package/src/Notion/ConceptNotion.tsx +0 -170
- package/src/Notion/FigureNotion.tsx +0 -104
- package/src/Notion/NotionVisualElement.tsx +0 -80
- package/src/utils/createUniversalPortal.tsx +0 -23
package/src/Figure/Figure.tsx
CHANGED
|
@@ -7,134 +7,15 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
// N.B These components is used to render static markup serverside
|
|
10
|
-
// Any interactivty is added by scripts located in the ndla-article-scripts package
|
|
11
10
|
|
|
12
11
|
import { ReactNode } from 'react';
|
|
13
12
|
import BEMHelper from 'react-bem-helper';
|
|
14
|
-
import { isFunction as isFunctionHelper
|
|
15
|
-
import { Link as LinkIcon } from '@ndla/icons/common';
|
|
16
|
-
import { LicenseByline } from '@ndla/notion';
|
|
17
|
-
import SafeLink from '@ndla/safelink';
|
|
18
|
-
import { ButtonV2 } from '@ndla/button';
|
|
19
|
-
import { isMobile } from 'react-device-detect';
|
|
13
|
+
import { isFunction as isFunctionHelper } from '@ndla/util';
|
|
20
14
|
const classes = new BEMHelper({
|
|
21
15
|
name: 'figure',
|
|
22
16
|
prefix: 'c-',
|
|
23
17
|
});
|
|
24
18
|
|
|
25
|
-
export const FigureCaption = ({
|
|
26
|
-
figureId,
|
|
27
|
-
id,
|
|
28
|
-
modalButton,
|
|
29
|
-
children,
|
|
30
|
-
caption,
|
|
31
|
-
authors,
|
|
32
|
-
reuseLabel,
|
|
33
|
-
licenseRights,
|
|
34
|
-
locale,
|
|
35
|
-
link,
|
|
36
|
-
hideFigcaption,
|
|
37
|
-
hasLinkedVideo,
|
|
38
|
-
hideIconsAndAuthors,
|
|
39
|
-
linkedVideoMessages,
|
|
40
|
-
linkedVideoButton,
|
|
41
|
-
className,
|
|
42
|
-
}: FigureCaptionProps) => {
|
|
43
|
-
return (
|
|
44
|
-
<figcaption {...classes('caption', hideFigcaption && !isMobile ? 'hidden-caption' : undefined, className)}>
|
|
45
|
-
{caption ? <div {...classes('info')}>{parseMarkdown(caption)}</div> : null}
|
|
46
|
-
<footer {...classes('byline')}>
|
|
47
|
-
<div {...classes('byline-licenselist')}>
|
|
48
|
-
<LicenseByline licenseRights={hideIconsAndAuthors ? [] : licenseRights} locale={locale} marginRight>
|
|
49
|
-
<div {...classes('byline-author-buttons', hideIconsAndAuthors ? 'no-siblings' : undefined)}>
|
|
50
|
-
{!hideIconsAndAuthors && (
|
|
51
|
-
<span {...classes('byline-authors')}>{authors?.map((author) => author.name).join(', ')}</span>
|
|
52
|
-
)}
|
|
53
|
-
<div>
|
|
54
|
-
{modalButton ? (
|
|
55
|
-
modalButton
|
|
56
|
-
) : (
|
|
57
|
-
<ButtonV2
|
|
58
|
-
shape="pill"
|
|
59
|
-
variant="outline"
|
|
60
|
-
size="small"
|
|
61
|
-
data-dialog-trigger-id={id}
|
|
62
|
-
data-dialog-source-id={figureId}
|
|
63
|
-
>
|
|
64
|
-
{reuseLabel}
|
|
65
|
-
</ButtonV2>
|
|
66
|
-
)}
|
|
67
|
-
{hasLinkedVideo &&
|
|
68
|
-
(linkedVideoButton ? (
|
|
69
|
-
linkedVideoButton
|
|
70
|
-
) : (
|
|
71
|
-
<ButtonV2 shape="pill" variant="outline" size="small" {...classes('toggleAlternativeVideo')}>
|
|
72
|
-
<span className="original">{linkedVideoMessages?.alternative}</span>
|
|
73
|
-
<span className="alternative hidden">{linkedVideoMessages?.original}</span>
|
|
74
|
-
</ButtonV2>
|
|
75
|
-
))}
|
|
76
|
-
</div>
|
|
77
|
-
{children}
|
|
78
|
-
</div>
|
|
79
|
-
</LicenseByline>
|
|
80
|
-
|
|
81
|
-
{link && (
|
|
82
|
-
<div {...classes('link-wrapper')}>
|
|
83
|
-
<SafeLink
|
|
84
|
-
to={link.url}
|
|
85
|
-
{...classes('link')}
|
|
86
|
-
target={link.external ? '_blank' : undefined}
|
|
87
|
-
rel={link.external ? 'noopener noreferrer' : undefined}
|
|
88
|
-
>
|
|
89
|
-
<span {...classes('link-text')}>{link.text}</span>
|
|
90
|
-
<LinkIcon />
|
|
91
|
-
</SafeLink>
|
|
92
|
-
{link.description && <p {...classes('link-description')}>{link.description}</p>}
|
|
93
|
-
</div>
|
|
94
|
-
)}
|
|
95
|
-
</div>
|
|
96
|
-
</footer>
|
|
97
|
-
</figcaption>
|
|
98
|
-
);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export interface FigureLicense {
|
|
102
|
-
short: string;
|
|
103
|
-
title: string;
|
|
104
|
-
userFriendlyTitle: string;
|
|
105
|
-
description: string;
|
|
106
|
-
rights: string[];
|
|
107
|
-
linkText?: string;
|
|
108
|
-
url?: string;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
interface FigureCaptionProps {
|
|
112
|
-
className?: string;
|
|
113
|
-
figureId: string;
|
|
114
|
-
id?: string;
|
|
115
|
-
caption?: string;
|
|
116
|
-
reuseLabel?: string;
|
|
117
|
-
licenseRights: string[];
|
|
118
|
-
children?: ReactNode;
|
|
119
|
-
modalButton?: ReactNode;
|
|
120
|
-
linkedVideoButton?: ReactNode;
|
|
121
|
-
authors?: { name: string }[];
|
|
122
|
-
link?: {
|
|
123
|
-
url: string;
|
|
124
|
-
text: string;
|
|
125
|
-
description?: string;
|
|
126
|
-
external?: boolean;
|
|
127
|
-
};
|
|
128
|
-
locale?: string;
|
|
129
|
-
hideFigcaption?: boolean;
|
|
130
|
-
hasLinkedVideo?: boolean;
|
|
131
|
-
hideIconsAndAuthors?: boolean;
|
|
132
|
-
linkedVideoMessages?: {
|
|
133
|
-
original: string;
|
|
134
|
-
alternative: string;
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
19
|
const Figure = ({ children, type = 'full', resizeIframe, className, ...rest }: Props) => {
|
|
139
20
|
const typeClass = type === 'full-column' ? 'c-figure--full-column' : `u-float-${type}`;
|
|
140
21
|
const right = ['small-right', 'xsmall-right'].includes(type);
|
package/src/Figure/index.ts
CHANGED
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
export { Figure, FigureCaption };
|
|
11
|
-
export { FigureLicenseDialog } from './FigureLicenseDialog';
|
|
9
|
+
export { default as Figure } from './Figure';
|
|
12
10
|
export { FigureExpandButton } from './FigureExpandButton';
|
|
13
11
|
export { FigureBylineExpandButton } from './FigureBylineExpandButton';
|
|
14
12
|
export { FigureOpenDialogButton } from './FigureOpenDialogButton';
|
package/src/Notion/index.ts
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export { default as ConceptNotion } from './ConceptNotion';
|
|
2
1
|
export { default as Notion } from './Notion';
|
|
3
|
-
export { default as NotionVisualElement } from './NotionVisualElement';
|
|
4
|
-
export type { NotionVisualElementType } from './NotionVisualElement';
|
|
5
|
-
export type { ConceptNotionType } from './ConceptNotion';
|
package/src/index.ts
CHANGED
|
@@ -42,8 +42,6 @@ export { default as Table, TableStyling } from './Table';
|
|
|
42
42
|
|
|
43
43
|
export { default as ResourcesWrapper, ResourcesTopicTitle } from './ResourcesWrapper';
|
|
44
44
|
|
|
45
|
-
export { createUniversalPortal } from './utils/createUniversalPortal';
|
|
46
|
-
|
|
47
45
|
export { default as NoContentBox } from './NoContentBox';
|
|
48
46
|
|
|
49
47
|
export { default as Masthead, getMastheadHeight, useMastheadHeight, SkipToMainContent } from './Masthead';
|
|
@@ -97,14 +95,7 @@ export { FilterList, FilterListPhone, FilterButtons, ToggleItem } from './Filter
|
|
|
97
95
|
|
|
98
96
|
export { Footer, EditorName, FooterText } from './Footer';
|
|
99
97
|
|
|
100
|
-
export {
|
|
101
|
-
Figure,
|
|
102
|
-
FigureCaption,
|
|
103
|
-
FigureLicenseDialog,
|
|
104
|
-
FigureExpandButton,
|
|
105
|
-
FigureOpenDialogButton,
|
|
106
|
-
FigureBylineExpandButton,
|
|
107
|
-
} from './Figure';
|
|
98
|
+
export { Figure, FigureExpandButton, FigureOpenDialogButton, FigureBylineExpandButton } from './Figure';
|
|
108
99
|
export type { FigureType } from './Figure';
|
|
109
100
|
|
|
110
101
|
export { LanguageSelector } from './LanguageSelector';
|
|
@@ -149,7 +140,7 @@ export { MessageBox, MessageBoxTag, MessageBanner } from './Messages';
|
|
|
149
140
|
|
|
150
141
|
export { ResourceBox } from './ResourceBox';
|
|
151
142
|
|
|
152
|
-
export { default as AudioPlayer
|
|
143
|
+
export { default as AudioPlayer } from './AudioPlayer';
|
|
153
144
|
|
|
154
145
|
export { NavigationBox, NavigationTopicAbout } from './Navigation';
|
|
155
146
|
|
|
@@ -241,8 +232,7 @@ export { default as CopyParagraphButton, CopyParagraphButtonV2 } from './CopyPar
|
|
|
241
232
|
|
|
242
233
|
export { default as ContentPlaceholder } from './ContentPlaceholder';
|
|
243
234
|
|
|
244
|
-
export { Notion
|
|
245
|
-
export type { NotionVisualElementType, ConceptNotionType } from './Notion';
|
|
235
|
+
export { Notion } from './Notion';
|
|
246
236
|
|
|
247
237
|
export { BannerCard } from './BannerCard';
|
|
248
238
|
export { Folder, FolderInput } from './MyNdla';
|
|
@@ -210,10 +210,10 @@ const messages = {
|
|
|
210
210
|
notionsHeading: 'Explanations',
|
|
211
211
|
notionsRemove: 'Remove',
|
|
212
212
|
showVideo: 'Watch video',
|
|
213
|
-
concept: '
|
|
213
|
+
concept: 'Concept',
|
|
214
214
|
gridView: 'Grid-view',
|
|
215
215
|
listView: 'List-view',
|
|
216
|
-
gloss: '
|
|
216
|
+
gloss: 'Gloss',
|
|
217
217
|
},
|
|
218
218
|
contextModal: {
|
|
219
219
|
button: '+ {{count}} more contexts',
|
|
@@ -1167,6 +1167,11 @@ const messages = {
|
|
|
1167
1167
|
},
|
|
1168
1168
|
},
|
|
1169
1169
|
},
|
|
1170
|
+
iconMenu: {
|
|
1171
|
+
folders: 'Folders',
|
|
1172
|
+
tags: 'Tags',
|
|
1173
|
+
subjects: 'Favourite subjects',
|
|
1174
|
+
},
|
|
1170
1175
|
tagList: 'Tags',
|
|
1171
1176
|
tags: '{{count}} tag',
|
|
1172
1177
|
tags_plural: '{{count}} tags',
|
|
@@ -210,8 +210,8 @@ const messages = {
|
|
|
210
210
|
notionsHeading: 'Begrepsforklaring',
|
|
211
211
|
notionsRemove: 'Fjern',
|
|
212
212
|
showVideo: 'Se video',
|
|
213
|
-
concept: '
|
|
214
|
-
gloss: '
|
|
213
|
+
concept: 'Begrepsforklaring',
|
|
214
|
+
gloss: 'Glose',
|
|
215
215
|
gridView: 'Gallerivisning',
|
|
216
216
|
listView: 'Listevisning',
|
|
217
217
|
},
|
|
@@ -1165,6 +1165,11 @@ const messages = {
|
|
|
1165
1165
|
},
|
|
1166
1166
|
},
|
|
1167
1167
|
},
|
|
1168
|
+
iconMenu: {
|
|
1169
|
+
folders: 'Mapper',
|
|
1170
|
+
tags: 'Knagger',
|
|
1171
|
+
subjects: 'Favorittfag',
|
|
1172
|
+
},
|
|
1168
1173
|
tagList: 'Emneknagger',
|
|
1169
1174
|
tags: '{{count}} emneknagg',
|
|
1170
1175
|
tags_plural: '{{count}} emneknagger',
|
|
@@ -210,10 +210,10 @@ const messages = {
|
|
|
210
210
|
notionsHeading: 'Begrepsforklaring',
|
|
211
211
|
notionsRemove: 'Fjern',
|
|
212
212
|
showVideo: 'Sjå video',
|
|
213
|
-
concept: '
|
|
213
|
+
concept: 'Begrepsforklaring',
|
|
214
214
|
gridView: 'Gallerivisning',
|
|
215
215
|
listView: 'Listevisning',
|
|
216
|
-
gloss: '
|
|
216
|
+
gloss: 'Glose',
|
|
217
217
|
},
|
|
218
218
|
contextModal: {
|
|
219
219
|
button: '+ {{count}} fleire stader',
|
|
@@ -1165,6 +1165,11 @@ const messages = {
|
|
|
1165
1165
|
},
|
|
1166
1166
|
},
|
|
1167
1167
|
},
|
|
1168
|
+
iconMenu: {
|
|
1169
|
+
folders: 'Mappar',
|
|
1170
|
+
tags: 'Knaggar',
|
|
1171
|
+
subjects: 'Favorittfag',
|
|
1172
|
+
},
|
|
1168
1173
|
tagList: 'Emneknaggar',
|
|
1169
1174
|
tags: '{{count}} emneknagg',
|
|
1170
1175
|
tags_plural: '{{count}} emneknaggar',
|
|
@@ -210,10 +210,10 @@ const messages = {
|
|
|
210
210
|
notionsHeading: 'Doabačilgehus',
|
|
211
211
|
notionsRemove: 'Sihko',
|
|
212
212
|
showVideo: 'Geahča video',
|
|
213
|
-
concept: '
|
|
213
|
+
concept: 'Doabačilgehus',
|
|
214
214
|
gridView: 'Galleriijačájáhus',
|
|
215
215
|
listView: 'Čájáhus listtu vuođul',
|
|
216
|
-
gloss: '
|
|
216
|
+
gloss: 'Sánit',
|
|
217
217
|
},
|
|
218
218
|
contextModal: {
|
|
219
219
|
button: '+ {{count}} eanet sajiin',
|
|
@@ -1166,6 +1166,11 @@ const messages = {
|
|
|
1166
1166
|
},
|
|
1167
1167
|
},
|
|
1168
1168
|
},
|
|
1169
|
+
iconMenu: {
|
|
1170
|
+
folders: 'Mapper',
|
|
1171
|
+
tags: 'Knagger',
|
|
1172
|
+
subjects: 'Favorittfag',
|
|
1173
|
+
},
|
|
1169
1174
|
tagList: 'Fáddágilkor',
|
|
1170
1175
|
tags: '{{count}} fáddágilkor',
|
|
1171
1176
|
tags_plural: '{{count}} fáddágilkorat',
|
|
@@ -210,10 +210,10 @@ const messages = {
|
|
|
210
210
|
notionsHeading: 'Baakoebuerkiestimmie',
|
|
211
211
|
notionsRemove: 'Skubph',
|
|
212
212
|
showVideo: 'Gïehtjh videjovem',
|
|
213
|
-
concept: '
|
|
213
|
+
concept: 'Begrepsforklaring',
|
|
214
214
|
gridView: 'Gallerivisning',
|
|
215
215
|
listView: 'Listevisning',
|
|
216
|
-
gloss: '
|
|
216
|
+
gloss: 'Glose',
|
|
217
217
|
},
|
|
218
218
|
contextModal: {
|
|
219
219
|
button: '+ {{count}} jieniebinie sijjine',
|
|
@@ -1169,6 +1169,11 @@ const messages = {
|
|
|
1169
1169
|
},
|
|
1170
1170
|
},
|
|
1171
1171
|
},
|
|
1172
|
+
iconMenu: {
|
|
1173
|
+
folders: 'Mapper',
|
|
1174
|
+
tags: 'Knagger',
|
|
1175
|
+
subjects: 'Favorittfag',
|
|
1176
|
+
},
|
|
1172
1177
|
tagList: 'Emneknagg',
|
|
1173
1178
|
tags: '{{count}} emneknagg',
|
|
1174
1179
|
tags_plural: '{{count}} emneknagger',
|
package/src/main.scss
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
@import 'global/components/component.story-intro';
|
|
9
9
|
@import 'Figure/component.figure';
|
|
10
10
|
@import 'Figure/component.figure-license';
|
|
11
|
-
@import 'Dialog/component.dialog';
|
|
12
11
|
@import 'FactBox/component.factbox';
|
|
13
12
|
@import 'Aside/component.aside';
|
|
14
13
|
@import 'Article/component.footnotes';
|
package/es/Animation/Fade.js
DELETED
|
@@ -1,62 +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
|
-
|
|
9
|
-
import { useMemo } from 'react';
|
|
10
|
-
import { AnimatePresence, LazyMotion, m, domAnimation } from 'framer-motion';
|
|
11
|
-
import uniqueId from 'lodash/uniqueId';
|
|
12
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
13
|
-
var animations = function animations(duration, delayIn, delayOut) {
|
|
14
|
-
return {
|
|
15
|
-
open: {
|
|
16
|
-
opacity: 1,
|
|
17
|
-
transition: {
|
|
18
|
-
delay: delayIn / 1000,
|
|
19
|
-
ease: 'easeInOut',
|
|
20
|
-
duration: duration / 1000
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
closed: {
|
|
24
|
-
opacity: 0,
|
|
25
|
-
transition: {
|
|
26
|
-
delay: delayOut / 1000,
|
|
27
|
-
ease: 'easeInOut',
|
|
28
|
-
duration: duration / 1000
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
var defaultTimeout = 300;
|
|
34
|
-
var Fade = function Fade(_ref) {
|
|
35
|
-
var show = _ref.show,
|
|
36
|
-
_ref$delay = _ref.delay,
|
|
37
|
-
delay = _ref$delay === void 0 ? 0 : _ref$delay,
|
|
38
|
-
_ref$timeout = _ref.timeout,
|
|
39
|
-
timeout = _ref$timeout === void 0 ? defaultTimeout : _ref$timeout,
|
|
40
|
-
_ref$exitDelay = _ref.exitDelay,
|
|
41
|
-
exitDelay = _ref$exitDelay === void 0 ? 0 : _ref$exitDelay,
|
|
42
|
-
children = _ref.children;
|
|
43
|
-
var id = useMemo(function () {
|
|
44
|
-
return uniqueId();
|
|
45
|
-
}, []);
|
|
46
|
-
var variants = useMemo(function () {
|
|
47
|
-
return animations(timeout, delay, exitDelay);
|
|
48
|
-
}, [timeout, delay, exitDelay]);
|
|
49
|
-
return _jsx(LazyMotion, {
|
|
50
|
-
features: domAnimation,
|
|
51
|
-
children: _jsx(AnimatePresence, {
|
|
52
|
-
children: show && _jsx(m.div, {
|
|
53
|
-
initial: "closed",
|
|
54
|
-
animate: "open",
|
|
55
|
-
exit: "closed",
|
|
56
|
-
variants: variants,
|
|
57
|
-
children: children
|
|
58
|
-
}, id)
|
|
59
|
-
})
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
export default Fade;
|
package/es/Animation/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Fade } from './Fade';
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2021-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 ReactDOM from 'react-dom';
|
|
10
|
-
import shave from 'shave';
|
|
11
|
-
import Controls from './Controls';
|
|
12
|
-
import SpeechControl from './SpeechControl';
|
|
13
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
14
|
-
export var truncateDescription = function truncateDescription(el, readMoreLabel) {
|
|
15
|
-
shave(el, 90, {
|
|
16
|
-
character: "... <a href=\"#\" onclick=\"(function(e){e.preventDefault(); const parentNode = e.target.parentNode; parentNode.nextSibling.style.display = 'inline'; parentNode.remove();return false;})(arguments[0]);return false;\">".concat(readMoreLabel, "</a>")
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
var forEachElement = function forEachElement(selector, callback) {
|
|
20
|
-
var nodeList = document.querySelectorAll(selector);
|
|
21
|
-
for (var i = 0; i < nodeList.length; i += 1) {
|
|
22
|
-
callback(nodeList[i], i);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
var initAudioPlayers = function initAudioPlayers(locale) {
|
|
26
|
-
forEachElement('[data-audio-player]', function (el) {
|
|
27
|
-
var src = el.getAttribute('data-src');
|
|
28
|
-
var title = el.getAttribute('data-title');
|
|
29
|
-
var speech = el.getAttribute('data-speech');
|
|
30
|
-
if (src && title) {
|
|
31
|
-
if (speech) {
|
|
32
|
-
// eslint-disable-next-line react/no-deprecated
|
|
33
|
-
ReactDOM.hydrate(_jsx(SpeechControl, {
|
|
34
|
-
src: src,
|
|
35
|
-
title: title
|
|
36
|
-
}), el);
|
|
37
|
-
} else {
|
|
38
|
-
// eslint-disable-next-line react/no-deprecated
|
|
39
|
-
ReactDOM.hydrate(_jsx(Controls, {
|
|
40
|
-
src: src,
|
|
41
|
-
title: title
|
|
42
|
-
}), el);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
forEachElement('[data-audio-player-description]', function (el) {
|
|
47
|
-
var readMoreLabel = el.getAttribute('data-read-more-text');
|
|
48
|
-
truncateDescription(el, readMoreLabel);
|
|
49
|
-
});
|
|
50
|
-
forEachElement('[data-audio-text-button-id]', function (el) {
|
|
51
|
-
var id = el.getAttribute('data-audio-text-button-id');
|
|
52
|
-
if (id) {
|
|
53
|
-
el.onclick = function () {
|
|
54
|
-
var _document, _document$getElementB;
|
|
55
|
-
return (_document = document) === null || _document === void 0 ? void 0 : (_document$getElementB = _document.getElementById(id)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.toggleAttribute('hidden');
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
export default initAudioPlayers;
|
package/es/Dialog/Dialog.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["children", "messages", "id", "labelledby", "label", "modifier", "disablePortal", "hidden", "onClose"];
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
-
/**
|
|
11
|
-
* Copyright (c) 2017-present, NDLA.
|
|
12
|
-
*
|
|
13
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
14
|
-
* LICENSE file in the root directory of this source tree.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
// N.B These component is used to render static markup serverside
|
|
19
|
-
// Any interactivty is added by scripts located in the ndla-article-scripts package
|
|
20
|
-
|
|
21
|
-
import BEMHelper from 'react-bem-helper';
|
|
22
|
-
import { createUniversalPortal } from '../utils/createUniversalPortal';
|
|
23
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
24
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
25
|
-
var classes = new BEMHelper({
|
|
26
|
-
name: 'dialog',
|
|
27
|
-
prefix: 'c-'
|
|
28
|
-
});
|
|
29
|
-
export 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, _excluded);
|
|
45
|
-
var content = _jsxs("div", _objectSpread(_objectSpread(_objectSpread({}, classes('', modifier)), {}, {
|
|
46
|
-
"data-dialog-id": id,
|
|
47
|
-
role: "dialog",
|
|
48
|
-
"aria-hidden": hidden,
|
|
49
|
-
"aria-labelledby": labelledby,
|
|
50
|
-
"aria-label": label
|
|
51
|
-
}, rest), {}, {
|
|
52
|
-
children: [_jsxs("div", _objectSpread(_objectSpread({}, classes('content')), {}, {
|
|
53
|
-
children: [_jsx("button", _objectSpread(_objectSpread({}, classes('close')), {}, {
|
|
54
|
-
type: "button",
|
|
55
|
-
onClick: function onClick() {
|
|
56
|
-
if (onClose) {
|
|
57
|
-
onClose();
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
children: messages.close
|
|
61
|
-
})), children]
|
|
62
|
-
})), _jsx("div", {
|
|
63
|
-
className: "o-backdrop"
|
|
64
|
-
})]
|
|
65
|
-
}));
|
|
66
|
-
if (disablePortal) {
|
|
67
|
-
return content;
|
|
68
|
-
}
|
|
69
|
-
return createUniversalPortal(content, 'body');
|
|
70
|
-
};
|
package/es/Dialog/index.js
DELETED
|
@@ -1,11 +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 { Dialog } from './Dialog';
|
|
10
|
-
export { Dialog };
|
|
11
|
-
export default Dialog;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
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
|
-
|
|
15
|
-
// N.B This component is used to render static markup serverside
|
|
16
|
-
// Any interactivty is added by scripts located in the ndla-article-scripts package
|
|
17
|
-
|
|
18
|
-
import BEMHelper from 'react-bem-helper';
|
|
19
|
-
import { uuid } from '@ndla/util';
|
|
20
|
-
import { LicenseDescription } from '@ndla/notion';
|
|
21
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
22
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
23
|
-
import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
24
|
-
export var classLicenses = new BEMHelper({
|
|
25
|
-
name: 'figure-license',
|
|
26
|
-
prefix: 'c-'
|
|
27
|
-
});
|
|
28
|
-
export var FigureLicenseCta = function FigureLicenseCta(_ref) {
|
|
29
|
-
var children = _ref.children,
|
|
30
|
-
messages = _ref.messages,
|
|
31
|
-
authors = _ref.authors,
|
|
32
|
-
origin = _ref.origin,
|
|
33
|
-
title = _ref.title;
|
|
34
|
-
return _jsxs("div", _objectSpread(_objectSpread({}, classLicenses('cta-wrapper')), {}, {
|
|
35
|
-
children: [_jsxs("ul", _objectSpread(_objectSpread({}, classLicenses('list')), {}, {
|
|
36
|
-
children: [title && _jsx("li", _objectSpread(_objectSpread({}, classLicenses('item')), {}, {
|
|
37
|
-
children: "".concat(messages.title, ": ").concat(title)
|
|
38
|
-
})), authors === null || authors === void 0 ? void 0 : authors.map(function (author) {
|
|
39
|
-
return _jsx("li", _objectSpread(_objectSpread({}, classLicenses('item')), {}, {
|
|
40
|
-
children: "".concat(author.type, ": ").concat(author.name)
|
|
41
|
-
}), uuid());
|
|
42
|
-
}), origin && _jsxs("li", _objectSpread(_objectSpread({}, classLicenses('item')), {}, {
|
|
43
|
-
children: [messages.source, ":", ' ', origin.startsWith('http') ? _jsx("a", {
|
|
44
|
-
href: origin,
|
|
45
|
-
target: "_blank",
|
|
46
|
-
rel: "noopener noreferrer",
|
|
47
|
-
children: origin
|
|
48
|
-
}) : origin]
|
|
49
|
-
}))]
|
|
50
|
-
})), _jsx("div", _objectSpread(_objectSpread({}, classLicenses('cta-block')), {}, {
|
|
51
|
-
children: children
|
|
52
|
-
}))]
|
|
53
|
-
}));
|
|
54
|
-
};
|
|
55
|
-
export var FigureLicenseByline = function FigureLicenseByline(_ref2) {
|
|
56
|
-
var messages = _ref2.messages,
|
|
57
|
-
license = _ref2.license,
|
|
58
|
-
locale = _ref2.locale;
|
|
59
|
-
return _jsxs(_Fragment, {
|
|
60
|
-
children: [_jsx(LicenseDescription, {
|
|
61
|
-
highlightCC: true,
|
|
62
|
-
locale: locale,
|
|
63
|
-
messages: messages,
|
|
64
|
-
licenseRights: license.rights
|
|
65
|
-
}, "byline"), _jsx("a", _objectSpread(_objectSpread({}, classLicenses('link')), {}, {
|
|
66
|
-
target: "_blank",
|
|
67
|
-
rel: "noopener noreferrer",
|
|
68
|
-
href: license.url,
|
|
69
|
-
children: license.linkText
|
|
70
|
-
}), "link")]
|
|
71
|
-
});
|
|
72
|
-
};
|