@ndla/ui 56.0.123-alpha.0 → 56.0.124-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.
- package/es/Article/Article.js +122 -194
- package/es/Article/Article.js.map +1 -0
- package/es/Article/ArticleByline.js +121 -170
- package/es/Article/ArticleByline.js.map +1 -0
- package/es/Article/ArticleFootNotes.js +38 -58
- package/es/Article/ArticleFootNotes.js.map +1 -0
- package/es/AudioPlayer/AudioPlayer.js +151 -212
- package/es/AudioPlayer/AudioPlayer.js.map +1 -0
- package/es/AudioPlayer/Controls.js +246 -324
- package/es/AudioPlayer/Controls.js.map +1 -0
- package/es/AudioPlayer/SpeechControl.js +36 -52
- package/es/AudioPlayer/SpeechControl.js.map +1 -0
- package/es/AudioPlayer/index.js +7 -9
- package/es/AudioPlayer/index.js.map +1 -0
- package/es/Breadcrumb/Breadcrumb.js +42 -58
- package/es/Breadcrumb/Breadcrumb.js.map +1 -0
- package/es/Breadcrumb/BreadcrumbItem.js +33 -59
- package/es/Breadcrumb/BreadcrumbItem.js.map +1 -0
- package/es/Breadcrumb/HomeBreadcrumb.js +41 -74
- package/es/Breadcrumb/HomeBreadcrumb.js.map +1 -0
- package/es/Breadcrumb/index.js +8 -10
- package/es/Breadcrumb/index.js.map +1 -0
- package/es/CampaignBlock/CampaignBlock.js +124 -173
- package/es/CampaignBlock/CampaignBlock.js.map +1 -0
- package/es/CodeBlock/CodeBlock.js +21 -31
- package/es/CodeBlock/CodeBlock.js.map +1 -0
- package/es/CodeBlock/codeLanguageOptions.js +112 -82
- package/es/CodeBlock/codeLanguageOptions.js.map +1 -0
- package/es/Concept/Concept.js +46 -68
- package/es/Concept/Concept.js.map +1 -0
- package/es/ContactBlock/ContactBlock.js +137 -191
- package/es/ContactBlock/ContactBlock.js.map +1 -0
- package/es/ContentTypeBadge/ContentTypeBadge.js +38 -47
- package/es/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +21 -28
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +21 -28
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
- package/es/ContentTypeHero/ContentTypeHero.js +36 -47
- package/es/ContentTypeHero/ContentTypeHero.js.map +1 -0
- package/es/CopyParagraphButton/CopyParagraphButton.js +57 -78
- package/es/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
- package/es/CopyParagraphButton/index.js +7 -10
- package/es/CopyParagraphButton/index.js.map +1 -0
- package/es/Embed/AudioEmbed.js +49 -73
- package/es/Embed/AudioEmbed.js.map +1 -0
- package/es/Embed/BrightcoveEmbed.js +90 -127
- package/es/Embed/BrightcoveEmbed.js.map +1 -0
- package/es/Embed/CodeEmbed.js +55 -73
- package/es/Embed/CodeEmbed.js.map +1 -0
- package/es/Embed/ConceptEmbed.js +72 -117
- package/es/Embed/ConceptEmbed.js.map +1 -0
- package/es/Embed/ConceptInlineTriggerButton.js +39 -44
- package/es/Embed/ConceptInlineTriggerButton.js.map +1 -0
- package/es/Embed/ContentLinkEmbed.js +29 -49
- package/es/Embed/ContentLinkEmbed.js.map +1 -0
- package/es/Embed/CopyrightEmbed.js +21 -31
- package/es/Embed/CopyrightEmbed.js.map +1 -0
- package/es/Embed/EmbedErrorPlaceholder.js +40 -55
- package/es/Embed/EmbedErrorPlaceholder.js.map +1 -0
- package/es/Embed/EmbedWrapper.js +21 -46
- package/es/Embed/EmbedWrapper.js.map +1 -0
- package/es/Embed/ExternalEmbed.js +50 -70
- package/es/Embed/ExternalEmbed.js.map +1 -0
- package/es/Embed/FootnoteEmbed.js +25 -42
- package/es/Embed/FootnoteEmbed.js.map +1 -0
- package/es/Embed/GlossEmbed.js +49 -77
- package/es/Embed/GlossEmbed.js.map +1 -0
- package/es/Embed/H5pEmbed.js +35 -58
- package/es/Embed/H5pEmbed.js.map +1 -0
- package/es/Embed/IframeEmbed.js +65 -89
- package/es/Embed/IframeEmbed.js.map +1 -0
- package/es/Embed/ImageEmbed.js +167 -225
- package/es/Embed/ImageEmbed.js.map +1 -0
- package/es/Embed/InlineTriggerButton.js +20 -32
- package/es/Embed/InlineTriggerButton.js.map +1 -0
- package/es/Embed/RelatedContentEmbed.js +36 -53
- package/es/Embed/RelatedContentEmbed.js.map +1 -0
- package/es/Embed/UnknownEmbed.js +18 -29
- package/es/Embed/UnknownEmbed.js.map +1 -0
- package/es/Embed/UuDisclaimerEmbed.js +51 -85
- package/es/Embed/UuDisclaimerEmbed.js.map +1 -0
- package/es/ErrorMessage/ErrorMessage.js +51 -92
- package/es/ErrorMessage/ErrorMessage.js.map +1 -0
- package/es/ErrorMessage/index.js +7 -9
- package/es/ErrorMessage/index.js.map +1 -0
- package/es/FactBox/FactBox.js +114 -170
- package/es/FactBox/FactBox.js.map +1 -0
- package/es/FactBox/index.js +7 -9
- package/es/FactBox/index.js.map +1 -0
- package/es/FileList/File.js +70 -95
- package/es/FileList/File.js.map +1 -0
- package/es/FileList/FileList.js +31 -46
- package/es/FileList/FileList.js.map +1 -0
- package/es/FileList/PdfFile.js +27 -49
- package/es/FileList/PdfFile.js.map +1 -0
- package/es/Gloss/Gloss.js +133 -166
- package/es/Gloss/Gloss.js.map +1 -0
- package/es/Gloss/GlossExample.js +42 -60
- package/es/Gloss/GlossExample.js.map +1 -0
- package/es/Grid/Grid.js +63 -91
- package/es/Grid/Grid.js.map +1 -0
- package/es/Grid/GridParallaxItem.js +19 -30
- package/es/Grid/GridParallaxItem.js.map +1 -0
- package/es/KeyFigure/KeyFigure.js +44 -61
- package/es/KeyFigure/KeyFigure.js.map +1 -0
- package/es/LicenseByline/EmbedByline.js +126 -206
- package/es/LicenseByline/EmbedByline.js.map +1 -0
- package/es/LicenseByline/LicenseLink.js +28 -53
- package/es/LicenseByline/LicenseLink.js.map +1 -0
- package/es/LinkBlock/LinkBlock.js +70 -99
- package/es/LinkBlock/LinkBlock.js.map +1 -0
- package/es/LinkBlock/LinkBlockSection.js +20 -32
- package/es/LinkBlock/LinkBlockSection.js.map +1 -0
- package/es/Pitch/Pitch.js +59 -80
- package/es/Pitch/Pitch.js.map +1 -0
- package/es/RelatedArticleList/RelatedArticleList.js +91 -129
- package/es/RelatedArticleList/RelatedArticleList.js.map +1 -0
- package/es/RelatedArticleList/index.js +7 -10
- package/es/RelatedArticleList/index.js.map +1 -0
- package/es/ResourceBox/ResourceBox.js +71 -96
- package/es/ResourceBox/ResourceBox.js.map +1 -0
- package/es/TagSelector/TagSelector.js +93 -136
- package/es/TagSelector/TagSelector.js.map +1 -0
- package/es/ZendeskButton/ZendeskButton.js +38 -52
- package/es/ZendeskButton/ZendeskButton.js.map +1 -0
- package/es/_virtual/rolldown_runtime.js +11 -0
- package/es/i18n/formatNestedMessages.js +16 -24
- package/es/i18n/formatNestedMessages.js.map +1 -0
- package/es/i18n/i18n.js +25 -31
- package/es/i18n/i18n.js.map +1 -0
- package/es/i18n/useComponentTranslations.js +147 -203
- package/es/i18n/useComponentTranslations.js.map +1 -0
- package/es/index.js +64 -44
- package/es/locale/messages-en.js +435 -459
- package/es/locale/messages-en.js.map +1 -0
- package/es/locale/messages-nb.js +435 -459
- package/es/locale/messages-nb.js.map +1 -0
- package/es/locale/messages-nn.js +435 -459
- package/es/locale/messages-nn.js.map +1 -0
- package/es/locale/messages-se.js +435 -459
- package/es/locale/messages-se.js.map +1 -0
- package/es/model/ContentType.js +69 -65
- package/es/model/ContentType.js.map +1 -0
- package/es/model/SubjectCategories.js +23 -10
- package/es/model/SubjectCategories.js.map +1 -0
- package/es/model/SubjectTypes.js +21 -9
- package/es/model/SubjectTypes.js.map +1 -0
- package/es/model/WordClass.js +51 -43
- package/es/model/WordClass.js.map +1 -0
- package/es/model/index.js +16 -18
- package/es/model/index.js.map +1 -0
- package/es/utils/licenseAttributes.js +15 -17
- package/es/utils/licenseAttributes.js.map +1 -0
- package/es/utils/relativeUrl.js +21 -32
- package/es/utils/relativeUrl.js.map +1 -0
- package/lib/Article/Article.js +130 -203
- package/lib/Article/Article.js.map +1 -0
- package/lib/Article/ArticleByline.js +125 -179
- package/lib/Article/ArticleByline.js.map +1 -0
- package/lib/Article/ArticleFootNotes.js +39 -65
- package/lib/Article/ArticleFootNotes.js.map +1 -0
- package/lib/AudioPlayer/AudioPlayer.js +155 -221
- package/lib/AudioPlayer/AudioPlayer.js.map +1 -0
- package/lib/AudioPlayer/Controls.js +249 -332
- package/lib/AudioPlayer/Controls.js.map +1 -0
- package/lib/AudioPlayer/SpeechControl.js +39 -60
- package/lib/AudioPlayer/SpeechControl.js.map +1 -0
- package/lib/AudioPlayer/index.js +7 -15
- package/lib/AudioPlayer/index.js.map +1 -0
- package/lib/Breadcrumb/Breadcrumb.js +43 -65
- package/lib/Breadcrumb/Breadcrumb.js.map +1 -0
- package/lib/Breadcrumb/BreadcrumbItem.js +34 -65
- package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -0
- package/lib/Breadcrumb/HomeBreadcrumb.js +43 -82
- package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -0
- package/lib/Breadcrumb/index.js +8 -22
- package/lib/Breadcrumb/index.js.map +1 -0
- package/lib/CampaignBlock/CampaignBlock.js +128 -183
- package/lib/CampaignBlock/CampaignBlock.js.map +1 -0
- package/lib/CodeBlock/CodeBlock.js +23 -38
- package/lib/CodeBlock/CodeBlock.js.map +1 -0
- package/lib/CodeBlock/codeLanguageOptions.js +112 -87
- package/lib/CodeBlock/codeLanguageOptions.js.map +1 -0
- package/lib/Concept/Concept.js +48 -75
- package/lib/Concept/Concept.js.map +1 -0
- package/lib/ContactBlock/ContactBlock.js +141 -200
- package/lib/ContactBlock/ContactBlock.js.map +1 -0
- package/lib/ContentTypeBadge/ContentTypeBadge.js +40 -54
- package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +23 -35
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +23 -35
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
- package/lib/ContentTypeHero/ContentTypeHero.js +37 -54
- package/lib/ContentTypeHero/ContentTypeHero.js.map +1 -0
- package/lib/CopyParagraphButton/CopyParagraphButton.js +61 -87
- package/lib/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
- package/lib/CopyParagraphButton/index.js +7 -21
- package/lib/CopyParagraphButton/index.js.map +1 -0
- package/lib/Embed/AudioEmbed.js +51 -82
- package/lib/Embed/AudioEmbed.js.map +1 -0
- package/lib/Embed/BrightcoveEmbed.js +93 -138
- package/lib/Embed/BrightcoveEmbed.js.map +1 -0
- package/lib/Embed/CodeEmbed.js +59 -83
- package/lib/Embed/CodeEmbed.js.map +1 -0
- package/lib/Embed/ConceptEmbed.js +77 -127
- package/lib/Embed/ConceptEmbed.js.map +1 -0
- package/lib/Embed/ConceptInlineTriggerButton.js +39 -49
- package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -0
- package/lib/Embed/ContentLinkEmbed.js +30 -55
- package/lib/Embed/ContentLinkEmbed.js.map +1 -0
- package/lib/Embed/CopyrightEmbed.js +22 -37
- package/lib/Embed/CopyrightEmbed.js.map +1 -0
- package/lib/Embed/EmbedErrorPlaceholder.js +42 -62
- package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -0
- package/lib/Embed/EmbedWrapper.js +24 -54
- package/lib/Embed/EmbedWrapper.js.map +1 -0
- package/lib/Embed/ExternalEmbed.js +53 -79
- package/lib/Embed/ExternalEmbed.js.map +1 -0
- package/lib/Embed/FootnoteEmbed.js +26 -48
- package/lib/Embed/FootnoteEmbed.js.map +1 -0
- package/lib/Embed/GlossEmbed.js +51 -86
- package/lib/Embed/GlossEmbed.js.map +1 -0
- package/lib/Embed/H5pEmbed.js +37 -66
- package/lib/Embed/H5pEmbed.js.map +1 -0
- package/lib/Embed/IframeEmbed.js +68 -98
- package/lib/Embed/IframeEmbed.js.map +1 -0
- package/lib/Embed/ImageEmbed.js +173 -238
- package/lib/Embed/ImageEmbed.js.map +1 -0
- package/lib/Embed/InlineTriggerButton.js +23 -40
- package/lib/Embed/InlineTriggerButton.js.map +1 -0
- package/lib/Embed/RelatedContentEmbed.js +37 -59
- package/lib/Embed/RelatedContentEmbed.js.map +1 -0
- package/lib/Embed/UnknownEmbed.js +19 -35
- package/lib/Embed/UnknownEmbed.js.map +1 -0
- package/lib/Embed/UuDisclaimerEmbed.js +53 -92
- package/lib/Embed/UuDisclaimerEmbed.js.map +1 -0
- package/lib/ErrorMessage/ErrorMessage.js +53 -99
- package/lib/ErrorMessage/ErrorMessage.js.map +1 -0
- package/lib/ErrorMessage/index.js +7 -15
- package/lib/ErrorMessage/index.js.map +1 -0
- package/lib/FactBox/FactBox.js +118 -180
- package/lib/FactBox/FactBox.js.map +1 -0
- package/lib/FactBox/index.js +7 -15
- package/lib/FactBox/index.js.map +1 -0
- package/lib/FileList/File.js +75 -105
- package/lib/FileList/File.js.map +1 -0
- package/lib/FileList/FileList.js +33 -52
- package/lib/FileList/FileList.js.map +1 -0
- package/lib/FileList/PdfFile.js +27 -55
- package/lib/FileList/PdfFile.js.map +1 -0
- package/lib/Gloss/Gloss.js +138 -176
- package/lib/Gloss/Gloss.js.map +1 -0
- package/lib/Gloss/GlossExample.js +45 -68
- package/lib/Gloss/GlossExample.js.map +1 -0
- package/lib/Grid/Grid.js +64 -98
- package/lib/Grid/Grid.js.map +1 -0
- package/lib/Grid/GridParallaxItem.js +19 -36
- package/lib/Grid/GridParallaxItem.js.map +1 -0
- package/lib/KeyFigure/KeyFigure.js +45 -68
- package/lib/KeyFigure/KeyFigure.js.map +1 -0
- package/lib/LicenseByline/EmbedByline.js +130 -216
- package/lib/LicenseByline/EmbedByline.js.map +1 -0
- package/lib/LicenseByline/LicenseLink.js +29 -59
- package/lib/LicenseByline/LicenseLink.js.map +1 -0
- package/lib/LinkBlock/LinkBlock.js +73 -108
- package/lib/LinkBlock/LinkBlock.js.map +1 -0
- package/lib/LinkBlock/LinkBlockSection.js +22 -39
- package/lib/LinkBlock/LinkBlockSection.js.map +1 -0
- package/lib/Pitch/Pitch.js +61 -89
- package/lib/Pitch/Pitch.js.map +1 -0
- package/lib/RelatedArticleList/RelatedArticleList.js +96 -140
- package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -0
- package/lib/RelatedArticleList/index.js +7 -20
- package/lib/RelatedArticleList/index.js.map +1 -0
- package/lib/ResourceBox/ResourceBox.js +73 -104
- package/lib/ResourceBox/ResourceBox.js.map +1 -0
- package/lib/TagSelector/TagSelector.js +103 -145
- package/lib/TagSelector/TagSelector.js.map +1 -0
- package/lib/ZendeskButton/ZendeskButton.js +39 -58
- package/lib/ZendeskButton/ZendeskButton.js.map +1 -0
- package/lib/_virtual/rolldown_runtime.js +42 -0
- package/lib/i18n/formatNestedMessages.js +16 -30
- package/lib/i18n/formatNestedMessages.js.map +1 -0
- package/lib/i18n/i18n.js +28 -38
- package/lib/i18n/i18n.js.map +1 -0
- package/lib/i18n/useComponentTranslations.js +154 -215
- package/lib/i18n/useComponentTranslations.js.map +1 -0
- package/lib/index.js +156 -598
- package/lib/locale/messages-en.js +436 -466
- package/lib/locale/messages-en.js.map +1 -0
- package/lib/locale/messages-nb.js +436 -466
- package/lib/locale/messages-nb.js.map +1 -0
- package/lib/locale/messages-nn.js +436 -466
- package/lib/locale/messages-nn.js.map +1 -0
- package/lib/locale/messages-se.js +436 -466
- package/lib/locale/messages-se.js.map +1 -0
- package/lib/model/ContentType.js +90 -70
- package/lib/model/ContentType.js.map +1 -0
- package/lib/model/SubjectCategories.js +26 -14
- package/lib/model/SubjectCategories.js.map +1 -0
- package/lib/model/SubjectTypes.js +24 -13
- package/lib/model/SubjectTypes.js.map +1 -0
- package/lib/model/WordClass.js +55 -48
- package/lib/model/WordClass.js.map +1 -0
- package/lib/model/index.js +16 -25
- package/lib/model/index.js.map +1 -0
- package/lib/utils/licenseAttributes.js +14 -22
- package/lib/utils/licenseAttributes.js.map +1 -0
- package/lib/utils/relativeUrl.js +20 -38
- package/lib/utils/relativeUrl.js.map +1 -0
- package/package.json +12 -11
- package/es/Article/index.js +0 -11
- package/es/CampaignBlock/index.js +0 -9
- package/es/CodeBlock/index.js +0 -10
- package/es/ContactBlock/index.js +0 -9
- package/es/ContentTypeHero/index.js +0 -9
- package/es/Embed/index.js +0 -25
- package/es/Embed/types.js +0 -1
- package/es/FileList/index.js +0 -11
- package/es/Gloss/index.js +0 -10
- package/es/Grid/index.js +0 -10
- package/es/KeyFigure/index.js +0 -9
- package/es/LicenseByline/index.js +0 -10
- package/es/LinkBlock/index.js +0 -10
- package/es/Pitch/index.js +0 -9
- package/es/ResourceBox/index.js +0 -10
- package/es/i18n/index.js +0 -11
- package/es/types.js +0 -1
- package/lib/Article/index.js +0 -68
- package/lib/CampaignBlock/index.js +0 -13
- package/lib/CodeBlock/index.js +0 -20
- package/lib/ContactBlock/index.js +0 -18
- package/lib/ContentTypeHero/index.js +0 -12
- package/lib/Embed/index.js +0 -150
- package/lib/Embed/types.js +0 -5
- package/lib/FileList/index.js +0 -44
- package/lib/Gloss/index.js +0 -20
- package/lib/Grid/index.js +0 -19
- package/lib/KeyFigure/index.js +0 -13
- package/lib/LicenseByline/index.js +0 -19
- package/lib/LinkBlock/index.js +0 -20
- package/lib/Pitch/index.js +0 -12
- package/lib/ResourceBox/index.js +0 -13
- package/lib/i18n/index.js +0 -68
- package/lib/types.js +0 -5
package/es/Article/Article.js
CHANGED
|
@@ -1,199 +1,127 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
1
|
+
import { ContentTypeBadge } from "../ContentTypeBadge/ContentTypeBadge.js";
|
|
2
|
+
import { ArticleByline } from "./ArticleByline.js";
|
|
9
3
|
import { forwardRef } from "react";
|
|
10
|
-
import { ark } from "@ark-ui/react";
|
|
11
4
|
import { Heading, Text } from "@ndla/primitives";
|
|
12
|
-
import { cx } from "@ndla/styled-system/css";
|
|
13
5
|
import { Stack, styled } from "@ndla/styled-system/jsx";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
content: "",
|
|
46
|
-
display: "table",
|
|
47
|
-
clear: "both"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}, {
|
|
51
|
-
baseComponent: true
|
|
52
|
-
});
|
|
53
|
-
export const ArticleWrapper = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/_jsx(StyledArticleWrapper, {
|
|
54
|
-
"data-ndla-article": "",
|
|
55
|
-
ref: ref,
|
|
56
|
-
...props
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { ark } from "@ark-ui/react";
|
|
8
|
+
import { cx } from "@ndla/styled-system/css";
|
|
9
|
+
|
|
10
|
+
//#region src/Article/Article.tsx
|
|
11
|
+
const StyledArticleContent = styled(ark.section, {}, { baseComponent: true });
|
|
12
|
+
const ArticleContent = forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(StyledArticleContent, {
|
|
13
|
+
className: cx("ndla-article", className),
|
|
14
|
+
...props,
|
|
15
|
+
ref
|
|
16
|
+
}));
|
|
17
|
+
const StyledArticleWrapper = styled(ark.article, { base: {
|
|
18
|
+
background: "background.default",
|
|
19
|
+
display: "flex",
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
color: "text.default",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
width: "100%",
|
|
24
|
+
overflowWrap: "break-word",
|
|
25
|
+
position: "relative",
|
|
26
|
+
"& mjx-stretchy-v > mjx-ext > mjx-c": { transform: "scaleY(100) translateY(0.075em)" },
|
|
27
|
+
_after: {
|
|
28
|
+
content: "",
|
|
29
|
+
display: "table",
|
|
30
|
+
clear: "both"
|
|
31
|
+
}
|
|
32
|
+
} }, { baseComponent: true });
|
|
33
|
+
const ArticleWrapper = forwardRef((props, ref) => /* @__PURE__ */ jsx(StyledArticleWrapper, {
|
|
34
|
+
"data-ndla-article": "",
|
|
35
|
+
ref,
|
|
36
|
+
...props
|
|
57
37
|
}));
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
introduction,
|
|
119
|
-
contentTypeLabel,
|
|
120
|
-
competenceGoals,
|
|
121
|
-
disclaimer
|
|
122
|
-
} = _ref2;
|
|
123
|
-
return /*#__PURE__*/_jsxs(ArticleHeader, {
|
|
124
|
-
children: [/*#__PURE__*/_jsxs(ArticleHGroup, {
|
|
125
|
-
children: [(!!contentType || !!heartButton) && /*#__PURE__*/_jsxs(StyledStack, {
|
|
126
|
-
justify: "space-between",
|
|
127
|
-
align: "center",
|
|
128
|
-
direction: "row",
|
|
129
|
-
gap: "small",
|
|
130
|
-
children: [!!contentType && /*#__PURE__*/_jsx(ContentTypeBadge, {
|
|
131
|
-
contentType: contentType,
|
|
132
|
-
children: contentTypeLabel
|
|
133
|
-
}), heartButton]
|
|
134
|
-
}), /*#__PURE__*/_jsx(Heading, {
|
|
135
|
-
textStyle: "heading.medium",
|
|
136
|
-
id: id,
|
|
137
|
-
lang: lang,
|
|
138
|
-
property: "dct:title",
|
|
139
|
-
children: title
|
|
140
|
-
})]
|
|
141
|
-
}), !!introduction && /*#__PURE__*/_jsx(Text, {
|
|
142
|
-
lang: lang,
|
|
143
|
-
textStyle: "body.xlarge",
|
|
144
|
-
asChild: true,
|
|
145
|
-
consumeCss: true,
|
|
146
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
147
|
-
children: introduction
|
|
148
|
-
})
|
|
149
|
-
}), /*#__PURE__*/_jsxs(StyledWrapper, {
|
|
150
|
-
children: [competenceGoals, disclaimer]
|
|
151
|
-
})]
|
|
152
|
-
});
|
|
38
|
+
const ArticleHGroup = styled(ark.hgroup, { base: {
|
|
39
|
+
display: "flex",
|
|
40
|
+
width: "100%",
|
|
41
|
+
flexDirection: "column",
|
|
42
|
+
alignItems: "flex-start",
|
|
43
|
+
"& h1": { overflowWrap: "anywhere" }
|
|
44
|
+
} }, { baseComponent: true });
|
|
45
|
+
const ArticleHeader = styled(ark.header, { base: {
|
|
46
|
+
display: "flex",
|
|
47
|
+
flexDirection: "column",
|
|
48
|
+
gap: "medium",
|
|
49
|
+
alignItems: "flex-start",
|
|
50
|
+
width: "100%",
|
|
51
|
+
paddingBlockStart: "xxlarge",
|
|
52
|
+
overflowWrap: "anywhere"
|
|
53
|
+
} }, { baseComponent: true });
|
|
54
|
+
const ArticleFooter = styled(ark.footer, { base: {
|
|
55
|
+
display: "flex",
|
|
56
|
+
flexDirection: "column",
|
|
57
|
+
gap: "xxlarge",
|
|
58
|
+
width: "100%",
|
|
59
|
+
"& > :is(:last-child)": { paddingBlockEnd: "5xlarge" }
|
|
60
|
+
} }, { baseComponent: true });
|
|
61
|
+
const StyledStack = styled(Stack, { base: {
|
|
62
|
+
width: "100%",
|
|
63
|
+
minHeight: "xxlarge"
|
|
64
|
+
} });
|
|
65
|
+
const StyledWrapper = styled("div", { base: {
|
|
66
|
+
display: "flex",
|
|
67
|
+
gap: "small",
|
|
68
|
+
flexWrap: "wrap",
|
|
69
|
+
alignItems: "center"
|
|
70
|
+
} });
|
|
71
|
+
const ArticleTitle = ({ contentType, heartButton, title, lang, id, introduction, contentTypeLabel, competenceGoals, disclaimer }) => {
|
|
72
|
+
return /* @__PURE__ */ jsxs(ArticleHeader, { children: [
|
|
73
|
+
/* @__PURE__ */ jsxs(ArticleHGroup, { children: [(!!contentType || !!heartButton) && /* @__PURE__ */ jsxs(StyledStack, {
|
|
74
|
+
justify: "space-between",
|
|
75
|
+
align: "center",
|
|
76
|
+
direction: "row",
|
|
77
|
+
gap: "small",
|
|
78
|
+
children: [!!contentType && /* @__PURE__ */ jsx(ContentTypeBadge, {
|
|
79
|
+
contentType,
|
|
80
|
+
children: contentTypeLabel
|
|
81
|
+
}), heartButton]
|
|
82
|
+
}), /* @__PURE__ */ jsx(Heading, {
|
|
83
|
+
textStyle: "heading.medium",
|
|
84
|
+
id,
|
|
85
|
+
lang,
|
|
86
|
+
property: "dct:title",
|
|
87
|
+
children: title
|
|
88
|
+
})] }),
|
|
89
|
+
!!introduction && /* @__PURE__ */ jsx(Text, {
|
|
90
|
+
lang,
|
|
91
|
+
textStyle: "body.xlarge",
|
|
92
|
+
asChild: true,
|
|
93
|
+
consumeCss: true,
|
|
94
|
+
children: /* @__PURE__ */ jsx("div", { children: introduction })
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ jsxs(StyledWrapper, { children: [competenceGoals, disclaimer] })
|
|
97
|
+
] });
|
|
153
98
|
};
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
competenceGoals: competenceGoals,
|
|
184
|
-
lang: lang,
|
|
185
|
-
contentTypeLabel: contentTypeLabel,
|
|
186
|
-
disclaimer: disclaimer
|
|
187
|
-
}), /*#__PURE__*/_jsx(ArticleContent, {
|
|
188
|
-
children: content
|
|
189
|
-
}), /*#__PURE__*/_jsxs(ArticleFooter, {
|
|
190
|
-
children: [/*#__PURE__*/_jsx(ArticleByline, {
|
|
191
|
-
footnotes: footNotes,
|
|
192
|
-
authors: authors,
|
|
193
|
-
suppliers: copyright?.rightsholders,
|
|
194
|
-
published: published,
|
|
195
|
-
licenseBox: licenseBox
|
|
196
|
-
}), children]
|
|
197
|
-
})]
|
|
198
|
-
});
|
|
199
|
-
};
|
|
99
|
+
const Article = ({ article, contentType, licenseBox, children, competenceGoals, contentTypeLabel, id, heartButton, lang, disclaimer }) => {
|
|
100
|
+
const { title, introduction, published, content, footNotes, copyright } = article;
|
|
101
|
+
const authors = copyright?.creators.length || copyright?.rightsholders.length ? copyright.creators : copyright?.processors;
|
|
102
|
+
return /* @__PURE__ */ jsxs(ArticleWrapper, { children: [
|
|
103
|
+
/* @__PURE__ */ jsx(ArticleTitle, {
|
|
104
|
+
id,
|
|
105
|
+
contentType,
|
|
106
|
+
heartButton,
|
|
107
|
+
title,
|
|
108
|
+
introduction,
|
|
109
|
+
competenceGoals,
|
|
110
|
+
lang,
|
|
111
|
+
contentTypeLabel,
|
|
112
|
+
disclaimer
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ jsx(ArticleContent, { children: content }),
|
|
115
|
+
/* @__PURE__ */ jsxs(ArticleFooter, { children: [/* @__PURE__ */ jsx(ArticleByline, {
|
|
116
|
+
footnotes: footNotes,
|
|
117
|
+
authors,
|
|
118
|
+
suppliers: copyright?.rightsholders,
|
|
119
|
+
published,
|
|
120
|
+
licenseBox
|
|
121
|
+
}), children] })
|
|
122
|
+
] });
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
//#endregion
|
|
126
|
+
export { Article, ArticleContent, ArticleFooter, ArticleHGroup, ArticleHeader, ArticleTitle, ArticleWrapper };
|
|
127
|
+
//# sourceMappingURL=Article.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Article.js","names":[],"sources":["../../src/Article/Article.tsx"],"sourcesContent":["/**\n * Copyright (c) 2016-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\";\nimport { Heading, Text } from \"@ndla/primitives\";\nimport { cx } from \"@ndla/styled-system/css\";\nimport { Stack, styled } from \"@ndla/styled-system/jsx\";\nimport type { JsxStyleProps } from \"@ndla/styled-system/types\";\nimport { ArticleByline } from \"./ArticleByline\";\nimport { ContentTypeBadge, type ContentType } from \"../ContentTypeBadge/ContentTypeBadge\";\nimport type { Article as ArticleType } from \"../types\";\n\nconst StyledArticleContent = styled(ark.section, {}, { baseComponent: true });\n\nexport const ArticleContent = forwardRef<HTMLElement, HTMLArkProps<\"div\"> & JsxStyleProps>(\n ({ className, ...props }, ref) => (\n <StyledArticleContent className={cx(\"ndla-article\", className)} {...props} ref={ref} />\n ),\n);\n\nconst StyledArticleWrapper = styled(\n ark.article,\n {\n base: {\n background: \"background.default\",\n display: \"flex\",\n flexDirection: \"column\",\n color: \"text.default\",\n alignItems: \"center\",\n width: \"100%\",\n overflowWrap: \"break-word\",\n position: \"relative\",\n \"& mjx-stretchy-v > mjx-ext > mjx-c\": {\n transform: \"scaleY(100) translateY(0.075em)\",\n },\n _after: {\n content: \"\",\n display: \"table\",\n clear: \"both\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleWrapper = forwardRef<HTMLElement, ComponentPropsWithRef<\"article\"> & JsxStyleProps>(\n (props, ref) => <StyledArticleWrapper data-ndla-article=\"\" ref={ref} {...props} />,\n);\n\nexport const ArticleHGroup = styled(\n ark.hgroup,\n {\n base: {\n display: \"flex\",\n width: \"100%\",\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n \"& h1\": {\n overflowWrap: \"anywhere\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleHeader = styled(\n ark.header,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n alignItems: \"flex-start\",\n width: \"100%\",\n paddingBlockStart: \"xxlarge\",\n overflowWrap: \"anywhere\",\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleFooter = styled(\n ark.footer,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xxlarge\",\n width: \"100%\",\n \"& > :is(:last-child)\": {\n paddingBlockEnd: \"5xlarge\",\n },\n },\n },\n { baseComponent: true },\n);\n\nconst StyledStack = styled(Stack, {\n base: {\n width: \"100%\",\n minHeight: \"xxlarge\",\n },\n});\n\nconst StyledWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"small\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n },\n});\n\ninterface ArticleTitleProps {\n heartButton?: ReactNode;\n contentType?: ContentType;\n contentTypeLabel?: ReactNode;\n competenceGoals?: ReactNode;\n id: string;\n lang?: string;\n title?: ReactNode;\n introduction?: ReactNode;\n disclaimer?: ReactNode;\n}\n\nexport const ArticleTitle = ({\n contentType,\n heartButton,\n title,\n lang,\n id,\n introduction,\n contentTypeLabel,\n competenceGoals,\n disclaimer,\n}: ArticleTitleProps) => {\n return (\n <ArticleHeader>\n <ArticleHGroup>\n {(!!contentType || !!heartButton) && (\n <StyledStack justify=\"space-between\" align=\"center\" direction=\"row\" gap=\"small\">\n {!!contentType && <ContentTypeBadge contentType={contentType}>{contentTypeLabel}</ContentTypeBadge>}\n {heartButton}\n </StyledStack>\n )}\n <Heading textStyle=\"heading.medium\" id={id} lang={lang} property=\"dct:title\">\n {title}\n </Heading>\n </ArticleHGroup>\n {!!introduction && (\n <Text lang={lang} textStyle=\"body.xlarge\" asChild consumeCss>\n <div>{introduction}</div>\n </Text>\n )}\n <StyledWrapper>\n {competenceGoals}\n {disclaimer}\n </StyledWrapper>\n </ArticleHeader>\n );\n};\n\ninterface Props {\n heartButton?: ReactNode;\n article: ArticleType;\n licenseBox?: ReactNode;\n contentType?: ContentType;\n contentTypeLabel?: ReactNode;\n children?: ReactNode;\n competenceGoals?: ReactNode;\n id: string;\n lang?: string;\n disclaimer?: ReactNode;\n}\n\nexport const Article = ({\n article,\n contentType,\n licenseBox,\n children,\n competenceGoals,\n contentTypeLabel,\n id,\n heartButton,\n lang,\n disclaimer,\n}: Props) => {\n const { title, introduction, published, content, footNotes, copyright } = article;\n\n const authors =\n copyright?.creators.length || copyright?.rightsholders.length ? copyright.creators : copyright?.processors;\n\n return (\n <ArticleWrapper>\n <ArticleTitle\n id={id}\n contentType={contentType}\n heartButton={heartButton}\n title={title}\n introduction={introduction}\n competenceGoals={competenceGoals}\n lang={lang}\n contentTypeLabel={contentTypeLabel}\n disclaimer={disclaimer}\n />\n <ArticleContent>{content}</ArticleContent>\n <ArticleFooter>\n <ArticleByline\n footnotes={footNotes}\n authors={authors}\n suppliers={copyright?.rightsholders}\n published={published}\n licenseBox={licenseBox}\n />\n {children}\n </ArticleFooter>\n </ArticleWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,uBAAuB,OAAO,IAAI,SAAS,CAAE,GAAE,EAAE,eAAe,KAAM,EAAC;AAE7E,MAAa,iBAAiB,WAC5B,CAAC,EAAE,UAAW,GAAG,OAAO,EAAE,wBACxB,IAAC;CAAqB,WAAW,GAAG,gBAAgB,UAAU;CAAE,GAAI;CAAY;EAAO,CAE1F;AAED,MAAM,uBAAuB,OAC3B,IAAI,SACJ,EACE,MAAM;CACJ,YAAY;CACZ,SAAS;CACT,eAAe;CACf,OAAO;CACP,YAAY;CACZ,OAAO;CACP,cAAc;CACd,UAAU;CACV,sCAAsC,EACpC,WAAW,kCACZ;CACD,QAAQ;EACN,SAAS;EACT,SAAS;EACT,OAAO;CACR;AACF,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,iBAAiB,WAC5B,CAAC,OAAO,wBAAQ,IAAC;CAAqB,qBAAkB;CAAQ;CAAK,GAAI;EAAS,CACnF;AAED,MAAa,gBAAgB,OAC3B,IAAI,QACJ,EACE,MAAM;CACJ,SAAS;CACT,OAAO;CACP,eAAe;CACf,YAAY;CACZ,QAAQ,EACN,cAAc,WACf;AACF,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,gBAAgB,OAC3B,IAAI,QACJ,EACE,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,YAAY;CACZ,OAAO;CACP,mBAAmB;CACnB,cAAc;AACf,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,gBAAgB,OAC3B,IAAI,QACJ,EACE,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,OAAO;CACP,wBAAwB,EACtB,iBAAiB,UAClB;AACF,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAM,cAAc,OAAO,OAAO,EAChC,MAAM;CACJ,OAAO;CACP,WAAW;AACZ,EACF,EAAC;AAEF,MAAM,gBAAgB,OAAO,OAAO,EAClC,MAAM;CACJ,SAAS;CACT,KAAK;CACL,UAAU;CACV,YAAY;AACb,EACF,EAAC;AAcF,MAAa,eAAe,CAAC,EAC3B,aACA,aACA,OACA,MACA,IACA,cACA,kBACA,iBACA,YACkB,KAAK;AACvB,wBACE,KAAC;kBACC,KAAC,+BACK,iBAAiB,gCACnB,KAAC;GAAY,SAAQ;GAAgB,OAAM;GAAS,WAAU;GAAM,KAAI;gBACnE,+BAAe,IAAC;IAA8B;cAAc;KAAoC,EAClG;IACW,kBAEhB,IAAC;GAAQ,WAAU;GAAqB;GAAU;GAAM,UAAS;aAC9D;IACO,IACI;IACb,gCACD,IAAC;GAAW;GAAM,WAAU;GAAc;GAAQ;6BAChD,IAAC,mBAAK,eAAmB;IACpB;kBAET,KAAC,4BACE,iBACA,cACa;KACF;AAEnB;AAeD,MAAa,UAAU,CAAC,EACtB,SACA,aACA,YACA,UACA,iBACA,kBACA,IACA,aACA,MACA,YACM,KAAK;CACX,MAAM,EAAE,OAAO,cAAc,WAAW,SAAS,WAAW,WAAW,GAAG;CAE1E,MAAM,UACJ,WAAW,SAAS,UAAU,WAAW,cAAc,SAAS,UAAU,WAAW,WAAW;AAElG,wBACE,KAAC;kBACC,IAAC;GACK;GACS;GACA;GACN;GACO;GACG;GACX;GACY;GACN;IACZ;kBACF,IAAC,4BAAgB,UAAyB;kBAC1C,KAAC,4CACC,IAAC;GACC,WAAW;GACF;GACT,WAAW,WAAW;GACX;GACC;IACZ,EACD,YACa;KACD;AAEpB"}
|
|
@@ -1,182 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (c) 2020-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
|
-
|
|
1
|
+
import { ArticleFootNotes } from "./ArticleFootNotes.js";
|
|
9
2
|
import { forwardRef, useCallback, useEffect, useState } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
|
-
import { useLocation } from "react-router-dom";
|
|
12
|
-
import { ArrowDownShortLine } from "@ndla/icons";
|
|
13
3
|
import { AccordionItem, AccordionItemContent, AccordionItemIndicator, AccordionItemTrigger, AccordionRoot, Heading } from "@ndla/primitives";
|
|
14
4
|
import { styled } from "@ndla/styled-system/jsx";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
5
|
+
import { useTranslation } from "react-i18next";
|
|
6
|
+
import { ArrowDownShortLine } from "@ndla/icons";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useLocation } from "react-router-dom";
|
|
9
|
+
|
|
10
|
+
//#region src/Article/ArticleByline.tsx
|
|
11
|
+
const Wrapper = styled("div", { base: {
|
|
12
|
+
marginBlockStart: "medium",
|
|
13
|
+
paddingBlockStart: "xsmall",
|
|
14
|
+
borderTop: "1px solid",
|
|
15
|
+
borderColor: "stroke.subtle"
|
|
16
|
+
} });
|
|
26
17
|
const TextWrapper = styled("div", {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
true: {},
|
|
42
|
-
false: {
|
|
43
|
-
tabletWide: {
|
|
44
|
-
flexDirection: "row"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
18
|
+
base: {
|
|
19
|
+
display: "flex",
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
gap: "3xsmall",
|
|
22
|
+
width: "100%",
|
|
23
|
+
justifyContent: "space-between",
|
|
24
|
+
paddingBlock: "xsmall",
|
|
25
|
+
textStyle: "body.medium",
|
|
26
|
+
"& [data-contributors=\"false\"]": { marginInlineStart: "auto" }
|
|
27
|
+
},
|
|
28
|
+
variants: { learningpath: {
|
|
29
|
+
true: {},
|
|
30
|
+
false: { tabletWide: { flexDirection: "row" } }
|
|
31
|
+
} }
|
|
49
32
|
});
|
|
50
33
|
const renderContributors = (contributors, t) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
34
|
+
const contributorsArray = contributors.map((contributor, index) => {
|
|
35
|
+
if (index < 1) return contributor.name;
|
|
36
|
+
const sep = index === contributors.length - 1 ? ` ${t("article.conjunction")} ` : ", ";
|
|
37
|
+
return `${sep}${contributor.name}`;
|
|
38
|
+
});
|
|
39
|
+
return contributorsArray.join("");
|
|
57
40
|
};
|
|
58
41
|
const getSuppliersText = (suppliers, t) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}) : t("article.supplierLabel", {
|
|
68
|
-
name: renderContributors(suppliers, t),
|
|
69
|
-
interpolation: {
|
|
70
|
-
escapeValue: false
|
|
71
|
-
}
|
|
72
|
-
});
|
|
42
|
+
if (suppliers.length === 0) return "";
|
|
43
|
+
return suppliers.length > 1 ? t("article.multipleSuppliersLabel", {
|
|
44
|
+
names: renderContributors(suppliers, t),
|
|
45
|
+
interpolation: { escapeValue: false }
|
|
46
|
+
}) : t("article.supplierLabel", {
|
|
47
|
+
name: renderContributors(suppliers, t),
|
|
48
|
+
interpolation: { escapeValue: false }
|
|
49
|
+
});
|
|
73
50
|
};
|
|
74
|
-
const StyledAccordionRoot = styled(AccordionRoot, {
|
|
75
|
-
base: {
|
|
76
|
-
paddingBlockStart: "xxlarge"
|
|
77
|
-
}
|
|
78
|
-
});
|
|
51
|
+
const StyledAccordionRoot = styled(AccordionRoot, { base: { paddingBlockStart: "xxlarge" } });
|
|
79
52
|
const refRegexp = /note\d/;
|
|
80
53
|
const footnotesAccordionId = "footnotes";
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
onValueChange: details => setOpenAccordions(details.value),
|
|
140
|
-
children: [!!licenseBox && /*#__PURE__*/_jsx(ArticleBylineAccordionItem, {
|
|
141
|
-
value: accordionItemValue,
|
|
142
|
-
accordionTitle: t("article.useContent"),
|
|
143
|
-
children: licenseBox
|
|
144
|
-
}), !!footnotes?.length && /*#__PURE__*/_jsx(ArticleBylineAccordionItem, {
|
|
145
|
-
value: footnotesAccordionId,
|
|
146
|
-
accordionTitle: t("article.footnotes"),
|
|
147
|
-
children: /*#__PURE__*/_jsx(ArticleFootNotes, {
|
|
148
|
-
footNotes: footnotes
|
|
149
|
-
})
|
|
150
|
-
})]
|
|
151
|
-
})]
|
|
152
|
-
});
|
|
54
|
+
const ArticleByline = ({ authors = [], suppliers = [], footnotes, licenseBox, published, displayByline = true, bylineType = "article", bylineSuffix }) => {
|
|
55
|
+
const { t } = useTranslation();
|
|
56
|
+
const { pathname } = useLocation();
|
|
57
|
+
const [openAccordions, setOpenAccordions] = useState([]);
|
|
58
|
+
const accordionItemValue = "rulesForUse";
|
|
59
|
+
const onHashChange = useCallback((e) => {
|
|
60
|
+
const hash = e.newURL.split("#")[1];
|
|
61
|
+
if (hash?.match(refRegexp) && !openAccordions.includes(footnotesAccordionId)) {
|
|
62
|
+
setOpenAccordions([...openAccordions, footnotesAccordionId]);
|
|
63
|
+
const el = document.getElementById(`#${hash}`);
|
|
64
|
+
el?.click();
|
|
65
|
+
el?.focus();
|
|
66
|
+
}
|
|
67
|
+
}, [openAccordions]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
setOpenAccordions((prev) => prev.filter((state) => state !== accordionItemValue));
|
|
70
|
+
}, [pathname]);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
window.addEventListener("hashchange", onHashChange);
|
|
73
|
+
return () => window.removeEventListener("hashchange", onHashChange);
|
|
74
|
+
}, [onHashChange]);
|
|
75
|
+
const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;
|
|
76
|
+
const authorLabel = {
|
|
77
|
+
article: "article.authorsLabel",
|
|
78
|
+
learningPath: "article.authorsLabelLearningpath",
|
|
79
|
+
external: "article.authorsLabelExternal"
|
|
80
|
+
};
|
|
81
|
+
return /* @__PURE__ */ jsxs(Wrapper, { children: [!!displayByline && /* @__PURE__ */ jsxs(TextWrapper, {
|
|
82
|
+
learningpath: bylineType === "learningPath",
|
|
83
|
+
children: [
|
|
84
|
+
!!showPrimaryContributors && /* @__PURE__ */ jsxs("span", { children: [authors.length > 0 && `${t(authorLabel[bylineType], {
|
|
85
|
+
names: renderContributors(authors, t),
|
|
86
|
+
interpolation: { escapeValue: false }
|
|
87
|
+
})}. `, getSuppliersText(suppliers, t)] }),
|
|
88
|
+
published ? /* @__PURE__ */ jsxs("div", {
|
|
89
|
+
"data-contributors": showPrimaryContributors,
|
|
90
|
+
children: [
|
|
91
|
+
t(`${bylineType}.lastUpdated`),
|
|
92
|
+
" ",
|
|
93
|
+
published
|
|
94
|
+
]
|
|
95
|
+
}) : null,
|
|
96
|
+
bylineSuffix
|
|
97
|
+
]
|
|
98
|
+
}), (!!licenseBox || !!footnotes?.length) && /* @__PURE__ */ jsxs(StyledAccordionRoot, {
|
|
99
|
+
multiple: true,
|
|
100
|
+
value: openAccordions,
|
|
101
|
+
onValueChange: (details) => setOpenAccordions(details.value),
|
|
102
|
+
children: [!!licenseBox && /* @__PURE__ */ jsx(ArticleBylineAccordionItem, {
|
|
103
|
+
value: accordionItemValue,
|
|
104
|
+
accordionTitle: t("article.useContent"),
|
|
105
|
+
children: licenseBox
|
|
106
|
+
}), !!footnotes?.length && /* @__PURE__ */ jsx(ArticleBylineAccordionItem, {
|
|
107
|
+
value: footnotesAccordionId,
|
|
108
|
+
accordionTitle: t("article.footnotes"),
|
|
109
|
+
children: /* @__PURE__ */ jsx(ArticleFootNotes, { footNotes: footnotes })
|
|
110
|
+
})]
|
|
111
|
+
})] });
|
|
153
112
|
};
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
})]
|
|
176
|
-
})
|
|
177
|
-
})
|
|
178
|
-
}), /*#__PURE__*/_jsx(AccordionItemContent, {
|
|
179
|
-
children: children
|
|
180
|
-
})]
|
|
181
|
-
});
|
|
182
|
-
});
|
|
113
|
+
const ArticleBylineAccordionItem = forwardRef(({ value, accordionTitle, children,...props }, ref) => {
|
|
114
|
+
return /* @__PURE__ */ jsxs(AccordionItem, {
|
|
115
|
+
value,
|
|
116
|
+
ref,
|
|
117
|
+
...props,
|
|
118
|
+
children: [/* @__PURE__ */ jsx(Heading, {
|
|
119
|
+
asChild: true,
|
|
120
|
+
consumeCss: true,
|
|
121
|
+
textStyle: "label.medium",
|
|
122
|
+
fontWeight: "bold",
|
|
123
|
+
children: /* @__PURE__ */ jsx("h2", { children: /* @__PURE__ */ jsxs(AccordionItemTrigger, { children: [accordionTitle, /* @__PURE__ */ jsx(AccordionItemIndicator, {
|
|
124
|
+
asChild: true,
|
|
125
|
+
children: /* @__PURE__ */ jsx(ArrowDownShortLine, {})
|
|
126
|
+
})] }) })
|
|
127
|
+
}), /* @__PURE__ */ jsx(AccordionItemContent, { children })]
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
//#endregion
|
|
132
|
+
export { ArticleByline, ArticleBylineAccordionItem };
|
|
133
|
+
//# sourceMappingURL=ArticleByline.js.map
|