@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
package/es/Grid/Grid.js DELETED
@@ -1,94 +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 { styled } from "@ndla/styled-system/jsx";
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- const GridContainer = styled("div", {
12
- base: {
13
- display: "grid",
14
- justifyContent: "center",
15
- borderRadius: "xsmall",
16
- gridRowGap: "large",
17
- gridColumnGap: "medium",
18
- width: "100%",
19
- backgroundColor: "background.subtle",
20
- minWidth: "surface.xxsmall",
21
- gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
22
- "& :not(div[data-parallax-cell='true']) > div[data-embed-type='pitch']": {
23
- height: "100%",
24
- "& > :last-child": {
25
- marginTop: "auto"
26
- }
27
- },
28
- tabletDown: {
29
- gridTemplateColumns: "repeat(1, minmax(0, 1fr))"
30
- },
31
- tabletToDesktop: {
32
- gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
33
- "& > div:nth-child(3):last-child": {
34
- display: "flex",
35
- flexFlow: "column",
36
- justifyContent: "center",
37
- alignItems: "center",
38
- gridColumn: "span 2"
39
- }
40
- }
41
- },
42
- variants: {
43
- columns: {
44
- "2": {},
45
- "2x2": {},
46
- "3": {
47
- desktop: {
48
- gridTemplateColumns: "repeat(3, minmax(0, 1fr))"
49
- }
50
- },
51
- "4": {
52
- desktop: {
53
- gridTemplateColumns: "repeat(4, minmax(0, 1fr))"
54
- }
55
- }
56
- },
57
- background: {
58
- white: {
59
- backgroundColor: "surface.default"
60
- },
61
- transparent: {
62
- backgroundColor: "transparent"
63
- },
64
- gray: {
65
- backgroundColor: "background.subtle"
66
- }
67
- },
68
- border: {
69
- lightBlue: {
70
- padding: "xsmall",
71
- border: "1px solid",
72
- borderColor: "surface.brand.2"
73
- }
74
- }
75
- }
76
- });
77
- export const Grid = _ref => {
78
- let {
79
- columns,
80
- border,
81
- children,
82
- background = "gray",
83
- ...rest
84
- } = _ref;
85
- const amountOfColumns = children?.length === 3 ? "3" : columns;
86
- return /*#__PURE__*/_jsx(GridContainer, {
87
- "data-embed-type": "grid",
88
- border: border === "none" ? undefined : border,
89
- columns: amountOfColumns,
90
- background: background,
91
- ...rest,
92
- children: children
93
- });
94
- };
@@ -1,32 +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 { styled } from "@ndla/styled-system/jsx";
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- const StyledGridParallaxItem = styled("div", {
12
- base: {
13
- position: "relative",
14
- "& > div": {
15
- top: "var(--masthead-height, 0px)",
16
- position: "sticky"
17
- }
18
- }
19
- });
20
- export const GridParallaxItem = _ref => {
21
- let {
22
- children,
23
- ...rest
24
- } = _ref;
25
- return /*#__PURE__*/_jsx(StyledGridParallaxItem, {
26
- ...rest,
27
- "data-embed-type": "grid-parallax",
28
- children: /*#__PURE__*/_jsx("div", {
29
- children: children
30
- })
31
- });
32
- };
package/es/Grid/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 { Grid } from "./Grid";
10
- export { GridParallaxItem } from "./GridParallaxItem";
@@ -1,63 +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 { styled } from "@ndla/styled-system/jsx";
11
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
- const ContentWrapper = styled("div", {
13
- base: {
14
- display: "flex",
15
- flexDirection: "column",
16
- alignItems: "center",
17
- justifyContent: "center",
18
- gap: "xsmall",
19
- "&:not(:has(> img))": {
20
- paddingBlock: "xxlarge"
21
- }
22
- }
23
- });
24
- const StyledImage = styled("img", {
25
- base: {
26
- height: "surface.3xsmall",
27
- width: "surface.3xsmall",
28
- borderRadius: "xsmall"
29
- }
30
- });
31
- const TitleWrapper = styled("div", {
32
- base: {
33
- textStyle: "heading.large",
34
- textAlign: "center"
35
- }
36
- });
37
- const SubTitleWrapper = styled("div", {
38
- base: {
39
- textStyle: "title.medium",
40
- textAlign: "center"
41
- }
42
- });
43
- const KeyFigure = _ref => {
44
- let {
45
- image,
46
- title,
47
- subtitle
48
- } = _ref;
49
- return /*#__PURE__*/_jsxs(ContentWrapper, {
50
- "data-embed-type": "key-figure",
51
- children: [!!image && /*#__PURE__*/_jsx(StyledImage, {
52
- src: `${image?.src}?width=150`,
53
- width: 150,
54
- height: 150,
55
- alt: image?.alt
56
- }), /*#__PURE__*/_jsx(TitleWrapper, {
57
- children: parse(title)
58
- }), /*#__PURE__*/_jsx(SubTitleWrapper, {
59
- children: parse(subtitle)
60
- })]
61
- });
62
- };
63
- export default KeyFigure;
@@ -1,9 +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 KeyFigure } from "./KeyFigure";
@@ -1,212 +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 { useState } from "react";
10
- import { useTranslation } from "react-i18next";
11
- import { AlertLine } from "@ndla/icons";
12
- import { getLicenseByAbbreviation, getLicenseCredits } from "@ndla/licenses";
13
- import { Button, Text } from "@ndla/primitives";
14
- import { styled } from "@ndla/styled-system/jsx";
15
- import { LicenseLink } from "./LicenseLink";
16
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
17
- const BylineWrapper = styled("figcaption", {
18
- base: {
19
- display: "flex",
20
- flexDirection: "column",
21
- paddingBlock: "xsmall",
22
- textStyle: "label.medium",
23
- color: "text.subtle"
24
- }
25
- });
26
- const ErrorBylineWrapper = styled(BylineWrapper, {
27
- base: {
28
- border: "1px solid",
29
- borderColor: "stroke.error",
30
- borderRadius: "xsmall",
31
- background: "surface.dangerSubtle",
32
- paddingInline: "medium",
33
- paddingBlock: "medium"
34
- }
35
- });
36
- const StyledText = styled(Text, {
37
- base: {
38
- fontStyle: "italic"
39
- }
40
- });
41
- const ContentWrapper = styled("div", {
42
- base: {
43
- display: "flex",
44
- gap: "xsmall",
45
- alignItems: "center",
46
- textStyle: "label.medium"
47
- }
48
- });
49
- const BaseDescription = styled("div", {
50
- base: {
51
- display: "inline-flex",
52
- whiteSpace: "pre-wrap"
53
- }
54
- });
55
- export const EmbedByline = _ref => {
56
- let {
57
- type,
58
- description,
59
- children,
60
- visibleAlt,
61
- hideCopyright,
62
- ...props
63
- } = _ref;
64
- const {
65
- t
66
- } = useTranslation();
67
- if (props.error) {
68
- const typeString = type === "h5p" ? "H5P" : t(`embed.type.${type}`).toLowerCase();
69
- return /*#__PURE__*/_jsx(ErrorBylineWrapper, {
70
- children: /*#__PURE__*/_jsxs(ContentWrapper, {
71
- children: [/*#__PURE__*/_jsx(AlertLine, {}), /*#__PURE__*/_jsx(BaseDescription, {
72
- children: /*#__PURE__*/_jsx("span", {
73
- children: t("embed.embedError", {
74
- type: typeString
75
- })
76
- })
77
- })]
78
- })
79
- });
80
- }
81
- const {
82
- copyright
83
- } = props;
84
- const hideByline = hideCopyright && !description;
85
- return /*#__PURE__*/_jsxs(_Fragment, {
86
- children: [!hideByline && /*#__PURE__*/_jsx(BylineWrapper, {
87
- children: /*#__PURE__*/_jsxs("div", {
88
- children: [!!hideCopyright && description, !hideCopyright && /*#__PURE__*/_jsx(LicenseContainerContent, {
89
- type: type,
90
- copyright: copyright,
91
- children: description
92
- }), children]
93
- })
94
- }), visibleAlt ? /*#__PURE__*/_jsx(StyledText, {
95
- color: "text.subtle",
96
- textStyle: "label.medium",
97
- asChild: true,
98
- consumeCss: true,
99
- children: /*#__PURE__*/_jsx("span", {
100
- children: `Alt: ${visibleAlt}`
101
- })
102
- }) : null]
103
- });
104
- };
105
- const StyledDescription = styled(BaseDescription, {
106
- base: {
107
- mobileWideDown: {
108
- display: "grid",
109
- gridTemplateColumns: "1fr auto",
110
- alignItems: "center",
111
- overflow: "hidden",
112
- _open: {
113
- display: "inline"
114
- }
115
- }
116
- }
117
- });
118
- const TextContent = styled("span", {
119
- base: {
120
- mobileWideDown: {
121
- whiteSpace: "nowrap",
122
- maxHeight: "large",
123
- overflow: "hidden",
124
- textOverflow: "ellipsis",
125
- transitionProperty: "max-height",
126
- transitionDuration: "slow",
127
- transitionTimingFunction: "ease-in",
128
- marginInlineEnd: "4xsmall",
129
- _open: {
130
- whiteSpace: "pre-wrap",
131
- maxHeight: "none"
132
- }
133
- }
134
- }
135
- });
136
- const StyledButton = styled(Button, {
137
- base: {
138
- mobileWide: {
139
- display: "none"
140
- }
141
- }
142
- });
143
- const LicenseDescription = _ref2 => {
144
- let {
145
- children,
146
- isOpen,
147
- setIsOpen
148
- } = _ref2;
149
- const open = isOpen ? {
150
- "data-open": ""
151
- } : {};
152
- const {
153
- t
154
- } = useTranslation();
155
- const handleToggle = () => {
156
- setIsOpen(!isOpen);
157
- };
158
- return /*#__PURE__*/_jsx(ContentWrapper, {
159
- children: /*#__PURE__*/_jsxs(StyledDescription, {
160
- ...open,
161
- children: [/*#__PURE__*/_jsx(TextContent, {
162
- ...open,
163
- children: children
164
- }), /*#__PURE__*/_jsx(StyledButton, {
165
- variant: "link",
166
- size: "small",
167
- onClick: handleToggle,
168
- children: isOpen ? `${t("audio.readLessDescriptionLabel")}` : `${t("audio.readMoreDescriptionLabel")}`
169
- })]
170
- })
171
- });
172
- };
173
- export const LicenseContainerContent = _ref3 => {
174
- let {
175
- children,
176
- copyright,
177
- type
178
- } = _ref3;
179
- const {
180
- t,
181
- i18n
182
- } = useTranslation();
183
- const license = copyright ? getLicenseByAbbreviation(copyright.license?.license ?? "", i18n.language) : undefined;
184
- const authors = getLicenseCredits(copyright);
185
- const captionAuthors = Object.values(authors).find(i => i.length > 0) ?? [];
186
- const [isOpen, setIsOpen] = useState(false);
187
- const content = /*#__PURE__*/_jsxs(_Fragment, {
188
- children: [children, ` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`, /*#__PURE__*/_jsx("span", {
189
- children: captionAuthors.map(author => author.name).join(", ")
190
- }), license ? /*#__PURE__*/_jsxs(_Fragment, {
191
- children: [" / ", /*#__PURE__*/_jsx(LicenseLink, {
192
- license: license,
193
- hideLink: !isOpen && !!children
194
- })]
195
- }) : null]
196
- });
197
- if (children) {
198
- return /*#__PURE__*/_jsx(LicenseDescription, {
199
- isOpen: isOpen,
200
- setIsOpen: setIsOpen,
201
- children: content
202
- });
203
- }
204
- return /*#__PURE__*/_jsx(Text, {
205
- textStyle: "label.medium",
206
- asChild: true,
207
- consumeCss: true,
208
- children: /*#__PURE__*/_jsx("span", {
209
- children: content
210
- })
211
- });
212
- };
@@ -1,56 +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 { SafeLink } from "@ndla/safelink";
11
- import { styled } from "@ndla/styled-system/jsx";
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- const StyledSafeLink = styled(SafeLink, {
14
- base: {
15
- color: "text.link",
16
- textDecoration: "underline",
17
- whiteSpace: "nowrap",
18
- _hover: {
19
- textDecoration: "none"
20
- },
21
- _focusWithin: {
22
- textDecoration: "none"
23
- },
24
- mobileWideDown: {
25
- _disabled: {
26
- display: "none"
27
- }
28
- }
29
- }
30
- });
31
- export const LicenseLink = /*#__PURE__*/forwardRef((_ref, ref) => {
32
- let {
33
- license,
34
- hideLink,
35
- ...rest
36
- } = _ref;
37
- const disabled = hideLink ? {
38
- "data-disabled": ""
39
- } : {};
40
- if (license.abbreviation === "unknown") {
41
- return null;
42
- }
43
- if (license.url?.length) {
44
- return /*#__PURE__*/_jsx(StyledSafeLink, {
45
- to: license.url,
46
- rel: "license",
47
- ...disabled,
48
- ...rest,
49
- ref: ref,
50
- children: license.abbreviation
51
- });
52
- }
53
- return /*#__PURE__*/_jsx("span", {
54
- children: license.abbreviation
55
- });
56
- });
@@ -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 { EmbedByline } from "./EmbedByline";
10
- export { LicenseLink } from "./LicenseLink";
@@ -1,103 +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 } from "react";
11
- import { ArrowRightLine, CalendarLine } from "@ndla/icons";
12
- import { Heading } from "@ndla/primitives";
13
- import { SafeLink } from "@ndla/safelink";
14
- import { styled } from "@ndla/styled-system/jsx";
15
- import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
16
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
- const InfoWrapper = styled("div", {
18
- base: {
19
- display: "flex",
20
- flexDirection: "column",
21
- gap: "xsmall"
22
- }
23
- });
24
- const StyledSafeLink = styled(SafeLink, {
25
- base: {
26
- display: "flex",
27
- justifyContent: "space-between",
28
- alignItems: "center",
29
- background: "surface.default",
30
- padding: "medium",
31
- border: "1px solid",
32
- borderColor: "stroke.subtle",
33
- borderRadius: "xsmall",
34
- "& h3": {
35
- textDecoration: "underline"
36
- },
37
- "& [data-forward]": {
38
- transitionProperty: "width, height",
39
- transitionTimingFunction: "ease-in-out",
40
- transitionDuration: "fast"
41
- },
42
- _hover: {
43
- "& h3": {
44
- textDecoration: "none"
45
- },
46
- "& [data-forward]": {
47
- width: "large",
48
- height: "large"
49
- }
50
- }
51
- }
52
- });
53
- const StyledDateContainer = styled("div", {
54
- base: {
55
- display: "flex",
56
- alignItems: "center",
57
- gap: "xxsmall"
58
- }
59
- });
60
- const StyledCalendarEd = styled(CalendarLine, {
61
- base: {
62
- color: "icon.strong"
63
- }
64
- });
65
- const LinkBlock = _ref => {
66
- let {
67
- title,
68
- articleLanguage,
69
- date,
70
- url,
71
- path
72
- } = _ref;
73
- const href = getPossiblyRelativeUrl(url, path);
74
- const formattedDate = useMemo(() => {
75
- if (!date) return null;
76
- return new Intl.DateTimeFormat(articleLanguage, {
77
- timeZone: "CET",
78
- day: "2-digit",
79
- month: "long",
80
- year: "numeric"
81
- }).format(new Date(date));
82
- }, [date, articleLanguage]);
83
- return /*#__PURE__*/_jsxs(StyledSafeLink, {
84
- to: href,
85
- "data-embed-type": "link-block",
86
- children: [/*#__PURE__*/_jsxs(InfoWrapper, {
87
- children: [/*#__PURE__*/_jsx(Heading, {
88
- asChild: true,
89
- consumeCss: true,
90
- textStyle: "title.medium",
91
- children: /*#__PURE__*/_jsx("h3", {
92
- "data-heading": true,
93
- children: parse(title)
94
- })
95
- }), !!date && /*#__PURE__*/_jsxs(StyledDateContainer, {
96
- children: [/*#__PURE__*/_jsx(StyledCalendarEd, {}), formattedDate]
97
- })]
98
- }), /*#__PURE__*/_jsx(ArrowRightLine, {
99
- "data-forward": true
100
- })]
101
- });
102
- };
103
- export default LinkBlock;
@@ -1,35 +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 { Children } from "react";
10
- import { styled } from "@ndla/styled-system/jsx";
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
- const StyledList = styled("ul", {
13
- base: {
14
- display: "flex",
15
- flexDirection: "column",
16
- gap: "xsmall",
17
- listStyle: "none"
18
- }
19
- });
20
- const LinkBlockSection = _ref => {
21
- let {
22
- children,
23
- ...rest
24
- } = _ref;
25
- return /*#__PURE__*/_jsx("nav", {
26
- ...rest,
27
- "data-embed-type": "link-block-list",
28
- children: /*#__PURE__*/_jsx(StyledList, {
29
- children: Children.map(children, child => /*#__PURE__*/_jsx("li", {
30
- children: child
31
- }))
32
- })
33
- });
34
- };
35
- export default LinkBlockSection;
@@ -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 LinkBlock } from "./LinkBlock";
10
- export { default as LinkBlockSection } from "./LinkBlockSection";