@ndla/ui 56.0.119-alpha.0 → 56.0.121-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 +1 -1
- package/es/FileList/File.js +4 -2
- package/es/index.js +0 -1
- package/lib/Article/ArticleByline.js +2 -2
- package/lib/FileList/File.js +4 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -7
- package/package.json +8 -8
- package/src/Article/ArticleByline.tsx +1 -1
- package/src/FileList/File.tsx +4 -2
- package/src/index.ts +0 -2
- package/es/TargetBlankIcon/TargetBlankIcon.js +0 -21
- package/es/TargetBlankIcon/index.js +0 -9
- package/lib/TargetBlankIcon/TargetBlankIcon.d.ts +0 -9
- package/lib/TargetBlankIcon/TargetBlankIcon.js +0 -27
- package/lib/TargetBlankIcon/index.d.ts +0 -8
- package/lib/TargetBlankIcon/index.js +0 -13
- package/src/TargetBlankIcon/TargetBlankIcon.tsx +0 -17
- package/src/TargetBlankIcon/index.ts +0 -9
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { forwardRef, useCallback, useEffect, useState } from "react";
|
|
10
10
|
import { useTranslation } from "react-i18next";
|
|
11
|
-
import { useLocation } from "react-router
|
|
11
|
+
import { useLocation } from "react-router";
|
|
12
12
|
import { ArrowDownShortLine } from "@ndla/icons";
|
|
13
13
|
import { AccordionItem, AccordionItemContent, AccordionItemIndicator, AccordionItemTrigger, AccordionRoot, Heading } from "@ndla/primitives";
|
|
14
14
|
import { styled } from "@ndla/styled-system/jsx";
|
package/es/FileList/File.js
CHANGED
|
@@ -45,7 +45,9 @@ export const File = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
45
45
|
const {
|
|
46
46
|
t
|
|
47
47
|
} = useTranslation();
|
|
48
|
-
const
|
|
48
|
+
const filename = `${title}-${url.split("/").pop() ?? ""}`;
|
|
49
|
+
const downloadUrl = `${url}?download=${filename}`;
|
|
50
|
+
const tooltip = `${t("download")} ${filename}`;
|
|
49
51
|
return /*#__PURE__*/_jsxs(StyledHStack, {
|
|
50
52
|
justify: "space-between",
|
|
51
53
|
ref: ref,
|
|
@@ -55,7 +57,7 @@ export const File = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
55
57
|
children: [/*#__PURE__*/_jsx(DownloadLine, {}), fileExists ? /*#__PURE__*/_jsx(StyledSafeLink, {
|
|
56
58
|
unstyled: true,
|
|
57
59
|
css: linkOverlay.raw(),
|
|
58
|
-
to:
|
|
60
|
+
to: downloadUrl,
|
|
59
61
|
title: tooltip,
|
|
60
62
|
children: title
|
|
61
63
|
}) : /*#__PURE__*/_jsx(Text, {
|
package/es/index.js
CHANGED
|
@@ -41,6 +41,5 @@ 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";
|
|
45
44
|
export { ZendeskButton } from "./ZendeskButton/ZendeskButton";
|
|
46
45
|
export { licenseAttributes } from "./utils/licenseAttributes";
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ArticleBylineAccordionItem = exports.ArticleByline = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactI18next = require("react-i18next");
|
|
9
|
-
var
|
|
9
|
+
var _reactRouter = require("react-router");
|
|
10
10
|
var _icons = require("@ndla/icons");
|
|
11
11
|
var _primitives = require("@ndla/primitives");
|
|
12
12
|
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
@@ -100,7 +100,7 @@ const ArticleByline = _ref => {
|
|
|
100
100
|
} = (0, _reactI18next.useTranslation)();
|
|
101
101
|
const {
|
|
102
102
|
pathname
|
|
103
|
-
} = (0,
|
|
103
|
+
} = (0, _reactRouter.useLocation)();
|
|
104
104
|
const [openAccordions, setOpenAccordions] = (0, _react.useState)([]);
|
|
105
105
|
const accordionItemValue = "rulesForUse";
|
|
106
106
|
const onHashChange = (0, _react.useCallback)(e => {
|
package/lib/FileList/File.js
CHANGED
|
@@ -51,7 +51,9 @@ const File = exports.File = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
51
51
|
const {
|
|
52
52
|
t
|
|
53
53
|
} = (0, _reactI18next.useTranslation)();
|
|
54
|
-
const
|
|
54
|
+
const filename = `${title}-${url.split("/").pop() ?? ""}`;
|
|
55
|
+
const downloadUrl = `${url}?download=${filename}`;
|
|
56
|
+
const tooltip = `${t("download")} ${filename}`;
|
|
55
57
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledHStack, {
|
|
56
58
|
justify: "space-between",
|
|
57
59
|
ref: ref,
|
|
@@ -61,7 +63,7 @@ const File = exports.File = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
61
63
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.DownloadLine, {}), fileExists ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSafeLink, {
|
|
62
64
|
unstyled: true,
|
|
63
65
|
css: _patterns.linkOverlay.raw(),
|
|
64
|
-
to:
|
|
66
|
+
to: downloadUrl,
|
|
65
67
|
title: tooltip,
|
|
66
68
|
children: title
|
|
67
69
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
|
package/lib/index.d.ts
CHANGED
|
@@ -48,7 +48,6 @@ 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";
|
|
52
51
|
export { ZendeskButton } from "./ZendeskButton/ZendeskButton";
|
|
53
52
|
export type { ZendeskButtonProps } from "./ZendeskButton/ZendeskButton";
|
|
54
53
|
export { licenseAttributes } from "./utils/licenseAttributes";
|
package/lib/index.js
CHANGED
|
@@ -411,12 +411,6 @@ 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
|
-
});
|
|
420
414
|
Object.defineProperty(exports, "UnknownEmbed", {
|
|
421
415
|
enumerable: true,
|
|
422
416
|
get: function () {
|
|
@@ -593,7 +587,6 @@ var _Grid = require("./Grid");
|
|
|
593
587
|
var _Gloss = require("./Gloss");
|
|
594
588
|
var _LinkBlock = require("./LinkBlock");
|
|
595
589
|
var _CodeBlock = require("./CodeBlock");
|
|
596
|
-
var _TargetBlankIcon = require("./TargetBlankIcon");
|
|
597
590
|
var _ZendeskButton = require("./ZendeskButton/ZendeskButton");
|
|
598
591
|
var _licenseAttributes = require("./utils/licenseAttributes");
|
|
599
592
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.121-alpha.0",
|
|
4
4
|
"description": "UI component library for NDLA",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@ndla/core": "^6.0.0-alpha.0",
|
|
36
|
-
"@ndla/icons": "^8.0.
|
|
36
|
+
"@ndla/icons": "^8.0.58-alpha.0",
|
|
37
37
|
"@ndla/licenses": "^9.0.1",
|
|
38
|
-
"@ndla/primitives": "^1.0.
|
|
39
|
-
"@ndla/safelink": "^7.0.
|
|
38
|
+
"@ndla/primitives": "^1.0.87-alpha.0",
|
|
39
|
+
"@ndla/safelink": "^7.0.89-alpha.0",
|
|
40
40
|
"@ndla/styled-system": "^0.0.34",
|
|
41
|
-
"@ndla/util": "^5.0.
|
|
41
|
+
"@ndla/util": "^5.0.8-alpha.0",
|
|
42
42
|
"html-react-parser": "^5.1.19"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"react": ">= 18",
|
|
47
47
|
"react-dom": ">= 18",
|
|
48
48
|
"react-i18next": "^15.4.1",
|
|
49
|
-
"react-router
|
|
49
|
+
"react-router": ">= 6.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@ndla/preset-panda": "^0.0.
|
|
52
|
+
"@ndla/preset-panda": "^0.0.54",
|
|
53
53
|
"@ndla/types-backend": "^1.0.40",
|
|
54
54
|
"@ndla/types-embed": "^5.0.14-alpha.0",
|
|
55
55
|
"@pandacss/dev": "^0.53.6"
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "d9ad62bb693321e31691b09d045af548f650c049"
|
|
61
61
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import type { TFunction } from "i18next";
|
|
10
10
|
import { type ReactNode, forwardRef, useCallback, useEffect, useState } from "react";
|
|
11
11
|
import { useTranslation } from "react-i18next";
|
|
12
|
-
import { useLocation } from "react-router
|
|
12
|
+
import { useLocation } from "react-router";
|
|
13
13
|
import { ArrowDownShortLine } from "@ndla/icons";
|
|
14
14
|
import {
|
|
15
15
|
AccordionItem,
|
package/src/FileList/File.tsx
CHANGED
|
@@ -58,14 +58,16 @@ const StyledHStack = styled(HStack, {
|
|
|
58
58
|
export const File = forwardRef<HTMLDivElement, FileProps>(
|
|
59
59
|
({ title, url, fileExists, fileType, fileSize, ...rest }, ref) => {
|
|
60
60
|
const { t } = useTranslation();
|
|
61
|
-
const
|
|
61
|
+
const filename = `${title}-${url.split("/").pop() ?? ""}`;
|
|
62
|
+
const downloadUrl = `${url}?download=${filename}`;
|
|
63
|
+
const tooltip = `${t("download")} ${filename}`;
|
|
62
64
|
|
|
63
65
|
return (
|
|
64
66
|
<StyledHStack justify="space-between" ref={ref} {...rest}>
|
|
65
67
|
<HStack gap="xxsmall">
|
|
66
68
|
<DownloadLine />
|
|
67
69
|
{fileExists ? (
|
|
68
|
-
<StyledSafeLink unstyled css={linkOverlay.raw()} to={
|
|
70
|
+
<StyledSafeLink unstyled css={linkOverlay.raw()} to={downloadUrl} title={tooltip}>
|
|
69
71
|
{title}
|
|
70
72
|
</StyledSafeLink>
|
|
71
73
|
) : (
|
package/src/index.ts
CHANGED
|
@@ -132,8 +132,6 @@ 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
|
-
|
|
137
135
|
export { ZendeskButton } from "./ZendeskButton/ZendeskButton";
|
|
138
136
|
|
|
139
137
|
export type { ZendeskButtonProps } from "./ZendeskButton/ZendeskButton";
|
|
@@ -1,21 +0,0 @@
|
|
|
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;
|
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1,27 +0,0 @@
|
|
|
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;
|
|
@@ -1,13 +0,0 @@
|
|
|
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 }; }
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|