@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.
- package/lib/i18n/index.d.ts +1 -1
- package/lib/i18n/useComponentTranslations.d.ts +2 -1
- package/lib/index.d.ts +1 -1
- package/lib/locale/messages-en.d.ts +34 -0
- package/lib/locale/messages-nb.d.ts +34 -0
- package/lib/locale/messages-nn.d.ts +34 -0
- package/lib/locale/messages-se.d.ts +34 -0
- package/package.json +6 -5
- package/src/Article/ArticleByline.tsx +1 -1
- package/src/i18n/index.ts +1 -0
- package/src/i18n/useComponentTranslations.ts +36 -1
- package/src/index.ts +1 -0
- package/src/locale/messages-en.ts +34 -0
- package/src/locale/messages-nb.ts +34 -0
- package/src/locale/messages-nn.ts +34 -0
- package/src/locale/messages-se.ts +34 -0
- package/es/Article/Article.js +0 -199
- package/es/Article/ArticleByline.js +0 -182
- package/es/Article/ArticleFootNotes.js +0 -60
- package/es/Article/index.js +0 -11
- package/es/AudioPlayer/AudioPlayer.js +0 -218
- package/es/AudioPlayer/Controls.js +0 -332
- package/es/AudioPlayer/SpeechControl.js +0 -56
- package/es/AudioPlayer/index.js +0 -10
- package/es/Breadcrumb/Breadcrumb.js +0 -60
- package/es/Breadcrumb/BreadcrumbItem.js +0 -62
- package/es/Breadcrumb/HomeBreadcrumb.js +0 -77
- package/es/Breadcrumb/index.js +0 -11
- package/es/CampaignBlock/CampaignBlock.js +0 -180
- package/es/CampaignBlock/index.js +0 -9
- package/es/CodeBlock/CodeBlock.js +0 -35
- package/es/CodeBlock/codeLanguageOptions.js +0 -84
- package/es/CodeBlock/index.js +0 -10
- package/es/Concept/Concept.js +0 -72
- package/es/ContactBlock/ContactBlock.js +0 -199
- package/es/ContactBlock/index.js +0 -9
- package/es/ContentTypeBadge/ContentTypeBadge.js +0 -50
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +0 -32
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +0 -32
- package/es/ContentTypeHero/ContentTypeHero.js +0 -50
- package/es/ContentTypeHero/index.js +0 -9
- package/es/CopyParagraphButton/CopyParagraphButton.js +0 -83
- package/es/CopyParagraphButton/index.js +0 -11
- package/es/Embed/AudioEmbed.js +0 -76
- package/es/Embed/BrightcoveEmbed.js +0 -133
- package/es/Embed/CodeEmbed.js +0 -79
- package/es/Embed/ConceptEmbed.js +0 -123
- package/es/Embed/ConceptInlineTriggerButton.js +0 -45
- package/es/Embed/ContentLinkEmbed.js +0 -51
- package/es/Embed/CopyrightEmbed.js +0 -33
- package/es/Embed/EmbedErrorPlaceholder.js +0 -58
- package/es/Embed/EmbedWrapper.js +0 -51
- package/es/Embed/ExternalEmbed.js +0 -74
- package/es/Embed/FootnoteEmbed.js +0 -44
- package/es/Embed/GlossEmbed.js +0 -80
- package/es/Embed/H5pEmbed.js +0 -61
- package/es/Embed/IframeEmbed.js +0 -93
- package/es/Embed/ImageEmbed.js +0 -238
- package/es/Embed/InlineTriggerButton.js +0 -37
- package/es/Embed/RelatedContentEmbed.js +0 -55
- package/es/Embed/UnknownEmbed.js +0 -31
- package/es/Embed/UuDisclaimerEmbed.js +0 -88
- package/es/Embed/index.js +0 -25
- package/es/Embed/types.js +0 -1
- package/es/ErrorMessage/ErrorMessage.js +0 -95
- package/es/ErrorMessage/index.js +0 -10
- package/es/FactBox/FactBox.js +0 -177
- package/es/FactBox/index.js +0 -10
- package/es/FileList/File.js +0 -101
- package/es/FileList/FileList.js +0 -47
- package/es/FileList/PdfFile.js +0 -50
- package/es/FileList/index.js +0 -11
- package/es/Gloss/Gloss.js +0 -175
- package/es/Gloss/GlossExample.js +0 -64
- package/es/Gloss/index.js +0 -10
- package/es/Grid/Grid.js +0 -94
- package/es/Grid/GridParallaxItem.js +0 -32
- package/es/Grid/index.js +0 -10
- package/es/KeyFigure/KeyFigure.js +0 -63
- package/es/KeyFigure/index.js +0 -9
- package/es/LicenseByline/EmbedByline.js +0 -212
- package/es/LicenseByline/LicenseLink.js +0 -56
- package/es/LicenseByline/index.js +0 -10
- package/es/LinkBlock/LinkBlock.js +0 -103
- package/es/LinkBlock/LinkBlockSection.js +0 -35
- package/es/LinkBlock/index.js +0 -10
- package/es/Pitch/Pitch.js +0 -83
- package/es/Pitch/index.js +0 -9
- package/es/RelatedArticleList/RelatedArticleList.js +0 -135
- package/es/RelatedArticleList/index.js +0 -11
- package/es/ResourceBox/ResourceBox.js +0 -99
- package/es/ResourceBox/index.js +0 -10
- package/es/TagSelector/TagSelector.js +0 -143
- package/es/ZendeskButton/ZendeskButton.js +0 -55
- package/es/i18n/formatNestedMessages.js +0 -25
- package/es/i18n/i18n.js +0 -35
- package/es/i18n/index.js +0 -11
- package/es/i18n/useComponentTranslations.js +0 -164
- package/es/index.js +0 -45
- package/es/locale/messages-en.js +0 -428
- package/es/locale/messages-nb.js +0 -428
- package/es/locale/messages-nn.js +0 -428
- package/es/locale/messages-se.js +0 -428
- package/es/model/ContentType.js +0 -68
- package/es/model/SubjectCategories.js +0 -12
- package/es/model/SubjectTypes.js +0 -11
- package/es/model/WordClass.js +0 -45
- package/es/model/index.js +0 -21
- package/es/types.js +0 -1
- package/es/utils/licenseAttributes.js +0 -18
- package/es/utils/relativeUrl.js +0 -37
- package/lib/Article/Article.js +0 -207
- package/lib/Article/ArticleByline.js +0 -189
- package/lib/Article/ArticleFootNotes.js +0 -67
- package/lib/Article/index.js +0 -68
- package/lib/AudioPlayer/AudioPlayer.js +0 -224
- package/lib/AudioPlayer/Controls.js +0 -338
- package/lib/AudioPlayer/SpeechControl.js +0 -62
- package/lib/AudioPlayer/index.js +0 -16
- package/lib/Breadcrumb/Breadcrumb.js +0 -67
- package/lib/Breadcrumb/BreadcrumbItem.js +0 -68
- package/lib/Breadcrumb/HomeBreadcrumb.js +0 -84
- package/lib/Breadcrumb/index.js +0 -23
- package/lib/CampaignBlock/CampaignBlock.js +0 -187
- package/lib/CampaignBlock/index.js +0 -13
- package/lib/CodeBlock/CodeBlock.js +0 -41
- package/lib/CodeBlock/codeLanguageOptions.js +0 -90
- package/lib/CodeBlock/index.js +0 -20
- package/lib/Concept/Concept.js +0 -78
- package/lib/ContactBlock/ContactBlock.js +0 -206
- package/lib/ContactBlock/index.js +0 -18
- package/lib/ContentTypeBadge/ContentTypeBadge.js +0 -57
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +0 -38
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +0 -38
- package/lib/ContentTypeHero/ContentTypeHero.js +0 -57
- package/lib/ContentTypeHero/index.js +0 -12
- package/lib/CopyParagraphButton/CopyParagraphButton.js +0 -89
- package/lib/CopyParagraphButton/index.js +0 -22
- package/lib/Embed/AudioEmbed.js +0 -84
- package/lib/Embed/BrightcoveEmbed.js +0 -142
- package/lib/Embed/CodeEmbed.js +0 -86
- package/lib/Embed/ConceptEmbed.js +0 -131
- package/lib/Embed/ConceptInlineTriggerButton.js +0 -51
- package/lib/Embed/ContentLinkEmbed.js +0 -57
- package/lib/Embed/CopyrightEmbed.js +0 -39
- package/lib/Embed/EmbedErrorPlaceholder.js +0 -64
- package/lib/Embed/EmbedWrapper.js +0 -57
- package/lib/Embed/ExternalEmbed.js +0 -81
- package/lib/Embed/FootnoteEmbed.js +0 -50
- package/lib/Embed/GlossEmbed.js +0 -88
- package/lib/Embed/H5pEmbed.js +0 -68
- package/lib/Embed/IframeEmbed.js +0 -100
- package/lib/Embed/ImageEmbed.js +0 -248
- package/lib/Embed/InlineTriggerButton.js +0 -43
- package/lib/Embed/RelatedContentEmbed.js +0 -61
- package/lib/Embed/UnknownEmbed.js +0 -37
- package/lib/Embed/UuDisclaimerEmbed.js +0 -94
- package/lib/Embed/index.js +0 -150
- package/lib/Embed/types.js +0 -5
- package/lib/ErrorMessage/ErrorMessage.js +0 -101
- package/lib/ErrorMessage/index.js +0 -16
- package/lib/FactBox/FactBox.js +0 -184
- package/lib/FactBox/index.js +0 -16
- package/lib/FileList/File.js +0 -108
- package/lib/FileList/FileList.js +0 -54
- package/lib/FileList/PdfFile.js +0 -57
- package/lib/FileList/index.js +0 -44
- package/lib/Gloss/Gloss.js +0 -181
- package/lib/Gloss/GlossExample.js +0 -70
- package/lib/Gloss/index.js +0 -20
- package/lib/Grid/Grid.js +0 -101
- package/lib/Grid/GridParallaxItem.js +0 -39
- package/lib/Grid/index.js +0 -19
- package/lib/KeyFigure/KeyFigure.js +0 -70
- package/lib/KeyFigure/index.js +0 -13
- package/lib/LicenseByline/EmbedByline.js +0 -220
- package/lib/LicenseByline/LicenseLink.js +0 -62
- package/lib/LicenseByline/index.js +0 -19
- package/lib/LinkBlock/LinkBlock.js +0 -110
- package/lib/LinkBlock/LinkBlockSection.js +0 -41
- package/lib/LinkBlock/index.js +0 -20
- package/lib/Pitch/Pitch.js +0 -91
- package/lib/Pitch/index.js +0 -12
- package/lib/RelatedArticleList/RelatedArticleList.js +0 -143
- package/lib/RelatedArticleList/index.js +0 -21
- package/lib/ResourceBox/ResourceBox.js +0 -106
- package/lib/ResourceBox/index.js +0 -13
- package/lib/TagSelector/TagSelector.js +0 -150
- package/lib/ZendeskButton/ZendeskButton.js +0 -61
- package/lib/i18n/formatNestedMessages.js +0 -32
- package/lib/i18n/i18n.js +0 -41
- package/lib/i18n/index.js +0 -62
- package/lib/i18n/useComponentTranslations.js +0 -176
- package/lib/index.js +0 -593
- package/lib/locale/messages-en.js +0 -435
- package/lib/locale/messages-nb.js +0 -435
- package/lib/locale/messages-nn.js +0 -435
- package/lib/locale/messages-se.js +0 -435
- package/lib/model/ContentType.js +0 -74
- package/lib/model/SubjectCategories.js +0 -18
- package/lib/model/SubjectTypes.js +0 -17
- package/lib/model/WordClass.js +0 -51
- package/lib/model/index.js +0 -28
- package/lib/types.js +0 -5
- package/lib/utils/licenseAttributes.js +0 -25
- package/lib/utils/relativeUrl.js +0 -44
package/lib/Article/Article.js
DELETED
|
@@ -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;
|
package/lib/Article/index.js
DELETED
|
@@ -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");
|