@ndla/ui 33.0.9 → 33.1.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.
- package/es/Article/ArticleContent.js +3 -2
- package/es/BlogPosts/BlogPost.js +5 -5
- package/es/Breadcrumb/ActionBreadcrumb.js +5 -5
- package/es/Masthead/Masthead.js +7 -25
- package/es/MyNdla/Resource/Folder.js +12 -12
- package/es/Resource/BlockResource.js +7 -7
- package/es/Resource/ListResource.js +7 -7
- package/es/Resource/resourceComponents.js +12 -12
- package/es/all.css +0 -90
- package/lib/Article/ArticleContent.js +2 -1
- package/lib/BlogPosts/BlogPost.js +5 -5
- package/lib/Breadcrumb/ActionBreadcrumb.js +5 -5
- package/lib/Masthead/Masthead.js +7 -28
- package/lib/MyNdla/Resource/Folder.js +12 -12
- package/lib/Resource/BlockResource.js +7 -7
- package/lib/Resource/ListResource.js +7 -7
- package/lib/Resource/resourceComponents.js +12 -12
- package/lib/all.css +0 -90
- package/package.json +8 -8
- package/src/Article/ArticleContent.tsx +3 -2
- package/src/BlogPosts/BlogPost.tsx +0 -5
- package/src/Breadcrumb/ActionBreadcrumb.tsx +1 -1
- package/src/CopyParagraphButton/initCopyParagraphButtons.tsx +2 -1
- package/src/Masthead/Masthead.tsx +1 -21
- package/src/MyNdla/Resource/Folder.tsx +1 -1
- package/src/Resource/BlockResource.tsx +1 -1
- package/src/Resource/ListResource.tsx +1 -1
- package/src/Resource/resourceComponents.tsx +1 -1
- package/src/all.scss +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "33.
|
|
3
|
+
"version": "33.1.1",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -32,19 +32,19 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@ndla/article-scripts": "^3.0.12",
|
|
35
|
-
"@ndla/button": "^
|
|
35
|
+
"@ndla/button": "^7.0.0",
|
|
36
36
|
"@ndla/carousel": "^2.1.0",
|
|
37
37
|
"@ndla/core": "^3.0.3",
|
|
38
|
-
"@ndla/forms": "^4.1.
|
|
38
|
+
"@ndla/forms": "^4.1.4",
|
|
39
39
|
"@ndla/hooks": "^1.2.0",
|
|
40
40
|
"@ndla/icons": "^2.1.0",
|
|
41
|
-
"@ndla/licenses": "^6.1.
|
|
41
|
+
"@ndla/licenses": "^6.1.2",
|
|
42
42
|
"@ndla/modal": "^2.2.1",
|
|
43
|
-
"@ndla/notion": "^4.1.
|
|
44
|
-
"@ndla/safelink": "^3.1.
|
|
43
|
+
"@ndla/notion": "^4.1.5",
|
|
44
|
+
"@ndla/safelink": "^3.1.4",
|
|
45
45
|
"@ndla/switch": "^1.0.3",
|
|
46
46
|
"@ndla/tabs": "^2.1.0",
|
|
47
|
-
"@ndla/tooltip": "^
|
|
47
|
+
"@ndla/tooltip": "^4.0.0",
|
|
48
48
|
"@ndla/types-learningpath-api": "^0.0.17",
|
|
49
49
|
"@ndla/util": "^3.1.9",
|
|
50
50
|
"@reach/menu-button": "^0.16.2",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "1acfb1f32a8076e654c2b6665dccb12eb7e7539f"
|
|
87
87
|
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
removeEventListenerForResize,
|
|
13
13
|
// @ts-ignore
|
|
14
14
|
} from '@ndla/article-scripts';
|
|
15
|
-
import { initTooltips } from '@ndla/tooltip';
|
|
15
|
+
import { initPopovers, initTooltips } from '@ndla/tooltip';
|
|
16
16
|
import { initAudioPlayers } from '../AudioPlayer';
|
|
17
17
|
import { initCopyParagraphButtons } from '../CopyParagraphButton';
|
|
18
18
|
import { Locale } from '../types';
|
|
@@ -26,8 +26,9 @@ const ArticleContent = ({ content, locale, ...rest }: Props) => {
|
|
|
26
26
|
removeEventListenerForResize();
|
|
27
27
|
initArticleScripts();
|
|
28
28
|
initAudioPlayers(locale);
|
|
29
|
-
initCopyParagraphButtons();
|
|
30
29
|
initTooltips();
|
|
30
|
+
initPopovers();
|
|
31
|
+
initCopyParagraphButtons();
|
|
31
32
|
return () => {
|
|
32
33
|
removeEventListenerForResize();
|
|
33
34
|
};
|
|
@@ -32,11 +32,6 @@ const StyledLicense = styled.span<StyledLicenseProps>`
|
|
|
32
32
|
border-radius: ${spacing.normal};
|
|
33
33
|
li {
|
|
34
34
|
padding-bottom: 0 !important;
|
|
35
|
-
svg {
|
|
36
|
-
width: 18px;
|
|
37
|
-
height: 18px;
|
|
38
|
-
min-width: 18px;
|
|
39
|
-
}
|
|
40
35
|
&:last-child {
|
|
41
36
|
padding-right: ${spacing.xsmall};
|
|
42
37
|
}
|
|
@@ -53,7 +53,7 @@ const ActionBreadcrumb = ({ items, actionItems }: Props) => {
|
|
|
53
53
|
}
|
|
54
54
|
if (item.index === totalCount - 1 && actionItems.length > 0) {
|
|
55
55
|
return (
|
|
56
|
-
<StyledMenuButton menuItems={actionItems}
|
|
56
|
+
<StyledMenuButton menuItems={actionItems} align="end" size="small">
|
|
57
57
|
<StyledSpan title={item.name}>{item.name}</StyledSpan>
|
|
58
58
|
</StyledMenuButton>
|
|
59
59
|
);
|
|
@@ -19,7 +19,8 @@ const forEachElement = (selector: string, callback: Function) => {
|
|
|
19
19
|
const initCopyParagraphButtons = () => {
|
|
20
20
|
forEachElement('[data-header-copy-container]', (el: HTMLElement) => {
|
|
21
21
|
const title = el.getAttribute('data-title');
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
ReactDOM.hydrate(<CopyParagraphButton title={title} content={title} hydrate />, el);
|
|
23
24
|
});
|
|
24
25
|
};
|
|
25
26
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { css } from '@emotion/react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
|
|
12
|
-
import React, { ReactNode
|
|
12
|
+
import React, { ReactNode } from 'react';
|
|
13
13
|
import { MessageBanner } from '../Messages';
|
|
14
14
|
import SkipToMainContent from './SkipToMainContent';
|
|
15
15
|
|
|
@@ -117,26 +117,6 @@ interface Props {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
export const Masthead = ({ children, fixed, ndlaFilm, skipToMainContentId, messages, onCloseAlert }: Props) => {
|
|
120
|
-
const mastheadRef = useRef<HTMLDivElement>(null);
|
|
121
|
-
const focusHandler = (evt: FocusEvent) => {
|
|
122
|
-
const mastheadHeight = (mastheadRef.current && mastheadRef.current.offsetHeight) || 0;
|
|
123
|
-
const { target } = evt;
|
|
124
|
-
const rect = (target as HTMLElement).getBoundingClientRect();
|
|
125
|
-
// Focused target is hidden behind Masthead
|
|
126
|
-
if (rect.y < mastheadHeight) {
|
|
127
|
-
window.scrollTo(window.scrollX, window.scrollY - (mastheadHeight + 10));
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
useEffect(() => {
|
|
132
|
-
if (fixed) {
|
|
133
|
-
document.addEventListener('focusin', focusHandler);
|
|
134
|
-
return () => {
|
|
135
|
-
document.removeEventListener('focusin', focusHandler);
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
}, [fixed]);
|
|
139
|
-
|
|
140
120
|
return (
|
|
141
121
|
<>
|
|
142
122
|
{skipToMainContentId && <SkipToMainContent skipToMainContentId={skipToMainContentId} />}
|
|
@@ -193,7 +193,7 @@ const Folder = ({ id, link, title, subFolders, subResources, type = 'list', menu
|
|
|
193
193
|
<Count layoutType={type} type={'folder'} count={subFolders} />
|
|
194
194
|
<Count layoutType={type} type={'resource'} count={subResources} />
|
|
195
195
|
</CountContainer>
|
|
196
|
-
{menuItems && menuItems.length > 0 && <MenuButton
|
|
196
|
+
{menuItems && menuItems.length > 0 && <MenuButton align="end" size="small" menuItems={menuItems} />}
|
|
197
197
|
</MenuWrapper>
|
|
198
198
|
</FolderWrapper>
|
|
199
199
|
);
|
|
@@ -193,7 +193,7 @@ const BlockResource = ({
|
|
|
193
193
|
</ContentWrapper>
|
|
194
194
|
<RightRow>
|
|
195
195
|
{tags && tags.length > 0 && <CompressedTagList tagLinkPrefix={tagLinkPrefix} tags={tags} />}
|
|
196
|
-
{menuItems && menuItems.length > 0 && <MenuButton
|
|
196
|
+
{menuItems && menuItems.length > 0 && <MenuButton align="end" size="small" menuItems={menuItems} />}
|
|
197
197
|
</RightRow>
|
|
198
198
|
</BlockInfoWrapper>
|
|
199
199
|
</BlockElementWrapper>
|
|
@@ -247,7 +247,7 @@ const ListResource = ({
|
|
|
247
247
|
{showDescription && <Description description={description} loading={isLoading} />}
|
|
248
248
|
<TagsandActionMenu hasMenuButton={!!(tags && tags.length > 3) || !!(menuItems && menuItems.length)}>
|
|
249
249
|
{tags && tags.length > 0 && <CompressedTagList tagLinkPrefix={tagLinkPrefix} tags={tags} />}
|
|
250
|
-
{menuItems && menuItems.length > 0 && <MenuButton
|
|
250
|
+
{menuItems && menuItems.length > 0 && <MenuButton align="end" size="small" menuItems={menuItems} />}
|
|
251
251
|
</TagsandActionMenu>
|
|
252
252
|
</ListResourceWrapper>
|
|
253
253
|
);
|
|
@@ -169,7 +169,7 @@ export const CompressedTagList = ({ tags, tagLinkPrefix }: CompressedTagListProp
|
|
|
169
169
|
size="small"
|
|
170
170
|
menuIcon={<TagCounterWrapper>{`+${remainingTags.length}`}</TagCounterWrapper>}
|
|
171
171
|
menuItems={remainingTags}
|
|
172
|
-
|
|
172
|
+
align="end"
|
|
173
173
|
aria-label={t('myNdla.moreTags', { count: remainingTags.length })}
|
|
174
174
|
/>
|
|
175
175
|
)}
|