@ndla/ui 56.0.112-alpha.0 → 56.0.114-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.
- package/es/Article/ArticleByline.js +7 -3
- package/es/TargetBlankIcon/TargetBlankIcon.js +21 -0
- package/es/TargetBlankIcon/index.js +9 -0
- package/es/index.js +1 -0
- package/es/locale/messages-en.js +1 -0
- package/es/locale/messages-nb.js +1 -0
- package/es/locale/messages-nn.js +1 -0
- package/es/locale/messages-se.js +1 -0
- package/lib/Article/ArticleByline.d.ts +1 -1
- package/lib/Article/ArticleByline.js +7 -3
- package/lib/TargetBlankIcon/TargetBlankIcon.d.ts +9 -0
- package/lib/TargetBlankIcon/TargetBlankIcon.js +27 -0
- package/lib/TargetBlankIcon/index.d.ts +8 -0
- package/lib/TargetBlankIcon/index.js +13 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -0
- package/lib/locale/messages-en.d.ts +1 -0
- package/lib/locale/messages-en.js +1 -0
- package/lib/locale/messages-nb.d.ts +1 -0
- package/lib/locale/messages-nb.js +1 -0
- package/lib/locale/messages-nn.d.ts +1 -0
- package/lib/locale/messages-nn.js +1 -0
- package/lib/locale/messages-se.d.ts +1 -0
- package/lib/locale/messages-se.js +1 -0
- package/package.json +3 -3
- package/src/Article/ArticleByline.tsx +9 -4
- package/src/TargetBlankIcon/TargetBlankIcon.tsx +17 -0
- package/src/TargetBlankIcon/index.ts +9 -0
- package/src/index.ts +2 -0
- package/src/locale/messages-en.ts +1 -0
- package/src/locale/messages-nb.ts +1 -0
- package/src/locale/messages-nn.ts +1 -0
- package/src/locale/messages-se.ts +1 -0
|
@@ -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
|
|
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:
|
|
124
|
+
learningpath: bylineType === "learningPath",
|
|
121
125
|
children: [!!showPrimaryContributors && /*#__PURE__*/_jsxs("span", {
|
|
122
|
-
children: [authors.length > 0 && `${t(
|
|
126
|
+
children: [authors.length > 0 && `${t(authorLabel[bylineType], {
|
|
123
127
|
names: renderContributors(authors, t),
|
|
124
128
|
interpolation: {
|
|
125
129
|
escapeValue: false
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useTranslation } from "react-i18next";
|
|
10
|
+
import { ExternalLinkLine } from "@ndla/icons";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
const TargetBlankIcon = () => {
|
|
13
|
+
const {
|
|
14
|
+
t
|
|
15
|
+
} = useTranslation();
|
|
16
|
+
return /*#__PURE__*/_jsx(ExternalLinkLine, {
|
|
17
|
+
size: "small",
|
|
18
|
+
"aria-label": t("license.openLink")
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
export default TargetBlankIcon;
|
package/es/index.js
CHANGED
|
@@ -41,5 +41,6 @@ export { Grid, GridParallaxItem } from "./Grid";
|
|
|
41
41
|
export { Gloss, GlossExample } from "./Gloss";
|
|
42
42
|
export { LinkBlock, LinkBlockSection } from "./LinkBlock";
|
|
43
43
|
export { CodeBlock, codeLanguageOptions } from "./CodeBlock";
|
|
44
|
+
export { TargetBlankIcon } from "./TargetBlankIcon";
|
|
44
45
|
export { ZendeskButton } from "./ZendeskButton/ZendeskButton";
|
|
45
46
|
export { licenseAttributes } from "./utils/licenseAttributes";
|
package/es/locale/messages-en.js
CHANGED
|
@@ -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",
|
package/es/locale/messages-nb.js
CHANGED
|
@@ -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",
|
package/es/locale/messages-nn.js
CHANGED
|
@@ -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 lagt til av {{names}}",
|
|
46
47
|
supplierLabel: "Rettshavar: {{name}}",
|
|
47
48
|
multipleSuppliersLabel: "Rettshavarar: {{names}}",
|
|
48
49
|
printPage: "Skriv ut teksten",
|
package/es/locale/messages-se.js
CHANGED
|
@@ -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
|
|
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:
|
|
130
|
+
learningpath: bylineType === "learningPath",
|
|
127
131
|
children: [!!showPrimaryContributors && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
128
|
-
children: [authors.length > 0 && `${t(
|
|
132
|
+
children: [authors.length > 0 && `${t(authorLabel[bylineType], {
|
|
129
133
|
names: renderContributors(authors, t),
|
|
130
134
|
interpolation: {
|
|
131
135
|
escapeValue: false
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
declare const TargetBlankIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default TargetBlankIcon;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactI18next = require("react-i18next");
|
|
8
|
+
var _icons = require("@ndla/icons");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
/**
|
|
11
|
+
* Copyright (c) 2025-present, NDLA.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const TargetBlankIcon = () => {
|
|
19
|
+
const {
|
|
20
|
+
t
|
|
21
|
+
} = (0, _reactI18next.useTranslation)();
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ExternalLinkLine, {
|
|
23
|
+
size: "small",
|
|
24
|
+
"aria-label": t("license.openLink")
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
var _default = exports.default = TargetBlankIcon;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "TargetBlankIcon", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _TargetBlankIcon.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _TargetBlankIcon = _interopRequireDefault(require("./TargetBlankIcon"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
package/lib/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export { Gloss, GlossExample } from "./Gloss";
|
|
|
48
48
|
export { LinkBlock, LinkBlockSection } from "./LinkBlock";
|
|
49
49
|
export type { Article as ArticleType, HeadingLevel } from "./types";
|
|
50
50
|
export { CodeBlock, codeLanguageOptions } from "./CodeBlock";
|
|
51
|
+
export { TargetBlankIcon } from "./TargetBlankIcon";
|
|
51
52
|
export { ZendeskButton } from "./ZendeskButton/ZendeskButton";
|
|
52
53
|
export type { ZendeskButtonProps } from "./ZendeskButton/ZendeskButton";
|
|
53
54
|
export { licenseAttributes } from "./utils/licenseAttributes";
|
package/lib/index.js
CHANGED
|
@@ -411,6 +411,12 @@ Object.defineProperty(exports, "TagSelectorTrigger", {
|
|
|
411
411
|
return _TagSelector.TagSelectorTrigger;
|
|
412
412
|
}
|
|
413
413
|
});
|
|
414
|
+
Object.defineProperty(exports, "TargetBlankIcon", {
|
|
415
|
+
enumerable: true,
|
|
416
|
+
get: function () {
|
|
417
|
+
return _TargetBlankIcon.TargetBlankIcon;
|
|
418
|
+
}
|
|
419
|
+
});
|
|
414
420
|
Object.defineProperty(exports, "UnknownEmbed", {
|
|
415
421
|
enumerable: true,
|
|
416
422
|
get: function () {
|
|
@@ -587,6 +593,7 @@ var _Grid = require("./Grid");
|
|
|
587
593
|
var _Gloss = require("./Gloss");
|
|
588
594
|
var _LinkBlock = require("./LinkBlock");
|
|
589
595
|
var _CodeBlock = require("./CodeBlock");
|
|
596
|
+
var _TargetBlankIcon = require("./TargetBlankIcon");
|
|
590
597
|
var _ZendeskButton = require("./ZendeskButton/ZendeskButton");
|
|
591
598
|
var _licenseAttributes = require("./utils/licenseAttributes");
|
|
592
599
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -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",
|
|
@@ -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",
|
|
@@ -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 lagt til av {{names}}",
|
|
53
54
|
supplierLabel: "Rettshavar: {{name}}",
|
|
54
55
|
multipleSuppliersLabel: "Rettshavarar: {{names}}",
|
|
55
56
|
printPage: "Skriv ut teksten",
|
|
@@ -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.
|
|
3
|
+
"version": "56.0.114-alpha.0",
|
|
4
4
|
"description": "UI component library for NDLA",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@ndla/core": "^5.0.3",
|
|
36
|
-
"@ndla/icons": "^8.0.
|
|
36
|
+
"@ndla/icons": "^8.0.54-alpha.0",
|
|
37
37
|
"@ndla/licenses": "^9.0.1",
|
|
38
38
|
"@ndla/primitives": "^1.0.85-alpha.0",
|
|
39
39
|
"@ndla/safelink": "^7.0.86-alpha.0",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "c69b83767d021c8f907b54b2a81c60db9d07ae73"
|
|
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
|
-
|
|
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={
|
|
162
|
+
<TextWrapper learningpath={bylineType === "learningPath"}>
|
|
158
163
|
{!!showPrimaryContributors && (
|
|
159
164
|
<span>
|
|
160
165
|
{authors.length > 0 &&
|
|
161
|
-
`${t(
|
|
166
|
+
`${t(authorLabel[bylineType], {
|
|
162
167
|
names: renderContributors(authors, t),
|
|
163
168
|
interpolation: { escapeValue: false },
|
|
164
169
|
})}. `}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { useTranslation } from "react-i18next";
|
|
10
|
+
import { ExternalLinkLine } from "@ndla/icons";
|
|
11
|
+
|
|
12
|
+
const TargetBlankIcon = () => {
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
return <ExternalLinkLine size="small" aria-label={t("license.openLink")} />;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default TargetBlankIcon;
|
package/src/index.ts
CHANGED
|
@@ -132,6 +132,8 @@ export type { Article as ArticleType, HeadingLevel } from "./types";
|
|
|
132
132
|
|
|
133
133
|
export { CodeBlock, codeLanguageOptions } from "./CodeBlock";
|
|
134
134
|
|
|
135
|
+
export { TargetBlankIcon } from "./TargetBlankIcon";
|
|
136
|
+
|
|
135
137
|
export { ZendeskButton } from "./ZendeskButton/ZendeskButton";
|
|
136
138
|
|
|
137
139
|
export type { ZendeskButtonProps } from "./ZendeskButton/ZendeskButton";
|
|
@@ -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 lagt 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",
|