@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
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.RelatedArticleList = exports.RelatedArticle = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactI18next = require("react-i18next");
|
|
9
|
-
var _icons = require("@ndla/icons");
|
|
10
|
-
var _primitives = require("@ndla/primitives");
|
|
11
|
-
var _safelink = require("@ndla/safelink");
|
|
12
|
-
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
13
|
-
var _patterns = require("@ndla/styled-system/patterns");
|
|
14
|
-
var _ContentTypeBadge = require("../ContentTypeBadge/ContentTypeBadge");
|
|
15
|
-
var _ContentType = require("../model/ContentType");
|
|
16
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
/**
|
|
18
|
-
* Copyright (c) 2023-present, NDLA.
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
21
|
-
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const StyledSpan = (0, _jsx2.styled)("span", {
|
|
26
|
-
base: {
|
|
27
|
-
display: "flex",
|
|
28
|
-
gap: "3xsmall"
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const RelatedArticle = _ref => {
|
|
32
|
-
let {
|
|
33
|
-
title,
|
|
34
|
-
introduction,
|
|
35
|
-
to,
|
|
36
|
-
linkInfo = "",
|
|
37
|
-
target = "",
|
|
38
|
-
type = _ContentType.contentTypes.SUBJECT_MATERIAL
|
|
39
|
-
} = _ref;
|
|
40
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.CardRoot, {
|
|
41
|
-
"data-embed-type": "related-article",
|
|
42
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.CardContent, {
|
|
43
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ContentTypeBadge.ContentTypeBadge, {
|
|
44
|
-
contentType: type
|
|
45
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.CardHeading, {
|
|
46
|
-
asChild: true,
|
|
47
|
-
consumeCss: true,
|
|
48
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
49
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_safelink.SafeLink, {
|
|
50
|
-
unstyled: true,
|
|
51
|
-
to: to,
|
|
52
|
-
target: target,
|
|
53
|
-
rel: linkInfo ? "noopener noreferrer" : undefined,
|
|
54
|
-
css: _patterns.linkOverlay.raw(),
|
|
55
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledSpan, {
|
|
56
|
-
children: [title, target === "_blank" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ExternalLinkLine, {})]
|
|
57
|
-
})
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
|
|
61
|
-
dangerouslySetInnerHTML: {
|
|
62
|
-
__html: introduction
|
|
63
|
-
}
|
|
64
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
|
|
65
|
-
color: "text.subtle",
|
|
66
|
-
textStyle: "label.small",
|
|
67
|
-
children: linkInfo
|
|
68
|
-
})]
|
|
69
|
-
})
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
exports.RelatedArticle = RelatedArticle;
|
|
73
|
-
const HeadingWrapper = (0, _jsx2.styled)("div", {
|
|
74
|
-
base: {
|
|
75
|
-
display: "flex",
|
|
76
|
-
width: "100%",
|
|
77
|
-
justifyContent: "space-between",
|
|
78
|
-
alignItems: "center",
|
|
79
|
-
alignSelf: "flex-start"
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
const ArticlesWrapper = (0, _jsx2.styled)("div", {
|
|
83
|
-
base: {
|
|
84
|
-
display: "grid",
|
|
85
|
-
width: "100%",
|
|
86
|
-
gridTemplateColumns: "repeat(2, 1fr)",
|
|
87
|
-
gap: "medium",
|
|
88
|
-
tabletDown: {
|
|
89
|
-
gridTemplateColumns: "1fr"
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
const StyledSection = (0, _jsx2.styled)("section", {
|
|
94
|
-
base: {
|
|
95
|
-
display: "flex",
|
|
96
|
-
flexDirection: "column",
|
|
97
|
-
alignItems: "center",
|
|
98
|
-
gap: "medium",
|
|
99
|
-
clear: "both"
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
const StyledButton = (0, _jsx2.styled)(_primitives.Button, {
|
|
103
|
-
base: {
|
|
104
|
-
marginBlockStart: "xsmall"
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
const RelatedArticleList = _ref2 => {
|
|
108
|
-
let {
|
|
109
|
-
children = [],
|
|
110
|
-
articleCount,
|
|
111
|
-
headingLevel: HeadingElement = "h2",
|
|
112
|
-
headingButtons,
|
|
113
|
-
...rest
|
|
114
|
-
} = _ref2;
|
|
115
|
-
const [expanded, setExpanded] = (0, _react.useState)(false);
|
|
116
|
-
const {
|
|
117
|
-
t
|
|
118
|
-
} = (0, _reactI18next.useTranslation)();
|
|
119
|
-
const childCount = (0, _react.useMemo)(() => articleCount ?? _react.Children.count(children), [children, articleCount]);
|
|
120
|
-
const childrenToShow = (0, _react.useMemo)(() => childCount > 2 && !expanded ? children?.slice(0, 2) : children, [childCount, children, expanded]);
|
|
121
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledSection, {
|
|
122
|
-
...rest,
|
|
123
|
-
"data-embed-type": "related-content-list",
|
|
124
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(HeadingWrapper, {
|
|
125
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Heading, {
|
|
126
|
-
asChild: true,
|
|
127
|
-
consumeCss: true,
|
|
128
|
-
textStyle: "title.large",
|
|
129
|
-
fontWeight: "bold",
|
|
130
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(HeadingElement, {
|
|
131
|
-
children: t("related.title")
|
|
132
|
-
})
|
|
133
|
-
}), headingButtons]
|
|
134
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ArticlesWrapper, {
|
|
135
|
-
children: childrenToShow
|
|
136
|
-
}), childCount > 2 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledButton, {
|
|
137
|
-
variant: "secondary",
|
|
138
|
-
onClick: () => setExpanded(p => !p),
|
|
139
|
-
children: t(`related.show${expanded ? "Less" : "More"}`)
|
|
140
|
-
}) : null]
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
exports.RelatedArticleList = RelatedArticleList;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "RelatedArticle", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _RelatedArticleList.RelatedArticle;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
exports.default = void 0;
|
|
13
|
-
var _RelatedArticleList = require("./RelatedArticleList");
|
|
14
|
-
/**
|
|
15
|
-
* Copyright (c) 2017-present, NDLA.
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
var _default = exports.default = _RelatedArticleList.RelatedArticleList;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.ResourceBox = void 0;
|
|
7
|
-
var _core = require("@ndla/core");
|
|
8
|
-
var _icons = require("@ndla/icons");
|
|
9
|
-
var _primitives = require("@ndla/primitives");
|
|
10
|
-
var _safelink = require("@ndla/safelink");
|
|
11
|
-
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
/**
|
|
14
|
-
* Copyright (c) 2022-present, NDLA.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const Container = (0, _jsx2.styled)("div", {
|
|
22
|
-
base: {
|
|
23
|
-
display: "flex",
|
|
24
|
-
padding: "medium",
|
|
25
|
-
borderRadius: "xsmall",
|
|
26
|
-
border: "1px solid",
|
|
27
|
-
borderColor: "stroke.default",
|
|
28
|
-
boxShadow: "full",
|
|
29
|
-
marginBlockEnd: "medium",
|
|
30
|
-
gap: "medium",
|
|
31
|
-
tabletWideDown: {
|
|
32
|
-
padding: "xsmall"
|
|
33
|
-
},
|
|
34
|
-
tabletDown: {
|
|
35
|
-
flexDirection: "column",
|
|
36
|
-
gap: "0",
|
|
37
|
-
padding: "0"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
const ContentWrapper = (0, _jsx2.styled)("div", {
|
|
42
|
-
base: {
|
|
43
|
-
display: "flex",
|
|
44
|
-
flexDirection: "column",
|
|
45
|
-
alignItems: "flex-start",
|
|
46
|
-
gap: "xsmall",
|
|
47
|
-
flex: "1",
|
|
48
|
-
tabletDown: {
|
|
49
|
-
padding: "xsmall"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
const StyledImage = (0, _jsx2.styled)(_primitives.Image, {
|
|
54
|
-
base: {
|
|
55
|
-
objectFit: "cover",
|
|
56
|
-
borderRadius: "xsmall",
|
|
57
|
-
width: "fit-content",
|
|
58
|
-
aspectRatio: "1/1",
|
|
59
|
-
tabletDown: {
|
|
60
|
-
width: "100%",
|
|
61
|
-
borderRadius: "0"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
const StyledText = (0, _jsx2.styled)(_primitives.Text, {
|
|
66
|
-
base: {
|
|
67
|
-
flex: "1"
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
const ResourceBox = _ref => {
|
|
71
|
-
let {
|
|
72
|
-
image,
|
|
73
|
-
title,
|
|
74
|
-
caption,
|
|
75
|
-
url,
|
|
76
|
-
buttonText
|
|
77
|
-
} = _ref;
|
|
78
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
79
|
-
children: [image ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledImage, {
|
|
80
|
-
src: image.src,
|
|
81
|
-
alt: image.alt,
|
|
82
|
-
sizes: `(min-width: ${_core.breakpoints.desktop}) 150px, (max-width: ${_core.breakpoints.tablet} ) 400px, 200px`,
|
|
83
|
-
variant: "rounded"
|
|
84
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(ContentWrapper, {
|
|
85
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Heading, {
|
|
86
|
-
textStyle: "label.large",
|
|
87
|
-
fontWeight: "bold",
|
|
88
|
-
asChild: true,
|
|
89
|
-
consumeCss: true,
|
|
90
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
91
|
-
children: title
|
|
92
|
-
})
|
|
93
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledText, {
|
|
94
|
-
textStyle: "body.medium",
|
|
95
|
-
children: caption
|
|
96
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_safelink.SafeLinkButton, {
|
|
97
|
-
to: url,
|
|
98
|
-
target: "_blank",
|
|
99
|
-
variant: "secondary",
|
|
100
|
-
children: [buttonText, /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ShareBoxLine, {})]
|
|
101
|
-
})]
|
|
102
|
-
})]
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
exports.ResourceBox = ResourceBox;
|
|
106
|
-
var _default = exports.default = ResourceBox;
|
package/lib/ResourceBox/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "ResourceBox", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _ResourceBox.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _ResourceBox = _interopRequireDefault(require("./ResourceBox"));
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TagSelectorTrigger = exports.TagSelectorRoot = exports.TagSelectorLabel = exports.TagSelectorItemInput = exports.TagSelectorInputBase = exports.TagSelectorInput = exports.TagSelectorControl = exports.TagSelectorClearTrigger = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _react2 = require("@ark-ui/react");
|
|
9
|
-
var _icons = require("@ndla/icons");
|
|
10
|
-
var _primitives = require("@ndla/primitives");
|
|
11
|
-
var _util = require("@ndla/util");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
/**
|
|
14
|
-
* Copyright (c) 2024-present, NDLA.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const TagSelectorRoot = _ref => {
|
|
22
|
-
let {
|
|
23
|
-
allowCustomValue = true,
|
|
24
|
-
multiple = true,
|
|
25
|
-
selectionBehavior = "clear",
|
|
26
|
-
editable,
|
|
27
|
-
addOnPaste = false,
|
|
28
|
-
onValueChange,
|
|
29
|
-
children,
|
|
30
|
-
value,
|
|
31
|
-
translations,
|
|
32
|
-
...rest
|
|
33
|
-
} = _ref;
|
|
34
|
-
const ids = {
|
|
35
|
-
root: (0, _react.useId)(),
|
|
36
|
-
input: (0, _react.useId)(),
|
|
37
|
-
control: (0, _react.useId)()
|
|
38
|
-
};
|
|
39
|
-
const controlRef = (0, _react.useRef)(undefined);
|
|
40
|
-
(0, _react.useEffect)(() => {
|
|
41
|
-
if (!controlRef.current) {
|
|
42
|
-
controlRef.current = document.getElementById(ids.control);
|
|
43
|
-
}
|
|
44
|
-
}, [ids.control]);
|
|
45
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ComboboxRoot, {
|
|
46
|
-
ids: ids,
|
|
47
|
-
asChild: true,
|
|
48
|
-
allowCustomValue: allowCustomValue,
|
|
49
|
-
multiple: multiple,
|
|
50
|
-
selectionBehavior: selectionBehavior,
|
|
51
|
-
onValueChange: onValueChange,
|
|
52
|
-
translations: translations,
|
|
53
|
-
onPointerDownOutside: event => {
|
|
54
|
-
if ((0, _util.contains)(controlRef.current, event.detail.originalEvent.target)) {
|
|
55
|
-
event.preventDefault();
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
value: value,
|
|
59
|
-
...rest,
|
|
60
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TagSelectorTagsInputRoot, {
|
|
61
|
-
ids: ids,
|
|
62
|
-
value: value,
|
|
63
|
-
editable: editable,
|
|
64
|
-
onValueChange: onValueChange,
|
|
65
|
-
addOnPaste: addOnPaste,
|
|
66
|
-
translations: translations,
|
|
67
|
-
children: children
|
|
68
|
-
})
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
exports.TagSelectorRoot = TagSelectorRoot;
|
|
72
|
-
const TagSelectorTagsInputRoot = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
73
|
-
const comboboxApi = (0, _react2.useComboboxContext)();
|
|
74
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.TagsInputRoot, {
|
|
75
|
-
ref: ref,
|
|
76
|
-
onInputValueChange: details => comboboxApi.setInputValue(details.inputValue),
|
|
77
|
-
...props
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
const TagSelectorLabel = exports.TagSelectorLabel = _primitives.ComboboxLabel;
|
|
81
|
-
const TagSelectorItemInput = exports.TagSelectorItemInput = _primitives.TagsInputItemInput;
|
|
82
|
-
const TagSelectorTrigger = exports.TagSelectorTrigger = _primitives.ComboboxTrigger;
|
|
83
|
-
const TagSelectorControl = exports.TagSelectorControl = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
84
|
-
let {
|
|
85
|
-
children,
|
|
86
|
-
...props
|
|
87
|
-
} = _ref2;
|
|
88
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ComboboxControl, {
|
|
89
|
-
ref: ref,
|
|
90
|
-
asChild: true,
|
|
91
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.TagsInputControl, {
|
|
92
|
-
...props,
|
|
93
|
-
children: children
|
|
94
|
-
})
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
const TagSelectorClearTrigger = exports.TagSelectorClearTrigger = _primitives.ComboboxClearTrigger;
|
|
98
|
-
// If you need to modify the TagsInputItem, you can use this.
|
|
99
|
-
const TagSelectorInputBase = exports.TagSelectorInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
100
|
-
let {
|
|
101
|
-
children,
|
|
102
|
-
...props
|
|
103
|
-
} = _ref3;
|
|
104
|
-
const tagsApi = (0, _react2.useTagsInputContext)();
|
|
105
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ComboboxInput, {
|
|
106
|
-
ref: ref,
|
|
107
|
-
asChild: true,
|
|
108
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.TagsInputInput, {
|
|
109
|
-
onKeyDown: event => {
|
|
110
|
-
if (event.key === "Enter") {
|
|
111
|
-
tagsApi.addValue(tagsApi.inputValue);
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
...props,
|
|
115
|
-
children: children
|
|
116
|
-
})
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
const TagSelectorInput = exports.TagSelectorInput = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
120
|
-
let {
|
|
121
|
-
children,
|
|
122
|
-
...props
|
|
123
|
-
} = _ref4;
|
|
124
|
-
const tagsApi = (0, _react2.useTagsInputContext)();
|
|
125
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
126
|
-
children: [tagsApi.value.map((value, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.TagsInputItem, {
|
|
127
|
-
index: index,
|
|
128
|
-
value: value,
|
|
129
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.TagsInputItemPreview, {
|
|
130
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.TagsInputItemText, {
|
|
131
|
-
children: value
|
|
132
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.TagsInputItemDeleteTrigger, {
|
|
133
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.CloseLine, {})
|
|
134
|
-
})]
|
|
135
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.TagsInputItemInput, {})]
|
|
136
|
-
}, value)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ComboboxInput, {
|
|
137
|
-
ref: ref,
|
|
138
|
-
asChild: true,
|
|
139
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.TagsInputInput, {
|
|
140
|
-
onKeyDown: event => {
|
|
141
|
-
if (event.key === "Enter") {
|
|
142
|
-
tagsApi.addValue(tagsApi.inputValue);
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
...props,
|
|
146
|
-
children: children
|
|
147
|
-
})
|
|
148
|
-
})]
|
|
149
|
-
});
|
|
150
|
-
});
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ZendeskButton = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _primitives = require("@ndla/primitives");
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
/**
|
|
11
|
-
* Copyright (c) 2024-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
|
-
// TODO: Let's consider abandoning `disabled` on the button here. It should instead just open/close the widget based on its current state.
|
|
19
|
-
|
|
20
|
-
const ZendeskButton = exports.ZendeskButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
21
|
-
let {
|
|
22
|
-
locale,
|
|
23
|
-
variant = "secondary",
|
|
24
|
-
widgetKey,
|
|
25
|
-
children,
|
|
26
|
-
...rest
|
|
27
|
-
} = _ref;
|
|
28
|
-
const [loading, setLoading] = (0, _react.useState)(false);
|
|
29
|
-
const handleClick = () => {
|
|
30
|
-
if (window && !window.zE) {
|
|
31
|
-
setLoading(true);
|
|
32
|
-
// Asynchronously load zendesk scripts for better performance
|
|
33
|
-
const script = document.createElement("script");
|
|
34
|
-
script.id = "ze-snippet";
|
|
35
|
-
script.type = "text/javascript";
|
|
36
|
-
script.async = true;
|
|
37
|
-
script.onload = () => {
|
|
38
|
-
if (window.zE) {
|
|
39
|
-
window.zE("webWidget", "setLocale", locale);
|
|
40
|
-
window.zE("webWidget:on", "close", () => {
|
|
41
|
-
setLoading(false);
|
|
42
|
-
});
|
|
43
|
-
window.zE("webWidget", "open");
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
script.src = `https://static.zdassets.com/ekr/snippet.js?key=${widgetKey}`;
|
|
47
|
-
document.body.appendChild(script);
|
|
48
|
-
} else if (window?.zE) {
|
|
49
|
-
window.zE("webWidget", "open");
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Button, {
|
|
53
|
-
onClick: handleClick,
|
|
54
|
-
variant: variant,
|
|
55
|
-
id: "zendeskButton",
|
|
56
|
-
disabled: loading,
|
|
57
|
-
...rest,
|
|
58
|
-
ref: ref,
|
|
59
|
-
children: children
|
|
60
|
-
});
|
|
61
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.formatNestedMessages = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Copyright (c) 2017-present, NDLA.
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const formatNestedMessages = function (phrases) {
|
|
16
|
-
let formattedMessages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
17
|
-
let prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
18
|
-
const messages = formattedMessages;
|
|
19
|
-
Object.keys(phrases).forEach(key => {
|
|
20
|
-
const value = phrases[key];
|
|
21
|
-
if ({}.hasOwnProperty.call(phrases, key)) {
|
|
22
|
-
const keyWithPrefix = prefix ? `${prefix}.${key}` : key;
|
|
23
|
-
if (typeof value === "object") {
|
|
24
|
-
formatNestedMessages(value, formattedMessages, keyWithPrefix);
|
|
25
|
-
} else {
|
|
26
|
-
messages[keyWithPrefix] = value;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
return messages;
|
|
31
|
-
};
|
|
32
|
-
exports.formatNestedMessages = formatNestedMessages;
|
package/lib/i18n/i18n.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.supportedTranslationLanguages = exports.i18nInstance = void 0;
|
|
7
|
-
var _i18next = _interopRequireDefault(require("i18next"));
|
|
8
|
-
var _reactI18next = require("react-i18next");
|
|
9
|
-
var _messagesEn = _interopRequireDefault(require("../locale/messages-en"));
|
|
10
|
-
var _messagesNb = _interopRequireDefault(require("../locale/messages-nb"));
|
|
11
|
-
var _messagesNn = _interopRequireDefault(require("../locale/messages-nn"));
|
|
12
|
-
var _messagesSe = _interopRequireDefault(require("../locale/messages-se"));
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
/**
|
|
15
|
-
* Copyright (c) 2021-present, NDLA.
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
const supportedTranslationLanguages = exports.supportedTranslationLanguages = ["nb", "nn", "en", "se"];
|
|
23
|
-
const i18nInstance = exports.i18nInstance = _i18next.default.use(_reactI18next.initReactI18next);
|
|
24
|
-
i18nInstance.init({
|
|
25
|
-
fallbackLng: "nb",
|
|
26
|
-
supportedLngs: supportedTranslationLanguages,
|
|
27
|
-
resources: {
|
|
28
|
-
en: {
|
|
29
|
-
translation: _messagesEn.default
|
|
30
|
-
},
|
|
31
|
-
nn: {
|
|
32
|
-
translation: _messagesNn.default
|
|
33
|
-
},
|
|
34
|
-
nb: {
|
|
35
|
-
translation: _messagesNb.default
|
|
36
|
-
},
|
|
37
|
-
se: {
|
|
38
|
-
translation: _messagesSe.default
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
});
|
package/lib/i18n/index.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "formatNestedMessages", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _formatNestedMessages.formatNestedMessages;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "i18nInstance", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _i18n.i18nInstance;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "useAudioSearchTranslations", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _useComponentTranslations.useAudioSearchTranslations;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "useComboboxTranslations", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _useComponentTranslations.useComboboxTranslations;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "useImageSearchTranslations", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _useComponentTranslations.useImageSearchTranslations;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "usePaginationTranslations", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _useComponentTranslations.usePaginationTranslations;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "useTagSelectorTranslations", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _useComponentTranslations.useTagSelectorTranslations;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "useTagsInputTranslations", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _useComponentTranslations.useTagsInputTranslations;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "useVideoSearchTranslations", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _useComponentTranslations.useVideoSearchTranslations;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
var _i18n = require("./i18n");
|
|
61
|
-
var _formatNestedMessages = require("./formatNestedMessages");
|
|
62
|
-
var _useComponentTranslations = require("./useComponentTranslations");
|