@ndla/ui 56.0.129-alpha.0 → 56.0.131-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/Embed/ConceptEmbed.js +5 -5
- package/es/Embed/ConceptEmbed.js.map +1 -1
- package/es/Embed/GlossEmbed.js +3 -3
- package/es/Embed/GlossEmbed.js.map +1 -1
- package/lib/Article/Article.js +4 -4
- package/lib/Article/ArticleByline.js +2 -2
- package/lib/Article/ArticleByline.js.map +1 -1
- package/lib/AudioPlayer/AudioPlayer.js +4 -4
- package/lib/AudioPlayer/index.js +2 -2
- package/lib/Breadcrumb/Breadcrumb.js +2 -2
- package/lib/Breadcrumb/HomeBreadcrumb.js +2 -2
- package/lib/Breadcrumb/index.js +3 -3
- package/lib/CampaignBlock/CampaignBlock.js +2 -2
- package/lib/CampaignBlock/CampaignBlock.js.map +1 -1
- package/lib/Concept/Concept.js +11 -11
- package/lib/Concept/Concept.js.map +1 -1
- package/lib/ContactBlock/ContactBlock.js +2 -2
- package/lib/ContentTypeBadge/ContentTypeBadge.js +20 -20
- package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -1
- package/lib/ContentTypeHero/ContentTypeHero.js +20 -20
- package/lib/ContentTypeHero/ContentTypeHero.js.map +1 -1
- package/lib/CopyParagraphButton/index.js +2 -2
- package/lib/Embed/AudioEmbed.js +9 -9
- package/lib/Embed/AudioEmbed.js.map +1 -1
- package/lib/Embed/BrightcoveEmbed.js +6 -6
- package/lib/Embed/BrightcoveEmbed.js.map +1 -1
- package/lib/Embed/CodeEmbed.js +6 -6
- package/lib/Embed/CodeEmbed.js.map +1 -1
- package/lib/Embed/ConceptEmbed.d.ts +4 -2
- package/lib/Embed/ConceptEmbed.js +13 -13
- package/lib/Embed/ConceptEmbed.js.map +1 -1
- package/lib/Embed/ConceptInlineTriggerButton.js +2 -2
- package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -1
- package/lib/Embed/CopyrightEmbed.js +2 -2
- package/lib/Embed/EmbedErrorPlaceholder.js +2 -2
- package/lib/Embed/ExternalEmbed.js +4 -4
- package/lib/Embed/ExternalEmbed.js.map +1 -1
- package/lib/Embed/GlossEmbed.d.ts +3 -1
- package/lib/Embed/GlossEmbed.js +9 -9
- package/lib/Embed/GlossEmbed.js.map +1 -1
- package/lib/Embed/H5pEmbed.js +2 -2
- package/lib/Embed/H5pEmbed.js.map +1 -1
- package/lib/Embed/IframeEmbed.js +4 -4
- package/lib/Embed/IframeEmbed.js.map +1 -1
- package/lib/Embed/ImageEmbed.js +6 -6
- package/lib/Embed/ImageEmbed.js.map +1 -1
- package/lib/Embed/RelatedContentEmbed.js +6 -6
- package/lib/Embed/RelatedContentEmbed.js.map +1 -1
- package/lib/ErrorMessage/index.js +2 -2
- package/lib/FactBox/index.js +2 -2
- package/lib/FileList/File.js +2 -2
- package/lib/FileList/File.js.map +1 -1
- package/lib/Gloss/Gloss.js +4 -4
- package/lib/LicenseByline/EmbedByline.js +2 -2
- package/lib/LinkBlock/LinkBlock.js +2 -2
- package/lib/LinkBlock/LinkBlock.js.map +1 -1
- package/lib/Pitch/Pitch.js +2 -2
- package/lib/Pitch/Pitch.js.map +1 -1
- package/lib/RelatedArticleList/RelatedArticleList.js +4 -4
- package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -1
- package/lib/RelatedArticleList/index.js +2 -2
- package/lib/i18n/i18n.js +8 -8
- package/lib/i18n/i18n.js.map +1 -1
- package/lib/index.js +156 -156
- package/lib/locale/messages-en.js +2 -2
- package/lib/locale/messages-nb.js +2 -2
- package/lib/locale/messages-nn.js +2 -2
- package/lib/locale/messages-se.js +2 -2
- package/lib/model/index.js +10 -10
- package/lib/utils/relativeUrl.js +2 -2
- package/lib/utils/relativeUrl.js.map +1 -1
- package/package.json +7 -7
- package/src/Embed/ConceptEmbed.stories.tsx +5 -2
- package/src/Embed/ConceptEmbed.tsx +8 -7
- package/src/Embed/GlossEmbed.stories.tsx +5 -2
- package/src/Embed/GlossEmbed.tsx +5 -4
package/es/Embed/ConceptEmbed.js
CHANGED
|
@@ -15,19 +15,19 @@ const StyledPopoverContent = styled(PopoverContent, { base: {
|
|
|
15
15
|
maxHeight: "50vh",
|
|
16
16
|
overflowY: "auto"
|
|
17
17
|
} });
|
|
18
|
-
const ConceptEmbed = ({ embed, renderContext, lang, previewAlt }) => {
|
|
18
|
+
const ConceptEmbed = ({ embed, renderContext, lang, previewAlt, children }) => {
|
|
19
19
|
const parsedContent = useMemo(() => {
|
|
20
20
|
if (embed.status === "error" || !embed.data.concept.content) return void 0;
|
|
21
21
|
return parse(embed.data.concept.content.htmlContent);
|
|
22
22
|
}, [embed]);
|
|
23
23
|
const parsedTitle = useMemo(() => embed.status === "success" ? parse(embed.data.concept.title.htmlTitle) : void 0, [embed]);
|
|
24
|
-
if (embed.status === "error" && embed.embedData.type === "inline") return /* @__PURE__ */ jsx("span", { children
|
|
24
|
+
if (embed.status === "error" && embed.embedData.type === "inline") return /* @__PURE__ */ jsx("span", { children });
|
|
25
25
|
if (embed.status === "error") return /* @__PURE__ */ jsx(EmbedErrorPlaceholder_default, { type: "gloss" });
|
|
26
26
|
const { concept, visualElement } = embed.data;
|
|
27
27
|
if (embed.data.concept.glossData) return /* @__PURE__ */ jsx(GlossEmbed, { embed });
|
|
28
28
|
if (embed.embedData.type === "inline") return /* @__PURE__ */ jsx(InlineConcept, {
|
|
29
29
|
previewAlt,
|
|
30
|
-
|
|
30
|
+
linkContent: children,
|
|
31
31
|
copyright: concept.copyright,
|
|
32
32
|
visualElement,
|
|
33
33
|
lang,
|
|
@@ -45,7 +45,7 @@ const ConceptEmbed = ({ embed, renderContext, lang, previewAlt }) => {
|
|
|
45
45
|
children: parsedContent
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
|
-
const InlineConcept = forwardRef(({
|
|
48
|
+
const InlineConcept = forwardRef(({ linkContent, copyright, visualElement, previewAlt, lang, children, title, source,...rest }, ref) => {
|
|
49
49
|
const contentRef = useRef(null);
|
|
50
50
|
return /* @__PURE__ */ jsxs(PopoverRoot, {
|
|
51
51
|
initialFocusEl: () => contentRef.current,
|
|
@@ -53,7 +53,7 @@ const InlineConcept = forwardRef(({ linkText, copyright, visualElement, previewA
|
|
|
53
53
|
asChild: true,
|
|
54
54
|
ref,
|
|
55
55
|
...rest,
|
|
56
|
-
children: /* @__PURE__ */ jsx(ConceptInlineTriggerButton, { children:
|
|
56
|
+
children: /* @__PURE__ */ jsx(ConceptInlineTriggerButton, { children: linkContent })
|
|
57
57
|
}), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(StyledPopoverContent, {
|
|
58
58
|
ref: contentRef,
|
|
59
59
|
children: /* @__PURE__ */ jsx(Concept, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConceptEmbed.js","names":["EmbedErrorPlaceholder"],"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 } 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}\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 }: 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>{
|
|
1
|
+
{"version":3,"file":"ConceptEmbed.js","names":["EmbedErrorPlaceholder"],"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,uBAAuB,OAAO,gBAAgB,EAClD,MAAM;CACJ,OAAO;CACP,WAAW;CACX,WAAW;AACZ,EACF,EAAC;AAEF,MAAa,eAAe,CAAC,EAAE,OAAO,eAAe,MAAM,YAAY,UAAiB,KAAK;CAC3F,MAAM,gBAAgB,QAAQ,MAAM;AAClC,MAAI,MAAM,WAAW,YAAY,MAAM,KAAK,QAAQ,QAAS;AAC7D,SAAO,MAAM,MAAM,KAAK,QAAQ,QAAQ,YAAY;CACrD,GAAE,CAAC,KAAM,EAAC;CAEX,MAAM,cAAc,QAClB,MAAO,MAAM,WAAW,YAAY,MAAM,MAAM,KAAK,QAAQ,MAAM,UAAU,WAC7E,CAAC,KAAM,EACR;AAED,KAAI,MAAM,WAAW,WAAW,MAAM,UAAU,SAAS,SACvD,wBAAO,IAAC,UAAM,WAAgB;AAEhC,KAAI,MAAM,WAAW,QAEnB,wBAAO,IAACA,iCAAsB,MAAK,UAAU;CAG/C,MAAM,EAAE,SAAS,eAAe,GAAG,MAAM;AAGzC,KAAI,MAAM,KAAK,QAAQ,UACrB,wBAAO,IAAC,cAAkB,QAAS;AAGrC,KAAI,MAAM,UAAU,SAAS,SAC3B,wBACE,IAAC;EACa;EACZ,aAAa;EACb,WAAW,QAAQ;EACJ;EACT;EACN,OAAO;EACP,QAAQ,QAAQ;YAEf;GACa;AAIpB,wBACE,IAAC;EACa;EACZ,WAAW,QAAQ;EACJ;EACT;EACN,OAAO,kBAAkB,mBAAsB;EAC/C,QAAQ,QAAQ;YAEf;GACY;AAElB;AAOD,MAAa,gBAAgB,WAC3B,CAAC,EAAE,aAAa,WAAW,eAAe,YAAY,MAAM,UAAU,OAAO,OAAQ,GAAG,MAAM,EAAE,QAAQ;CACtG,MAAM,aAAa,OAAuB,KAAK;AAC/C,wBACE,KAAC;EAAY,gBAAgB,MAAM,WAAW;6BAE5C,IAAC;GAAe;GAAa;GAAK,GAAI;6BACpC,IAAC,wCAA4B,cAAyC;IACvD,kBACjB,IAAC,oCACC,IAAC;GAAqB,KAAK;6BACzB,IAAC;IACY;IACI;IACR;IACD;IACE;IACI;IAEX;KACO;IACW,GAChB;GACG;AAEjB,EACF;AAID,MAAa,eAAe,WAA2C,CAAC,OAAO,wBAC7E,IAAC;CAAQ,GAAI;CAAO,mBAAgB;CAAe;EAAO,CAC1D"}
|
package/es/Embed/GlossEmbed.js
CHANGED
|
@@ -9,9 +9,9 @@ import { Portal } from "@ark-ui/react";
|
|
|
9
9
|
|
|
10
10
|
//#region src/Embed/GlossEmbed.tsx
|
|
11
11
|
const StyledPopoverContent = styled(PopoverContent, { base: { width: "surface.xlarge" } });
|
|
12
|
-
const GlossEmbed = ({ embed }) => {
|
|
12
|
+
const GlossEmbed = ({ embed, children }) => {
|
|
13
13
|
const contentRef = useRef(null);
|
|
14
|
-
if (embed.status === "error" && embed.embedData.type === "inline") return /* @__PURE__ */ jsx("span", { children
|
|
14
|
+
if (embed.status === "error" && embed.embedData.type === "inline") return /* @__PURE__ */ jsx("span", { children });
|
|
15
15
|
if (embed.status === "error" || !embed.data.concept.glossData) return /* @__PURE__ */ jsx(EmbedErrorPlaceholder_default, { type: "gloss" });
|
|
16
16
|
const { concept, visualElement } = embed.data;
|
|
17
17
|
const audio = visualElement?.status === "success" && visualElement.resource === "audio" ? {
|
|
@@ -22,7 +22,7 @@ const GlossEmbed = ({ embed }) => {
|
|
|
22
22
|
initialFocusEl: () => contentRef.current,
|
|
23
23
|
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
24
24
|
asChild: true,
|
|
25
|
-
children: /* @__PURE__ */ jsx(ConceptInlineTriggerButton, { children
|
|
25
|
+
children: /* @__PURE__ */ jsx(ConceptInlineTriggerButton, { children })
|
|
26
26
|
}), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(StyledPopoverContent, {
|
|
27
27
|
ref: contentRef,
|
|
28
28
|
children: /* @__PURE__ */ jsx(Figure, { children: /* @__PURE__ */ jsx(Gloss_default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlossEmbed.js","names":["EmbedErrorPlaceholder","Gloss"],"sources":["../../src/Embed/GlossEmbed.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 { useRef } from \"react\";\nimport { Portal } from \"@ark-ui/react\";\nimport { Figure, 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 { Gloss } from \"../Gloss\";\n\ninterface Props {\n embed: ConceptMetaData;\n}\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n width: \"surface.xlarge\",\n },\n});\n\nexport const GlossEmbed = ({ embed }: Props) => {\n const contentRef = useRef<HTMLDivElement>(null);\n if (embed.status === \"error\" && embed.embedData.type === \"inline\") {\n return <span>{
|
|
1
|
+
{"version":3,"file":"GlossEmbed.js","names":["EmbedErrorPlaceholder","Gloss"],"sources":["../../src/Embed/GlossEmbed.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 { useRef, type ReactNode } from \"react\";\nimport { Portal } from \"@ark-ui/react\";\nimport { Figure, 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 { Gloss } from \"../Gloss\";\n\ninterface Props {\n embed: ConceptMetaData;\n children?: ReactNode;\n}\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n width: \"surface.xlarge\",\n },\n});\n\nexport const GlossEmbed = ({ embed, children }: Props) => {\n const contentRef = useRef<HTMLDivElement>(null);\n if (embed.status === \"error\" && embed.embedData.type === \"inline\") {\n return <span>{children}</span>;\n }\n if (embed.status === \"error\" || !embed.data.concept.glossData) {\n return <EmbedErrorPlaceholder type=\"gloss\" />;\n }\n\n const { concept, visualElement } = embed.data;\n\n const audio =\n visualElement?.status === \"success\" && visualElement.resource === \"audio\"\n ? {\n src: visualElement.data.audioFile.url,\n title: visualElement.data.title.title,\n }\n : undefined;\n\n if (embed.embedData.type === \"inline\") {\n return (\n <PopoverRoot initialFocusEl={() => contentRef.current}>\n <PopoverTrigger asChild>\n <ConceptInlineTriggerButton>{children}</ConceptInlineTriggerButton>\n </PopoverTrigger>\n <Portal>\n <StyledPopoverContent ref={contentRef}>\n <Figure>\n <Gloss\n glossData={concept.glossData}\n title={concept.title}\n audio={audio}\n exampleIds={embed.embedData.exampleIds}\n exampleLangs={embed.embedData.exampleLangs}\n />\n </Figure>\n </StyledPopoverContent>\n </Portal>\n </PopoverRoot>\n );\n }\n\n return (\n <Figure data-embed-type=\"gloss\">\n <Gloss\n glossData={concept.glossData}\n title={concept.title}\n audio={audio}\n exampleIds={embed.embedData.exampleIds}\n exampleLangs={embed.embedData.exampleLangs}\n variant=\"bordered\"\n />\n </Figure>\n );\n};\n"],"mappings":";;;;;;;;;;AAsBA,MAAM,uBAAuB,OAAO,gBAAgB,EAClD,MAAM,EACJ,OAAO,iBACR,EACF,EAAC;AAEF,MAAa,aAAa,CAAC,EAAE,OAAO,UAAiB,KAAK;CACxD,MAAM,aAAa,OAAuB,KAAK;AAC/C,KAAI,MAAM,WAAW,WAAW,MAAM,UAAU,SAAS,SACvD,wBAAO,IAAC,UAAM,WAAgB;AAEhC,KAAI,MAAM,WAAW,YAAY,MAAM,KAAK,QAAQ,UAClD,wBAAO,IAACA,iCAAsB,MAAK,UAAU;CAG/C,MAAM,EAAE,SAAS,eAAe,GAAG,MAAM;CAEzC,MAAM,QACJ,eAAe,WAAW,aAAa,cAAc,aAAa,UAC9D;EACE,KAAK,cAAc,KAAK,UAAU;EAClC,OAAO,cAAc,KAAK,MAAM;CACjC;AAGP,KAAI,MAAM,UAAU,SAAS,SAC3B,wBACE,KAAC;EAAY,gBAAgB,MAAM,WAAW;6BAC5C,IAAC;GAAe;6BACd,IAAC,8BAA4B,WAAsC;IACpD,kBACjB,IAAC,oCACC,IAAC;GAAqB,KAAK;6BACzB,IAAC,oCACC,IAACC;IACC,WAAW,QAAQ;IACnB,OAAO,QAAQ;IACR;IACP,YAAY,MAAM,UAAU;IAC5B,cAAc,MAAM,UAAU;KAC9B,GACK;IACY,GAChB;GACG;AAIlB,wBACE,IAAC;EAAO,mBAAgB;4BACtB,IAACA;GACC,WAAW,QAAQ;GACnB,OAAO,QAAQ;GACR;GACP,YAAY,MAAM,UAAU;GAC5B,cAAc,MAAM,UAAU;GAC9B,SAAQ;IACR;GACK;AAEZ"}
|
package/lib/Article/Article.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_ContentTypeBadge_ContentTypeBadge = require('../ContentTypeBadge/ContentTypeBadge.js');
|
|
3
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Article_ArticleByline = require('./ArticleByline.js');
|
|
4
4
|
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
5
5
|
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
6
6
|
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
@@ -76,7 +76,7 @@ const ArticleTitle = ({ contentType, heartButton, title, lang, id, introduction,
|
|
|
76
76
|
align: "center",
|
|
77
77
|
direction: "row",
|
|
78
78
|
gap: "small",
|
|
79
|
-
children: [!!contentType && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
79
|
+
children: [!!contentType && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_ContentTypeBadge_ContentTypeBadge.ContentTypeBadge, {
|
|
80
80
|
contentType,
|
|
81
81
|
children: contentTypeLabel
|
|
82
82
|
}), heartButton]
|
|
@@ -113,7 +113,7 @@ const Article = ({ article, contentType, licenseBox, children, competenceGoals,
|
|
|
113
113
|
disclaimer
|
|
114
114
|
}),
|
|
115
115
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArticleContent, { children: content }),
|
|
116
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ArticleFooter, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
116
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ArticleFooter, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Article_ArticleByline.ArticleByline, {
|
|
117
117
|
lang,
|
|
118
118
|
footnotes: footNotes,
|
|
119
119
|
authors,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
-
const
|
|
2
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Article_ArticleFootNotes = require('./ArticleFootNotes.js');
|
|
3
3
|
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
4
4
|
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
5
5
|
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
@@ -93,7 +93,7 @@ const ArticleByline = ({ lang, authors = [], suppliers = [], footnotes, licenseB
|
|
|
93
93
|
}), !!footnotes?.length && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArticleBylineAccordionItem, {
|
|
94
94
|
value: footnotesAccordionId,
|
|
95
95
|
accordionTitle: t("article.footnotes"),
|
|
96
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
96
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Article_ArticleFootNotes.ArticleFootNotes, { footNotes: footnotes })
|
|
97
97
|
})]
|
|
98
98
|
})] });
|
|
99
99
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticleByline.js","names":["list: SupplierProps[]","listFormatter: Intl.ListFormat","AccordionRoot","e: HashChangeEvent","SafeLink","ArticleFootNotes","AccordionItem","Heading","AccordionItemTrigger","AccordionItemIndicator","ArrowDownShortLine","AccordionItemContent"],"sources":["../../src/Article/ArticleByline.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 ReactNode, forwardRef, useCallback, useEffect, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { useLocation } from \"react-router-dom\";\nimport { ArrowDownShortLine } from \"@ndla/icons\";\nimport {\n AccordionItem,\n AccordionItemContent,\n AccordionItemIndicator,\n type AccordionItemProps,\n AccordionItemTrigger,\n AccordionRoot,\n Heading,\n} from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { ArticleFootNotes } from \"./ArticleFootNotes\";\nimport type { FootNote } from \"../types\";\n\nconst Wrapper = styled(\"div\", {\n base: {\n // TODO: Figure out if we want to remove this margin. It's only here to add some gap between the article content and the byline.\n marginBlockStart: \"medium\",\n paddingBlockStart: \"xsmall\",\n borderTop: \"1px solid\",\n borderColor: \"stroke.subtle\",\n },\n});\n\nconst TextWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n width: \"100%\",\n justifyContent: \"space-between\",\n paddingBlock: \"xsmall\",\n textStyle: \"body.medium\",\n '& [data-contributors=\"false\"]': {\n marginInlineStart: \"auto\",\n },\n },\n variants: {\n learningpath: {\n true: {},\n false: {\n tabletWide: {\n flexDirection: \"row\",\n },\n },\n },\n },\n});\n\ntype AuthorProps = {\n name: string;\n};\n\ntype SupplierProps = {\n name: string;\n};\n\ntype Props = {\n lang?: string;\n authors?: AuthorProps[];\n suppliers?: SupplierProps[];\n published?: string;\n licenseBox?: ReactNode;\n footnotes?: FootNote[];\n displayByline?: boolean;\n bylineType?: \"article\" | \"learningPath\" | \"external\";\n bylineSuffix?: ReactNode;\n learningpathCopiedFrom?: string;\n};\n\nfunction formatList(list: SupplierProps[], listFormatter: Intl.ListFormat) {\n return listFormatter.format(list.map((l) => l.name));\n}\n\nconst StyledAccordionRoot = styled(AccordionRoot, {\n base: {\n paddingBlockStart: \"xxlarge\",\n },\n});\n\nconst refRegexp = /note\\d/;\nconst footnotesAccordionId = \"footnotes\";\n\nexport const ArticleByline = ({\n lang,\n authors = [],\n suppliers = [],\n footnotes,\n licenseBox,\n published,\n displayByline = true,\n bylineType = \"article\",\n bylineSuffix,\n learningpathCopiedFrom,\n}: Props) => {\n const { t } = useTranslation();\n const { pathname } = useLocation();\n const [openAccordions, setOpenAccordions] = useState<string[]>([]);\n const accordionItemValue = \"rulesForUse\";\n\n const onHashChange = useCallback(\n (e: HashChangeEvent) => {\n const hash = e.newURL.split(\"#\")[1];\n if (hash?.match(refRegexp) && !openAccordions.includes(footnotesAccordionId)) {\n setOpenAccordions([...openAccordions, footnotesAccordionId]);\n const el = document.getElementById(`#${hash}`);\n el?.click();\n el?.focus();\n }\n },\n [openAccordions],\n );\n\n useEffect(() => {\n setOpenAccordions((prev) => prev.filter((state) => state !== accordionItemValue));\n }, [pathname]);\n\n useEffect(() => {\n window.addEventListener(\"hashchange\", onHashChange);\n return () => window.removeEventListener(\"hashchange\", onHashChange);\n }, [onHashChange]);\n\n const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;\n const listFormatter = new Intl.ListFormat(lang, { style: \"long\", type: \"conjunction\" });\n\n return (\n <Wrapper>\n {!!displayByline && (\n <TextWrapper learningpath={bylineType === \"learningPath\"}>\n {!!showPrimaryContributors && (\n <span>\n {authors.length > 0 &&\n `${t(\"article.authorsLabel\", { context: bylineType })} ${formatList(authors, listFormatter)}. `}\n {suppliers.length > 0 &&\n `${t(\"article.supplierLabel\", { count: suppliers.length })} ${formatList(suppliers, listFormatter)}.`}\n </span>\n )}\n {learningpathCopiedFrom ? (\n <SafeLink to={learningpathCopiedFrom}>{t(`learningPath.copiedFrom`)}</SafeLink>\n ) : null}\n {published ? (\n <div data-contributors={showPrimaryContributors}>\n {t(`${bylineType}.lastUpdated`)} {published}\n </div>\n ) : null}\n {bylineSuffix}\n </TextWrapper>\n )}\n {(!!licenseBox || !!footnotes?.length) && (\n <StyledAccordionRoot\n multiple\n value={openAccordions}\n onValueChange={(details) => setOpenAccordions(details.value)}\n >\n {!!licenseBox && (\n <ArticleBylineAccordionItem value={accordionItemValue} accordionTitle={t(\"article.useContent\")}>\n {licenseBox}\n </ArticleBylineAccordionItem>\n )}\n {!!footnotes?.length && (\n <ArticleBylineAccordionItem value={footnotesAccordionId} accordionTitle={t(\"article.footnotes\")}>\n <ArticleFootNotes footNotes={footnotes} />\n </ArticleBylineAccordionItem>\n )}\n </StyledAccordionRoot>\n )}\n </Wrapper>\n );\n};\n\ninterface ArticleBylineAccordionprops extends AccordionItemProps {\n accordionTitle: ReactNode;\n}\n\nexport const ArticleBylineAccordionItem = forwardRef<HTMLDivElement, ArticleBylineAccordionprops>(\n ({ value, accordionTitle, children, ...props }, ref) => {\n return (\n <AccordionItem value={value} ref={ref} {...props}>\n <Heading asChild consumeCss textStyle=\"label.medium\" fontWeight=\"bold\">\n <h2>\n <AccordionItemTrigger>\n {accordionTitle}\n <AccordionItemIndicator asChild>\n <ArrowDownShortLine />\n </AccordionItemIndicator>\n </AccordionItemTrigger>\n </h2>\n </Heading>\n <AccordionItemContent>{children}</AccordionItemContent>\n </AccordionItem>\n );\n },\n);\n"],"mappings":"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
|
|
1
|
+
{"version":3,"file":"ArticleByline.js","names":["list: SupplierProps[]","listFormatter: Intl.ListFormat","AccordionRoot","e: HashChangeEvent","SafeLink","ArticleFootNotes","AccordionItem","Heading","AccordionItemTrigger","AccordionItemIndicator","ArrowDownShortLine","AccordionItemContent"],"sources":["../../src/Article/ArticleByline.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 ReactNode, forwardRef, useCallback, useEffect, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { useLocation } from \"react-router-dom\";\nimport { ArrowDownShortLine } from \"@ndla/icons\";\nimport {\n AccordionItem,\n AccordionItemContent,\n AccordionItemIndicator,\n type AccordionItemProps,\n AccordionItemTrigger,\n AccordionRoot,\n Heading,\n} from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { ArticleFootNotes } from \"./ArticleFootNotes\";\nimport type { FootNote } from \"../types\";\n\nconst Wrapper = styled(\"div\", {\n base: {\n // TODO: Figure out if we want to remove this margin. It's only here to add some gap between the article content and the byline.\n marginBlockStart: \"medium\",\n paddingBlockStart: \"xsmall\",\n borderTop: \"1px solid\",\n borderColor: \"stroke.subtle\",\n },\n});\n\nconst TextWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"3xsmall\",\n width: \"100%\",\n justifyContent: \"space-between\",\n paddingBlock: \"xsmall\",\n textStyle: \"body.medium\",\n '& [data-contributors=\"false\"]': {\n marginInlineStart: \"auto\",\n },\n },\n variants: {\n learningpath: {\n true: {},\n false: {\n tabletWide: {\n flexDirection: \"row\",\n },\n },\n },\n },\n});\n\ntype AuthorProps = {\n name: string;\n};\n\ntype SupplierProps = {\n name: string;\n};\n\ntype Props = {\n lang?: string;\n authors?: AuthorProps[];\n suppliers?: SupplierProps[];\n published?: string;\n licenseBox?: ReactNode;\n footnotes?: FootNote[];\n displayByline?: boolean;\n bylineType?: \"article\" | \"learningPath\" | \"external\";\n bylineSuffix?: ReactNode;\n learningpathCopiedFrom?: string;\n};\n\nfunction formatList(list: SupplierProps[], listFormatter: Intl.ListFormat) {\n return listFormatter.format(list.map((l) => l.name));\n}\n\nconst StyledAccordionRoot = styled(AccordionRoot, {\n base: {\n paddingBlockStart: \"xxlarge\",\n },\n});\n\nconst refRegexp = /note\\d/;\nconst footnotesAccordionId = \"footnotes\";\n\nexport const ArticleByline = ({\n lang,\n authors = [],\n suppliers = [],\n footnotes,\n licenseBox,\n published,\n displayByline = true,\n bylineType = \"article\",\n bylineSuffix,\n learningpathCopiedFrom,\n}: Props) => {\n const { t } = useTranslation();\n const { pathname } = useLocation();\n const [openAccordions, setOpenAccordions] = useState<string[]>([]);\n const accordionItemValue = \"rulesForUse\";\n\n const onHashChange = useCallback(\n (e: HashChangeEvent) => {\n const hash = e.newURL.split(\"#\")[1];\n if (hash?.match(refRegexp) && !openAccordions.includes(footnotesAccordionId)) {\n setOpenAccordions([...openAccordions, footnotesAccordionId]);\n const el = document.getElementById(`#${hash}`);\n el?.click();\n el?.focus();\n }\n },\n [openAccordions],\n );\n\n useEffect(() => {\n setOpenAccordions((prev) => prev.filter((state) => state !== accordionItemValue));\n }, [pathname]);\n\n useEffect(() => {\n window.addEventListener(\"hashchange\", onHashChange);\n return () => window.removeEventListener(\"hashchange\", onHashChange);\n }, [onHashChange]);\n\n const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;\n const listFormatter = new Intl.ListFormat(lang, { style: \"long\", type: \"conjunction\" });\n\n return (\n <Wrapper>\n {!!displayByline && (\n <TextWrapper learningpath={bylineType === \"learningPath\"}>\n {!!showPrimaryContributors && (\n <span>\n {authors.length > 0 &&\n `${t(\"article.authorsLabel\", { context: bylineType })} ${formatList(authors, listFormatter)}. `}\n {suppliers.length > 0 &&\n `${t(\"article.supplierLabel\", { count: suppliers.length })} ${formatList(suppliers, listFormatter)}.`}\n </span>\n )}\n {learningpathCopiedFrom ? (\n <SafeLink to={learningpathCopiedFrom}>{t(`learningPath.copiedFrom`)}</SafeLink>\n ) : null}\n {published ? (\n <div data-contributors={showPrimaryContributors}>\n {t(`${bylineType}.lastUpdated`)} {published}\n </div>\n ) : null}\n {bylineSuffix}\n </TextWrapper>\n )}\n {(!!licenseBox || !!footnotes?.length) && (\n <StyledAccordionRoot\n multiple\n value={openAccordions}\n onValueChange={(details) => setOpenAccordions(details.value)}\n >\n {!!licenseBox && (\n <ArticleBylineAccordionItem value={accordionItemValue} accordionTitle={t(\"article.useContent\")}>\n {licenseBox}\n </ArticleBylineAccordionItem>\n )}\n {!!footnotes?.length && (\n <ArticleBylineAccordionItem value={footnotesAccordionId} accordionTitle={t(\"article.footnotes\")}>\n <ArticleFootNotes footNotes={footnotes} />\n </ArticleBylineAccordionItem>\n )}\n </StyledAccordionRoot>\n )}\n </Wrapper>\n );\n};\n\ninterface ArticleBylineAccordionprops extends AccordionItemProps {\n accordionTitle: ReactNode;\n}\n\nexport const ArticleBylineAccordionItem = forwardRef<HTMLDivElement, ArticleBylineAccordionprops>(\n ({ value, accordionTitle, children, ...props }, ref) => {\n return (\n <AccordionItem value={value} ref={ref} {...props}>\n <Heading asChild consumeCss textStyle=\"label.medium\" fontWeight=\"bold\">\n <h2>\n <AccordionItemTrigger>\n {accordionTitle}\n <AccordionItemIndicator asChild>\n <ArrowDownShortLine />\n </AccordionItemIndicator>\n </AccordionItemTrigger>\n </h2>\n </Heading>\n <AccordionItemContent>{children}</AccordionItemContent>\n </AccordionItem>\n );\n },\n);\n"],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_AudioPlayer_Controls = require('./Controls.js');
|
|
3
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_AudioPlayer_SpeechControl = require('./SpeechControl.js');
|
|
4
4
|
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
5
5
|
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
6
6
|
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
@@ -93,7 +93,7 @@ const AudioPlayer = ({ src, title, subtitle, speech, description, img, textVersi
|
|
|
93
93
|
const [showFullDescription, setShowFullDescription] = (0, react.useState)(false);
|
|
94
94
|
const truncatedDescription = (0, react.useMemo)(() => description?.slice(0, DESCRIPTION_MAX_LENGTH), [description]);
|
|
95
95
|
const textDescriptionId = (0, react.useId)();
|
|
96
|
-
if (speech) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
96
|
+
if (speech) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_AudioPlayer_SpeechControl.SpeechControl_default, {
|
|
97
97
|
src,
|
|
98
98
|
title
|
|
99
99
|
});
|
|
@@ -135,7 +135,7 @@ const AudioPlayer = ({ src, title, subtitle, speech, description, img, textVersi
|
|
|
135
135
|
!!textVersion && !!img && textVersionButton
|
|
136
136
|
]
|
|
137
137
|
})] }),
|
|
138
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
138
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_AudioPlayer_Controls.Controls_default, {
|
|
139
139
|
src,
|
|
140
140
|
title
|
|
141
141
|
}),
|
package/lib/AudioPlayer/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_AudioPlayer_AudioPlayer = require('./AudioPlayer.js');
|
|
2
2
|
|
|
3
3
|
//#region src/AudioPlayer/index.ts
|
|
4
|
-
var AudioPlayer_default$1 =
|
|
4
|
+
var AudioPlayer_default$1 = require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_AudioPlayer_AudioPlayer.AudioPlayer_default$1;
|
|
5
5
|
|
|
6
6
|
//#endregion
|
|
7
7
|
exports.AudioPlayer_default = AudioPlayer_default$1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
-
const
|
|
2
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Breadcrumb_BreadcrumbItem = require('./BreadcrumbItem.js');
|
|
3
3
|
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
4
4
|
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
5
5
|
const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
|
|
@@ -22,7 +22,7 @@ const Breadcrumb = ({ items, renderItem, renderSeparator, collapseFirst, collaps
|
|
|
22
22
|
const { t } = (0, react_i18next.useTranslation)();
|
|
23
23
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
24
24
|
"aria-label": t("breadcrumb.breadcrumb"),
|
|
25
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledList, { children: items.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
25
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledList, { children: items.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Breadcrumb_BreadcrumbItem.BreadcrumbItem_default, {
|
|
26
26
|
renderItem,
|
|
27
27
|
renderSeparator,
|
|
28
28
|
ref: (element) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
-
const
|
|
2
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Breadcrumb_Breadcrumb = require('./Breadcrumb.js');
|
|
3
3
|
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
4
4
|
const __ndla_icons = require_rolldown_runtime.__toESM(require("@ndla/icons"));
|
|
5
5
|
const __ndla_safelink = require_rolldown_runtime.__toESM(require("@ndla/safelink"));
|
|
@@ -32,7 +32,7 @@ const HomeBreadcrumb = ({ items }) => {
|
|
|
32
32
|
if (item.index === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledArrowRight, {});
|
|
33
33
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_icons.ArrowRightShortLine, {});
|
|
34
34
|
};
|
|
35
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
35
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Breadcrumb_Breadcrumb.Breadcrumb_default$1, {
|
|
36
36
|
items,
|
|
37
37
|
renderItem,
|
|
38
38
|
renderSeparator
|
package/lib/Breadcrumb/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Breadcrumb_Breadcrumb = require('./Breadcrumb.js');
|
|
2
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Breadcrumb_HomeBreadcrumb = require('./HomeBreadcrumb.js');
|
|
3
3
|
|
|
4
4
|
//#region src/Breadcrumb/index.ts
|
|
5
|
-
var Breadcrumb_default$1 =
|
|
5
|
+
var Breadcrumb_default$1 = require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Breadcrumb_Breadcrumb.Breadcrumb_default$1;
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
exports.Breadcrumb_default = Breadcrumb_default$1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
-
const
|
|
2
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_utils_relativeUrl = require('../utils/relativeUrl.js');
|
|
3
3
|
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
4
4
|
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
5
5
|
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
@@ -83,7 +83,7 @@ const StyledSafeLinkButton = (0, __ndla_styled_system_jsx.styled)(__ndla_safelin
|
|
|
83
83
|
} });
|
|
84
84
|
const LinkButton = ({ url, children, path }) => {
|
|
85
85
|
if (url) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledSafeLinkButton, {
|
|
86
|
-
to:
|
|
86
|
+
to: require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_utils_relativeUrl.getPossiblyRelativeUrl(url, path),
|
|
87
87
|
variant: "secondary",
|
|
88
88
|
rel: "noopener noreferrer",
|
|
89
89
|
children
|
|
@@ -1 +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
|
|
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,gHAAuB,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"}
|
package/lib/Concept/Concept.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
2
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_LicenseByline_EmbedByline = require('../LicenseByline/EmbedByline.js');
|
|
3
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_utils_licenseAttributes = require('../utils/licenseAttributes.js');
|
|
4
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_ImageEmbed = require('../Embed/ImageEmbed.js');
|
|
5
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_H5pEmbed = require('../Embed/H5pEmbed.js');
|
|
6
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_ExternalEmbed = require('../Embed/ExternalEmbed.js');
|
|
7
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_IframeEmbed = require('../Embed/IframeEmbed.js');
|
|
8
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_BrightcoveEmbed = require('../Embed/BrightcoveEmbed.js');
|
|
9
9
|
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
10
10
|
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
11
11
|
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
@@ -23,7 +23,7 @@ const ContentWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
|
23
23
|
"& p": { display: "inline" }
|
|
24
24
|
} });
|
|
25
25
|
const Concept = (0, react.forwardRef)(({ copyright, visualElement, lang, children, title, source, previewAlt,...rest }, ref) => {
|
|
26
|
-
const licenseProps =
|
|
26
|
+
const licenseProps = require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_utils_licenseAttributes.licenseAttributes(copyright?.license?.license, lang, source);
|
|
27
27
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledFigure, {
|
|
28
28
|
ref,
|
|
29
29
|
...rest,
|
|
@@ -33,12 +33,12 @@ const Concept = (0, react.forwardRef)(({ copyright, visualElement, lang, childre
|
|
|
33
33
|
lang,
|
|
34
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
35
|
}),
|
|
36
|
-
visualElement?.resource === "image" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
36
|
+
visualElement?.resource === "image" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_ImageEmbed.ImageEmbed_default, {
|
|
37
37
|
embed: visualElement,
|
|
38
38
|
lang,
|
|
39
39
|
previewAlt
|
|
40
|
-
}) : visualElement?.resource === "brightcove" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
41
|
-
!!copyright && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
40
|
+
}) : visualElement?.resource === "brightcove" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_BrightcoveEmbed.BrightcoveEmbed_default, { embed: visualElement }) : visualElement?.resource === "h5p" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_H5pEmbed.H5pEmbed_default, { embed: visualElement }) : visualElement?.resource === "iframe" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_IframeEmbed.IframeEmbed_default, { embed: visualElement }) : visualElement?.resource === "external" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_Embed_ExternalEmbed.ExternalEmbed_default, { embed: visualElement }) : null,
|
|
41
|
+
!!copyright && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_LicenseByline_EmbedByline.EmbedByline, {
|
|
42
42
|
copyright,
|
|
43
43
|
type: "concept"
|
|
44
44
|
})
|
|
@@ -1 +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 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":";;;;;;;;;;;;;;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,
|
|
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 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":";;;;;;;;;;;;;;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,iHAAkB,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,wHAAgB,OAAO,gBAAiB,GACvC,eAAe,aAAa,wBAC9B,2BAACC,0GAAS,OAAO,gBAAiB,GAChC,eAAe,aAAa,2BAC9B,2BAACC,gHAAY,OAAO,gBAAiB,GACnC,eAAe,aAAa,6BAC9B,2BAACC,oHAAc,OAAO,gBAAiB,GACrC;KACD,6BAAa,2BAACC;IAAuB;IAAW,MAAK;KAAY;;GACvD;AAElB,EACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
-
const
|
|
2
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_LicenseByline_EmbedByline = require('../LicenseByline/EmbedByline.js');
|
|
3
3
|
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
4
4
|
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
5
5
|
const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
|
|
@@ -133,7 +133,7 @@ const ContactBlock = ({ image, jobTitle, description, name, email, embedAlt, lan
|
|
|
133
133
|
src: image.image.imageUrl,
|
|
134
134
|
width: 300,
|
|
135
135
|
height: 300
|
|
136
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
136
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_LicenseByline_EmbedByline.LicenseContainerContent, {
|
|
137
137
|
type: "image",
|
|
138
138
|
copyright: image.copyright
|
|
139
139
|
})]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
-
const
|
|
2
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType = require('../model/ContentType.js');
|
|
3
3
|
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
4
4
|
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
5
5
|
const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
|
|
@@ -7,25 +7,25 @@ const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-ru
|
|
|
7
7
|
|
|
8
8
|
//#region src/ContentTypeBadge/ContentTypeBadge.tsx
|
|
9
9
|
const contentTypeToBadgeVariantMap = {
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
10
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.SUBJECT_MATERIAL]: "brand1",
|
|
11
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.TASKS_AND_ACTIVITIES]: "brand2",
|
|
12
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.ASSESSMENT_RESOURCES]: "brand2",
|
|
13
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.SUBJECT]: "neutral",
|
|
14
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.SOURCE_MATERIAL]: "brand1",
|
|
15
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.LEARNING_PATH]: "brand3",
|
|
16
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.TOPIC]: "neutral",
|
|
17
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.MULTIDISCIPLINARY]: "neutral",
|
|
18
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.CONCEPT]: "brand1",
|
|
19
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.EXTERNAL]: "brand2",
|
|
20
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.IMAGE]: "brand1",
|
|
21
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.AUDIO]: "brand1",
|
|
22
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.PODCAST]: "brand1",
|
|
23
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.VIDEO]: "brand1",
|
|
24
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.MISSING]: "neutral",
|
|
25
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.PODCAST_SERIES]: "brand1",
|
|
26
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.GLOSS]: "brand1",
|
|
27
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.PROGRAMME]: "neutral",
|
|
28
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.FRONTPAGE_ARTICLE]: "brand2"
|
|
29
29
|
};
|
|
30
30
|
const ContentTypeBadge = (0, react.forwardRef)(({ contentType, children,...props }, ref) => {
|
|
31
31
|
const { t } = (0, react_i18next.useTranslation)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentTypeBadge.js","names":["contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant>","Badge"],"sources":["../../src/ContentTypeBadge/ContentTypeBadge.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 { forwardRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Badge, type BadgeProps, type BadgeVariant } from \"@ndla/primitives\";\nimport * as contentTypes from \"../model/ContentType\";\n\nexport interface ContentTypeBadgeProps extends Omit<BadgeProps, \"colorTheme\"> {\n contentType: ContentType | undefined;\n}\n\nexport type StrictContentType =\n | typeof contentTypes.SUBJECT_MATERIAL\n | typeof contentTypes.TASKS_AND_ACTIVITIES\n | typeof contentTypes.ASSESSMENT_RESOURCES\n | typeof contentTypes.SUBJECT\n | typeof contentTypes.SOURCE_MATERIAL\n | typeof contentTypes.LEARNING_PATH\n | typeof contentTypes.TOPIC\n | typeof contentTypes.MULTIDISCIPLINARY\n | typeof contentTypes.CONCEPT\n | typeof contentTypes.EXTERNAL\n | typeof contentTypes.IMAGE\n | typeof contentTypes.AUDIO\n | typeof contentTypes.VIDEO\n | typeof contentTypes.MISSING\n | typeof contentTypes.PODCAST\n | typeof contentTypes.GLOSS\n | typeof contentTypes.PROGRAMME\n | typeof contentTypes.PODCAST_SERIES\n | typeof contentTypes.FRONTPAGE_ARTICLE;\n\nexport type ContentType =\n | StrictContentType\n // This allows for us to fallback to string without getting a ts error, while still keeping intellisense\n | (string & {});\n\nexport const contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant> = {\n [contentTypes.SUBJECT_MATERIAL]: \"brand1\",\n [contentTypes.TASKS_AND_ACTIVITIES]: \"brand2\",\n [contentTypes.ASSESSMENT_RESOURCES]: \"brand2\",\n [contentTypes.SUBJECT]: \"neutral\",\n [contentTypes.SOURCE_MATERIAL]: \"brand1\",\n [contentTypes.LEARNING_PATH]: \"brand3\",\n [contentTypes.TOPIC]: \"neutral\",\n [contentTypes.MULTIDISCIPLINARY]: \"neutral\",\n [contentTypes.CONCEPT]: \"brand1\",\n [contentTypes.EXTERNAL]: \"brand2\",\n [contentTypes.IMAGE]: \"brand1\",\n [contentTypes.AUDIO]: \"brand1\",\n [contentTypes.PODCAST]: \"brand1\",\n [contentTypes.VIDEO]: \"brand1\",\n [contentTypes.MISSING]: \"neutral\",\n [contentTypes.PODCAST_SERIES]: \"brand1\",\n [contentTypes.GLOSS]: \"brand1\",\n [contentTypes.PROGRAMME]: \"neutral\",\n [contentTypes.FRONTPAGE_ARTICLE]: \"brand2\",\n};\n\nexport const ContentTypeBadge = forwardRef<HTMLDivElement, ContentTypeBadgeProps>(\n ({ contentType, children, ...props }, ref) => {\n const { t } = useTranslation();\n return (\n <Badge\n colorTheme={contentTypeToBadgeVariantMap[contentType ?? \"missing\"] ?? contentTypeToBadgeVariantMap[\"missing\"]}\n {...props}\n ref={ref}\n >\n {children ?? t(`contentTypes.${contentType}`)}\n </Badge>\n );\n },\n);\n"],"mappings":";;;;;;;;AA2CA,MAAaA,+BAAkE;
|
|
1
|
+
{"version":3,"file":"ContentTypeBadge.js","names":["contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant>","Badge"],"sources":["../../src/ContentTypeBadge/ContentTypeBadge.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 { forwardRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Badge, type BadgeProps, type BadgeVariant } from \"@ndla/primitives\";\nimport * as contentTypes from \"../model/ContentType\";\n\nexport interface ContentTypeBadgeProps extends Omit<BadgeProps, \"colorTheme\"> {\n contentType: ContentType | undefined;\n}\n\nexport type StrictContentType =\n | typeof contentTypes.SUBJECT_MATERIAL\n | typeof contentTypes.TASKS_AND_ACTIVITIES\n | typeof contentTypes.ASSESSMENT_RESOURCES\n | typeof contentTypes.SUBJECT\n | typeof contentTypes.SOURCE_MATERIAL\n | typeof contentTypes.LEARNING_PATH\n | typeof contentTypes.TOPIC\n | typeof contentTypes.MULTIDISCIPLINARY\n | typeof contentTypes.CONCEPT\n | typeof contentTypes.EXTERNAL\n | typeof contentTypes.IMAGE\n | typeof contentTypes.AUDIO\n | typeof contentTypes.VIDEO\n | typeof contentTypes.MISSING\n | typeof contentTypes.PODCAST\n | typeof contentTypes.GLOSS\n | typeof contentTypes.PROGRAMME\n | typeof contentTypes.PODCAST_SERIES\n | typeof contentTypes.FRONTPAGE_ARTICLE;\n\nexport type ContentType =\n | StrictContentType\n // This allows for us to fallback to string without getting a ts error, while still keeping intellisense\n | (string & {});\n\nexport const contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant> = {\n [contentTypes.SUBJECT_MATERIAL]: \"brand1\",\n [contentTypes.TASKS_AND_ACTIVITIES]: \"brand2\",\n [contentTypes.ASSESSMENT_RESOURCES]: \"brand2\",\n [contentTypes.SUBJECT]: \"neutral\",\n [contentTypes.SOURCE_MATERIAL]: \"brand1\",\n [contentTypes.LEARNING_PATH]: \"brand3\",\n [contentTypes.TOPIC]: \"neutral\",\n [contentTypes.MULTIDISCIPLINARY]: \"neutral\",\n [contentTypes.CONCEPT]: \"brand1\",\n [contentTypes.EXTERNAL]: \"brand2\",\n [contentTypes.IMAGE]: \"brand1\",\n [contentTypes.AUDIO]: \"brand1\",\n [contentTypes.PODCAST]: \"brand1\",\n [contentTypes.VIDEO]: \"brand1\",\n [contentTypes.MISSING]: \"neutral\",\n [contentTypes.PODCAST_SERIES]: \"brand1\",\n [contentTypes.GLOSS]: \"brand1\",\n [contentTypes.PROGRAMME]: \"neutral\",\n [contentTypes.FRONTPAGE_ARTICLE]: \"brand2\",\n};\n\nexport const ContentTypeBadge = forwardRef<HTMLDivElement, ContentTypeBadgeProps>(\n ({ contentType, children, ...props }, ref) => {\n const { t } = useTranslation();\n return (\n <Badge\n colorTheme={contentTypeToBadgeVariantMap[contentType ?? \"missing\"] ?? contentTypeToBadgeVariantMap[\"missing\"]}\n {...props}\n ref={ref}\n >\n {children ?? t(`contentTypes.${contentType}`)}\n </Badge>\n );\n },\n);\n"],"mappings":";;;;;;;;AA2CA,MAAaA,+BAAkE;8GAC5C;kHACI;kHACA;qGACb;6GACQ;2GACF;mGACR;+GACY;qGACV;sGACC;mGACH;mGACA;qGACE;mGACF;qGACE;4GACO;mGACT;uGACI;+GACQ;AACnC;AAED,MAAa,mBAAmB,sBAC9B,CAAC,EAAE,aAAa,SAAU,GAAG,OAAO,EAAE,QAAQ;CAC5C,MAAM,EAAE,GAAG,GAAG,mCAAgB;AAC9B,wBACE,2BAACC;EACC,YAAY,6BAA6B,eAAe,cAAc,6BAA6B;EACnG,GAAI;EACC;YAEJ,YAAY,GAAG,eAAe,YAAY,EAAE;GACvC;AAEX,EACF"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
-
const
|
|
2
|
+
const require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType = require('../model/ContentType.js');
|
|
3
3
|
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
4
4
|
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
5
5
|
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
|
|
6
6
|
|
|
7
7
|
//#region src/ContentTypeHero/ContentTypeHero.tsx
|
|
8
8
|
const contentTypeToHeroMap = {
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
9
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.SUBJECT_MATERIAL]: "primary",
|
|
10
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.TASKS_AND_ACTIVITIES]: "brand2Bold",
|
|
11
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.ASSESSMENT_RESOURCES]: "brand2",
|
|
12
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.SUBJECT]: "primary",
|
|
13
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.SOURCE_MATERIAL]: "brand1",
|
|
14
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.LEARNING_PATH]: "primary",
|
|
15
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.TOPIC]: "neutral",
|
|
16
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.MULTIDISCIPLINARY]: "primary",
|
|
17
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.CONCEPT]: "brand1Moderate",
|
|
18
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.EXTERNAL]: "primary",
|
|
19
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.IMAGE]: "primary",
|
|
20
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.AUDIO]: "primary",
|
|
21
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.PODCAST]: "primary",
|
|
22
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.VIDEO]: "primary",
|
|
23
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.MISSING]: "neutral",
|
|
24
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.GLOSS]: "brand1Moderate",
|
|
25
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.PROGRAMME]: "primary",
|
|
26
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.PODCAST_SERIES]: "primary",
|
|
27
|
+
[require__Users_amatho_code_ndla_frontend_packages_packages_ndla_ui_src_model_ContentType.FRONTPAGE_ARTICLE]: "primary"
|
|
28
28
|
};
|
|
29
29
|
const ContentTypeHero = (0, react.forwardRef)(({ contentType, children,...props }, ref) => {
|
|
30
30
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Hero, {
|