@ndla/ui 56.0.148-alpha.0 → 56.0.149-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/AudioPlayer/AudioPlayer.mjs +5 -6
- package/es/AudioPlayer/AudioPlayer.mjs.map +1 -1
- package/es/AudioPlayer/Controls.mjs +1 -2
- package/es/AudioPlayer/Controls.mjs.map +1 -1
- package/es/AudioPlayer/SpeechControl.mjs +1 -2
- package/es/AudioPlayer/SpeechControl.mjs.map +1 -1
- package/es/Breadcrumb/Breadcrumb.mjs +3 -4
- package/es/Breadcrumb/Breadcrumb.mjs.map +1 -1
- package/es/Breadcrumb/BreadcrumbItem.mjs +1 -2
- package/es/Breadcrumb/BreadcrumbItem.mjs.map +1 -1
- package/es/Breadcrumb/HomeBreadcrumb.mjs +3 -4
- package/es/Breadcrumb/HomeBreadcrumb.mjs.map +1 -1
- package/es/CampaignBlock/CampaignBlock.mjs +1 -2
- package/es/CampaignBlock/CampaignBlock.mjs.map +1 -1
- package/es/CodeBlock/CodeBlock.mjs +2 -3
- package/es/CodeBlock/CodeBlock.mjs.map +1 -1
- package/es/Concept/Concept.mjs +7 -7
- package/es/Concept/Concept.mjs.map +1 -1
- package/es/CopyParagraphButton/CopyParagraphButton.mjs +1 -2
- package/es/CopyParagraphButton/CopyParagraphButton.mjs.map +1 -1
- package/es/Embed/AudioEmbed.mjs +6 -7
- package/es/Embed/AudioEmbed.mjs.map +1 -1
- package/es/Embed/BrightcoveEmbed.mjs +3 -4
- package/es/Embed/BrightcoveEmbed.mjs.map +1 -1
- package/es/Embed/CodeEmbed.mjs +5 -6
- package/es/Embed/CodeEmbed.mjs.map +1 -1
- package/es/Embed/ConceptEmbed.mjs +2 -2
- package/es/Embed/ConceptEmbed.mjs.map +1 -1
- package/es/Embed/ContentLinkEmbed.mjs +1 -2
- package/es/Embed/ContentLinkEmbed.mjs.map +1 -1
- package/es/Embed/CopyrightEmbed.mjs +1 -2
- package/es/Embed/CopyrightEmbed.mjs.map +1 -1
- package/es/Embed/EmbedErrorPlaceholder.mjs +1 -2
- package/es/Embed/EmbedErrorPlaceholder.mjs.map +1 -1
- package/es/Embed/ExternalEmbed.mjs +5 -6
- package/es/Embed/ExternalEmbed.mjs.map +1 -1
- package/es/Embed/FootnoteEmbed.mjs +1 -2
- package/es/Embed/FootnoteEmbed.mjs.map +1 -1
- package/es/Embed/GlossEmbed.mjs +5 -5
- package/es/Embed/GlossEmbed.mjs.map +1 -1
- package/es/Embed/H5pEmbed.mjs +3 -4
- package/es/Embed/H5pEmbed.mjs.map +1 -1
- package/es/Embed/IframeEmbed.mjs +5 -6
- package/es/Embed/IframeEmbed.mjs.map +1 -1
- package/es/Embed/ImageEmbed.mjs +3 -4
- package/es/Embed/ImageEmbed.mjs.map +1 -1
- package/es/Embed/RelatedContentEmbed.mjs +1 -2
- package/es/Embed/RelatedContentEmbed.mjs.map +1 -1
- package/es/Embed/UnknownEmbed.mjs +1 -2
- package/es/Embed/UnknownEmbed.mjs.map +1 -1
- package/es/Embed/UuDisclaimerEmbed.mjs +1 -2
- package/es/Embed/UuDisclaimerEmbed.mjs.map +1 -1
- package/es/FactBox/FactBox.mjs +1 -2
- package/es/FactBox/FactBox.mjs.map +1 -1
- package/es/Gloss/Gloss.mjs +5 -6
- package/es/Gloss/Gloss.mjs.map +1 -1
- package/es/Gloss/GlossExample.mjs +1 -2
- package/es/Gloss/GlossExample.mjs.map +1 -1
- package/es/KeyFigure/KeyFigure.mjs +1 -2
- package/es/KeyFigure/KeyFigure.mjs.map +1 -1
- package/es/LinkBlock/LinkBlock.mjs +1 -2
- package/es/LinkBlock/LinkBlock.mjs.map +1 -1
- package/es/LinkBlock/LinkBlockSection.mjs +1 -2
- package/es/LinkBlock/LinkBlockSection.mjs.map +1 -1
- package/es/ResourceBox/ResourceBox.mjs +1 -2
- package/es/ResourceBox/ResourceBox.mjs.map +1 -1
- package/es/index.mjs +31 -27
- package/es/locale/messages-en.mjs +38 -37
- package/es/locale/messages-en.mjs.map +1 -1
- package/es/locale/messages-nb.mjs +38 -37
- package/es/locale/messages-nb.mjs.map +1 -1
- package/es/locale/messages-nn.mjs +38 -37
- package/es/locale/messages-nn.mjs.map +1 -1
- package/es/locale/messages-se.mjs +38 -37
- package/es/locale/messages-se.mjs.map +1 -1
- package/es/model/SubjectCategories.mjs +9 -2
- package/es/model/SubjectCategories.mjs.map +1 -1
- package/es/model/SubjectTypes.mjs +9 -2
- package/es/model/SubjectTypes.mjs.map +1 -1
- package/es/model/WordClass.mjs +1 -1
- package/es/model/index.mjs +2 -3
- package/es/model/index.mjs.map +1 -1
- package/lib/AudioPlayer/AudioPlayer.d.ts +2 -2
- package/lib/AudioPlayer/AudioPlayer.js +3 -4
- package/lib/AudioPlayer/AudioPlayer.js.map +1 -1
- package/lib/AudioPlayer/Controls.d.ts +2 -2
- package/lib/AudioPlayer/Controls.js +1 -2
- package/lib/AudioPlayer/Controls.js.map +1 -1
- package/lib/AudioPlayer/SpeechControl.d.ts +2 -2
- package/lib/AudioPlayer/SpeechControl.js +1 -2
- package/lib/AudioPlayer/SpeechControl.js.map +1 -1
- package/lib/Breadcrumb/Breadcrumb.d.ts +2 -2
- package/lib/Breadcrumb/Breadcrumb.js +2 -3
- package/lib/Breadcrumb/Breadcrumb.js.map +1 -1
- package/lib/Breadcrumb/BreadcrumbItem.d.ts +2 -2
- package/lib/Breadcrumb/BreadcrumbItem.js +1 -2
- package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -1
- package/lib/Breadcrumb/HomeBreadcrumb.d.ts +2 -2
- package/lib/Breadcrumb/HomeBreadcrumb.js +2 -3
- package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -1
- package/lib/CampaignBlock/CampaignBlock.d.ts +2 -2
- package/lib/CampaignBlock/CampaignBlock.js +1 -2
- package/lib/CampaignBlock/CampaignBlock.js.map +1 -1
- package/lib/CodeBlock/CodeBlock.d.ts +2 -2
- package/lib/CodeBlock/CodeBlock.js +2 -3
- package/lib/CodeBlock/CodeBlock.js.map +1 -1
- package/lib/Concept/Concept.js +2 -2
- package/lib/Concept/Concept.js.map +1 -1
- package/lib/CopyParagraphButton/CopyParagraphButton.d.ts +2 -2
- package/lib/CopyParagraphButton/CopyParagraphButton.js +1 -2
- package/lib/CopyParagraphButton/CopyParagraphButton.js.map +1 -1
- package/lib/Embed/AudioEmbed.d.ts +2 -2
- package/lib/Embed/AudioEmbed.js +4 -5
- package/lib/Embed/AudioEmbed.js.map +1 -1
- package/lib/Embed/BrightcoveEmbed.d.ts +2 -2
- package/lib/Embed/BrightcoveEmbed.js +2 -3
- package/lib/Embed/BrightcoveEmbed.js.map +1 -1
- package/lib/Embed/CodeEmbed.d.ts +2 -2
- package/lib/Embed/CodeEmbed.js +3 -4
- package/lib/Embed/CodeEmbed.js.map +1 -1
- package/lib/Embed/ConceptEmbed.js +1 -1
- package/lib/Embed/ConceptEmbed.js.map +1 -1
- package/lib/Embed/ContentLinkEmbed.d.ts +2 -2
- package/lib/Embed/ContentLinkEmbed.js +1 -2
- package/lib/Embed/ContentLinkEmbed.js.map +1 -1
- package/lib/Embed/CopyrightEmbed.d.ts +2 -2
- package/lib/Embed/CopyrightEmbed.js +1 -2
- package/lib/Embed/CopyrightEmbed.js.map +1 -1
- package/lib/Embed/EmbedErrorPlaceholder.d.ts +2 -2
- package/lib/Embed/EmbedErrorPlaceholder.js +1 -2
- package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -1
- package/lib/Embed/ExternalEmbed.d.ts +2 -2
- package/lib/Embed/ExternalEmbed.js +3 -4
- package/lib/Embed/ExternalEmbed.js.map +1 -1
- package/lib/Embed/FootnoteEmbed.d.ts +2 -2
- package/lib/Embed/FootnoteEmbed.js +1 -2
- package/lib/Embed/FootnoteEmbed.js.map +1 -1
- package/lib/Embed/GlossEmbed.js +3 -3
- package/lib/Embed/GlossEmbed.js.map +1 -1
- package/lib/Embed/H5pEmbed.d.ts +2 -2
- package/lib/Embed/H5pEmbed.js +2 -3
- package/lib/Embed/H5pEmbed.js.map +1 -1
- package/lib/Embed/IframeEmbed.d.ts +2 -2
- package/lib/Embed/IframeEmbed.js +3 -4
- package/lib/Embed/IframeEmbed.js.map +1 -1
- package/lib/Embed/ImageEmbed.d.ts +2 -2
- package/lib/Embed/ImageEmbed.js +2 -3
- package/lib/Embed/ImageEmbed.js.map +1 -1
- package/lib/Embed/RelatedContentEmbed.d.ts +2 -2
- package/lib/Embed/RelatedContentEmbed.js +1 -2
- package/lib/Embed/RelatedContentEmbed.js.map +1 -1
- package/lib/Embed/UnknownEmbed.d.ts +2 -2
- package/lib/Embed/UnknownEmbed.js +1 -2
- package/lib/Embed/UnknownEmbed.js.map +1 -1
- package/lib/Embed/UuDisclaimerEmbed.d.ts +2 -2
- package/lib/Embed/UuDisclaimerEmbed.js +1 -2
- package/lib/Embed/UuDisclaimerEmbed.js.map +1 -1
- package/lib/FactBox/FactBox.d.ts +2 -2
- package/lib/FactBox/FactBox.js +1 -2
- package/lib/FactBox/FactBox.js.map +1 -1
- package/lib/Gloss/Gloss.d.ts +2 -2
- package/lib/Gloss/Gloss.js +3 -4
- package/lib/Gloss/Gloss.js.map +1 -1
- package/lib/Gloss/GlossExample.d.ts +2 -2
- package/lib/Gloss/GlossExample.js +1 -2
- package/lib/Gloss/GlossExample.js.map +1 -1
- package/lib/KeyFigure/KeyFigure.d.ts +1 -2
- package/lib/KeyFigure/KeyFigure.js +1 -2
- package/lib/KeyFigure/KeyFigure.js.map +1 -1
- package/lib/LinkBlock/LinkBlock.d.ts +2 -2
- package/lib/LinkBlock/LinkBlock.js +1 -2
- package/lib/LinkBlock/LinkBlock.js.map +1 -1
- package/lib/LinkBlock/LinkBlockSection.d.ts +2 -2
- package/lib/LinkBlock/LinkBlockSection.js +1 -2
- package/lib/LinkBlock/LinkBlockSection.js.map +1 -1
- package/lib/ResourceBox/ResourceBox.d.ts +1 -1
- package/lib/ResourceBox/ResourceBox.js +0 -2
- package/lib/ResourceBox/ResourceBox.js.map +1 -1
- package/lib/index.d.ts +30 -26
- package/lib/index.js +37 -27
- package/lib/locale/messages-en.d.ts +11 -9
- package/lib/locale/messages-en.js +47 -46
- package/lib/locale/messages-en.js.map +1 -1
- package/lib/locale/messages-nb.d.ts +11 -9
- package/lib/locale/messages-nb.js +47 -46
- package/lib/locale/messages-nb.js.map +1 -1
- package/lib/locale/messages-nn.d.ts +11 -9
- package/lib/locale/messages-nn.js +47 -46
- package/lib/locale/messages-nn.js.map +1 -1
- package/lib/locale/messages-se.d.ts +11 -9
- package/lib/locale/messages-se.js +47 -46
- package/lib/locale/messages-se.js.map +1 -1
- package/lib/model/SubjectCategories.d.ts +6 -0
- package/lib/model/SubjectCategories.js +9 -1
- package/lib/model/SubjectCategories.js.map +1 -1
- package/lib/model/SubjectTypes.d.ts +6 -0
- package/lib/model/SubjectTypes.js +9 -1
- package/lib/model/SubjectTypes.js.map +1 -1
- package/lib/model/WordClass.js +1 -0
- package/lib/model/index.d.ts +1 -2
- package/lib/model/index.js +2 -3
- package/lib/model/index.js.map +1 -1
- package/package.json +8 -8
- package/src/AudioPlayer/AudiPlayer.stories.tsx +1 -1
- package/src/AudioPlayer/AudioPlayer.tsx +3 -5
- package/src/AudioPlayer/Controls.tsx +1 -3
- package/src/AudioPlayer/SpeechControl.tsx +1 -3
- package/src/Breadcrumb/Breadcrumb.stories.tsx +1 -1
- package/src/Breadcrumb/Breadcrumb.tsx +2 -4
- package/src/Breadcrumb/BreadcrumbItem.tsx +1 -3
- package/src/Breadcrumb/HomeBreadcrumb.stories.tsx +1 -1
- package/src/Breadcrumb/HomeBreadcrumb.tsx +2 -4
- package/src/CampaignBlock/CampaignBlock.stories.tsx +1 -1
- package/src/CampaignBlock/CampaignBlock.tsx +1 -3
- package/src/CodeBlock/CodeBlock.stories.tsx +1 -1
- package/src/CodeBlock/CodeBlock.tsx +1 -3
- package/src/Concept/Concept.tsx +5 -5
- package/src/CopyParagraphButton/CopyParagraphButton.tsx +1 -3
- package/src/Embed/AudioEmbed.stories.tsx +1 -1
- package/src/Embed/AudioEmbed.tsx +3 -5
- package/src/Embed/BrightcoveEmbed.stories.tsx +1 -1
- package/src/Embed/BrightcoveEmbed.tsx +2 -4
- package/src/Embed/CodeEmbed.stories.tsx +1 -1
- package/src/Embed/CodeEmbed.tsx +3 -5
- package/src/Embed/ConceptEmbed.tsx +1 -1
- package/src/Embed/ContentLinkEmbed.tsx +1 -3
- package/src/Embed/CopyrightEmbed.tsx +1 -3
- package/src/Embed/EmbedErrorPlaceholder.tsx +1 -3
- package/src/Embed/ExternalEmbed.stories.tsx +1 -1
- package/src/Embed/ExternalEmbed.tsx +3 -4
- package/src/Embed/FootnoteEmbed.stories.tsx +1 -1
- package/src/Embed/FootnoteEmbed.tsx +1 -3
- package/src/Embed/GlossEmbed.tsx +2 -2
- package/src/Embed/H5pEmbed.stories.tsx +1 -1
- package/src/Embed/H5pEmbed.tsx +2 -4
- package/src/Embed/IframeEmbed.stories.tsx +1 -1
- package/src/Embed/IframeEmbed.tsx +3 -5
- package/src/Embed/ImageEmbed.stories.tsx +1 -1
- package/src/Embed/ImageEmbed.tsx +2 -4
- package/src/Embed/RelatedContentEmbed.stories.tsx +1 -1
- package/src/Embed/RelatedContentEmbed.tsx +1 -3
- package/src/Embed/UnknownEmbed.tsx +1 -3
- package/src/Embed/UuDisclaimerEmbed.stories.tsx +5 -5
- package/src/Embed/UuDisclaimerEmbed.tsx +1 -3
- package/src/FactBox/FactBox.tsx +1 -3
- package/src/FactBox/Factbox.stories.tsx +1 -1
- package/src/Gloss/Gloss.stories.tsx +2 -2
- package/src/Gloss/Gloss.tsx +3 -5
- package/src/Gloss/GlossExample.tsx +1 -3
- package/src/KeyFigure/KeyFigure.stories.tsx +1 -1
- package/src/KeyFigure/KeyFigure.tsx +1 -3
- package/src/LinkBlock/LinkBlock.stories.tsx +2 -2
- package/src/LinkBlock/LinkBlock.tsx +1 -3
- package/src/LinkBlock/LinkBlockSection.tsx +1 -3
- package/src/ResourceBox/ResourceBox.tsx +0 -2
- package/src/index.ts +30 -26
- package/src/locale/messages-en.ts +38 -38
- package/src/locale/messages-nb.ts +38 -38
- package/src/locale/messages-nn.ts +38 -38
- package/src/locale/messages-se.ts +38 -38
- package/src/model/SubjectCategories.ts +7 -0
- package/src/model/SubjectTypes.ts +7 -0
- package/src/model/index.ts +1 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbItem.js","names":[],"sources":["../../src/Breadcrumb/BreadcrumbItem.tsx"],"sourcesContent":["/**\n * Copyright (c) 2016-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nexport interface SimpleBreadcrumbItem {\n to: string | Partial<Location>;\n name: ReactNode;\n}\n\nexport interface IndexedBreadcrumbItem extends SimpleBreadcrumbItem {\n index: number;\n}\n\nexport interface BreadcrumbRenderProps {\n item: IndexedBreadcrumbItem;\n totalCount: number;\n}\n\nconst StyledListItem = styled(\"li\", {\n base: {\n display: \"flex\",\n color: \"inherit\",\n gap: \"3xsmall\",\n alignItems: \"flex-end\",\n tabletDown: {\n display: \"block\",\n },\n \"& a\": {\n _visited: {\n color: \"inherit\",\n },\n },\n },\n});\n\ninterface Props {\n item: IndexedBreadcrumbItem;\n autoCollapse?: boolean;\n totalCount: number;\n renderItem: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n renderSeparator: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n}\n\
|
|
1
|
+
{"version":3,"file":"BreadcrumbItem.js","names":[],"sources":["../../src/Breadcrumb/BreadcrumbItem.tsx"],"sourcesContent":["/**\n * Copyright (c) 2016-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nexport interface SimpleBreadcrumbItem {\n to: string | Partial<Location>;\n name: ReactNode;\n}\n\nexport interface IndexedBreadcrumbItem extends SimpleBreadcrumbItem {\n index: number;\n}\n\nexport interface BreadcrumbRenderProps {\n item: IndexedBreadcrumbItem;\n totalCount: number;\n}\n\nconst StyledListItem = styled(\"li\", {\n base: {\n display: \"flex\",\n color: \"inherit\",\n gap: \"3xsmall\",\n alignItems: \"flex-end\",\n tabletDown: {\n display: \"block\",\n },\n \"& a\": {\n _visited: {\n color: \"inherit\",\n },\n },\n },\n});\n\ninterface Props {\n item: IndexedBreadcrumbItem;\n autoCollapse?: boolean;\n totalCount: number;\n renderItem: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n renderSeparator: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n}\n\nexport const BreadcrumbItem = ({ renderItem, renderSeparator, item, totalCount }: Props) => {\n const isLast = item.index === totalCount - 1;\n return (\n <StyledListItem aria-current={isLast ? \"page\" : undefined}>\n {renderItem(item, totalCount)}\n {renderSeparator(item, totalCount)}\n </StyledListItem>\n );\n};\n"],"mappings":";;;;;;;;;AAyBA,MAAM,sDAAwB,MAAM,EAClC,MAAM;CACJ,SAAS;CACT,OAAO;CACP,KAAK;CACL,YAAY;CACZ,YAAY,EACV,SAAS,SACV;CACD,OAAO,EACL,UAAU,EACR,OAAO,WACR,EACF;CACF,EACF,CAAC;AAUF,MAAa,kBAAkB,EAAE,YAAY,iBAAiB,MAAM,iBAAwB;CAC1F,MAAM,SAAS,KAAK,UAAU,aAAa;AAC3C,QACE,4CAAC;EAAe,gBAAc,SAAS,SAAS;aAC7C,WAAW,MAAM,WAAW,EAC5B,gBAAgB,MAAM,WAAW;GACnB"}
|
|
@@ -9,5 +9,5 @@ import type { SimpleBreadcrumbItem } from "./BreadcrumbItem";
|
|
|
9
9
|
interface Props {
|
|
10
10
|
items: SimpleBreadcrumbItem[];
|
|
11
11
|
}
|
|
12
|
-
declare const HomeBreadcrumb: ({ items }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export
|
|
12
|
+
export declare const HomeBreadcrumb: ({ items }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -36,14 +36,13 @@ const HomeBreadcrumb = ({ items }) => {
|
|
|
36
36
|
if (item.index === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledArrowRight, { "aria-hidden": true });
|
|
37
37
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_icons.ArrowRightShortLine, { "aria-hidden": true });
|
|
38
38
|
};
|
|
39
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Breadcrumb.
|
|
39
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Breadcrumb.Breadcrumb, {
|
|
40
40
|
items,
|
|
41
41
|
renderItem,
|
|
42
42
|
renderSeparator
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
|
-
var HomeBreadcrumb_default = HomeBreadcrumb;
|
|
46
45
|
|
|
47
46
|
//#endregion
|
|
48
|
-
exports.
|
|
47
|
+
exports.HomeBreadcrumb = HomeBreadcrumb;
|
|
49
48
|
//# sourceMappingURL=HomeBreadcrumb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomeBreadcrumb.js","names":["SafeLink","ArrowRightShortLine","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\
|
|
1
|
+
{"version":3,"file":"HomeBreadcrumb.js","names":["SafeLink","ArrowRightShortLine","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\nexport const 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 aria-hidden />;\n }\n return <ArrowRightShortLine aria-hidden />;\n };\n\n return <Breadcrumb items={items} renderItem={renderItem} renderSeparator={renderSeparator} />;\n};\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,sDAAwBA,0BAAU,EACtC,MAAM;CACJ,OAAO;CACP,gBAAgB;CAChB,QAAQ,EACN,gBAAgB,QACjB;CACD,eAAe,EACb,gBAAgB,QACjB;CACF,EACF,CAAC;AAEF,MAAM,wDAA0BC,kCAAqB,EACnD,MAAM,EACJ,YAAY,EACV,SAAS,QACV,EACF,EACF,CAAC;AAEF,MAAM,oDAAsBD,0BAAU,EACpC,MAAM,EACJ,OAAO,WACR,EACF,CAAC;AAMF,MAAa,kBAAkB,EAAE,YAAmB;CAClD,MAAM,cAAc,MAA6B,eAAuB;AACtE,MAAI,KAAK,UAAU,aAAa,EAC9B,QAAO,2CAAC,oBAAM,KAAK,OAAY;AAEjC,MAAI,KAAK,UAAU,KAAK,OAAO,KAAK,SAAS,SAC3C,QACE,2CAAC;GAAa,cAAY,KAAK;GAAM,IAAI,KAAK;aAC5C,2CAACE,yBAAS,OAAO,KAAK,OAAQ;IACjB;AAGnB,SAAO,2CAAC;GAAe,IAAI,KAAK;aAAK,KAAK;IAAsB;;CAGlE,MAAM,mBAAmB,MAA6B,eAAuB;AAC3E,MAAI,KAAK,UAAU,aAAa,EAC9B,QAAO;AAET,MAAI,KAAK,UAAU,EACjB,QAAO,2CAAC,oBAAiB,sBAAc;AAEzC,SAAO,2CAACD,oCAAoB,sBAAc;;AAG5C,QAAO,2CAACE;EAAkB;EAAmB;EAA6B;GAAmB"}
|
|
@@ -25,5 +25,5 @@ interface Props {
|
|
|
25
25
|
path?: string;
|
|
26
26
|
background?: CampaignBlockEmbedData["background"];
|
|
27
27
|
}
|
|
28
|
-
declare const CampaignBlock: ({ title, image, imageSide, description, headingLevel: InternalHeading, url, path, className, background, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
export
|
|
28
|
+
export declare const CampaignBlock: ({ title, image, imageSide, description, headingLevel: InternalHeading, url, path, className, background, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export {};
|
|
@@ -132,8 +132,7 @@ const CampaignBlock = ({ title, image, imageSide = "left", description, headingL
|
|
|
132
132
|
]
|
|
133
133
|
}) });
|
|
134
134
|
};
|
|
135
|
-
var CampaignBlock_default = CampaignBlock;
|
|
136
135
|
|
|
137
136
|
//#endregion
|
|
138
|
-
exports.
|
|
137
|
+
exports.CampaignBlock = CampaignBlock;
|
|
139
138
|
//# sourceMappingURL=CampaignBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CampaignBlock.js","names":["Text","SafeLinkButton","getPossiblyRelativeUrl","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\
|
|
1
|
+
{"version":3,"file":"CampaignBlock.js","names":["Text","SafeLinkButton","getPossiblyRelativeUrl","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\nexport const 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"],"mappings":";;;;;;;;;;;;;;;;;;AAsCA,MAAM,+CAAiB,OAAO,EAC5B,MAAM;CACJ,OAAO;CACP,QAAQ;CACR,eAAe;CAChB,EACF,CAAC;AAEF,MAAM,iDAAmB,OAAO;CAC9B,MAAM;EACJ,SAAS;EACT,qBAAqB;EACrB,QAAQ;EACR,aAAa;EACb,iBAAiB;EACjB,cAAc;EACd,WAAW;EACX,UAAU;EACX;CACD,UAAU;EACR,WAAW;GACT,MAAM;IACJ,YAAY,EACV,qBAAqB,6BACtB;IACD,+CAA+C,EAC7C,YAAY,EACV,qBAAqB,6BACtB,EACF;IACF;GACD,OAAO;IACL,YAAY,EACV,qBAAqB,6BACtB;IACD,+CAA+C,EAC7C,YAAY,EACV,qBAAqB,6BACtB,EACF;IACF;GACF;EACD,YAAY;GACV,SAAS,EAAE;GACX,QAAQ,EACN,iBAAiB,mBAClB;GACD,QAAQ,EACN,iBAAiB,mBAClB;GACF;EACF;CACD,iBAAiB;EACf,WAAW;EACX,YAAY;EACb;CACF,CAAC;AAEF,MAAM,iDAAmB,OAAO,EAC9B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AG,EACtB,2CAACG,gCAAiB;MACP;OAEA;GAChB,cAAc,UAAU;;GACf,GACJ"}
|
|
@@ -11,5 +11,5 @@ interface Props extends StyledProps, ComponentPropsWithRef<"pre"> {
|
|
|
11
11
|
highlightedCode: string;
|
|
12
12
|
format: string;
|
|
13
13
|
}
|
|
14
|
-
export declare const
|
|
15
|
-
export
|
|
14
|
+
export declare const CodeBlock: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLPreElement>>;
|
|
15
|
+
export {};
|
|
@@ -10,7 +10,7 @@ __ndla_styled_system_css = require_rolldown_runtime.__toESM(__ndla_styled_system
|
|
|
10
10
|
|
|
11
11
|
//#region src/CodeBlock/CodeBlock.tsx
|
|
12
12
|
const Pre = (0, __ndla_styled_system_jsx.styled)("pre", {});
|
|
13
|
-
const
|
|
13
|
+
const CodeBlock = (0, react.forwardRef)(({ highlightedCode, format, className,...props }, ref) => {
|
|
14
14
|
const codeWithLineNumbers = (0, react.useMemo)(() => {
|
|
15
15
|
return highlightedCode.split("\n").map((line, i) => {
|
|
16
16
|
return `<span class="linenumber">${i + 1}</span>${line}`;
|
|
@@ -23,8 +23,7 @@ const Codeblock = (0, react.forwardRef)(({ highlightedCode, format, className,..
|
|
|
23
23
|
ref
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
|
-
var CodeBlock_default = Codeblock;
|
|
27
26
|
|
|
28
27
|
//#endregion
|
|
29
|
-
exports.
|
|
28
|
+
exports.CodeBlock = CodeBlock;
|
|
30
29
|
//# sourceMappingURL=CodeBlock.js.map
|
|
@@ -1 +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 { StyledProps } from \"@ndla/styled-system/types\";\n\ninterface Props extends StyledProps, ComponentPropsWithRef<\"pre\"> {\n highlightedCode: string;\n format: string;\n}\n\nconst Pre = styled(\"pre\", {});\n\nexport const
|
|
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 { StyledProps } from \"@ndla/styled-system/types\";\n\ninterface Props extends StyledProps, 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"],"mappings":";;;;;;;;;;;AAkBA,MAAM,2CAAa,OAAO,EAAE,CAAC;AAE7B,MAAa,mCAA+C,EAAE,iBAAiB,QAAQ,UAAW,GAAG,SAAS,QAAQ;CACpH,MAAM,+CAAoC;AACxC,SAAO,gBACJ,MAAM,KAAK,CACX,KAAK,MAAM,MAAM;AAChB,UAAO,4BAA4B,IAAI,EAAE,SAAS;IAClD,CACD,KAAK,KAAK;IACZ,CAAC,gBAAgB,CAAC;AAErB,QACE,2CAAC;EACC,4CAAc,aAAa,YAAY,UAAU,UAAU;EAC3D,GAAI;EACJ,yBAAyB,EAAE,QAAQ,qBAAqB;EACnD;GACL;EAEJ"}
|
package/lib/Concept/Concept.js
CHANGED
|
@@ -37,11 +37,11 @@ const Concept = (0, react.forwardRef)(({ copyright, visualElement, lang, childre
|
|
|
37
37
|
lang,
|
|
38
38
|
children: [!!title && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: title }), ` – `] }), children]
|
|
39
39
|
}),
|
|
40
|
-
visualElement?.resource === "image" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ImageEmbed.
|
|
40
|
+
visualElement?.resource === "image" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ImageEmbed.ImageEmbed, {
|
|
41
41
|
embed: visualElement,
|
|
42
42
|
lang,
|
|
43
43
|
previewAlt
|
|
44
|
-
}) : visualElement?.resource === "brightcove" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BrightcoveEmbed.
|
|
44
|
+
}) : visualElement?.resource === "brightcove" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BrightcoveEmbed.BrightcoveEmbed, { embed: visualElement }) : visualElement?.resource === "h5p" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_H5pEmbed.H5pEmbed, { embed: visualElement }) : visualElement?.resource === "iframe" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_IframeEmbed.IframeEmbed, { embed: visualElement }) : visualElement?.resource === "external" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ExternalEmbed.ExternalEmbed, { embed: visualElement }) : null,
|
|
45
45
|
!!copyright && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedByline.EmbedByline, {
|
|
46
46
|
copyright,
|
|
47
47
|
type: "concept"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Concept.js","names":["Figure","licenseAttributes","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 from \"../Embed/BrightcoveEmbed\";\nimport ExternalEmbed from \"../Embed/ExternalEmbed\";\nimport H5pEmbed from \"../Embed/H5pEmbed\";\nimport IframeEmbed from \"../Embed/IframeEmbed\";\nimport ImageEmbed from \"../Embed/ImageEmbed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nexport interface ConceptProps extends Omit<ComponentPropsWithRef<\"figure\">, \"title\"> {\n copyright?: ConceptCopyright;\n visualElement?: ConceptVisualElementMeta;\n lang?: string;\n title?: ReactNode;\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":";;;;;;;;;;;;;;;;;;AA+BA,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACN,EACF,CAAC;AAEF,MAAM,sDAAwB,OAAO,EACnC,MAAM;CACJ,WAAW;CACX,SAAS;CACT,OAAO,EACL,SAAS,UACV;CACF,EACF,CAAC;AAEF,MAAa,iCACV,EAAE,WAAW,eAAe,MAAM,UAAU,OAAO,QAAQ,WAAY,GAAG,QAAQ,QAAQ;CACzF,MAAM,eAAeC,4CAAkB,WAAW,SAAS,SAAS,MAAM,OAAO;AAEjF,QACE,4CAAC;EAAkB;EAAK,GAAI;EAAM,GAAI;;GACpC,4CAAC;IAAqB;eACnB,CAAC,CAAC,SACD,qFACE,2CAAC,iBAAG,QAAU,EACb,SACA,EAEJ;KACc;GAChB,eAAe,aAAa,UAC3B,2CAACC;IAAW,OAAO;IAAqB;IAAkB;KAAc,GACtE,eAAe,aAAa,eAC9B,2CAACC,
|
|
1
|
+
{"version":3,"file":"Concept.js","names":["Figure","licenseAttributes","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 } from \"../Embed/BrightcoveEmbed\";\nimport { ExternalEmbed } from \"../Embed/ExternalEmbed\";\nimport { H5pEmbed } from \"../Embed/H5pEmbed\";\nimport { IframeEmbed } from \"../Embed/IframeEmbed\";\nimport { ImageEmbed } from \"../Embed/ImageEmbed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nexport interface ConceptProps extends Omit<ComponentPropsWithRef<\"figure\">, \"title\"> {\n copyright?: ConceptCopyright;\n visualElement?: ConceptVisualElementMeta;\n lang?: string;\n title?: ReactNode;\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":";;;;;;;;;;;;;;;;;;AA+BA,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACN,EACF,CAAC;AAEF,MAAM,sDAAwB,OAAO,EACnC,MAAM;CACJ,WAAW;CACX,SAAS;CACT,OAAO,EACL,SAAS,UACV;CACF,EACF,CAAC;AAEF,MAAa,iCACV,EAAE,WAAW,eAAe,MAAM,UAAU,OAAO,QAAQ,WAAY,GAAG,QAAQ,QAAQ;CACzF,MAAM,eAAeC,4CAAkB,WAAW,SAAS,SAAS,MAAM,OAAO;AAEjF,QACE,4CAAC;EAAkB;EAAK,GAAI;EAAM,GAAI;;GACpC,4CAAC;IAAqB;eACnB,CAAC,CAAC,SACD,qFACE,2CAAC,iBAAG,QAAU,EACb,SACA,EAEJ;KACc;GAChB,eAAe,aAAa,UAC3B,2CAACC;IAAW,OAAO;IAAqB;IAAkB;KAAc,GACtE,eAAe,aAAa,eAC9B,2CAACC,2CAAgB,OAAO,gBAAiB,GACvC,eAAe,aAAa,QAC9B,2CAACC,6BAAS,OAAO,gBAAiB,GAChC,eAAe,aAAa,WAC9B,2CAACC,mCAAY,OAAO,gBAAiB,GACnC,eAAe,aAAa,aAC9B,2CAACC,uCAAc,OAAO,gBAAiB,GACrC;GACH,CAAC,CAAC,aAAa,2CAACC;IAAuB;IAAW,MAAK;KAAY;;GACvD;EAGpB"}
|
|
@@ -11,5 +11,5 @@ interface Props {
|
|
|
11
11
|
copyText: string;
|
|
12
12
|
lang?: string;
|
|
13
13
|
}
|
|
14
|
-
declare const CopyParagraphButton: ({ children, copyText, lang }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export
|
|
14
|
+
export declare const CopyParagraphButton: ({ children, copyText, lang }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -63,8 +63,7 @@ const CopyParagraphButton = ({ children, copyText, lang }) => {
|
|
|
63
63
|
})]
|
|
64
64
|
});
|
|
65
65
|
};
|
|
66
|
-
var CopyParagraphButton_default = CopyParagraphButton;
|
|
67
66
|
|
|
68
67
|
//#endregion
|
|
69
|
-
exports.
|
|
68
|
+
exports.CopyParagraphButton = CopyParagraphButton;
|
|
70
69
|
//# sourceMappingURL=CopyParagraphButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyParagraphButton.js","names":["IconButton","LinkMedium"],"sources":["../../src/CopyParagraphButton/CopyParagraphButton.tsx"],"sourcesContent":["/**\n * Copyright (c) 2021-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 ReactNode, useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { LinkMedium } from \"@ndla/icons\";\nimport { IconButton } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst ContainerDiv = styled(\"div\", {\n base: {\n position: \"relative\",\n _hover: {\n \"& [data-copy-button]\": {\n opacity: \"1\",\n cursor: \"pointer\",\n },\n },\n },\n});\n\nconst StyledIconButton = styled(IconButton, {\n base: {\n position: \"absolute\",\n left: \"-xxlarge\",\n top: \"-4xsmall\",\n opacity: \"0\",\n cursor: \"pointer\",\n \"&:focus, &:focus-visible, &:active\": {\n opacity: \"1\",\n },\n },\n});\n\ninterface Props {\n // What to render within the h2\n children: ReactNode;\n copyText: string;\n lang?: string;\n}\
|
|
1
|
+
{"version":3,"file":"CopyParagraphButton.js","names":["IconButton","LinkMedium"],"sources":["../../src/CopyParagraphButton/CopyParagraphButton.tsx"],"sourcesContent":["/**\n * Copyright (c) 2021-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 ReactNode, useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { LinkMedium } from \"@ndla/icons\";\nimport { IconButton } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst ContainerDiv = styled(\"div\", {\n base: {\n position: \"relative\",\n _hover: {\n \"& [data-copy-button]\": {\n opacity: \"1\",\n cursor: \"pointer\",\n },\n },\n },\n});\n\nconst StyledIconButton = styled(IconButton, {\n base: {\n position: \"absolute\",\n left: \"-xxlarge\",\n top: \"-4xsmall\",\n opacity: \"0\",\n cursor: \"pointer\",\n \"&:focus, &:focus-visible, &:active\": {\n opacity: \"1\",\n },\n },\n});\n\ninterface Props {\n // What to render within the h2\n children: ReactNode;\n copyText: string;\n lang?: string;\n}\nexport const CopyParagraphButton = ({ children, copyText, lang }: Props) => {\n const [hasCopied, setHasCopied] = useState(false);\n const { t } = useTranslation();\n const sanitizedTitle = useMemo(() => encodeURIComponent(copyText.replace(/ /g, \"-\")), [copyText]);\n\n useEffect(() => {\n if (hasCopied) {\n setTimeout(() => setHasCopied(false), 3000);\n }\n }, [hasCopied]);\n\n const onCopyClick = useCallback(async () => {\n const { location } = window;\n const newHash = `#${sanitizedTitle}`;\n const port = location.port ? `:${location.port}` : \"\";\n const urlToCopy = `${location.protocol}//${location.hostname}${port}${location.pathname}${location.search}${newHash}`;\n try {\n await navigator.clipboard.writeText(urlToCopy);\n setHasCopied(true);\n } catch {\n // do nothing\n }\n }, [sanitizedTitle]);\n\n const tooltip = hasCopied ? t(\"article.copyPageLinkCopied\") : t(\"article.copyHeaderLink\");\n return (\n <ContainerDiv data-embed-type=\"copy-heading\">\n <StyledIconButton\n variant=\"clear\"\n data-copy-button=\"\"\n onClick={onCopyClick}\n title={tooltip}\n aria-label={`${tooltip}: ${copyText}`}\n >\n <LinkMedium />\n </StyledIconButton>\n <h2 id={sanitizedTitle} tabIndex={-1} lang={lang}>\n {children}\n </h2>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seCredits: (authors: {
|
|
|
16
16
|
rightsholders: Author[];
|
|
17
17
|
processors: Author[];
|
|
18
18
|
}) => Author[];
|
|
19
|
-
declare const AudioEmbed: ({ embed, lang }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export
|
|
19
|
+
export declare const AudioEmbed: ({ embed, lang }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
package/lib/Embed/AudioEmbed.js
CHANGED
|
@@ -14,9 +14,9 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
14
14
|
const StyledFigure = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Figure, { base: { clear: "both" } });
|
|
15
15
|
const AudioEmbed = ({ embed, lang }) => {
|
|
16
16
|
const type = embed.embedData.type === "standard" ? "audio" : "podcast";
|
|
17
|
-
if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedErrorPlaceholder.
|
|
17
|
+
if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedErrorPlaceholder.EmbedErrorPlaceholder, { type });
|
|
18
18
|
const { data, embedData } = embed;
|
|
19
|
-
if (embedData.type === "minimal") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AudioPlayer.
|
|
19
|
+
if (embedData.type === "minimal") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AudioPlayer.AudioPlayer, {
|
|
20
20
|
speech: true,
|
|
21
21
|
src: data.audioFile.url,
|
|
22
22
|
title: data.title.title
|
|
@@ -35,7 +35,7 @@ const AudioEmbed = ({ embed, lang }) => {
|
|
|
35
35
|
lang,
|
|
36
36
|
"data-embed-type": type,
|
|
37
37
|
...licenseProps,
|
|
38
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AudioPlayer.
|
|
38
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AudioPlayer.AudioPlayer, {
|
|
39
39
|
description: data.podcastMeta?.introduction ?? "",
|
|
40
40
|
img,
|
|
41
41
|
src: data.audioFile.url,
|
|
@@ -49,8 +49,7 @@ const AudioEmbed = ({ embed, lang }) => {
|
|
|
49
49
|
})]
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
|
-
var AudioEmbed_default = AudioEmbed;
|
|
53
52
|
|
|
54
53
|
//#endregion
|
|
55
|
-
exports.
|
|
54
|
+
exports.AudioEmbed = AudioEmbed;
|
|
56
55
|
//# sourceMappingURL=AudioEmbed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioEmbed.js","names":["Figure","EmbedErrorPlaceholder","AudioPlayer","licenseAttributes","EmbedByline"],"sources":["../../src/Embed/AudioEmbed.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 { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { AudioMetaData } from \"@ndla/types-embed\";\nimport EmbedErrorPlaceholder from \"./EmbedErrorPlaceholder\";\nimport type { Author } from \"./ImageEmbed\";\nimport AudioPlayer from \"../AudioPlayer/AudioPlayer\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nconst StyledFigure = styled(Figure, {\n base: {\n clear: \"both\",\n },\n});\n\ninterface Props {\n embed: AudioMetaData;\n lang?: string;\n}\n\nexport const getFirstNonEmptyLicenseCredits = (authors: {\n creators: Author[];\n rightsholders: Author[];\n processors: Author[];\n}) => Object.values(authors).find((i) => i.length > 0) ?? [];\n\
|
|
1
|
+
{"version":3,"file":"AudioEmbed.js","names":["Figure","EmbedErrorPlaceholder","AudioPlayer","licenseAttributes","EmbedByline"],"sources":["../../src/Embed/AudioEmbed.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 { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { AudioMetaData } from \"@ndla/types-embed\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport type { Author } from \"./ImageEmbed\";\nimport { AudioPlayer } from \"../AudioPlayer/AudioPlayer\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nconst StyledFigure = styled(Figure, {\n base: {\n clear: \"both\",\n },\n});\n\ninterface Props {\n embed: AudioMetaData;\n lang?: string;\n}\n\nexport const getFirstNonEmptyLicenseCredits = (authors: {\n creators: Author[];\n rightsholders: Author[];\n processors: Author[];\n}) => Object.values(authors).find((i) => i.length > 0) ?? [];\n\nexport const AudioEmbed = ({ embed, lang }: Props) => {\n const type = embed.embedData.type === \"standard\" ? \"audio\" : \"podcast\";\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type={type} />;\n }\n\n const { data, embedData } = embed;\n\n if (embedData.type === \"minimal\") {\n return <AudioPlayer speech src={data.audioFile.url} title={data.title.title} />;\n }\n\n const subtitle = data.series ? { title: data.series.title.title, url: `/podkast/${data.series.id}` } : undefined;\n\n const coverPhoto = data.podcastMeta?.coverPhoto;\n\n const img = coverPhoto && { url: coverPhoto.url, alt: coverPhoto.altText };\n\n const licenseProps = licenseAttributes(data.copyright.license.license, lang, embedData.url);\n\n return (\n <StyledFigure lang={lang} data-embed-type={type} {...licenseProps}>\n <AudioPlayer\n description={data.podcastMeta?.introduction ?? \"\"}\n img={img}\n src={data.audioFile.url}\n textVersion={\n data.manuscript?.manuscript.length ? (\n <div dangerouslySetInnerHTML={{ __html: data.manuscript.manuscript }} />\n ) : undefined\n }\n title={data.title.title}\n subtitle={subtitle}\n />\n <EmbedByline\n error={false}\n type={data.audioType === \"standard\" ? \"audio\" : \"podcast\"}\n copyright={embed.data.copyright}\n />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAiBA,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM,EACJ,OAAO,QACR,EACF,CAAC;AAaF,MAAa,cAAc,EAAE,OAAO,WAAkB;CACpD,MAAM,OAAO,MAAM,UAAU,SAAS,aAAa,UAAU;AAC7D,KAAI,MAAM,WAAW,QACnB,QAAO,2CAACC,uDAA4B,OAAQ;CAG9C,MAAM,EAAE,MAAM,cAAc;AAE5B,KAAI,UAAU,SAAS,UACrB,QAAO,2CAACC;EAAY;EAAO,KAAK,KAAK,UAAU;EAAK,OAAO,KAAK,MAAM;GAAS;CAGjF,MAAM,WAAW,KAAK,SAAS;EAAE,OAAO,KAAK,OAAO,MAAM;EAAO,KAAK,YAAY,KAAK,OAAO;EAAM,GAAG;CAEvG,MAAM,aAAa,KAAK,aAAa;CAErC,MAAM,MAAM,cAAc;EAAE,KAAK,WAAW;EAAK,KAAK,WAAW;EAAS;CAE1E,MAAM,eAAeC,4CAAkB,KAAK,UAAU,QAAQ,SAAS,MAAM,UAAU,IAAI;AAE3F,QACE,4CAAC;EAAmB;EAAM,mBAAiB;EAAM,GAAI;aACnD,2CAACD;GACC,aAAa,KAAK,aAAa,gBAAgB;GAC1C;GACL,KAAK,KAAK,UAAU;GACpB,aACE,KAAK,YAAY,WAAW,SAC1B,2CAAC,SAAI,yBAAyB,EAAE,QAAQ,KAAK,WAAW,YAAY,GAAI,GACtE;GAEN,OAAO,KAAK,MAAM;GACR;IACV,EACF,2CAACE;GACC,OAAO;GACP,MAAM,KAAK,cAAc,aAAa,UAAU;GAChD,WAAW,MAAM,KAAK;IACtB;GACW"}
|
|
@@ -14,5 +14,5 @@ interface Props {
|
|
|
14
14
|
}
|
|
15
15
|
export declare const makeIframeString: (url: string, width: string | number, height: string | number, title?: string) => string;
|
|
16
16
|
export declare const isNumeric: (value: any) => boolean;
|
|
17
|
-
declare const BrightcoveEmbed: ({ embed, renderContext, lang }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export
|
|
17
|
+
export declare const BrightcoveEmbed: ({ embed, renderContext, lang }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -51,7 +51,7 @@ const BrightcoveEmbed = ({ embed, renderContext = "article", lang }) => {
|
|
|
51
51
|
iframe.height = "";
|
|
52
52
|
}
|
|
53
53
|
}, []);
|
|
54
|
-
if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedErrorPlaceholder.
|
|
54
|
+
if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedErrorPlaceholder.EmbedErrorPlaceholder, {
|
|
55
55
|
type: "video",
|
|
56
56
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BrightcoveIframe, {
|
|
57
57
|
ref: iframeRef,
|
|
@@ -96,8 +96,7 @@ const BrightcoveEmbed = ({ embed, renderContext = "article", lang }) => {
|
|
|
96
96
|
})]
|
|
97
97
|
});
|
|
98
98
|
};
|
|
99
|
-
var BrightcoveEmbed_default = BrightcoveEmbed;
|
|
100
99
|
|
|
101
100
|
//#endregion
|
|
102
|
-
exports.
|
|
101
|
+
exports.BrightcoveEmbed = BrightcoveEmbed;
|
|
103
102
|
//# sourceMappingURL=BrightcoveEmbed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrightcoveEmbed.js","names":["Button","EmbedErrorPlaceholder","licenseAttributes","Figure","EmbedByline"],"sources":["../../src/Embed/BrightcoveEmbed.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 { useEffect, useMemo, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Button, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { BrightcoveEmbedData, BrightcoveMetaData, BrightcoveVideoSource } from \"@ndla/types-embed\";\nimport EmbedErrorPlaceholder from \"./EmbedErrorPlaceholder\";\nimport type { RenderContext } from \"./types\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\ninterface Props {\n embed: BrightcoveMetaData;\n renderContext?: RenderContext;\n lang?: string;\n}\n\nconst LinkedVideoButton = styled(Button, {\n base: {\n marginBlockStart: \"3xsmall\",\n },\n});\n\nconst BrightcoveIframe = styled(\"iframe\", {\n base: {\n border: 0,\n height: \"auto\",\n width: \"100%\",\n },\n});\n\nexport const makeIframeString = (url: string, width: string | number, height: string | number, title = \"\") => {\n const strippedWidth = typeof width === \"number\" ? width : width.replace(/\\s*px/, \"\");\n const strippedHeight = typeof height === \"number\" ? height : height.replace(/\\s*px/, \"\");\n const urlOrTitle = title || url;\n return `<iframe title=\"${urlOrTitle}\" aria-label=\"${urlOrTitle}\" src=\"${url}\" width=\"${strippedWidth}\" height=\"${strippedHeight}\" allowfullscreen scrolling=\"no\" frameborder=\"0\" loading=\"lazy\"></iframe>`;\n};\n\nexport const isNumeric = (value: any) => !Number.isNaN(value - Number.parseFloat(value));\n\nconst getIframeProps = (data: BrightcoveEmbedData, sources: BrightcoveVideoSource[]) => {\n const { account, videoid, player = \"default\" } = data;\n\n const source = sources.filter((s) => s.width && s.height).toSorted((a, b) => a!.height! - b.height!)[0];\n\n return {\n src: `https://players.brightcove.net/${account}/${player}_default/index.html?videoId=${videoid}`,\n height: source?.height ?? \"480\",\n width: source?.width ?? \"640\",\n };\n};\
|
|
1
|
+
{"version":3,"file":"BrightcoveEmbed.js","names":["Button","EmbedErrorPlaceholder","licenseAttributes","Figure","EmbedByline"],"sources":["../../src/Embed/BrightcoveEmbed.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 { useEffect, useMemo, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Button, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { BrightcoveEmbedData, BrightcoveMetaData, BrightcoveVideoSource } from \"@ndla/types-embed\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport type { RenderContext } from \"./types\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\ninterface Props {\n embed: BrightcoveMetaData;\n renderContext?: RenderContext;\n lang?: string;\n}\n\nconst LinkedVideoButton = styled(Button, {\n base: {\n marginBlockStart: \"3xsmall\",\n },\n});\n\nconst BrightcoveIframe = styled(\"iframe\", {\n base: {\n border: 0,\n height: \"auto\",\n width: \"100%\",\n },\n});\n\nexport const makeIframeString = (url: string, width: string | number, height: string | number, title = \"\") => {\n const strippedWidth = typeof width === \"number\" ? width : width.replace(/\\s*px/, \"\");\n const strippedHeight = typeof height === \"number\" ? height : height.replace(/\\s*px/, \"\");\n const urlOrTitle = title || url;\n return `<iframe title=\"${urlOrTitle}\" aria-label=\"${urlOrTitle}\" src=\"${url}\" width=\"${strippedWidth}\" height=\"${strippedHeight}\" allowfullscreen scrolling=\"no\" frameborder=\"0\" loading=\"lazy\"></iframe>`;\n};\n\nexport const isNumeric = (value: any) => !Number.isNaN(value - Number.parseFloat(value));\n\nconst getIframeProps = (data: BrightcoveEmbedData, sources: BrightcoveVideoSource[]) => {\n const { account, videoid, player = \"default\" } = data;\n\n const source = sources.filter((s) => s.width && s.height).toSorted((a, b) => a!.height! - b.height!)[0];\n\n return {\n src: `https://players.brightcove.net/${account}/${player}_default/index.html?videoId=${videoid}`,\n height: source?.height ?? \"480\",\n width: source?.width ?? \"640\",\n };\n};\nexport const BrightcoveEmbed = ({ embed, renderContext = \"article\", lang }: Props) => {\n const [showOriginalVideo, setShowOriginalVideo] = useState(true);\n const { t } = useTranslation();\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const { embedData } = embed;\n const fallbackTitle = `${t(\"embed.type.video\")}: ${embedData.videoid}`;\n const parsedDescription = useMemo(() => {\n if (embed.embedData.caption || renderContext === \"article\") {\n return embed.embedData.caption ? parse(embed.embedData.caption) : undefined;\n } else if (embed.status === \"success\" && embed.data.description) {\n return parse(embed.data.description);\n }\n }, [embed, renderContext]);\n\n useEffect(() => {\n const iframe = iframeRef.current;\n if (iframe) {\n const [width, height] = [parseInt(iframe.width), parseInt(iframe.height)];\n iframe.style.aspectRatio = `${width}/${height}`;\n iframe.width = \"\";\n iframe.height = \"\";\n }\n }, []);\n if (embed.status === \"error\") {\n return (\n <EmbedErrorPlaceholder type=\"video\">\n <BrightcoveIframe\n ref={iframeRef}\n title={embedData.alt || fallbackTitle}\n aria-label={embedData.alt || fallbackTitle}\n {...getIframeProps(embedData, [])}\n allow=\"fullscreen; encrypted-media\"\n />\n </EmbedErrorPlaceholder>\n );\n }\n const { data } = embed;\n\n const linkedVideoId = isNumeric(data.link?.text) ? data.link?.text : undefined;\n\n const originalVideoProps = getIframeProps(embedData, data.sources);\n const alternativeVideoProps = linkedVideoId\n ? getIframeProps({ ...embedData, videoid: linkedVideoId }, data.sources)\n : undefined;\n\n const licenseProps = licenseAttributes(data?.copyright?.license.license, lang, embedData.pageUrl);\n\n const title = data.name?.trim() ? `${t(\"embed.type.video\")}: ${data.name}` : fallbackTitle;\n\n return (\n <Figure data-embed-type=\"brightcove\" {...licenseProps}>\n <div className=\"brightcove-video\">\n <BrightcoveIframe\n ref={iframeRef}\n className=\"original\"\n title={title}\n aria-label={title}\n {...(alternativeVideoProps && !showOriginalVideo ? alternativeVideoProps : originalVideoProps)}\n allow=\"fullscreen; encrypted-media\"\n />\n </div>\n <EmbedByline type=\"video\" copyright={data.copyright!} description={parsedDescription}>\n <div>\n {!!linkedVideoId && (\n <LinkedVideoButton size=\"small\" variant=\"secondary\" onClick={() => setShowOriginalVideo((p) => !p)}>\n {t(`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|
|
9
9
|
interface Props {
|
|
10
10
|
embed: CodeMetaData;
|
|
11
11
|
}
|
|
12
|
-
declare const CodeEmbed: ({ embed }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export
|
|
12
|
+
export declare const CodeEmbed: ({ embed }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
package/lib/Embed/CodeEmbed.js
CHANGED
|
@@ -39,12 +39,12 @@ const CodeEmbed = ({ embed }) => {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
}, [isCopied]);
|
|
42
|
-
if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedErrorPlaceholder.
|
|
42
|
+
if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedErrorPlaceholder.EmbedErrorPlaceholder, { type: "code" });
|
|
43
43
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledFigure, {
|
|
44
44
|
"data-embed-type": "code-block",
|
|
45
45
|
children: [
|
|
46
46
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledFigCaption, { children: embed.embedData.title || getTitleFromFormat(embed.embedData.codeFormat) }),
|
|
47
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CodeBlock.
|
|
47
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CodeBlock.CodeBlock, {
|
|
48
48
|
highlightedCode: embed.status === "success" ? embed.data.highlightedCode : "",
|
|
49
49
|
format: embed.embedData.codeFormat
|
|
50
50
|
}),
|
|
@@ -61,8 +61,7 @@ const CodeEmbed = ({ embed }) => {
|
|
|
61
61
|
]
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
|
-
var CodeEmbed_default = CodeEmbed;
|
|
65
64
|
|
|
66
65
|
//#endregion
|
|
67
|
-
exports.
|
|
66
|
+
exports.CodeEmbed = CodeEmbed;
|
|
68
67
|
//# sourceMappingURL=CodeEmbed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEmbed.js","names":["Figure","codeLanguageOptions","EmbedErrorPlaceholder","CodeBlock","Button","CheckLine","FileCopyLine"],"sources":["../../src/Embed/CodeEmbed.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 { useEffect, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { FileCopyLine, CheckLine } from \"@ndla/icons\";\nimport { Button, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CodeMetaData } from \"@ndla/types-embed\";\nimport EmbedErrorPlaceholder from \"./EmbedErrorPlaceholder\";\nimport CodeBlock from \"../CodeBlock/CodeBlock\";\nimport { codeLanguageOptions, type ICodeLangugeOption } from \"../CodeBlock/codeLanguageOptions\";\n\ninterface Props {\n embed: CodeMetaData;\n}\n\nconst StyledFigCaption = styled(\"figcaption\", {\n base: {\n textStyle: \"label.large\",\n fontWeight: \"bold\",\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n clear: \"both\",\n // We apply margin here to allow for the float and size props on figure to work as intended.\n \"& > *:not(:where(:first-child))\": {\n marginBlockStart: \"xsmall\",\n },\n },\n});\n\nconst getTitleFromFormat = (format: string) => {\n const selectedLanguage = codeLanguageOptions.find((item: ICodeLangugeOption) => item.format === format);\n if (selectedLanguage) {\n return selectedLanguage.title;\n }\n return;\n};\n\
|
|
1
|
+
{"version":3,"file":"CodeEmbed.js","names":["Figure","codeLanguageOptions","EmbedErrorPlaceholder","CodeBlock","Button","CheckLine","FileCopyLine"],"sources":["../../src/Embed/CodeEmbed.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 { useEffect, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { FileCopyLine, CheckLine } from \"@ndla/icons\";\nimport { Button, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CodeMetaData } from \"@ndla/types-embed\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport { CodeBlock } from \"../CodeBlock/CodeBlock\";\nimport { codeLanguageOptions, type ICodeLangugeOption } from \"../CodeBlock/codeLanguageOptions\";\n\ninterface Props {\n embed: CodeMetaData;\n}\n\nconst StyledFigCaption = styled(\"figcaption\", {\n base: {\n textStyle: \"label.large\",\n fontWeight: \"bold\",\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n clear: \"both\",\n // We apply margin here to allow for the float and size props on figure to work as intended.\n \"& > *:not(:where(:first-child))\": {\n marginBlockStart: \"xsmall\",\n },\n },\n});\n\nconst getTitleFromFormat = (format: string) => {\n const selectedLanguage = codeLanguageOptions.find((item: ICodeLangugeOption) => item.format === format);\n if (selectedLanguage) {\n return selectedLanguage.title;\n }\n return;\n};\n\nexport const CodeEmbed = ({ embed }: Props) => {\n const [isCopied, setIsCopied] = useState(false);\n const { t } = useTranslation();\n\n useEffect(() => {\n if (isCopied) {\n const timer = setInterval(() => setIsCopied(false), 3000);\n // ensure interval is cleared - also if unmounted\n return () => {\n clearTimeout(timer);\n };\n }\n }, [isCopied]);\n\n if (embed.status === \"error\") {\n return <EmbedErrorPlaceholder type=\"code\" />;\n }\n\n return (\n <StyledFigure data-embed-type=\"code-block\">\n <StyledFigCaption>{embed.embedData.title || getTitleFromFormat(embed.embedData.codeFormat)}</StyledFigCaption>\n <CodeBlock\n highlightedCode={embed.status === \"success\" ? embed.data.highlightedCode : \"\"}\n format={embed.embedData.codeFormat}\n />\n <Button\n variant=\"secondary\"\n onClick={async () => {\n if (embed.status === \"success\") {\n try {\n await navigator.clipboard.writeText(embed.data.decodedContent);\n setIsCopied(true);\n } catch {\n // do nothing\n }\n }\n }}\n >\n {isCopied ? <CheckLine /> : <FileCopyLine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ed = ({ embed, renderContext, lang, previewAlt, children }) => {
|
|
|
29
29
|
}, [embed]);
|
|
30
30
|
const parsedTitle = (0, react.useMemo)(() => embed.status === "success" ? (0, html_react_parser.default)(embed.data.concept.title.htmlTitle) : void 0, [embed]);
|
|
31
31
|
if (embed.status === "error" && embed.embedData.type === "inline") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children });
|
|
32
|
-
if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedErrorPlaceholder.
|
|
32
|
+
if (embed.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmbedErrorPlaceholder.EmbedErrorPlaceholder, { type: "gloss" });
|
|
33
33
|
const { concept, visualElement } = embed.data;
|
|
34
34
|
if (embed.data.concept.glossData) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_GlossEmbed.GlossEmbed, { embed });
|
|
35
35
|
if (embed.embedData.type === "inline") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InlineConcept, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConceptEmbed.js","names":["PopoverContent","EmbedErrorPlaceholder","GlossEmbed","PopoverRoot","PopoverTrigger","ConceptInlineTriggerButton","Portal","Concept"],"sources":["../../src/Embed/ConceptEmbed.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 parse from \"html-react-parser\";\nimport { forwardRef, useMemo, useRef, type ReactNode } from \"react\";\nimport { Portal } from \"@ark-ui/react\";\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { ConceptMetaData } from \"@ndla/types-embed\";\nimport { ConceptInlineTriggerButton } from \"./ConceptInlineTriggerButton\";\nimport EmbedErrorPlaceholder from \"./EmbedErrorPlaceholder\";\nimport { GlossEmbed } from \"./GlossEmbed\";\nimport type { RenderContext } from \"./types\";\nimport { Concept, type ConceptProps } from \"../Concept/Concept\";\n\ninterface BaseProps {\n renderContext?: RenderContext;\n lang?: string;\n previewAlt?: boolean;\n}\n\ninterface Props extends BaseProps {\n embed: ConceptMetaData;\n children?: ReactNode;\n}\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n width: \"surface.xlarge\",\n maxHeight: \"50vh\",\n overflowY: \"auto\",\n },\n});\n\nexport const ConceptEmbed = ({ embed, renderContext, lang, previewAlt, children }: Props) => {\n const parsedContent = useMemo(() => {\n if (embed.status === \"error\" || !embed.data.concept.content) return undefined;\n return parse(embed.data.concept.content.htmlContent);\n }, [embed]);\n\n const parsedTitle = useMemo(\n () => (embed.status === \"success\" ? parse(embed.data.concept.title.htmlTitle) : undefined),\n [embed],\n );\n\n if (embed.status === \"error\" && embed.embedData.type === \"inline\") {\n return <span>{children}</span>;\n }\n if (embed.status === \"error\") {\n // TODO: This could be either concept or gloss. We don't know if it errors out. :)\n return <EmbedErrorPlaceholder type=\"gloss\" />;\n }\n\n const { concept, visualElement } = embed.data;\n\n // TODO: Consider whether we should do this in article-converter instead.\n if (embed.data.concept.glossData) {\n return <GlossEmbed embed={embed} />;\n }\n\n if (embed.embedData.type === \"inline\") {\n return (\n <InlineConcept\n previewAlt={previewAlt}\n linkContent={children}\n copyright={concept.copyright}\n visualElement={visualElement}\n lang={lang}\n title={parsedTitle}\n source={concept.source}\n >\n {parsedContent}\n </InlineConcept>\n );\n }\n\n return (\n <BlockConcept\n previewAlt={previewAlt}\n copyright={concept.copyright}\n visualElement={visualElement}\n lang={lang}\n title={renderContext === \"embed\" ? undefined : parsedTitle}\n source={concept.source}\n >\n {parsedContent}\n </BlockConcept>\n );\n};\n\nexport interface InlineConceptProps extends ConceptProps, BaseProps {\n linkContent?: ReactNode;\n source?: string;\n}\n\nexport const InlineConcept = forwardRef<HTMLSpanElement, InlineConceptProps>(\n ({ linkContent, copyright, visualElement, previewAlt, lang, children, title, source, ...rest }, ref) => {\n const contentRef = useRef<HTMLDivElement>(null);\n return (\n <PopoverRoot initialFocusEl={() => contentRef.current}>\n {/* @ts-expect-error placing ref and rest on popover trigger somehow removes a bug where the popover target becomes a bit bigger */}\n <PopoverTrigger asChild ref={ref} {...rest}>\n <ConceptInlineTriggerButton>{linkContent}</ConceptInlineTriggerButton>\n </PopoverTrigger>\n <Portal>\n <StyledPopoverContent ref={contentRef}>\n <Concept\n copyright={copyright}\n visualElement={visualElement}\n title={title}\n lang={lang}\n source={source}\n previewAlt={previewAlt}\n >\n {children}\n </Concept>\n </StyledPopoverContent>\n </Portal>\n </PopoverRoot>\n );\n },\n);\n\nexport interface BlockConceptProps extends ConceptProps {}\n\nexport const BlockConcept = forwardRef<HTMLElement, BlockConceptProps>((props, ref) => (\n <Concept {...props} data-embed-type=\"concept\" ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+BA,MAAM,4DAA8BA,kCAAgB,EAClD,MAAM;CACJ,OAAO;CACP,WAAW;CACX,WAAW;CACZ,EACF,CAAC;AAEF,MAAa,gBAAgB,EAAE,OAAO,eAAe,MAAM,YAAY,eAAsB;CAC3F,MAAM,yCAA8B;AAClC,MAAI,MAAM,WAAW,WAAW,CAAC,MAAM,KAAK,QAAQ,QAAS,QAAO;AACpE,wCAAa,MAAM,KAAK,QAAQ,QAAQ,YAAY;IACnD,CAAC,MAAM,CAAC;CAEX,MAAM,uCACG,MAAM,WAAW,2CAAkB,MAAM,KAAK,QAAQ,MAAM,UAAU,GAAG,QAChF,CAAC,MAAM,CACR;AAED,KAAI,MAAM,WAAW,WAAW,MAAM,UAAU,SAAS,SACvD,QAAO,2CAAC,UAAM,WAAgB;AAEhC,KAAI,MAAM,WAAW,QAEnB,QAAO,2CAACC,
|
|
1
|
+
{"version":3,"file":"ConceptEmbed.js","names":["PopoverContent","EmbedErrorPlaceholder","GlossEmbed","PopoverRoot","PopoverTrigger","ConceptInlineTriggerButton","Portal","Concept"],"sources":["../../src/Embed/ConceptEmbed.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 parse from \"html-react-parser\";\nimport { forwardRef, useMemo, useRef, type ReactNode } from \"react\";\nimport { Portal } from \"@ark-ui/react\";\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { ConceptMetaData } from \"@ndla/types-embed\";\nimport { ConceptInlineTriggerButton } from \"./ConceptInlineTriggerButton\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport { GlossEmbed } from \"./GlossEmbed\";\nimport type { RenderContext } from \"./types\";\nimport { Concept, type ConceptProps } from \"../Concept/Concept\";\n\ninterface BaseProps {\n renderContext?: RenderContext;\n lang?: string;\n previewAlt?: boolean;\n}\n\ninterface Props extends BaseProps {\n embed: ConceptMetaData;\n children?: ReactNode;\n}\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n width: \"surface.xlarge\",\n maxHeight: \"50vh\",\n overflowY: \"auto\",\n },\n});\n\nexport const ConceptEmbed = ({ embed, renderContext, lang, previewAlt, children }: Props) => {\n const parsedContent = useMemo(() => {\n if (embed.status === \"error\" || !embed.data.concept.content) return undefined;\n return parse(embed.data.concept.content.htmlContent);\n }, [embed]);\n\n const parsedTitle = useMemo(\n () => (embed.status === \"success\" ? parse(embed.data.concept.title.htmlTitle) : undefined),\n [embed],\n );\n\n if (embed.status === \"error\" && embed.embedData.type === \"inline\") {\n return <span>{children}</span>;\n }\n if (embed.status === \"error\") {\n // TODO: This could be either concept or gloss. We don't know if it errors out. :)\n return <EmbedErrorPlaceholder type=\"gloss\" />;\n }\n\n const { concept, visualElement } = embed.data;\n\n // TODO: Consider whether we should do this in article-converter instead.\n if (embed.data.concept.glossData) {\n return <GlossEmbed embed={embed} />;\n }\n\n if (embed.embedData.type === \"inline\") {\n return (\n <InlineConcept\n previewAlt={previewAlt}\n linkContent={children}\n copyright={concept.copyright}\n visualElement={visualElement}\n lang={lang}\n title={parsedTitle}\n source={concept.source}\n >\n {parsedContent}\n </InlineConcept>\n );\n }\n\n return (\n <BlockConcept\n previewAlt={previewAlt}\n copyright={concept.copyright}\n visualElement={visualElement}\n lang={lang}\n title={renderContext === \"embed\" ? undefined : parsedTitle}\n source={concept.source}\n >\n {parsedContent}\n </BlockConcept>\n );\n};\n\nexport interface InlineConceptProps extends ConceptProps, BaseProps {\n linkContent?: ReactNode;\n source?: string;\n}\n\nexport const InlineConcept = forwardRef<HTMLSpanElement, InlineConceptProps>(\n ({ linkContent, copyright, visualElement, previewAlt, lang, children, title, source, ...rest }, ref) => {\n const contentRef = useRef<HTMLDivElement>(null);\n return (\n <PopoverRoot initialFocusEl={() => contentRef.current}>\n {/* @ts-expect-error placing ref and rest on popover trigger somehow removes a bug where the popover target becomes a bit bigger */}\n <PopoverTrigger asChild ref={ref} {...rest}>\n <ConceptInlineTriggerButton>{linkContent}</ConceptInlineTriggerButton>\n </PopoverTrigger>\n <Portal>\n <StyledPopoverContent ref={contentRef}>\n <Concept\n copyright={copyright}\n visualElement={visualElement}\n title={title}\n lang={lang}\n source={source}\n previewAlt={previewAlt}\n >\n {children}\n </Concept>\n </StyledPopoverContent>\n </Portal>\n </PopoverRoot>\n );\n },\n);\n\nexport interface BlockConceptProps extends ConceptProps {}\n\nexport const BlockConcept = forwardRef<HTMLElement, BlockConceptProps>((props, ref) => (\n <Concept {...props} data-embed-type=\"concept\" ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+BA,MAAM,4DAA8BA,kCAAgB,EAClD,MAAM;CACJ,OAAO;CACP,WAAW;CACX,WAAW;CACZ,EACF,CAAC;AAEF,MAAa,gBAAgB,EAAE,OAAO,eAAe,MAAM,YAAY,eAAsB;CAC3F,MAAM,yCAA8B;AAClC,MAAI,MAAM,WAAW,WAAW,CAAC,MAAM,K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
}
|
|
15
|
-
declare const ContentLinkEmbed: ({ embed, isOembed, children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export
|
|
15
|
+
export declare const ContentLinkEmbed: ({ embed, isOembed, children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -28,8 +28,7 @@ const ContentLinkEmbed = ({ embed, isOembed, children }) => {
|
|
|
28
28
|
children
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
|
-
var ContentLinkEmbed_default = ContentLinkEmbed;
|
|
32
31
|
|
|
33
32
|
//#endregion
|
|
34
|
-
exports.
|
|
33
|
+
exports.ContentLinkEmbed = ContentLinkEmbed;
|
|
35
34
|
//# sourceMappingURL=ContentLinkEmbed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentLinkEmbed.js","names":["Text"],"sources":["../../src/Embed/ContentLinkEmbed.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 type { ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Text } from \"@ndla/primitives\";\nimport type { ContentLinkMetaData } from \"@ndla/types-embed\";\n\ninterface Props {\n embed: ContentLinkMetaData;\n isOembed?: boolean;\n children?: ReactNode;\n}\n\
|
|
1
|
+
{"version":3,"file":"ContentLinkEmbed.js","names":["Text"],"sources":["../../src/Embed/ContentLinkEmbed.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 type { ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Text } from \"@ndla/primitives\";\nimport type { ContentLinkMetaData } from \"@ndla/types-embed\";\n\ninterface Props {\n embed: ContentLinkMetaData;\n isOembed?: boolean;\n children?: ReactNode;\n}\n\nexport const ContentLinkEmbed = ({ embed, isOembed, children }: Props) => {\n const { t } = useTranslation();\n if (embed.status === \"error\") {\n return (\n <Text color=\"text.error\" asChild consumeCss>\n <span>\n <span>{`${t(\"embed.linkError\")}: `}</span>\n {children}\n </span>\n </Text>\n );\n }\n\n const { embedData, data } = embed;\n\n if (embedData.openIn === \"new-context\" || isOembed) {\n return (\n <a href={data.path} data-embed-type=\"content-link\" target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n }\n\n return <a href={data.path}>{children}</a>;\n};\n"],"mappings":";;;;;;;;;AAmBA,MAAa,oBAAoB,EAAE,OAAO,UAAU,eAAsB;CACxE,MAAM,EAAE,yCAAsB;AAC9B,KAAI,MAAM,WAAW,QACnB,QACE,2CAACA;EAAK,OAAM;EAAa;EAAQ;YAC/B,4CAAC,qBACC,2CAAC,oBAAM,GAAG,EAAE,kBAAkB,CAAC,MAAW,EACzC,YACI;GACF;CAIX,MAAM,EAAE,WAAW,SAAS;AAE5B,KAAI,UAAU,WAAW,iBAAiB,SACxC,QACE,2CAAC;EAAE,MAAM,KAAK;EAAM,mBAAgB;EAAe,QAAO;EAAS,KAAI;EACpE;GACC;AAIR,QAAO,2CAAC;EAAE,MAAM,KAAK;EAAO;GAAa"}
|
|
@@ -11,5 +11,5 @@ interface Props {
|
|
|
11
11
|
embed: CopyrightMetaData;
|
|
12
12
|
children?: ReactNode;
|
|
13
13
|
}
|
|
14
|
-
declare const CopyrightEmbed: ({ embed, children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export
|
|
14
|
+
export declare const CopyrightEmbed: ({ embed, children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -19,8 +19,7 @@ const CopyrightEmbed = ({ embed, children }) => {
|
|
|
19
19
|
})]
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
|
-
var CopyrightEmbed_default = CopyrightEmbed;
|
|
23
22
|
|
|
24
23
|
//#endregion
|
|
25
|
-
exports.
|
|
24
|
+
exports.CopyrightEmbed = CopyrightEmbed;
|
|
26
25
|
//# sourceMappingURL=CopyrightEmbed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyrightEmbed.js","names":["EmbedByline"],"sources":["../../src/Embed/CopyrightEmbed.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 { ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CopyrightMetaData } from \"@ndla/types-embed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\n\ninterface Props {\n embed: CopyrightMetaData;\n children?: ReactNode;\n}\n\nconst StyledCopyrightContent = styled(\"div\", {\n base: {\n marginBlockEnd: \"xsmall\",\n },\n});\n\
|
|
1
|
+
{"version":3,"file":"CopyrightEmbed.js","names":["EmbedByline"],"sources":["../../src/Embed/CopyrightEmbed.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 { ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { CopyrightMetaData } from \"@ndla/types-embed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\n\ninterface Props {\n embed: CopyrightMetaData;\n children?: ReactNode;\n}\n\nconst StyledCopyrightContent = styled(\"div\", {\n base: {\n marginBlockEnd: \"xsmall\",\n },\n});\n\nexport const CopyrightEmbed = ({ embed, children }: Props) => {\n return (\n <figure data-embed-type=\"copyright\">\n <StyledCopyrightContent data-copyright-content=\"\">{children}</StyledCopyrightContent>\n <EmbedByline type=\"copyright\" copyright={embed.embedData.copyright} />\n </figure>\n );\n};\n"],"mappings":";;;;;;;;AAkBA,MAAM,8DAAgC,OAAO,EAC3C,MAAM,EACJ,gBAAgB,UACjB,EACF,CAAC;AAEF,MAAa,kBAAkB,EAAE,OAAO,eAAsB;AAC5D,QACE,4CAAC;EAAO,mBAAgB;aACtB,2CAAC;GAAuB,0BAAuB;GAAI;IAAkC,EACrF,2CAACA;GAAY,MAAK;GAAY,WAAW,MAAM,UAAU;IAAa;GAC/D"}
|
|
@@ -14,5 +14,5 @@ interface Props {
|
|
|
14
14
|
float?: FigureFloat;
|
|
15
15
|
children?: ReactNode;
|
|
16
16
|
}
|
|
17
|
-
declare const EmbedErrorPlaceholder: ({ type, children, figureType, float }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export
|
|
17
|
+
export declare const EmbedErrorPlaceholder: ({ type, children, figureType, float }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -42,8 +42,7 @@ const EmbedErrorPlaceholder = ({ type, children, figureType, float }) => {
|
|
|
42
42
|
})]
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
|
-
var EmbedErrorPlaceholder_default = EmbedErrorPlaceholder;
|
|
46
45
|
|
|
47
46
|
//#endregion
|
|
48
|
-
exports.
|
|
47
|
+
exports.EmbedErrorPlaceholder = EmbedErrorPlaceholder;
|
|
49
48
|
//# sourceMappingURL=EmbedErrorPlaceholder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbedErrorPlaceholder.js","names":["Figure","ErrorWarningLine","EmbedByline"],"sources":["../../src/Embed/EmbedErrorPlaceholder.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 { type ReactNode } from \"react\";\nimport { ErrorWarningLine } from \"@ndla/icons\";\nimport { Figure, type FigureFloat, type FigureSize } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { EmbedByline, type EmbedBylineErrorProps } from \"../LicenseByline/EmbedByline\";\n\ninterface Props {\n type: EmbedBylineErrorProps[\"type\"];\n figureType?: FigureSize;\n float?: FigureFloat;\n children?: ReactNode;\n}\n\nconst ErrorPlaceholder = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"background.subtle\",\n height: \"surface.xsmall\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n \"& svg\": {\n height: \"5xlarge\",\n width: \"5xlarge\",\n fill: \"stroke.default\",\n },\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& > *:not(:first-child)\": {\n marginBlockStart: \"3xsmall\",\n },\n },\n});\n\
|
|
1
|
+
{"version":3,"file":"EmbedErrorPlaceholder.js","names":["Figure","ErrorWarningLine","EmbedByline"],"sources":["../../src/Embed/EmbedErrorPlaceholder.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 { type ReactNode } from \"react\";\nimport { ErrorWarningLine } from \"@ndla/icons\";\nimport { Figure, type FigureFloat, type FigureSize } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { EmbedByline, type EmbedBylineErrorProps } from \"../LicenseByline/EmbedByline\";\n\ninterface Props {\n type: EmbedBylineErrorProps[\"type\"];\n figureType?: FigureSize;\n float?: FigureFloat;\n children?: ReactNode;\n}\n\nconst ErrorPlaceholder = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"background.subtle\",\n height: \"surface.xsmall\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n \"& svg\": {\n height: \"5xlarge\",\n width: \"5xlarge\",\n fill: \"stroke.default\",\n },\n },\n});\n\nconst StyledFigure = styled(Figure, {\n base: {\n \"& > *:not(:first-child)\": {\n marginBlockStart: \"3xsmall\",\n },\n },\n});\n\nexport const EmbedErrorPlaceholder = ({ type, children, figureType, float }: Props) => {\n return (\n <StyledFigure size={figureType} float={float} data-embed-type={type}>\n {children ?? (\n <ErrorPlaceholder data-embed-type={type}>\n <ErrorWarningLine />\n </ErrorPlaceholder>\n )}\n <EmbedByline error type={type} />\n </StyledFigure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAM,wDAA0B,OAAO,EACrC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,QAAQ;CACR,aAAa;CACb,cAAc;CACd,SAAS;EACP,QAAQ;EACR,OAAO;EACP,MAAM;EACP;CACF,EACF,CAAC;AAEF,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM,EACJ,2BAA2B,EACzB,kBAAkB,WACnB,EACF,EACF,CAAC;AAEF,MAAa,yBAAyB,EAAE,MAAM,UAAU,YAAY,YAAmB;AACrF,QACE,4CAAC;EAAa,MAAM;EAAmB;EAAO,mBAAiB;aAC5D,YACC,2CAAC;GAAiB,mBAAiB;aACjC,2CAACC,kCAAmB;IACH,EAErB,2CAACC;GAAY;GAAY;IAAQ;GACpB"}
|
|
@@ -9,5 +9,5 @@ import type { OembedMetaData } from "@ndla/types-embed";
|
|
|
9
9
|
interface Props {
|
|
10
10
|
embed: OembedMetaData;
|
|
11
11
|
}
|
|
12
|
-
declare const ExternalEmbed: ({ embed }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export
|
|
12
|
+
export declare const ExternalEmbed: ({ embed }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|