@ndla/ui 56.0.87-alpha.0 → 56.0.89-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 -4
- package/dist/styles.css +14 -10
- package/es/Article/Article.js +17 -4
- package/es/Embed/GlossEmbed.js +5 -1
- package/es/Embed/UuDisclaimerEmbed.js +46 -41
- package/es/locale/messages-en.js +5 -1
- package/es/locale/messages-nb.js +5 -1
- package/es/locale/messages-nn.js +5 -1
- package/es/locale/messages-se.js +5 -1
- package/es/locale/messages-sma.js +5 -1
- package/lib/Article/Article.d.ts +4 -2
- package/lib/Article/Article.js +17 -4
- package/lib/Embed/GlossEmbed.js +5 -1
- package/lib/Embed/UuDisclaimerEmbed.d.ts +2 -1
- package/lib/Embed/UuDisclaimerEmbed.js +44 -39
- package/lib/locale/messages-en.d.ts +4 -0
- package/lib/locale/messages-en.js +5 -1
- package/lib/locale/messages-nb.d.ts +4 -0
- package/lib/locale/messages-nb.js +5 -1
- package/lib/locale/messages-nn.d.ts +4 -0
- package/lib/locale/messages-nn.js +5 -1
- package/lib/locale/messages-se.d.ts +4 -0
- package/lib/locale/messages-se.js +5 -1
- package/lib/locale/messages-sma.d.ts +4 -0
- package/lib/locale/messages-sma.js +5 -1
- package/package.json +4 -4
- package/src/Article/Article.tsx +18 -1
- package/src/Embed/GlossEmbed.tsx +15 -2
- package/src/Embed/UuDisclaimerEmbed.stories.tsx +35 -32
- package/src/Embed/UuDisclaimerEmbed.tsx +46 -43
- package/src/locale/messages-en.ts +2 -0
- package/src/locale/messages-nb.ts +2 -0
- package/src/locale/messages-nn.ts +2 -0
- package/src/locale/messages-se.ts +2 -0
- package/src/locale/messages-sma.ts +2 -0
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
"gap]___[value:xxlarge",
|
|
23
23
|
"paddingBlockEnd]___[value:5xlarge]___[cond:& > :is(:last-child)",
|
|
24
24
|
"minHeight]___[value:xxlarge",
|
|
25
|
+
"gap]___[value:small",
|
|
26
|
+
"flexWrap]___[value:wrap",
|
|
25
27
|
"marginBlockStart]___[value:medium",
|
|
26
28
|
"paddingBlockStart]___[value:xsmall",
|
|
27
29
|
"borderTop]___[value:1px solid",
|
|
@@ -99,7 +101,6 @@
|
|
|
99
101
|
"height]___[value:surface.3xsmall",
|
|
100
102
|
"minWidth]___[value:small",
|
|
101
103
|
"paddingInline]___[value:small",
|
|
102
|
-
"flexWrap]___[value:wrap",
|
|
103
104
|
"alignItems]___[value:flex-start]___[cond:mobileDown",
|
|
104
105
|
"justifyContent]___[value:center]___[cond:mobileDown",
|
|
105
106
|
"flexDirection]___[value:column]___[cond:mobileDown",
|
|
@@ -220,7 +221,6 @@
|
|
|
220
221
|
"width]___[value:100%]___[cond:& iframe",
|
|
221
222
|
"color]___[value:text.link",
|
|
222
223
|
"textDecoration]___[value:unset]___[cond:_hover",
|
|
223
|
-
"gap]___[value:small",
|
|
224
224
|
"backgroundColor]___[value:surface.brand.2.subtle",
|
|
225
225
|
"borderRadius]___[value:xxsmall",
|
|
226
226
|
"borderColor]___[value:stroke.info",
|
|
@@ -251,8 +251,8 @@
|
|
|
251
251
|
"transitionProperty]___[value:transform]___[cond:& svg",
|
|
252
252
|
"transitionDuration]___[value:normal]___[cond:& svg",
|
|
253
253
|
"transitionTimingFunction]___[value:ease-out]___[cond:& svg",
|
|
254
|
-
"
|
|
255
|
-
"
|
|
254
|
+
"alignSelf]___[value:flex-end",
|
|
255
|
+
"fill]___[value:icon.subtle",
|
|
256
256
|
"color]___[value:text.strong]___[cond:& a",
|
|
257
257
|
"marginTop]___[value:0]___[cond:& h1",
|
|
258
258
|
"marginBottom]___[value:medium",
|
|
@@ -352,6 +352,7 @@
|
|
|
352
352
|
"whiteSpace]___[value:pre-wrap]___[cond:mobileWideDown<___>_open",
|
|
353
353
|
"maxHeight]___[value:none]___[cond:mobileWideDown<___>_open",
|
|
354
354
|
"display]___[value:none]___[cond:mobileWide",
|
|
355
|
+
"textDecoration]___[value:none]___[cond:_focusWithin",
|
|
355
356
|
"display]___[value:none]___[cond:mobileWideDown<___>_disabled",
|
|
356
357
|
"textDecoration]___[value:underline]___[cond:& h3",
|
|
357
358
|
"transitionProperty]___[value:width, height]___[cond:& [data-forward]",
|
package/dist/styles.css
CHANGED
|
@@ -160,6 +160,10 @@
|
|
|
160
160
|
min-height: var(--sizes-xxlarge);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
.gap_small {
|
|
164
|
+
gap: var(--spacing-small);
|
|
165
|
+
}
|
|
166
|
+
|
|
163
167
|
.mbs_medium {
|
|
164
168
|
margin-block-start: var(--spacing-medium);
|
|
165
169
|
}
|
|
@@ -445,10 +449,6 @@
|
|
|
445
449
|
color: var(--colors-text-link);
|
|
446
450
|
}
|
|
447
451
|
|
|
448
|
-
.gap_small {
|
|
449
|
-
gap: var(--spacing-small);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
452
|
.bdr_xxsmall {
|
|
453
453
|
border-radius: xxsmall;
|
|
454
454
|
}
|
|
@@ -489,8 +489,8 @@
|
|
|
489
489
|
border-radius: var(--radii-large);
|
|
490
490
|
}
|
|
491
491
|
|
|
492
|
-
.
|
|
493
|
-
|
|
492
|
+
.fill_icon\.subtle {
|
|
493
|
+
fill: var(--colors-icon-subtle);
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
.my_xxlarge {
|
|
@@ -589,6 +589,10 @@
|
|
|
589
589
|
align-items: flex-start;
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
+
.flex-wrap_wrap {
|
|
593
|
+
flex-wrap: wrap;
|
|
594
|
+
}
|
|
595
|
+
|
|
592
596
|
.bd-c_stroke\.subtle {
|
|
593
597
|
border-color: var(--colors-stroke-subtle);
|
|
594
598
|
}
|
|
@@ -617,10 +621,6 @@
|
|
|
617
621
|
flex-shrink: 0;
|
|
618
622
|
}
|
|
619
623
|
|
|
620
|
-
.flex-wrap_wrap {
|
|
621
|
-
flex-wrap: wrap;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
624
|
.ai_flex-end {
|
|
625
625
|
align-items: flex-end;
|
|
626
626
|
}
|
|
@@ -716,6 +716,10 @@
|
|
|
716
716
|
background-color: var(--colors-surface-action);
|
|
717
717
|
}
|
|
718
718
|
|
|
719
|
+
.as_flex-end {
|
|
720
|
+
align-self: flex-end;
|
|
721
|
+
}
|
|
722
|
+
|
|
719
723
|
.mb_medium {
|
|
720
724
|
margin-bottom: var(--spacing-medium);
|
|
721
725
|
}
|
package/es/Article/Article.js
CHANGED
|
@@ -100,6 +100,14 @@ const StyledStack = styled(Stack, {
|
|
|
100
100
|
minHeight: "xxlarge"
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
+
const StyledWrapper = styled("div", {
|
|
104
|
+
base: {
|
|
105
|
+
display: "flex",
|
|
106
|
+
gap: "small",
|
|
107
|
+
flexWrap: "wrap",
|
|
108
|
+
alignItems: "center"
|
|
109
|
+
}
|
|
110
|
+
});
|
|
103
111
|
export const ArticleTitle = _ref2 => {
|
|
104
112
|
let {
|
|
105
113
|
contentType,
|
|
@@ -109,7 +117,8 @@ export const ArticleTitle = _ref2 => {
|
|
|
109
117
|
id,
|
|
110
118
|
introduction,
|
|
111
119
|
contentTypeLabel,
|
|
112
|
-
competenceGoals
|
|
120
|
+
competenceGoals,
|
|
121
|
+
disclaimer
|
|
113
122
|
} = _ref2;
|
|
114
123
|
return /*#__PURE__*/_jsxs(ArticleHeader, {
|
|
115
124
|
children: [/*#__PURE__*/_jsxs(ArticleHGroup, {
|
|
@@ -137,7 +146,9 @@ export const ArticleTitle = _ref2 => {
|
|
|
137
146
|
children: /*#__PURE__*/_jsx("div", {
|
|
138
147
|
children: introduction
|
|
139
148
|
})
|
|
140
|
-
}),
|
|
149
|
+
}), /*#__PURE__*/_jsxs(StyledWrapper, {
|
|
150
|
+
children: [competenceGoals, disclaimer]
|
|
151
|
+
})]
|
|
141
152
|
});
|
|
142
153
|
};
|
|
143
154
|
export const Article = _ref3 => {
|
|
@@ -150,7 +161,8 @@ export const Article = _ref3 => {
|
|
|
150
161
|
contentTypeLabel,
|
|
151
162
|
id,
|
|
152
163
|
heartButton,
|
|
153
|
-
lang
|
|
164
|
+
lang,
|
|
165
|
+
disclaimer
|
|
154
166
|
} = _ref3;
|
|
155
167
|
const {
|
|
156
168
|
title,
|
|
@@ -170,7 +182,8 @@ export const Article = _ref3 => {
|
|
|
170
182
|
introduction: introduction,
|
|
171
183
|
competenceGoals: competenceGoals,
|
|
172
184
|
lang: lang,
|
|
173
|
-
contentTypeLabel: contentTypeLabel
|
|
185
|
+
contentTypeLabel: contentTypeLabel,
|
|
186
|
+
disclaimer: disclaimer
|
|
174
187
|
}), /*#__PURE__*/_jsx(ArticleContent, {
|
|
175
188
|
children: content
|
|
176
189
|
}), /*#__PURE__*/_jsxs(ArticleFooter, {
|
package/es/Embed/GlossEmbed.js
CHANGED
|
@@ -57,7 +57,9 @@ export const GlossEmbed = _ref => {
|
|
|
57
57
|
children: /*#__PURE__*/_jsx(Gloss, {
|
|
58
58
|
glossData: concept.glossData,
|
|
59
59
|
title: concept.title,
|
|
60
|
-
audio: audio
|
|
60
|
+
audio: audio,
|
|
61
|
+
exampleIds: embed.embedData.exampleIds,
|
|
62
|
+
exampleLangs: embed.embedData.exampleLangs
|
|
61
63
|
})
|
|
62
64
|
})
|
|
63
65
|
})
|
|
@@ -70,6 +72,8 @@ export const GlossEmbed = _ref => {
|
|
|
70
72
|
glossData: concept.glossData,
|
|
71
73
|
title: concept.title,
|
|
72
74
|
audio: audio,
|
|
75
|
+
exampleIds: embed.embedData.exampleIds,
|
|
76
|
+
exampleLangs: embed.embedData.exampleLangs,
|
|
73
77
|
variant: "bordered"
|
|
74
78
|
})
|
|
75
79
|
});
|
|
@@ -6,68 +6,73 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { useTranslation } from "react-i18next";
|
|
10
|
+
import { Portal } from "@ark-ui/react";
|
|
11
|
+
import { AccessibilityFill, ErrorWarningFill } from "@ndla/icons";
|
|
12
|
+
import { IconButton, PopoverContent, PopoverRoot, PopoverTrigger, PopoverTitle } from "@ndla/primitives";
|
|
12
13
|
import { styled } from "@ndla/styled-system/jsx";
|
|
13
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
const
|
|
15
|
+
const DisclaimerWrapper = styled("div", {
|
|
15
16
|
base: {
|
|
16
17
|
display: "flex",
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
flexDirection: "column",
|
|
19
|
+
gap: "3xsmall",
|
|
20
|
+
clear: "both"
|
|
19
21
|
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const StyledIconButton = styled(IconButton, {
|
|
22
24
|
base: {
|
|
23
|
-
|
|
25
|
+
alignSelf: "flex-end"
|
|
24
26
|
}
|
|
25
27
|
});
|
|
26
|
-
const
|
|
28
|
+
const StyledErrorWarningFill = styled(ErrorWarningFill, {
|
|
27
29
|
base: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
textDecoration: "underline",
|
|
31
|
-
whiteSpace: "nowrap",
|
|
32
|
-
_hover: {
|
|
33
|
-
textDecoration: "none"
|
|
34
|
-
},
|
|
35
|
-
_focusWithin: {
|
|
36
|
-
textDecoration: "none"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
const Wrapper = styled("div", {
|
|
41
|
-
base: {
|
|
42
|
-
clear: "both"
|
|
30
|
+
alignSelf: "flex-end",
|
|
31
|
+
fill: "icon.subtle"
|
|
43
32
|
}
|
|
44
33
|
});
|
|
45
34
|
const UuDisclaimerEmbed = _ref => {
|
|
46
35
|
let {
|
|
47
36
|
embed,
|
|
37
|
+
transformedDisclaimer,
|
|
48
38
|
children
|
|
49
39
|
} = _ref;
|
|
40
|
+
const {
|
|
41
|
+
t
|
|
42
|
+
} = useTranslation();
|
|
50
43
|
if (embed.status === "error") {
|
|
51
|
-
return
|
|
44
|
+
return /*#__PURE__*/_jsxs(DisclaimerWrapper, {
|
|
45
|
+
children: [/*#__PURE__*/_jsx(StyledErrorWarningFill, {
|
|
46
|
+
"aria-label": t("embed.embedError", {
|
|
47
|
+
type: t("embed.type.disclaimer")
|
|
48
|
+
}),
|
|
49
|
+
title: t("embed.embedError", {
|
|
50
|
+
type: t("embed.type.disclaimer")
|
|
51
|
+
})
|
|
52
|
+
}), children]
|
|
53
|
+
});
|
|
52
54
|
}
|
|
53
|
-
|
|
54
|
-
embedData,
|
|
55
|
-
data
|
|
56
|
-
} = embed;
|
|
57
|
-
const disclaimerLink = data?.disclaimerLink ? /*#__PURE__*/_jsx(StyledSafeLink, {
|
|
58
|
-
to: data.disclaimerLink.href,
|
|
59
|
-
target: "_blank",
|
|
60
|
-
rel: "noopener noreferrer",
|
|
61
|
-
children: data.disclaimerLink.text
|
|
62
|
-
}) : null;
|
|
63
|
-
return /*#__PURE__*/_jsxs(Wrapper, {
|
|
55
|
+
return /*#__PURE__*/_jsxs(DisclaimerWrapper, {
|
|
64
56
|
role: "region",
|
|
65
57
|
"data-embed-type": "uu-disclaimer",
|
|
66
|
-
children: [/*#__PURE__*/_jsxs(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
children: [/*#__PURE__*/_jsxs(PopoverRoot, {
|
|
59
|
+
children: [/*#__PURE__*/_jsx(PopoverTrigger, {
|
|
60
|
+
asChild: true,
|
|
61
|
+
children: /*#__PURE__*/_jsx(StyledIconButton, {
|
|
62
|
+
size: "small",
|
|
63
|
+
variant: "secondary",
|
|
64
|
+
"aria-label": t("uuDisclaimer.title"),
|
|
65
|
+
title: t("uuDisclaimer.title"),
|
|
66
|
+
children: /*#__PURE__*/_jsx(AccessibilityFill, {})
|
|
67
|
+
})
|
|
68
|
+
}), /*#__PURE__*/_jsx(Portal, {
|
|
69
|
+
children: /*#__PURE__*/_jsxs(PopoverContent, {
|
|
70
|
+
children: [/*#__PURE__*/_jsx(PopoverTitle, {
|
|
71
|
+
children: t("uuDisclaimer.title")
|
|
72
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
73
|
+
children: transformedDisclaimer
|
|
74
|
+
})]
|
|
75
|
+
})
|
|
71
76
|
})]
|
|
72
77
|
}), /*#__PURE__*/_jsx("div", {
|
|
73
78
|
"data-uu-content": "",
|
package/es/locale/messages-en.js
CHANGED
|
@@ -1405,9 +1405,13 @@ const messages = {
|
|
|
1405
1405
|
external: "External resource",
|
|
1406
1406
|
gloss: "Gloss",
|
|
1407
1407
|
copyright: "Text",
|
|
1408
|
-
code: "Code block"
|
|
1408
|
+
code: "Code block",
|
|
1409
|
+
disclaimer: "Accessibility warning"
|
|
1409
1410
|
}
|
|
1410
1411
|
},
|
|
1412
|
+
uuDisclaimer: {
|
|
1413
|
+
title: "Accessibility"
|
|
1414
|
+
},
|
|
1411
1415
|
gloss: {
|
|
1412
1416
|
examples: "Examples",
|
|
1413
1417
|
showExamples: "Show examples",
|
package/es/locale/messages-nb.js
CHANGED
|
@@ -1405,9 +1405,13 @@ const messages = {
|
|
|
1405
1405
|
external: "Ekstern ressurs",
|
|
1406
1406
|
gloss: "Glose",
|
|
1407
1407
|
copyright: "Tekst",
|
|
1408
|
-
code: "Kodeblokk"
|
|
1408
|
+
code: "Kodeblokk",
|
|
1409
|
+
disclaimer: "UU-advarsel"
|
|
1409
1410
|
}
|
|
1410
1411
|
},
|
|
1412
|
+
uuDisclaimer: {
|
|
1413
|
+
title: "Tilgjengelighet"
|
|
1414
|
+
},
|
|
1411
1415
|
gloss: {
|
|
1412
1416
|
examples: "Eksempler",
|
|
1413
1417
|
showExamples: "Vis eksempler",
|
package/es/locale/messages-nn.js
CHANGED
|
@@ -1405,9 +1405,13 @@ const messages = {
|
|
|
1405
1405
|
external: "Ekstern ressurs",
|
|
1406
1406
|
gloss: "Glose",
|
|
1407
1407
|
copyright: "Tekst",
|
|
1408
|
-
code: "Kodeblokk"
|
|
1408
|
+
code: "Kodeblokk",
|
|
1409
|
+
disclaimer: "UU-advarsel"
|
|
1409
1410
|
}
|
|
1410
1411
|
},
|
|
1412
|
+
uuDisclaimer: {
|
|
1413
|
+
title: "Tilgjengelighet"
|
|
1414
|
+
},
|
|
1411
1415
|
gloss: {
|
|
1412
1416
|
examples: "Eksempler",
|
|
1413
1417
|
showExamples: "Vis eksempler",
|
package/es/locale/messages-se.js
CHANGED
|
@@ -1405,9 +1405,13 @@ const messages = {
|
|
|
1405
1405
|
external: "Olgguldas resursa",
|
|
1406
1406
|
gloss: "Glose",
|
|
1407
1407
|
copyright: "Tekst",
|
|
1408
|
-
code: "Kodeblokk"
|
|
1408
|
+
code: "Kodeblokk",
|
|
1409
|
+
disclaimer: "UU-advarsel"
|
|
1409
1410
|
}
|
|
1410
1411
|
},
|
|
1412
|
+
uuDisclaimer: {
|
|
1413
|
+
title: "Tilgjengelighet"
|
|
1414
|
+
},
|
|
1411
1415
|
gloss: {
|
|
1412
1416
|
examples: "Ovdamearkkat",
|
|
1413
1417
|
showExamples: "Vis eksempler",
|
|
@@ -1405,9 +1405,13 @@ const messages = {
|
|
|
1405
1405
|
external: "Ekstern ressurs",
|
|
1406
1406
|
gloss: "Glosa",
|
|
1407
1407
|
copyright: "Tekst",
|
|
1408
|
-
code: "Kodeblokk"
|
|
1408
|
+
code: "Kodeblokk",
|
|
1409
|
+
disclaimer: "UU-advarsel"
|
|
1409
1410
|
}
|
|
1410
1411
|
},
|
|
1412
|
+
uuDisclaimer: {
|
|
1413
|
+
title: "Tilgjengelighet"
|
|
1414
|
+
},
|
|
1411
1415
|
gloss: {
|
|
1412
1416
|
examples: "Eksempler",
|
|
1413
1417
|
showExamples: "Vis eksempler",
|
package/lib/Article/Article.d.ts
CHANGED
|
@@ -26,8 +26,9 @@ interface ArticleTitleProps {
|
|
|
26
26
|
lang?: string;
|
|
27
27
|
title?: ReactNode;
|
|
28
28
|
introduction?: ReactNode;
|
|
29
|
+
disclaimer?: ReactNode;
|
|
29
30
|
}
|
|
30
|
-
export declare const ArticleTitle: ({ contentType, heartButton, title, lang, id, introduction, contentTypeLabel, competenceGoals, }: ArticleTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare const ArticleTitle: ({ contentType, heartButton, title, lang, id, introduction, contentTypeLabel, competenceGoals, disclaimer, }: ArticleTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
32
|
interface Props {
|
|
32
33
|
heartButton?: ReactNode;
|
|
33
34
|
article: ArticleType;
|
|
@@ -38,6 +39,7 @@ interface Props {
|
|
|
38
39
|
competenceGoals?: ReactNode;
|
|
39
40
|
id: string;
|
|
40
41
|
lang?: string;
|
|
42
|
+
disclaimer?: ReactNode;
|
|
41
43
|
}
|
|
42
|
-
export declare const Article: ({ article, contentType, licenseBox, children, competenceGoals, contentTypeLabel, id, heartButton, lang, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export declare const Article: ({ article, contentType, licenseBox, children, competenceGoals, contentTypeLabel, id, heartButton, lang, disclaimer, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
43
45
|
export {};
|
package/lib/Article/Article.js
CHANGED
|
@@ -106,6 +106,14 @@ const StyledStack = (0, _jsx2.styled)(_jsx2.Stack, {
|
|
|
106
106
|
minHeight: "xxlarge"
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
+
const StyledWrapper = (0, _jsx2.styled)("div", {
|
|
110
|
+
base: {
|
|
111
|
+
display: "flex",
|
|
112
|
+
gap: "small",
|
|
113
|
+
flexWrap: "wrap",
|
|
114
|
+
alignItems: "center"
|
|
115
|
+
}
|
|
116
|
+
});
|
|
109
117
|
const ArticleTitle = _ref2 => {
|
|
110
118
|
let {
|
|
111
119
|
contentType,
|
|
@@ -115,7 +123,8 @@ const ArticleTitle = _ref2 => {
|
|
|
115
123
|
id,
|
|
116
124
|
introduction,
|
|
117
125
|
contentTypeLabel,
|
|
118
|
-
competenceGoals
|
|
126
|
+
competenceGoals,
|
|
127
|
+
disclaimer
|
|
119
128
|
} = _ref2;
|
|
120
129
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ArticleHeader, {
|
|
121
130
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(ArticleHGroup, {
|
|
@@ -143,7 +152,9 @@ const ArticleTitle = _ref2 => {
|
|
|
143
152
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
144
153
|
children: introduction
|
|
145
154
|
})
|
|
146
|
-
}),
|
|
155
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledWrapper, {
|
|
156
|
+
children: [competenceGoals, disclaimer]
|
|
157
|
+
})]
|
|
147
158
|
});
|
|
148
159
|
};
|
|
149
160
|
exports.ArticleTitle = ArticleTitle;
|
|
@@ -157,7 +168,8 @@ const Article = _ref3 => {
|
|
|
157
168
|
contentTypeLabel,
|
|
158
169
|
id,
|
|
159
170
|
heartButton,
|
|
160
|
-
lang
|
|
171
|
+
lang,
|
|
172
|
+
disclaimer
|
|
161
173
|
} = _ref3;
|
|
162
174
|
const {
|
|
163
175
|
title,
|
|
@@ -177,7 +189,8 @@ const Article = _ref3 => {
|
|
|
177
189
|
introduction: introduction,
|
|
178
190
|
competenceGoals: competenceGoals,
|
|
179
191
|
lang: lang,
|
|
180
|
-
contentTypeLabel: contentTypeLabel
|
|
192
|
+
contentTypeLabel: contentTypeLabel,
|
|
193
|
+
disclaimer: disclaimer
|
|
181
194
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ArticleContent, {
|
|
182
195
|
children: content
|
|
183
196
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(ArticleFooter, {
|
package/lib/Embed/GlossEmbed.js
CHANGED
|
@@ -64,7 +64,9 @@ const GlossEmbed = _ref => {
|
|
|
64
64
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Gloss.Gloss, {
|
|
65
65
|
glossData: concept.glossData,
|
|
66
66
|
title: concept.title,
|
|
67
|
-
audio: audio
|
|
67
|
+
audio: audio,
|
|
68
|
+
exampleIds: embed.embedData.exampleIds,
|
|
69
|
+
exampleLangs: embed.embedData.exampleLangs
|
|
68
70
|
})
|
|
69
71
|
})
|
|
70
72
|
})
|
|
@@ -77,6 +79,8 @@ const GlossEmbed = _ref => {
|
|
|
77
79
|
glossData: concept.glossData,
|
|
78
80
|
title: concept.title,
|
|
79
81
|
audio: audio,
|
|
82
|
+
exampleIds: embed.embedData.exampleIds,
|
|
83
|
+
exampleLangs: embed.embedData.exampleLangs,
|
|
80
84
|
variant: "bordered"
|
|
81
85
|
})
|
|
82
86
|
});
|
|
@@ -9,7 +9,8 @@ import { type ReactNode } from "react";
|
|
|
9
9
|
import type { UuDisclaimerMetaData } from "@ndla/types-embed";
|
|
10
10
|
interface Props {
|
|
11
11
|
embed: UuDisclaimerMetaData;
|
|
12
|
+
transformedDisclaimer: ReactNode;
|
|
12
13
|
children?: ReactNode;
|
|
13
14
|
}
|
|
14
|
-
declare const UuDisclaimerEmbed: ({ embed, children }: Props) => import("react/jsx-runtime").JSX.Element
|
|
15
|
+
declare const UuDisclaimerEmbed: ({ embed, transformedDisclaimer, children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export default UuDisclaimerEmbed;
|
|
@@ -4,9 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _reactI18next = require("react-i18next");
|
|
8
|
+
var _react = require("@ark-ui/react");
|
|
7
9
|
var _icons = require("@ndla/icons");
|
|
8
10
|
var _primitives = require("@ndla/primitives");
|
|
9
|
-
var _safelink = require("@ndla/safelink");
|
|
10
11
|
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
/**
|
|
@@ -17,63 +18,67 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
17
18
|
*
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
|
-
const
|
|
21
|
+
const DisclaimerWrapper = (0, _jsx2.styled)("div", {
|
|
21
22
|
base: {
|
|
22
23
|
display: "flex",
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
flexDirection: "column",
|
|
25
|
+
gap: "3xsmall",
|
|
26
|
+
clear: "both"
|
|
25
27
|
}
|
|
26
28
|
});
|
|
27
|
-
const
|
|
29
|
+
const StyledIconButton = (0, _jsx2.styled)(_primitives.IconButton, {
|
|
28
30
|
base: {
|
|
29
|
-
|
|
31
|
+
alignSelf: "flex-end"
|
|
30
32
|
}
|
|
31
33
|
});
|
|
32
|
-
const
|
|
34
|
+
const StyledErrorWarningFill = (0, _jsx2.styled)(_icons.ErrorWarningFill, {
|
|
33
35
|
base: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
textDecoration: "underline",
|
|
37
|
-
whiteSpace: "nowrap",
|
|
38
|
-
_hover: {
|
|
39
|
-
textDecoration: "none"
|
|
40
|
-
},
|
|
41
|
-
_focusWithin: {
|
|
42
|
-
textDecoration: "none"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
const Wrapper = (0, _jsx2.styled)("div", {
|
|
47
|
-
base: {
|
|
48
|
-
clear: "both"
|
|
36
|
+
alignSelf: "flex-end",
|
|
37
|
+
fill: "icon.subtle"
|
|
49
38
|
}
|
|
50
39
|
});
|
|
51
40
|
const UuDisclaimerEmbed = _ref => {
|
|
52
41
|
let {
|
|
53
42
|
embed,
|
|
43
|
+
transformedDisclaimer,
|
|
54
44
|
children
|
|
55
45
|
} = _ref;
|
|
46
|
+
const {
|
|
47
|
+
t
|
|
48
|
+
} = (0, _reactI18next.useTranslation)();
|
|
56
49
|
if (embed.status === "error") {
|
|
57
|
-
return
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DisclaimerWrapper, {
|
|
51
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StyledErrorWarningFill, {
|
|
52
|
+
"aria-label": t("embed.embedError", {
|
|
53
|
+
type: t("embed.type.disclaimer")
|
|
54
|
+
}),
|
|
55
|
+
title: t("embed.embedError", {
|
|
56
|
+
type: t("embed.type.disclaimer")
|
|
57
|
+
})
|
|
58
|
+
}), children]
|
|
59
|
+
});
|
|
58
60
|
}
|
|
59
|
-
|
|
60
|
-
embedData,
|
|
61
|
-
data
|
|
62
|
-
} = embed;
|
|
63
|
-
const disclaimerLink = data?.disclaimerLink ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSafeLink, {
|
|
64
|
-
to: data.disclaimerLink.href,
|
|
65
|
-
target: "_blank",
|
|
66
|
-
rel: "noopener noreferrer",
|
|
67
|
-
children: data.disclaimerLink.text
|
|
68
|
-
}) : null;
|
|
69
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DisclaimerWrapper, {
|
|
70
62
|
role: "region",
|
|
71
63
|
"data-embed-type": "uu-disclaimer",
|
|
72
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.PopoverRoot, {
|
|
65
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.PopoverTrigger, {
|
|
66
|
+
asChild: true,
|
|
67
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledIconButton, {
|
|
68
|
+
size: "small",
|
|
69
|
+
variant: "secondary",
|
|
70
|
+
"aria-label": t("uuDisclaimer.title"),
|
|
71
|
+
title: t("uuDisclaimer.title"),
|
|
72
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.AccessibilityFill, {})
|
|
73
|
+
})
|
|
74
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Portal, {
|
|
75
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.PopoverContent, {
|
|
76
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.PopoverTitle, {
|
|
77
|
+
children: t("uuDisclaimer.title")
|
|
78
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
79
|
+
children: transformedDisclaimer
|
|
80
|
+
})]
|
|
81
|
+
})
|
|
77
82
|
})]
|
|
78
83
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
79
84
|
"data-uu-content": "",
|
|
@@ -1396,8 +1396,12 @@ declare const messages: {
|
|
|
1396
1396
|
gloss: string;
|
|
1397
1397
|
copyright: string;
|
|
1398
1398
|
code: string;
|
|
1399
|
+
disclaimer: string;
|
|
1399
1400
|
};
|
|
1400
1401
|
};
|
|
1402
|
+
uuDisclaimer: {
|
|
1403
|
+
title: string;
|
|
1404
|
+
};
|
|
1401
1405
|
gloss: {
|
|
1402
1406
|
examples: string;
|
|
1403
1407
|
showExamples: string;
|
|
@@ -1412,9 +1412,13 @@ const messages = {
|
|
|
1412
1412
|
external: "External resource",
|
|
1413
1413
|
gloss: "Gloss",
|
|
1414
1414
|
copyright: "Text",
|
|
1415
|
-
code: "Code block"
|
|
1415
|
+
code: "Code block",
|
|
1416
|
+
disclaimer: "Accessibility warning"
|
|
1416
1417
|
}
|
|
1417
1418
|
},
|
|
1419
|
+
uuDisclaimer: {
|
|
1420
|
+
title: "Accessibility"
|
|
1421
|
+
},
|
|
1418
1422
|
gloss: {
|
|
1419
1423
|
examples: "Examples",
|
|
1420
1424
|
showExamples: "Show examples",
|
|
@@ -1396,8 +1396,12 @@ declare const messages: {
|
|
|
1396
1396
|
gloss: string;
|
|
1397
1397
|
copyright: string;
|
|
1398
1398
|
code: string;
|
|
1399
|
+
disclaimer: string;
|
|
1399
1400
|
};
|
|
1400
1401
|
};
|
|
1402
|
+
uuDisclaimer: {
|
|
1403
|
+
title: string;
|
|
1404
|
+
};
|
|
1401
1405
|
gloss: {
|
|
1402
1406
|
examples: string;
|
|
1403
1407
|
showExamples: string;
|
|
@@ -1412,9 +1412,13 @@ const messages = {
|
|
|
1412
1412
|
external: "Ekstern ressurs",
|
|
1413
1413
|
gloss: "Glose",
|
|
1414
1414
|
copyright: "Tekst",
|
|
1415
|
-
code: "Kodeblokk"
|
|
1415
|
+
code: "Kodeblokk",
|
|
1416
|
+
disclaimer: "UU-advarsel"
|
|
1416
1417
|
}
|
|
1417
1418
|
},
|
|
1419
|
+
uuDisclaimer: {
|
|
1420
|
+
title: "Tilgjengelighet"
|
|
1421
|
+
},
|
|
1418
1422
|
gloss: {
|
|
1419
1423
|
examples: "Eksempler",
|
|
1420
1424
|
showExamples: "Vis eksempler",
|
|
@@ -1396,8 +1396,12 @@ declare const messages: {
|
|
|
1396
1396
|
gloss: string;
|
|
1397
1397
|
copyright: string;
|
|
1398
1398
|
code: string;
|
|
1399
|
+
disclaimer: string;
|
|
1399
1400
|
};
|
|
1400
1401
|
};
|
|
1402
|
+
uuDisclaimer: {
|
|
1403
|
+
title: string;
|
|
1404
|
+
};
|
|
1401
1405
|
gloss: {
|
|
1402
1406
|
examples: string;
|
|
1403
1407
|
showExamples: string;
|
|
@@ -1412,9 +1412,13 @@ const messages = {
|
|
|
1412
1412
|
external: "Ekstern ressurs",
|
|
1413
1413
|
gloss: "Glose",
|
|
1414
1414
|
copyright: "Tekst",
|
|
1415
|
-
code: "Kodeblokk"
|
|
1415
|
+
code: "Kodeblokk",
|
|
1416
|
+
disclaimer: "UU-advarsel"
|
|
1416
1417
|
}
|
|
1417
1418
|
},
|
|
1419
|
+
uuDisclaimer: {
|
|
1420
|
+
title: "Tilgjengelighet"
|
|
1421
|
+
},
|
|
1418
1422
|
gloss: {
|
|
1419
1423
|
examples: "Eksempler",
|
|
1420
1424
|
showExamples: "Vis eksempler",
|
|
@@ -1396,8 +1396,12 @@ declare const messages: {
|
|
|
1396
1396
|
gloss: string;
|
|
1397
1397
|
copyright: string;
|
|
1398
1398
|
code: string;
|
|
1399
|
+
disclaimer: string;
|
|
1399
1400
|
};
|
|
1400
1401
|
};
|
|
1402
|
+
uuDisclaimer: {
|
|
1403
|
+
title: string;
|
|
1404
|
+
};
|
|
1401
1405
|
gloss: {
|
|
1402
1406
|
examples: string;
|
|
1403
1407
|
showExamples: string;
|
|
@@ -1412,9 +1412,13 @@ const messages = {
|
|
|
1412
1412
|
external: "Olgguldas resursa",
|
|
1413
1413
|
gloss: "Glose",
|
|
1414
1414
|
copyright: "Tekst",
|
|
1415
|
-
code: "Kodeblokk"
|
|
1415
|
+
code: "Kodeblokk",
|
|
1416
|
+
disclaimer: "UU-advarsel"
|
|
1416
1417
|
}
|
|
1417
1418
|
},
|
|
1419
|
+
uuDisclaimer: {
|
|
1420
|
+
title: "Tilgjengelighet"
|
|
1421
|
+
},
|
|
1418
1422
|
gloss: {
|
|
1419
1423
|
examples: "Ovdamearkkat",
|
|
1420
1424
|
showExamples: "Vis eksempler",
|
|
@@ -1396,8 +1396,12 @@ declare const messages: {
|
|
|
1396
1396
|
gloss: string;
|
|
1397
1397
|
copyright: string;
|
|
1398
1398
|
code: string;
|
|
1399
|
+
disclaimer: string;
|
|
1399
1400
|
};
|
|
1400
1401
|
};
|
|
1402
|
+
uuDisclaimer: {
|
|
1403
|
+
title: string;
|
|
1404
|
+
};
|
|
1401
1405
|
gloss: {
|
|
1402
1406
|
examples: string;
|
|
1403
1407
|
showExamples: string;
|
|
@@ -1412,9 +1412,13 @@ const messages = {
|
|
|
1412
1412
|
external: "Ekstern ressurs",
|
|
1413
1413
|
gloss: "Glosa",
|
|
1414
1414
|
copyright: "Tekst",
|
|
1415
|
-
code: "Kodeblokk"
|
|
1415
|
+
code: "Kodeblokk",
|
|
1416
|
+
disclaimer: "UU-advarsel"
|
|
1416
1417
|
}
|
|
1417
1418
|
},
|
|
1419
|
+
uuDisclaimer: {
|
|
1420
|
+
title: "Tilgjengelighet"
|
|
1421
|
+
},
|
|
1418
1422
|
gloss: {
|
|
1419
1423
|
examples: "Eksempler",
|
|
1420
1424
|
showExamples: "Vis eksempler",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.89-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.50-alpha.0",
|
|
37
37
|
"@ndla/licenses": "^8.0.6-alpha.0",
|
|
38
38
|
"@ndla/primitives": "^1.0.69-alpha.0",
|
|
39
39
|
"@ndla/safelink": "^7.0.70-alpha.0",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@ndla/preset-panda": "^0.0.49",
|
|
54
54
|
"@ndla/types-backend": "^1.0.1",
|
|
55
|
-
"@ndla/types-embed": "^5.0.
|
|
55
|
+
"@ndla/types-embed": "^5.0.9-alpha.0",
|
|
56
56
|
"@pandacss/dev": "^0.48.0"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "a6b92c306c7340d6ed121afd3e6f5878deba51d9"
|
|
62
62
|
}
|
package/src/Article/Article.tsx
CHANGED
|
@@ -109,6 +109,15 @@ const StyledStack = styled(Stack, {
|
|
|
109
109
|
},
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
+
const StyledWrapper = styled("div", {
|
|
113
|
+
base: {
|
|
114
|
+
display: "flex",
|
|
115
|
+
gap: "small",
|
|
116
|
+
flexWrap: "wrap",
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
112
121
|
interface ArticleTitleProps {
|
|
113
122
|
heartButton?: ReactNode;
|
|
114
123
|
contentType?: ContentType;
|
|
@@ -118,6 +127,7 @@ interface ArticleTitleProps {
|
|
|
118
127
|
lang?: string;
|
|
119
128
|
title?: ReactNode;
|
|
120
129
|
introduction?: ReactNode;
|
|
130
|
+
disclaimer?: ReactNode;
|
|
121
131
|
}
|
|
122
132
|
|
|
123
133
|
export const ArticleTitle = ({
|
|
@@ -129,6 +139,7 @@ export const ArticleTitle = ({
|
|
|
129
139
|
introduction,
|
|
130
140
|
contentTypeLabel,
|
|
131
141
|
competenceGoals,
|
|
142
|
+
disclaimer,
|
|
132
143
|
}: ArticleTitleProps) => {
|
|
133
144
|
return (
|
|
134
145
|
<ArticleHeader>
|
|
@@ -148,7 +159,10 @@ export const ArticleTitle = ({
|
|
|
148
159
|
<div>{introduction}</div>
|
|
149
160
|
</Text>
|
|
150
161
|
)}
|
|
151
|
-
|
|
162
|
+
<StyledWrapper>
|
|
163
|
+
{competenceGoals}
|
|
164
|
+
{disclaimer}
|
|
165
|
+
</StyledWrapper>
|
|
152
166
|
</ArticleHeader>
|
|
153
167
|
);
|
|
154
168
|
};
|
|
@@ -163,6 +177,7 @@ interface Props {
|
|
|
163
177
|
competenceGoals?: ReactNode;
|
|
164
178
|
id: string;
|
|
165
179
|
lang?: string;
|
|
180
|
+
disclaimer?: ReactNode;
|
|
166
181
|
}
|
|
167
182
|
|
|
168
183
|
export const Article = ({
|
|
@@ -175,6 +190,7 @@ export const Article = ({
|
|
|
175
190
|
id,
|
|
176
191
|
heartButton,
|
|
177
192
|
lang,
|
|
193
|
+
disclaimer,
|
|
178
194
|
}: Props) => {
|
|
179
195
|
const { title, introduction, published, content, footNotes, copyright } = article;
|
|
180
196
|
|
|
@@ -192,6 +208,7 @@ export const Article = ({
|
|
|
192
208
|
competenceGoals={competenceGoals}
|
|
193
209
|
lang={lang}
|
|
194
210
|
contentTypeLabel={contentTypeLabel}
|
|
211
|
+
disclaimer={disclaimer}
|
|
195
212
|
/>
|
|
196
213
|
<ArticleContent>{content}</ArticleContent>
|
|
197
214
|
<ArticleFooter>
|
package/src/Embed/GlossEmbed.tsx
CHANGED
|
@@ -53,7 +53,13 @@ export const GlossEmbed = ({ embed }: Props) => {
|
|
|
53
53
|
<Portal>
|
|
54
54
|
<StyledPopoverContent ref={contentRef}>
|
|
55
55
|
<Figure>
|
|
56
|
-
<Gloss
|
|
56
|
+
<Gloss
|
|
57
|
+
glossData={concept.glossData}
|
|
58
|
+
title={concept.title}
|
|
59
|
+
audio={audio}
|
|
60
|
+
exampleIds={embed.embedData.exampleIds}
|
|
61
|
+
exampleLangs={embed.embedData.exampleLangs}
|
|
62
|
+
/>
|
|
57
63
|
</Figure>
|
|
58
64
|
</StyledPopoverContent>
|
|
59
65
|
</Portal>
|
|
@@ -63,7 +69,14 @@ export const GlossEmbed = ({ embed }: Props) => {
|
|
|
63
69
|
|
|
64
70
|
return (
|
|
65
71
|
<Figure data-embed-type="gloss">
|
|
66
|
-
<Gloss
|
|
72
|
+
<Gloss
|
|
73
|
+
glossData={concept.glossData}
|
|
74
|
+
title={concept.title}
|
|
75
|
+
audio={audio}
|
|
76
|
+
exampleIds={embed.embedData.exampleIds}
|
|
77
|
+
exampleLangs={embed.embedData.exampleLangs}
|
|
78
|
+
variant="bordered"
|
|
79
|
+
/>
|
|
67
80
|
</Figure>
|
|
68
81
|
);
|
|
69
82
|
};
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
10
10
|
import { ExpandableBox, ExpandableBoxSummary, FramedContent, PageContent } from "@ndla/primitives";
|
|
11
|
-
import type { UuDisclaimerEmbedData } from "@ndla/types-embed";
|
|
11
|
+
import type { UUDisclaimerData, UuDisclaimerEmbedData } from "@ndla/types-embed";
|
|
12
12
|
import H5pEmbed from "./H5pEmbed";
|
|
13
13
|
import IframeEmbed from "./IframeEmbed";
|
|
14
14
|
import UuDisclaimerEmbed from "./UuDisclaimerEmbed";
|
|
@@ -19,13 +19,17 @@ import FactBox from "../FactBox";
|
|
|
19
19
|
const embedData: UuDisclaimerEmbedData = {
|
|
20
20
|
resource: "uu-disclaimer",
|
|
21
21
|
disclaimer: "Dette inholdet er ikke tastaturvennlig.",
|
|
22
|
-
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const data: UUDisclaimerData = {
|
|
25
|
+
transformedContent: "Dette inholdet er ikke tastaturvennlig.",
|
|
23
26
|
};
|
|
24
27
|
|
|
25
28
|
const meta: Meta<typeof UuDisclaimerEmbed> = {
|
|
26
29
|
title: "Embeds/UuDisclaimerEmbed",
|
|
27
30
|
component: UuDisclaimerEmbed,
|
|
28
31
|
tags: ["autodocs"],
|
|
32
|
+
args: { transformedDisclaimer: data.transformedContent },
|
|
29
33
|
decorators: [
|
|
30
34
|
(Story) => (
|
|
31
35
|
<PageContent variant="content" asChild>
|
|
@@ -46,24 +50,8 @@ export const Regular: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
|
46
50
|
embed: {
|
|
47
51
|
resource: "uu-disclaimer",
|
|
48
52
|
status: "success",
|
|
49
|
-
embedData
|
|
50
|
-
data
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const WithLink: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
56
|
-
args: {
|
|
57
|
-
embed: {
|
|
58
|
-
resource: "uu-disclaimer",
|
|
59
|
-
status: "success",
|
|
60
|
-
embedData: embedData,
|
|
61
|
-
data: {
|
|
62
|
-
disclaimerLink: {
|
|
63
|
-
href: "https://ndla.no/article/123",
|
|
64
|
-
text: "Navn på artikkel med innhold",
|
|
65
|
-
},
|
|
66
|
-
},
|
|
53
|
+
embedData,
|
|
54
|
+
data,
|
|
67
55
|
},
|
|
68
56
|
},
|
|
69
57
|
};
|
|
@@ -73,8 +61,8 @@ export const WithIframe: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
|
73
61
|
embed: {
|
|
74
62
|
resource: "uu-disclaimer",
|
|
75
63
|
status: "success",
|
|
76
|
-
embedData
|
|
77
|
-
data
|
|
64
|
+
embedData,
|
|
65
|
+
data,
|
|
78
66
|
},
|
|
79
67
|
children: (
|
|
80
68
|
<IframeEmbed
|
|
@@ -98,8 +86,8 @@ export const WithH5p: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
|
98
86
|
embed: {
|
|
99
87
|
resource: "uu-disclaimer",
|
|
100
88
|
status: "success",
|
|
101
|
-
embedData
|
|
102
|
-
data
|
|
89
|
+
embedData,
|
|
90
|
+
data,
|
|
103
91
|
},
|
|
104
92
|
children: (
|
|
105
93
|
<H5pEmbed
|
|
@@ -134,8 +122,8 @@ export const WithHtml: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
|
134
122
|
embed: {
|
|
135
123
|
resource: "uu-disclaimer",
|
|
136
124
|
status: "success",
|
|
137
|
-
embedData
|
|
138
|
-
data
|
|
125
|
+
embedData,
|
|
126
|
+
data,
|
|
139
127
|
},
|
|
140
128
|
children: (
|
|
141
129
|
<>
|
|
@@ -154,8 +142,8 @@ export const WithFramedContent: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
|
154
142
|
embed: {
|
|
155
143
|
resource: "uu-disclaimer",
|
|
156
144
|
status: "success",
|
|
157
|
-
embedData
|
|
158
|
-
data
|
|
145
|
+
embedData,
|
|
146
|
+
data,
|
|
159
147
|
},
|
|
160
148
|
children: (
|
|
161
149
|
<FramedContent>
|
|
@@ -170,8 +158,8 @@ export const WithFactBox: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
|
170
158
|
embed: {
|
|
171
159
|
resource: "uu-disclaimer",
|
|
172
160
|
status: "success",
|
|
173
|
-
embedData
|
|
174
|
-
data
|
|
161
|
+
embedData,
|
|
162
|
+
data,
|
|
175
163
|
},
|
|
176
164
|
children: (
|
|
177
165
|
<FactBox>
|
|
@@ -186,8 +174,23 @@ export const WithCopyParagraphLink: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
|
186
174
|
embed: {
|
|
187
175
|
resource: "uu-disclaimer",
|
|
188
176
|
status: "success",
|
|
189
|
-
embedData
|
|
190
|
-
data
|
|
177
|
+
embedData,
|
|
178
|
+
data,
|
|
179
|
+
},
|
|
180
|
+
children: (
|
|
181
|
+
<CopyParagraphButton copyText="Dette er en overskrift" lang="no">
|
|
182
|
+
<h2>Dette er en overskrift</h2>
|
|
183
|
+
</CopyParagraphButton>
|
|
184
|
+
),
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const Error: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
189
|
+
args: {
|
|
190
|
+
embed: {
|
|
191
|
+
resource: "uu-disclaimer",
|
|
192
|
+
status: "error",
|
|
193
|
+
embedData,
|
|
191
194
|
},
|
|
192
195
|
children: (
|
|
193
196
|
<CopyParagraphButton copyText="Dette er en overskrift" lang="no">
|
|
@@ -7,74 +7,77 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { type ReactNode } from "react";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { useTranslation } from "react-i18next";
|
|
11
|
+
import { Portal } from "@ark-ui/react";
|
|
12
|
+
import { AccessibilityFill, ErrorWarningFill } from "@ndla/icons";
|
|
13
|
+
import { IconButton, PopoverContent, PopoverRoot, PopoverTrigger, PopoverTitle } from "@ndla/primitives";
|
|
13
14
|
import { styled } from "@ndla/styled-system/jsx";
|
|
14
15
|
import type { UuDisclaimerMetaData } from "@ndla/types-embed";
|
|
15
16
|
|
|
16
17
|
interface Props {
|
|
17
18
|
embed: UuDisclaimerMetaData;
|
|
19
|
+
transformedDisclaimer: ReactNode;
|
|
18
20
|
children?: ReactNode;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
const
|
|
23
|
+
const DisclaimerWrapper = styled("div", {
|
|
22
24
|
base: {
|
|
23
25
|
display: "flex",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
const Disclaimer = styled("div", {
|
|
29
|
-
base: {
|
|
30
|
-
textStyle: "body.medium",
|
|
26
|
+
flexDirection: "column",
|
|
27
|
+
gap: "3xsmall",
|
|
28
|
+
clear: "both",
|
|
31
29
|
},
|
|
32
30
|
});
|
|
33
|
-
|
|
31
|
+
|
|
32
|
+
const StyledIconButton = styled(IconButton, {
|
|
34
33
|
base: {
|
|
35
|
-
|
|
36
|
-
color: "text.link",
|
|
37
|
-
textDecoration: "underline",
|
|
38
|
-
whiteSpace: "nowrap",
|
|
39
|
-
_hover: {
|
|
40
|
-
textDecoration: "none",
|
|
41
|
-
},
|
|
42
|
-
_focusWithin: {
|
|
43
|
-
textDecoration: "none",
|
|
44
|
-
},
|
|
34
|
+
alignSelf: "flex-end",
|
|
45
35
|
},
|
|
46
36
|
});
|
|
47
37
|
|
|
48
|
-
const
|
|
38
|
+
const StyledErrorWarningFill = styled(ErrorWarningFill, {
|
|
49
39
|
base: {
|
|
50
|
-
|
|
40
|
+
alignSelf: "flex-end",
|
|
41
|
+
fill: "icon.subtle",
|
|
51
42
|
},
|
|
52
43
|
});
|
|
53
44
|
|
|
54
|
-
const UuDisclaimerEmbed = ({ embed, children }: Props) => {
|
|
45
|
+
const UuDisclaimerEmbed = ({ embed, transformedDisclaimer, children }: Props) => {
|
|
46
|
+
const { t } = useTranslation();
|
|
55
47
|
if (embed.status === "error") {
|
|
56
|
-
return
|
|
48
|
+
return (
|
|
49
|
+
<DisclaimerWrapper>
|
|
50
|
+
<StyledErrorWarningFill
|
|
51
|
+
aria-label={t("embed.embedError", { type: t("embed.type.disclaimer") })}
|
|
52
|
+
title={t("embed.embedError", { type: t("embed.type.disclaimer") })}
|
|
53
|
+
/>
|
|
54
|
+
{children}
|
|
55
|
+
</DisclaimerWrapper>
|
|
56
|
+
);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
const { embedData, data } = embed;
|
|
60
|
-
|
|
61
|
-
const disclaimerLink = data?.disclaimerLink ? (
|
|
62
|
-
<StyledSafeLink to={data.disclaimerLink.href} target="_blank" rel="noopener noreferrer">
|
|
63
|
-
{data.disclaimerLink.text}
|
|
64
|
-
</StyledSafeLink>
|
|
65
|
-
) : null;
|
|
66
|
-
|
|
67
59
|
return (
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
60
|
+
<DisclaimerWrapper role="region" data-embed-type="uu-disclaimer">
|
|
61
|
+
<PopoverRoot>
|
|
62
|
+
<PopoverTrigger asChild>
|
|
63
|
+
<StyledIconButton
|
|
64
|
+
size="small"
|
|
65
|
+
variant="secondary"
|
|
66
|
+
aria-label={t("uuDisclaimer.title")}
|
|
67
|
+
title={t("uuDisclaimer.title")}
|
|
68
|
+
>
|
|
69
|
+
<AccessibilityFill />
|
|
70
|
+
</StyledIconButton>
|
|
71
|
+
</PopoverTrigger>
|
|
72
|
+
<Portal>
|
|
73
|
+
<PopoverContent>
|
|
74
|
+
<PopoverTitle>{t("uuDisclaimer.title")}</PopoverTitle>
|
|
75
|
+
<div>{transformedDisclaimer}</div>
|
|
76
|
+
</PopoverContent>
|
|
77
|
+
</Portal>
|
|
78
|
+
</PopoverRoot>
|
|
76
79
|
<div data-uu-content="">{children}</div>
|
|
77
|
-
</
|
|
80
|
+
</DisclaimerWrapper>
|
|
78
81
|
);
|
|
79
82
|
};
|
|
80
83
|
|
|
@@ -1439,8 +1439,10 @@ const messages = {
|
|
|
1439
1439
|
gloss: "Gloss",
|
|
1440
1440
|
copyright: "Text",
|
|
1441
1441
|
code: "Code block",
|
|
1442
|
+
disclaimer: "Accessibility warning",
|
|
1442
1443
|
},
|
|
1443
1444
|
},
|
|
1445
|
+
uuDisclaimer: { title: "Accessibility" },
|
|
1444
1446
|
gloss: {
|
|
1445
1447
|
examples: "Examples",
|
|
1446
1448
|
showExamples: "Show examples",
|
|
@@ -1440,8 +1440,10 @@ const messages = {
|
|
|
1440
1440
|
gloss: "Glose",
|
|
1441
1441
|
copyright: "Tekst",
|
|
1442
1442
|
code: "Kodeblokk",
|
|
1443
|
+
disclaimer: "UU-advarsel",
|
|
1443
1444
|
},
|
|
1444
1445
|
},
|
|
1446
|
+
uuDisclaimer: { title: "Tilgjengelighet" },
|
|
1445
1447
|
gloss: {
|
|
1446
1448
|
examples: "Eksempler",
|
|
1447
1449
|
showExamples: "Vis eksempler",
|
|
@@ -1439,8 +1439,10 @@ const messages = {
|
|
|
1439
1439
|
gloss: "Glose",
|
|
1440
1440
|
copyright: "Tekst",
|
|
1441
1441
|
code: "Kodeblokk",
|
|
1442
|
+
disclaimer: "UU-advarsel",
|
|
1442
1443
|
},
|
|
1443
1444
|
},
|
|
1445
|
+
uuDisclaimer: { title: "Tilgjengelighet" },
|
|
1444
1446
|
gloss: {
|
|
1445
1447
|
examples: "Eksempler",
|
|
1446
1448
|
showExamples: "Vis eksempler",
|
|
@@ -1441,8 +1441,10 @@ const messages = {
|
|
|
1441
1441
|
gloss: "Glose",
|
|
1442
1442
|
copyright: "Tekst",
|
|
1443
1443
|
code: "Kodeblokk",
|
|
1444
|
+
disclaimer: "UU-advarsel",
|
|
1444
1445
|
},
|
|
1445
1446
|
},
|
|
1447
|
+
uuDisclaimer: { title: "Tilgjengelighet" },
|
|
1446
1448
|
gloss: {
|
|
1447
1449
|
examples: "Ovdamearkkat",
|
|
1448
1450
|
showExamples: "Vis eksempler",
|
|
@@ -1443,8 +1443,10 @@ const messages = {
|
|
|
1443
1443
|
gloss: "Glosa",
|
|
1444
1444
|
copyright: "Tekst",
|
|
1445
1445
|
code: "Kodeblokk",
|
|
1446
|
+
disclaimer: "UU-advarsel",
|
|
1446
1447
|
},
|
|
1447
1448
|
},
|
|
1449
|
+
uuDisclaimer: { title: "Tilgjengelighet" },
|
|
1448
1450
|
gloss: {
|
|
1449
1451
|
examples: "Eksempler",
|
|
1450
1452
|
showExamples: "Vis eksempler",
|