@ndla/ui 45.0.6 → 45.0.7
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/LicenseByline/EmbedByline.js +8 -8
- package/es/Search/SearchResultSleeve.js +15 -24
- package/lib/CampaignBlock/CampaignBlock.js +7 -7
- package/lib/LicenseByline/EmbedByline.d.ts +5 -5
- package/lib/LicenseByline/EmbedByline.js +8 -8
- package/lib/Search/SearchResultSleeve.js +15 -24
- package/package.json +2 -2
- package/src/CampaignBlock/CampaignBlock.tsx +1 -1
- package/src/LicenseByline/EmbedByline.tsx +7 -7
- package/src/Search/SearchResultSleeve.tsx +9 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "45.0.
|
|
3
|
+
"version": "45.0.7",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "5d97f47146fd65e33858db400db6d3b408503237"
|
|
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>
|
|
@@ -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>
|
|
@@ -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('');
|