@ndla/ui 56.0.121-alpha.0 → 56.0.122-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/lib/i18n/index.d.ts +1 -1
- package/lib/i18n/useComponentTranslations.d.ts +2 -1
- package/lib/index.d.ts +1 -1
- package/lib/locale/messages-en.d.ts +34 -0
- package/lib/locale/messages-nb.d.ts +34 -0
- package/lib/locale/messages-nn.d.ts +34 -0
- package/lib/locale/messages-se.d.ts +34 -0
- package/package.json +6 -5
- package/src/Article/ArticleByline.tsx +1 -1
- package/src/i18n/index.ts +1 -0
- package/src/i18n/useComponentTranslations.ts +36 -1
- package/src/index.ts +1 -0
- package/src/locale/messages-en.ts +34 -0
- package/src/locale/messages-nb.ts +34 -0
- package/src/locale/messages-nn.ts +34 -0
- package/src/locale/messages-se.ts +34 -0
- package/es/Article/Article.js +0 -199
- package/es/Article/ArticleByline.js +0 -182
- package/es/Article/ArticleFootNotes.js +0 -60
- package/es/Article/index.js +0 -11
- package/es/AudioPlayer/AudioPlayer.js +0 -218
- package/es/AudioPlayer/Controls.js +0 -332
- package/es/AudioPlayer/SpeechControl.js +0 -56
- package/es/AudioPlayer/index.js +0 -10
- package/es/Breadcrumb/Breadcrumb.js +0 -60
- package/es/Breadcrumb/BreadcrumbItem.js +0 -62
- package/es/Breadcrumb/HomeBreadcrumb.js +0 -77
- package/es/Breadcrumb/index.js +0 -11
- package/es/CampaignBlock/CampaignBlock.js +0 -180
- package/es/CampaignBlock/index.js +0 -9
- package/es/CodeBlock/CodeBlock.js +0 -35
- package/es/CodeBlock/codeLanguageOptions.js +0 -84
- package/es/CodeBlock/index.js +0 -10
- package/es/Concept/Concept.js +0 -72
- package/es/ContactBlock/ContactBlock.js +0 -199
- package/es/ContactBlock/index.js +0 -9
- package/es/ContentTypeBadge/ContentTypeBadge.js +0 -50
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +0 -32
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +0 -32
- package/es/ContentTypeHero/ContentTypeHero.js +0 -50
- package/es/ContentTypeHero/index.js +0 -9
- package/es/CopyParagraphButton/CopyParagraphButton.js +0 -83
- package/es/CopyParagraphButton/index.js +0 -11
- package/es/Embed/AudioEmbed.js +0 -76
- package/es/Embed/BrightcoveEmbed.js +0 -133
- package/es/Embed/CodeEmbed.js +0 -79
- package/es/Embed/ConceptEmbed.js +0 -123
- package/es/Embed/ConceptInlineTriggerButton.js +0 -45
- package/es/Embed/ContentLinkEmbed.js +0 -51
- package/es/Embed/CopyrightEmbed.js +0 -33
- package/es/Embed/EmbedErrorPlaceholder.js +0 -58
- package/es/Embed/EmbedWrapper.js +0 -51
- package/es/Embed/ExternalEmbed.js +0 -74
- package/es/Embed/FootnoteEmbed.js +0 -44
- package/es/Embed/GlossEmbed.js +0 -80
- package/es/Embed/H5pEmbed.js +0 -61
- package/es/Embed/IframeEmbed.js +0 -93
- package/es/Embed/ImageEmbed.js +0 -238
- package/es/Embed/InlineTriggerButton.js +0 -37
- package/es/Embed/RelatedContentEmbed.js +0 -55
- package/es/Embed/UnknownEmbed.js +0 -31
- package/es/Embed/UuDisclaimerEmbed.js +0 -88
- package/es/Embed/index.js +0 -25
- package/es/Embed/types.js +0 -1
- package/es/ErrorMessage/ErrorMessage.js +0 -95
- package/es/ErrorMessage/index.js +0 -10
- package/es/FactBox/FactBox.js +0 -177
- package/es/FactBox/index.js +0 -10
- package/es/FileList/File.js +0 -101
- package/es/FileList/FileList.js +0 -47
- package/es/FileList/PdfFile.js +0 -50
- package/es/FileList/index.js +0 -11
- package/es/Gloss/Gloss.js +0 -175
- package/es/Gloss/GlossExample.js +0 -64
- package/es/Gloss/index.js +0 -10
- package/es/Grid/Grid.js +0 -94
- package/es/Grid/GridParallaxItem.js +0 -32
- package/es/Grid/index.js +0 -10
- package/es/KeyFigure/KeyFigure.js +0 -63
- package/es/KeyFigure/index.js +0 -9
- package/es/LicenseByline/EmbedByline.js +0 -212
- package/es/LicenseByline/LicenseLink.js +0 -56
- package/es/LicenseByline/index.js +0 -10
- package/es/LinkBlock/LinkBlock.js +0 -103
- package/es/LinkBlock/LinkBlockSection.js +0 -35
- package/es/LinkBlock/index.js +0 -10
- package/es/Pitch/Pitch.js +0 -83
- package/es/Pitch/index.js +0 -9
- package/es/RelatedArticleList/RelatedArticleList.js +0 -135
- package/es/RelatedArticleList/index.js +0 -11
- package/es/ResourceBox/ResourceBox.js +0 -99
- package/es/ResourceBox/index.js +0 -10
- package/es/TagSelector/TagSelector.js +0 -143
- package/es/ZendeskButton/ZendeskButton.js +0 -55
- package/es/i18n/formatNestedMessages.js +0 -25
- package/es/i18n/i18n.js +0 -35
- package/es/i18n/index.js +0 -11
- package/es/i18n/useComponentTranslations.js +0 -164
- package/es/index.js +0 -45
- package/es/locale/messages-en.js +0 -428
- package/es/locale/messages-nb.js +0 -428
- package/es/locale/messages-nn.js +0 -428
- package/es/locale/messages-se.js +0 -428
- package/es/model/ContentType.js +0 -68
- package/es/model/SubjectCategories.js +0 -12
- package/es/model/SubjectTypes.js +0 -11
- package/es/model/WordClass.js +0 -45
- package/es/model/index.js +0 -21
- package/es/types.js +0 -1
- package/es/utils/licenseAttributes.js +0 -18
- package/es/utils/relativeUrl.js +0 -37
- package/lib/Article/Article.js +0 -207
- package/lib/Article/ArticleByline.js +0 -189
- package/lib/Article/ArticleFootNotes.js +0 -67
- package/lib/Article/index.js +0 -68
- package/lib/AudioPlayer/AudioPlayer.js +0 -224
- package/lib/AudioPlayer/Controls.js +0 -338
- package/lib/AudioPlayer/SpeechControl.js +0 -62
- package/lib/AudioPlayer/index.js +0 -16
- package/lib/Breadcrumb/Breadcrumb.js +0 -67
- package/lib/Breadcrumb/BreadcrumbItem.js +0 -68
- package/lib/Breadcrumb/HomeBreadcrumb.js +0 -84
- package/lib/Breadcrumb/index.js +0 -23
- package/lib/CampaignBlock/CampaignBlock.js +0 -187
- package/lib/CampaignBlock/index.js +0 -13
- package/lib/CodeBlock/CodeBlock.js +0 -41
- package/lib/CodeBlock/codeLanguageOptions.js +0 -90
- package/lib/CodeBlock/index.js +0 -20
- package/lib/Concept/Concept.js +0 -78
- package/lib/ContactBlock/ContactBlock.js +0 -206
- package/lib/ContactBlock/index.js +0 -18
- package/lib/ContentTypeBadge/ContentTypeBadge.js +0 -57
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +0 -38
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +0 -38
- package/lib/ContentTypeHero/ContentTypeHero.js +0 -57
- package/lib/ContentTypeHero/index.js +0 -12
- package/lib/CopyParagraphButton/CopyParagraphButton.js +0 -89
- package/lib/CopyParagraphButton/index.js +0 -22
- package/lib/Embed/AudioEmbed.js +0 -84
- package/lib/Embed/BrightcoveEmbed.js +0 -142
- package/lib/Embed/CodeEmbed.js +0 -86
- package/lib/Embed/ConceptEmbed.js +0 -131
- package/lib/Embed/ConceptInlineTriggerButton.js +0 -51
- package/lib/Embed/ContentLinkEmbed.js +0 -57
- package/lib/Embed/CopyrightEmbed.js +0 -39
- package/lib/Embed/EmbedErrorPlaceholder.js +0 -64
- package/lib/Embed/EmbedWrapper.js +0 -57
- package/lib/Embed/ExternalEmbed.js +0 -81
- package/lib/Embed/FootnoteEmbed.js +0 -50
- package/lib/Embed/GlossEmbed.js +0 -88
- package/lib/Embed/H5pEmbed.js +0 -68
- package/lib/Embed/IframeEmbed.js +0 -100
- package/lib/Embed/ImageEmbed.js +0 -248
- package/lib/Embed/InlineTriggerButton.js +0 -43
- package/lib/Embed/RelatedContentEmbed.js +0 -61
- package/lib/Embed/UnknownEmbed.js +0 -37
- package/lib/Embed/UuDisclaimerEmbed.js +0 -94
- package/lib/Embed/index.js +0 -150
- package/lib/Embed/types.js +0 -5
- package/lib/ErrorMessage/ErrorMessage.js +0 -101
- package/lib/ErrorMessage/index.js +0 -16
- package/lib/FactBox/FactBox.js +0 -184
- package/lib/FactBox/index.js +0 -16
- package/lib/FileList/File.js +0 -108
- package/lib/FileList/FileList.js +0 -54
- package/lib/FileList/PdfFile.js +0 -57
- package/lib/FileList/index.js +0 -44
- package/lib/Gloss/Gloss.js +0 -181
- package/lib/Gloss/GlossExample.js +0 -70
- package/lib/Gloss/index.js +0 -20
- package/lib/Grid/Grid.js +0 -101
- package/lib/Grid/GridParallaxItem.js +0 -39
- package/lib/Grid/index.js +0 -19
- package/lib/KeyFigure/KeyFigure.js +0 -70
- package/lib/KeyFigure/index.js +0 -13
- package/lib/LicenseByline/EmbedByline.js +0 -220
- package/lib/LicenseByline/LicenseLink.js +0 -62
- package/lib/LicenseByline/index.js +0 -19
- package/lib/LinkBlock/LinkBlock.js +0 -110
- package/lib/LinkBlock/LinkBlockSection.js +0 -41
- package/lib/LinkBlock/index.js +0 -20
- package/lib/Pitch/Pitch.js +0 -91
- package/lib/Pitch/index.js +0 -12
- package/lib/RelatedArticleList/RelatedArticleList.js +0 -143
- package/lib/RelatedArticleList/index.js +0 -21
- package/lib/ResourceBox/ResourceBox.js +0 -106
- package/lib/ResourceBox/index.js +0 -13
- package/lib/TagSelector/TagSelector.js +0 -150
- package/lib/ZendeskButton/ZendeskButton.js +0 -61
- package/lib/i18n/formatNestedMessages.js +0 -32
- package/lib/i18n/i18n.js +0 -41
- package/lib/i18n/index.js +0 -62
- package/lib/i18n/useComponentTranslations.js +0 -176
- package/lib/index.js +0 -593
- package/lib/locale/messages-en.js +0 -435
- package/lib/locale/messages-nb.js +0 -435
- package/lib/locale/messages-nn.js +0 -435
- package/lib/locale/messages-se.js +0 -435
- package/lib/model/ContentType.js +0 -74
- package/lib/model/SubjectCategories.js +0 -18
- package/lib/model/SubjectTypes.js +0 -17
- package/lib/model/WordClass.js +0 -51
- package/lib/model/index.js +0 -28
- package/lib/types.js +0 -5
- package/lib/utils/licenseAttributes.js +0 -25
- package/lib/utils/relativeUrl.js +0 -44
package/es/FactBox/FactBox.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016-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 React, { forwardRef, useCallback, useEffect, useId, useMemo, useState } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
|
-
import { ArrowDownShortLine } from "@ndla/icons";
|
|
12
|
-
import { IconButton } from "@ndla/primitives";
|
|
13
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
14
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
const StyledAside = styled("aside", {
|
|
16
|
-
base: {
|
|
17
|
-
position: "relative",
|
|
18
|
-
padding: "medium",
|
|
19
|
-
display: "grid",
|
|
20
|
-
gridTemplateRows: "0fr",
|
|
21
|
-
transitionProperty: "grid-template-rows",
|
|
22
|
-
transitionDuration: "slow",
|
|
23
|
-
transitionTimingFunction: "ease-in-out",
|
|
24
|
-
justifyItems: "center",
|
|
25
|
-
border: "1px solid",
|
|
26
|
-
borderColor: "stroke.default",
|
|
27
|
-
borderRadius: "xsmall",
|
|
28
|
-
clear: "both",
|
|
29
|
-
_open: {
|
|
30
|
-
gridTemplateRows: "1fr"
|
|
31
|
-
},
|
|
32
|
-
_closed: {
|
|
33
|
-
_print: {
|
|
34
|
-
overflow: "visible",
|
|
35
|
-
maxHeight: "500vh"
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"& > div": {
|
|
39
|
-
minHeight: "surface.3xsmall"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
variants: {
|
|
43
|
-
overflowHidden: {
|
|
44
|
-
true: {
|
|
45
|
-
"& > div": {
|
|
46
|
-
overflow: "hidden"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
const StyledContent = styled("div", {
|
|
53
|
-
base: {
|
|
54
|
-
position: "relative",
|
|
55
|
-
width: "100%",
|
|
56
|
-
// Reset the top margin of the very first child.
|
|
57
|
-
"& :first-child": {
|
|
58
|
-
marginBlockStart: "0"
|
|
59
|
-
},
|
|
60
|
-
_after: {
|
|
61
|
-
content: '""',
|
|
62
|
-
textAlign: "center",
|
|
63
|
-
position: "absolute",
|
|
64
|
-
inset: "0",
|
|
65
|
-
transitionProperty: "opacity",
|
|
66
|
-
transitionDuration: "slow",
|
|
67
|
-
transitionTimingFunction: "ease-in-out",
|
|
68
|
-
gradientFrom: "surface.default/20",
|
|
69
|
-
gradientTo: "surface.default/95",
|
|
70
|
-
backgroundGradient: "to-b",
|
|
71
|
-
opacity: "1",
|
|
72
|
-
zIndex: "base",
|
|
73
|
-
pointerEvents: "none"
|
|
74
|
-
},
|
|
75
|
-
_print: {
|
|
76
|
-
overflow: "visible",
|
|
77
|
-
_after: {
|
|
78
|
-
display: "none"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
_open: {
|
|
82
|
-
paddingBlockEnd: "xsmall",
|
|
83
|
-
_after: {
|
|
84
|
-
opacity: "0"
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
const StyledIconButton = styled(IconButton, {
|
|
90
|
-
base: {
|
|
91
|
-
position: "absolute",
|
|
92
|
-
bottom: "-medium",
|
|
93
|
-
zIndex: "base",
|
|
94
|
-
"& svg": {
|
|
95
|
-
transitionProperty: "transform",
|
|
96
|
-
transitionTimingFunction: "ease-in-out",
|
|
97
|
-
transitionDuration: "fast"
|
|
98
|
-
},
|
|
99
|
-
_open: {
|
|
100
|
-
"& svg": {
|
|
101
|
-
transform: "rotate(180deg)"
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
_print: {
|
|
105
|
-
display: "none"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// TODO: Consider moving the open trigger depending on whether the content is open or closed.
|
|
111
|
-
|
|
112
|
-
const FactBox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
113
|
-
let {
|
|
114
|
-
children,
|
|
115
|
-
open,
|
|
116
|
-
onOpenChange,
|
|
117
|
-
defaultOpen = false,
|
|
118
|
-
...rest
|
|
119
|
-
} = _ref;
|
|
120
|
-
const {
|
|
121
|
-
t
|
|
122
|
-
} = useTranslation();
|
|
123
|
-
const [state, setState] = useState(defaultOpen ? "open" : "closed");
|
|
124
|
-
const [overflowHidden, setOverflowHidden] = useState(!defaultOpen);
|
|
125
|
-
const contentId = useId();
|
|
126
|
-
// Inert has existed since early 2023. It allows us to disable tabindex inside the content if it is closed, allowing us to be accessible for users with newish browsers. React 18 removes this because it doesn't recognize the attribute. This is a workaround for that.
|
|
127
|
-
// When running in React 18, we need to use an empty string instead of true.
|
|
128
|
-
// TODO: Remove this hack once we upgrade to React 19 as a peer dep.
|
|
129
|
-
const inertAttribute = useMemo(() => {
|
|
130
|
-
return state === "closed" ? {
|
|
131
|
-
inert: typeof React.use === "function" ? true : ""
|
|
132
|
-
} : {};
|
|
133
|
-
}, [state]);
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
if (open !== undefined) {
|
|
136
|
-
setState(open ? "open" : "closed");
|
|
137
|
-
}
|
|
138
|
-
}, [open]);
|
|
139
|
-
const onClick = useCallback(() => {
|
|
140
|
-
const newState = state === "open" ? "closed" : "open";
|
|
141
|
-
setState(newState);
|
|
142
|
-
onOpenChange?.(newState === "open");
|
|
143
|
-
}, [state, onOpenChange]);
|
|
144
|
-
return /*#__PURE__*/_jsxs(StyledAside, {
|
|
145
|
-
"data-state": state,
|
|
146
|
-
"data-embed-type": "factbox",
|
|
147
|
-
...rest,
|
|
148
|
-
ref: ref,
|
|
149
|
-
overflowHidden: overflowHidden,
|
|
150
|
-
onTransitionStart: e => {
|
|
151
|
-
if (e.target === e.currentTarget && state === "closed") {
|
|
152
|
-
setOverflowHidden(true);
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
onTransitionEnd: e => {
|
|
156
|
-
if (e.target === e.currentTarget && state === "open") {
|
|
157
|
-
setOverflowHidden(false);
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
children: [/*#__PURE__*/_jsx(StyledIconButton, {
|
|
161
|
-
"data-state": state,
|
|
162
|
-
onClick: onClick,
|
|
163
|
-
contentEditable: false,
|
|
164
|
-
"aria-expanded": state === "open",
|
|
165
|
-
"aria-controls": contentId,
|
|
166
|
-
"aria-label": t(`factbox.${state === "open" ? "close" : "open"}`),
|
|
167
|
-
children: /*#__PURE__*/_jsx(ArrowDownShortLine, {})
|
|
168
|
-
}), /*#__PURE__*/_jsx(StyledContent, {
|
|
169
|
-
id: contentId,
|
|
170
|
-
"data-state": state,
|
|
171
|
-
"aria-hidden": state === "closed",
|
|
172
|
-
...inertAttribute,
|
|
173
|
-
children: children
|
|
174
|
-
})]
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
export default FactBox;
|
package/es/FactBox/index.js
DELETED
package/es/FileList/File.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-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 { forwardRef } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
|
-
import { DownloadLine } from "@ndla/icons";
|
|
12
|
-
import { Text } from "@ndla/primitives";
|
|
13
|
-
import { SafeLink } from "@ndla/safelink";
|
|
14
|
-
import { HStack, styled } from "@ndla/styled-system/jsx";
|
|
15
|
-
import { linkOverlay } from "@ndla/styled-system/patterns";
|
|
16
|
-
import { FileListItem } from ".";
|
|
17
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
-
const StyledSafeLink = styled(SafeLink, {
|
|
19
|
-
base: {
|
|
20
|
-
textUnderlineOffset: "2px",
|
|
21
|
-
textDecoration: "underline",
|
|
22
|
-
_hover: {
|
|
23
|
-
textDecoration: "none"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
const StyledHStack = styled(HStack, {
|
|
28
|
-
base: {
|
|
29
|
-
position: "relative",
|
|
30
|
-
paddingBlock: "small",
|
|
31
|
-
paddingInlineEnd: "medium",
|
|
32
|
-
paddingInlineStart: "small",
|
|
33
|
-
width: "100%"
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
export const File = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
37
|
-
let {
|
|
38
|
-
title,
|
|
39
|
-
url,
|
|
40
|
-
fileExists,
|
|
41
|
-
fileType,
|
|
42
|
-
fileSize,
|
|
43
|
-
...rest
|
|
44
|
-
} = _ref;
|
|
45
|
-
const {
|
|
46
|
-
t
|
|
47
|
-
} = useTranslation();
|
|
48
|
-
const filename = `${title}-${url.split("/").pop() ?? ""}`;
|
|
49
|
-
const downloadUrl = `${url}?download=${filename}`;
|
|
50
|
-
const tooltip = `${t("download")} ${filename}`;
|
|
51
|
-
return /*#__PURE__*/_jsxs(StyledHStack, {
|
|
52
|
-
justify: "space-between",
|
|
53
|
-
ref: ref,
|
|
54
|
-
...rest,
|
|
55
|
-
children: [/*#__PURE__*/_jsxs(HStack, {
|
|
56
|
-
gap: "xxsmall",
|
|
57
|
-
children: [/*#__PURE__*/_jsx(DownloadLine, {}), fileExists ? /*#__PURE__*/_jsx(StyledSafeLink, {
|
|
58
|
-
unstyled: true,
|
|
59
|
-
css: linkOverlay.raw(),
|
|
60
|
-
to: downloadUrl,
|
|
61
|
-
title: tooltip,
|
|
62
|
-
children: title
|
|
63
|
-
}) : /*#__PURE__*/_jsx(Text, {
|
|
64
|
-
textStyle: "label.medium",
|
|
65
|
-
children: title
|
|
66
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
67
|
-
textStyle: "label.large",
|
|
68
|
-
asChild: true,
|
|
69
|
-
consumeCss: true,
|
|
70
|
-
children: /*#__PURE__*/_jsxs("span", {
|
|
71
|
-
children: ["(", fileType?.toUpperCase(), ")"]
|
|
72
|
-
})
|
|
73
|
-
})]
|
|
74
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
75
|
-
textStyle: "label.large",
|
|
76
|
-
asChild: true,
|
|
77
|
-
consumeCss: true,
|
|
78
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
79
|
-
children: fileSize
|
|
80
|
-
})
|
|
81
|
-
})]
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
export const FileListElement = _ref2 => {
|
|
85
|
-
let {
|
|
86
|
-
title,
|
|
87
|
-
url,
|
|
88
|
-
fileExists,
|
|
89
|
-
fileType,
|
|
90
|
-
fileSize
|
|
91
|
-
} = _ref2;
|
|
92
|
-
return /*#__PURE__*/_jsx(FileListItem, {
|
|
93
|
-
children: /*#__PURE__*/_jsx(File, {
|
|
94
|
-
title: title,
|
|
95
|
-
url: url,
|
|
96
|
-
fileExists: fileExists,
|
|
97
|
-
fileType: fileType,
|
|
98
|
-
fileSize: fileSize
|
|
99
|
-
})
|
|
100
|
-
});
|
|
101
|
-
};
|
package/es/FileList/FileList.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-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 { ark } from "@ark-ui/react";
|
|
10
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
export const FileListWrapper = styled(ark.ul, {
|
|
13
|
-
base: {
|
|
14
|
-
display: "flex",
|
|
15
|
-
flexDirection: "column",
|
|
16
|
-
gap: "xsmall",
|
|
17
|
-
clear: "both"
|
|
18
|
-
}
|
|
19
|
-
}, {
|
|
20
|
-
baseComponent: true
|
|
21
|
-
});
|
|
22
|
-
export const FileListItem = styled(ark.li, {
|
|
23
|
-
base: {
|
|
24
|
-
listStyle: "none",
|
|
25
|
-
background: "surface.infoSubtle",
|
|
26
|
-
borderBlockEnd: "1px solid",
|
|
27
|
-
borderColor: "stroke.default",
|
|
28
|
-
display: "flex",
|
|
29
|
-
justifyContent: "space-between",
|
|
30
|
-
_hover: {
|
|
31
|
-
backgroundColor: "surface.infoSubtle.hover"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}, {
|
|
35
|
-
baseComponent: true
|
|
36
|
-
});
|
|
37
|
-
export const FileListEmbed = _ref => {
|
|
38
|
-
let {
|
|
39
|
-
children,
|
|
40
|
-
...rest
|
|
41
|
-
} = _ref;
|
|
42
|
-
return /*#__PURE__*/_jsx(FileListWrapper, {
|
|
43
|
-
...rest,
|
|
44
|
-
"data-embed-type": "file-list",
|
|
45
|
-
children: children
|
|
46
|
-
});
|
|
47
|
-
};
|
package/es/FileList/PdfFile.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-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 { Heading, Figure } from "@ndla/primitives";
|
|
10
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
const StyledIframe = styled("iframe", {
|
|
13
|
-
base: {
|
|
14
|
-
width: "100%"
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
const StyledListElement = styled("li", {
|
|
18
|
-
base: {
|
|
19
|
-
listStyle: "none"
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const StyledFigure = styled(Figure, {
|
|
23
|
-
base: {
|
|
24
|
-
display: "flex",
|
|
25
|
-
flexDirection: "column",
|
|
26
|
-
gap: "xsmall"
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
export const PdfFile = _ref => {
|
|
30
|
-
let {
|
|
31
|
-
title,
|
|
32
|
-
url
|
|
33
|
-
} = _ref;
|
|
34
|
-
return /*#__PURE__*/_jsx(StyledListElement, {
|
|
35
|
-
children: /*#__PURE__*/_jsxs(StyledFigure, {
|
|
36
|
-
children: [/*#__PURE__*/_jsx(Heading, {
|
|
37
|
-
asChild: true,
|
|
38
|
-
consumeCss: true,
|
|
39
|
-
textStyle: "title.medium",
|
|
40
|
-
children: /*#__PURE__*/_jsx("h4", {
|
|
41
|
-
children: title
|
|
42
|
-
})
|
|
43
|
-
}), /*#__PURE__*/_jsx(StyledIframe, {
|
|
44
|
-
title: title,
|
|
45
|
-
height: "1050",
|
|
46
|
-
src: url
|
|
47
|
-
})]
|
|
48
|
-
})
|
|
49
|
-
});
|
|
50
|
-
};
|
package/es/FileList/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2018-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
|
-
export { FileListEmbed, FileListItem, FileListWrapper } from "./FileList";
|
|
10
|
-
export { File, FileListElement } from "./File";
|
|
11
|
-
export { PdfFile } from "./PdfFile";
|
package/es/Gloss/Gloss.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-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 { useMemo } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
|
-
import { AccordionItemTrigger } from "@ark-ui/react";
|
|
12
|
-
import { ArrowDownShortLine } from "@ndla/icons";
|
|
13
|
-
import { AccordionItem, AccordionItemContent, AccordionItemIndicator, AccordionRoot, IconButton, Text } from "@ndla/primitives";
|
|
14
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
15
|
-
import GlossExample from "./GlossExample";
|
|
16
|
-
import SpeechControl from "../AudioPlayer/SpeechControl";
|
|
17
|
-
|
|
18
|
-
// TODO: Figure out padding between bordered and simple variant.
|
|
19
|
-
// The design says that the content above the accordion content should have enough padding to align with the accordion content.
|
|
20
|
-
// When a gloss is bordered there's way too much padding.
|
|
21
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
const getFilteredExamples = (glossData, exampleIds, exampleLangs) => {
|
|
23
|
-
if (exampleIds !== undefined || exampleLangs !== undefined) {
|
|
24
|
-
const exampleIdsList = exampleIds?.toString()?.split(",") ?? [];
|
|
25
|
-
const exampleLangsList = exampleLangs?.split(",") ?? [];
|
|
26
|
-
const filteredExamples = glossData?.examples?.map((examples, i) => {
|
|
27
|
-
if (exampleIdsList.includes(i.toString())) {
|
|
28
|
-
return examples.filter(e => exampleLangsList.includes(e.language));
|
|
29
|
-
}
|
|
30
|
-
return [];
|
|
31
|
-
}) ?? [];
|
|
32
|
-
const examplesWithoutEmpty = filteredExamples.filter(el => !!el.length);
|
|
33
|
-
return examplesWithoutEmpty;
|
|
34
|
-
}
|
|
35
|
-
return glossData?.examples ?? [];
|
|
36
|
-
};
|
|
37
|
-
const Container = styled("div", {
|
|
38
|
-
base: {
|
|
39
|
-
display: "flex",
|
|
40
|
-
alignItems: "center",
|
|
41
|
-
justifyContent: "space-between"
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
const TextWrapper = styled("div", {
|
|
45
|
-
base: {
|
|
46
|
-
display: "flex",
|
|
47
|
-
gap: "small"
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
const StyledAccordionItemContent = styled(AccordionItemContent, {
|
|
51
|
-
base: {
|
|
52
|
-
paddingInline: "0"
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
const StyledContainer = styled(Container, {
|
|
56
|
-
base: {
|
|
57
|
-
marginBlockStart: "3xsmall"
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
const StyledAccordionItem = styled(AccordionItem, {
|
|
61
|
-
base: {
|
|
62
|
-
paddingBlock: "small",
|
|
63
|
-
paddingInline: "medium"
|
|
64
|
-
},
|
|
65
|
-
defaultVariants: {
|
|
66
|
-
variant: "simple"
|
|
67
|
-
},
|
|
68
|
-
variants: {
|
|
69
|
-
variant: {
|
|
70
|
-
simple: {},
|
|
71
|
-
bordered: {
|
|
72
|
-
border: "1px solid",
|
|
73
|
-
borderColor: "stroke.subtle",
|
|
74
|
-
borderRadius: "xsmall"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
const Gloss = _ref => {
|
|
80
|
-
let {
|
|
81
|
-
title,
|
|
82
|
-
glossData,
|
|
83
|
-
audio,
|
|
84
|
-
exampleIds,
|
|
85
|
-
exampleLangs,
|
|
86
|
-
variant
|
|
87
|
-
} = _ref;
|
|
88
|
-
const {
|
|
89
|
-
t
|
|
90
|
-
} = useTranslation();
|
|
91
|
-
const filteredExamples = useMemo(() => getFilteredExamples(glossData, exampleIds, exampleLangs), [exampleIds, exampleLangs, glossData]);
|
|
92
|
-
if (!glossData) return null;
|
|
93
|
-
return /*#__PURE__*/_jsx(AccordionRoot, {
|
|
94
|
-
multiple: true,
|
|
95
|
-
variant: "clean",
|
|
96
|
-
children: /*#__PURE__*/_jsxs(StyledAccordionItem, {
|
|
97
|
-
value: "gloss",
|
|
98
|
-
variant: variant,
|
|
99
|
-
children: [/*#__PURE__*/_jsxs(Container, {
|
|
100
|
-
children: [/*#__PURE__*/_jsxs(TextWrapper, {
|
|
101
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
102
|
-
textStyle: "label.medium",
|
|
103
|
-
fontWeight: "bold",
|
|
104
|
-
asChild: true,
|
|
105
|
-
consumeCss: true,
|
|
106
|
-
lang: glossData.originalLanguage,
|
|
107
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
108
|
-
children: glossData.gloss
|
|
109
|
-
})
|
|
110
|
-
}), !!glossData.transcriptions.traditional && /*#__PURE__*/_jsx(Text, {
|
|
111
|
-
textStyle: "label.medium",
|
|
112
|
-
asChild: true,
|
|
113
|
-
consumeCss: true,
|
|
114
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
115
|
-
"aria-label": t("gloss.transcriptions.traditional"),
|
|
116
|
-
lang: glossData.originalLanguage,
|
|
117
|
-
children: glossData.transcriptions.traditional
|
|
118
|
-
}, t("gloss.transcriptions.traditional"))
|
|
119
|
-
}), !!glossData.transcriptions.pinyin && /*#__PURE__*/_jsx(Text, {
|
|
120
|
-
textStyle: "label.medium",
|
|
121
|
-
asChild: true,
|
|
122
|
-
consumeCss: true,
|
|
123
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
124
|
-
"data-pinyin": "",
|
|
125
|
-
"aria-label": t("gloss.transcriptions.pinyin"),
|
|
126
|
-
lang: glossData.originalLanguage,
|
|
127
|
-
children: glossData.transcriptions.pinyin
|
|
128
|
-
}, t("gloss.transcriptions.pinyin"))
|
|
129
|
-
}), !!glossData.wordClass && /*#__PURE__*/_jsx(Text, {
|
|
130
|
-
textStyle: "label.medium",
|
|
131
|
-
asChild: true,
|
|
132
|
-
consumeCss: true,
|
|
133
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
134
|
-
"aria-label": t("gloss.wordClass"),
|
|
135
|
-
children: t(`wordClass.${glossData.wordClass}`).toLowerCase()
|
|
136
|
-
})
|
|
137
|
-
})]
|
|
138
|
-
}), !!audio?.src && /*#__PURE__*/_jsx(SpeechControl, {
|
|
139
|
-
src: audio.src,
|
|
140
|
-
title: audio.title,
|
|
141
|
-
type: "gloss"
|
|
142
|
-
})]
|
|
143
|
-
}), /*#__PURE__*/_jsxs(StyledContainer, {
|
|
144
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
145
|
-
textStyle: "label.medium",
|
|
146
|
-
asChild: true,
|
|
147
|
-
consumeCss: true,
|
|
148
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
149
|
-
lang: title.language,
|
|
150
|
-
children: title.title
|
|
151
|
-
})
|
|
152
|
-
}), !!filteredExamples.length && /*#__PURE__*/_jsx(AccordionItemTrigger, {
|
|
153
|
-
asChild: true,
|
|
154
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
|
155
|
-
variant: "tertiary",
|
|
156
|
-
"aria-label": t("gloss.showExamples"),
|
|
157
|
-
title: t("gloss.showExamples"),
|
|
158
|
-
children: /*#__PURE__*/_jsx(AccordionItemIndicator, {
|
|
159
|
-
asChild: true,
|
|
160
|
-
children: /*#__PURE__*/_jsx(ArrowDownShortLine, {
|
|
161
|
-
size: "medium"
|
|
162
|
-
})
|
|
163
|
-
})
|
|
164
|
-
})
|
|
165
|
-
})]
|
|
166
|
-
}), /*#__PURE__*/_jsx(StyledAccordionItemContent, {
|
|
167
|
-
children: filteredExamples.map((examples, index) => /*#__PURE__*/_jsx(GlossExample, {
|
|
168
|
-
examples: examples,
|
|
169
|
-
originalLanguage: glossData.originalLanguage
|
|
170
|
-
}, `gloss-example-${index}`))
|
|
171
|
-
})]
|
|
172
|
-
})
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
export default Gloss;
|
package/es/Gloss/GlossExample.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-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 { Fragment } from "react";
|
|
10
|
-
import { Text } from "@ndla/primitives";
|
|
11
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
const StyledGlossExample = styled("div", {
|
|
14
|
-
base: {
|
|
15
|
-
borderTop: "1px solid",
|
|
16
|
-
borderColor: "stroke.subtle",
|
|
17
|
-
paddingBlock: "xsmall",
|
|
18
|
-
paddingInline: "medium",
|
|
19
|
-
_first: {
|
|
20
|
-
background: "surface.brand.1.subtle",
|
|
21
|
-
borderColor: "stroke.default",
|
|
22
|
-
"& p": {
|
|
23
|
-
fontWeight: "bold"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const PinyinText = styled(Text, {
|
|
29
|
-
base: {
|
|
30
|
-
fontStyle: "italic"
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
const GlossExample = _ref => {
|
|
34
|
-
let {
|
|
35
|
-
examples,
|
|
36
|
-
originalLanguage
|
|
37
|
-
} = _ref;
|
|
38
|
-
return /*#__PURE__*/_jsx("div", {
|
|
39
|
-
children: examples.map((examples, index) => /*#__PURE__*/_jsxs(Fragment, {
|
|
40
|
-
children: [/*#__PURE__*/_jsx(StyledGlossExample, {
|
|
41
|
-
lang: examples.language,
|
|
42
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
43
|
-
textStyle: "label.medium",
|
|
44
|
-
lang: examples.language,
|
|
45
|
-
children: examples.example
|
|
46
|
-
})
|
|
47
|
-
}), !!examples.transcriptions.pinyin && /*#__PURE__*/_jsx(StyledGlossExample, {
|
|
48
|
-
children: /*#__PURE__*/_jsx(PinyinText, {
|
|
49
|
-
"data-pinyin": "",
|
|
50
|
-
lang: originalLanguage,
|
|
51
|
-
textStyle: "label.medium",
|
|
52
|
-
children: examples.transcriptions?.pinyin
|
|
53
|
-
})
|
|
54
|
-
}), !!examples.transcriptions?.traditional && /*#__PURE__*/_jsx(StyledGlossExample, {
|
|
55
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
56
|
-
textStyle: "label.medium",
|
|
57
|
-
lang: originalLanguage,
|
|
58
|
-
children: examples.transcriptions.traditional
|
|
59
|
-
})
|
|
60
|
-
})]
|
|
61
|
-
}, index))
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
export default GlossExample;
|
package/es/Gloss/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-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
|
-
export { default as Gloss } from "./Gloss";
|
|
10
|
-
export { default as GlossExample } from "./GlossExample";
|