@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,207 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ArticleWrapper = exports.ArticleTitle = exports.ArticleHeader = exports.ArticleHGroup = exports.ArticleFooter = exports.ArticleContent = exports.Article = void 0;
7
- var _react = require("react");
8
- var _react2 = require("@ark-ui/react");
9
- var _primitives = require("@ndla/primitives");
10
- var _css = require("@ndla/styled-system/css");
11
- var _jsx2 = require("@ndla/styled-system/jsx");
12
- var _ArticleByline = require("./ArticleByline");
13
- var _ContentTypeBadge = require("../ContentTypeBadge/ContentTypeBadge");
14
- var _jsxRuntime = require("react/jsx-runtime");
15
- /**
16
- * Copyright (c) 2016-present, NDLA.
17
- *
18
- * This source code is licensed under the GPLv3 license found in the
19
- * LICENSE file in the root directory of this source tree.
20
- *
21
- */
22
-
23
- const StyledArticleContent = (0, _jsx2.styled)(_react2.ark.section, {}, {
24
- baseComponent: true
25
- });
26
- const ArticleContent = exports.ArticleContent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
27
- let {
28
- className,
29
- ...props
30
- } = _ref;
31
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledArticleContent, {
32
- className: (0, _css.cx)("ndla-article", className),
33
- ...props,
34
- ref: ref
35
- });
36
- });
37
- const StyledArticleWrapper = (0, _jsx2.styled)(_react2.ark.article, {
38
- base: {
39
- background: "background.default",
40
- display: "flex",
41
- flexDirection: "column",
42
- color: "text.default",
43
- alignItems: "center",
44
- width: "100%",
45
- overflowWrap: "break-word",
46
- position: "relative",
47
- "& mjx-stretchy-v > mjx-ext > mjx-c": {
48
- transform: "scaleY(100) translateY(0.075em)"
49
- },
50
- _after: {
51
- content: "",
52
- display: "table",
53
- clear: "both"
54
- }
55
- }
56
- }, {
57
- baseComponent: true
58
- });
59
- const ArticleWrapper = exports.ArticleWrapper = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledArticleWrapper, {
60
- "data-ndla-article": "",
61
- ref: ref,
62
- ...props
63
- }));
64
- const ArticleHGroup = exports.ArticleHGroup = (0, _jsx2.styled)(_react2.ark.hgroup, {
65
- base: {
66
- display: "flex",
67
- width: "100%",
68
- flexDirection: "column",
69
- alignItems: "flex-start",
70
- "& h1": {
71
- overflowWrap: "anywhere"
72
- }
73
- }
74
- }, {
75
- baseComponent: true
76
- });
77
- const ArticleHeader = exports.ArticleHeader = (0, _jsx2.styled)(_react2.ark.header, {
78
- base: {
79
- display: "flex",
80
- flexDirection: "column",
81
- gap: "medium",
82
- alignItems: "flex-start",
83
- width: "100%",
84
- paddingBlockStart: "xxlarge",
85
- overflowWrap: "anywhere"
86
- }
87
- }, {
88
- baseComponent: true
89
- });
90
- const ArticleFooter = exports.ArticleFooter = (0, _jsx2.styled)(_react2.ark.footer, {
91
- base: {
92
- display: "flex",
93
- flexDirection: "column",
94
- gap: "xxlarge",
95
- width: "100%",
96
- "& > :is(:last-child)": {
97
- paddingBlockEnd: "5xlarge"
98
- }
99
- }
100
- }, {
101
- baseComponent: true
102
- });
103
- const StyledStack = (0, _jsx2.styled)(_jsx2.Stack, {
104
- base: {
105
- width: "100%",
106
- minHeight: "xxlarge"
107
- }
108
- });
109
- const StyledWrapper = (0, _jsx2.styled)("div", {
110
- base: {
111
- display: "flex",
112
- gap: "small",
113
- flexWrap: "wrap",
114
- alignItems: "center"
115
- }
116
- });
117
- const ArticleTitle = _ref2 => {
118
- let {
119
- contentType,
120
- heartButton,
121
- title,
122
- lang,
123
- id,
124
- introduction,
125
- contentTypeLabel,
126
- competenceGoals,
127
- disclaimer
128
- } = _ref2;
129
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ArticleHeader, {
130
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(ArticleHGroup, {
131
- children: [(!!contentType || !!heartButton) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledStack, {
132
- justify: "space-between",
133
- align: "center",
134
- direction: "row",
135
- gap: "small",
136
- children: [!!contentType && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ContentTypeBadge.ContentTypeBadge, {
137
- contentType: contentType,
138
- children: contentTypeLabel
139
- }), heartButton]
140
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Heading, {
141
- textStyle: "heading.medium",
142
- id: id,
143
- lang: lang,
144
- property: "dct:title",
145
- children: title
146
- })]
147
- }), !!introduction && /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
148
- lang: lang,
149
- textStyle: "body.xlarge",
150
- asChild: true,
151
- consumeCss: true,
152
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
153
- children: introduction
154
- })
155
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledWrapper, {
156
- children: [competenceGoals, disclaimer]
157
- })]
158
- });
159
- };
160
- exports.ArticleTitle = ArticleTitle;
161
- const Article = _ref3 => {
162
- let {
163
- article,
164
- contentType,
165
- licenseBox,
166
- children,
167
- competenceGoals,
168
- contentTypeLabel,
169
- id,
170
- heartButton,
171
- lang,
172
- disclaimer
173
- } = _ref3;
174
- const {
175
- title,
176
- introduction,
177
- published,
178
- content,
179
- footNotes,
180
- copyright
181
- } = article;
182
- const authors = copyright?.creators.length || copyright?.rightsholders.length ? copyright.creators : copyright?.processors;
183
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ArticleWrapper, {
184
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ArticleTitle, {
185
- id: id,
186
- contentType: contentType,
187
- heartButton: heartButton,
188
- title: title,
189
- introduction: introduction,
190
- competenceGoals: competenceGoals,
191
- lang: lang,
192
- contentTypeLabel: contentTypeLabel,
193
- disclaimer: disclaimer
194
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ArticleContent, {
195
- children: content
196
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(ArticleFooter, {
197
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ArticleByline.ArticleByline, {
198
- footnotes: footNotes,
199
- authors: authors,
200
- suppliers: copyright?.rightsholders,
201
- published: published,
202
- licenseBox: licenseBox
203
- }), children]
204
- })]
205
- });
206
- };
207
- exports.Article = Article;
@@ -1,189 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ArticleBylineAccordionItem = exports.ArticleByline = void 0;
7
- var _react = require("react");
8
- var _reactI18next = require("react-i18next");
9
- var _reactRouter = require("react-router");
10
- var _icons = require("@ndla/icons");
11
- var _primitives = require("@ndla/primitives");
12
- var _jsx2 = require("@ndla/styled-system/jsx");
13
- var _ArticleFootNotes = require("./ArticleFootNotes");
14
- var _jsxRuntime = require("react/jsx-runtime");
15
- /**
16
- * Copyright (c) 2020-present, NDLA.
17
- *
18
- * This source code is licensed under the GPLv3 license found in the
19
- * LICENSE file in the root directory of this source tree.
20
- *
21
- */
22
-
23
- const Wrapper = (0, _jsx2.styled)("div", {
24
- base: {
25
- // TODO: Figure out if we want to remove this margin. It's only here to add some gap between the article content and the byline.
26
- marginBlockStart: "medium",
27
- paddingBlockStart: "xsmall",
28
- borderTop: "1px solid",
29
- borderColor: "stroke.subtle"
30
- }
31
- });
32
- const TextWrapper = (0, _jsx2.styled)("div", {
33
- base: {
34
- display: "flex",
35
- flexDirection: "column",
36
- gap: "3xsmall",
37
- width: "100%",
38
- justifyContent: "space-between",
39
- paddingBlock: "xsmall",
40
- textStyle: "body.medium",
41
- '& [data-contributors="false"]': {
42
- marginInlineStart: "auto"
43
- }
44
- },
45
- variants: {
46
- learningpath: {
47
- true: {},
48
- false: {
49
- tabletWide: {
50
- flexDirection: "row"
51
- }
52
- }
53
- }
54
- }
55
- });
56
- const renderContributors = (contributors, t) => {
57
- const contributorsArray = contributors.map((contributor, index) => {
58
- if (index < 1) return contributor.name;
59
- const sep = index === contributors.length - 1 ? ` ${t("article.conjunction")} ` : ", ";
60
- return `${sep}${contributor.name}`;
61
- });
62
- return contributorsArray.join("");
63
- };
64
- const getSuppliersText = (suppliers, t) => {
65
- if (suppliers.length === 0) {
66
- return "";
67
- }
68
- return suppliers.length > 1 ? t("article.multipleSuppliersLabel", {
69
- names: renderContributors(suppliers, t),
70
- interpolation: {
71
- escapeValue: false
72
- }
73
- }) : t("article.supplierLabel", {
74
- name: renderContributors(suppliers, t),
75
- interpolation: {
76
- escapeValue: false
77
- }
78
- });
79
- };
80
- const StyledAccordionRoot = (0, _jsx2.styled)(_primitives.AccordionRoot, {
81
- base: {
82
- paddingBlockStart: "xxlarge"
83
- }
84
- });
85
- const refRegexp = /note\d/;
86
- const footnotesAccordionId = "footnotes";
87
- const ArticleByline = _ref => {
88
- let {
89
- authors = [],
90
- suppliers = [],
91
- footnotes,
92
- licenseBox,
93
- published,
94
- displayByline = true,
95
- bylineType = "article",
96
- bylineSuffix
97
- } = _ref;
98
- const {
99
- t
100
- } = (0, _reactI18next.useTranslation)();
101
- const {
102
- pathname
103
- } = (0, _reactRouter.useLocation)();
104
- const [openAccordions, setOpenAccordions] = (0, _react.useState)([]);
105
- const accordionItemValue = "rulesForUse";
106
- const onHashChange = (0, _react.useCallback)(e => {
107
- const hash = e.newURL.split("#")[1];
108
- if (hash?.match(refRegexp) && !openAccordions.includes(footnotesAccordionId)) {
109
- setOpenAccordions([...openAccordions, footnotesAccordionId]);
110
- const el = document.getElementById(`#${hash}`);
111
- el?.click();
112
- el?.focus();
113
- }
114
- }, [openAccordions]);
115
- (0, _react.useEffect)(() => {
116
- setOpenAccordions(prev => prev.filter(state => state !== accordionItemValue));
117
- }, [pathname]);
118
- (0, _react.useEffect)(() => {
119
- window.addEventListener("hashchange", onHashChange);
120
- return () => window.removeEventListener("hashchange", onHashChange);
121
- }, [onHashChange]);
122
- const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;
123
- const authorLabel = {
124
- article: "article.authorsLabel",
125
- learningPath: "article.authorsLabelLearningpath",
126
- external: "article.authorsLabelExternal"
127
- };
128
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
129
- children: [!!displayByline && /*#__PURE__*/(0, _jsxRuntime.jsxs)(TextWrapper, {
130
- learningpath: bylineType === "learningPath",
131
- children: [!!showPrimaryContributors && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
132
- children: [authors.length > 0 && `${t(authorLabel[bylineType], {
133
- names: renderContributors(authors, t),
134
- interpolation: {
135
- escapeValue: false
136
- }
137
- })}. `, getSuppliersText(suppliers, t)]
138
- }), published ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
139
- "data-contributors": showPrimaryContributors,
140
- children: [t(`${bylineType}.lastUpdated`), " ", published]
141
- }) : null, bylineSuffix]
142
- }), (!!licenseBox || !!footnotes?.length) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledAccordionRoot, {
143
- multiple: true,
144
- value: openAccordions,
145
- onValueChange: details => setOpenAccordions(details.value),
146
- children: [!!licenseBox && /*#__PURE__*/(0, _jsxRuntime.jsx)(ArticleBylineAccordionItem, {
147
- value: accordionItemValue,
148
- accordionTitle: t("article.useContent"),
149
- children: licenseBox
150
- }), !!footnotes?.length && /*#__PURE__*/(0, _jsxRuntime.jsx)(ArticleBylineAccordionItem, {
151
- value: footnotesAccordionId,
152
- accordionTitle: t("article.footnotes"),
153
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArticleFootNotes.ArticleFootNotes, {
154
- footNotes: footnotes
155
- })
156
- })]
157
- })]
158
- });
159
- };
160
- exports.ArticleByline = ArticleByline;
161
- const ArticleBylineAccordionItem = exports.ArticleBylineAccordionItem = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
162
- let {
163
- value,
164
- accordionTitle,
165
- children,
166
- ...props
167
- } = _ref2;
168
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.AccordionItem, {
169
- value: value,
170
- ref: ref,
171
- ...props,
172
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Heading, {
173
- asChild: true,
174
- consumeCss: true,
175
- textStyle: "label.medium",
176
- fontWeight: "bold",
177
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
178
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.AccordionItemTrigger, {
179
- children: [accordionTitle, /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.AccordionItemIndicator, {
180
- asChild: true,
181
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ArrowDownShortLine, {})
182
- })]
183
- })
184
- })
185
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.AccordionItemContent, {
186
- children: children
187
- })]
188
- });
189
- });
@@ -1,67 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ArticleFootNotes = void 0;
7
- var _primitives = require("@ndla/primitives");
8
- var _jsx2 = require("@ndla/styled-system/jsx");
9
- var _jsxRuntime = require("react/jsx-runtime");
10
- /**
11
- * Copyright (c) 2017-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 citeDetailString = description => description ? `${description}. ` : "";
19
- const StyledCite = (0, _jsx2.styled)("cite", {
20
- base: {
21
- display: "flex",
22
- alignItems: "center",
23
- gap: "xsmall"
24
- }
25
- });
26
- const FootNote = _ref => {
27
- let {
28
- footNote
29
- } = _ref;
30
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
31
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
32
- id: `note${footNote.ref}`,
33
- asChild: true,
34
- consumeCss: true,
35
- textStyle: "body.medium",
36
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledCite, {
37
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
38
- href: `#ref${footNote.ref}`,
39
- target: "_self",
40
- children: footNote.ref
41
- }), `«${footNote.title}». ${footNote.authors.join(" ")}. ${citeDetailString(footNote.edition)}${citeDetailString(footNote.publisher)}${footNote.year}. `, footNote.url ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("a", {
42
- href: footNote.url,
43
- children: [footNote.url, "."]
44
- }) : null]
45
- })
46
- })
47
- });
48
- };
49
- const FootnoteList = (0, _jsx2.styled)("ol", {
50
- base: {
51
- display: "flex",
52
- flexDirection: "column",
53
- gap: "medium",
54
- listStyle: "none"
55
- }
56
- });
57
- const ArticleFootNotes = _ref2 => {
58
- let {
59
- footNotes
60
- } = _ref2;
61
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(FootnoteList, {
62
- children: footNotes.map(footNote => /*#__PURE__*/(0, _jsxRuntime.jsx)(FootNote, {
63
- footNote: footNote
64
- }, footNote.ref))
65
- });
66
- };
67
- exports.ArticleFootNotes = ArticleFootNotes;
@@ -1,68 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Article", {
7
- enumerable: true,
8
- get: function () {
9
- return _Article.Article;
10
- }
11
- });
12
- Object.defineProperty(exports, "ArticleByline", {
13
- enumerable: true,
14
- get: function () {
15
- return _ArticleByline.ArticleByline;
16
- }
17
- });
18
- Object.defineProperty(exports, "ArticleBylineAccordionItem", {
19
- enumerable: true,
20
- get: function () {
21
- return _ArticleByline.ArticleBylineAccordionItem;
22
- }
23
- });
24
- Object.defineProperty(exports, "ArticleContent", {
25
- enumerable: true,
26
- get: function () {
27
- return _Article.ArticleContent;
28
- }
29
- });
30
- Object.defineProperty(exports, "ArticleFootNotes", {
31
- enumerable: true,
32
- get: function () {
33
- return _ArticleFootNotes.ArticleFootNotes;
34
- }
35
- });
36
- Object.defineProperty(exports, "ArticleFooter", {
37
- enumerable: true,
38
- get: function () {
39
- return _Article.ArticleFooter;
40
- }
41
- });
42
- Object.defineProperty(exports, "ArticleHGroup", {
43
- enumerable: true,
44
- get: function () {
45
- return _Article.ArticleHGroup;
46
- }
47
- });
48
- Object.defineProperty(exports, "ArticleHeader", {
49
- enumerable: true,
50
- get: function () {
51
- return _Article.ArticleHeader;
52
- }
53
- });
54
- Object.defineProperty(exports, "ArticleTitle", {
55
- enumerable: true,
56
- get: function () {
57
- return _Article.ArticleTitle;
58
- }
59
- });
60
- Object.defineProperty(exports, "ArticleWrapper", {
61
- enumerable: true,
62
- get: function () {
63
- return _Article.ArticleWrapper;
64
- }
65
- });
66
- var _Article = require("./Article");
67
- var _ArticleByline = require("./ArticleByline");
68
- var _ArticleFootNotes = require("./ArticleFootNotes");