@ndla/ui 56.0.184-alpha.0 → 56.0.186-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/dist/panda.buildinfo.json +5 -22
- package/dist/styles.css +8 -127
- package/es/Article/ArticleByline.mjs +2 -1
- package/es/Article/ArticleByline.mjs.map +1 -1
- package/es/Breadcrumb/BreadcrumbItem.mjs +1 -2
- package/es/Breadcrumb/BreadcrumbItem.mjs.map +1 -1
- package/es/Embed/AudioEmbed.mjs +1 -2
- package/es/Embed/AudioEmbed.mjs.map +1 -1
- package/es/Embed/ExternalEmbed.mjs +13 -16
- package/es/Embed/ExternalEmbed.mjs.map +1 -1
- package/es/Embed/IframeEmbed.mjs +4 -5
- package/es/Embed/IframeEmbed.mjs.map +1 -1
- package/es/FactBox/FactBox.mjs +14 -38
- package/es/FactBox/FactBox.mjs.map +1 -1
- package/es/Grid/Grid.mjs +1 -2
- package/es/Grid/Grid.mjs.map +1 -1
- package/es/LinkBlock/LinkBlock.mjs +9 -2
- package/es/LinkBlock/LinkBlock.mjs.map +1 -1
- package/es/Pitch/Pitch.mjs +1 -2
- package/es/Pitch/Pitch.mjs.map +1 -1
- package/lib/Article/ArticleByline.js +2 -1
- package/lib/Article/ArticleByline.js.map +1 -1
- package/lib/Breadcrumb/BreadcrumbItem.js +1 -2
- package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -1
- package/lib/Embed/AudioEmbed.js +1 -2
- package/lib/Embed/AudioEmbed.js.map +1 -1
- package/lib/Embed/ExternalEmbed.js +13 -16
- package/lib/Embed/ExternalEmbed.js.map +1 -1
- package/lib/Embed/IframeEmbed.js +4 -5
- package/lib/Embed/IframeEmbed.js.map +1 -1
- package/lib/FactBox/FactBox.js +13 -37
- package/lib/FactBox/FactBox.js.map +1 -1
- package/lib/Grid/Grid.js +1 -2
- package/lib/Grid/Grid.js.map +1 -1
- package/lib/LinkBlock/LinkBlock.js +9 -2
- package/lib/LinkBlock/LinkBlock.js.map +1 -1
- package/lib/Pitch/Pitch.js +1 -2
- package/lib/Pitch/Pitch.js.map +1 -1
- package/package.json +11 -11
- package/src/Article/ArticleByline.tsx +5 -1
- package/src/FactBox/FactBox.tsx +13 -43
- package/src/LinkBlock/LinkBlock.tsx +5 -2
package/lib/Pitch/Pitch.js
CHANGED
|
@@ -29,7 +29,6 @@ const StyledCardImage = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.Car
|
|
|
29
29
|
height: "unset"
|
|
30
30
|
} });
|
|
31
31
|
const Pitch = ({ title, url, metaImage, path, description }) => {
|
|
32
|
-
const href = require_relativeUrl.getPossiblyRelativeUrl(url, path);
|
|
33
32
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledCardRoot, {
|
|
34
33
|
nonInteractive: true,
|
|
35
34
|
"data-embed-type": "pitch",
|
|
@@ -41,7 +40,7 @@ const Pitch = ({ title, url, metaImage, path, description }) => {
|
|
|
41
40
|
asChild: true,
|
|
42
41
|
consumeCss: true,
|
|
43
42
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_safelink.SafeLink, {
|
|
44
|
-
to:
|
|
43
|
+
to: require_relativeUrl.getPossiblyRelativeUrl(url, path),
|
|
45
44
|
unstyled: true,
|
|
46
45
|
css: _ndla_styled_system_patterns.linkOverlay.raw(),
|
|
47
46
|
children: (0, html_react_parser.default)(title)
|
package/lib/Pitch/Pitch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pitch.js","names":["CardHeading","Text","CardRoot","CardImage","
|
|
1
|
+
{"version":3,"file":"Pitch.js","names":["CardHeading","Text","CardRoot","CardImage","SafeLink","getPossiblyRelativeUrl","linkOverlay"],"sources":["../../src/Pitch/Pitch.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { CardHeading, CardImage, CardRoot, Text } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { linkOverlay } from \"@ndla/styled-system/patterns\";\nimport parse from \"html-react-parser\";\nimport { getPossiblyRelativeUrl } from \"../utils/relativeUrl\";\n\nexport interface Props {\n title: string;\n url: string;\n description?: string;\n metaImage: {\n url: string;\n alt: string;\n };\n path?: string;\n}\n\nconst StyledCardHeading = styled(CardHeading, {\n base: {\n paddingBlockStart: \"medium\",\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n paddingBlockEnd: \"medium\",\n },\n});\n\nconst StyledCardRoot = styled(CardRoot, {\n base: {\n outline: \"0px\",\n boxShadow: \"none\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"small\",\n },\n});\n\nconst StyledCardImage = styled(CardImage, {\n base: {\n aspectRatio: \"16/9\",\n height: \"unset\",\n },\n});\n\nexport const Pitch = ({ title, url, metaImage, path, description }: Props) => {\n const href = getPossiblyRelativeUrl(url, path);\n\n return (\n <StyledCardRoot nonInteractive data-embed-type=\"pitch\" asChild consumeCss>\n <div>\n <StyledCardHeading textStyle=\"heading.small\" asChild consumeCss>\n <SafeLink to={href} unstyled css={linkOverlay.raw()}>\n {parse(title)}\n </SafeLink>\n </StyledCardHeading>\n {!!description && (\n <StyledText textStyle=\"body.xlarge\" asChild consumeCss>\n <div>{parse(description)}</div>\n </StyledText>\n )}\n <StyledCardImage\n variant=\"rounded\"\n src={metaImage.url}\n alt={metaImage.alt}\n sizes=\"480px\"\n fallbackWidth={300}\n width={550}\n height={310}\n />\n </div>\n </StyledCardRoot>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,MAAM,qBAAA,GAAA,wBAAA,QAA2BA,iBAAAA,aAAa,EAC5C,MAAM,EACJ,mBAAmB,UACpB,EACF,CAAC;AAEF,MAAM,cAAA,GAAA,wBAAA,QAAoBC,iBAAAA,MAAM,EAC9B,MAAM,EACJ,iBAAiB,UAClB,EAC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0",
|
|
5
5
|
"description": "UI component library for NDLA",
|
|
6
6
|
"license": "GPL-3.0",
|
|
7
7
|
"exports": {
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@ark-ui/react": "^5.34.1",
|
|
40
40
|
"@ndla/core": "^6.0.7-alpha.0",
|
|
41
|
-
"@ndla/icons": "^8.0.
|
|
41
|
+
"@ndla/icons": "^8.0.89-alpha.0",
|
|
42
42
|
"@ndla/licenses": "^10.0.11-alpha.0",
|
|
43
|
-
"@ndla/locales": "^0.0.
|
|
44
|
-
"@ndla/primitives": "^1.0.
|
|
45
|
-
"@ndla/safelink": "^7.0.
|
|
46
|
-
"@ndla/styled-system": "^0.0.
|
|
47
|
-
"@ndla/util": "^5.0.
|
|
48
|
-
"html-react-parser": "^
|
|
43
|
+
"@ndla/locales": "^0.0.3",
|
|
44
|
+
"@ndla/primitives": "^1.0.128-alpha.0",
|
|
45
|
+
"@ndla/safelink": "^7.0.131-alpha.0",
|
|
46
|
+
"@ndla/styled-system": "^0.0.49",
|
|
47
|
+
"@ndla/util": "^5.0.21-alpha.0",
|
|
48
|
+
"html-react-parser": "^6.0.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"i18next": ">= 25.0.0",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"react-router": ">= 7.0.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@ndla/preset-panda": "^0.0.
|
|
58
|
+
"@ndla/preset-panda": "^0.0.76",
|
|
59
59
|
"@ndla/types-backend": "^1.0.89",
|
|
60
60
|
"@ndla/types-embed": "^5.0.21-alpha.0",
|
|
61
|
-
"@pandacss/dev": "^1.
|
|
61
|
+
"@pandacss/dev": "^1.10.0"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "f8a73392a71c05f052f6cc69d55ca57c38e0db5b"
|
|
67
67
|
}
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "@ndla/primitives";
|
|
20
20
|
import { SafeLink } from "@ndla/safelink";
|
|
21
21
|
import { styled } from "@ndla/styled-system/jsx";
|
|
22
|
+
import { toIntlLanguage } from "@ndla/util";
|
|
22
23
|
import { type ReactNode, forwardRef, useCallback, useEffect, useRef } from "react";
|
|
23
24
|
import { useTranslation } from "react-i18next";
|
|
24
25
|
import type { FootNote } from "../types";
|
|
@@ -112,7 +113,10 @@ export const ArticleByline = ({
|
|
|
112
113
|
const { t, i18n } = useTranslation();
|
|
113
114
|
|
|
114
115
|
const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;
|
|
115
|
-
const listFormatter = new Intl.ListFormat(lang ?? i18n.language, {
|
|
116
|
+
const listFormatter = new Intl.ListFormat(toIntlLanguage(lang ?? i18n.language), {
|
|
117
|
+
style: "long",
|
|
118
|
+
type: "conjunction",
|
|
119
|
+
});
|
|
116
120
|
|
|
117
121
|
return (
|
|
118
122
|
<Wrapper>
|
package/src/FactBox/FactBox.tsx
CHANGED
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import { IconButton } from "@ndla/primitives";
|
|
9
|
+
import { Button } from "@ndla/primitives";
|
|
11
10
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
11
|
import React, {
|
|
13
12
|
type ComponentProps,
|
|
@@ -45,11 +44,10 @@ const StyledAside = styled("aside", {
|
|
|
45
44
|
_open: {
|
|
46
45
|
gridTemplateRows: "1fr",
|
|
47
46
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
47
|
+
_print: {
|
|
48
|
+
gridTemplateRows: "1fr",
|
|
49
|
+
overflow: "visible",
|
|
50
|
+
maxHeight: "500vh",
|
|
53
51
|
},
|
|
54
52
|
"& > div": {
|
|
55
53
|
minHeight: "surface.3xsmall",
|
|
@@ -60,6 +58,9 @@ const StyledAside = styled("aside", {
|
|
|
60
58
|
true: {
|
|
61
59
|
"& > div": {
|
|
62
60
|
overflow: "hidden",
|
|
61
|
+
_print: {
|
|
62
|
+
overflow: "visible",
|
|
63
|
+
},
|
|
63
64
|
},
|
|
64
65
|
},
|
|
65
66
|
},
|
|
@@ -74,51 +75,20 @@ const StyledContent = styled("div", {
|
|
|
74
75
|
"& :first-child": {
|
|
75
76
|
marginBlockStart: "0",
|
|
76
77
|
},
|
|
77
|
-
_after: {
|
|
78
|
-
content: '""',
|
|
79
|
-
textAlign: "center",
|
|
80
|
-
position: "absolute",
|
|
81
|
-
inset: "0",
|
|
82
|
-
transitionProperty: "opacity",
|
|
83
|
-
transitionDuration: "slow",
|
|
84
|
-
transitionTimingFunction: "ease-in-out",
|
|
85
|
-
gradientFrom: "surface.default/20",
|
|
86
|
-
gradientTo: "surface.default/95",
|
|
87
|
-
backgroundGradient: "to-b",
|
|
88
|
-
opacity: "1",
|
|
89
|
-
zIndex: "base",
|
|
90
|
-
pointerEvents: "none",
|
|
91
|
-
},
|
|
92
78
|
_print: {
|
|
93
79
|
overflow: "visible",
|
|
94
|
-
_after: {
|
|
95
|
-
display: "none",
|
|
96
|
-
},
|
|
97
80
|
},
|
|
98
81
|
_open: {
|
|
99
82
|
paddingBlockEnd: "xsmall",
|
|
100
|
-
_after: {
|
|
101
|
-
opacity: "0",
|
|
102
|
-
},
|
|
103
83
|
},
|
|
104
84
|
},
|
|
105
85
|
});
|
|
106
86
|
|
|
107
|
-
const
|
|
87
|
+
const StyledButton = styled(Button, {
|
|
108
88
|
base: {
|
|
109
89
|
position: "absolute",
|
|
110
90
|
bottom: "-medium",
|
|
111
91
|
zIndex: "base",
|
|
112
|
-
"& svg": {
|
|
113
|
-
transitionProperty: "transform",
|
|
114
|
-
transitionTimingFunction: "ease-in-out",
|
|
115
|
-
transitionDuration: "fast",
|
|
116
|
-
},
|
|
117
|
-
_open: {
|
|
118
|
-
"& svg": {
|
|
119
|
-
transform: "rotate(180deg)",
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
92
|
_print: {
|
|
123
93
|
display: "none",
|
|
124
94
|
},
|
|
@@ -170,16 +140,16 @@ export const FactBox = forwardRef<HTMLElement, Props>(
|
|
|
170
140
|
}
|
|
171
141
|
}}
|
|
172
142
|
>
|
|
173
|
-
<
|
|
143
|
+
<StyledButton
|
|
174
144
|
data-state={state}
|
|
175
145
|
onClick={onClick}
|
|
176
146
|
contentEditable={false}
|
|
177
147
|
aria-expanded={state === "open"}
|
|
148
|
+
variant="secondary"
|
|
178
149
|
aria-controls={contentId}
|
|
179
|
-
aria-label={t(`factbox.${state === "open" ? "close" : "open"}`)}
|
|
180
150
|
>
|
|
181
|
-
|
|
182
|
-
</
|
|
151
|
+
{t(`factbox.${state === "open" ? "showLess" : "showMore"}`)}
|
|
152
|
+
</StyledButton>
|
|
183
153
|
<StyledContent id={contentId} data-state={state} aria-hidden={state === "closed"} {...inertAttribute}>
|
|
184
154
|
{children}
|
|
185
155
|
</StyledContent>
|
|
@@ -11,8 +11,10 @@ import { Heading } from "@ndla/primitives";
|
|
|
11
11
|
import { SafeLink } from "@ndla/safelink";
|
|
12
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
13
13
|
import type { LinkBlockEmbedData } from "@ndla/types-embed";
|
|
14
|
+
import { toIntlLanguage } from "@ndla/util";
|
|
14
15
|
import parse from "html-react-parser";
|
|
15
16
|
import { useMemo } from "react";
|
|
17
|
+
import { useTranslation } from "react-i18next";
|
|
16
18
|
import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
|
|
17
19
|
|
|
18
20
|
const InfoWrapper = styled("div", {
|
|
@@ -73,16 +75,17 @@ interface Props extends Omit<LinkBlockEmbedData, "resource"> {
|
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
export const LinkBlock = ({ title, articleLanguage, date, url, path }: Props) => {
|
|
78
|
+
const { i18n } = useTranslation();
|
|
76
79
|
const href = getPossiblyRelativeUrl(url, path);
|
|
77
80
|
const formattedDate = useMemo(() => {
|
|
78
81
|
if (!date) return null;
|
|
79
|
-
return new Intl.DateTimeFormat(articleLanguage, {
|
|
82
|
+
return new Intl.DateTimeFormat(toIntlLanguage(articleLanguage ?? i18n.language), {
|
|
80
83
|
timeZone: "CET",
|
|
81
84
|
day: "2-digit",
|
|
82
85
|
month: "long",
|
|
83
86
|
year: "numeric",
|
|
84
87
|
}).format(new Date(date));
|
|
85
|
-
}, [date, articleLanguage]);
|
|
88
|
+
}, [date, articleLanguage, i18n.language]);
|
|
86
89
|
return (
|
|
87
90
|
<StyledSafeLink to={href} data-embed-type="link-block">
|
|
88
91
|
<InfoWrapper>
|