@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,238 +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 parse from "html-react-parser";
10
- import { useMemo, useState } from "react";
11
- import { useTranslation } from "react-i18next";
12
- import { AddLine } from "@ndla/icons";
13
- import { Figure, Image } from "@ndla/primitives";
14
- import { styled } from "@ndla/styled-system/jsx";
15
- import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
16
- import { EmbedByline } from "../LicenseByline";
17
- import { licenseAttributes } from "../utils/licenseAttributes";
18
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
- export const getLicenseCredits = copyright => {
20
- return {
21
- creators: copyright?.creators ?? [],
22
- rightsholders: copyright?.rightsholders ?? [],
23
- processors: copyright?.processors ?? []
24
- };
25
- };
26
- const getFigureProps = (size, float) => {
27
- const actualFloat = float === "left" ? "left" : float === "right" ? "right" : undefined;
28
- const replacedSize = size?.replace("-hide-byline", "") ?? "full";
29
- const actualSize = replacedSize === "fullwidth" ? "full" : replacedSize;
30
- return {
31
- float: actualFloat,
32
- // Figure expects you to set a size when floating. If you don't, the figure will simply take up the available width. Fallback to medium in those cases.
33
- size: actualSize === "full" && float ? "medium" : actualSize
34
- };
35
- };
36
- const getSizes = (size, align) => {
37
- if (align && size === "full") {
38
- return "(min-width: 1024px) 512px, (min-width: 768px) 350px, 100vw";
39
- }
40
- if (align && size === "small") {
41
- return "(min-width: 1024px) 350px, (min-width: 768px) 180px, 100vw";
42
- }
43
- if (align && size === "xsmall") {
44
- return "(min-width: 1024px) 180px, (min-width: 768px) 180px, 100vw";
45
- }
46
- return "(min-width: 1024px) 1024px, 100vw";
47
- };
48
- export const getFocalPoint = data => {
49
- const focalX = Number.parseFloat(data.focalX ?? "");
50
- const focalY = Number.parseFloat(data.focalY ?? "");
51
- if (!Number.isNaN(focalX) && !Number.isNaN(focalY)) {
52
- return {
53
- x: focalX,
54
- y: focalY
55
- };
56
- }
57
- return undefined;
58
- };
59
- export const getCrop = data => {
60
- const lowerRightX = Number.parseFloat(data.lowerRightX ?? "");
61
- const lowerRightY = Number.parseFloat(data.lowerRightY ?? "");
62
- const upperLeftX = Number.parseFloat(data.upperLeftX ?? "");
63
- const upperLeftY = Number.parseFloat(data.upperLeftY ?? "");
64
- if (!Number.isNaN(lowerRightX) && !Number.isNaN(lowerRightY) && !Number.isNaN(upperLeftX) && !Number.isNaN(upperLeftY)) {
65
- return {
66
- startX: lowerRightX,
67
- startY: lowerRightY,
68
- endX: upperLeftX,
69
- endY: upperLeftY
70
- };
71
- }
72
- return undefined;
73
- };
74
- const expandedSizes = "(min-width: 1024px) 1024px, 100vw";
75
- const ImageWrapper = styled("div", {
76
- base: {
77
- overflow: "hidden",
78
- position: "relative",
79
- width: "100%",
80
- "& img": {
81
- width: "100%"
82
- }
83
- },
84
- variants: {
85
- svg: {
86
- true: {
87
- display: "flex",
88
- justifyContent: "center"
89
- },
90
- false: {}
91
- },
92
- border: {
93
- true: {
94
- border: "1px solid",
95
- borderColor: "stroke.subtle",
96
- borderRadius: "xsmall",
97
- "& img": {
98
- borderRadius: "0"
99
- }
100
- },
101
- false: {}
102
- },
103
- expandable: {
104
- true: {
105
- cursor: "pointer"
106
- },
107
- false: {}
108
- }
109
- }
110
- });
111
- const StyledFigure = styled(Figure, {
112
- base: {
113
- zIndex: "docked",
114
- _hover: {
115
- "& [data-byline-button]": {
116
- background: "background.default"
117
- },
118
- "& button[data-expanded]": {
119
- transform: "scale(1.2)"
120
- }
121
- },
122
- "& button[data-expanded='true']": {
123
- "& svg": {
124
- transform: "rotate(-45deg)"
125
- }
126
- }
127
- }
128
- });
129
- const ExpandButton = styled("button", {
130
- base: {
131
- display: "flex",
132
- alignItems: "center",
133
- justifyContent: "center",
134
- cursor: "pointer",
135
- position: "absolute",
136
- padding: "0",
137
- top: "xsmall",
138
- right: "xsmall",
139
- width: "medium",
140
- height: "medium",
141
- border: "2px solid",
142
- borderColor: "background.default",
143
- transitionProperty: "transform, background-color, color",
144
- transitionDuration: "normal",
145
- transitionTimingFunction: "ease-out",
146
- color: "background.default",
147
- backgroundColor: "surface.action",
148
- borderRadius: "large",
149
- "& svg": {
150
- transitionProperty: "transform",
151
- transitionDuration: "normal",
152
- transitionTimingFunction: "ease-out"
153
- },
154
- tabletDown: {
155
- display: "none"
156
- }
157
- }
158
- }, {
159
- defaultProps: {
160
- type: "button"
161
- }
162
- });
163
- const ImageEmbed = _ref => {
164
- let {
165
- embed,
166
- previewAlt,
167
- lang,
168
- renderContext = "article",
169
- children
170
- } = _ref;
171
- const [imageSizes, setImageSizes] = useState(undefined);
172
- const figureProps = getFigureProps(embed.embedData.size, embed.embedData.align);
173
- const {
174
- t
175
- } = useTranslation();
176
- const parsedDescription = useMemo(() => {
177
- if (embed.embedData.caption || renderContext === "article") {
178
- return embed.embedData.caption ? parse(embed.embedData.caption) : undefined;
179
- }
180
- if (embed.status === "success" && embed.data.caption.caption) {
181
- return parse(embed.data.caption.caption);
182
- }
183
- }, [embed, renderContext]);
184
- if (embed.status === "error") {
185
- return /*#__PURE__*/_jsx(EmbedErrorPlaceholder, {
186
- type: "image",
187
- figureType: figureProps?.size,
188
- float: figureProps?.float
189
- });
190
- }
191
- const {
192
- data,
193
- embedData
194
- } = embed;
195
- const altText = embedData.alt || "";
196
- const sizes = getSizes(embedData.size, embedData.align);
197
- const focalPoint = getFocalPoint(embedData);
198
- const crop = getCrop(embedData);
199
- const toggleImageSize = () => {
200
- setImageSizes(sizes => !sizes ? expandedSizes : undefined);
201
- };
202
- const licenseProps = licenseAttributes(data.copyright.license.license, lang, embedData.url);
203
- const figureSize = figureProps?.float ? figureProps?.size ?? "medium" : "full";
204
- return /*#__PURE__*/_jsxs(StyledFigure, {
205
- float: figureProps?.float,
206
- size: imageSizes ? "full" : figureSize,
207
- "data-embed-type": "image",
208
- ...licenseProps,
209
- children: [children, /*#__PURE__*/_jsxs(ImageWrapper, {
210
- border: embedData.border === "true",
211
- expandable: !!figureProps?.float,
212
- children: [/*#__PURE__*/_jsx(Image, {
213
- focalPoint: focalPoint,
214
- contentType: data.image.contentType,
215
- crop: crop,
216
- sizes: imageSizes ?? sizes,
217
- alt: altText,
218
- src: data.image.imageUrl,
219
- lang: lang,
220
- onClick: figureProps?.float ? toggleImageSize : undefined,
221
- variant: "rounded"
222
- }), (embedData.align === "right" || embedData.align === "left") && /*#__PURE__*/_jsx(ExpandButton, {
223
- "aria-label": t(`license.images.itemImage.zoom${imageSizes ? "Out" : ""}ImageButtonLabel`),
224
- onClick: toggleImageSize,
225
- "data-expanded": !!imageSizes,
226
- children: /*#__PURE__*/_jsx(AddLine, {})
227
- })]
228
- }), /*#__PURE__*/_jsx(EmbedByline, {
229
- type: "image",
230
- copyright: data.copyright,
231
- description: parsedDescription,
232
- hideDescription: embedData.hideCaption === "true",
233
- hideCopyright: embedData.hideByline === "true",
234
- visibleAlt: previewAlt ? embed.embedData.alt : ""
235
- })]
236
- });
237
- };
238
- export default ImageEmbed;
@@ -1,37 +0,0 @@
1
- /**
2
- * Copyright (c) 2024-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, useCallback, useRef } from "react";
10
- import { styled } from "@ndla/styled-system/jsx";
11
- import { composeRefs } from "@ndla/util";
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- const StyledSpan = styled("span", {
14
- base: {}
15
- });
16
- export const InlineTriggerButton = /*#__PURE__*/forwardRef((_ref, ref) => {
17
- let {
18
- onClick,
19
- ...props
20
- } = _ref;
21
- const spanRef = useRef(null);
22
-
23
- // Emulate a button click when pressing Enter or Space
24
- const onKeyboardEvent = useCallback(event => {
25
- if (event.key === "Enter" || event.key === " ") {
26
- spanRef.current?.click();
27
- }
28
- }, []);
29
- return /*#__PURE__*/_jsx(StyledSpan, {
30
- ref: composeRefs(spanRef, ref),
31
- onKeyUp: onKeyboardEvent,
32
- onClick: onClick,
33
- role: "button",
34
- tabIndex: 0,
35
- ...props
36
- });
37
- });
@@ -1,55 +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 { useTranslation } from "react-i18next";
10
- import { contentTypeMapping } from "../model/ContentType";
11
- import { RelatedArticle } from "../RelatedArticleList/RelatedArticleList";
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- const RelatedContentEmbed = _ref => {
14
- let {
15
- embed,
16
- isOembed,
17
- subject,
18
- ndlaFrontendDomain
19
- } = _ref;
20
- const {
21
- t
22
- } = useTranslation();
23
- if (embed.status === "error") {
24
- return null;
25
- }
26
- const {
27
- data,
28
- embedData
29
- } = embed;
30
- if (embedData.articleId && data) {
31
- const typeId = data.resource?.resourceTypes.find(rt => contentTypeMapping[rt.id])?.id;
32
- const type = typeId ? contentTypeMapping[typeId] : undefined;
33
- const context = data.resource?.contexts.find(c => c.rootId === subject);
34
- const url = context?.url ?? data.resource?.url ?? `/article/${embedData.articleId}`;
35
- return /*#__PURE__*/_jsx(RelatedArticle, {
36
- title: data.article.title?.title ?? "",
37
- introduction: data.article.metaDescription?.metaDescription ?? "",
38
- target: isOembed ? "_blank" : undefined,
39
- to: `${ndlaFrontendDomain ?? ""}${url ?? ""}`,
40
- type: type
41
- });
42
- }
43
- if (typeof embedData.url === "string") {
44
- return /*#__PURE__*/_jsx(RelatedArticle, {
45
- title: embedData.title ?? "",
46
- introduction: "",
47
- to: embedData.url,
48
- target: "_blank",
49
- type: "external",
50
- linkInfo: `${t("related.linkInfo")} ${embedData.urlDomain}`
51
- });
52
- }
53
- return null;
54
- };
55
- export default RelatedContentEmbed;
@@ -1,31 +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 { useTranslation } from "react-i18next";
10
- import { Text } from "@ndla/primitives";
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
- const UnknownEmbed = _ref => {
13
- let {
14
- embed
15
- } = _ref;
16
- const {
17
- t
18
- } = useTranslation();
19
- return /*#__PURE__*/_jsx(Text, {
20
- color: "text.error",
21
- asChild: true,
22
- consumeCss: true,
23
- "data-embed-type": "unknown",
24
- children: /*#__PURE__*/_jsx("span", {
25
- children: t("embed.unsupported", {
26
- type: embed.resource
27
- })
28
- })
29
- });
30
- };
31
- export default UnknownEmbed;
@@ -1,88 +0,0 @@
1
- /**
2
- * Copyright (c) 2024-present, NDLA.
3
- *
4
- * This source code is licensed under the GPLv3 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import { useTranslation } from "react-i18next";
10
- import { Portal } from "@ark-ui/react";
11
- import { AccessibilityFill, ErrorWarningFill } from "@ndla/icons";
12
- import { IconButton, PopoverContent, PopoverRoot, PopoverTrigger } 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 DisclaimerWrapper = styled("div", {
16
- base: {
17
- display: "flex",
18
- flexDirection: "column",
19
- gap: "3xsmall",
20
- clear: "both"
21
- }
22
- });
23
- const StyledIconButton = styled(IconButton, {
24
- base: {
25
- alignSelf: "flex-end"
26
- }
27
- });
28
- const StyledErrorWarningFill = styled(ErrorWarningFill, {
29
- base: {
30
- alignSelf: "flex-end",
31
- fill: "icon.subtle"
32
- }
33
- });
34
- const StyledPopoverContent = styled(PopoverContent, {
35
- base: {
36
- width: "surface.xlarge",
37
- maxHeight: "50vh",
38
- overflowY: "auto"
39
- }
40
- });
41
- const UuDisclaimerEmbed = _ref => {
42
- let {
43
- embed,
44
- transformedDisclaimer,
45
- children
46
- } = _ref;
47
- const {
48
- t
49
- } = useTranslation();
50
- if (embed.status === "error") {
51
- return /*#__PURE__*/_jsxs(DisclaimerWrapper, {
52
- children: [/*#__PURE__*/_jsx(StyledErrorWarningFill, {
53
- "aria-label": t("embed.embedError", {
54
- type: t("embed.type.disclaimer")
55
- }),
56
- title: t("embed.embedError", {
57
- type: t("embed.type.disclaimer")
58
- })
59
- }), children]
60
- });
61
- }
62
- return /*#__PURE__*/_jsxs(DisclaimerWrapper, {
63
- role: "region",
64
- "data-embed-type": "uu-disclaimer",
65
- children: [/*#__PURE__*/_jsxs(PopoverRoot, {
66
- children: [/*#__PURE__*/_jsx(PopoverTrigger, {
67
- asChild: true,
68
- children: /*#__PURE__*/_jsx(StyledIconButton, {
69
- size: "small",
70
- variant: "secondary",
71
- "aria-label": t("uuDisclaimer.title"),
72
- title: t("uuDisclaimer.title"),
73
- children: /*#__PURE__*/_jsx(AccessibilityFill, {})
74
- })
75
- }), /*#__PURE__*/_jsx(Portal, {
76
- children: /*#__PURE__*/_jsx(StyledPopoverContent, {
77
- children: /*#__PURE__*/_jsx("div", {
78
- children: transformedDisclaimer
79
- })
80
- })
81
- })]
82
- }), /*#__PURE__*/_jsx("div", {
83
- "data-uu-content": "",
84
- children: children
85
- })]
86
- });
87
- };
88
- export default UuDisclaimerEmbed;
package/es/Embed/index.js DELETED
@@ -1,25 +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 ImageEmbed, getCrop, getFocalPoint } from "./ImageEmbed";
10
- export { InlineTriggerButton } from "./InlineTriggerButton";
11
- export { default as AudioEmbed } from "./AudioEmbed";
12
- export { default as H5pEmbed } from "./H5pEmbed";
13
- export { default as ExternalEmbed } from "./ExternalEmbed";
14
- export { default as IframeEmbed } from "./IframeEmbed";
15
- export { default as FootnoteEmbed } from "./FootnoteEmbed";
16
- export { default as BrightcoveEmbed } from "./BrightcoveEmbed";
17
- export { default as ContentLinkEmbed } from "./ContentLinkEmbed";
18
- export { default as RelatedContentEmbed } from "./RelatedContentEmbed";
19
- export { ConceptEmbed, InlineConcept, BlockConcept } from "./ConceptEmbed";
20
- export { default as UnknownEmbed } from "./UnknownEmbed";
21
- export { default as UuDisclaimerEmbed } from "./UuDisclaimerEmbed";
22
- export { default as CopyrightEmbed } from "./CopyrightEmbed";
23
- export { default as CodeEmbed } from "./CodeEmbed";
24
- export { EmbedWrapper } from "./EmbedWrapper";
25
- export { ConceptInlineTriggerButton } from "./ConceptInlineTriggerButton";
package/es/Embed/types.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,95 +0,0 @@
1
- /**
2
- * Copyright (c) 2019-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 { Text } from "@ndla/primitives";
10
- import { SafeLink } from "@ndla/safelink";
11
- import { styled } from "@ndla/styled-system/jsx";
12
-
13
- // TODO: This has not been redesignet yet. This is just a rewrite of the previous design in panda
14
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
- const StyledErrorMessage = styled("article", {
16
- base: {
17
- textAlign: "center",
18
- "& a": {
19
- color: "text.strong"
20
- },
21
- "& h1": {
22
- marginTop: "0"
23
- }
24
- }
25
- });
26
- const IllustrationWrapper = styled("div", {
27
- base: {
28
- display: "flex",
29
- justifyContent: "center",
30
- marginBottom: "medium",
31
- tablet: {
32
- marginTop: "xxlarge"
33
- }
34
- }
35
- });
36
- const Description = styled(Text, {
37
- base: {
38
- marginBottom: "medium",
39
- tablet: {
40
- marginBottom: "xxlarge"
41
- }
42
- }
43
- });
44
- const CustomElementWrapper = styled("div", {
45
- base: {
46
- marginBlock: "xxlarge"
47
- }
48
- });
49
- const MessageWrapper = styled("div", {
50
- base: {
51
- marginTop: "3xsmall"
52
- }
53
- });
54
- export const ErrorMessage = _ref => {
55
- let {
56
- children,
57
- messages,
58
- illustration,
59
- illustrationElement,
60
- customElement
61
- } = _ref;
62
- return /*#__PURE__*/_jsxs(StyledErrorMessage, {
63
- children: [!!illustration && /*#__PURE__*/_jsx(IllustrationWrapper, {
64
- children: /*#__PURE__*/_jsx("img", {
65
- src: illustration.url,
66
- alt: illustration.altText
67
- })
68
- }), !!illustrationElement && /*#__PURE__*/_jsx(IllustrationWrapper, {
69
- children: illustrationElement
70
- }), /*#__PURE__*/_jsx("h1", {
71
- children: messages.title
72
- }), !!messages.description && /*#__PURE__*/_jsx(Description, {
73
- children: messages.description
74
- }), !!customElement && /*#__PURE__*/_jsx(CustomElementWrapper, {
75
- children: customElement
76
- }), !!messages.linksTitle && /*#__PURE__*/_jsx("h2", {
77
- children: messages.linksTitle
78
- }), !!messages.back && /*#__PURE__*/_jsx(SafeLink, {
79
- to: `/#${encodeURI(messages.back)}`,
80
- onClick: () => window.history.back(),
81
- children: messages.back
82
- }), !!messages.goToFrontPage && /*#__PURE__*/_jsx(MessageWrapper, {
83
- children: /*#__PURE__*/_jsx(SafeLink, {
84
- to: "/",
85
- children: messages.goToFrontPage
86
- })
87
- }), !!messages.logInFailed && /*#__PURE__*/_jsx(MessageWrapper, {
88
- children: /*#__PURE__*/_jsx(SafeLink, {
89
- to: "/minndla",
90
- children: messages.logInFailed
91
- })
92
- }), children]
93
- });
94
- };
95
- export default ErrorMessage;
@@ -1,10 +0,0 @@
1
- /**
2
- * Copyright (c) 2019-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 ErrorMessage from "./ErrorMessage";
10
- export default ErrorMessage;