@ndla/ui 33.0.9 → 33.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "33.0.9",
3
+ "version": "33.1.0",
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": "^6.1.2",
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.3",
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.1",
41
+ "@ndla/licenses": "^6.1.2",
42
42
  "@ndla/modal": "^2.2.1",
43
- "@ndla/notion": "^4.1.4",
44
- "@ndla/safelink": "^3.1.3",
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": "^3.1.1",
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": "6271acfff097c6476a717ea8a55994adbbccd79a"
86
+ "gitHead": "f8d526fe0c85850c50c0f79d4ed402783bfa1bf9"
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';
@@ -28,6 +28,7 @@ const ArticleContent = ({ content, locale, ...rest }: Props) => {
28
28
  initAudioPlayers(locale);
29
29
  initCopyParagraphButtons();
30
30
  initTooltips();
31
+ initPopovers();
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} alignRight size="small">
56
+ <StyledMenuButton menuItems={actionItems} align="end" size="small">
57
57
  <StyledSpan title={item.name}>{item.name}</StyledSpan>
58
58
  </StyledMenuButton>
59
59
  );
@@ -19,6 +19,7 @@ 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={true} />, el);
23
24
  });
24
25
  };
@@ -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, useEffect, useRef } from 'react';
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 alignRight size="small" menuItems={menuItems} />}
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 alignRight size="small" menuItems={menuItems} />}
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 alignRight size="small" menuItems={menuItems} />}
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
- alignRight
172
+ align="end"
173
173
  aria-label={t('myNdla.moreTags', { count: remainingTags.length })}
174
174
  />
175
175
  )}
package/src/all.scss CHANGED
@@ -4,5 +4,3 @@
4
4
  @import '~@ndla/tabs/scss/tabs';
5
5
  @import '~@ndla/core/scss/utilities';
6
6
  @import '~@ndla/video-search/scss/video-search';
7
- @import '~@ndla/button/src/all.scss';
8
- @import '~@ndla/tooltip/src/all.css';