@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.
Files changed (206) hide show
  1. package/lib/i18n/index.d.ts +1 -1
  2. package/lib/i18n/useComponentTranslations.d.ts +2 -1
  3. package/lib/index.d.ts +1 -1
  4. package/lib/locale/messages-en.d.ts +34 -0
  5. package/lib/locale/messages-nb.d.ts +34 -0
  6. package/lib/locale/messages-nn.d.ts +34 -0
  7. package/lib/locale/messages-se.d.ts +34 -0
  8. package/package.json +6 -5
  9. package/src/Article/ArticleByline.tsx +1 -1
  10. package/src/i18n/index.ts +1 -0
  11. package/src/i18n/useComponentTranslations.ts +36 -1
  12. package/src/index.ts +1 -0
  13. package/src/locale/messages-en.ts +34 -0
  14. package/src/locale/messages-nb.ts +34 -0
  15. package/src/locale/messages-nn.ts +34 -0
  16. package/src/locale/messages-se.ts +34 -0
  17. package/es/Article/Article.js +0 -199
  18. package/es/Article/ArticleByline.js +0 -182
  19. package/es/Article/ArticleFootNotes.js +0 -60
  20. package/es/Article/index.js +0 -11
  21. package/es/AudioPlayer/AudioPlayer.js +0 -218
  22. package/es/AudioPlayer/Controls.js +0 -332
  23. package/es/AudioPlayer/SpeechControl.js +0 -56
  24. package/es/AudioPlayer/index.js +0 -10
  25. package/es/Breadcrumb/Breadcrumb.js +0 -60
  26. package/es/Breadcrumb/BreadcrumbItem.js +0 -62
  27. package/es/Breadcrumb/HomeBreadcrumb.js +0 -77
  28. package/es/Breadcrumb/index.js +0 -11
  29. package/es/CampaignBlock/CampaignBlock.js +0 -180
  30. package/es/CampaignBlock/index.js +0 -9
  31. package/es/CodeBlock/CodeBlock.js +0 -35
  32. package/es/CodeBlock/codeLanguageOptions.js +0 -84
  33. package/es/CodeBlock/index.js +0 -10
  34. package/es/Concept/Concept.js +0 -72
  35. package/es/ContactBlock/ContactBlock.js +0 -199
  36. package/es/ContactBlock/index.js +0 -9
  37. package/es/ContentTypeBadge/ContentTypeBadge.js +0 -50
  38. package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +0 -32
  39. package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +0 -32
  40. package/es/ContentTypeHero/ContentTypeHero.js +0 -50
  41. package/es/ContentTypeHero/index.js +0 -9
  42. package/es/CopyParagraphButton/CopyParagraphButton.js +0 -83
  43. package/es/CopyParagraphButton/index.js +0 -11
  44. package/es/Embed/AudioEmbed.js +0 -76
  45. package/es/Embed/BrightcoveEmbed.js +0 -133
  46. package/es/Embed/CodeEmbed.js +0 -79
  47. package/es/Embed/ConceptEmbed.js +0 -123
  48. package/es/Embed/ConceptInlineTriggerButton.js +0 -45
  49. package/es/Embed/ContentLinkEmbed.js +0 -51
  50. package/es/Embed/CopyrightEmbed.js +0 -33
  51. package/es/Embed/EmbedErrorPlaceholder.js +0 -58
  52. package/es/Embed/EmbedWrapper.js +0 -51
  53. package/es/Embed/ExternalEmbed.js +0 -74
  54. package/es/Embed/FootnoteEmbed.js +0 -44
  55. package/es/Embed/GlossEmbed.js +0 -80
  56. package/es/Embed/H5pEmbed.js +0 -61
  57. package/es/Embed/IframeEmbed.js +0 -93
  58. package/es/Embed/ImageEmbed.js +0 -238
  59. package/es/Embed/InlineTriggerButton.js +0 -37
  60. package/es/Embed/RelatedContentEmbed.js +0 -55
  61. package/es/Embed/UnknownEmbed.js +0 -31
  62. package/es/Embed/UuDisclaimerEmbed.js +0 -88
  63. package/es/Embed/index.js +0 -25
  64. package/es/Embed/types.js +0 -1
  65. package/es/ErrorMessage/ErrorMessage.js +0 -95
  66. package/es/ErrorMessage/index.js +0 -10
  67. package/es/FactBox/FactBox.js +0 -177
  68. package/es/FactBox/index.js +0 -10
  69. package/es/FileList/File.js +0 -101
  70. package/es/FileList/FileList.js +0 -47
  71. package/es/FileList/PdfFile.js +0 -50
  72. package/es/FileList/index.js +0 -11
  73. package/es/Gloss/Gloss.js +0 -175
  74. package/es/Gloss/GlossExample.js +0 -64
  75. package/es/Gloss/index.js +0 -10
  76. package/es/Grid/Grid.js +0 -94
  77. package/es/Grid/GridParallaxItem.js +0 -32
  78. package/es/Grid/index.js +0 -10
  79. package/es/KeyFigure/KeyFigure.js +0 -63
  80. package/es/KeyFigure/index.js +0 -9
  81. package/es/LicenseByline/EmbedByline.js +0 -212
  82. package/es/LicenseByline/LicenseLink.js +0 -56
  83. package/es/LicenseByline/index.js +0 -10
  84. package/es/LinkBlock/LinkBlock.js +0 -103
  85. package/es/LinkBlock/LinkBlockSection.js +0 -35
  86. package/es/LinkBlock/index.js +0 -10
  87. package/es/Pitch/Pitch.js +0 -83
  88. package/es/Pitch/index.js +0 -9
  89. package/es/RelatedArticleList/RelatedArticleList.js +0 -135
  90. package/es/RelatedArticleList/index.js +0 -11
  91. package/es/ResourceBox/ResourceBox.js +0 -99
  92. package/es/ResourceBox/index.js +0 -10
  93. package/es/TagSelector/TagSelector.js +0 -143
  94. package/es/ZendeskButton/ZendeskButton.js +0 -55
  95. package/es/i18n/formatNestedMessages.js +0 -25
  96. package/es/i18n/i18n.js +0 -35
  97. package/es/i18n/index.js +0 -11
  98. package/es/i18n/useComponentTranslations.js +0 -164
  99. package/es/index.js +0 -45
  100. package/es/locale/messages-en.js +0 -428
  101. package/es/locale/messages-nb.js +0 -428
  102. package/es/locale/messages-nn.js +0 -428
  103. package/es/locale/messages-se.js +0 -428
  104. package/es/model/ContentType.js +0 -68
  105. package/es/model/SubjectCategories.js +0 -12
  106. package/es/model/SubjectTypes.js +0 -11
  107. package/es/model/WordClass.js +0 -45
  108. package/es/model/index.js +0 -21
  109. package/es/types.js +0 -1
  110. package/es/utils/licenseAttributes.js +0 -18
  111. package/es/utils/relativeUrl.js +0 -37
  112. package/lib/Article/Article.js +0 -207
  113. package/lib/Article/ArticleByline.js +0 -189
  114. package/lib/Article/ArticleFootNotes.js +0 -67
  115. package/lib/Article/index.js +0 -68
  116. package/lib/AudioPlayer/AudioPlayer.js +0 -224
  117. package/lib/AudioPlayer/Controls.js +0 -338
  118. package/lib/AudioPlayer/SpeechControl.js +0 -62
  119. package/lib/AudioPlayer/index.js +0 -16
  120. package/lib/Breadcrumb/Breadcrumb.js +0 -67
  121. package/lib/Breadcrumb/BreadcrumbItem.js +0 -68
  122. package/lib/Breadcrumb/HomeBreadcrumb.js +0 -84
  123. package/lib/Breadcrumb/index.js +0 -23
  124. package/lib/CampaignBlock/CampaignBlock.js +0 -187
  125. package/lib/CampaignBlock/index.js +0 -13
  126. package/lib/CodeBlock/CodeBlock.js +0 -41
  127. package/lib/CodeBlock/codeLanguageOptions.js +0 -90
  128. package/lib/CodeBlock/index.js +0 -20
  129. package/lib/Concept/Concept.js +0 -78
  130. package/lib/ContactBlock/ContactBlock.js +0 -206
  131. package/lib/ContactBlock/index.js +0 -18
  132. package/lib/ContentTypeBadge/ContentTypeBadge.js +0 -57
  133. package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +0 -38
  134. package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +0 -38
  135. package/lib/ContentTypeHero/ContentTypeHero.js +0 -57
  136. package/lib/ContentTypeHero/index.js +0 -12
  137. package/lib/CopyParagraphButton/CopyParagraphButton.js +0 -89
  138. package/lib/CopyParagraphButton/index.js +0 -22
  139. package/lib/Embed/AudioEmbed.js +0 -84
  140. package/lib/Embed/BrightcoveEmbed.js +0 -142
  141. package/lib/Embed/CodeEmbed.js +0 -86
  142. package/lib/Embed/ConceptEmbed.js +0 -131
  143. package/lib/Embed/ConceptInlineTriggerButton.js +0 -51
  144. package/lib/Embed/ContentLinkEmbed.js +0 -57
  145. package/lib/Embed/CopyrightEmbed.js +0 -39
  146. package/lib/Embed/EmbedErrorPlaceholder.js +0 -64
  147. package/lib/Embed/EmbedWrapper.js +0 -57
  148. package/lib/Embed/ExternalEmbed.js +0 -81
  149. package/lib/Embed/FootnoteEmbed.js +0 -50
  150. package/lib/Embed/GlossEmbed.js +0 -88
  151. package/lib/Embed/H5pEmbed.js +0 -68
  152. package/lib/Embed/IframeEmbed.js +0 -100
  153. package/lib/Embed/ImageEmbed.js +0 -248
  154. package/lib/Embed/InlineTriggerButton.js +0 -43
  155. package/lib/Embed/RelatedContentEmbed.js +0 -61
  156. package/lib/Embed/UnknownEmbed.js +0 -37
  157. package/lib/Embed/UuDisclaimerEmbed.js +0 -94
  158. package/lib/Embed/index.js +0 -150
  159. package/lib/Embed/types.js +0 -5
  160. package/lib/ErrorMessage/ErrorMessage.js +0 -101
  161. package/lib/ErrorMessage/index.js +0 -16
  162. package/lib/FactBox/FactBox.js +0 -184
  163. package/lib/FactBox/index.js +0 -16
  164. package/lib/FileList/File.js +0 -108
  165. package/lib/FileList/FileList.js +0 -54
  166. package/lib/FileList/PdfFile.js +0 -57
  167. package/lib/FileList/index.js +0 -44
  168. package/lib/Gloss/Gloss.js +0 -181
  169. package/lib/Gloss/GlossExample.js +0 -70
  170. package/lib/Gloss/index.js +0 -20
  171. package/lib/Grid/Grid.js +0 -101
  172. package/lib/Grid/GridParallaxItem.js +0 -39
  173. package/lib/Grid/index.js +0 -19
  174. package/lib/KeyFigure/KeyFigure.js +0 -70
  175. package/lib/KeyFigure/index.js +0 -13
  176. package/lib/LicenseByline/EmbedByline.js +0 -220
  177. package/lib/LicenseByline/LicenseLink.js +0 -62
  178. package/lib/LicenseByline/index.js +0 -19
  179. package/lib/LinkBlock/LinkBlock.js +0 -110
  180. package/lib/LinkBlock/LinkBlockSection.js +0 -41
  181. package/lib/LinkBlock/index.js +0 -20
  182. package/lib/Pitch/Pitch.js +0 -91
  183. package/lib/Pitch/index.js +0 -12
  184. package/lib/RelatedArticleList/RelatedArticleList.js +0 -143
  185. package/lib/RelatedArticleList/index.js +0 -21
  186. package/lib/ResourceBox/ResourceBox.js +0 -106
  187. package/lib/ResourceBox/index.js +0 -13
  188. package/lib/TagSelector/TagSelector.js +0 -150
  189. package/lib/ZendeskButton/ZendeskButton.js +0 -61
  190. package/lib/i18n/formatNestedMessages.js +0 -32
  191. package/lib/i18n/i18n.js +0 -41
  192. package/lib/i18n/index.js +0 -62
  193. package/lib/i18n/useComponentTranslations.js +0 -176
  194. package/lib/index.js +0 -593
  195. package/lib/locale/messages-en.js +0 -435
  196. package/lib/locale/messages-nb.js +0 -435
  197. package/lib/locale/messages-nn.js +0 -435
  198. package/lib/locale/messages-se.js +0 -435
  199. package/lib/model/ContentType.js +0 -74
  200. package/lib/model/SubjectCategories.js +0 -18
  201. package/lib/model/SubjectTypes.js +0 -17
  202. package/lib/model/WordClass.js +0 -51
  203. package/lib/model/index.js +0 -28
  204. package/lib/types.js +0 -5
  205. package/lib/utils/licenseAttributes.js +0 -25
  206. package/lib/utils/relativeUrl.js +0 -44
@@ -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;
@@ -1,10 +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
- import FactBox from "./FactBox";
10
- export default FactBox;
@@ -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
- };
@@ -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
- };
@@ -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
- };
@@ -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;
@@ -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";