@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,61 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _reactI18next = require("react-i18next");
8
- var _ContentType = require("../model/ContentType");
9
- var _RelatedArticleList = require("../RelatedArticleList/RelatedArticleList");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- /**
12
- * Copyright (c) 2023-present, NDLA.
13
- *
14
- * This source code is licensed under the GPLv3 license found in the
15
- * LICENSE file in the root directory of this source tree.
16
- *
17
- */
18
-
19
- const RelatedContentEmbed = _ref => {
20
- let {
21
- embed,
22
- isOembed,
23
- subject,
24
- ndlaFrontendDomain
25
- } = _ref;
26
- const {
27
- t
28
- } = (0, _reactI18next.useTranslation)();
29
- if (embed.status === "error") {
30
- return null;
31
- }
32
- const {
33
- data,
34
- embedData
35
- } = embed;
36
- if (embedData.articleId && data) {
37
- const typeId = data.resource?.resourceTypes.find(rt => _ContentType.contentTypeMapping[rt.id])?.id;
38
- const type = typeId ? _ContentType.contentTypeMapping[typeId] : undefined;
39
- const context = data.resource?.contexts.find(c => c.rootId === subject);
40
- const url = context?.url ?? data.resource?.url ?? `/article/${embedData.articleId}`;
41
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RelatedArticleList.RelatedArticle, {
42
- title: data.article.title?.title ?? "",
43
- introduction: data.article.metaDescription?.metaDescription ?? "",
44
- target: isOembed ? "_blank" : undefined,
45
- to: `${ndlaFrontendDomain ?? ""}${url ?? ""}`,
46
- type: type
47
- });
48
- }
49
- if (typeof embedData.url === "string") {
50
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RelatedArticleList.RelatedArticle, {
51
- title: embedData.title ?? "",
52
- introduction: "",
53
- to: embedData.url,
54
- target: "_blank",
55
- type: "external",
56
- linkInfo: `${t("related.linkInfo")} ${embedData.urlDomain}`
57
- });
58
- }
59
- return null;
60
- };
61
- var _default = exports.default = RelatedContentEmbed;
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _reactI18next = require("react-i18next");
8
- var _primitives = require("@ndla/primitives");
9
- var _jsxRuntime = require("react/jsx-runtime");
10
- /**
11
- * Copyright (c) 2023-present, NDLA.
12
- *
13
- * This source code is licensed under the GPLv3 license found in the
14
- * LICENSE file in the root directory of this source tree.
15
- *
16
- */
17
-
18
- const UnknownEmbed = _ref => {
19
- let {
20
- embed
21
- } = _ref;
22
- const {
23
- t
24
- } = (0, _reactI18next.useTranslation)();
25
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
26
- color: "text.error",
27
- asChild: true,
28
- consumeCss: true,
29
- "data-embed-type": "unknown",
30
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
31
- children: t("embed.unsupported", {
32
- type: embed.resource
33
- })
34
- })
35
- });
36
- };
37
- var _default = exports.default = UnknownEmbed;
@@ -1,94 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _reactI18next = require("react-i18next");
8
- var _react = require("@ark-ui/react");
9
- var _icons = require("@ndla/icons");
10
- var _primitives = require("@ndla/primitives");
11
- var _jsx2 = require("@ndla/styled-system/jsx");
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- /**
14
- * Copyright (c) 2024-present, NDLA.
15
- *
16
- * This source code is licensed under the GPLv3 license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- *
19
- */
20
-
21
- const DisclaimerWrapper = (0, _jsx2.styled)("div", {
22
- base: {
23
- display: "flex",
24
- flexDirection: "column",
25
- gap: "3xsmall",
26
- clear: "both"
27
- }
28
- });
29
- const StyledIconButton = (0, _jsx2.styled)(_primitives.IconButton, {
30
- base: {
31
- alignSelf: "flex-end"
32
- }
33
- });
34
- const StyledErrorWarningFill = (0, _jsx2.styled)(_icons.ErrorWarningFill, {
35
- base: {
36
- alignSelf: "flex-end",
37
- fill: "icon.subtle"
38
- }
39
- });
40
- const StyledPopoverContent = (0, _jsx2.styled)(_primitives.PopoverContent, {
41
- base: {
42
- width: "surface.xlarge",
43
- maxHeight: "50vh",
44
- overflowY: "auto"
45
- }
46
- });
47
- const UuDisclaimerEmbed = _ref => {
48
- let {
49
- embed,
50
- transformedDisclaimer,
51
- children
52
- } = _ref;
53
- const {
54
- t
55
- } = (0, _reactI18next.useTranslation)();
56
- if (embed.status === "error") {
57
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DisclaimerWrapper, {
58
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StyledErrorWarningFill, {
59
- "aria-label": t("embed.embedError", {
60
- type: t("embed.type.disclaimer")
61
- }),
62
- title: t("embed.embedError", {
63
- type: t("embed.type.disclaimer")
64
- })
65
- }), children]
66
- });
67
- }
68
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DisclaimerWrapper, {
69
- role: "region",
70
- "data-embed-type": "uu-disclaimer",
71
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.PopoverRoot, {
72
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.PopoverTrigger, {
73
- asChild: true,
74
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledIconButton, {
75
- size: "small",
76
- variant: "secondary",
77
- "aria-label": t("uuDisclaimer.title"),
78
- title: t("uuDisclaimer.title"),
79
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.AccessibilityFill, {})
80
- })
81
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Portal, {
82
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledPopoverContent, {
83
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
84
- children: transformedDisclaimer
85
- })
86
- })
87
- })]
88
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
89
- "data-uu-content": "",
90
- children: children
91
- })]
92
- });
93
- };
94
- var _default = exports.default = UuDisclaimerEmbed;
@@ -1,150 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "AudioEmbed", {
7
- enumerable: true,
8
- get: function () {
9
- return _AudioEmbed.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "BlockConcept", {
13
- enumerable: true,
14
- get: function () {
15
- return _ConceptEmbed.BlockConcept;
16
- }
17
- });
18
- Object.defineProperty(exports, "BrightcoveEmbed", {
19
- enumerable: true,
20
- get: function () {
21
- return _BrightcoveEmbed.default;
22
- }
23
- });
24
- Object.defineProperty(exports, "CodeEmbed", {
25
- enumerable: true,
26
- get: function () {
27
- return _CodeEmbed.default;
28
- }
29
- });
30
- Object.defineProperty(exports, "ConceptEmbed", {
31
- enumerable: true,
32
- get: function () {
33
- return _ConceptEmbed.ConceptEmbed;
34
- }
35
- });
36
- Object.defineProperty(exports, "ConceptInlineTriggerButton", {
37
- enumerable: true,
38
- get: function () {
39
- return _ConceptInlineTriggerButton.ConceptInlineTriggerButton;
40
- }
41
- });
42
- Object.defineProperty(exports, "ContentLinkEmbed", {
43
- enumerable: true,
44
- get: function () {
45
- return _ContentLinkEmbed.default;
46
- }
47
- });
48
- Object.defineProperty(exports, "CopyrightEmbed", {
49
- enumerable: true,
50
- get: function () {
51
- return _CopyrightEmbed.default;
52
- }
53
- });
54
- Object.defineProperty(exports, "EmbedWrapper", {
55
- enumerable: true,
56
- get: function () {
57
- return _EmbedWrapper.EmbedWrapper;
58
- }
59
- });
60
- Object.defineProperty(exports, "ExternalEmbed", {
61
- enumerable: true,
62
- get: function () {
63
- return _ExternalEmbed.default;
64
- }
65
- });
66
- Object.defineProperty(exports, "FootnoteEmbed", {
67
- enumerable: true,
68
- get: function () {
69
- return _FootnoteEmbed.default;
70
- }
71
- });
72
- Object.defineProperty(exports, "H5pEmbed", {
73
- enumerable: true,
74
- get: function () {
75
- return _H5pEmbed.default;
76
- }
77
- });
78
- Object.defineProperty(exports, "IframeEmbed", {
79
- enumerable: true,
80
- get: function () {
81
- return _IframeEmbed.default;
82
- }
83
- });
84
- Object.defineProperty(exports, "ImageEmbed", {
85
- enumerable: true,
86
- get: function () {
87
- return _ImageEmbed.default;
88
- }
89
- });
90
- Object.defineProperty(exports, "InlineConcept", {
91
- enumerable: true,
92
- get: function () {
93
- return _ConceptEmbed.InlineConcept;
94
- }
95
- });
96
- Object.defineProperty(exports, "InlineTriggerButton", {
97
- enumerable: true,
98
- get: function () {
99
- return _InlineTriggerButton.InlineTriggerButton;
100
- }
101
- });
102
- Object.defineProperty(exports, "RelatedContentEmbed", {
103
- enumerable: true,
104
- get: function () {
105
- return _RelatedContentEmbed.default;
106
- }
107
- });
108
- Object.defineProperty(exports, "UnknownEmbed", {
109
- enumerable: true,
110
- get: function () {
111
- return _UnknownEmbed.default;
112
- }
113
- });
114
- Object.defineProperty(exports, "UuDisclaimerEmbed", {
115
- enumerable: true,
116
- get: function () {
117
- return _UuDisclaimerEmbed.default;
118
- }
119
- });
120
- Object.defineProperty(exports, "getCrop", {
121
- enumerable: true,
122
- get: function () {
123
- return _ImageEmbed.getCrop;
124
- }
125
- });
126
- Object.defineProperty(exports, "getFocalPoint", {
127
- enumerable: true,
128
- get: function () {
129
- return _ImageEmbed.getFocalPoint;
130
- }
131
- });
132
- var _ImageEmbed = _interopRequireWildcard(require("./ImageEmbed"));
133
- var _InlineTriggerButton = require("./InlineTriggerButton");
134
- var _AudioEmbed = _interopRequireDefault(require("./AudioEmbed"));
135
- var _H5pEmbed = _interopRequireDefault(require("./H5pEmbed"));
136
- var _ExternalEmbed = _interopRequireDefault(require("./ExternalEmbed"));
137
- var _IframeEmbed = _interopRequireDefault(require("./IframeEmbed"));
138
- var _FootnoteEmbed = _interopRequireDefault(require("./FootnoteEmbed"));
139
- var _BrightcoveEmbed = _interopRequireDefault(require("./BrightcoveEmbed"));
140
- var _ContentLinkEmbed = _interopRequireDefault(require("./ContentLinkEmbed"));
141
- var _RelatedContentEmbed = _interopRequireDefault(require("./RelatedContentEmbed"));
142
- var _ConceptEmbed = require("./ConceptEmbed");
143
- var _UnknownEmbed = _interopRequireDefault(require("./UnknownEmbed"));
144
- var _UuDisclaimerEmbed = _interopRequireDefault(require("./UuDisclaimerEmbed"));
145
- var _CopyrightEmbed = _interopRequireDefault(require("./CopyrightEmbed"));
146
- var _CodeEmbed = _interopRequireDefault(require("./CodeEmbed"));
147
- var _EmbedWrapper = require("./EmbedWrapper");
148
- var _ConceptInlineTriggerButton = require("./ConceptInlineTriggerButton");
149
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
150
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1,101 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.ErrorMessage = void 0;
7
- var _primitives = require("@ndla/primitives");
8
- var _safelink = require("@ndla/safelink");
9
- var _jsx2 = require("@ndla/styled-system/jsx");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- /**
12
- * Copyright (c) 2019-present, NDLA.
13
- *
14
- * This source code is licensed under the GPLv3 license found in the
15
- * LICENSE file in the root directory of this source tree.
16
- *
17
- */
18
-
19
- // TODO: This has not been redesignet yet. This is just a rewrite of the previous design in panda
20
- const StyledErrorMessage = (0, _jsx2.styled)("article", {
21
- base: {
22
- textAlign: "center",
23
- "& a": {
24
- color: "text.strong"
25
- },
26
- "& h1": {
27
- marginTop: "0"
28
- }
29
- }
30
- });
31
- const IllustrationWrapper = (0, _jsx2.styled)("div", {
32
- base: {
33
- display: "flex",
34
- justifyContent: "center",
35
- marginBottom: "medium",
36
- tablet: {
37
- marginTop: "xxlarge"
38
- }
39
- }
40
- });
41
- const Description = (0, _jsx2.styled)(_primitives.Text, {
42
- base: {
43
- marginBottom: "medium",
44
- tablet: {
45
- marginBottom: "xxlarge"
46
- }
47
- }
48
- });
49
- const CustomElementWrapper = (0, _jsx2.styled)("div", {
50
- base: {
51
- marginBlock: "xxlarge"
52
- }
53
- });
54
- const MessageWrapper = (0, _jsx2.styled)("div", {
55
- base: {
56
- marginTop: "3xsmall"
57
- }
58
- });
59
- const ErrorMessage = _ref => {
60
- let {
61
- children,
62
- messages,
63
- illustration,
64
- illustrationElement,
65
- customElement
66
- } = _ref;
67
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledErrorMessage, {
68
- children: [!!illustration && /*#__PURE__*/(0, _jsxRuntime.jsx)(IllustrationWrapper, {
69
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
70
- src: illustration.url,
71
- alt: illustration.altText
72
- })
73
- }), !!illustrationElement && /*#__PURE__*/(0, _jsxRuntime.jsx)(IllustrationWrapper, {
74
- children: illustrationElement
75
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
76
- children: messages.title
77
- }), !!messages.description && /*#__PURE__*/(0, _jsxRuntime.jsx)(Description, {
78
- children: messages.description
79
- }), !!customElement && /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomElementWrapper, {
80
- children: customElement
81
- }), !!messages.linksTitle && /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
82
- children: messages.linksTitle
83
- }), !!messages.back && /*#__PURE__*/(0, _jsxRuntime.jsx)(_safelink.SafeLink, {
84
- to: `/#${encodeURI(messages.back)}`,
85
- onClick: () => window.history.back(),
86
- children: messages.back
87
- }), !!messages.goToFrontPage && /*#__PURE__*/(0, _jsxRuntime.jsx)(MessageWrapper, {
88
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_safelink.SafeLink, {
89
- to: "/",
90
- children: messages.goToFrontPage
91
- })
92
- }), !!messages.logInFailed && /*#__PURE__*/(0, _jsxRuntime.jsx)(MessageWrapper, {
93
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_safelink.SafeLink, {
94
- to: "/minndla",
95
- children: messages.logInFailed
96
- })
97
- }), children]
98
- });
99
- };
100
- exports.ErrorMessage = ErrorMessage;
101
- var _default = exports.default = ErrorMessage;
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _ErrorMessage = _interopRequireDefault(require("./ErrorMessage"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- /**
10
- * Copyright (c) 2019-present, NDLA.
11
- *
12
- * This source code is licensed under the GPLv3 license found in the
13
- * LICENSE file in the root directory of this source tree.
14
- *
15
- */
16
- var _default = exports.default = _ErrorMessage.default;
@@ -1,184 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactI18next = require("react-i18next");
9
- var _icons = require("@ndla/icons");
10
- var _primitives = require("@ndla/primitives");
11
- var _jsx2 = require("@ndla/styled-system/jsx");
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
- /**
15
- * Copyright (c) 2016-present, NDLA.
16
- *
17
- * This source code is licensed under the GPLv3 license found in the
18
- * LICENSE file in the root directory of this source tree.
19
- *
20
- */
21
-
22
- const StyledAside = (0, _jsx2.styled)("aside", {
23
- base: {
24
- position: "relative",
25
- padding: "medium",
26
- display: "grid",
27
- gridTemplateRows: "0fr",
28
- transitionProperty: "grid-template-rows",
29
- transitionDuration: "slow",
30
- transitionTimingFunction: "ease-in-out",
31
- justifyItems: "center",
32
- border: "1px solid",
33
- borderColor: "stroke.default",
34
- borderRadius: "xsmall",
35
- clear: "both",
36
- _open: {
37
- gridTemplateRows: "1fr"
38
- },
39
- _closed: {
40
- _print: {
41
- overflow: "visible",
42
- maxHeight: "500vh"
43
- }
44
- },
45
- "& > div": {
46
- minHeight: "surface.3xsmall"
47
- }
48
- },
49
- variants: {
50
- overflowHidden: {
51
- true: {
52
- "& > div": {
53
- overflow: "hidden"
54
- }
55
- }
56
- }
57
- }
58
- });
59
- const StyledContent = (0, _jsx2.styled)("div", {
60
- base: {
61
- position: "relative",
62
- width: "100%",
63
- // Reset the top margin of the very first child.
64
- "& :first-child": {
65
- marginBlockStart: "0"
66
- },
67
- _after: {
68
- content: '""',
69
- textAlign: "center",
70
- position: "absolute",
71
- inset: "0",
72
- transitionProperty: "opacity",
73
- transitionDuration: "slow",
74
- transitionTimingFunction: "ease-in-out",
75
- gradientFrom: "surface.default/20",
76
- gradientTo: "surface.default/95",
77
- backgroundGradient: "to-b",
78
- opacity: "1",
79
- zIndex: "base",
80
- pointerEvents: "none"
81
- },
82
- _print: {
83
- overflow: "visible",
84
- _after: {
85
- display: "none"
86
- }
87
- },
88
- _open: {
89
- paddingBlockEnd: "xsmall",
90
- _after: {
91
- opacity: "0"
92
- }
93
- }
94
- }
95
- });
96
- const StyledIconButton = (0, _jsx2.styled)(_primitives.IconButton, {
97
- base: {
98
- position: "absolute",
99
- bottom: "-medium",
100
- zIndex: "base",
101
- "& svg": {
102
- transitionProperty: "transform",
103
- transitionTimingFunction: "ease-in-out",
104
- transitionDuration: "fast"
105
- },
106
- _open: {
107
- "& svg": {
108
- transform: "rotate(180deg)"
109
- }
110
- },
111
- _print: {
112
- display: "none"
113
- }
114
- }
115
- });
116
-
117
- // TODO: Consider moving the open trigger depending on whether the content is open or closed.
118
-
119
- const FactBox = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
120
- let {
121
- children,
122
- open,
123
- onOpenChange,
124
- defaultOpen = false,
125
- ...rest
126
- } = _ref;
127
- const {
128
- t
129
- } = (0, _reactI18next.useTranslation)();
130
- const [state, setState] = (0, _react.useState)(defaultOpen ? "open" : "closed");
131
- const [overflowHidden, setOverflowHidden] = (0, _react.useState)(!defaultOpen);
132
- const contentId = (0, _react.useId)();
133
- // 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.
134
- // When running in React 18, we need to use an empty string instead of true.
135
- // TODO: Remove this hack once we upgrade to React 19 as a peer dep.
136
- const inertAttribute = (0, _react.useMemo)(() => {
137
- return state === "closed" ? {
138
- inert: typeof _react.default.use === "function" ? true : ""
139
- } : {};
140
- }, [state]);
141
- (0, _react.useEffect)(() => {
142
- if (open !== undefined) {
143
- setState(open ? "open" : "closed");
144
- }
145
- }, [open]);
146
- const onClick = (0, _react.useCallback)(() => {
147
- const newState = state === "open" ? "closed" : "open";
148
- setState(newState);
149
- onOpenChange?.(newState === "open");
150
- }, [state, onOpenChange]);
151
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledAside, {
152
- "data-state": state,
153
- "data-embed-type": "factbox",
154
- ...rest,
155
- ref: ref,
156
- overflowHidden: overflowHidden,
157
- onTransitionStart: e => {
158
- if (e.target === e.currentTarget && state === "closed") {
159
- setOverflowHidden(true);
160
- }
161
- },
162
- onTransitionEnd: e => {
163
- if (e.target === e.currentTarget && state === "open") {
164
- setOverflowHidden(false);
165
- }
166
- },
167
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StyledIconButton, {
168
- "data-state": state,
169
- onClick: onClick,
170
- contentEditable: false,
171
- "aria-expanded": state === "open",
172
- "aria-controls": contentId,
173
- "aria-label": t(`factbox.${state === "open" ? "close" : "open"}`),
174
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ArrowDownShortLine, {})
175
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledContent, {
176
- id: contentId,
177
- "data-state": state,
178
- "aria-hidden": state === "closed",
179
- ...inertAttribute,
180
- children: children
181
- })]
182
- });
183
- });
184
- var _default = exports.default = FactBox;
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _FactBox = _interopRequireDefault(require("./FactBox"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- /**
10
- * Copyright (c) 2018-present, NDLA.
11
- *
12
- * This source code is licensed under the GPLv3 license found in the
13
- * LICENSE file in the root directory of this source tree.
14
- *
15
- */
16
- var _default = exports.default = _FactBox.default;