@ndla/ui 45.0.6 → 45.0.8
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/README.md +1 -1
- package/es/CampaignBlock/CampaignBlock.js +7 -7
- package/es/Gloss/Gloss.js +9 -9
- package/es/LicenseByline/EmbedByline.js +8 -8
- package/es/MediaList/MediaList.js +32 -14
- package/es/Search/SearchResultSleeve.js +15 -24
- package/es/locale/messages-en.js +1 -0
- package/es/locale/messages-nb.js +1 -0
- package/es/locale/messages-nn.js +1 -0
- package/es/locale/messages-se.js +1 -0
- package/es/locale/messages-sma.js +1 -0
- package/lib/CampaignBlock/CampaignBlock.js +7 -7
- package/lib/Gloss/Gloss.d.ts +1 -1
- package/lib/Gloss/Gloss.js +9 -9
- package/lib/LicenseByline/EmbedByline.d.ts +5 -5
- package/lib/LicenseByline/EmbedByline.js +8 -8
- package/lib/MediaList/MediaList.d.ts +12 -5
- package/lib/MediaList/MediaList.js +31 -14
- package/lib/MediaList/index.d.ts +1 -0
- package/lib/Search/SearchResultSleeve.js +15 -24
- package/lib/index.d.ts +1 -0
- package/lib/locale/messages-en.d.ts +1 -0
- package/lib/locale/messages-en.js +1 -0
- package/lib/locale/messages-nb.d.ts +1 -0
- package/lib/locale/messages-nb.js +1 -0
- package/lib/locale/messages-nn.d.ts +1 -0
- package/lib/locale/messages-nn.js +1 -0
- package/lib/locale/messages-se.d.ts +1 -0
- package/lib/locale/messages-se.js +1 -0
- package/lib/locale/messages-sma.d.ts +1 -0
- package/lib/locale/messages-sma.js +1 -0
- package/package.json +4 -4
- package/src/CampaignBlock/CampaignBlock.tsx +1 -1
- package/src/Gloss/Gloss.tsx +2 -2
- package/src/LicenseByline/EmbedByline.tsx +7 -7
- package/src/MediaList/MediaList.tsx +38 -8
- package/src/MediaList/index.ts +2 -0
- package/src/Search/SearchResultSleeve.tsx +9 -20
- package/src/index.ts +2 -0
- package/src/locale/messages-en.ts +1 -0
- package/src/locale/messages-nb.ts +1 -0
- package/src/locale/messages-nn.ts +1 -0
- package/src/locale/messages-se.ts +1 -0
- package/src/locale/messages-sma.ts +1 -0
package/lib/index.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ export { default as ResourceGroup } from './ResourceGroup';
|
|
|
68
68
|
export { default as LayoutItem, OneColumn, PageContainer, Content } from './Layout';
|
|
69
69
|
export { FilmSlideshow, MovieGrid, AboutNdlaFilm, FilmMovieSearch, FilmMovieList, AllMoviesAlphabetically, } from './NDLAFilm';
|
|
70
70
|
export { MediaList, MediaListItem, MediaListItemBody, MediaListItemActions, MediaListItemImage, MediaListItemMeta, } from './MediaList';
|
|
71
|
+
export type { ItemType } from './MediaList';
|
|
71
72
|
export { default as ContentTypeBadge, SubjectMaterialBadge, TasksAndActivitiesBadge, AssessmentResourcesBadge, LearningPathBadge, SubjectBadge, ExternalLearningResourcesBadge, SourceMaterialBadge, } from './ContentTypeBadge';
|
|
72
73
|
export { SubjectChildContent, SubjectContent, SubjectFlexWrapper, SubjectHeader, SubjectNewContent, SubjectSecondaryContent, SubjectSectionTitle, SubjectSidebarWrapper, SubjectSocialContent, SubjectSocialSection, SubjectTopics, SubjectBanner, } from './Subject';
|
|
73
74
|
export { default as CopyParagraphButton, CopyParagraphButtonV2 } from './CopyParagraphButton';
|
|
@@ -601,6 +601,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
601
601
|
title: 'Title',
|
|
602
602
|
originator: 'Originator',
|
|
603
603
|
rightsholder: 'Rightsholder',
|
|
604
|
+
processed: 'The content has been processed',
|
|
604
605
|
source: 'Source',
|
|
605
606
|
published: 'Published',
|
|
606
607
|
info: 'License information'
|
|
@@ -599,6 +599,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
599
599
|
title: 'Tittel',
|
|
600
600
|
originator: 'Opphaver',
|
|
601
601
|
published: 'Publiseringsdato',
|
|
602
|
+
processed: 'Innholdet har blitt bearbeidet',
|
|
602
603
|
rightsholder: 'Rettighetshaver',
|
|
603
604
|
source: 'Kilde',
|
|
604
605
|
info: 'Lisensinformasjon'
|
|
@@ -599,6 +599,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
599
599
|
title: 'Tihttel',
|
|
600
600
|
originator: 'Ásaheaddji',
|
|
601
601
|
published: 'Almmuhanbeaivi',
|
|
602
|
+
processed: 'Sisdoallu lea rievdaduvvon.',
|
|
602
603
|
rightsholder: 'Vuoigatvuođaguoddi',
|
|
603
604
|
source: 'Gáldu',
|
|
604
605
|
info: 'Lisensinformasjon'
|
|
@@ -599,6 +599,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
599
599
|
title: 'Tihtele',
|
|
600
600
|
originator: 'Opphaver',
|
|
601
601
|
published: 'Publiseringsdato',
|
|
602
|
+
processed: 'Innhaldet har vorte omarbeidd',
|
|
602
603
|
rightsholder: 'Rettighetshaver',
|
|
603
604
|
source: 'Gaaltije',
|
|
604
605
|
info: 'Lisensinformasjon'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "45.0.
|
|
3
|
+
"version": "45.0.8",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"@ndla/forms": "^4.3.23",
|
|
41
41
|
"@ndla/hooks": "^2.1.0",
|
|
42
42
|
"@ndla/icons": "^4.0.6",
|
|
43
|
-
"@ndla/licenses": "^7.1.
|
|
43
|
+
"@ndla/licenses": "^7.1.4",
|
|
44
44
|
"@ndla/modal": "^4.0.7",
|
|
45
|
-
"@ndla/notion": "^5.0.
|
|
45
|
+
"@ndla/notion": "^5.0.24",
|
|
46
46
|
"@ndla/safelink": "^4.1.21",
|
|
47
47
|
"@ndla/select": "^2.4.12",
|
|
48
48
|
"@ndla/switch": "^1.1.12",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "4fcf1c6c35e6612269adbe3878fd773d7fdd9cd2"
|
|
87
87
|
}
|
|
@@ -97,7 +97,7 @@ const CampaignBlock = ({
|
|
|
97
97
|
const href = usePossiblyRelativeUrl(url.url, path);
|
|
98
98
|
return (
|
|
99
99
|
<Container className={className} data-type="campaign-block" data-image-side={imageSide}>
|
|
100
|
-
{image && <StyledImg src={image.src} height={200} width={240} alt=
|
|
100
|
+
{image && <StyledImg src={image.src} height={200} width={240} alt={image.src} />}
|
|
101
101
|
<TextWrapper>
|
|
102
102
|
<Heading css={headingStyle}>{title.title}</Heading>
|
|
103
103
|
<StyledDescription>{description.text}</StyledDescription>
|
package/src/Gloss/Gloss.tsx
CHANGED
|
@@ -31,7 +31,7 @@ export interface Props {
|
|
|
31
31
|
transcriptions: Transcription;
|
|
32
32
|
examples?: Example[][];
|
|
33
33
|
};
|
|
34
|
-
audio
|
|
34
|
+
audio?: {
|
|
35
35
|
title: string;
|
|
36
36
|
src?: string;
|
|
37
37
|
};
|
|
@@ -124,7 +124,7 @@ const Gloss = ({ title, glossData, audio }: Props) => {
|
|
|
124
124
|
<TypeSpan aria-label={t('gloss.wordClass')}>{t(`wordClass.${glossData.wordClass}`)}</TypeSpan>
|
|
125
125
|
)}
|
|
126
126
|
</GlossContainer>
|
|
127
|
-
{audio
|
|
127
|
+
{audio?.src && <SpeechControl src={audio.src} title={audio.title}></SpeechControl>}
|
|
128
128
|
</Wrapper>
|
|
129
129
|
<span>{title.title}</span>
|
|
130
130
|
</Container>
|
|
@@ -39,27 +39,27 @@ export interface EmbedBylineErrorProps extends BaseProps {
|
|
|
39
39
|
|
|
40
40
|
interface ImageProps extends BaseProps {
|
|
41
41
|
type: 'image';
|
|
42
|
-
copyright: ImageCopyright;
|
|
42
|
+
copyright: ImageCopyright | undefined;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
interface BrightcoveProps extends BaseProps {
|
|
46
46
|
type: 'video';
|
|
47
|
-
copyright: BrightcoveCopyright;
|
|
47
|
+
copyright: BrightcoveCopyright | undefined;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
interface AudioProps extends BaseProps {
|
|
51
51
|
type: 'audio';
|
|
52
|
-
copyright: AudioCopyright;
|
|
52
|
+
copyright: AudioCopyright | undefined;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
interface PodcastProps extends BaseProps {
|
|
56
56
|
type: 'podcast';
|
|
57
|
-
copyright: AudioCopyright;
|
|
57
|
+
copyright: AudioCopyright | undefined;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
interface ConceptProps extends BaseProps {
|
|
61
61
|
type: 'concept';
|
|
62
|
-
copyright: ConceptCopyright;
|
|
62
|
+
copyright: ConceptCopyright | undefined;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export type EmbedBylineTypeProps = ImageProps | BrightcoveProps | AudioProps | PodcastProps | ConceptProps;
|
|
@@ -158,7 +158,7 @@ const EmbedByline = ({
|
|
|
158
158
|
|
|
159
159
|
const { copyright } = props;
|
|
160
160
|
|
|
161
|
-
const license = getLicenseByAbbreviation(copyright.license?.license ?? '', i18n.language);
|
|
161
|
+
const license = copyright ? getLicenseByAbbreviation(copyright.license?.license ?? '', i18n.language) : undefined;
|
|
162
162
|
const authors = getLicenseCredits(copyright);
|
|
163
163
|
const captionAuthors = Object.values(authors).find((i) => i.length > 0) ?? [];
|
|
164
164
|
|
|
@@ -167,7 +167,7 @@ const EmbedByline = ({
|
|
|
167
167
|
{!!strippedDescription?.length && description && <LicenseDescription description={description} />}
|
|
168
168
|
{visibleAlt ? <StyledSpan>{`Alt: ${visibleAlt}`}</StyledSpan> : null}
|
|
169
169
|
<RightsWrapper data-grid={inGrid}>
|
|
170
|
-
<LicenseLink license={license} asLink={!!license.url.length} />
|
|
170
|
+
{license ? <LicenseLink license={license} asLink={!!license.url.length} /> : null}
|
|
171
171
|
<LicenseInformationWrapper>
|
|
172
172
|
<span>
|
|
173
173
|
<b>{t(`embed.type.${type}`)}: </b>
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
isCreativeCommonsLicense,
|
|
14
14
|
metaTypes,
|
|
15
15
|
} from '@ndla/licenses';
|
|
16
|
+
import type { MetaType } from '@ndla/licenses';
|
|
16
17
|
import { LicenseDescription } from '@ndla/notion';
|
|
17
18
|
import BEMHelper from 'react-bem-helper';
|
|
18
19
|
import { uuid } from '@ndla/util';
|
|
@@ -182,25 +183,54 @@ export const HandleLink = ({ text, children }: HandleLinkProps) => {
|
|
|
182
183
|
|
|
183
184
|
const attributionTypes = [metaTypes.author, metaTypes.copyrightHolder, metaTypes.contributor];
|
|
184
185
|
|
|
186
|
+
export type ItemType = ItemTypeWithDescription | DescriptionLessItemType;
|
|
187
|
+
|
|
188
|
+
interface ItemTypeWithDescription {
|
|
189
|
+
label: string;
|
|
190
|
+
description: string;
|
|
191
|
+
metaType: Omit<MetaType, 'otherWithoutDescription'>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface DescriptionLessItemType {
|
|
195
|
+
label: string;
|
|
196
|
+
metaType: 'otherWithoutDescription';
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function isOtherWithoutDescription(item: ItemType): item is DescriptionLessItemType {
|
|
200
|
+
return item.metaType === metaTypes.otherWithoutDescription;
|
|
201
|
+
}
|
|
202
|
+
|
|
185
203
|
interface MediaListItemMetaProps {
|
|
186
|
-
items?:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
204
|
+
items?: ItemType[];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const ItemText = ({ item }: { item: ItemType }) => {
|
|
208
|
+
if (isOtherWithoutDescription(item)) {
|
|
209
|
+
return <>{item.label}</>;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<>
|
|
214
|
+
{item.label}: <HandleLink text={item.description}>{item.description}</HandleLink>
|
|
215
|
+
</>
|
|
216
|
+
);
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
function isAttributionItem(item: ItemType): item is ItemTypeWithDescription {
|
|
220
|
+
if (isOtherWithoutDescription(item)) return false;
|
|
221
|
+
return attributionTypes.some((type) => type === item.metaType);
|
|
191
222
|
}
|
|
192
223
|
|
|
193
224
|
export const MediaListItemMeta = ({ items = [] }: MediaListItemMetaProps) => {
|
|
194
|
-
const attributionItems = items.filter(
|
|
225
|
+
const attributionItems = items.filter(isAttributionItem);
|
|
195
226
|
const attributionMeta = attributionItems.map((item) => `${item.label}: ${item.description}`).join(', ');
|
|
196
227
|
|
|
197
228
|
return (
|
|
198
|
-
//@ts-ignore
|
|
199
229
|
// eslint-disable-next-line react/no-unknown-property
|
|
200
230
|
<ul {...cClasses('actions')} property="cc:attributionName" content={attributionMeta}>
|
|
201
231
|
{items.map((item) => (
|
|
202
232
|
<li key={uuid()} className="c-medialist__meta-item">
|
|
203
|
-
|
|
233
|
+
<ItemText item={item} />
|
|
204
234
|
</li>
|
|
205
235
|
))}
|
|
206
236
|
</ul>
|
package/src/MediaList/index.ts
CHANGED
|
@@ -253,28 +253,17 @@ const SearchResultSleeve = ({
|
|
|
253
253
|
return findPathForKeyboardNavigation(contentRef.current, prevKeyPath, -1);
|
|
254
254
|
});
|
|
255
255
|
} else if (e.code === 'Enter') {
|
|
256
|
-
e.stopPropagation();
|
|
257
|
-
e.preventDefault();
|
|
258
256
|
if (keyboardPathNavigation === GO_TO_SUGGESTION) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
anchorTag.click();
|
|
268
|
-
}
|
|
269
|
-
} else {
|
|
270
|
-
if (keyboardPathNavigation instanceof HTMLElement) {
|
|
271
|
-
const toClick =
|
|
272
|
-
keyboardPathNavigation &&
|
|
273
|
-
keyboardPathNavigation.querySelector &&
|
|
274
|
-
(keyboardPathNavigation.querySelector('a') || keyboardPathNavigation.querySelector('button'));
|
|
257
|
+
searchSuggestionRef?.current?.closest('a')?.click();
|
|
258
|
+
} else if (keyboardPathNavigation instanceof HTMLElement) {
|
|
259
|
+
e.stopPropagation();
|
|
260
|
+
e.preventDefault();
|
|
261
|
+
const toClick =
|
|
262
|
+
keyboardPathNavigation &&
|
|
263
|
+
keyboardPathNavigation.querySelector &&
|
|
264
|
+
(keyboardPathNavigation.querySelector('a') || keyboardPathNavigation.querySelector('button'));
|
|
275
265
|
|
|
276
|
-
|
|
277
|
-
}
|
|
266
|
+
toClick && toClick.click();
|
|
278
267
|
}
|
|
279
268
|
} else if (e.code === 'Tab') {
|
|
280
269
|
setKeyNavigation('');
|
package/src/index.ts
CHANGED