@ndla/ui 56.0.166-alpha.0 → 56.0.168-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -11
- package/dist/panda.buildinfo.json +9 -9
- package/dist/styles.css +38 -36
- package/es/AnchorHeading/AnchorHeading.mjs +43 -0
- package/es/AnchorHeading/AnchorHeading.mjs.map +1 -0
- package/es/CodeBlock/codeLanguageOptions.mjs.map +1 -1
- package/es/ContactBlock/ContactBlock.mjs.map +1 -1
- package/es/ContentTypeBadge/ContentTypeBadge.mjs.map +1 -1
- package/es/Embed/ImageEmbed.mjs.map +1 -1
- package/es/Grid/Grid.mjs +2 -2
- package/es/Grid/Grid.mjs.map +1 -1
- package/es/_virtual/rolldown_runtime.mjs +2 -2
- package/es/index.mjs +2 -2
- package/es/locale/messages-en.mjs +1 -0
- package/es/locale/messages-en.mjs.map +1 -1
- package/es/locale/messages-nb.mjs +1 -0
- package/es/locale/messages-nb.mjs.map +1 -1
- package/es/locale/messages-nn.mjs +1 -0
- package/es/locale/messages-nn.mjs.map +1 -1
- package/es/locale/messages-se.mjs +1 -0
- package/es/locale/messages-se.mjs.map +1 -1
- package/es/model/ContentType.mjs.map +1 -1
- package/es/model/SubjectCategories.mjs +2 -2
- package/es/model/SubjectTypes.mjs +2 -2
- package/es/model/WordClass.mjs +2 -2
- package/lib/{CopyParagraphButton/CopyParagraphButton.d.ts → AnchorHeading/AnchorHeading.d.ts} +1 -1
- package/lib/AnchorHeading/AnchorHeading.js +44 -0
- package/lib/AnchorHeading/AnchorHeading.js.map +1 -0
- package/lib/Article/Article.js +14 -14
- package/lib/Article/Article.js.map +1 -1
- package/lib/Article/ArticleByline.js +13 -13
- package/lib/Article/ArticleByline.js.map +1 -1
- package/lib/Article/ArticleFootNotes.js +5 -5
- package/lib/Article/ArticleFootNotes.js.map +1 -1
- package/lib/Article/BadgesContainer.js +2 -2
- package/lib/Article/BadgesContainer.js.map +1 -1
- package/lib/AudioPlayer/AudioPlayer.js +16 -16
- package/lib/AudioPlayer/AudioPlayer.js.map +1 -1
- package/lib/AudioPlayer/Controls.js +35 -35
- package/lib/AudioPlayer/Controls.js.map +1 -1
- package/lib/AudioPlayer/SpeechControl.js +4 -4
- package/lib/AudioPlayer/SpeechControl.js.map +1 -1
- package/lib/Breadcrumb/Breadcrumb.js +2 -2
- package/lib/Breadcrumb/Breadcrumb.js.map +1 -1
- package/lib/Breadcrumb/BreadcrumbItem.js +2 -2
- package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -1
- package/lib/Breadcrumb/HomeBreadcrumb.js +8 -8
- package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -1
- package/lib/CampaignBlock/CampaignBlock.js +12 -12
- package/lib/CampaignBlock/CampaignBlock.js.map +1 -1
- package/lib/CodeBlock/CodeBlock.js +4 -4
- package/lib/CodeBlock/CodeBlock.js.map +1 -1
- package/lib/CodeBlock/codeLanguageOptions.js.map +1 -1
- package/lib/Concept/Concept.js +4 -4
- package/lib/Concept/Concept.js.map +1 -1
- package/lib/ContactBlock/ContactBlock.js +12 -12
- package/lib/ContactBlock/ContactBlock.js.map +1 -1
- package/lib/ContentTypeBadge/ContentTypeBadge.js +2 -2
- package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -1
- package/lib/Embed/AudioEmbed.js +3 -3
- package/lib/Embed/AudioEmbed.js.map +1 -1
- package/lib/Embed/BrightcoveEmbed.js +5 -5
- package/lib/Embed/BrightcoveEmbed.js.map +1 -1
- package/lib/Embed/CodeEmbed.js +7 -7
- package/lib/Embed/CodeEmbed.js.map +1 -1
- package/lib/Embed/ConceptEmbed.js +7 -7
- 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/ContentLinkEmbed.js +2 -2
- package/lib/Embed/CopyrightEmbed.js +2 -2
- package/lib/Embed/CopyrightEmbed.js.map +1 -1
- package/lib/Embed/EmbedErrorPlaceholder.js +6 -6
- package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -1
- package/lib/Embed/EmbedWrapper.js +6 -6
- package/lib/Embed/EmbedWrapper.js.map +1 -1
- package/lib/Embed/ExternalEmbed.js +4 -4
- package/lib/Embed/ExternalEmbed.js.map +1 -1
- package/lib/Embed/FootnoteEmbed.js +2 -2
- package/lib/Embed/FootnoteEmbed.js.map +1 -1
- package/lib/Embed/GlossEmbed.js +9 -9
- package/lib/Embed/GlossEmbed.js.map +1 -1
- package/lib/Embed/H5pEmbed.js +4 -4
- 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 +8 -8
- package/lib/Embed/ImageEmbed.js.map +1 -1
- package/lib/Embed/InlineTriggerButton.js +4 -4
- package/lib/Embed/InlineTriggerButton.js.map +1 -1
- package/lib/Embed/UnknownEmbed.js +2 -2
- package/lib/Embed/UuDisclaimerEmbed.js +11 -11
- package/lib/Embed/UuDisclaimerEmbed.js.map +1 -1
- package/lib/FactBox/FactBox.js +7 -7
- package/lib/FactBox/FactBox.js.map +1 -1
- package/lib/FileList/File.js +13 -13
- package/lib/FileList/File.js.map +1 -1
- package/lib/FileList/FileList.js +4 -4
- package/lib/FileList/FileList.js.map +1 -1
- package/lib/FileList/PdfFile.js +6 -6
- package/lib/FileList/PdfFile.js.map +1 -1
- package/lib/Gloss/Gloss.js +19 -19
- package/lib/Gloss/Gloss.js.map +1 -1
- package/lib/Gloss/GlossExample.js +6 -6
- package/lib/Gloss/GlossExample.js.map +1 -1
- package/lib/Grid/Grid.js +5 -5
- package/lib/Grid/Grid.js.map +1 -1
- package/lib/KeyFigure/KeyFigure.js +5 -5
- package/lib/KeyFigure/KeyFigure.js.map +1 -1
- package/lib/LicenseByline/EmbedByline.js +15 -15
- package/lib/LicenseByline/EmbedByline.js.map +1 -1
- package/lib/LicenseByline/LicenseLink.js +3 -3
- package/lib/LicenseByline/LicenseLink.js.map +1 -1
- package/lib/LinkBlock/LinkBlock.js +10 -10
- package/lib/LinkBlock/LinkBlock.js.map +1 -1
- package/lib/LinkBlock/LinkBlockSection.js +2 -2
- package/lib/LinkBlock/LinkBlockSection.js.map +1 -1
- package/lib/Pitch/Pitch.js +10 -10
- package/lib/Pitch/Pitch.js.map +1 -1
- package/lib/RelatedArticleList/RelatedArticleList.js +19 -19
- package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -1
- package/lib/ResourceBox/ResourceBox.js +13 -13
- package/lib/ResourceBox/ResourceBox.js.map +1 -1
- package/lib/TagSelector/TagSelector.js +22 -22
- package/lib/TagSelector/TagSelector.js.map +1 -1
- package/lib/ZendeskButton/ZendeskButton.js +2 -2
- package/lib/_virtual/rolldown_runtime.js +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +6 -6
- package/lib/locale/messages-en.d.ts +1 -0
- package/lib/locale/messages-en.js +3 -2
- package/lib/locale/messages-en.js.map +1 -1
- package/lib/locale/messages-nb.d.ts +1 -0
- package/lib/locale/messages-nb.js +3 -2
- package/lib/locale/messages-nb.js.map +1 -1
- package/lib/locale/messages-nn.d.ts +1 -0
- package/lib/locale/messages-nn.js +3 -2
- package/lib/locale/messages-nn.js.map +1 -1
- package/lib/locale/messages-se.d.ts +1 -0
- package/lib/locale/messages-se.js +3 -2
- package/lib/locale/messages-se.js.map +1 -1
- package/lib/model/ContentType.js.map +1 -1
- package/lib/model/SubjectCategories.js +1 -1
- package/lib/model/SubjectTypes.js +1 -1
- package/lib/model/WordClass.js +1 -1
- package/lib/utils/licenseAttributes.js +2 -2
- package/lib/utils/licenseAttributes.js.map +1 -1
- package/package.json +10 -10
- package/src/AnchorHeading/AnchorHeading.tsx +60 -0
- package/src/Embed/UuDisclaimerEmbed.stories.tsx +8 -8
- package/src/Grid/Grid.tsx +4 -2
- package/src/index.ts +1 -1
- package/src/locale/messages-en.ts +1 -0
- package/src/locale/messages-nb.ts +1 -0
- package/src/locale/messages-nn.ts +1 -0
- package/src/locale/messages-se.ts +1 -0
- package/es/CopyParagraphButton/CopyParagraphButton.mjs +0 -69
- package/es/CopyParagraphButton/CopyParagraphButton.mjs.map +0 -1
- package/lib/CopyParagraphButton/CopyParagraphButton.js +0 -70
- package/lib/CopyParagraphButton/CopyParagraphButton.js.map +0 -1
- package/src/CopyParagraphButton/CopyParagraphButton.tsx +0 -87
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
2
|
let react = require("react");
|
|
3
|
-
let
|
|
4
|
-
let
|
|
3
|
+
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
4
|
+
let _ndla_safelink = require("@ndla/safelink");
|
|
5
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
6
|
|
|
7
7
|
//#region src/LicenseByline/LicenseLink.tsx
|
|
@@ -12,7 +12,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
12
12
|
* LICENSE file in the root directory of this source tree.
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
|
-
const StyledSafeLink = (0,
|
|
15
|
+
const StyledSafeLink = (0, _ndla_styled_system_jsx.styled)(_ndla_safelink.SafeLink, { base: {
|
|
16
16
|
color: "text.link",
|
|
17
17
|
textDecoration: "underline",
|
|
18
18
|
whiteSpace: "nowrap",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LicenseLink.js","names":["SafeLink"],"sources":["../../src/LicenseByline/LicenseLink.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 { forwardRef } from \"react\";\nimport type { LicenseLocaleType } from \"@ndla/licenses\";\nimport { SafeLink, type SafeLinkProps } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\ninterface Props extends Omit<SafeLinkProps, \"to\"> {\n license: LicenseLocaleType;\n hideLink?: boolean;\n}\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n color: \"text.link\",\n textDecoration: \"underline\",\n whiteSpace: \"nowrap\",\n _hover: {\n textDecoration: \"none\",\n },\n _focusWithin: {\n textDecoration: \"none\",\n },\n mobileWideDown: {\n _disabled: {\n display: \"none\",\n },\n },\n },\n});\n\nexport const LicenseLink = forwardRef<HTMLAnchorElement, Props>(({ license, hideLink, ...rest }, ref) => {\n const disabled = hideLink ? { \"data-disabled\": \"\" } : {};\n if (license.abbreviation === \"unknown\") {\n return null;\n }\n if (license.url?.length) {\n return (\n <StyledSafeLink to={license.url} rel=\"license\" {...disabled} {...rest} ref={ref}>\n {license.abbreviation}\n </StyledSafeLink>\n );\n }\n return <span>{license.abbreviation}</span>;\n});\n"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,
|
|
1
|
+
{"version":3,"file":"LicenseLink.js","names":["SafeLink"],"sources":["../../src/LicenseByline/LicenseLink.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 { forwardRef } from \"react\";\nimport type { LicenseLocaleType } from \"@ndla/licenses\";\nimport { SafeLink, type SafeLinkProps } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\ninterface Props extends Omit<SafeLinkProps, \"to\"> {\n license: LicenseLocaleType;\n hideLink?: boolean;\n}\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n color: \"text.link\",\n textDecoration: \"underline\",\n whiteSpace: \"nowrap\",\n _hover: {\n textDecoration: \"none\",\n },\n _focusWithin: {\n textDecoration: \"none\",\n },\n mobileWideDown: {\n _disabled: {\n display: \"none\",\n },\n },\n },\n});\n\nexport const LicenseLink = forwardRef<HTMLAnchorElement, Props>(({ license, hideLink, ...rest }, ref) => {\n const disabled = hideLink ? { \"data-disabled\": \"\" } : {};\n if (license.abbreviation === \"unknown\") {\n return null;\n }\n if (license.url?.length) {\n return (\n <StyledSafeLink to={license.url} rel=\"license\" {...disabled} {...rest} ref={ref}>\n {license.abbreviation}\n </StyledSafeLink>\n );\n }\n return <span>{license.abbreviation}</span>;\n});\n"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,qDAAwBA,yBAAU,EACtC,MAAM;CACJ,OAAO;CACP,gBAAgB;CAChB,YAAY;CACZ,QAAQ,EACN,gBAAgB,QACjB;CACD,cAAc,EACZ,gBAAgB,QACjB;CACD,gBAAgB,EACd,WAAW,EACT,SAAS,QACV,EACF;CACF,EACF,CAAC;AAEF,MAAa,qCAAoD,EAAE,SAAS,UAAU,GAAG,QAAQ,QAAQ;CACvG,MAAM,WAAW,WAAW,EAAE,iBAAiB,IAAI,GAAG,EAAE;AACxD,KAAI,QAAQ,iBAAiB,UAC3B,QAAO;AAET,KAAI,QAAQ,KAAK,OACf,QACE,2CAAC;EAAe,IAAI,QAAQ;EAAK,KAAI;EAAU,GAAI;EAAU,GAAI;EAAW;YACzE,QAAQ;GACM;AAGrB,QAAO,2CAAC,oBAAM,QAAQ,eAAoB;EAC1C"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
2
|
const require_relativeUrl = require('../utils/relativeUrl.js');
|
|
3
3
|
let react = require("react");
|
|
4
|
-
let
|
|
5
|
-
let
|
|
4
|
+
let _ndla_primitives = require("@ndla/primitives");
|
|
5
|
+
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
6
6
|
let html_react_parser = require("html-react-parser");
|
|
7
7
|
html_react_parser = require_rolldown_runtime.__toESM(html_react_parser);
|
|
8
|
-
let
|
|
9
|
-
let
|
|
8
|
+
let _ndla_icons = require("@ndla/icons");
|
|
9
|
+
let _ndla_safelink = require("@ndla/safelink");
|
|
10
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
11
|
|
|
12
12
|
//#region src/LinkBlock/LinkBlock.tsx
|
|
@@ -17,12 +17,12 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
|
-
const InfoWrapper = (0,
|
|
20
|
+
const InfoWrapper = (0, _ndla_styled_system_jsx.styled)("div", { base: {
|
|
21
21
|
display: "flex",
|
|
22
22
|
flexDirection: "column",
|
|
23
23
|
gap: "xsmall"
|
|
24
24
|
} });
|
|
25
|
-
const StyledSafeLink = (0,
|
|
25
|
+
const StyledSafeLink = (0, _ndla_styled_system_jsx.styled)(_ndla_safelink.SafeLink, { base: {
|
|
26
26
|
display: "flex",
|
|
27
27
|
justifyContent: "space-between",
|
|
28
28
|
alignItems: "center",
|
|
@@ -45,12 +45,12 @@ const StyledSafeLink = (0, __ndla_styled_system_jsx.styled)(__ndla_safelink.Safe
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
} });
|
|
48
|
-
const StyledDateContainer = (0,
|
|
48
|
+
const StyledDateContainer = (0, _ndla_styled_system_jsx.styled)("div", { base: {
|
|
49
49
|
display: "flex",
|
|
50
50
|
alignItems: "center",
|
|
51
51
|
gap: "xxsmall"
|
|
52
52
|
} });
|
|
53
|
-
const StyledCalendarEd = (0,
|
|
53
|
+
const StyledCalendarEd = (0, _ndla_styled_system_jsx.styled)(_ndla_icons.CalendarLine, { base: { color: "icon.strong" } });
|
|
54
54
|
const LinkBlock = ({ title, articleLanguage, date, url, path }) => {
|
|
55
55
|
const href = require_relativeUrl.getPossiblyRelativeUrl(url, path);
|
|
56
56
|
const formattedDate = (0, react.useMemo)(() => {
|
|
@@ -65,7 +65,7 @@ const LinkBlock = ({ title, articleLanguage, date, url, path }) => {
|
|
|
65
65
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledSafeLink, {
|
|
66
66
|
to: href,
|
|
67
67
|
"data-embed-type": "link-block",
|
|
68
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(InfoWrapper, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
68
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(InfoWrapper, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Heading, {
|
|
69
69
|
asChild: true,
|
|
70
70
|
consumeCss: true,
|
|
71
71
|
textStyle: "title.medium",
|
|
@@ -73,7 +73,7 @@ const LinkBlock = ({ title, articleLanguage, date, url, path }) => {
|
|
|
73
73
|
"data-heading": true,
|
|
74
74
|
children: (0, html_react_parser.default)(title)
|
|
75
75
|
})
|
|
76
|
-
}), !!date && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledDateContainer, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledCalendarEd, {}), formattedDate] })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
76
|
+
}), !!date && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledDateContainer, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledCalendarEd, {}), formattedDate] })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_icons.ArrowRightLine, { "data-forward": true })]
|
|
77
77
|
});
|
|
78
78
|
};
|
|
79
79
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkBlock.js","names":["SafeLink","CalendarLine","getPossiblyRelativeUrl","Heading","ArrowRightLine"],"sources":["../../src/LinkBlock/LinkBlock.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 { useMemo } from \"react\";\nimport { ArrowRightLine, CalendarLine } from \"@ndla/icons\";\nimport { Heading } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { LinkBlockEmbedData } from \"@ndla/types-embed\";\nimport { getPossiblyRelativeUrl } from \"../utils/relativeUrl\";\n\nconst InfoWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n});\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n background: \"surface.default\",\n padding: \"medium\",\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n borderRadius: \"xsmall\",\n \"& h3\": {\n textDecoration: \"underline\",\n },\n \"& [data-forward]\": {\n transitionProperty: \"width, height\",\n transitionTimingFunction: \"ease-in-out\",\n transitionDuration: \"fast\",\n },\n _hover: {\n \"& h3\": {\n textDecoration: \"none\",\n },\n \"& [data-forward]\": {\n width: \"large\",\n height: \"large\",\n },\n },\n },\n});\n\nconst StyledDateContainer = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"xxsmall\",\n },\n});\n\nconst StyledCalendarEd = styled(CalendarLine, {\n base: {\n color: \"icon.strong\",\n },\n});\n\ninterface Props extends Omit<LinkBlockEmbedData, \"resource\"> {\n path?: string;\n articleLanguage?: string;\n}\n\nexport const LinkBlock = ({ title, articleLanguage, date, url, path }: Props) => {\n const href = getPossiblyRelativeUrl(url, path);\n const formattedDate = useMemo(() => {\n if (!date) return null;\n return new Intl.DateTimeFormat(articleLanguage, {\n timeZone: \"CET\",\n day: \"2-digit\",\n month: \"long\",\n year: \"numeric\",\n }).format(new Date(date));\n }, [date, articleLanguage]);\n return (\n <StyledSafeLink to={href} data-embed-type=\"link-block\">\n <InfoWrapper>\n <Heading asChild consumeCss textStyle=\"title.medium\">\n <h3 data-heading>{parse(title)}</h3>\n </Heading>\n {!!date && (\n <StyledDateContainer>\n <StyledCalendarEd />\n {formattedDate}\n </StyledDateContainer>\n )}\n </InfoWrapper>\n <ArrowRightLine data-forward />\n </StyledSafeLink>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,MAAM,
|
|
1
|
+
{"version":3,"file":"LinkBlock.js","names":["SafeLink","CalendarLine","getPossiblyRelativeUrl","Heading","ArrowRightLine"],"sources":["../../src/LinkBlock/LinkBlock.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 { useMemo } from \"react\";\nimport { ArrowRightLine, CalendarLine } from \"@ndla/icons\";\nimport { Heading } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { LinkBlockEmbedData } from \"@ndla/types-embed\";\nimport { getPossiblyRelativeUrl } from \"../utils/relativeUrl\";\n\nconst InfoWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n },\n});\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n background: \"surface.default\",\n padding: \"medium\",\n border: \"1px solid\",\n borderColor: \"stroke.subtle\",\n borderRadius: \"xsmall\",\n \"& h3\": {\n textDecoration: \"underline\",\n },\n \"& [data-forward]\": {\n transitionProperty: \"width, height\",\n transitionTimingFunction: \"ease-in-out\",\n transitionDuration: \"fast\",\n },\n _hover: {\n \"& h3\": {\n textDecoration: \"none\",\n },\n \"& [data-forward]\": {\n width: \"large\",\n height: \"large\",\n },\n },\n },\n});\n\nconst StyledDateContainer = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"xxsmall\",\n },\n});\n\nconst StyledCalendarEd = styled(CalendarLine, {\n base: {\n color: \"icon.strong\",\n },\n});\n\ninterface Props extends Omit<LinkBlockEmbedData, \"resource\"> {\n path?: string;\n articleLanguage?: string;\n}\n\nexport const LinkBlock = ({ title, articleLanguage, date, url, path }: Props) => {\n const href = getPossiblyRelativeUrl(url, path);\n const formattedDate = useMemo(() => {\n if (!date) return null;\n return new Intl.DateTimeFormat(articleLanguage, {\n timeZone: \"CET\",\n day: \"2-digit\",\n month: \"long\",\n year: \"numeric\",\n }).format(new Date(date));\n }, [date, articleLanguage]);\n return (\n <StyledSafeLink to={href} data-embed-type=\"link-block\">\n <InfoWrapper>\n <Heading asChild consumeCss textStyle=\"title.medium\">\n <h3 data-heading>{parse(title)}</h3>\n </Heading>\n {!!date && (\n <StyledDateContainer>\n <StyledCalendarEd />\n {formattedDate}\n </StyledDateContainer>\n )}\n </InfoWrapper>\n <ArrowRightLine data-forward />\n </StyledSafeLink>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,MAAM,kDAAqB,OAAO,EAChC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACN,EACF,CAAC;AAEF,MAAM,qDAAwBA,yBAAU,EACtC,MAAM;CACJ,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,aAAa;CACb,cAAc;CACd,QAAQ,EACN,gBAAgB,aACjB;CACD,oBAAoB;EAClB,oBAAoB;EACpB,0BAA0B;EAC1B,oBAAoB;EACrB;CACD,QAAQ;EACN,QAAQ,EACN,gBAAgB,QACjB;EACD,oBAAoB;GAClB,OAAO;GACP,QAAQ;GACT;EACF;CACF,EACF,CAAC;AAEF,MAAM,0DAA6B,OAAO,EACxC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,KAAK;CACN,EACF,CAAC;AAEF,MAAM,uDAA0BC,0BAAc,EAC5C,MAAM,EACJ,OAAO,eACR,EACF,CAAC;AAOF,MAAa,aAAa,EAAE,OAAO,iBAAiB,MAAM,KAAK,WAAkB;CAC/E,MAAM,OAAOC,2CAAuB,KAAK,KAAK;CAC9C,MAAM,yCAA8B;AAClC,MAAI,CAAC,KAAM,QAAO;AAClB,SAAO,IAAI,KAAK,eAAe,iBAAiB;GAC9C,UAAU;GACV,KAAK;GACL,OAAO;GACP,MAAM;GACP,CAAC,CAAC,OAAO,IAAI,KAAK,KAAK,CAAC;IACxB,CAAC,MAAM,gBAAgB,CAAC;AAC3B,QACE,4CAAC;EAAe,IAAI;EAAM,mBAAgB;aACxC,4CAAC,0BACC,2CAACC;GAAQ;GAAQ;GAAW,WAAU;aACpC,2CAAC;IAAG;6CAAoB,MAAM;KAAM;IAC5B,EACT,CAAC,CAAC,QACD,4CAAC,kCACC,2CAAC,qBAAmB,EACnB,iBACmB,IAEZ,EACd,2CAACC,8BAAe,uBAAe;GAChB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
2
|
let react = require("react");
|
|
3
|
-
let
|
|
3
|
+
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
4
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
5
|
|
|
6
6
|
//#region src/LinkBlock/LinkBlockSection.tsx
|
|
@@ -11,7 +11,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
|
-
const StyledList = (0,
|
|
14
|
+
const StyledList = (0, _ndla_styled_system_jsx.styled)("ul", { base: {
|
|
15
15
|
display: "flex",
|
|
16
16
|
flexDirection: "column",
|
|
17
17
|
gap: "xsmall",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkBlockSection.js","names":["Children"],"sources":["../../src/LinkBlock/LinkBlockSection.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 { Children, type HTMLAttributes, type ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\ninterface Props extends HTMLAttributes<HTMLElement> {\n children: ReactNode;\n}\n\nconst StyledList = styled(\"ul\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n listStyle: \"none\",\n },\n});\n\nexport const LinkBlockSection = ({ children, ...rest }: Props) => {\n return (\n <nav {...rest} data-embed-type=\"link-block-list\">\n <StyledList>\n {Children.map(children, (child) => (\n <li>{child}</li>\n ))}\n </StyledList>\n </nav>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAM,
|
|
1
|
+
{"version":3,"file":"LinkBlockSection.js","names":["Children"],"sources":["../../src/LinkBlock/LinkBlockSection.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 { Children, type HTMLAttributes, type ReactNode } from \"react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\ninterface Props extends HTMLAttributes<HTMLElement> {\n children: ReactNode;\n}\n\nconst StyledList = styled(\"ul\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n listStyle: \"none\",\n },\n});\n\nexport const LinkBlockSection = ({ children, ...rest }: Props) => {\n return (\n <nav {...rest} data-embed-type=\"link-block-list\">\n <StyledList>\n {Children.map(children, (child) => (\n <li>{child}</li>\n ))}\n </StyledList>\n </nav>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAM,iDAAoB,MAAM,EAC9B,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,WAAW;CACZ,EACF,CAAC;AAEF,MAAa,oBAAoB,EAAE,UAAU,GAAG,WAAkB;AAChE,QACE,2CAAC;EAAI,GAAI;EAAM,mBAAgB;YAC7B,2CAAC,wBACEA,eAAS,IAAI,WAAW,UACvB,2CAAC,kBAAI,QAAW,CAChB,GACS;GACT"}
|
package/lib/Pitch/Pitch.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
2
|
const require_relativeUrl = require('../utils/relativeUrl.js');
|
|
3
|
-
let
|
|
4
|
-
let
|
|
3
|
+
let _ndla_primitives = require("@ndla/primitives");
|
|
4
|
+
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
5
5
|
let html_react_parser = require("html-react-parser");
|
|
6
6
|
html_react_parser = require_rolldown_runtime.__toESM(html_react_parser);
|
|
7
|
-
let
|
|
7
|
+
let _ndla_safelink = require("@ndla/safelink");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
-
let
|
|
9
|
+
let _ndla_styled_system_patterns = require("@ndla/styled-system/patterns");
|
|
10
10
|
|
|
11
11
|
//#region src/Pitch/Pitch.tsx
|
|
12
12
|
/**
|
|
@@ -16,16 +16,16 @@ let __ndla_styled_system_patterns = require("@ndla/styled-system/patterns");
|
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
|
-
const StyledCardHeading = (0,
|
|
20
|
-
const StyledText = (0,
|
|
21
|
-
const StyledCardRoot = (0,
|
|
19
|
+
const StyledCardHeading = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.CardHeading, { base: { paddingBlockStart: "medium" } });
|
|
20
|
+
const StyledText = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.Text, { base: { paddingBlockEnd: "medium" } });
|
|
21
|
+
const StyledCardRoot = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.CardRoot, { base: {
|
|
22
22
|
outline: "0px",
|
|
23
23
|
boxShadow: "none",
|
|
24
24
|
display: "flex",
|
|
25
25
|
flexDirection: "column",
|
|
26
26
|
gap: "small"
|
|
27
27
|
} });
|
|
28
|
-
const StyledCardImage = (0,
|
|
28
|
+
const StyledCardImage = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.CardImage, { base: {
|
|
29
29
|
aspectRatio: "16/9",
|
|
30
30
|
height: "unset"
|
|
31
31
|
} });
|
|
@@ -41,10 +41,10 @@ const Pitch = ({ title, url, metaImage, path, description }) => {
|
|
|
41
41
|
textStyle: "heading.small",
|
|
42
42
|
asChild: true,
|
|
43
43
|
consumeCss: true,
|
|
44
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
44
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_safelink.SafeLink, {
|
|
45
45
|
to: href,
|
|
46
46
|
unstyled: true,
|
|
47
|
-
css:
|
|
47
|
+
css: _ndla_styled_system_patterns.linkOverlay.raw(),
|
|
48
48
|
children: (0, html_react_parser.default)(title)
|
|
49
49
|
})
|
|
50
50
|
}),
|
package/lib/Pitch/Pitch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pitch.js","names":["CardHeading","Text","CardRoot","CardImage","getPossiblyRelativeUrl","SafeLink","linkOverlay"],"sources":["../../src/Pitch/Pitch.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 { CardHeading, CardImage, CardRoot, Text } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { linkOverlay } from \"@ndla/styled-system/patterns\";\nimport { getPossiblyRelativeUrl } from \"../utils/relativeUrl\";\n\nexport interface Props {\n title: string;\n url: string;\n description?: string;\n metaImage: {\n url: string;\n alt: string;\n };\n path?: string;\n}\n\nconst StyledCardHeading = styled(CardHeading, {\n base: {\n paddingBlockStart: \"medium\",\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n paddingBlockEnd: \"medium\",\n },\n});\n\nconst StyledCardRoot = styled(CardRoot, {\n base: {\n outline: \"0px\",\n boxShadow: \"none\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"small\",\n },\n});\n\nconst StyledCardImage = styled(CardImage, {\n base: {\n aspectRatio: \"16/9\",\n height: \"unset\",\n },\n});\n\nexport const Pitch = ({ title, url, metaImage, path, description }: Props) => {\n const href = getPossiblyRelativeUrl(url, path);\n\n return (\n <StyledCardRoot nonInteractive data-embed-type=\"pitch\" asChild consumeCss>\n <div>\n <StyledCardHeading textStyle=\"heading.small\" asChild consumeCss>\n <SafeLink to={href} unstyled css={linkOverlay.raw()}>\n {parse(title)}\n </SafeLink>\n </StyledCardHeading>\n {!!description && (\n <StyledText textStyle=\"body.xlarge\" asChild consumeCss>\n <div>{parse(description)}</div>\n </StyledText>\n )}\n <StyledCardImage\n variant=\"rounded\"\n src={metaImage.url}\n alt={metaImage.alt}\n sizes=\"480px\"\n fallbackWidth={300}\n width={550}\n height={310}\n />\n </div>\n </StyledCardRoot>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,MAAM,
|
|
1
|
+
{"version":3,"file":"Pitch.js","names":["CardHeading","Text","CardRoot","CardImage","getPossiblyRelativeUrl","SafeLink","linkOverlay"],"sources":["../../src/Pitch/Pitch.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 { CardHeading, CardImage, CardRoot, Text } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { linkOverlay } from \"@ndla/styled-system/patterns\";\nimport { getPossiblyRelativeUrl } from \"../utils/relativeUrl\";\n\nexport interface Props {\n title: string;\n url: string;\n description?: string;\n metaImage: {\n url: string;\n alt: string;\n };\n path?: string;\n}\n\nconst StyledCardHeading = styled(CardHeading, {\n base: {\n paddingBlockStart: \"medium\",\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n paddingBlockEnd: \"medium\",\n },\n});\n\nconst StyledCardRoot = styled(CardRoot, {\n base: {\n outline: \"0px\",\n boxShadow: \"none\",\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"small\",\n },\n});\n\nconst StyledCardImage = styled(CardImage, {\n base: {\n aspectRatio: \"16/9\",\n height: \"unset\",\n },\n});\n\nexport const Pitch = ({ title, url, metaImage, path, description }: Props) => {\n const href = getPossiblyRelativeUrl(url, path);\n\n return (\n <StyledCardRoot nonInteractive data-embed-type=\"pitch\" asChild consumeCss>\n <div>\n <StyledCardHeading textStyle=\"heading.small\" asChild consumeCss>\n <SafeLink to={href} unstyled css={linkOverlay.raw()}>\n {parse(title)}\n </SafeLink>\n </StyledCardHeading>\n {!!description && (\n <StyledText textStyle=\"body.xlarge\" asChild consumeCss>\n <div>{parse(description)}</div>\n </StyledText>\n )}\n <StyledCardImage\n variant=\"rounded\"\n src={metaImage.url}\n alt={metaImage.alt}\n sizes=\"480px\"\n fallbackWidth={300}\n width={550}\n height={310}\n />\n </div>\n </StyledCardRoot>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,MAAM,wDAA2BA,8BAAa,EAC5C,MAAM,EACJ,mBAAmB,UACpB,EACF,CAAC;AAEF,MAAM,iDAAoBC,uBAAM,EAC9B,MAAM,EACJ,iBAAiB,UAClB,EACF,CAAC;AAEF,MAAM,qDAAwBC,2BAAU,EACtC,MAAM;CACJ,SAAS;CACT,WAAW;CACX,SAAS;CACT,eAAe;CACf,KAAK;CACN,EACF,CAAC;AAEF,MAAM,sDAAyBC,4BAAW,EACxC,MAAM;CACJ,aAAa;CACb,QAAQ;CACT,EACF,CAAC;AAEF,MAAa,SAAS,EAAE,OAAO,KAAK,WAAW,MAAM,kBAAyB;CAC5E,MAAM,OAAOC,2CAAuB,KAAK,KAAK;AAE9C,QACE,2CAAC;EAAe;EAAe,mBAAgB;EAAQ;EAAQ;YAC7D,4CAAC;GACC,2CAAC;IAAkB,WAAU;IAAgB;IAAQ;cACnD,2CAACC;KAAS,IAAI;KAAM;KAAS,KAAKC,yCAAY,KAAK;8CAC1C,MAAM;MACJ;KACO;GACnB,CAAC,CAAC,eACD,2CAAC;IAAW,WAAU;IAAc;IAAQ;cAC1C,2CAAC,kDAAW,YAAY,GAAO;KACpB;GAEf,2CAAC;IACC,SAAQ;IACR,KAAK,UAAU;IACf,KAAK,UAAU;IACf,OAAM;IACN,eAAe;IACf,OAAO;IACP,QAAQ;KACR;MACE;GACS"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
2
|
let react = require("react");
|
|
3
|
-
let
|
|
4
|
-
let
|
|
3
|
+
let _ndla_primitives = require("@ndla/primitives");
|
|
4
|
+
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
5
5
|
let react_i18next = require("react-i18next");
|
|
6
|
-
let
|
|
7
|
-
let
|
|
6
|
+
let _ndla_icons = require("@ndla/icons");
|
|
7
|
+
let _ndla_safelink = require("@ndla/safelink");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
-
let
|
|
9
|
+
let _ndla_styled_system_patterns = require("@ndla/styled-system/patterns");
|
|
10
10
|
|
|
11
11
|
//#region src/RelatedArticleList/RelatedArticleList.tsx
|
|
12
12
|
/**
|
|
@@ -16,28 +16,28 @@ let __ndla_styled_system_patterns = require("@ndla/styled-system/patterns");
|
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
|
-
const StyledSpan = (0,
|
|
19
|
+
const StyledSpan = (0, _ndla_styled_system_jsx.styled)("span", { base: {
|
|
20
20
|
display: "flex",
|
|
21
21
|
alignItems: "center",
|
|
22
22
|
gap: "3xsmall"
|
|
23
23
|
} });
|
|
24
24
|
const RelatedArticle = ({ title, introduction, to, linkInfo = "", target = "" }) => {
|
|
25
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
25
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.CardRoot, {
|
|
26
26
|
"data-embed-type": "related-article",
|
|
27
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
28
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
27
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_ndla_primitives.CardContent, { children: [
|
|
28
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.CardHeading, {
|
|
29
29
|
asChild: true,
|
|
30
30
|
consumeCss: true,
|
|
31
|
-
css:
|
|
32
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
31
|
+
css: _ndla_styled_system_patterns.linkOverlay.raw(),
|
|
32
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_safelink.SafeLink, {
|
|
33
33
|
to,
|
|
34
34
|
target,
|
|
35
35
|
rel: linkInfo ? "noopener noreferrer" : void 0,
|
|
36
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledSpan, { children: [title, target === "_blank" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
36
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledSpan, { children: [title, target === "_blank" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_icons.ExternalLinkLine, {})] })
|
|
37
37
|
})
|
|
38
38
|
}),
|
|
39
|
-
!!introduction && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
40
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
39
|
+
!!introduction && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Text, { dangerouslySetInnerHTML: { __html: introduction } }),
|
|
40
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Text, {
|
|
41
41
|
color: "text.subtle",
|
|
42
42
|
textStyle: "label.small",
|
|
43
43
|
children: linkInfo
|
|
@@ -45,28 +45,28 @@ const RelatedArticle = ({ title, introduction, to, linkInfo = "", target = "" })
|
|
|
45
45
|
] })
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
|
-
const HeadingWrapper = (0,
|
|
48
|
+
const HeadingWrapper = (0, _ndla_styled_system_jsx.styled)("div", { base: {
|
|
49
49
|
display: "flex",
|
|
50
50
|
width: "100%",
|
|
51
51
|
justifyContent: "space-between",
|
|
52
52
|
alignItems: "center",
|
|
53
53
|
alignSelf: "flex-start"
|
|
54
54
|
} });
|
|
55
|
-
const ArticlesWrapper = (0,
|
|
55
|
+
const ArticlesWrapper = (0, _ndla_styled_system_jsx.styled)("div", { base: {
|
|
56
56
|
display: "grid",
|
|
57
57
|
width: "100%",
|
|
58
58
|
gridTemplateColumns: "repeat(2, 1fr)",
|
|
59
59
|
gap: "medium",
|
|
60
60
|
tabletDown: { gridTemplateColumns: "1fr" }
|
|
61
61
|
} });
|
|
62
|
-
const StyledSection = (0,
|
|
62
|
+
const StyledSection = (0, _ndla_styled_system_jsx.styled)("section", { base: {
|
|
63
63
|
display: "flex",
|
|
64
64
|
flexDirection: "column",
|
|
65
65
|
alignItems: "center",
|
|
66
66
|
gap: "medium",
|
|
67
67
|
clear: "both"
|
|
68
68
|
} });
|
|
69
|
-
const StyledButton = (0,
|
|
69
|
+
const StyledButton = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.Button, { base: { marginBlockStart: "xsmall" } });
|
|
70
70
|
const RelatedArticleList = ({ children = [], articleCount, headingLevel: HeadingElement = "h2", headingButtons, ...rest }) => {
|
|
71
71
|
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
72
72
|
const { t } = (0, react_i18next.useTranslation)();
|
|
@@ -80,7 +80,7 @@ const RelatedArticleList = ({ children = [], articleCount, headingLevel: Heading
|
|
|
80
80
|
...rest,
|
|
81
81
|
"data-embed-type": "related-content-list",
|
|
82
82
|
children: [
|
|
83
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(HeadingWrapper, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
83
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(HeadingWrapper, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Heading, {
|
|
84
84
|
asChild: true,
|
|
85
85
|
consumeCss: true,
|
|
86
86
|
textStyle: "title.large",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelatedArticleList.js","names":["CardRoot","CardContent","CardHeading","linkOverlay","SafeLink","ExternalLinkLine","Text","Button","Children","Heading"],"sources":["../../src/RelatedArticleList/RelatedArticleList.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 { Children, type ComponentPropsWithoutRef, type ReactElement, type ReactNode, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { ExternalLinkLine } from \"@ndla/icons\";\nimport { CardContent, CardHeading, CardRoot, Text, Heading, Button } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { linkOverlay } from \"@ndla/styled-system/patterns\";\nimport type { HeadingLevel } from \"../types\";\n\ninterface RelatedArticleProps {\n title: string;\n introduction?: string;\n to: string;\n linkInfo?: string;\n target?: string;\n}\n\nconst StyledSpan = styled(\"span\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"3xsmall\",\n },\n});\n\nexport const RelatedArticle = ({ title, introduction, to, linkInfo = \"\", target = \"\" }: RelatedArticleProps) => {\n return (\n <CardRoot data-embed-type=\"related-article\">\n <CardContent>\n <CardHeading asChild consumeCss css={linkOverlay.raw()}>\n <SafeLink to={to} target={target} rel={linkInfo ? \"noopener noreferrer\" : undefined}>\n <StyledSpan>\n {title}\n {target === \"_blank\" && <ExternalLinkLine />}\n </StyledSpan>\n </SafeLink>\n </CardHeading>\n {!!introduction && <Text dangerouslySetInnerHTML={{ __html: introduction }} />}\n <Text color=\"text.subtle\" textStyle=\"label.small\">\n {linkInfo}\n </Text>\n </CardContent>\n </CardRoot>\n );\n};\n\nconst HeadingWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n width: \"100%\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n alignSelf: \"flex-start\",\n },\n});\n\nconst ArticlesWrapper = styled(\"div\", {\n base: {\n display: \"grid\",\n width: \"100%\",\n gridTemplateColumns: \"repeat(2, 1fr)\",\n gap: \"medium\",\n tabletDown: {\n gridTemplateColumns: \"1fr\",\n },\n },\n});\n\nconst StyledSection = styled(\"section\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: \"medium\",\n clear: \"both\",\n },\n});\n\nconst StyledButton = styled(Button, {\n base: {\n marginBlockStart: \"xsmall\",\n },\n});\n\ninterface Props extends ComponentPropsWithoutRef<\"section\"> {\n children?: ReactElement[];\n articleCount?: number;\n headingLevel?: HeadingLevel;\n headingButtons?: ReactNode;\n}\n\nexport const RelatedArticleList = ({\n children = [],\n articleCount,\n headingLevel: HeadingElement = \"h2\",\n headingButtons,\n ...rest\n}: Props) => {\n const [expanded, setExpanded] = useState(false);\n const { t } = useTranslation();\n const childCount = useMemo(() => articleCount ?? Children.count(children), [children, articleCount]);\n const childrenToShow = useMemo(\n () => (childCount > 2 && !expanded ? children?.slice(0, 2) : children),\n [childCount, children, expanded],\n );\n\n return (\n <StyledSection {...rest} data-embed-type=\"related-content-list\">\n <HeadingWrapper>\n <Heading asChild consumeCss textStyle=\"title.large\" fontWeight=\"bold\">\n <HeadingElement>{t(\"related.title\")}</HeadingElement>\n </Heading>\n {headingButtons}\n </HeadingWrapper>\n <ArticlesWrapper>{childrenToShow}</ArticlesWrapper>\n {childCount > 2 ? (\n <StyledButton variant=\"secondary\" onClick={() => setExpanded((p) => !p)}>\n {t(`related.show${expanded ? \"Less\" : \"More\"}`)}\n </StyledButton>\n ) : null}\n </StyledSection>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,MAAM,
|
|
1
|
+
{"version":3,"file":"RelatedArticleList.js","names":["CardRoot","CardContent","CardHeading","linkOverlay","SafeLink","ExternalLinkLine","Text","Button","Children","Heading"],"sources":["../../src/RelatedArticleList/RelatedArticleList.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 { Children, type ComponentPropsWithoutRef, type ReactElement, type ReactNode, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { ExternalLinkLine } from \"@ndla/icons\";\nimport { CardContent, CardHeading, CardRoot, Text, Heading, Button } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { linkOverlay } from \"@ndla/styled-system/patterns\";\nimport type { HeadingLevel } from \"../types\";\n\ninterface RelatedArticleProps {\n title: string;\n introduction?: string;\n to: string;\n linkInfo?: string;\n target?: string;\n}\n\nconst StyledSpan = styled(\"span\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"3xsmall\",\n },\n});\n\nexport const RelatedArticle = ({ title, introduction, to, linkInfo = \"\", target = \"\" }: RelatedArticleProps) => {\n return (\n <CardRoot data-embed-type=\"related-article\">\n <CardContent>\n <CardHeading asChild consumeCss css={linkOverlay.raw()}>\n <SafeLink to={to} target={target} rel={linkInfo ? \"noopener noreferrer\" : undefined}>\n <StyledSpan>\n {title}\n {target === \"_blank\" && <ExternalLinkLine />}\n </StyledSpan>\n </SafeLink>\n </CardHeading>\n {!!introduction && <Text dangerouslySetInnerHTML={{ __html: introduction }} />}\n <Text color=\"text.subtle\" textStyle=\"label.small\">\n {linkInfo}\n </Text>\n </CardContent>\n </CardRoot>\n );\n};\n\nconst HeadingWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n width: \"100%\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n alignSelf: \"flex-start\",\n },\n});\n\nconst ArticlesWrapper = styled(\"div\", {\n base: {\n display: \"grid\",\n width: \"100%\",\n gridTemplateColumns: \"repeat(2, 1fr)\",\n gap: \"medium\",\n tabletDown: {\n gridTemplateColumns: \"1fr\",\n },\n },\n});\n\nconst StyledSection = styled(\"section\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: \"medium\",\n clear: \"both\",\n },\n});\n\nconst StyledButton = styled(Button, {\n base: {\n marginBlockStart: \"xsmall\",\n },\n});\n\ninterface Props extends ComponentPropsWithoutRef<\"section\"> {\n children?: ReactElement[];\n articleCount?: number;\n headingLevel?: HeadingLevel;\n headingButtons?: ReactNode;\n}\n\nexport const RelatedArticleList = ({\n children = [],\n articleCount,\n headingLevel: HeadingElement = \"h2\",\n headingButtons,\n ...rest\n}: Props) => {\n const [expanded, setExpanded] = useState(false);\n const { t } = useTranslation();\n const childCount = useMemo(() => articleCount ?? Children.count(children), [children, articleCount]);\n const childrenToShow = useMemo(\n () => (childCount > 2 && !expanded ? children?.slice(0, 2) : children),\n [childCount, children, expanded],\n );\n\n return (\n <StyledSection {...rest} data-embed-type=\"related-content-list\">\n <HeadingWrapper>\n <Heading asChild consumeCss textStyle=\"title.large\" fontWeight=\"bold\">\n <HeadingElement>{t(\"related.title\")}</HeadingElement>\n </Heading>\n {headingButtons}\n </HeadingWrapper>\n <ArticlesWrapper>{childrenToShow}</ArticlesWrapper>\n {childCount > 2 ? (\n <StyledButton variant=\"secondary\" onClick={() => setExpanded((p) => !p)}>\n {t(`related.show${expanded ? \"Less\" : \"More\"}`)}\n </StyledButton>\n ) : null}\n </StyledSection>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,MAAM,iDAAoB,QAAQ,EAChC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,KAAK;CACN,EACF,CAAC;AAEF,MAAa,kBAAkB,EAAE,OAAO,cAAc,IAAI,WAAW,IAAI,SAAS,SAA8B;AAC9G,QACE,2CAACA;EAAS,mBAAgB;YACxB,4CAACC;GACC,2CAACC;IAAY;IAAQ;IAAW,KAAKC,yCAAY,KAAK;cACpD,2CAACC;KAAa;KAAY;KAAQ,KAAK,WAAW,wBAAwB;eACxE,4CAAC,yBACE,OACA,WAAW,YAAY,2CAACC,iCAAmB,IACjC;MACJ;KACC;GACb,CAAC,CAAC,gBAAgB,2CAACC,yBAAK,yBAAyB,EAAE,QAAQ,cAAc,GAAI;GAC9E,2CAACA;IAAK,OAAM;IAAc,WAAU;cACjC;KACI;MACK;GACL;;AAIf,MAAM,qDAAwB,OAAO,EACnC,MAAM;CACJ,SAAS;CACT,OAAO;CACP,gBAAgB;CAChB,YAAY;CACZ,WAAW;CACZ,EACF,CAAC;AAEF,MAAM,sDAAyB,OAAO,EACpC,MAAM;CACJ,SAAS;CACT,OAAO;CACP,qBAAqB;CACrB,KAAK;CACL,YAAY,EACV,qBAAqB,OACtB;CACF,EACF,CAAC;AAEF,MAAM,oDAAuB,WAAW,EACtC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,YAAY;CACZ,KAAK;CACL,OAAO;CACR,EACF,CAAC;AAEF,MAAM,mDAAsBC,yBAAQ,EAClC,MAAM,EACJ,kBAAkB,UACnB,EACF,CAAC;AASF,MAAa,sBAAsB,EACjC,WAAW,EAAE,EACb,cACA,cAAc,iBAAiB,MAC/B,gBACA,GAAG,WACQ;CACX,MAAM,CAAC,UAAU,mCAAwB,MAAM;CAC/C,MAAM,EAAE,yCAAsB;CAC9B,MAAM,sCAA2B,gBAAgBC,eAAS,MAAM,SAAS,EAAE,CAAC,UAAU,aAAa,CAAC;CACpG,MAAM,0CACG,aAAa,KAAK,CAAC,WAAW,UAAU,MAAM,GAAG,EAAE,GAAG,UAC7D;EAAC;EAAY;EAAU;EAAS,CACjC;AAED,QACE,4CAAC;EAAc,GAAI;EAAM,mBAAgB;;GACvC,4CAAC,6BACC,2CAACC;IAAQ;IAAQ;IAAW,WAAU;IAAc,YAAW;cAC7D,2CAAC,4BAAgB,EAAE,gBAAgB,GAAkB;KAC7C,EACT,kBACc;GACjB,2CAAC,6BAAiB,iBAAiC;GAClD,aAAa,IACZ,2CAAC;IAAa,SAAQ;IAAY,eAAe,aAAa,MAAM,CAAC,EAAE;cACpE,EAAE,eAAe,WAAW,SAAS,SAAS;KAClC,GACb;;GACU"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
-
let
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
2
|
+
let _ndla_primitives = require("@ndla/primitives");
|
|
3
|
+
let _ndla_styled_system_jsx = require("@ndla/styled-system/jsx");
|
|
4
|
+
let _ndla_icons = require("@ndla/icons");
|
|
5
|
+
let _ndla_safelink = require("@ndla/safelink");
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
-
let
|
|
7
|
+
let _ndla_core = require("@ndla/core");
|
|
8
8
|
|
|
9
9
|
//#region src/ResourceBox/ResourceBox.tsx
|
|
10
10
|
/**
|
|
@@ -14,7 +14,7 @@ let __ndla_core = require("@ndla/core");
|
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
|
-
const Container = (0,
|
|
17
|
+
const Container = (0, _ndla_styled_system_jsx.styled)("div", { base: {
|
|
18
18
|
display: "flex",
|
|
19
19
|
padding: "medium",
|
|
20
20
|
borderRadius: "xsmall",
|
|
@@ -30,7 +30,7 @@ const Container = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
|
30
30
|
padding: "0"
|
|
31
31
|
}
|
|
32
32
|
} });
|
|
33
|
-
const ContentWrapper = (0,
|
|
33
|
+
const ContentWrapper = (0, _ndla_styled_system_jsx.styled)("div", { base: {
|
|
34
34
|
display: "flex",
|
|
35
35
|
flexDirection: "column",
|
|
36
36
|
alignItems: "flex-start",
|
|
@@ -38,7 +38,7 @@ const ContentWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
|
38
38
|
flex: "1",
|
|
39
39
|
tabletDown: { padding: "xsmall" }
|
|
40
40
|
} });
|
|
41
|
-
const StyledImage = (0,
|
|
41
|
+
const StyledImage = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.Image, { base: {
|
|
42
42
|
objectFit: "cover",
|
|
43
43
|
borderRadius: "xsmall",
|
|
44
44
|
width: "fit-content",
|
|
@@ -48,15 +48,15 @@ const StyledImage = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Image
|
|
|
48
48
|
borderRadius: "0"
|
|
49
49
|
}
|
|
50
50
|
} });
|
|
51
|
-
const StyledText = (0,
|
|
51
|
+
const StyledText = (0, _ndla_styled_system_jsx.styled)(_ndla_primitives.Text, { base: { flex: "1" } });
|
|
52
52
|
const ResourceBox = ({ image, title, caption, url, buttonText }) => {
|
|
53
53
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Container, { children: [image ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledImage, {
|
|
54
54
|
src: image.src,
|
|
55
55
|
alt: image.alt,
|
|
56
|
-
sizes: `(min-width: ${
|
|
56
|
+
sizes: `(min-width: ${_ndla_core.breakpoints.desktop}) 150px, (max-width: ${_ndla_core.breakpoints.tablet} ) 400px, 200px`,
|
|
57
57
|
variant: "rounded"
|
|
58
58
|
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ContentWrapper, { children: [
|
|
59
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
59
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Heading, {
|
|
60
60
|
textStyle: "label.large",
|
|
61
61
|
fontWeight: "bold",
|
|
62
62
|
asChild: true,
|
|
@@ -67,11 +67,11 @@ const ResourceBox = ({ image, title, caption, url, buttonText }) => {
|
|
|
67
67
|
textStyle: "body.medium",
|
|
68
68
|
children: caption
|
|
69
69
|
}),
|
|
70
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
70
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_ndla_safelink.SafeLinkButton, {
|
|
71
71
|
to: url,
|
|
72
72
|
target: "_blank",
|
|
73
73
|
variant: "secondary",
|
|
74
|
-
children: [buttonText, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
74
|
+
children: [buttonText, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_icons.ShareBoxLine, {})]
|
|
75
75
|
})
|
|
76
76
|
] })] });
|
|
77
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceBox.js","names":["Image","Text","breakpoints","Heading","SafeLinkButton","ShareBoxLine"],"sources":["../../src/ResourceBox/ResourceBox.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 { breakpoints } from \"@ndla/core\";\nimport { ShareBoxLine } from \"@ndla/icons\";\nimport { Heading, Image, Text } from \"@ndla/primitives\";\nimport { SafeLinkButton } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst Container = styled(\"div\", {\n base: {\n display: \"flex\",\n padding: \"medium\",\n borderRadius: \"xsmall\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n boxShadow: \"full\",\n marginBlockEnd: \"medium\",\n gap: \"medium\",\n tabletWideDown: {\n padding: \"xsmall\",\n },\n tabletDown: {\n flexDirection: \"column\",\n gap: \"0\",\n padding: \"0\",\n },\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n gap: \"xsmall\",\n flex: \"1\",\n tabletDown: {\n padding: \"xsmall\",\n },\n },\n});\n\nconst StyledImage = styled(Image, {\n base: {\n objectFit: \"cover\",\n borderRadius: \"xsmall\",\n width: \"fit-content\",\n aspectRatio: \"1/1\",\n tabletDown: {\n width: \"100%\",\n borderRadius: \"0\",\n },\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n flex: \"1\",\n },\n});\n\ninterface ImageMeta {\n src: string | undefined;\n alt: string;\n}\n\ninterface Props {\n image?: ImageMeta;\n title: string;\n caption: string;\n url: string;\n buttonText: string;\n}\n\nexport const ResourceBox = ({ image, title, caption, url, buttonText }: Props) => {\n return (\n <Container>\n {image ? (\n <StyledImage\n src={image.src}\n alt={image.alt}\n sizes={`(min-width: ${breakpoints.desktop}) 150px, (max-width: ${breakpoints.tablet} ) 400px, 200px`}\n variant=\"rounded\"\n />\n ) : null}\n <ContentWrapper>\n <Heading textStyle=\"label.large\" fontWeight=\"bold\" asChild consumeCss>\n <h3>{title}</h3>\n </Heading>\n <StyledText textStyle=\"body.medium\">{caption}</StyledText>\n <SafeLinkButton to={url} target=\"_blank\" variant=\"secondary\">\n {buttonText}\n <ShareBoxLine />\n </SafeLinkButton>\n </ContentWrapper>\n </Container>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAM,
|
|
1
|
+
{"version":3,"file":"ResourceBox.js","names":["Image","Text","breakpoints","Heading","SafeLinkButton","ShareBoxLine"],"sources":["../../src/ResourceBox/ResourceBox.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 { breakpoints } from \"@ndla/core\";\nimport { ShareBoxLine } from \"@ndla/icons\";\nimport { Heading, Image, Text } from \"@ndla/primitives\";\nimport { SafeLinkButton } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst Container = styled(\"div\", {\n base: {\n display: \"flex\",\n padding: \"medium\",\n borderRadius: \"xsmall\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n boxShadow: \"full\",\n marginBlockEnd: \"medium\",\n gap: \"medium\",\n tabletWideDown: {\n padding: \"xsmall\",\n },\n tabletDown: {\n flexDirection: \"column\",\n gap: \"0\",\n padding: \"0\",\n },\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n gap: \"xsmall\",\n flex: \"1\",\n tabletDown: {\n padding: \"xsmall\",\n },\n },\n});\n\nconst StyledImage = styled(Image, {\n base: {\n objectFit: \"cover\",\n borderRadius: \"xsmall\",\n width: \"fit-content\",\n aspectRatio: \"1/1\",\n tabletDown: {\n width: \"100%\",\n borderRadius: \"0\",\n },\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n flex: \"1\",\n },\n});\n\ninterface ImageMeta {\n src: string | undefined;\n alt: string;\n}\n\ninterface Props {\n image?: ImageMeta;\n title: string;\n caption: string;\n url: string;\n buttonText: string;\n}\n\nexport const ResourceBox = ({ image, title, caption, url, buttonText }: Props) => {\n return (\n <Container>\n {image ? (\n <StyledImage\n src={image.src}\n alt={image.alt}\n sizes={`(min-width: ${breakpoints.desktop}) 150px, (max-width: ${breakpoints.tablet} ) 400px, 200px`}\n variant=\"rounded\"\n />\n ) : null}\n <ContentWrapper>\n <Heading textStyle=\"label.large\" fontWeight=\"bold\" asChild consumeCss>\n <h3>{title}</h3>\n </Heading>\n <StyledText textStyle=\"body.medium\">{caption}</StyledText>\n <SafeLinkButton to={url} target=\"_blank\" variant=\"secondary\">\n {buttonText}\n <ShareBoxLine />\n </SafeLinkButton>\n </ContentWrapper>\n </Container>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAM,gDAAmB,OAAO,EAC9B,MAAM;CACJ,SAAS;CACT,SAAS;CACT,cAAc;CACd,QAAQ;CACR,aAAa;CACb,WAAW;CACX,gBAAgB;CAChB,KAAK;CACL,gBAAgB,EACd,SAAS,UACV;CACD,YAAY;EACV,eAAe;EACf,KAAK;EACL,SAAS;EACV;CACF,EACF,CAAC;AAEF,MAAM,qDAAwB,OAAO,EACnC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,YAAY;CACZ,KAAK;CACL,MAAM;CACN,YAAY,EACV,SAAS,UACV;CACF,EACF,CAAC;AAEF,MAAM,kDAAqBA,wBAAO,EAChC,MAAM;CACJ,WAAW;CACX,cAAc;CACd,OAAO;CACP,aAAa;CACb,YAAY;EACV,OAAO;EACP,cAAc;EACf;CACF,EACF,CAAC;AAEF,MAAM,iDAAoBC,uBAAM,EAC9B,MAAM,EACJ,MAAM,KACP,EACF,CAAC;AAeF,MAAa,eAAe,EAAE,OAAO,OAAO,SAAS,KAAK,iBAAwB;AAChF,QACE,4CAAC,wBACE,QACC,2CAAC;EACC,KAAK,MAAM;EACX,KAAK,MAAM;EACX,OAAO,eAAeC,uBAAY,QAAQ,uBAAuBA,uBAAY,OAAO;EACpF,SAAQ;GACR,GACA,MACJ,4CAAC;EACC,2CAACC;GAAQ,WAAU;GAAc,YAAW;GAAO;GAAQ;aACzD,2CAAC,kBAAI,QAAW;IACR;EACV,2CAAC;GAAW,WAAU;aAAe;IAAqB;EAC1D,4CAACC;GAAe,IAAI;GAAK,QAAO;GAAS,SAAQ;cAC9C,YACD,2CAACC,6BAAe;IACD;KACF,IACP"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
2
|
let react = require("react");
|
|
3
|
-
let
|
|
4
|
-
let
|
|
3
|
+
let _ndla_primitives = require("@ndla/primitives");
|
|
4
|
+
let _ndla_icons = require("@ndla/icons");
|
|
5
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
-
let
|
|
7
|
-
let
|
|
6
|
+
let _ndla_util = require("@ndla/util");
|
|
7
|
+
let _ark_ui_react = require("@ark-ui/react");
|
|
8
8
|
|
|
9
9
|
//#region src/TagSelector/TagSelector.tsx
|
|
10
10
|
/**
|
|
@@ -24,7 +24,7 @@ const TagSelectorRoot = ({ allowCustomValue = true, multiple = true, selectionBe
|
|
|
24
24
|
(0, react.useEffect)(() => {
|
|
25
25
|
if (!controlRef.current) controlRef.current = document.getElementById(ids.control);
|
|
26
26
|
}, [ids.control]);
|
|
27
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
27
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.ComboboxRoot, {
|
|
28
28
|
ids,
|
|
29
29
|
asChild: true,
|
|
30
30
|
allowCustomValue,
|
|
@@ -33,7 +33,7 @@ const TagSelectorRoot = ({ allowCustomValue = true, multiple = true, selectionBe
|
|
|
33
33
|
onValueChange,
|
|
34
34
|
translations,
|
|
35
35
|
onPointerDownOutside: (event) => {
|
|
36
|
-
if ((0,
|
|
36
|
+
if ((0, _ndla_util.contains)(controlRef.current, event.detail.originalEvent.target)) event.preventDefault();
|
|
37
37
|
},
|
|
38
38
|
value,
|
|
39
39
|
...rest,
|
|
@@ -49,33 +49,33 @@ const TagSelectorRoot = ({ allowCustomValue = true, multiple = true, selectionBe
|
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
51
|
const TagSelectorTagsInputRoot = (0, react.forwardRef)((props, ref) => {
|
|
52
|
-
const comboboxApi = (0,
|
|
53
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
52
|
+
const comboboxApi = (0, _ark_ui_react.useComboboxContext)();
|
|
53
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.TagsInputRoot, {
|
|
54
54
|
ref,
|
|
55
55
|
onInputValueChange: (details) => comboboxApi.setInputValue(details.inputValue),
|
|
56
56
|
...props
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
|
-
const TagSelectorLabel =
|
|
60
|
-
const TagSelectorItemInput =
|
|
61
|
-
const TagSelectorTrigger =
|
|
59
|
+
const TagSelectorLabel = _ndla_primitives.ComboboxLabel;
|
|
60
|
+
const TagSelectorItemInput = _ndla_primitives.TagsInputItemInput;
|
|
61
|
+
const TagSelectorTrigger = _ndla_primitives.ComboboxTrigger;
|
|
62
62
|
const TagSelectorControl = (0, react.forwardRef)(({ children, ...props }, ref) => {
|
|
63
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
63
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.ComboboxControl, {
|
|
64
64
|
ref,
|
|
65
65
|
asChild: true,
|
|
66
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
66
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.TagsInputControl, {
|
|
67
67
|
...props,
|
|
68
68
|
children
|
|
69
69
|
})
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
|
-
const TagSelectorClearTrigger =
|
|
72
|
+
const TagSelectorClearTrigger = _ndla_primitives.ComboboxClearTrigger;
|
|
73
73
|
const TagSelectorInputBase = (0, react.forwardRef)(({ children, ...props }, ref) => {
|
|
74
|
-
const tagsApi = (0,
|
|
75
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
74
|
+
const tagsApi = (0, _ark_ui_react.useTagsInputContext)();
|
|
75
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.ComboboxInput, {
|
|
76
76
|
ref,
|
|
77
77
|
asChild: true,
|
|
78
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
78
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.TagsInputInput, {
|
|
79
79
|
onKeyDown: (event) => {
|
|
80
80
|
if (event.key === "Enter") tagsApi.addValue(tagsApi.inputValue);
|
|
81
81
|
},
|
|
@@ -85,15 +85,15 @@ const TagSelectorInputBase = (0, react.forwardRef)(({ children, ...props }, ref)
|
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
87
|
const TagSelectorInput = (0, react.forwardRef)(({ children, ...props }, ref) => {
|
|
88
|
-
const tagsApi = (0,
|
|
89
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [tagsApi.value.map((value, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
88
|
+
const tagsApi = (0, _ark_ui_react.useTagsInputContext)();
|
|
89
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [tagsApi.value.map((value, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_ndla_primitives.TagsInputItem, {
|
|
90
90
|
index,
|
|
91
91
|
value,
|
|
92
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
93
|
-
}, value)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
92
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_ndla_primitives.TagsInputItemPreview, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.TagsInputItemText, { children: value }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.TagsInputItemDeleteTrigger, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_icons.CloseLine, {}) })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.TagsInputItemInput, {})]
|
|
93
|
+
}, value)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.ComboboxInput, {
|
|
94
94
|
ref,
|
|
95
95
|
asChild: true,
|
|
96
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
96
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.TagsInputInput, {
|
|
97
97
|
onKeyDown: (event) => {
|
|
98
98
|
if (event.key === "Enter") tagsApi.addValue(tagsApi.inputValue);
|
|
99
99
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagSelector.js","names":["ComboboxRoot","TagsInputRoot","ComboboxLabel","TagsInputItemInput","ComboboxTrigger","ComboboxControl","TagsInputControl","ComboboxClearTrigger","ComboboxInput","TagsInputInput","TagsInputItem","TagsInputItemPreview","TagsInputItemText","TagsInputItemDeleteTrigger","CloseLine"],"sources":["../../src/TagSelector/TagSelector.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, useEffect, useId, useRef } from \"react\";\nimport { type CollectionItem, useTagsInputContext, useComboboxContext } from \"@ark-ui/react\";\nimport { CloseLine } from \"@ndla/icons\";\nimport {\n ComboboxClearTrigger,\n ComboboxControl,\n type ComboboxControlProps,\n ComboboxInput,\n type ComboboxInputProps,\n ComboboxLabel,\n ComboboxRoot,\n type ComboboxRootProps,\n ComboboxTrigger,\n TagsInputControl,\n type TagsInputControlProps,\n TagsInputInput,\n type TagsInputInputProps,\n TagsInputItem,\n TagsInputItemDeleteTrigger,\n TagsInputItemPreview,\n TagsInputItemText,\n TagsInputRoot,\n type TagsInputRootProps,\n TagsInputItemInput,\n} from \"@ndla/primitives\";\nimport { contains } from \"@ndla/util\";\n\nexport type TagSelectorRootProps<T extends CollectionItem> = ComboboxRootProps<T> & TagsInputRootProps;\n\nexport const TagSelectorRoot = <T extends CollectionItem>({\n allowCustomValue = true,\n multiple = true,\n selectionBehavior = \"clear\",\n editable,\n addOnPaste = false,\n onValueChange,\n children,\n value,\n translations,\n ...rest\n}: TagSelectorRootProps<T>) => {\n const ids = {\n root: useId(),\n input: useId(),\n control: useId(),\n };\n\n const controlRef = useRef<HTMLDivElement | undefined>(undefined);\n\n useEffect(() => {\n if (!controlRef.current) {\n controlRef.current = document.getElementById(ids.control) as HTMLDivElement | undefined;\n }\n }, [ids.control]);\n\n return (\n <ComboboxRoot\n ids={ids}\n asChild\n allowCustomValue={allowCustomValue}\n multiple={multiple}\n selectionBehavior={selectionBehavior}\n onValueChange={onValueChange}\n translations={translations}\n onPointerDownOutside={(event) => {\n if (contains(controlRef.current, event.detail.originalEvent.target)) {\n event.preventDefault();\n }\n }}\n value={value}\n {...rest}\n >\n <TagSelectorTagsInputRoot\n ids={ids}\n value={value}\n editable={editable}\n onValueChange={onValueChange}\n addOnPaste={addOnPaste}\n translations={translations}\n >\n {children}\n </TagSelectorTagsInputRoot>\n </ComboboxRoot>\n );\n};\n\nconst TagSelectorTagsInputRoot = forwardRef<HTMLDivElement, TagsInputRootProps>((props, ref) => {\n const comboboxApi = useComboboxContext();\n return (\n <TagsInputRoot\n ref={ref}\n onInputValueChange={(details) => comboboxApi.setInputValue(details.inputValue)}\n {...props}\n />\n );\n});\n\nexport type TagSelectorControlProps = ComboboxControlProps & TagsInputControlProps;\n\nexport const TagSelectorLabel = ComboboxLabel;\n\nexport const TagSelectorItemInput = TagsInputItemInput;\n\nexport const TagSelectorTrigger = ComboboxTrigger;\n\nexport const TagSelectorControl = forwardRef<HTMLDivElement, TagSelectorControlProps>(({ children, ...props }, ref) => {\n return (\n <ComboboxControl ref={ref} asChild>\n <TagsInputControl {...props}>{children}</TagsInputControl>\n </ComboboxControl>\n );\n});\n\nexport const TagSelectorClearTrigger = ComboboxClearTrigger;\n\nexport type TagSelectorInputProps = ComboboxInputProps & TagsInputInputProps;\n\n// If you need to modify the TagsInputItem, you can use this.\nexport const TagSelectorInputBase = forwardRef<HTMLInputElement, TagSelectorInputProps>(\n ({ children, ...props }, ref) => {\n const tagsApi = useTagsInputContext();\n\n return (\n <ComboboxInput ref={ref} asChild>\n <TagsInputInput\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n tagsApi.addValue(tagsApi.inputValue);\n }\n }}\n {...props}\n >\n {children}\n </TagsInputInput>\n </ComboboxInput>\n );\n },\n);\n\nexport const TagSelectorInput = forwardRef<HTMLInputElement, TagSelectorInputProps>(({ children, ...props }, ref) => {\n const tagsApi = useTagsInputContext();\n\n return (\n <>\n {tagsApi.value.map((value, index) => (\n <TagsInputItem index={index} value={value} key={value}>\n <TagsInputItemPreview>\n <TagsInputItemText>{value}</TagsInputItemText>\n <TagsInputItemDeleteTrigger>\n <CloseLine />\n </TagsInputItemDeleteTrigger>\n </TagsInputItemPreview>\n <TagsInputItemInput />\n </TagsInputItem>\n ))}\n <ComboboxInput ref={ref} asChild>\n <TagsInputInput\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n tagsApi.addValue(tagsApi.inputValue);\n }\n }}\n {...props}\n >\n {children}\n </TagsInputInput>\n </ComboboxInput>\n </>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;AAqCA,MAAa,mBAA6C,EACxD,mBAAmB,MACnB,WAAW,MACX,oBAAoB,SACpB,UACA,aAAa,OACb,eACA,UACA,OACA,cACA,GAAG,WAC0B;CAC7B,MAAM,MAAM;EACV,wBAAa;EACb,yBAAc;EACd,2BAAgB;EACjB;CAED,MAAM,+BAAgD,OAAU;AAEhE,4BAAgB;AACd,MAAI,CAAC,WAAW,QACd,YAAW,UAAU,SAAS,eAAe,IAAI,QAAQ;IAE1D,CAAC,IAAI,QAAQ,CAAC;AAEjB,QACE,2CAACA;EACM;EACL;EACkB;EACR;EACS;EACJ;EACD;EACd,uBAAuB,UAAU;AAC/B,
|
|
1
|
+
{"version":3,"file":"TagSelector.js","names":["ComboboxRoot","TagsInputRoot","ComboboxLabel","TagsInputItemInput","ComboboxTrigger","ComboboxControl","TagsInputControl","ComboboxClearTrigger","ComboboxInput","TagsInputInput","TagsInputItem","TagsInputItemPreview","TagsInputItemText","TagsInputItemDeleteTrigger","CloseLine"],"sources":["../../src/TagSelector/TagSelector.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, useEffect, useId, useRef } from \"react\";\nimport { type CollectionItem, useTagsInputContext, useComboboxContext } from \"@ark-ui/react\";\nimport { CloseLine } from \"@ndla/icons\";\nimport {\n ComboboxClearTrigger,\n ComboboxControl,\n type ComboboxControlProps,\n ComboboxInput,\n type ComboboxInputProps,\n ComboboxLabel,\n ComboboxRoot,\n type ComboboxRootProps,\n ComboboxTrigger,\n TagsInputControl,\n type TagsInputControlProps,\n TagsInputInput,\n type TagsInputInputProps,\n TagsInputItem,\n TagsInputItemDeleteTrigger,\n TagsInputItemPreview,\n TagsInputItemText,\n TagsInputRoot,\n type TagsInputRootProps,\n TagsInputItemInput,\n} from \"@ndla/primitives\";\nimport { contains } from \"@ndla/util\";\n\nexport type TagSelectorRootProps<T extends CollectionItem> = ComboboxRootProps<T> & TagsInputRootProps;\n\nexport const TagSelectorRoot = <T extends CollectionItem>({\n allowCustomValue = true,\n multiple = true,\n selectionBehavior = \"clear\",\n editable,\n addOnPaste = false,\n onValueChange,\n children,\n value,\n translations,\n ...rest\n}: TagSelectorRootProps<T>) => {\n const ids = {\n root: useId(),\n input: useId(),\n control: useId(),\n };\n\n const controlRef = useRef<HTMLDivElement | undefined>(undefined);\n\n useEffect(() => {\n if (!controlRef.current) {\n controlRef.current = document.getElementById(ids.control) as HTMLDivElement | undefined;\n }\n }, [ids.control]);\n\n return (\n <ComboboxRoot\n ids={ids}\n asChild\n allowCustomValue={allowCustomValue}\n multiple={multiple}\n selectionBehavior={selectionBehavior}\n onValueChange={onValueChange}\n translations={translations}\n onPointerDownOutside={(event) => {\n if (contains(controlRef.current, event.detail.originalEvent.target)) {\n event.preventDefault();\n }\n }}\n value={value}\n {...rest}\n >\n <TagSelectorTagsInputRoot\n ids={ids}\n value={value}\n editable={editable}\n onValueChange={onValueChange}\n addOnPaste={addOnPaste}\n translations={translations}\n >\n {children}\n </TagSelectorTagsInputRoot>\n </ComboboxRoot>\n );\n};\n\nconst TagSelectorTagsInputRoot = forwardRef<HTMLDivElement, TagsInputRootProps>((props, ref) => {\n const comboboxApi = useComboboxContext();\n return (\n <TagsInputRoot\n ref={ref}\n onInputValueChange={(details) => comboboxApi.setInputValue(details.inputValue)}\n {...props}\n />\n );\n});\n\nexport type TagSelectorControlProps = ComboboxControlProps & TagsInputControlProps;\n\nexport const TagSelectorLabel = ComboboxLabel;\n\nexport const TagSelectorItemInput = TagsInputItemInput;\n\nexport const TagSelectorTrigger = ComboboxTrigger;\n\nexport const TagSelectorControl = forwardRef<HTMLDivElement, TagSelectorControlProps>(({ children, ...props }, ref) => {\n return (\n <ComboboxControl ref={ref} asChild>\n <TagsInputControl {...props}>{children}</TagsInputControl>\n </ComboboxControl>\n );\n});\n\nexport const TagSelectorClearTrigger = ComboboxClearTrigger;\n\nexport type TagSelectorInputProps = ComboboxInputProps & TagsInputInputProps;\n\n// If you need to modify the TagsInputItem, you can use this.\nexport const TagSelectorInputBase = forwardRef<HTMLInputElement, TagSelectorInputProps>(\n ({ children, ...props }, ref) => {\n const tagsApi = useTagsInputContext();\n\n return (\n <ComboboxInput ref={ref} asChild>\n <TagsInputInput\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n tagsApi.addValue(tagsApi.inputValue);\n }\n }}\n {...props}\n >\n {children}\n </TagsInputInput>\n </ComboboxInput>\n );\n },\n);\n\nexport const TagSelectorInput = forwardRef<HTMLInputElement, TagSelectorInputProps>(({ children, ...props }, ref) => {\n const tagsApi = useTagsInputContext();\n\n return (\n <>\n {tagsApi.value.map((value, index) => (\n <TagsInputItem index={index} value={value} key={value}>\n <TagsInputItemPreview>\n <TagsInputItemText>{value}</TagsInputItemText>\n <TagsInputItemDeleteTrigger>\n <CloseLine />\n </TagsInputItemDeleteTrigger>\n </TagsInputItemPreview>\n <TagsInputItemInput />\n </TagsInputItem>\n ))}\n <ComboboxInput ref={ref} asChild>\n <TagsInputInput\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n tagsApi.addValue(tagsApi.inputValue);\n }\n }}\n {...props}\n >\n {children}\n </TagsInputInput>\n </ComboboxInput>\n </>\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;AAqCA,MAAa,mBAA6C,EACxD,mBAAmB,MACnB,WAAW,MACX,oBAAoB,SACpB,UACA,aAAa,OACb,eACA,UACA,OACA,cACA,GAAG,WAC0B;CAC7B,MAAM,MAAM;EACV,wBAAa;EACb,yBAAc;EACd,2BAAgB;EACjB;CAED,MAAM,+BAAgD,OAAU;AAEhE,4BAAgB;AACd,MAAI,CAAC,WAAW,QACd,YAAW,UAAU,SAAS,eAAe,IAAI,QAAQ;IAE1D,CAAC,IAAI,QAAQ,CAAC;AAEjB,QACE,2CAACA;EACM;EACL;EACkB;EACR;EACS;EACJ;EACD;EACd,uBAAuB,UAAU;AAC/B,gCAAa,WAAW,SAAS,MAAM,OAAO,cAAc,OAAO,CACjE,OAAM,gBAAgB;;EAGnB;EACP,GAAI;YAEJ,2CAAC;GACM;GACE;GACG;GACK;GACH;GACE;GAEb;IACwB;GACd;;AAInB,MAAM,kDAA2E,OAAO,QAAQ;CAC9F,MAAM,qDAAkC;AACxC,QACE,2CAACC;EACM;EACL,qBAAqB,YAAY,YAAY,cAAc,QAAQ,WAAW;EAC9E,GAAI;GACJ;EAEJ;AAIF,MAAa,mBAAmBC;AAEhC,MAAa,uBAAuBC;AAEpC,MAAa,qBAAqBC;AAElC,MAAa,4CAA0E,EAAE,UAAU,GAAG,SAAS,QAAQ;AACrH,QACE,2CAACC;EAAqB;EAAK;YACzB,2CAACC;GAAiB,GAAI;GAAQ;IAA4B;GAC1C;EAEpB;AAEF,MAAa,0BAA0BC;AAKvC,MAAa,8CACV,EAAE,UAAU,GAAG,SAAS,QAAQ;CAC/B,MAAM,kDAA+B;AAErC,QACE,2CAACC;EAAmB;EAAK;YACvB,2CAACC;GACC,YAAY,UAAU;AACpB,QAAI,MAAM,QAAQ,QAChB,SAAQ,SAAS,QAAQ,WAAW;;GAGxC,GAAI;GAEH;IACc;GACH;EAGrB;AAED,MAAa,0CAAwE,EAAE,UAAU,GAAG,SAAS,QAAQ;CACnH,MAAM,kDAA+B;AAErC,QACE,qFACG,QAAQ,MAAM,KAAK,OAAO,UACzB,4CAACC;EAAqB;EAAc;aAClC,4CAACC,oDACC,2CAACC,gDAAmB,QAA0B,EAC9C,2CAACC,yDACC,2CAACC,0BAAY,GACc,IACR,EACvB,2CAACX,wCAAqB;IAPwB,MAQhC,CAChB,EACF,2CAACK;EAAmB;EAAK;YACvB,2CAACC;GACC,YAAY,UAAU;AACpB,QAAI,MAAM,QAAQ,QAChB,SAAQ,SAAS,QAAQ,WAAW;;GAGxC,GAAI;GAEH;IACc;GACH,IACf;EAEL"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
2
|
let react = require("react");
|
|
3
|
-
let
|
|
3
|
+
let _ndla_primitives = require("@ndla/primitives");
|
|
4
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
5
|
|
|
6
6
|
//#region src/ZendeskButton/ZendeskButton.tsx
|
|
@@ -33,7 +33,7 @@ const ZendeskButton = (0, react.forwardRef)(({ locale, variant = "secondary", wi
|
|
|
33
33
|
document.body.appendChild(script);
|
|
34
34
|
} else if (window?.zE) window.zE("webWidget", "open");
|
|
35
35
|
};
|
|
36
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
36
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ndla_primitives.Button, {
|
|
37
37
|
onClick: handleClick,
|
|
38
38
|
variant,
|
|
39
39
|
id: "zendeskButton",
|