@ndla/ui 56.0.81-alpha.0 → 56.0.84-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/README.md +1 -1
- package/es/Article/ArticleByline.js +1 -5
- package/es/Embed/RelatedContentEmbed.js +3 -2
- package/es/FileList/FileList.js +4 -19
- package/es/LicenseByline/EmbedByline.js +0 -1
- package/lib/Article/ArticleByline.js +1 -5
- package/lib/Embed/RelatedContentEmbed.js +3 -2
- package/lib/FileList/FileList.d.ts +2 -2
- package/lib/FileList/FileList.js +3 -18
- package/lib/LicenseByline/EmbedByline.js +0 -1
- package/package.json +4 -4
- package/src/Article/ArticleByline.tsx +1 -2
- package/src/Embed/RelatedContentEmbed.tsx +3 -5
- package/src/FileList/FileList.stories.tsx +2 -2
- package/src/FileList/FileList.tsx +3 -9
- package/src/LicenseByline/EmbedByline.tsx +1 -2
package/README.md
CHANGED
|
@@ -116,11 +116,7 @@ export const ArticleByline = _ref => {
|
|
|
116
116
|
return /*#__PURE__*/_jsxs(Wrapper, {
|
|
117
117
|
children: [!!displayByline && /*#__PURE__*/_jsxs(TextWrapper, {
|
|
118
118
|
learningpath: bylineType === "learningPath",
|
|
119
|
-
children: [!!showPrimaryContributors &&
|
|
120
|
-
/*#__PURE__*/
|
|
121
|
-
//eslint-disable-next-line react/no-unknown-property
|
|
122
|
-
_jsxs("span", {
|
|
123
|
-
property: "cc:attributionName",
|
|
119
|
+
children: [!!showPrimaryContributors && /*#__PURE__*/_jsxs("span", {
|
|
124
120
|
children: [authors.length > 0 && `${t("article.authorsLabel", {
|
|
125
121
|
names: renderContributors(authors, t),
|
|
126
122
|
interpolation: {
|
|
@@ -30,12 +30,13 @@ const RelatedContentEmbed = _ref => {
|
|
|
30
30
|
if (embedData.articleId && data) {
|
|
31
31
|
const typeId = data.resource?.resourceTypes.find(rt => contentTypeMapping[rt.id])?.id;
|
|
32
32
|
const type = typeId ? contentTypeMapping[typeId] : undefined;
|
|
33
|
-
const
|
|
33
|
+
const context = data.resource?.contexts.find(c => c.rootId === subject);
|
|
34
|
+
const url = context?.url ?? data.resource?.url ?? `/article/${embedData.articleId}`;
|
|
34
35
|
return /*#__PURE__*/_jsx(RelatedArticle, {
|
|
35
36
|
title: data.article.title?.title ?? "",
|
|
36
37
|
introduction: data.article.metaDescription?.metaDescription ?? "",
|
|
37
38
|
target: isOembed ? "_blank" : undefined,
|
|
38
|
-
to: `${ndlaFrontendDomain ?? ""}${
|
|
39
|
+
to: `${ndlaFrontendDomain ?? ""}${url ?? ""}`,
|
|
39
40
|
type: type
|
|
40
41
|
});
|
|
41
42
|
}
|
package/es/FileList/FileList.js
CHANGED
|
@@ -6,12 +6,10 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { useTranslation } from "react-i18next";
|
|
10
9
|
import { ark } from "@ark-ui/react";
|
|
11
|
-
import { Heading } from "@ndla/primitives";
|
|
12
10
|
import { styled } from "@ndla/styled-system/jsx";
|
|
13
|
-
import { jsx as _jsx
|
|
14
|
-
export const FileListWrapper = styled("
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
export const FileListWrapper = styled("ul", {
|
|
15
13
|
base: {
|
|
16
14
|
display: "flex",
|
|
17
15
|
flexDirection: "column",
|
|
@@ -38,22 +36,9 @@ export const FileListEmbed = _ref => {
|
|
|
38
36
|
children,
|
|
39
37
|
...rest
|
|
40
38
|
} = _ref;
|
|
41
|
-
|
|
42
|
-
t
|
|
43
|
-
} = useTranslation();
|
|
44
|
-
return /*#__PURE__*/_jsxs(FileListWrapper, {
|
|
39
|
+
return /*#__PURE__*/_jsx(FileListWrapper, {
|
|
45
40
|
...rest,
|
|
46
41
|
"data-embed-type": "file-list",
|
|
47
|
-
children:
|
|
48
|
-
fontWeight: "bold",
|
|
49
|
-
textStyle: "heading.small",
|
|
50
|
-
asChild: true,
|
|
51
|
-
consumeCss: true,
|
|
52
|
-
children: /*#__PURE__*/_jsx("h3", {
|
|
53
|
-
children: t("files")
|
|
54
|
-
})
|
|
55
|
-
}), /*#__PURE__*/_jsx("ul", {
|
|
56
|
-
children: children
|
|
57
|
-
})]
|
|
42
|
+
children: children
|
|
58
43
|
});
|
|
59
44
|
};
|
|
@@ -186,7 +186,6 @@ export const LicenseContainerContent = _ref3 => {
|
|
|
186
186
|
const [isOpen, setIsOpen] = useState(false);
|
|
187
187
|
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
188
188
|
children: [children, ` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`, /*#__PURE__*/_jsx("span", {
|
|
189
|
-
property: "cc:attributionName",
|
|
190
189
|
children: captionAuthors.map(author => author.name).join(", ")
|
|
191
190
|
}), license ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
192
191
|
children: [" / ", /*#__PURE__*/_jsx(LicenseLink, {
|
|
@@ -122,11 +122,7 @@ const ArticleByline = _ref => {
|
|
|
122
122
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
|
|
123
123
|
children: [!!displayByline && /*#__PURE__*/(0, _jsxRuntime.jsxs)(TextWrapper, {
|
|
124
124
|
learningpath: bylineType === "learningPath",
|
|
125
|
-
children: [!!showPrimaryContributors &&
|
|
126
|
-
/*#__PURE__*/
|
|
127
|
-
//eslint-disable-next-line react/no-unknown-property
|
|
128
|
-
(0, _jsxRuntime.jsxs)("span", {
|
|
129
|
-
property: "cc:attributionName",
|
|
125
|
+
children: [!!showPrimaryContributors && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
130
126
|
children: [authors.length > 0 && `${t("article.authorsLabel", {
|
|
131
127
|
names: renderContributors(authors, t),
|
|
132
128
|
interpolation: {
|
|
@@ -36,12 +36,13 @@ const RelatedContentEmbed = _ref => {
|
|
|
36
36
|
if (embedData.articleId && data) {
|
|
37
37
|
const typeId = data.resource?.resourceTypes.find(rt => _ContentType.contentTypeMapping[rt.id])?.id;
|
|
38
38
|
const type = typeId ? _ContentType.contentTypeMapping[typeId] : undefined;
|
|
39
|
-
const
|
|
39
|
+
const context = data.resource?.contexts.find(c => c.rootId === subject);
|
|
40
|
+
const url = context?.url ?? data.resource?.url ?? `/article/${embedData.articleId}`;
|
|
40
41
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RelatedArticleList.RelatedArticle, {
|
|
41
42
|
title: data.article.title?.title ?? "",
|
|
42
43
|
introduction: data.article.metaDescription?.metaDescription ?? "",
|
|
43
44
|
target: isOembed ? "_blank" : undefined,
|
|
44
|
-
to: `${ndlaFrontendDomain ?? ""}${
|
|
45
|
+
to: `${ndlaFrontendDomain ?? ""}${url ?? ""}`,
|
|
45
46
|
type: type
|
|
46
47
|
});
|
|
47
48
|
}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import { type ComponentPropsWithoutRef } from "react";
|
|
9
|
-
interface Props extends ComponentPropsWithoutRef<"
|
|
9
|
+
interface Props extends ComponentPropsWithoutRef<"ul"> {
|
|
10
10
|
}
|
|
11
|
-
export declare const FileListWrapper: import("@ndla/styled-system/types").StyledComponent<"
|
|
11
|
+
export declare const FileListWrapper: import("@ndla/styled-system/types").StyledComponent<"ul", {}>;
|
|
12
12
|
export declare const FileListItem: import("@ndla/styled-system/types").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ClassAttributes<HTMLLIElement> & import("react").LiHTMLAttributes<HTMLLIElement> & import("@ark-ui/react").PolymorphicProps>, {}>;
|
|
13
13
|
export declare const FileListEmbed: ({ children, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export {};
|
package/lib/FileList/FileList.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.FileListWrapper = exports.FileListItem = exports.FileListEmbed = void 0;
|
|
7
|
-
var _reactI18next = require("react-i18next");
|
|
8
7
|
var _react = require("@ark-ui/react");
|
|
9
|
-
var _primitives = require("@ndla/primitives");
|
|
10
8
|
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
11
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
10
|
/**
|
|
@@ -17,7 +15,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
17
15
|
*
|
|
18
16
|
*/
|
|
19
17
|
|
|
20
|
-
const FileListWrapper = exports.FileListWrapper = (0, _jsx2.styled)("
|
|
18
|
+
const FileListWrapper = exports.FileListWrapper = (0, _jsx2.styled)("ul", {
|
|
21
19
|
base: {
|
|
22
20
|
display: "flex",
|
|
23
21
|
flexDirection: "column",
|
|
@@ -44,23 +42,10 @@ const FileListEmbed = _ref => {
|
|
|
44
42
|
children,
|
|
45
43
|
...rest
|
|
46
44
|
} = _ref;
|
|
47
|
-
|
|
48
|
-
t
|
|
49
|
-
} = (0, _reactI18next.useTranslation)();
|
|
50
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(FileListWrapper, {
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(FileListWrapper, {
|
|
51
46
|
...rest,
|
|
52
47
|
"data-embed-type": "file-list",
|
|
53
|
-
children:
|
|
54
|
-
fontWeight: "bold",
|
|
55
|
-
textStyle: "heading.small",
|
|
56
|
-
asChild: true,
|
|
57
|
-
consumeCss: true,
|
|
58
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
59
|
-
children: t("files")
|
|
60
|
-
})
|
|
61
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
62
|
-
children: children
|
|
63
|
-
})]
|
|
48
|
+
children: children
|
|
64
49
|
});
|
|
65
50
|
};
|
|
66
51
|
exports.FileListEmbed = FileListEmbed;
|
|
@@ -193,7 +193,6 @@ const LicenseContainerContent = _ref3 => {
|
|
|
193
193
|
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
194
194
|
const content = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
195
195
|
children: [children, ` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
196
|
-
property: "cc:attributionName",
|
|
197
196
|
children: captionAuthors.map(author => author.name).join(", ")
|
|
198
197
|
}), license ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
199
198
|
children: [" / ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_LicenseLink.LicenseLink, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.84-alpha.0",
|
|
4
4
|
"description": "UI component library for NDLA",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@ndla/core": "^5.0.3",
|
|
36
36
|
"@ndla/icons": "^8.0.48-alpha.0",
|
|
37
37
|
"@ndla/licenses": "^8.0.6-alpha.0",
|
|
38
|
-
"@ndla/primitives": "^1.0.
|
|
39
|
-
"@ndla/safelink": "^7.0.
|
|
38
|
+
"@ndla/primitives": "^1.0.67-alpha.0",
|
|
39
|
+
"@ndla/safelink": "^7.0.68-alpha.0",
|
|
40
40
|
"@ndla/styled-system": "^0.0.29",
|
|
41
41
|
"@ndla/util": "^5.0.5-alpha.0",
|
|
42
42
|
"html-react-parser": "^5.1.19",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "14e44312c9dd32cc892dac71c60b3569c2b3dfc8"
|
|
62
62
|
}
|
|
@@ -153,8 +153,7 @@ export const ArticleByline = ({
|
|
|
153
153
|
{!!displayByline && (
|
|
154
154
|
<TextWrapper learningpath={bylineType === "learningPath"}>
|
|
155
155
|
{!!showPrimaryContributors && (
|
|
156
|
-
|
|
157
|
-
<span property="cc:attributionName">
|
|
156
|
+
<span>
|
|
158
157
|
{authors.length > 0 &&
|
|
159
158
|
`${t("article.authorsLabel", {
|
|
160
159
|
names: renderContributors(authors, t),
|
|
@@ -29,16 +29,14 @@ const RelatedContentEmbed = ({ embed, isOembed, subject, ndlaFrontendDomain }: P
|
|
|
29
29
|
if (embedData.articleId && data) {
|
|
30
30
|
const typeId = data.resource?.resourceTypes.find((rt) => contentTypeMapping[rt.id])?.id;
|
|
31
31
|
const type = typeId ? contentTypeMapping[typeId] : undefined;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
data.resource?.path ??
|
|
35
|
-
`/article/${embedData.articleId}`;
|
|
32
|
+
const context = data.resource?.contexts.find((c) => c.rootId === subject);
|
|
33
|
+
const url = context?.url ?? data.resource?.url ?? `/article/${embedData.articleId}`;
|
|
36
34
|
return (
|
|
37
35
|
<RelatedArticle
|
|
38
36
|
title={data.article.title?.title ?? ""}
|
|
39
37
|
introduction={data.article.metaDescription?.metaDescription ?? ""}
|
|
40
38
|
target={isOembed ? "_blank" : undefined}
|
|
41
|
-
to={`${ndlaFrontendDomain ?? ""}${
|
|
39
|
+
to={`${ndlaFrontendDomain ?? ""}${url ?? ""}`}
|
|
42
40
|
type={type}
|
|
43
41
|
/>
|
|
44
42
|
);
|
|
@@ -95,7 +95,7 @@ export const DifferentFiles: StoryObj<typeof File> = {
|
|
|
95
95
|
),
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
-
export const
|
|
98
|
+
export const JustTheFileItems: StoryObj<typeof File> = {
|
|
99
99
|
render: () => (
|
|
100
100
|
<ul>
|
|
101
101
|
<FileListItem>
|
|
@@ -108,7 +108,7 @@ export const NoHeader: StoryObj<typeof File> = {
|
|
|
108
108
|
),
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
export const
|
|
111
|
+
export const FileItemsWithButtons: StoryObj<typeof File> = {
|
|
112
112
|
render: () => (
|
|
113
113
|
<ul>
|
|
114
114
|
<FileListItem>
|
|
@@ -7,14 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { type ComponentPropsWithoutRef } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
10
|
import { ark } from "@ark-ui/react";
|
|
12
|
-
import { Heading } from "@ndla/primitives";
|
|
13
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
14
12
|
|
|
15
|
-
interface Props extends ComponentPropsWithoutRef<"
|
|
13
|
+
interface Props extends ComponentPropsWithoutRef<"ul"> {}
|
|
16
14
|
|
|
17
|
-
export const FileListWrapper = styled("
|
|
15
|
+
export const FileListWrapper = styled("ul", {
|
|
18
16
|
base: {
|
|
19
17
|
display: "flex",
|
|
20
18
|
flexDirection: "column",
|
|
@@ -42,13 +40,9 @@ export const FileListItem = styled(
|
|
|
42
40
|
);
|
|
43
41
|
|
|
44
42
|
export const FileListEmbed = ({ children, ...rest }: Props) => {
|
|
45
|
-
const { t } = useTranslation();
|
|
46
43
|
return (
|
|
47
44
|
<FileListWrapper {...rest} data-embed-type="file-list">
|
|
48
|
-
|
|
49
|
-
<h3>{t("files")}</h3>
|
|
50
|
-
</Heading>
|
|
51
|
-
<ul>{children}</ul>
|
|
45
|
+
{children}
|
|
52
46
|
</FileListWrapper>
|
|
53
47
|
);
|
|
54
48
|
};
|
|
@@ -244,8 +244,7 @@ export const LicenseContainerContent = ({ children, copyright, type }: LicenseCo
|
|
|
244
244
|
<>
|
|
245
245
|
{children}
|
|
246
246
|
{` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`}
|
|
247
|
-
{
|
|
248
|
-
<span property="cc:attributionName">{captionAuthors.map((author) => author.name).join(", ")}</span>
|
|
247
|
+
<span>{captionAuthors.map((author) => author.name).join(", ")}</span>
|
|
249
248
|
{license ? (
|
|
250
249
|
<>
|
|
251
250
|
{" / "}
|