@ndla/ui 56.0.111-alpha.0 → 56.0.113-alpha.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.
@@ -114,12 +114,16 @@ export const ArticleByline = _ref => {
114
114
  return () => window.removeEventListener("hashchange", onHashChange);
115
115
  }, [onHashChange]);
116
116
  const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;
117
- const isLearningpath = bylineType === "learningPath";
117
+ const authorLabel = {
118
+ article: "article.authorsLabel",
119
+ learningPath: "article.authorsLabelLearningpath",
120
+ external: "article.authorsLabelExternal"
121
+ };
118
122
  return /*#__PURE__*/_jsxs(Wrapper, {
119
123
  children: [!!displayByline && /*#__PURE__*/_jsxs(TextWrapper, {
120
- learningpath: isLearningpath,
124
+ learningpath: bylineType === "learningPath",
121
125
  children: [!!showPrimaryContributors && /*#__PURE__*/_jsxs("span", {
122
- children: [authors.length > 0 && `${t(isLearningpath ? "article.authorsLabelLearningpath" : "article.authorsLabel", {
126
+ children: [authors.length > 0 && `${t(authorLabel[bylineType], {
123
127
  names: renderContributors(authors, t),
124
128
  interpolation: {
125
129
  escapeValue: false
package/es/Grid/Grid.js CHANGED
@@ -79,7 +79,8 @@ export const Grid = _ref => {
79
79
  columns,
80
80
  border,
81
81
  children,
82
- background = "gray"
82
+ background = "gray",
83
+ ...rest
83
84
  } = _ref;
84
85
  const amountOfColumns = children?.length === 3 ? "3" : columns;
85
86
  return /*#__PURE__*/_jsx(GridContainer, {
@@ -87,6 +88,7 @@ export const Grid = _ref => {
87
88
  border: border === "none" ? undefined : border,
88
89
  columns: amountOfColumns,
89
90
  background: background,
91
+ ...rest,
90
92
  children: children
91
93
  });
92
94
  };
@@ -43,6 +43,7 @@ const messages = {
43
43
  copyPageLinkCopied: "Link copied",
44
44
  copyHeaderLink: "Copy link to header",
45
45
  conjunction: "and",
46
+ authorsLabelExternal: "This link is added by {{names}}",
46
47
  supplierLabel: "Rightsholder: {{name}}",
47
48
  multipleSuppliersLabel: "Rightsholders: {{names}}",
48
49
  printPage: "Print text",
@@ -43,6 +43,7 @@ const messages = {
43
43
  copyPageLinkCopied: "Lenke kopiert",
44
44
  copyHeaderLink: "Kopier lenke til overskriften",
45
45
  conjunction: "og",
46
+ authorsLabelExternal: "Denne lenken er lagt til av {{names}}",
46
47
  supplierLabel: "Rettighetshaver: {{name}}",
47
48
  multipleSuppliersLabel: "Rettighetshavere: {{names}}",
48
49
  printPage: "Skriv ut teksten",
@@ -43,6 +43,7 @@ const messages = {
43
43
  copyPageLinkCopied: "Lenke kopiert",
44
44
  copyHeaderLink: "Kopier lenke til overskrifta",
45
45
  conjunction: "og",
46
+ authorsLabelExternal: "Denne lenka er lagd til av {{names}}",
46
47
  supplierLabel: "Rettshavar: {{name}}",
47
48
  multipleSuppliersLabel: "Rettshavarar: {{names}}",
48
49
  printPage: "Skriv ut teksten",
@@ -43,6 +43,7 @@ const messages = {
43
43
  copyPageLinkCopied: "Liŋka máŋgejuvvon",
44
44
  copyHeaderLink: "Máŋge liŋka bajilčállagii",
45
45
  conjunction: "ja",
46
+ authorsLabelExternal: "Denne lenken er lagt til av {{names}}",
46
47
  supplierLabel: "Vuoigatvuođaguoddi: {{name}}",
47
48
  multipleSuppliersLabel: "Vuoigatvuođaguoddit: {{names}}",
48
49
  printPage: "Čálit teavstta",
@@ -21,7 +21,7 @@ type Props = {
21
21
  licenseBox?: ReactNode;
22
22
  footnotes?: FootNote[];
23
23
  displayByline?: boolean;
24
- bylineType?: "article" | "learningPath";
24
+ bylineType?: "article" | "learningPath" | "external";
25
25
  bylineSuffix?: ReactNode;
26
26
  };
27
27
  export declare const ArticleByline: ({ authors, suppliers, footnotes, licenseBox, published, displayByline, bylineType, bylineSuffix, }: Props) => import("react/jsx-runtime").JSX.Element;
@@ -120,12 +120,16 @@ const ArticleByline = _ref => {
120
120
  return () => window.removeEventListener("hashchange", onHashChange);
121
121
  }, [onHashChange]);
122
122
  const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;
123
- const isLearningpath = bylineType === "learningPath";
123
+ const authorLabel = {
124
+ article: "article.authorsLabel",
125
+ learningPath: "article.authorsLabelLearningpath",
126
+ external: "article.authorsLabelExternal"
127
+ };
124
128
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
125
129
  children: [!!displayByline && /*#__PURE__*/(0, _jsxRuntime.jsxs)(TextWrapper, {
126
- learningpath: isLearningpath,
130
+ learningpath: bylineType === "learningPath",
127
131
  children: [!!showPrimaryContributors && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
128
- children: [authors.length > 0 && `${t(isLearningpath ? "article.authorsLabelLearningpath" : "article.authorsLabel", {
132
+ children: [authors.length > 0 && `${t(authorLabel[bylineType], {
129
133
  names: renderContributors(authors, t),
130
134
  interpolation: {
131
135
  escapeValue: false
@@ -5,11 +5,11 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import { type ReactNode } from "react";
9
- export interface GridProps {
8
+ import { type ComponentProps, type ReactNode } from "react";
9
+ export interface GridProps extends ComponentProps<"div"> {
10
10
  columns: "2" | "3" | "4" | "2x2";
11
11
  border?: "none" | "lightBlue";
12
12
  background?: "transparent" | "white" | "gray";
13
13
  children?: ReactNode[];
14
14
  }
15
- export declare const Grid: ({ columns, border, children, background }: GridProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const Grid: ({ columns, border, children, background, ...rest }: GridProps) => import("react/jsx-runtime").JSX.Element;
package/lib/Grid/Grid.js CHANGED
@@ -85,7 +85,8 @@ const Grid = _ref => {
85
85
  columns,
86
86
  border,
87
87
  children,
88
- background = "gray"
88
+ background = "gray",
89
+ ...rest
89
90
  } = _ref;
90
91
  const amountOfColumns = children?.length === 3 ? "3" : columns;
91
92
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridContainer, {
@@ -93,6 +94,7 @@ const Grid = _ref => {
93
94
  border: border === "none" ? undefined : border,
94
95
  columns: amountOfColumns,
95
96
  background: background,
97
+ ...rest,
96
98
  children: children
97
99
  });
98
100
  };
@@ -34,6 +34,7 @@ declare const messages: {
34
34
  copyPageLinkCopied: string;
35
35
  copyHeaderLink: string;
36
36
  conjunction: string;
37
+ authorsLabelExternal: string;
37
38
  supplierLabel: string;
38
39
  multipleSuppliersLabel: string;
39
40
  printPage: string;
@@ -50,6 +50,7 @@ const messages = {
50
50
  copyPageLinkCopied: "Link copied",
51
51
  copyHeaderLink: "Copy link to header",
52
52
  conjunction: "and",
53
+ authorsLabelExternal: "This link is added by {{names}}",
53
54
  supplierLabel: "Rightsholder: {{name}}",
54
55
  multipleSuppliersLabel: "Rightsholders: {{names}}",
55
56
  printPage: "Print text",
@@ -34,6 +34,7 @@ declare const messages: {
34
34
  copyPageLinkCopied: string;
35
35
  copyHeaderLink: string;
36
36
  conjunction: string;
37
+ authorsLabelExternal: string;
37
38
  supplierLabel: string;
38
39
  multipleSuppliersLabel: string;
39
40
  printPage: string;
@@ -50,6 +50,7 @@ const messages = {
50
50
  copyPageLinkCopied: "Lenke kopiert",
51
51
  copyHeaderLink: "Kopier lenke til overskriften",
52
52
  conjunction: "og",
53
+ authorsLabelExternal: "Denne lenken er lagt til av {{names}}",
53
54
  supplierLabel: "Rettighetshaver: {{name}}",
54
55
  multipleSuppliersLabel: "Rettighetshavere: {{names}}",
55
56
  printPage: "Skriv ut teksten",
@@ -34,6 +34,7 @@ declare const messages: {
34
34
  copyPageLinkCopied: string;
35
35
  copyHeaderLink: string;
36
36
  conjunction: string;
37
+ authorsLabelExternal: string;
37
38
  supplierLabel: string;
38
39
  multipleSuppliersLabel: string;
39
40
  printPage: string;
@@ -50,6 +50,7 @@ const messages = {
50
50
  copyPageLinkCopied: "Lenke kopiert",
51
51
  copyHeaderLink: "Kopier lenke til overskrifta",
52
52
  conjunction: "og",
53
+ authorsLabelExternal: "Denne lenka er lagd til av {{names}}",
53
54
  supplierLabel: "Rettshavar: {{name}}",
54
55
  multipleSuppliersLabel: "Rettshavarar: {{names}}",
55
56
  printPage: "Skriv ut teksten",
@@ -34,6 +34,7 @@ declare const messages: {
34
34
  copyPageLinkCopied: string;
35
35
  copyHeaderLink: string;
36
36
  conjunction: string;
37
+ authorsLabelExternal: string;
37
38
  supplierLabel: string;
38
39
  multipleSuppliersLabel: string;
39
40
  printPage: string;
@@ -50,6 +50,7 @@ const messages = {
50
50
  copyPageLinkCopied: "Liŋka máŋgejuvvon",
51
51
  copyHeaderLink: "Máŋge liŋka bajilčállagii",
52
52
  conjunction: "ja",
53
+ authorsLabelExternal: "Denne lenken er lagt til av {{names}}",
53
54
  supplierLabel: "Vuoigatvuođaguoddi: {{name}}",
54
55
  multipleSuppliersLabel: "Vuoigatvuođaguoddit: {{names}}",
55
56
  printPage: "Čálit teavstta",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "56.0.111-alpha.0",
3
+ "version": "56.0.113-alpha.0",
4
4
  "description": "UI component library for NDLA",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -57,5 +57,5 @@
57
57
  "publishConfig": {
58
58
  "access": "public"
59
59
  },
60
- "gitHead": "2636009581467510d1675793f45f1762065b5a81"
60
+ "gitHead": "e8c865af1ed43005dd82d12f85a0704acd4ff4ae"
61
61
  }
@@ -74,7 +74,7 @@ type Props = {
74
74
  licenseBox?: ReactNode;
75
75
  footnotes?: FootNote[];
76
76
  displayByline?: boolean;
77
- bylineType?: "article" | "learningPath";
77
+ bylineType?: "article" | "learningPath" | "external";
78
78
  bylineSuffix?: ReactNode;
79
79
  };
80
80
 
@@ -149,16 +149,21 @@ export const ArticleByline = ({
149
149
  }, [onHashChange]);
150
150
 
151
151
  const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;
152
- const isLearningpath = bylineType === "learningPath";
152
+
153
+ const authorLabel: Record<string, string> = {
154
+ article: "article.authorsLabel",
155
+ learningPath: "article.authorsLabelLearningpath",
156
+ external: "article.authorsLabelExternal",
157
+ };
153
158
 
154
159
  return (
155
160
  <Wrapper>
156
161
  {!!displayByline && (
157
- <TextWrapper learningpath={isLearningpath}>
162
+ <TextWrapper learningpath={bylineType === "learningPath"}>
158
163
  {!!showPrimaryContributors && (
159
164
  <span>
160
165
  {authors.length > 0 &&
161
- `${t(isLearningpath ? "article.authorsLabelLearningpath" : "article.authorsLabel", {
166
+ `${t(authorLabel[bylineType], {
162
167
  names: renderContributors(authors, t),
163
168
  interpolation: { escapeValue: false },
164
169
  })}. `}
package/src/Grid/Grid.tsx CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
 
9
- import { type ReactNode } from "react";
9
+ import { type ComponentProps, type ReactNode } from "react";
10
10
  import { styled } from "@ndla/styled-system/jsx";
11
11
 
12
12
  const GridContainer = styled("div", {
@@ -63,14 +63,14 @@ const GridContainer = styled("div", {
63
63
  },
64
64
  });
65
65
 
66
- export interface GridProps {
66
+ export interface GridProps extends ComponentProps<"div"> {
67
67
  columns: "2" | "3" | "4" | "2x2";
68
68
  border?: "none" | "lightBlue";
69
69
  background?: "transparent" | "white" | "gray";
70
70
  children?: ReactNode[];
71
71
  }
72
72
 
73
- export const Grid = ({ columns, border, children, background = "gray" }: GridProps) => {
73
+ export const Grid = ({ columns, border, children, background = "gray", ...rest }: GridProps) => {
74
74
  const amountOfColumns = children?.length === 3 ? "3" : columns;
75
75
 
76
76
  return (
@@ -79,6 +79,7 @@ export const Grid = ({ columns, border, children, background = "gray" }: GridPro
79
79
  border={border === "none" ? undefined : border}
80
80
  columns={amountOfColumns}
81
81
  background={background}
82
+ {...rest}
82
83
  >
83
84
  {children}
84
85
  </GridContainer>
@@ -41,6 +41,7 @@ const messages = {
41
41
  copyPageLinkCopied: "Link copied",
42
42
  copyHeaderLink: "Copy link to header",
43
43
  conjunction: "and",
44
+ authorsLabelExternal: "This link is added by {{names}}",
44
45
  supplierLabel: "Rightsholder: {{name}}",
45
46
  multipleSuppliersLabel: "Rightsholders: {{names}}",
46
47
  printPage: "Print text",
@@ -42,6 +42,7 @@ const messages = {
42
42
  copyPageLinkCopied: "Lenke kopiert",
43
43
  copyHeaderLink: "Kopier lenke til overskriften",
44
44
  conjunction: "og",
45
+ authorsLabelExternal: "Denne lenken er lagt til av {{names}}",
45
46
  supplierLabel: "Rettighetshaver: {{name}}",
46
47
  multipleSuppliersLabel: "Rettighetshavere: {{names}}",
47
48
  printPage: "Skriv ut teksten",
@@ -42,6 +42,7 @@ const messages = {
42
42
  copyPageLinkCopied: "Lenke kopiert",
43
43
  copyHeaderLink: "Kopier lenke til overskrifta",
44
44
  conjunction: "og",
45
+ authorsLabelExternal: "Denne lenka er lagd til av {{names}}",
45
46
  supplierLabel: "Rettshavar: {{name}}",
46
47
  multipleSuppliersLabel: "Rettshavarar: {{names}}",
47
48
  printPage: "Skriv ut teksten",
@@ -42,6 +42,7 @@ const messages = {
42
42
  copyPageLinkCopied: "Liŋka máŋgejuvvon",
43
43
  copyHeaderLink: "Máŋge liŋka bajilčállagii",
44
44
  conjunction: "ja",
45
+ authorsLabelExternal: "Denne lenken er lagt til av {{names}}",
45
46
  supplierLabel: "Vuoigatvuođaguoddi: {{name}}",
46
47
  multipleSuppliersLabel: "Vuoigatvuođaguoddit: {{names}}",
47
48
  printPage: "Čálit teavstta",