@ndla/ui 56.0.122-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/README.md +1 -1
- package/es/Article/Article.js +127 -0
- package/es/Article/Article.js.map +1 -0
- package/es/Article/ArticleByline.js +133 -0
- package/es/Article/ArticleByline.js.map +1 -0
- package/es/Article/ArticleFootNotes.js +40 -0
- package/es/Article/ArticleFootNotes.js.map +1 -0
- package/es/AudioPlayer/AudioPlayer.js +157 -0
- package/es/AudioPlayer/AudioPlayer.js.map +1 -0
- package/es/AudioPlayer/Controls.js +254 -0
- package/es/AudioPlayer/Controls.js.map +1 -0
- package/es/AudioPlayer/SpeechControl.js +40 -0
- package/es/AudioPlayer/SpeechControl.js.map +1 -0
- package/es/AudioPlayer/index.js +8 -0
- package/es/AudioPlayer/index.js.map +1 -0
- package/es/Breadcrumb/Breadcrumb.js +44 -0
- package/es/Breadcrumb/Breadcrumb.js.map +1 -0
- package/es/Breadcrumb/BreadcrumbItem.js +36 -0
- package/es/Breadcrumb/BreadcrumbItem.js.map +1 -0
- package/es/Breadcrumb/HomeBreadcrumb.js +44 -0
- package/es/Breadcrumb/HomeBreadcrumb.js.map +1 -0
- package/es/Breadcrumb/index.js +9 -0
- package/es/Breadcrumb/index.js.map +1 -0
- package/es/CampaignBlock/CampaignBlock.js +131 -0
- package/es/CampaignBlock/CampaignBlock.js.map +1 -0
- package/es/CodeBlock/CodeBlock.js +25 -0
- package/es/CodeBlock/CodeBlock.js.map +1 -0
- package/es/CodeBlock/codeLanguageOptions.js +114 -0
- package/es/CodeBlock/codeLanguageOptions.js.map +1 -0
- package/es/Concept/Concept.js +50 -0
- package/es/Concept/Concept.js.map +1 -0
- package/es/ContactBlock/ContactBlock.js +145 -0
- package/es/ContactBlock/ContactBlock.js.map +1 -0
- package/es/ContentTypeBadge/ContentTypeBadge.js +41 -0
- package/es/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +25 -0
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +25 -0
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
- package/es/ContentTypeHero/ContentTypeHero.js +39 -0
- package/es/ContentTypeHero/ContentTypeHero.js.map +1 -0
- package/es/CopyParagraphButton/CopyParagraphButton.js +62 -0
- package/es/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
- package/es/CopyParagraphButton/index.js +8 -0
- package/es/CopyParagraphButton/index.js.map +1 -0
- package/es/Embed/AudioEmbed.js +52 -0
- package/es/Embed/AudioEmbed.js.map +1 -0
- package/es/Embed/BrightcoveEmbed.js +96 -0
- package/es/Embed/BrightcoveEmbed.js.map +1 -0
- package/es/Embed/CodeEmbed.js +61 -0
- package/es/Embed/CodeEmbed.js.map +1 -0
- package/es/Embed/ConceptEmbed.js +78 -0
- package/es/Embed/ConceptEmbed.js.map +1 -0
- package/es/Embed/ConceptInlineTriggerButton.js +40 -0
- package/es/Embed/ConceptInlineTriggerButton.js.map +1 -0
- package/es/Embed/ContentLinkEmbed.js +31 -0
- package/es/Embed/ContentLinkEmbed.js.map +1 -0
- package/es/Embed/CopyrightEmbed.js +23 -0
- package/es/Embed/CopyrightEmbed.js.map +1 -0
- package/es/Embed/EmbedErrorPlaceholder.js +43 -0
- package/es/Embed/EmbedErrorPlaceholder.js.map +1 -0
- package/es/Embed/EmbedWrapper.js +26 -0
- package/es/Embed/EmbedWrapper.js.map +1 -0
- package/es/Embed/ExternalEmbed.js +54 -0
- package/es/Embed/ExternalEmbed.js.map +1 -0
- package/es/Embed/FootnoteEmbed.js +27 -0
- package/es/Embed/FootnoteEmbed.js.map +1 -0
- package/es/Embed/GlossEmbed.js +52 -0
- package/es/Embed/GlossEmbed.js.map +1 -0
- package/es/Embed/H5pEmbed.js +38 -0
- package/es/Embed/H5pEmbed.js.map +1 -0
- package/es/Embed/IframeEmbed.js +69 -0
- package/es/Embed/IframeEmbed.js.map +1 -0
- package/es/Embed/ImageEmbed.js +180 -0
- package/es/Embed/ImageEmbed.js.map +1 -0
- package/es/Embed/InlineTriggerButton.js +25 -0
- package/es/Embed/InlineTriggerButton.js.map +1 -0
- package/es/Embed/RelatedContentEmbed.js +38 -0
- package/es/Embed/RelatedContentEmbed.js.map +1 -0
- package/es/Embed/UnknownEmbed.js +20 -0
- package/es/Embed/UnknownEmbed.js.map +1 -0
- package/es/Embed/UuDisclaimerEmbed.js +54 -0
- package/es/Embed/UuDisclaimerEmbed.js.map +1 -0
- package/es/ErrorMessage/ErrorMessage.js +54 -0
- package/es/ErrorMessage/ErrorMessage.js.map +1 -0
- package/es/ErrorMessage/index.js +8 -0
- package/es/ErrorMessage/index.js.map +1 -0
- package/es/FactBox/FactBox.js +121 -0
- package/es/FactBox/FactBox.js.map +1 -0
- package/es/FactBox/index.js +8 -0
- package/es/FactBox/index.js.map +1 -0
- package/es/FileList/File.js +76 -0
- package/es/FileList/File.js.map +1 -0
- package/es/FileList/FileList.js +32 -0
- package/es/FileList/FileList.js.map +1 -0
- package/es/FileList/PdfFile.js +28 -0
- package/es/FileList/PdfFile.js.map +1 -0
- package/es/Gloss/Gloss.js +142 -0
- package/es/Gloss/Gloss.js.map +1 -0
- package/es/Gloss/GlossExample.js +46 -0
- package/es/Gloss/GlossExample.js.map +1 -0
- package/es/Grid/Grid.js +66 -0
- package/es/Grid/Grid.js.map +1 -0
- package/es/Grid/GridParallaxItem.js +21 -0
- package/es/Grid/GridParallaxItem.js.map +1 -0
- package/es/KeyFigure/KeyFigure.js +46 -0
- package/es/KeyFigure/KeyFigure.js.map +1 -0
- package/es/LicenseByline/EmbedByline.js +132 -0
- package/es/LicenseByline/EmbedByline.js.map +1 -0
- package/es/LicenseByline/LicenseLink.js +31 -0
- package/es/LicenseByline/LicenseLink.js.map +1 -0
- package/es/LinkBlock/LinkBlock.js +74 -0
- package/es/LinkBlock/LinkBlock.js.map +1 -0
- package/es/LinkBlock/LinkBlockSection.js +23 -0
- package/es/LinkBlock/LinkBlockSection.js.map +1 -0
- package/es/Pitch/Pitch.js +62 -0
- package/es/Pitch/Pitch.js.map +1 -0
- package/es/RelatedArticleList/RelatedArticleList.js +97 -0
- package/es/RelatedArticleList/RelatedArticleList.js.map +1 -0
- package/es/RelatedArticleList/index.js +8 -0
- package/es/RelatedArticleList/index.js.map +1 -0
- package/es/ResourceBox/ResourceBox.js +74 -0
- package/es/ResourceBox/ResourceBox.js.map +1 -0
- package/es/TagSelector/TagSelector.js +100 -0
- package/es/TagSelector/TagSelector.js.map +1 -0
- package/es/ZendeskButton/ZendeskButton.js +41 -0
- package/es/ZendeskButton/ZendeskButton.js.map +1 -0
- package/es/_virtual/rolldown_runtime.js +11 -0
- package/es/i18n/formatNestedMessages.js +17 -0
- package/es/i18n/formatNestedMessages.js.map +1 -0
- package/es/i18n/i18n.js +29 -0
- package/es/i18n/i18n.js.map +1 -0
- package/es/i18n/useComponentTranslations.js +155 -0
- package/es/i18n/useComponentTranslations.js.map +1 -0
- package/es/index.js +65 -0
- package/es/locale/messages-en.js +438 -0
- package/es/locale/messages-en.js.map +1 -0
- package/es/locale/messages-nb.js +438 -0
- package/es/locale/messages-nb.js.map +1 -0
- package/es/locale/messages-nn.js +438 -0
- package/es/locale/messages-nn.js.map +1 -0
- package/es/locale/messages-se.js +438 -0
- package/es/locale/messages-se.js.map +1 -0
- package/es/model/ContentType.js +72 -0
- package/es/model/ContentType.js.map +1 -0
- package/es/model/SubjectCategories.js +25 -0
- package/es/model/SubjectCategories.js.map +1 -0
- package/es/model/SubjectTypes.js +23 -0
- package/es/model/SubjectTypes.js.map +1 -0
- package/es/model/WordClass.js +53 -0
- package/es/model/WordClass.js.map +1 -0
- package/es/model/index.js +19 -0
- package/es/model/index.js.map +1 -0
- package/es/utils/licenseAttributes.js +16 -0
- package/es/utils/licenseAttributes.js.map +1 -0
- package/es/utils/relativeUrl.js +26 -0
- package/es/utils/relativeUrl.js.map +1 -0
- package/lib/Article/Article.js +134 -0
- package/lib/Article/Article.js.map +1 -0
- package/lib/Article/ArticleByline.js +135 -0
- package/lib/Article/ArticleByline.js.map +1 -0
- package/lib/Article/ArticleFootNotes.js +41 -0
- package/lib/Article/ArticleFootNotes.js.map +1 -0
- package/lib/AudioPlayer/AudioPlayer.js +158 -0
- package/lib/AudioPlayer/AudioPlayer.js.map +1 -0
- package/lib/AudioPlayer/Controls.js +255 -0
- package/lib/AudioPlayer/Controls.js.map +1 -0
- package/lib/AudioPlayer/SpeechControl.js +41 -0
- package/lib/AudioPlayer/SpeechControl.js.map +1 -0
- package/lib/AudioPlayer/index.js +8 -0
- package/lib/AudioPlayer/index.js.map +1 -0
- package/lib/Breadcrumb/Breadcrumb.js +45 -0
- package/lib/Breadcrumb/Breadcrumb.js.map +1 -0
- package/lib/Breadcrumb/BreadcrumbItem.js +37 -0
- package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -0
- package/lib/Breadcrumb/HomeBreadcrumb.js +45 -0
- package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -0
- package/lib/Breadcrumb/index.js +9 -0
- package/lib/Breadcrumb/index.js.map +1 -0
- package/lib/CampaignBlock/CampaignBlock.js +132 -0
- package/lib/CampaignBlock/CampaignBlock.js.map +1 -0
- package/lib/CodeBlock/CodeBlock.js +26 -0
- package/lib/CodeBlock/CodeBlock.js.map +1 -0
- package/lib/CodeBlock/codeLanguageOptions.js +115 -0
- package/lib/CodeBlock/codeLanguageOptions.js.map +1 -0
- package/lib/Concept/Concept.js +51 -0
- package/lib/Concept/Concept.js.map +1 -0
- package/lib/ContactBlock/ContactBlock.js +147 -0
- package/lib/ContactBlock/ContactBlock.js.map +1 -0
- package/lib/ContentTypeBadge/ContentTypeBadge.js +43 -0
- package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +26 -0
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +26 -0
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
- package/lib/ContentTypeHero/ContentTypeHero.js +40 -0
- package/lib/ContentTypeHero/ContentTypeHero.js.map +1 -0
- package/lib/CopyParagraphButton/CopyParagraphButton.js +63 -0
- package/lib/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
- package/lib/CopyParagraphButton/index.js +8 -0
- package/lib/CopyParagraphButton/index.js.map +1 -0
- package/lib/Embed/AudioEmbed.js +53 -0
- package/lib/Embed/AudioEmbed.js.map +1 -0
- package/lib/Embed/BrightcoveEmbed.js +97 -0
- package/lib/Embed/BrightcoveEmbed.js.map +1 -0
- package/lib/Embed/CodeEmbed.js +62 -0
- package/lib/Embed/CodeEmbed.js.map +1 -0
- package/lib/Embed/ConceptEmbed.js +81 -0
- package/lib/Embed/ConceptEmbed.js.map +1 -0
- package/lib/Embed/ConceptInlineTriggerButton.js +41 -0
- package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -0
- package/lib/Embed/ContentLinkEmbed.js +32 -0
- package/lib/Embed/ContentLinkEmbed.js.map +1 -0
- package/lib/Embed/CopyrightEmbed.js +24 -0
- package/lib/Embed/CopyrightEmbed.js.map +1 -0
- package/lib/Embed/EmbedErrorPlaceholder.js +44 -0
- package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -0
- package/lib/Embed/EmbedWrapper.js +27 -0
- package/lib/Embed/EmbedWrapper.js.map +1 -0
- package/lib/Embed/ExternalEmbed.js +55 -0
- package/lib/Embed/ExternalEmbed.js.map +1 -0
- package/lib/Embed/FootnoteEmbed.js +28 -0
- package/lib/Embed/FootnoteEmbed.js.map +1 -0
- package/lib/Embed/GlossEmbed.js +53 -0
- package/lib/Embed/GlossEmbed.js.map +1 -0
- package/lib/Embed/H5pEmbed.js +39 -0
- package/lib/Embed/H5pEmbed.js.map +1 -0
- package/lib/Embed/IframeEmbed.js +70 -0
- package/lib/Embed/IframeEmbed.js.map +1 -0
- package/lib/Embed/ImageEmbed.js +183 -0
- package/lib/Embed/ImageEmbed.js.map +1 -0
- package/lib/Embed/InlineTriggerButton.js +26 -0
- package/lib/Embed/InlineTriggerButton.js.map +1 -0
- package/lib/Embed/RelatedContentEmbed.js +39 -0
- package/lib/Embed/RelatedContentEmbed.js.map +1 -0
- package/lib/Embed/UnknownEmbed.js +21 -0
- package/lib/Embed/UnknownEmbed.js.map +1 -0
- package/lib/Embed/UuDisclaimerEmbed.js +55 -0
- package/lib/Embed/UuDisclaimerEmbed.js.map +1 -0
- package/lib/ErrorMessage/ErrorMessage.js +55 -0
- package/lib/ErrorMessage/ErrorMessage.js.map +1 -0
- package/lib/ErrorMessage/index.js +8 -0
- package/lib/ErrorMessage/index.js.map +1 -0
- package/lib/FactBox/FactBox.js +122 -0
- package/lib/FactBox/FactBox.js.map +1 -0
- package/lib/FactBox/index.js +8 -0
- package/lib/FactBox/index.js.map +1 -0
- package/lib/FileList/File.js +78 -0
- package/lib/FileList/File.js.map +1 -0
- package/lib/FileList/FileList.js +35 -0
- package/lib/FileList/FileList.js.map +1 -0
- package/lib/FileList/PdfFile.js +29 -0
- package/lib/FileList/PdfFile.js.map +1 -0
- package/lib/Gloss/Gloss.js +143 -0
- package/lib/Gloss/Gloss.js.map +1 -0
- package/lib/Gloss/GlossExample.js +47 -0
- package/lib/Gloss/GlossExample.js.map +1 -0
- package/lib/Grid/Grid.js +67 -0
- package/lib/Grid/Grid.js.map +1 -0
- package/lib/Grid/GridParallaxItem.js +22 -0
- package/lib/Grid/GridParallaxItem.js.map +1 -0
- package/lib/KeyFigure/KeyFigure.js +47 -0
- package/lib/KeyFigure/KeyFigure.js.map +1 -0
- package/lib/LicenseByline/EmbedByline.js +134 -0
- package/lib/LicenseByline/EmbedByline.js.map +1 -0
- package/lib/LicenseByline/LicenseLink.js +32 -0
- package/lib/LicenseByline/LicenseLink.js.map +1 -0
- package/lib/LinkBlock/LinkBlock.js +75 -0
- package/lib/LinkBlock/LinkBlock.js.map +1 -0
- package/lib/LinkBlock/LinkBlockSection.js +24 -0
- package/lib/LinkBlock/LinkBlockSection.js.map +1 -0
- package/lib/Pitch/Pitch.js +63 -0
- package/lib/Pitch/Pitch.js.map +1 -0
- package/lib/RelatedArticleList/RelatedArticleList.js +99 -0
- package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -0
- package/lib/RelatedArticleList/index.js +8 -0
- package/lib/RelatedArticleList/index.js.map +1 -0
- package/lib/ResourceBox/ResourceBox.js +75 -0
- package/lib/ResourceBox/ResourceBox.js.map +1 -0
- package/lib/TagSelector/TagSelector.js +108 -0
- package/lib/TagSelector/TagSelector.js.map +1 -0
- package/lib/ZendeskButton/ZendeskButton.js +42 -0
- package/lib/ZendeskButton/ZendeskButton.js.map +1 -0
- package/lib/_virtual/rolldown_runtime.js +42 -0
- package/lib/i18n/formatNestedMessages.js +18 -0
- package/lib/i18n/formatNestedMessages.js.map +1 -0
- package/lib/i18n/i18n.js +31 -0
- package/lib/i18n/i18n.js.map +1 -0
- package/lib/i18n/useComponentTranslations.js +163 -0
- package/lib/i18n/useComponentTranslations.js.map +1 -0
- package/lib/index.js +157 -0
- package/lib/locale/messages-en.js +439 -0
- package/lib/locale/messages-en.js.map +1 -0
- package/lib/locale/messages-nb.js +439 -0
- package/lib/locale/messages-nb.js.map +1 -0
- package/lib/locale/messages-nn.js +439 -0
- package/lib/locale/messages-nn.js.map +1 -0
- package/lib/locale/messages-se.js +439 -0
- package/lib/locale/messages-se.js.map +1 -0
- package/lib/model/ContentType.js +94 -0
- package/lib/model/ContentType.js.map +1 -0
- package/lib/model/SubjectCategories.js +30 -0
- package/lib/model/SubjectCategories.js.map +1 -0
- package/lib/model/SubjectTypes.js +28 -0
- package/lib/model/SubjectTypes.js.map +1 -0
- package/lib/model/WordClass.js +58 -0
- package/lib/model/WordClass.js.map +1 -0
- package/lib/model/index.js +19 -0
- package/lib/model/index.js.map +1 -0
- package/lib/utils/licenseAttributes.js +17 -0
- package/lib/utils/licenseAttributes.js.map +1 -0
- package/lib/utils/relativeUrl.js +26 -0
- package/lib/utils/relativeUrl.js.map +1 -0
- package/package.json +12 -11
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_Breadcrumb = require('./Breadcrumb.js');
|
|
3
|
+
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
4
|
+
const __ndla_icons = require_rolldown_runtime.__toESM(require("@ndla/icons"));
|
|
5
|
+
const __ndla_safelink = require_rolldown_runtime.__toESM(require("@ndla/safelink"));
|
|
6
|
+
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
|
|
7
|
+
|
|
8
|
+
//#region src/Breadcrumb/HomeBreadcrumb.tsx
|
|
9
|
+
const StyledSafeLink = (0, __ndla_styled_system_jsx.styled)(__ndla_safelink.SafeLink, { base: {
|
|
10
|
+
color: "inherit",
|
|
11
|
+
textDecoration: "underline",
|
|
12
|
+
_hover: { textDecoration: "none" },
|
|
13
|
+
_focusVisible: { textDecoration: "none" }
|
|
14
|
+
} });
|
|
15
|
+
const StyledArrowRight = (0, __ndla_styled_system_jsx.styled)(__ndla_icons.ArrowRightShortLine, { base: { tabletDown: { display: "none" } } });
|
|
16
|
+
const IconSafeLink = (0, __ndla_styled_system_jsx.styled)(__ndla_safelink.SafeLink, { base: { color: "inherit" } });
|
|
17
|
+
const HomeBreadcrumb = ({ items }) => {
|
|
18
|
+
const renderItem = (item, totalCount) => {
|
|
19
|
+
if (item.index === totalCount - 1) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.name });
|
|
20
|
+
if (item.index === 0 && typeof item.name === "string") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconSafeLink, {
|
|
21
|
+
"aria-label": item.name,
|
|
22
|
+
to: item.to,
|
|
23
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_icons.HomeLine, { title: item.name })
|
|
24
|
+
});
|
|
25
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledSafeLink, {
|
|
26
|
+
to: item.to,
|
|
27
|
+
children: item.name
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const renderSeparator = (item, totalCount) => {
|
|
31
|
+
if (item.index === totalCount - 1) return null;
|
|
32
|
+
if (item.index === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledArrowRight, {});
|
|
33
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_icons.ArrowRightShortLine, {});
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Breadcrumb.Breadcrumb_default, {
|
|
36
|
+
items,
|
|
37
|
+
renderItem,
|
|
38
|
+
renderSeparator
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
var HomeBreadcrumb_default = HomeBreadcrumb;
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
exports.HomeBreadcrumb_default = HomeBreadcrumb_default;
|
|
45
|
+
//# sourceMappingURL=HomeBreadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HomeBreadcrumb.js","names":["SafeLink","ArrowRightShortLine","item: IndexedBreadcrumbItem","totalCount: number","HomeLine","Breadcrumb"],"sources":["../../src/Breadcrumb/HomeBreadcrumb.tsx"],"sourcesContent":["/**\n * Copyright (c) 2022-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 { ArrowRightShortLine, HomeLine } from \"@ndla/icons\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport Breadcrumb from \"./Breadcrumb\";\nimport type { IndexedBreadcrumbItem, SimpleBreadcrumbItem } from \"./BreadcrumbItem\";\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n color: \"inherit\",\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n _focusVisible: {\n textDecoration: \"none\",\n },\n },\n});\n\nconst StyledArrowRight = styled(ArrowRightShortLine, {\n base: {\n tabletDown: {\n display: \"none\",\n },\n },\n});\n\nconst IconSafeLink = styled(SafeLink, {\n base: {\n color: \"inherit\",\n },\n});\n\ninterface Props {\n items: SimpleBreadcrumbItem[];\n}\n\nconst HomeBreadcrumb = ({ items }: Props) => {\n const renderItem = (item: IndexedBreadcrumbItem, totalCount: number) => {\n if (item.index === totalCount - 1) {\n return <span>{item.name}</span>;\n }\n if (item.index === 0 && typeof item.name === \"string\") {\n return (\n <IconSafeLink aria-label={item.name} to={item.to}>\n <HomeLine title={item.name} />\n </IconSafeLink>\n );\n }\n return <StyledSafeLink to={item.to}>{item.name}</StyledSafeLink>;\n };\n\n const renderSeparator = (item: IndexedBreadcrumbItem, totalCount: number) => {\n if (item.index === totalCount - 1) {\n return null;\n }\n if (item.index === 0) {\n return <StyledArrowRight />;\n }\n return <ArrowRightShortLine />;\n };\n\n return <Breadcrumb items={items} renderItem={renderItem} renderSeparator={renderSeparator} />;\n};\n\nexport default HomeBreadcrumb;\n"],"mappings":";;;;;;;;AAcA,MAAM,iBAAiB,qCAAOA,0BAAU,EACtC,MAAM;CACJ,OAAO;CACP,gBAAgB;CAChB,QAAQ,EACN,gBAAgB,OACjB;CACD,eAAe,EACb,gBAAgB,OACjB;AACF,EACF,EAAC;AAEF,MAAM,mBAAmB,qCAAOC,kCAAqB,EACnD,MAAM,EACJ,YAAY,EACV,SAAS,OACV,EACF,EACF,EAAC;AAEF,MAAM,eAAe,qCAAOD,0BAAU,EACpC,MAAM,EACJ,OAAO,UACR,EACF,EAAC;AAMF,MAAM,iBAAiB,CAAC,EAAE,OAAc,KAAK;CAC3C,MAAM,aAAa,CAACE,MAA6BC,eAAuB;AACtE,MAAI,KAAK,UAAU,aAAa,EAC9B,wBAAO,2BAAC,oBAAM,KAAK,OAAY;AAEjC,MAAI,KAAK,UAAU,YAAY,KAAK,SAAS,SAC3C,wBACE,2BAAC;GAAa,cAAY,KAAK;GAAM,IAAI,KAAK;6BAC5C,2BAACC,yBAAS,OAAO,KAAK,OAAQ;IACjB;AAGnB,yBAAO,2BAAC;GAAe,IAAI,KAAK;aAAK,KAAK;IAAsB;CACjE;CAED,MAAM,kBAAkB,CAACF,MAA6BC,eAAuB;AAC3E,MAAI,KAAK,UAAU,aAAa,EAC9B,QAAO;AAET,MAAI,KAAK,UAAU,EACjB,wBAAO,2BAAC,qBAAmB;AAE7B,yBAAO,2BAACF,qCAAsB;CAC/B;AAED,wBAAO,2BAACI;EAAkB;EAAmB;EAA6B;GAAmB;AAC9F;AAED,6BAAe"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const require_Breadcrumb = require('./Breadcrumb.js');
|
|
2
|
+
const require_HomeBreadcrumb = require('./HomeBreadcrumb.js');
|
|
3
|
+
|
|
4
|
+
//#region src/Breadcrumb/index.ts
|
|
5
|
+
var Breadcrumb_default$1 = require_Breadcrumb.Breadcrumb_default;
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
exports.Breadcrumb_default = Breadcrumb_default$1;
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["Breadcrumb"],"sources":["../../src/Breadcrumb/index.ts"],"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 Breadcrumb from \"./Breadcrumb\";\n\nexport type { SimpleBreadcrumbItem, IndexedBreadcrumbItem } from \"./BreadcrumbItem\";\n\nexport { default as HomeBreadcrumb } from \"./HomeBreadcrumb\";\n\nexport default Breadcrumb;\n"],"mappings":";;;;AAcA,2BAAeA"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_relativeUrl = require('../utils/relativeUrl.js');
|
|
3
|
+
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
4
|
+
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
5
|
+
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
6
|
+
const html_react_parser = require_rolldown_runtime.__toESM(require("html-react-parser"));
|
|
7
|
+
const __ndla_icons = require_rolldown_runtime.__toESM(require("@ndla/icons"));
|
|
8
|
+
const __ndla_safelink = require_rolldown_runtime.__toESM(require("@ndla/safelink"));
|
|
9
|
+
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
|
|
10
|
+
|
|
11
|
+
//#region src/CampaignBlock/CampaignBlock.tsx
|
|
12
|
+
const Wrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
13
|
+
width: "100%",
|
|
14
|
+
height: "100%",
|
|
15
|
+
containerType: "inline-size"
|
|
16
|
+
} });
|
|
17
|
+
const Container = (0, __ndla_styled_system_jsx.styled)("div", {
|
|
18
|
+
base: {
|
|
19
|
+
display: "grid",
|
|
20
|
+
gridTemplateColumns: "1fr",
|
|
21
|
+
border: "1px solid",
|
|
22
|
+
borderColor: "stroke.default",
|
|
23
|
+
backgroundColor: "background.default",
|
|
24
|
+
borderRadius: "xsmall",
|
|
25
|
+
boxShadow: "full",
|
|
26
|
+
overflow: "hidden"
|
|
27
|
+
},
|
|
28
|
+
variants: {
|
|
29
|
+
imageSide: {
|
|
30
|
+
left: {
|
|
31
|
+
"@/tablet": { gridTemplateColumns: "minmax(230px, 455px) auto" },
|
|
32
|
+
"@supports not (container-type: inline-size)": { tabletWide: { gridTemplateColumns: "minmax(230px, 455px) auto" } }
|
|
33
|
+
},
|
|
34
|
+
right: {
|
|
35
|
+
"@/tablet": { gridTemplateColumns: "auto minmax(230px, 455px)" },
|
|
36
|
+
"@supports not (container-type: inline-size)": { tabletWide: { gridTemplateColumns: "auto minmax(230px, 455px)" } }
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
background: {
|
|
40
|
+
neutral: {},
|
|
41
|
+
brand1: { backgroundColor: "surface.brand.1" },
|
|
42
|
+
brand3: { backgroundColor: "surface.brand.3" }
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
imageSide: "left",
|
|
47
|
+
background: "neutral"
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const StyledImg = (0, __ndla_styled_system_jsx.styled)("img", { base: {
|
|
51
|
+
objectFit: "cover",
|
|
52
|
+
width: "100%",
|
|
53
|
+
height: "215px",
|
|
54
|
+
"@/tablet": { height: "340px" },
|
|
55
|
+
"@supports not (container-type: inline-size)": {
|
|
56
|
+
tablet: { height: "265px" },
|
|
57
|
+
tabletWide: { height: "340px" }
|
|
58
|
+
},
|
|
59
|
+
backgroundColor: "background.default"
|
|
60
|
+
} });
|
|
61
|
+
const ContentWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
62
|
+
width: "100%",
|
|
63
|
+
display: "flex",
|
|
64
|
+
flexDirection: "column",
|
|
65
|
+
gap: "medium",
|
|
66
|
+
alignItems: "flex-start",
|
|
67
|
+
justifyContent: "center",
|
|
68
|
+
paddingBlock: "medium",
|
|
69
|
+
paddingInline: "medium",
|
|
70
|
+
position: "relative"
|
|
71
|
+
} });
|
|
72
|
+
const StyledText = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Text, { base: { tablet: {
|
|
73
|
+
display: "block",
|
|
74
|
+
overflow: "hidden",
|
|
75
|
+
position: "relative",
|
|
76
|
+
lineClamp: 4,
|
|
77
|
+
boxOrient: "vertical"
|
|
78
|
+
} } });
|
|
79
|
+
const StyledSafeLinkButton = (0, __ndla_styled_system_jsx.styled)(__ndla_safelink.SafeLinkButton, { base: {
|
|
80
|
+
boxShadow: "full",
|
|
81
|
+
border: "1px solid",
|
|
82
|
+
borderColor: "stroke.default"
|
|
83
|
+
} });
|
|
84
|
+
const LinkButton = ({ url, children, path }) => {
|
|
85
|
+
if (url) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledSafeLinkButton, {
|
|
86
|
+
to: require_relativeUrl.getPossiblyRelativeUrl(url, path),
|
|
87
|
+
variant: "secondary",
|
|
88
|
+
rel: "noopener noreferrer",
|
|
89
|
+
children
|
|
90
|
+
});
|
|
91
|
+
return children;
|
|
92
|
+
};
|
|
93
|
+
const CampaignBlock = ({ title, image, imageSide = "left", description, headingLevel: InternalHeading = "h2", url, path, className, background }) => {
|
|
94
|
+
const imageComponent = image && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledImg, {
|
|
95
|
+
src: `${image.src}?width=455`,
|
|
96
|
+
height: 340,
|
|
97
|
+
width: 455,
|
|
98
|
+
alt: image.alt
|
|
99
|
+
});
|
|
100
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Wrapper, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Container, {
|
|
101
|
+
className,
|
|
102
|
+
"data-embed-type": "campaign-block",
|
|
103
|
+
imageSide,
|
|
104
|
+
background,
|
|
105
|
+
children: [
|
|
106
|
+
imageSide === "left" && imageComponent,
|
|
107
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ContentWrapper, { children: [
|
|
108
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
|
|
109
|
+
asChild: true,
|
|
110
|
+
consumeCss: true,
|
|
111
|
+
textStyle: "heading.small",
|
|
112
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalHeading, { children: (0, html_react_parser.default)(title) })
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledText, {
|
|
115
|
+
textStyle: "body.xlarge",
|
|
116
|
+
children: (0, html_react_parser.default)(description)
|
|
117
|
+
}),
|
|
118
|
+
!!url?.url && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(LinkButton, {
|
|
119
|
+
url: url.url,
|
|
120
|
+
path,
|
|
121
|
+
children: [(0, html_react_parser.default)(url.text ?? ""), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_icons.ArrowRightLine, {})]
|
|
122
|
+
})
|
|
123
|
+
] }),
|
|
124
|
+
imageSide !== "left" && imageComponent
|
|
125
|
+
]
|
|
126
|
+
}) });
|
|
127
|
+
};
|
|
128
|
+
var CampaignBlock_default = CampaignBlock;
|
|
129
|
+
|
|
130
|
+
//#endregion
|
|
131
|
+
exports.CampaignBlock_default = CampaignBlock_default;
|
|
132
|
+
//# sourceMappingURL=CampaignBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CampaignBlock.js","names":["Text","SafeLinkButton","ArrowRightLine"],"sources":["../../src/CampaignBlock/CampaignBlock.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-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 parse from \"html-react-parser\";\nimport { type ReactNode } from \"react\";\nimport { ArrowRightLine } from \"@ndla/icons\";\nimport { Text } from \"@ndla/primitives\";\nimport { SafeLinkButton } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CampaignBlockEmbedData } from \"@ndla/types-embed\";\nimport type { HeadingLevel } from \"../types\";\nimport { getPossiblyRelativeUrl } from \"../utils/relativeUrl\";\n\ninterface Image {\n src: string;\n alt: string;\n}\n\ninterface Props {\n title: string;\n description: string;\n headingLevel?: HeadingLevel;\n url: {\n url?: string;\n text?: string;\n };\n image?: Image;\n imageSide?: CampaignBlockEmbedData[\"imageSide\"];\n className?: string;\n path?: string;\n background?: CampaignBlockEmbedData[\"background\"];\n}\n\nconst Wrapper = styled(\"div\", {\n base: {\n width: \"100%\",\n height: \"100%\",\n containerType: \"inline-size\",\n },\n});\n\nconst Container = styled(\"div\", {\n base: {\n display: \"grid\",\n gridTemplateColumns: \"1fr\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n backgroundColor: \"background.default\",\n borderRadius: \"xsmall\",\n boxShadow: \"full\",\n overflow: \"hidden\",\n },\n variants: {\n imageSide: {\n left: {\n \"@/tablet\": {\n gridTemplateColumns: \"minmax(230px, 455px) auto\", //required for campaign block in myNdla\n },\n \"@supports not (container-type: inline-size)\": {\n tabletWide: {\n gridTemplateColumns: \"minmax(230px, 455px) auto\",\n },\n },\n },\n right: {\n \"@/tablet\": {\n gridTemplateColumns: \"auto minmax(230px, 455px)\", //required for campaign block in myNdla\n },\n \"@supports not (container-type: inline-size)\": {\n tabletWide: {\n gridTemplateColumns: \"auto minmax(230px, 455px)\",\n },\n },\n },\n },\n background: {\n neutral: {},\n brand1: {\n backgroundColor: \"surface.brand.1\",\n },\n brand3: {\n backgroundColor: \"surface.brand.3\",\n },\n },\n },\n defaultVariants: {\n imageSide: \"left\",\n background: \"neutral\",\n },\n});\n\nconst StyledImg = styled(\"img\", {\n base: {\n objectFit: \"cover\",\n width: \"100%\",\n height: \"215px\",\n \"@/tablet\": {\n height: \"340px\",\n },\n \"@supports not (container-type: inline-size)\": {\n tablet: {\n height: \"265px\",\n },\n tabletWide: {\n height: \"340px\",\n },\n },\n backgroundColor: \"background.default\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n alignItems: \"flex-start\",\n justifyContent: \"center\",\n paddingBlock: \"medium\",\n paddingInline: \"medium\",\n position: \"relative\",\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n tablet: {\n display: \"block\",\n overflow: \"hidden\",\n position: \"relative\",\n lineClamp: 4,\n boxOrient: \"vertical\",\n },\n },\n});\n\ninterface LinkButtonProps {\n url?: string;\n path?: string;\n children: ReactNode;\n}\n\nconst StyledSafeLinkButton = styled(SafeLinkButton, {\n base: {\n boxShadow: \"full\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n },\n});\n\nconst LinkButton = ({ url, children, path }: LinkButtonProps) => {\n if (url)\n return (\n <StyledSafeLinkButton to={getPossiblyRelativeUrl(url, path)} variant=\"secondary\" rel=\"noopener noreferrer\">\n {children}\n </StyledSafeLinkButton>\n );\n return children;\n};\n\nconst CampaignBlock = ({\n title,\n image,\n imageSide = \"left\",\n description,\n headingLevel: InternalHeading = \"h2\",\n url,\n path,\n className,\n background,\n}: Props) => {\n const imageComponent = image && <StyledImg src={`${image.src}?width=455`} height={340} width={455} alt={image.alt} />;\n\n return (\n <Wrapper>\n <Container className={className} data-embed-type=\"campaign-block\" imageSide={imageSide} background={background}>\n {imageSide === \"left\" && imageComponent}\n <ContentWrapper>\n <Text asChild consumeCss textStyle=\"heading.small\">\n <InternalHeading>{parse(title)}</InternalHeading>\n </Text>\n <StyledText textStyle=\"body.xlarge\">{parse(description)}</StyledText>\n {!!url?.url && (\n <LinkButton url={url.url} path={path}>\n {parse(url.text ?? \"\")}\n <ArrowRightLine />\n </LinkButton>\n )}\n </ContentWrapper>\n {imageSide !== \"left\" && imageComponent}\n </Container>\n </Wrapper>\n );\n};\n\nexport default CampaignBlock;\n"],"mappings":";;;;;;;;;;;AAsCA,MAAM,UAAU,qCAAO,OAAO,EAC5B,MAAM;CACJ,OAAO;CACP,QAAQ;CACR,eAAe;AAChB,EACF,EAAC;AAEF,MAAM,YAAY,qCAAO,OAAO;CAC9B,MAAM;EACJ,SAAS;EACT,qBAAqB;EACrB,QAAQ;EACR,aAAa;EACb,iBAAiB;EACjB,cAAc;EACd,WAAW;EACX,UAAU;CACX;CACD,UAAU;EACR,WAAW;GACT,MAAM;IACJ,YAAY,EACV,qBAAqB,4BACtB;IACD,+CAA+C,EAC7C,YAAY,EACV,qBAAqB,4BACtB,EACF;GACF;GACD,OAAO;IACL,YAAY,EACV,qBAAqB,4BACtB;IACD,+CAA+C,EAC7C,YAAY,EACV,qBAAqB,4BACtB,EACF;GACF;EACF;EACD,YAAY;GACV,SAAS,CAAE;GACX,QAAQ,EACN,iBAAiB,kBAClB;GACD,QAAQ,EACN,iBAAiB,kBAClB;EACF;CACF;CACD,iBAAiB;EACf,WAAW;EACX,YAAY;CACb;AACF,EAAC;AAEF,MAAM,YAAY,qCAAO,OAAO,EAC9B,MAAM;CACJ,WAAW;CACX,OAAO;CACP,QAAQ;CACR,YAAY,EACV,QAAQ,QACT;CACD,+CAA+C;EAC7C,QAAQ,EACN,QAAQ,QACT;EACD,YAAY,EACV,QAAQ,QACT;CACF;CACD,iBAAiB;AAClB,EACF,EAAC;AAEF,MAAM,iBAAiB,qCAAO,OAAO,EACnC,MAAM;CACJ,OAAO;CACP,SAAS;CACT,eAAe;CACf,KAAK;CACL,YAAY;CACZ,gBAAgB;CAChB,cAAc;CACd,eAAe;CACf,UAAU;AACX,EACF,EAAC;AAEF,MAAM,aAAa,qCAAOA,wBAAM,EAC9B,MAAM,EACJ,QAAQ;CACN,SAAS;CACT,UAAU;CACV,UAAU;CACV,WAAW;CACX,WAAW;AACZ,EACF,EACF,EAAC;AAQF,MAAM,uBAAuB,qCAAOC,gCAAgB,EAClD,MAAM;CACJ,WAAW;CACX,QAAQ;CACR,aAAa;AACd,EACF,EAAC;AAEF,MAAM,aAAa,CAAC,EAAE,KAAK,UAAU,MAAuB,KAAK;AAC/D,KAAI,IACF,wBACE,2BAAC;EAAqB,IAAI,2CAAuB,KAAK,KAAK;EAAE,SAAQ;EAAY,KAAI;EAClF;GACoB;AAE3B,QAAO;AACR;AAED,MAAM,gBAAgB,CAAC,EACrB,OACA,OACA,YAAY,QACZ,aACA,cAAc,kBAAkB,MAChC,KACA,MACA,WACA,YACM,KAAK;CACX,MAAM,iBAAiB,yBAAS,2BAAC;EAAU,MAAM,EAAE,MAAM,IAAI;EAAa,QAAQ;EAAK,OAAO;EAAK,KAAK,MAAM;GAAO;AAErH,wBACE,2BAAC,qCACC,4BAAC;EAAqB;EAAW,mBAAgB;EAA4B;EAAuB;;GACjG,cAAc,UAAU;mBACzB,4BAAC;oBACC,2BAACD;KAAK;KAAQ;KAAW,WAAU;+BACjC,2BAAC,6BAAiB,+BAAM,MAAM,GAAmB;MAC5C;oBACP,2BAAC;KAAW,WAAU;eAAe,+BAAM,YAAY;MAAc;MAClE,KAAK,uBACN,4BAAC;KAAW,KAAK,IAAI;KAAW;gBAC7B,+BAAM,IAAI,QAAQ,GAAG,kBACtB,2BAACE,gCAAiB;MACP;OAEA;GAChB,cAAc,UAAU;;GACf,GACJ;AAEb;AAED,4BAAe"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
3
|
+
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
4
|
+
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
|
|
5
|
+
const __ndla_styled_system_css = require_rolldown_runtime.__toESM(require("@ndla/styled-system/css"));
|
|
6
|
+
|
|
7
|
+
//#region src/CodeBlock/CodeBlock.tsx
|
|
8
|
+
const Pre = (0, __ndla_styled_system_jsx.styled)("pre", {});
|
|
9
|
+
const Codeblock = (0, react.forwardRef)(({ highlightedCode, format, className,...props }, ref) => {
|
|
10
|
+
const codeWithLineNumbers = (0, react.useMemo)(() => {
|
|
11
|
+
return highlightedCode.split("\n").map((line, i) => {
|
|
12
|
+
return `<span class="linenumber">${i + 1}</span>${line}`;
|
|
13
|
+
}).join("\n");
|
|
14
|
+
}, [highlightedCode]);
|
|
15
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Pre, {
|
|
16
|
+
className: (0, __ndla_styled_system_css.cx)("codeblock", `language-${format}`, className),
|
|
17
|
+
...props,
|
|
18
|
+
dangerouslySetInnerHTML: { __html: codeWithLineNumbers },
|
|
19
|
+
ref
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
var CodeBlock_default = Codeblock;
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.CodeBlock_default = CodeBlock_default;
|
|
26
|
+
//# sourceMappingURL=CodeBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeBlock.js","names":[],"sources":["../../src/CodeBlock/CodeBlock.tsx"],"sourcesContent":["/**\n * Copyright (c) 2020-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, forwardRef, useMemo } from \"react\";\nimport { cx } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { JsxStyleProps } from \"@ndla/styled-system/types\";\n\ninterface Props extends JsxStyleProps, ComponentPropsWithRef<\"pre\"> {\n highlightedCode: string;\n format: string;\n}\n\nconst Pre = styled(\"pre\", {});\n\nexport const Codeblock = forwardRef<HTMLPreElement, Props>(({ highlightedCode, format, className, ...props }, ref) => {\n const codeWithLineNumbers = useMemo(() => {\n return highlightedCode\n .split(\"\\n\")\n .map((line, i) => {\n return `<span class=\"linenumber\">${i + 1}</span>${line}`;\n })\n .join(\"\\n\");\n }, [highlightedCode]);\n\n return (\n <Pre\n className={cx(\"codeblock\", `language-${format}`, className)}\n {...props}\n dangerouslySetInnerHTML={{ __html: codeWithLineNumbers }}\n ref={ref}\n />\n );\n});\n\nexport default Codeblock;\n"],"mappings":";;;;;;;AAkBA,MAAM,MAAM,qCAAO,OAAO,CAAE,EAAC;AAE7B,MAAa,YAAY,sBAAkC,CAAC,EAAE,iBAAiB,QAAQ,UAAW,GAAG,OAAO,EAAE,QAAQ;CACpH,MAAM,sBAAsB,mBAAQ,MAAM;AACxC,SAAO,gBACJ,MAAM,KAAK,CACX,IAAI,CAAC,MAAM,MAAM;AAChB,WAAQ,2BAA2B,IAAI,EAAE,SAAS,KAAK;EACxD,EAAC,CACD,KAAK,KAAK;CACd,GAAE,CAAC,eAAgB,EAAC;AAErB,wBACE,2BAAC;EACC,WAAW,iCAAG,cAAc,WAAW,OAAO,GAAG,UAAU;EAC3D,GAAI;EACJ,yBAAyB,EAAE,QAAQ,oBAAqB;EACnD;GACL;AAEL,EAAC;AAEF,wBAAe"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/CodeBlock/codeLanguageOptions.ts
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) 2019-present, NDLA.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
const codeLanguageOptions = [
|
|
11
|
+
{
|
|
12
|
+
title: "Bash",
|
|
13
|
+
format: "bash"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
title: "C",
|
|
17
|
+
format: "c"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
title: "CSharp",
|
|
21
|
+
format: "csharp"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: "CSS",
|
|
25
|
+
format: "css"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
title: "Diff",
|
|
29
|
+
format: "diff"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
title: "HTML",
|
|
33
|
+
format: "markup"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: "Ini",
|
|
37
|
+
format: "ini"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: "Java",
|
|
41
|
+
format: "java"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
title: "Javascript",
|
|
45
|
+
format: "js"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: "JSON",
|
|
49
|
+
format: "json"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
title: "JSX",
|
|
53
|
+
format: "jsx"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
title: "Kotlin",
|
|
57
|
+
format: "kotlin"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
title: "LUA",
|
|
61
|
+
format: "lua"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
title: "Markdown",
|
|
65
|
+
format: "markdown"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: "Matlab",
|
|
69
|
+
format: "matlab"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: "NSIS",
|
|
73
|
+
format: "nsis"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
title: "PHP",
|
|
77
|
+
format: "php"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
title: "Powershell",
|
|
81
|
+
format: "powershell"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
title: "Python",
|
|
85
|
+
format: "python"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
title: "Ruby",
|
|
89
|
+
format: "ruby"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
title: "Rust",
|
|
93
|
+
format: "rust"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
title: "SQL",
|
|
97
|
+
format: "sql"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
title: "Text",
|
|
101
|
+
format: "text"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
title: "VHDL",
|
|
105
|
+
format: "vhdl"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
title: "XML",
|
|
109
|
+
format: "xml"
|
|
110
|
+
}
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
exports.codeLanguageOptions = codeLanguageOptions;
|
|
115
|
+
//# sourceMappingURL=codeLanguageOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeLanguageOptions.js","names":["codeLanguageOptions: Array<ICodeLangugeOption>"],"sources":["../../src/CodeBlock/codeLanguageOptions.ts"],"sourcesContent":["/**\n * Copyright (c) 2019-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\nexport const codeLanguageOptions: Array<ICodeLangugeOption> = [\n {\n title: \"Bash\",\n format: \"bash\",\n },\n {\n title: \"C\",\n format: \"c\",\n },\n {\n title: \"CSharp\",\n format: \"csharp\",\n },\n {\n title: \"CSS\",\n format: \"css\",\n },\n {\n title: \"Diff\",\n format: \"diff\",\n },\n {\n title: \"HTML\",\n format: \"markup\",\n },\n {\n title: \"Ini\",\n format: \"ini\",\n },\n {\n title: \"Java\",\n format: \"java\",\n },\n {\n title: \"Javascript\",\n format: \"js\",\n },\n {\n title: \"JSON\",\n format: \"json\",\n },\n {\n title: \"JSX\",\n format: \"jsx\",\n },\n {\n title: \"Kotlin\",\n format: \"kotlin\",\n },\n {\n title: \"LUA\",\n format: \"lua\",\n },\n {\n title: \"Markdown\",\n format: \"markdown\",\n },\n {\n title: \"Matlab\",\n format: \"matlab\",\n },\n {\n title: \"NSIS\",\n format: \"nsis\",\n },\n {\n title: \"PHP\",\n format: \"php\",\n },\n {\n title: \"Powershell\",\n format: \"powershell\",\n },\n {\n title: \"Python\",\n format: \"python\",\n },\n {\n title: \"Ruby\",\n format: \"ruby\",\n },\n {\n title: \"Rust\",\n format: \"rust\",\n },\n {\n title: \"SQL\",\n format: \"sql\",\n },\n {\n title: \"Text\",\n format: \"text\",\n },\n {\n title: \"VHDL\",\n format: \"vhdl\",\n },\n {\n title: \"XML\",\n format: \"xml\",\n },\n];\n\nexport interface ICodeLangugeOption {\n title: string;\n format: string;\n}\n"],"mappings":";;;;;;;;;AAQA,MAAaA,sBAAiD;CAC5D;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;CACD;EACE,OAAO;EACP,QAAQ;CACT;AACF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_EmbedByline = require('../LicenseByline/EmbedByline.js');
|
|
3
|
+
const require_licenseAttributes = require('../utils/licenseAttributes.js');
|
|
4
|
+
const require_ImageEmbed = require('../Embed/ImageEmbed.js');
|
|
5
|
+
const require_H5pEmbed = require('../Embed/H5pEmbed.js');
|
|
6
|
+
const require_ExternalEmbed = require('../Embed/ExternalEmbed.js');
|
|
7
|
+
const require_IframeEmbed = require('../Embed/IframeEmbed.js');
|
|
8
|
+
const require_BrightcoveEmbed = require('../Embed/BrightcoveEmbed.js');
|
|
9
|
+
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
10
|
+
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
11
|
+
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
12
|
+
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
|
|
13
|
+
|
|
14
|
+
//#region src/Concept/Concept.tsx
|
|
15
|
+
const StyledFigure = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Figure, { base: {
|
|
16
|
+
display: "flex",
|
|
17
|
+
flexDirection: "column",
|
|
18
|
+
gap: "medium"
|
|
19
|
+
} });
|
|
20
|
+
const ContentWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
21
|
+
textStyle: "body.large",
|
|
22
|
+
display: "inline",
|
|
23
|
+
"& p": { display: "inline" }
|
|
24
|
+
} });
|
|
25
|
+
const Concept = (0, react.forwardRef)(({ copyright, visualElement, lang, children, title, source, previewAlt,...rest }, ref) => {
|
|
26
|
+
const licenseProps = require_licenseAttributes.licenseAttributes(copyright?.license?.license, lang, source);
|
|
27
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledFigure, {
|
|
28
|
+
ref,
|
|
29
|
+
...rest,
|
|
30
|
+
...licenseProps,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ContentWrapper, {
|
|
33
|
+
lang,
|
|
34
|
+
children: [!!title && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: title }), ` – `] }), children]
|
|
35
|
+
}),
|
|
36
|
+
visualElement?.resource === "image" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ImageEmbed.ImageEmbed_default, {
|
|
37
|
+
embed: visualElement,
|
|
38
|
+
lang,
|
|
39
|
+
previewAlt
|
|
40
|
+
}) : visualElement?.resource === "brightcove" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BrightcoveEmbed.BrightcoveEmbed_default, { embed: visualElement }) : visualElement?.resource === "h5p" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_H5pEmbed.H5pEmbed_default, { embed: visualElement }) : visualElement?.resource === "iframe" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_IframeEmbed.IframeEmbed_default, { embed: visualElement }) : visualElement?.resource === "external" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ExternalEmbed.ExternalEmbed_default, { embed: visualElement }) : null,
|
|
41
|
+
!!copyright && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedByline.EmbedByline, {
|
|
42
|
+
copyright,
|
|
43
|
+
type: "concept"
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
exports.Concept = Concept;
|
|
51
|
+
//# sourceMappingURL=Concept.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Concept.js","names":["Figure","ImageEmbed","BrightcoveEmbed","H5pEmbed","IframeEmbed","ExternalEmbed","EmbedByline"],"sources":["../../src/Concept/Concept.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-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 { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { IDraftCopyrightDTO as ConceptCopyright } from \"@ndla/types-backend/concept-api\";\nimport type { ConceptVisualElementMeta } from \"@ndla/types-embed\";\nimport { BrightcoveEmbed, ExternalEmbed, H5pEmbed, IframeEmbed, ImageEmbed } from \"../Embed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nexport interface ConceptProps extends ComponentPropsWithRef<\"figure\"> {\n copyright?: ConceptCopyright;\n visualElement?: ConceptVisualElementMeta;\n lang?: string;\n title?: string;\n children?: ReactNode;\n source?: string;\n previewAlt?: boolean;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n textStyle: \"body.large\",\n display: \"inline\",\n \"& p\": {\n display: \"inline\",\n },\n },\n});\n\nexport const Concept = forwardRef<HTMLElement, ConceptProps>(\n ({ copyright, visualElement, lang, children, title, source, previewAlt, ...rest }, ref) => {\n const licenseProps = licenseAttributes(copyright?.license?.license, lang, source);\n\n return (\n <StyledFigure ref={ref} {...rest} {...licenseProps}>\n <ContentWrapper lang={lang}>\n {!!title && (\n <>\n <b>{title}</b>\n {` – `}\n </>\n )}\n {children}\n </ContentWrapper>\n {visualElement?.resource === \"image\" ? (\n <ImageEmbed embed={visualElement} lang={lang} previewAlt={previewAlt} />\n ) : visualElement?.resource === \"brightcove\" ? (\n <BrightcoveEmbed embed={visualElement} />\n ) : visualElement?.resource === \"h5p\" ? (\n <H5pEmbed embed={visualElement} />\n ) : visualElement?.resource === \"iframe\" ? (\n <IframeEmbed embed={visualElement} />\n ) : visualElement?.resource === \"external\" ? (\n <ExternalEmbed embed={visualElement} />\n ) : null}\n {!!copyright && <EmbedByline copyright={copyright} type=\"concept\" />}\n </StyledFigure>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;AA2BA,MAAM,eAAe,qCAAOA,0BAAQ,EAClC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;AACN,EACF,EAAC;AAEF,MAAM,iBAAiB,qCAAO,OAAO,EACnC,MAAM;CACJ,WAAW;CACX,SAAS;CACT,OAAO,EACL,SAAS,SACV;AACF,EACF,EAAC;AAEF,MAAa,UAAU,sBACrB,CAAC,EAAE,WAAW,eAAe,MAAM,UAAU,OAAO,QAAQ,WAAY,GAAG,MAAM,EAAE,QAAQ;CACzF,MAAM,eAAe,4CAAkB,WAAW,SAAS,SAAS,MAAM,OAAO;AAEjF,wBACE,4BAAC;EAAkB;EAAK,GAAI;EAAM,GAAI;;mBACpC,4BAAC;IAAqB;iBACjB,yBACD,qFACE,2BAAC,iBAAG,QAAU,GACZ,QACD,EAEJ;KACc;GAChB,eAAe,aAAa,0BAC3B,2BAACC;IAAW,OAAO;IAAqB;IAAkB;KAAc,GACtE,eAAe,aAAa,+BAC9B,2BAACC,mDAAgB,OAAO,gBAAiB,GACvC,eAAe,aAAa,wBAC9B,2BAACC,qCAAS,OAAO,gBAAiB,GAChC,eAAe,aAAa,2BAC9B,2BAACC,2CAAY,OAAO,gBAAiB,GACnC,eAAe,aAAa,6BAC9B,2BAACC,+CAAc,OAAO,gBAAiB,GACrC;KACD,6BAAa,2BAACC;IAAuB;IAAW,MAAK;KAAY;;GACvD;AAElB,EACF"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_EmbedByline = require('../LicenseByline/EmbedByline.js');
|
|
3
|
+
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
4
|
+
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
5
|
+
const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
|
|
6
|
+
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
|
|
7
|
+
|
|
8
|
+
//#region src/ContactBlock/ContactBlock.tsx
|
|
9
|
+
const BackgroundVariant = {
|
|
10
|
+
strong: { _before: { backgroundColor: "surface.brand.3" } },
|
|
11
|
+
moderate: { _before: { backgroundColor: "surface.brand.3.moderate" } },
|
|
12
|
+
subtle: { _before: { backgroundColor: "surface.brand.3.subtle" } }
|
|
13
|
+
};
|
|
14
|
+
const contactBlockBackgrounds = Object.keys(BackgroundVariant);
|
|
15
|
+
const StyledWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
16
|
+
display: "flex",
|
|
17
|
+
minWidth: "surface.xxsmall",
|
|
18
|
+
padding: "medium",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
justifyContent: "space-between",
|
|
21
|
+
boxShadow: "full",
|
|
22
|
+
border: "1px solid",
|
|
23
|
+
gap: "medium",
|
|
24
|
+
position: "relative",
|
|
25
|
+
borderColor: "stroke.default",
|
|
26
|
+
borderRadius: "xsmall",
|
|
27
|
+
overflow: "hidden",
|
|
28
|
+
background: "surface.default",
|
|
29
|
+
flexDirection: "column-reverse",
|
|
30
|
+
tablet: {
|
|
31
|
+
alignItems: "unset",
|
|
32
|
+
flexDirection: "row"
|
|
33
|
+
}
|
|
34
|
+
} });
|
|
35
|
+
const EmailLink = (0, __ndla_styled_system_jsx.styled)("a", { base: {
|
|
36
|
+
color: "text.default",
|
|
37
|
+
textDecoration: "underline",
|
|
38
|
+
_hover: { textDecoration: "none" },
|
|
39
|
+
_focusVisible: { textDecoration: "none" }
|
|
40
|
+
} });
|
|
41
|
+
const HeaderWrapper = (0, __ndla_styled_system_jsx.styled)("div", {
|
|
42
|
+
base: {
|
|
43
|
+
position: "relative",
|
|
44
|
+
display: "flex",
|
|
45
|
+
flexDirection: "column",
|
|
46
|
+
gap: "3xsmall",
|
|
47
|
+
zIndex: "base",
|
|
48
|
+
_before: {
|
|
49
|
+
content: "\"\"",
|
|
50
|
+
position: "absolute",
|
|
51
|
+
top: "-60px",
|
|
52
|
+
left: "-50px",
|
|
53
|
+
right: "0",
|
|
54
|
+
bottom: "0",
|
|
55
|
+
height: "calc(100% + 50px)",
|
|
56
|
+
width: "surface.3xlarge",
|
|
57
|
+
transform: "rotate(-4deg)",
|
|
58
|
+
zIndex: "hide"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
variants: {
|
|
62
|
+
variant: BackgroundVariant,
|
|
63
|
+
imageExists: { true: { tabletDown: { _before: { display: "none" } } } }
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
const ImageWrapper = (0, __ndla_styled_system_jsx.styled)("div", {
|
|
67
|
+
base: {
|
|
68
|
+
display: "flex",
|
|
69
|
+
gap: "xxsmall",
|
|
70
|
+
alignItems: "flex-start",
|
|
71
|
+
justifyContent: "flex-start",
|
|
72
|
+
flexDirection: "column",
|
|
73
|
+
zIndex: "base",
|
|
74
|
+
tabletDown: { _before: {
|
|
75
|
+
content: "\"\"",
|
|
76
|
+
position: "absolute",
|
|
77
|
+
top: "-50px",
|
|
78
|
+
left: "-50px",
|
|
79
|
+
right: "0",
|
|
80
|
+
bottom: "0",
|
|
81
|
+
height: "surface.xxsmall",
|
|
82
|
+
width: "surface.3xlarge",
|
|
83
|
+
transform: "rotate(-4deg)",
|
|
84
|
+
zIndex: "hide"
|
|
85
|
+
} }
|
|
86
|
+
},
|
|
87
|
+
variants: { variant: BackgroundVariant }
|
|
88
|
+
});
|
|
89
|
+
const StyledImage = (0, __ndla_styled_system_jsx.styled)("img", { base: {
|
|
90
|
+
borderRadius: "xsmall",
|
|
91
|
+
width: "surface.xsmall",
|
|
92
|
+
height: "surface.xsmall",
|
|
93
|
+
objectFit: "cover"
|
|
94
|
+
} });
|
|
95
|
+
const ContentWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
96
|
+
display: "flex",
|
|
97
|
+
flexDirection: "column",
|
|
98
|
+
gap: "medium",
|
|
99
|
+
flex: "1",
|
|
100
|
+
width: "100%"
|
|
101
|
+
} });
|
|
102
|
+
const StyledDescription = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Text, { base: { fontFamily: "serif" } });
|
|
103
|
+
const ContactBlock = ({ image, jobTitle, description, name, email, embedAlt, lang, backgroundColor = "strong" }) => {
|
|
104
|
+
const { t } = (0, react_i18next.useTranslation)();
|
|
105
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledWrapper, {
|
|
106
|
+
"data-embed-type": "contact-block",
|
|
107
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ContentWrapper, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(HeaderWrapper, {
|
|
108
|
+
variant: backgroundColor,
|
|
109
|
+
imageExists: !!image,
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
|
|
112
|
+
lang,
|
|
113
|
+
fontWeight: "bold",
|
|
114
|
+
textStyle: "heading.small",
|
|
115
|
+
children: name
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
|
|
118
|
+
lang,
|
|
119
|
+
children: jobTitle
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__ndla_primitives.Text, { children: [`${t("email")}: `, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EmailLink, {
|
|
122
|
+
href: `mailto:${email}`,
|
|
123
|
+
children: email
|
|
124
|
+
})] })
|
|
125
|
+
]
|
|
126
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledDescription, {
|
|
127
|
+
textStyle: "body.large",
|
|
128
|
+
children: description
|
|
129
|
+
})] }), !!image && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ImageWrapper, {
|
|
130
|
+
variant: backgroundColor,
|
|
131
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledImage, {
|
|
132
|
+
alt: embedAlt !== void 0 ? embedAlt : image.alttext.alttext,
|
|
133
|
+
src: image.image.imageUrl,
|
|
134
|
+
width: 300,
|
|
135
|
+
height: 300
|
|
136
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedByline.LicenseContainerContent, {
|
|
137
|
+
type: "image",
|
|
138
|
+
copyright: image.copyright
|
|
139
|
+
})]
|
|
140
|
+
})]
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
//#endregion
|
|
145
|
+
exports.ContactBlock = ContactBlock;
|
|
146
|
+
exports.contactBlockBackgrounds = contactBlockBackgrounds;
|
|
147
|
+
//# sourceMappingURL=ContactBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContactBlock.js","names":["BackgroundVariant: Record<ContactBlockBackground, SystemStyleObject>","Text","LicenseContainerContent"],"sources":["../../src/ContactBlock/ContactBlock.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-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 { useTranslation } from \"react-i18next\";\nimport { Text } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { SystemStyleObject } from \"@ndla/styled-system/types\";\nimport type { IImageMetaInformationV3DTO } from \"@ndla/types-backend/image-api\";\nimport { LicenseContainerContent } from \"../LicenseByline/EmbedByline\";\n\nexport type ContactBlockBackground = \"strong\" | \"moderate\" | \"subtle\";\n\nconst BackgroundVariant: Record<ContactBlockBackground, SystemStyleObject> = {\n strong: { _before: { backgroundColor: \"surface.brand.3\" } },\n moderate: { _before: { backgroundColor: \"surface.brand.3.moderate\" } },\n subtle: { _before: { backgroundColor: \"surface.brand.3.subtle\" } },\n};\n\nexport const contactBlockBackgrounds = Object.keys(BackgroundVariant) as ContactBlockBackground[];\n\nconst StyledWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n minWidth: \"surface.xxsmall\",\n padding: \"medium\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n boxShadow: \"full\",\n border: \"1px solid\",\n gap: \"medium\",\n position: \"relative\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n overflow: \"hidden\",\n background: \"surface.default\",\n flexDirection: \"column-reverse\",\n tablet: {\n alignItems: \"unset\",\n flexDirection: \"row\",\n },\n },\n});\n\nconst EmailLink = styled(\"a\", {\n base: {\n color: \"text.default\",\n textDecoration: \"underline\",\n _hover: { textDecoration: \"none\" },\n _focusVisible: { textDecoration: \"none\" },\n },\n});\n\nconst HeaderWrapper = styled(\"div\", {\n base: {\n position: \"relative\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n zIndex: \"base\",\n _before: {\n content: '\"\"',\n position: \"absolute\",\n top: \"-60px\",\n left: \"-50px\",\n right: \"0\",\n bottom: \"0\",\n height: \"calc(100% + 50px)\",\n width: \"surface.3xlarge\",\n transform: \"rotate(-4deg)\",\n zIndex: \"hide\",\n },\n },\n variants: {\n variant: BackgroundVariant,\n imageExists: {\n true: {\n tabletDown: {\n _before: {\n display: \"none\",\n },\n },\n },\n },\n },\n});\n\nconst ImageWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"xxsmall\",\n alignItems: \"flex-start\",\n justifyContent: \"flex-start\",\n flexDirection: \"column\",\n zIndex: \"base\",\n tabletDown: {\n _before: {\n content: '\"\"',\n position: \"absolute\",\n top: \"-50px\",\n left: \"-50px\",\n right: \"0\",\n bottom: \"0\",\n height: \"surface.xxsmall\",\n width: \"surface.3xlarge\",\n transform: \"rotate(-4deg)\",\n zIndex: \"hide\",\n },\n },\n },\n variants: {\n variant: BackgroundVariant,\n },\n});\n\nconst StyledImage = styled(\"img\", {\n base: {\n borderRadius: \"xsmall\",\n width: \"surface.xsmall\",\n height: \"surface.xsmall\",\n objectFit: \"cover\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n flex: \"1\",\n width: \"100%\",\n },\n});\n\nconst StyledDescription = styled(Text, {\n base: {\n fontFamily: \"serif\",\n },\n});\n\ninterface Props {\n image?: IImageMetaInformationV3DTO;\n jobTitle: string;\n description: string;\n backgroundColor?: ContactBlockBackground;\n imageWidth?: number;\n name: string;\n email: string;\n embedAlt?: string;\n lang?: string;\n}\n\nexport const ContactBlock = ({\n image,\n jobTitle,\n description,\n name,\n email,\n embedAlt,\n lang,\n backgroundColor = \"strong\",\n}: Props) => {\n const { t } = useTranslation();\n return (\n <StyledWrapper data-embed-type=\"contact-block\">\n <ContentWrapper>\n <HeaderWrapper variant={backgroundColor} imageExists={!!image}>\n <Text lang={lang} fontWeight=\"bold\" textStyle=\"heading.small\">\n {name}\n </Text>\n <Text lang={lang}>{jobTitle}</Text>\n <Text>\n {`${t(\"email\")}: `}\n <EmailLink href={`mailto:${email}`}>{email}</EmailLink>\n </Text>\n </HeaderWrapper>\n <StyledDescription textStyle=\"body.large\">{description}</StyledDescription>\n </ContentWrapper>\n {!!image && (\n <ImageWrapper variant={backgroundColor}>\n <StyledImage\n alt={embedAlt !== undefined ? embedAlt : image.alttext.alttext}\n src={image.image.imageUrl}\n width={300}\n height={300}\n />\n <LicenseContainerContent type=\"image\" copyright={image.copyright} />\n </ImageWrapper>\n )}\n </StyledWrapper>\n );\n};\n"],"mappings":";;;;;;;;AAiBA,MAAMA,oBAAuE;CAC3E,QAAQ,EAAE,SAAS,EAAE,iBAAiB,kBAAmB,EAAE;CAC3D,UAAU,EAAE,SAAS,EAAE,iBAAiB,2BAA4B,EAAE;CACtE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,yBAA0B,EAAE;AACnE;AAED,MAAa,0BAA0B,OAAO,KAAK,kBAAkB;AAErE,MAAM,gBAAgB,qCAAO,OAAO,EAClC,MAAM;CACJ,SAAS;CACT,UAAU;CACV,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,WAAW;CACX,QAAQ;CACR,KAAK;CACL,UAAU;CACV,aAAa;CACb,cAAc;CACd,UAAU;CACV,YAAY;CACZ,eAAe;CACf,QAAQ;EACN,YAAY;EACZ,eAAe;CAChB;AACF,EACF,EAAC;AAEF,MAAM,YAAY,qCAAO,KAAK,EAC5B,MAAM;CACJ,OAAO;CACP,gBAAgB;CAChB,QAAQ,EAAE,gBAAgB,OAAQ;CAClC,eAAe,EAAE,gBAAgB,OAAQ;AAC1C,EACF,EAAC;AAEF,MAAM,gBAAgB,qCAAO,OAAO;CAClC,MAAM;EACJ,UAAU;EACV,SAAS;EACT,eAAe;EACf,KAAK;EACL,QAAQ;EACR,SAAS;GACP,SAAS;GACT,UAAU;GACV,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,QAAQ;GACR,OAAO;GACP,WAAW;GACX,QAAQ;EACT;CACF;CACD,UAAU;EACR,SAAS;EACT,aAAa,EACX,MAAM,EACJ,YAAY,EACV,SAAS,EACP,SAAS,OACV,EACF,EACF,EACF;CACF;AACF,EAAC;AAEF,MAAM,eAAe,qCAAO,OAAO;CACjC,MAAM;EACJ,SAAS;EACT,KAAK;EACL,YAAY;EACZ,gBAAgB;EAChB,eAAe;EACf,QAAQ;EACR,YAAY,EACV,SAAS;GACP,SAAS;GACT,UAAU;GACV,KAAK;GACL,MAAM;GACN,OAAO;GACP,QAAQ;GACR,QAAQ;GACR,OAAO;GACP,WAAW;GACX,QAAQ;EACT,EACF;CACF;CACD,UAAU,EACR,SAAS,kBACV;AACF,EAAC;AAEF,MAAM,cAAc,qCAAO,OAAO,EAChC,MAAM;CACJ,cAAc;CACd,OAAO;CACP,QAAQ;CACR,WAAW;AACZ,EACF,EAAC;AAEF,MAAM,iBAAiB,qCAAO,OAAO,EACnC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,MAAM;CACN,OAAO;AACR,EACF,EAAC;AAEF,MAAM,oBAAoB,qCAAOC,wBAAM,EACrC,MAAM,EACJ,YAAY,QACb,EACF,EAAC;AAcF,MAAa,eAAe,CAAC,EAC3B,OACA,UACA,aACA,MACA,OACA,UACA,MACA,kBAAkB,UACZ,KAAK;CACX,MAAM,EAAE,GAAG,GAAG,mCAAgB;AAC9B,wBACE,4BAAC;EAAc,mBAAgB;6BAC7B,4BAAC,6CACC,4BAAC;GAAc,SAAS;GAAiB,eAAe;;oBACtD,2BAACA;KAAW;KAAM,YAAW;KAAO,WAAU;eAC3C;MACI;oBACP,2BAACA;KAAW;eAAO;MAAgB;oBACnC,4BAACA,sCACG,EAAE,EAAE,QAAQ,CAAC,qBACf,2BAAC;KAAU,OAAO,SAAS,MAAM;eAAI;MAAkB,IAClD;;IACO,kBAChB,2BAAC;GAAkB,WAAU;aAAc;IAAgC,IAC5D,IACd,yBACD,4BAAC;GAAa,SAAS;8BACrB,2BAAC;IACC,KAAK,sBAAyB,WAAW,MAAM,QAAQ;IACvD,KAAK,MAAM,MAAM;IACjB,OAAO;IACP,QAAQ;KACR,kBACF,2BAACC;IAAwB,MAAK;IAAQ,WAAW,MAAM;KAAa;IACvD;GAEH;AAEnB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_ContentType = require('../model/ContentType.js');
|
|
3
|
+
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
4
|
+
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
5
|
+
const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
|
|
6
|
+
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
|
|
7
|
+
|
|
8
|
+
//#region src/ContentTypeBadge/ContentTypeBadge.tsx
|
|
9
|
+
const contentTypeToBadgeVariantMap = {
|
|
10
|
+
[require_ContentType.SUBJECT_MATERIAL]: "brand1",
|
|
11
|
+
[require_ContentType.TASKS_AND_ACTIVITIES]: "brand2",
|
|
12
|
+
[require_ContentType.ASSESSMENT_RESOURCES]: "brand2",
|
|
13
|
+
[require_ContentType.SUBJECT]: "neutral",
|
|
14
|
+
[require_ContentType.SOURCE_MATERIAL]: "brand1",
|
|
15
|
+
[require_ContentType.LEARNING_PATH]: "brand3",
|
|
16
|
+
[require_ContentType.TOPIC]: "neutral",
|
|
17
|
+
[require_ContentType.MULTIDISCIPLINARY]: "neutral",
|
|
18
|
+
[require_ContentType.CONCEPT]: "brand1",
|
|
19
|
+
[require_ContentType.EXTERNAL]: "brand2",
|
|
20
|
+
[require_ContentType.IMAGE]: "brand1",
|
|
21
|
+
[require_ContentType.AUDIO]: "brand1",
|
|
22
|
+
[require_ContentType.PODCAST]: "brand1",
|
|
23
|
+
[require_ContentType.VIDEO]: "brand1",
|
|
24
|
+
[require_ContentType.MISSING]: "neutral",
|
|
25
|
+
[require_ContentType.PODCAST_SERIES]: "brand1",
|
|
26
|
+
[require_ContentType.GLOSS]: "brand1",
|
|
27
|
+
[require_ContentType.PROGRAMME]: "neutral",
|
|
28
|
+
[require_ContentType.FRONTPAGE_ARTICLE]: "brand2"
|
|
29
|
+
};
|
|
30
|
+
const ContentTypeBadge = (0, react.forwardRef)(({ contentType, children,...props }, ref) => {
|
|
31
|
+
const { t } = (0, react_i18next.useTranslation)();
|
|
32
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Badge, {
|
|
33
|
+
colorTheme: contentTypeToBadgeVariantMap[contentType ?? "missing"] ?? contentTypeToBadgeVariantMap["missing"],
|
|
34
|
+
...props,
|
|
35
|
+
ref,
|
|
36
|
+
children: children ?? t(`contentTypes.${contentType}`)
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
exports.ContentTypeBadge = ContentTypeBadge;
|
|
42
|
+
exports.contentTypeToBadgeVariantMap = contentTypeToBadgeVariantMap;
|
|
43
|
+
//# sourceMappingURL=ContentTypeBadge.js.map
|