@ndla/ui 3.2.6 → 3.3.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.
@@ -335,7 +335,7 @@ var messages = _objectSpread(_objectSpread({
335
335
  competenceTopicSearchText: 'Find resources',
336
336
  competenceSubjectSearchText: 'Go to topic page',
337
337
  competenceGoalClose: 'Close',
338
- competenceGoalTitle: 'The goal is for the student to be able to:',
338
+ competenceGoalTitle: 'The pupil is expected to be able to:',
339
339
  competenceTabLK06label: 'Competence goal (LK06)',
340
340
  competenceTabLK20label: 'Competence goal (LK20)',
341
341
  competenceTabCorelabel: 'Core element',
@@ -671,18 +671,18 @@ var messages = _objectSpread(_objectSpread({
671
671
  },
672
672
  blogPosts: {
673
673
  blog1: {
674
- text: 'Hva skjer med fagfornyelsen på NDLA?',
675
- externalLink: 'https://blogg.ndla.no/2019/11/hva-skjer-med-fagfornyelsen-pa-ndla/',
674
+ text: 'Nye fag på NDLA',
675
+ externalLink: 'https://blogg.ndla.no/2021/12/nye-fag-pa-ndla/',
676
676
  linkText: 'Fagblogg',
677
- license: 'CC-BY-NC-SA-4.0',
678
- licenseAuthor: 'Scanpix.no'
677
+ license: 'CC-BY-SA-4.0',
678
+ licenseAuthor: 'Vibeke Klungland'
679
679
  },
680
680
  blog2: {
681
681
  text: 'Aktiviser elevane med digitale verktøy',
682
682
  externalLink: 'https://blogg.ndla.no/2021/09/aktiviser-elevane-med-digitale-verktoy/',
683
683
  linkText: 'Fagblogg',
684
- license: 'CC-BY-NC-SA-4.0',
685
- licenseAuthor: 'Scanpix.no'
684
+ license: 'CC-BY-SA-4.0',
685
+ licenseAuthor: 'Tom Knudsen'
686
686
  }
687
687
  },
688
688
  editor: {
@@ -671,18 +671,18 @@ var messages = _objectSpread(_objectSpread({
671
671
  },
672
672
  blogPosts: {
673
673
  blog1: {
674
- text: 'Hva skjer med fagfornyelsen på NDLA?',
675
- externalLink: 'https://blogg.ndla.no/2019/11/hva-skjer-med-fagfornyelsen-pa-ndla/',
674
+ text: 'Nye fag på NDLA',
675
+ externalLink: 'https://blogg.ndla.no/2021/12/nye-fag-pa-ndla/',
676
676
  linkText: 'Fagblogg',
677
- license: 'CC-BY-NC-SA-4.0',
678
- licenseAuthor: 'Scanpix.no'
677
+ license: 'CC-BY-SA-4.0',
678
+ licenseAuthor: 'Vibeke Klungland'
679
679
  },
680
680
  blog2: {
681
681
  text: 'Aktiviser elevene med digitale verktøy',
682
682
  externalLink: 'https://blogg.ndla.no/2021/09/aktiviser-elevane-med-digitale-verktoy/',
683
683
  linkText: 'Fagblogg',
684
- license: 'CC-BY-NC-SA-4.0',
685
- licenseAuthor: 'Scanpix.no'
684
+ license: 'CC-BY-SA-4.0',
685
+ licenseAuthor: 'Tom Knudsen'
686
686
  }
687
687
  },
688
688
  editor: {
@@ -335,7 +335,7 @@ var messages = _objectSpread(_objectSpread({
335
335
  competenceTopicSearchText: 'Søk ressursar for tema',
336
336
  competenceSubjectSearchText: 'Gå til fagsiden',
337
337
  competenceGoalClose: 'Lukk',
338
- competenceGoalTitle: 'Målet er at eleven skal kunna:',
338
+ competenceGoalTitle: 'Målet er at eleven skal kunne:',
339
339
  competenceTabLK06label: 'Kompetansemål (LK06)',
340
340
  competenceTabLK20label: 'Kompetansemål (LK20)',
341
341
  competenceTabCorelabel: 'Kjerneelement',
@@ -671,18 +671,18 @@ var messages = _objectSpread(_objectSpread({
671
671
  },
672
672
  blogPosts: {
673
673
  blog1: {
674
- text: 'Kva skjer med fagfornyinga på NDLA?',
675
- externalLink: 'https://blogg.ndla.no/2019/11/hva-skjer-med-fagfornyelsen-pa-ndla/',
674
+ text: 'Nye fag på NDLA',
675
+ externalLink: 'https://blogg.ndla.no/2021/12/nye-fag-pa-ndla/',
676
676
  linkText: 'Fagblogg',
677
- license: 'CC-BY-NC-SA-4.0',
678
- licenseAuthor: 'Scanpix.no'
677
+ license: 'CC-BY-SA-4.0',
678
+ licenseAuthor: 'Vibeke Klungland'
679
679
  },
680
680
  blog2: {
681
681
  text: 'Aktiviser elevane med digitale verktøy',
682
682
  externalLink: 'https://blogg.ndla.no/2021/09/aktiviser-elevane-med-digitale-verktoy/',
683
683
  linkText: 'Fagblogg',
684
- license: 'CC-BY-NC-SA-4.0',
685
- licenseAuthor: 'Scanpix.no'
684
+ license: 'CC-BY-SA-4.0',
685
+ licenseAuthor: 'Tom Knudsen'
686
686
  }
687
687
  },
688
688
  editor: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "3.2.6",
3
+ "version": "3.3.1",
4
4
  "description": "UI component library for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -34,15 +34,15 @@
34
34
  "@ndla/button": "^1.1.1",
35
35
  "@ndla/carousel": "^1.0.6",
36
36
  "@ndla/core": "^0.7.2",
37
- "@ndla/hooks": "^1.0.6",
37
+ "@ndla/hooks": "^1.0.7",
38
38
  "@ndla/icons": "^1.3.1",
39
- "@ndla/licenses": "^1.0.7",
40
- "@ndla/modal": "^1.1.14",
41
- "@ndla/safelink": "^1.0.5",
39
+ "@ndla/licenses": "^1.0.8",
40
+ "@ndla/modal": "^1.1.15",
41
+ "@ndla/safelink": "^1.0.6",
42
42
  "@ndla/switch": "^0.0.32",
43
- "@ndla/tabs": "^1.0.11",
43
+ "@ndla/tabs": "^1.0.12",
44
44
  "@ndla/tooltip": "^0.2.49",
45
- "@ndla/util": "^2.0.0",
45
+ "@ndla/util": "^2.0.1",
46
46
  "@reach/menu-button": "^0.12.1",
47
47
  "@reach/slider": "^0.12.1",
48
48
  "@types/hoist-non-react-statics": "^3.3.1",
@@ -92,5 +92,5 @@
92
92
  "publishConfig": {
93
93
  "access": "public"
94
94
  },
95
- "gitHead": "92ea83efa493853e12e35826ed69489342676eb1"
95
+ "gitHead": "2ea6dd8341da40057df18969093c0da56db91473"
96
96
  }
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
 
9
- import React, { useEffect, useState } from 'react';
9
+ import React, { ReactNode, useEffect, useState } from 'react';
10
10
 
11
11
  import styled from '@emotion/styled';
12
12
  import { Link } from '@ndla/icons/common';
@@ -47,9 +47,27 @@ const ContainerDiv = styled.div`
47
47
  interface Props {
48
48
  title?: string | null;
49
49
  content?: string | null;
50
+ hydrate?: boolean;
50
51
  }
51
52
 
52
- const CopyParagraphButton = ({ title, content }: Props) => {
53
+ interface WrapperProps {
54
+ title: string;
55
+ hydrate?: boolean;
56
+ children: ReactNode;
57
+ }
58
+
59
+ const WrapperComponent = ({ title, hydrate, children }: WrapperProps) => {
60
+ if (hydrate) {
61
+ return <>{children}</>;
62
+ }
63
+ return (
64
+ <ContainerDiv data-header-copy-container data-title={title}>
65
+ {children}
66
+ </ContainerDiv>
67
+ );
68
+ };
69
+
70
+ const CopyParagraphButton = ({ title, content, hydrate }: Props) => {
53
71
  const { t } = useTranslation();
54
72
  const [hasCopied, setHasCopied] = useState(false);
55
73
  useEffect(() => {
@@ -73,15 +91,16 @@ const CopyParagraphButton = ({ title, content }: Props) => {
73
91
 
74
92
  const sanitizedTitle = encodeURIComponent(title.replace(/ /g, '-'));
75
93
  const tooltip = hasCopied ? t('article.copyPageLinkCopied') : t('article.copyHeaderLink');
94
+
76
95
  return (
77
- <ContainerDiv data-header-copy-container data-title={title}>
96
+ <WrapperComponent hydrate={hydrate} title={title}>
78
97
  <IconButton onClick={onCopyClick} data-title={sanitizedTitle}>
79
98
  <Tooltip tooltip={tooltip}>
80
99
  <Link title={''} />
81
100
  </Tooltip>
82
101
  </IconButton>
83
102
  <h2 id={sanitizedTitle} tabIndex={0} dangerouslySetInnerHTML={{ __html: content || '' }}></h2>
84
- </ContainerDiv>
103
+ </WrapperComponent>
85
104
  );
86
105
  };
87
106
 
@@ -19,8 +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
- const content = el.innerHTML;
23
- ReactDOM.hydrate(<CopyParagraphButton title={title} content={content} />, el);
22
+ ReactDOM.hydrate(<CopyParagraphButton title={title} content={title} hydrate={true} />, el);
24
23
  });
25
24
  };
26
25
 
@@ -132,10 +132,20 @@ const isFunction = (children: Function | ReactNode): children is Function => {
132
132
  return isFunctionHelper(children);
133
133
  };
134
134
 
135
+ export type FigureType =
136
+ | 'full'
137
+ | 'full-column'
138
+ | 'left'
139
+ | 'small-left'
140
+ | 'right'
141
+ | 'small-right'
142
+ | 'xsmall-right'
143
+ | 'xsmall-left';
144
+
135
145
  interface Props {
136
146
  id?: string;
137
147
  children: ReactNode | ((params: { typeClass: string }) => ReactNode);
138
- type?: 'full' | 'full-column' | 'left' | 'small-left' | 'right' | 'small-right' | 'xsmall-right' | 'xsmall-left';
148
+ type?: FigureType;
139
149
  resizeIframe?: boolean;
140
150
  noFigcaption?: boolean;
141
151
  }
@@ -10,7 +10,6 @@ import React from 'react';
10
10
  import { ChevronUp, ChevronDown } from '@ndla/icons/common';
11
11
 
12
12
  interface Props {
13
- children: Element;
14
13
  messages: {
15
14
  expandBylineButtonLabel: string;
16
15
  minimizeBylineButtonLabel: string;
@@ -18,7 +17,7 @@ interface Props {
18
17
  typeClass: string;
19
18
  }
20
19
 
21
- export const FigureBylineExpandButton = ({ children, messages, typeClass }: Props) => {
20
+ export const FigureBylineExpandButton = ({ messages, typeClass }: Props) => {
22
21
  return (
23
22
  <button
24
23
  className="c-figure__show-byline-btn"
@@ -11,3 +11,5 @@ export { Figure, FigureCaption };
11
11
  export { FigureLicenseDialog } from './FigureLicenseDialog';
12
12
  export { FigureExpandButton } from './FigureExpandButton';
13
13
  export { FigureBylineExpandButton } from './FigureBylineExpandButton';
14
+
15
+ export type { FigureType } from './Figure';
@@ -7,7 +7,6 @@
7
7
  */
8
8
 
9
9
  import React, { ReactNode } from 'react';
10
- import defined from 'defined';
11
10
  import styled from '@emotion/styled';
12
11
  import LazyLoadImage from './LazyLoadImage';
13
12
  export interface ImageCrop {
@@ -67,8 +66,8 @@ const Image = ({
67
66
  expandButton,
68
67
  ...rest
69
68
  }: Props) => {
70
- const srcSet = defined(rest.srcSet, getSrcSet(src, crop, focalPoint));
71
- const fallbackWidth = defined(rest.fallbackWidth, 1024);
69
+ const srcSet = rest.srcSet ?? getSrcSet(src, crop, focalPoint);
70
+ const fallbackWidth = rest.fallbackWidth ?? 1024;
72
71
  const queryString = makeSrcQueryString(fallbackWidth, crop, focalPoint);
73
72
 
74
73
  if (contentType && contentType === 'image/gif') {
@@ -6,7 +6,7 @@
6
6
 
7
7
  .c-table {
8
8
  $scrollbar-height: 8px;
9
- margin: 0;
9
+ margin: 0 0 $spacing--medium 0;
10
10
 
11
11
  &::-webkit-scrollbar {
12
12
  height: $scrollbar-height;
@@ -84,22 +84,12 @@
84
84
 
85
85
  &__left-shadow {
86
86
  left: 0;
87
- background: radial-gradient(
88
- ellipse at left,
89
- rgba(0, 0, 0, 0.2) 0%,
90
- rgba(0, 0, 0, 0) 75%
91
- )
92
- 0 center;
87
+ background: radial-gradient(ellipse at left, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0) 75%) 0 center;
93
88
  }
94
89
 
95
90
  &__right-shadow {
96
91
  right: 0;
97
- background: radial-gradient(
98
- ellipse at right,
99
- rgba(0, 0, 0, 0.2) 0%,
100
- rgba(0, 0, 0, 0) 75%
101
- )
102
- 0 center;
92
+ background: radial-gradient(ellipse at right, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0) 75%) 0 center;
103
93
  }
104
94
  }
105
95
 
@@ -359,7 +359,7 @@ const messages = {
359
359
  competenceTopicSearchText: 'Find resources',
360
360
  competenceSubjectSearchText: 'Go to topic page',
361
361
  competenceGoalClose: 'Close',
362
- competenceGoalTitle: 'The goal is for the student to be able to:',
362
+ competenceGoalTitle: 'The pupil is expected to be able to:',
363
363
  competenceTabLK06label: 'Competence goal (LK06)',
364
364
  competenceTabLK20label: 'Competence goal (LK20)',
365
365
  competenceTabCorelabel: 'Core element',
@@ -700,18 +700,18 @@ const messages = {
700
700
  },
701
701
  blogPosts: {
702
702
  blog1: {
703
- text: 'Hva skjer med fagfornyelsen på NDLA?',
704
- externalLink: 'https://blogg.ndla.no/2019/11/hva-skjer-med-fagfornyelsen-pa-ndla/',
703
+ text: 'Nye fag på NDLA',
704
+ externalLink: 'https://blogg.ndla.no/2021/12/nye-fag-pa-ndla/',
705
705
  linkText: 'Fagblogg',
706
- license: 'CC-BY-NC-SA-4.0',
707
- licenseAuthor: 'Scanpix.no',
706
+ license: 'CC-BY-SA-4.0',
707
+ licenseAuthor: 'Vibeke Klungland',
708
708
  },
709
709
  blog2: {
710
710
  text: 'Aktiviser elevane med digitale verktøy',
711
711
  externalLink: 'https://blogg.ndla.no/2021/09/aktiviser-elevane-med-digitale-verktoy/',
712
712
  linkText: 'Fagblogg',
713
- license: 'CC-BY-NC-SA-4.0',
714
- licenseAuthor: 'Scanpix.no',
713
+ license: 'CC-BY-SA-4.0',
714
+ licenseAuthor: 'Tom Knudsen',
715
715
  },
716
716
  },
717
717
  editor: {
@@ -699,18 +699,18 @@ const messages = {
699
699
  },
700
700
  blogPosts: {
701
701
  blog1: {
702
- text: 'Hva skjer med fagfornyelsen på NDLA?',
703
- externalLink: 'https://blogg.ndla.no/2019/11/hva-skjer-med-fagfornyelsen-pa-ndla/',
702
+ text: 'Nye fag på NDLA',
703
+ externalLink: 'https://blogg.ndla.no/2021/12/nye-fag-pa-ndla/',
704
704
  linkText: 'Fagblogg',
705
- license: 'CC-BY-NC-SA-4.0',
706
- licenseAuthor: 'Scanpix.no',
705
+ license: 'CC-BY-SA-4.0',
706
+ licenseAuthor: 'Vibeke Klungland',
707
707
  },
708
708
  blog2: {
709
709
  text: 'Aktiviser elevene med digitale verktøy',
710
710
  externalLink: 'https://blogg.ndla.no/2021/09/aktiviser-elevane-med-digitale-verktoy/',
711
711
  linkText: 'Fagblogg',
712
- license: 'CC-BY-NC-SA-4.0',
713
- licenseAuthor: 'Scanpix.no',
712
+ license: 'CC-BY-SA-4.0',
713
+ licenseAuthor: 'Tom Knudsen',
714
714
  },
715
715
  },
716
716
  editor: {
@@ -359,7 +359,7 @@ const messages = {
359
359
  competenceTopicSearchText: 'Søk ressursar for tema',
360
360
  competenceSubjectSearchText: 'Gå til fagsiden',
361
361
  competenceGoalClose: 'Lukk',
362
- competenceGoalTitle: 'Målet er at eleven skal kunna:',
362
+ competenceGoalTitle: 'Målet er at eleven skal kunne:',
363
363
  competenceTabLK06label: 'Kompetansemål (LK06)',
364
364
  competenceTabLK20label: 'Kompetansemål (LK20)',
365
365
  competenceTabCorelabel: 'Kjerneelement',
@@ -700,18 +700,18 @@ const messages = {
700
700
  },
701
701
  blogPosts: {
702
702
  blog1: {
703
- text: 'Kva skjer med fagfornyinga på NDLA?',
704
- externalLink: 'https://blogg.ndla.no/2019/11/hva-skjer-med-fagfornyelsen-pa-ndla/',
703
+ text: 'Nye fag på NDLA',
704
+ externalLink: 'https://blogg.ndla.no/2021/12/nye-fag-pa-ndla/',
705
705
  linkText: 'Fagblogg',
706
- license: 'CC-BY-NC-SA-4.0',
707
- licenseAuthor: 'Scanpix.no',
706
+ license: 'CC-BY-SA-4.0',
707
+ licenseAuthor: 'Vibeke Klungland',
708
708
  },
709
709
  blog2: {
710
710
  text: 'Aktiviser elevane med digitale verktøy',
711
711
  externalLink: 'https://blogg.ndla.no/2021/09/aktiviser-elevane-med-digitale-verktoy/',
712
712
  linkText: 'Fagblogg',
713
- license: 'CC-BY-NC-SA-4.0',
714
- licenseAuthor: 'Scanpix.no',
713
+ license: 'CC-BY-SA-4.0',
714
+ licenseAuthor: 'Tom Knudsen',
715
715
  },
716
716
  },
717
717
  editor: {