@ndla/ui 56.0.155-alpha.0 → 56.0.157-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/Article/Article.mjs +4 -3
- package/es/Article/Article.mjs.map +1 -1
- package/es/Article/ArticleByline.mjs +1 -1
- package/es/Article/ArticleByline.mjs.map +1 -1
- package/es/AudioPlayer/Controls.mjs +14 -13
- package/es/AudioPlayer/Controls.mjs.map +1 -1
- package/es/CodeBlock/CodeBlock.mjs +1 -1
- package/es/CodeBlock/CodeBlock.mjs.map +1 -1
- package/es/Concept/Concept.mjs +1 -1
- package/es/Concept/Concept.mjs.map +1 -1
- package/es/ContentTypeBadge/ContentTypeBadge.mjs +1 -1
- package/es/ContentTypeBadge/ContentTypeBadge.mjs.map +1 -1
- package/es/Embed/BrightcoveEmbed.mjs.map +1 -1
- package/es/Embed/ConceptEmbed.mjs +1 -1
- package/es/Embed/ConceptEmbed.mjs.map +1 -1
- package/es/Embed/EmbedWrapper.mjs +1 -1
- package/es/Embed/EmbedWrapper.mjs.map +1 -1
- package/es/Embed/ImageEmbed.mjs +2 -1
- package/es/Embed/ImageEmbed.mjs.map +1 -1
- package/es/Embed/InlineTriggerButton.mjs +1 -1
- package/es/Embed/InlineTriggerButton.mjs.map +1 -1
- package/es/FactBox/FactBox.mjs +1 -1
- package/es/FactBox/FactBox.mjs.map +1 -1
- package/es/FileList/File.mjs +1 -1
- package/es/FileList/File.mjs.map +1 -1
- package/es/FileList/FileList.mjs +1 -1
- package/es/FileList/FileList.mjs.map +1 -1
- package/es/Gloss/Gloss.mjs +1 -1
- package/es/Gloss/Gloss.mjs.map +1 -1
- package/es/Grid/Grid.mjs +1 -1
- package/es/Grid/Grid.mjs.map +1 -1
- package/es/Grid/GridParallaxItem.mjs +1 -1
- package/es/Grid/GridParallaxItem.mjs.map +1 -1
- package/es/LicenseByline/EmbedByline.mjs +7 -4
- package/es/LicenseByline/EmbedByline.mjs.map +1 -1
- package/es/LicenseByline/LicenseLink.mjs +1 -1
- package/es/LicenseByline/LicenseLink.mjs.map +1 -1
- package/es/LinkBlock/LinkBlockSection.mjs +1 -1
- package/es/LinkBlock/LinkBlockSection.mjs.map +1 -1
- package/es/RelatedArticleList/RelatedArticleList.mjs +1 -1
- package/es/RelatedArticleList/RelatedArticleList.mjs.map +1 -1
- package/es/TagSelector/TagSelector.mjs +4 -4
- package/es/TagSelector/TagSelector.mjs.map +1 -1
- package/es/ZendeskButton/ZendeskButton.mjs +1 -1
- package/es/ZendeskButton/ZendeskButton.mjs.map +1 -1
- package/es/_virtual/rolldown_runtime.mjs +10 -5
- package/es/i18n/useComponentTranslations.mjs +4 -3
- package/es/i18n/useComponentTranslations.mjs.map +1 -1
- package/es/locale/messages-en.mjs +11 -1
- package/es/locale/messages-en.mjs.map +1 -1
- package/es/locale/messages-nb.mjs +11 -1
- package/es/locale/messages-nb.mjs.map +1 -1
- package/es/locale/messages-nn.mjs +11 -1
- package/es/locale/messages-nn.mjs.map +1 -1
- package/es/locale/messages-se.mjs +11 -1
- package/es/locale/messages-se.mjs.map +1 -1
- package/lib/Article/Article.d.ts +2 -1
- package/lib/Article/Article.js +4 -3
- package/lib/Article/Article.js.map +1 -1
- package/lib/Article/ArticleByline.js +1 -1
- package/lib/Article/ArticleByline.js.map +1 -1
- package/lib/AudioPlayer/Controls.js +14 -13
- package/lib/AudioPlayer/Controls.js.map +1 -1
- package/lib/CodeBlock/CodeBlock.js +1 -1
- package/lib/CodeBlock/CodeBlock.js.map +1 -1
- package/lib/Concept/Concept.js +1 -1
- package/lib/Concept/Concept.js.map +1 -1
- package/lib/ContentTypeBadge/ContentTypeBadge.js +1 -1
- package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -1
- package/lib/Embed/BrightcoveEmbed.js.map +1 -1
- package/lib/Embed/ConceptEmbed.js +1 -1
- package/lib/Embed/ConceptEmbed.js.map +1 -1
- package/lib/Embed/EmbedWrapper.js +1 -1
- package/lib/Embed/EmbedWrapper.js.map +1 -1
- package/lib/Embed/ImageEmbed.d.ts +0 -9
- package/lib/Embed/ImageEmbed.js +2 -1
- package/lib/Embed/ImageEmbed.js.map +1 -1
- package/lib/Embed/InlineTriggerButton.js +1 -1
- package/lib/Embed/InlineTriggerButton.js.map +1 -1
- package/lib/FactBox/FactBox.js +1 -1
- package/lib/FactBox/FactBox.js.map +1 -1
- package/lib/FileList/File.js +1 -1
- package/lib/FileList/File.js.map +1 -1
- package/lib/FileList/FileList.js +1 -1
- package/lib/FileList/FileList.js.map +1 -1
- package/lib/Gloss/Gloss.js +1 -1
- package/lib/Gloss/Gloss.js.map +1 -1
- package/lib/Grid/Grid.js +1 -1
- package/lib/Grid/Grid.js.map +1 -1
- package/lib/Grid/GridParallaxItem.js +1 -1
- package/lib/Grid/GridParallaxItem.js.map +1 -1
- package/lib/LicenseByline/EmbedByline.js +6 -3
- package/lib/LicenseByline/EmbedByline.js.map +1 -1
- package/lib/LicenseByline/LicenseLink.js +1 -1
- package/lib/LicenseByline/LicenseLink.js.map +1 -1
- package/lib/LinkBlock/LinkBlockSection.js +1 -1
- package/lib/LinkBlock/LinkBlockSection.js.map +1 -1
- package/lib/RelatedArticleList/RelatedArticleList.js +1 -1
- package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -1
- package/lib/TagSelector/TagSelector.js +4 -4
- package/lib/TagSelector/TagSelector.js.map +1 -1
- package/lib/ZendeskButton/ZendeskButton.js +1 -1
- package/lib/ZendeskButton/ZendeskButton.js.map +1 -1
- package/lib/_virtual/rolldown_runtime.js +20 -11
- package/lib/i18n/useComponentTranslations.js +4 -3
- package/lib/i18n/useComponentTranslations.js.map +1 -1
- package/lib/locale/messages-en.d.ts +10 -0
- package/lib/locale/messages-en.js +11 -1
- package/lib/locale/messages-en.js.map +1 -1
- package/lib/locale/messages-nb.d.ts +10 -0
- package/lib/locale/messages-nb.js +11 -1
- package/lib/locale/messages-nb.js.map +1 -1
- package/lib/locale/messages-nn.d.ts +10 -0
- package/lib/locale/messages-nn.js +11 -1
- package/lib/locale/messages-nn.js.map +1 -1
- package/lib/locale/messages-se.d.ts +10 -0
- package/lib/locale/messages-se.js +11 -1
- package/lib/locale/messages-se.js.map +1 -1
- package/package.json +5 -5
- package/src/Article/Article.tsx +3 -0
- package/src/AudioPlayer/Controls.tsx +15 -14
- package/src/Concept/Concept.stories.tsx +1 -0
- package/src/ContactBlock/ContactBlock.stories.tsx +1 -0
- package/src/Embed/AudioEmbed.stories.tsx +1 -0
- package/src/Embed/BrightcoveEmbed.tsx +1 -1
- package/src/Embed/ConceptEmbed.stories.tsx +1 -0
- package/src/Embed/ExternalEmbed.stories.tsx +3 -2
- package/src/Embed/GlossEmbed.stories.tsx +2 -1
- package/src/Embed/IframeEmbed.stories.tsx +1 -0
- package/src/Embed/ImageEmbed.stories.tsx +1 -0
- package/src/Embed/ImageEmbed.tsx +1 -12
- package/src/Embed/RelatedContentEmbed.stories.tsx +2 -0
- package/src/Gloss/Gloss.stories.tsx +4 -4
- package/src/Gloss/Gloss.tsx +3 -1
- package/src/LicenseByline/EmbedByline.tsx +3 -3
- package/src/i18n/useComponentTranslations.ts +1 -0
- package/src/locale/messages-en.ts +10 -0
- package/src/locale/messages-nb.ts +10 -0
- package/src/locale/messages-nn.ts +10 -0
- package/src/locale/messages-se.ts +10 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages-se.mjs","names":[],"sources":["../../src/locale/messages-se.ts"],"sourcesContent":["/**\n * Copyright (c) 2018-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 { contributorTypes } from \"@ndla/licenses\";\nimport { subjectCategories } from \"../model/SubjectCategories\";\nimport { subjectTypes } from \"../model/SubjectTypes\";\nimport { wordClass } from \"../model/WordClass\";\n\nconst messages = {\n ...Object.entries(contributorTypes).reduce<Record<string, string>>((acc, curr) => {\n acc[curr[0]] = curr[1].nb;\n return acc;\n }, {}),\n askNDLA: \"Jeara NDLA:s\",\n subjectCategories: {\n [subjectCategories.ACTIVE_SUBJECTS]: \"Doaimmas\",\n [subjectCategories.ARCHIVE_SUBJECTS]: \"Ii doaimmas šat\",\n [subjectCategories.BETA_SUBJECTS]: \"Boahttevaš\",\n [subjectCategories.OTHER]: \"Eará resurssat\",\n [subjectTypes.RESOURCE_COLLECTION]: \"Resursačoakkáldat\",\n },\n subjectTypes: {\n [subjectTypes.ARCHIVE_SUBJECT]: \"Arkivfag\",\n [subjectTypes.BETA_SUBJECT]: \"Betafága\",\n [subjectTypes.RESOURCE_COLLECTION]: \"Resursačoakkáldat\",\n [subjectTypes.SUBJECT]: \"Fága\",\n },\n meta: {\n description:\n \"Kvalitehta sihkarasttojuvvon ja nuvttá olamuttos neahttavuđot oahpponeavvut joatkkaskuvlla oahpahussii\",\n keywords: \"oahpponeavvu, fága, skuvla, joatkka, fidnohárjehalli, pensuma, fágaávnnas\",\n },\n logo: {\n altText: \"Našunála digitála oahppanarena\",\n },\n article: {\n lastUpdated: \"Maŋemusat ođastuvvon\",\n useContent: \"Čujuhit vai ođđasit atnit?\",\n authorsLabel_article: \"Dán lea/leat čállán \",\n authorsLabel_learningPath: \"Laget av\",\n authorsLabel_external: \"Denne lenken er lagt til av\",\n copyPageLinkCopied: \"Liŋka máŋgejuvvon\",\n copyHeaderLink: \"Máŋge liŋka bajilčállagii\",\n conjunction: \"ja\",\n supplierLabel_one: \"Vuoigatvuođaguoddi:\",\n supplierLabel_other: \"Vuoigatvuođaguoddit:\",\n printPage: \"Čálit teavstta\",\n access: {\n onlyTeacher: \"Dát resursa lea dušše olamuttus oahpaheddjiide geat leat Feide bokte sisaloggejuvvon.\",\n },\n footnotes: \"Fotnotar\",\n },\n external: {\n lastUpdated: \"Maŋemusat ođastuvvon\",\n },\n learningPath: {\n copiedFrom: \"Dette er en remiks av en annen læringsti\",\n lastUpdated: \"Maŋemusat ođastuvvon\",\n },\n license: {\n copyTitle: \"Máŋge gáldooainnu\",\n hasCopiedTitle: \"Máŋgejuvvon!\",\n embed: \"Hukse sisa\",\n embedCopied: \"Máŋgejuvvon sisahuksenkoda!\",\n copyText: {\n now: \"dál\",\n podcast: \"podkásta\",\n by: \"geas\",\n internet: \"[Interneahtta]. \",\n noTitle: \"Tihttela haga\",\n downloadedFrom: \"Gos vižžojuvvon: \",\n readDate: \"Lohkan: \",\n },\n download: \"Viečča\",\n openLink: \"Raba ođđa gilkoris\",\n tabs: {\n text: \"Teaksta\",\n images: \"Govat\",\n audio: \"Jietna\",\n video: \"Video\",\n h5p: \"H5P\",\n files: \"Fiillat\",\n embedlink: \"Sisahuksenliŋka\",\n concept: \"Čilgehusat\",\n gloss: \"Gloser\",\n podcast: \"Podkásta\",\n other: \"Eará sisdoallu\",\n },\n embedlink: {\n heading: \"Ná čájehat artihkkala eará sisdoalus\",\n description: \"Dát liŋka čájeha artihkkala konteavstta haga (fállu ja vuolleteaksta)\",\n copyTitle: \"Máŋge liŋkka\",\n hasCopiedTitle: \"Liŋka máŋgejuvvon\",\n },\n image: {\n rules: \"Njuolggadusat gova geavaheapmái:\",\n },\n images: {\n heading: \"Ná geavahat govaid ođđasit\",\n description: \"Muitte máŋget teavstta mii galgá mielddusin govvii go geavahat dan.\",\n rules: \"Njuolggadusat gova geavaheapmái\",\n itemImage: {\n ariaLabel: \"Raba gova ođđa siiddus\",\n zoomImageButtonLabel: \"Stuorit gova\",\n zoomOutImageButtonLabel: \"Unnit gova\",\n expandByline: \"Čájet byline\",\n minimizeByline: \"Čiega byline\",\n },\n licenseText: \"Dán govas lea liseansa\",\n restrictedUseText: \"Dán govas lea\",\n },\n text: {\n heading: \"Ná geavahat teavstta ođđasit\",\n description: \"Muitte čujuhit gáldui go nuppi teavstta anát.\",\n rules: \"Njuolggadusat teavstta geavaheapmái\",\n published: \"Almmuhanbeaivi\",\n licenseText: \"Dán teavsttas lea liseansa\",\n restrictedUseText: \"Dán teavsttas lea\",\n },\n audio: {\n heading: \"Ná geavahat jietnafiilla ođđasit\",\n description: \"Muitte máŋget teavstta mii galgá čuovvut jietnafiilla doppe gos geavahuvvo.\",\n rules: \"Njuolggadusat jietnafiilla geavaheapmái\",\n licenseText: \"Dán jietnafiillas lea liseansa\",\n restrictedUseText: \"Dán jietnafiillas lea\",\n },\n podcast: {\n heading: \"Ná geavahat podkásta ođđasit\",\n description: \"Muitte máŋget teavstta mii galgá čuovvut podkásta doppe gos geavahuvvo.\",\n rules: \"Njuolggadusat podkásta geavaheapmái\",\n licenseText: \"Dán podkasttas lea liseansa\",\n restrictedUseText: \"Dán podkasttas lea\",\n },\n video: {\n heading: \"Ná geavahat video ođđasit\",\n description: \"Muitte máŋget teavstta mii galgá čuovvut video doppe gos dat geavahuvvo.\",\n rules: \"Njuolggadusat video geavaheapmái\",\n itemImage: {\n ariaLabel: \"Raba video ođđa siiddus\",\n },\n licenseText: \"Dán videoi lea liseansa\",\n restrictedUseText: \"Dán videoi lea\",\n },\n other: {\n heading: \"Ná geavahat eará sisdoalu ođđasit\",\n description: \"Njuolggadusaid sisdoalu geavaheapmái gávnnat sisdoalloelemeanttas\",\n itemImage: {\n ariaLabel: \"Raba ođđa siiddus\",\n },\n },\n h5p: {\n heading: \"Ná geavahat H5P-sisdoalu ođđasit\",\n description: \"Njuolggadusaid sisdoalu geavaheapmái gávnnat H5P-elemeanttas\",\n rules: \"Njuolggadusat H5P geavaheapmái\",\n licenseText: \"Dát interaktiiva bargu (H5P) lea ožžon liseanssa\",\n restrictedUseText: \"Dát interaktiiva bargu (H5P) lea ožžon\",\n },\n concept: {\n heading: \"Ná geavahat čilgehusaid ođđasit\",\n description: \"Husk at innebygd innhald i ei forklaring kan ha ein anna lisens enn sjølve forklaringsteksten\",\n rules: \"Njuolggadusat čilgehusa geavaheapmái\",\n embedlink: {\n heading: \"Ná čájehat čilgehusa eará sisdoalus\",\n description: \"Dát liŋka čájeha čilgehusa konteavstta haga (fállu ja vuolleteaksta)\",\n copyTitle: \"Máŋge sisahuksenliŋkka\",\n hasCopiedTitle: \"Sisahuksenliŋka máŋgejuvvon\",\n },\n licenseText: \"Dán čilgehusas lea liseansa\",\n restrictedUseText: \"Dán čilgehusas lea\",\n },\n gloss: {\n heading: \"Movt geavahit ođđasit dajaldagaid\",\n description:\n \"Muitte ahte sisdoalus mii lea vuojuhuvvon ovtta gihppagii sáhttá leat eará liseansa go dušše jietnadat.\",\n rules: \"Glossa geavaheami njuolggadusat\",\n showOrHideExamples: \"Čájet dahje čiega ovdamearkkaid\",\n embedlink: {\n heading: \"Čájet jietnadaga eará sisdoaluin\",\n description: \"Dát liŋka čájeha teavstta konteavstta haga (fállu ja juolgeteaksta)\",\n copyTitle: \"Máŋge sisačálihanliŋkka\",\n hasCopiedTitle: \"Sajáiduhttinliŋka mángejuvvon\",\n },\n licenseText: \"Dán jietnadagas lea liseansa\",\n restrictedUseText: \"Dán jietnadagas lea\",\n },\n files: {\n heading: \"Ná geavahat fiillaid ođđasit\",\n description: \"Muitte máŋget teavsttaid mat galget čuovvut fiillaid doppe gos dat geavahuvvet.\",\n rules: \"Njuolggadusat fiilla geavaheapmái\",\n itemImage: {\n ariaLabel: \"Raba ođđa siiddus\",\n },\n },\n processed: \"Sisdoallu lea rievdaduvvon.\",\n },\n errorMessage: {\n title: \"Ops, juoga manai boastut\",\n description: \"Šállošit, boasttuvuohta čuožžilii.\",\n back: \"Mana ruovttoluotta\",\n goToFrontPage: \"Mana ovdasiidui\",\n },\n figure: {\n button: {\n alternative: \"Lonut siidui mas dulkojuvvo oaidninváttuid ektui\",\n original: \"Lonut orginála videoi\",\n },\n },\n contentTypes: {\n all: \"Buot\",\n article: \"Artikkel\",\n subject: \"Fága\",\n \"topic-article\": \"Fáddá\",\n learningpath: \"Oahppanbálggis\",\n \"learning-path\": \"Oahppanbálggis\",\n \"subject-material\": \"Fágaávdnasat\",\n \"tasks-and-activities\": \"Bihtát ja doaimmat\",\n \"source-material\": \"Gáldomateriála\",\n \"assessment-resources\": \"Árvoštallanresursa\",\n topic: \"Fáddá\",\n multidisciplinary: \"Fágaidrasttideaddji fáddá\",\n image: \"Govva\",\n concept: \"Čilgehus\",\n audio: \"Jietna\",\n podcast: \"Podkásta\",\n h5p: \"H5P\",\n video: \"Video\",\n missing: \"Ukjent\",\n external: \"Ekstern\",\n gloss: \"Glose\",\n programme: \"Programfag\",\n \"podcast-series\": \"Podkast-serie\",\n \"frontpage-article\": \"Om NDLA-artikkel\",\n },\n languages: {\n nb: \"Girjedárogiella\",\n nn: \"Ođđadárogiella\",\n en: \"Eŋgelasgiella\",\n fr: \"Fránskkagiella\",\n de: \"Duiskkagiella\",\n se: \"Davvisámegiella\",\n sma: \"Máttasámegiella\",\n es: \"Espánnjagiella\",\n zh: \"Kiinnágiella\",\n ukr: \"Ukrainsk\",\n unknown: \"Amas\",\n prefixChangeLanguage: \"Vállje giela\",\n },\n breadcrumb: {\n toFrontpage: \"NDLA ovdasiidu\",\n breadcrumb: \"Láibemoallobálggis\",\n },\n codeBlock: {\n copiedCode: \"Koda lea máŋgejuvvon vuorkátávvalii\",\n copyCode: \"Máŋge koda vuorkátávvalii\",\n },\n close: \"Govčča\",\n loading: \"Viežžá\",\n title: \"Tihttel\",\n cancel: \"Botkke\",\n save: \"Vurke\",\n email: \"E-boasta\",\n finished: \"Ferdig\",\n audio: {\n play: \"Čuojat\",\n pause: \"Boatkke\",\n progressBar: \"Fremdriftsindikator\",\n valueText: \"{{start}} av {{end}}\",\n controls: {\n forward15sec: \"Sirdde 15 sekundda ovddas\",\n rewind15sec: \"Sirdde 15 sekundda maŋos\",\n selectSpeed: \"Vállje čuojahanleahtu\",\n adjustVolume: \"Rievdat voluma\",\n },\n textVersion: {\n heading: \"Teakstavearšuvdna\",\n close: \"Govčča teakstavearšuvnna\",\n },\n readMoreDescriptionLabel: \"Čájet eanet\",\n readLessDescriptionLabel: \"Čájet unnit\",\n },\n source: \"Gáldu\",\n related: {\n title: \"Guoskevaš sisdoallu\",\n linkInfo: \"Neahttasiidu čuovvuvaččas\",\n showMore: \"Čájet eanet guoskevaš sisdoalu\",\n showLess: \"Čájet unnit\",\n },\n download: \"Viečča fiilla: \",\n factbox: {\n open: \"Raba fáktádoasa\",\n close: \"Govčča fáktádoasa\",\n },\n embed: {\n linkError: \"Ii sáhttán čájehit liŋkka.\",\n unsupported: `Embed {{type}} ii dorjojuvvo.`,\n embedError: `Šattai meattáhus {{type}} vieččadettiin. Geahččal viežžat siiddu ođđasit.`,\n type: {\n image: \"Govva\",\n video: \"Video\",\n audio: \"Jietna\",\n podcast: \"Podkast\",\n concept: \"Čilgehus\",\n h5p: \"H5P\",\n external: \"Olgguldas resursa\",\n gloss: \"Glose\",\n copyright: \"Tekst\",\n code: \"Kodeblokk\",\n disclaimer: \"UU-advarsel\",\n },\n },\n uuDisclaimer: { title: \"Tilgjengelighet\" },\n gloss: {\n examples: \"Ovdamearkkat\",\n showExamples: \"Vis eksempler\",\n wordClass: \"Sátneluohkká\",\n play: \"Čuojat glose\",\n transcriptions: {\n traditional: \"Árbevirolaš čállinvuohki\",\n pinyin: \"Pinyin\",\n },\n },\n wordClass: {\n [wordClass.adjective]: \"Adjektiivvat\",\n [wordClass.adverb]: \"Advearba\",\n [wordClass.properNoun]: \"Iežas namma\",\n [wordClass.auxiliary]: \"Veahkkesánit\",\n [wordClass.complement]: \"Dievasmahttin\",\n [wordClass.conjunction]: \"Konjunksjon\",\n [wordClass.coverb]: \"Koverb\",\n [wordClass.determiner]: \"Mearrádussánit\",\n [wordClass.interjection]: \"Ovttastuvvon\",\n [wordClass.quantifier]: \"Kvantor\",\n [wordClass.marker]: \"Sieván\",\n [wordClass.modalVerb]: \"Modálavearba\",\n [wordClass.measureWord]: \"Olahussátni\",\n [wordClass.noun]: \"Substantiivvat\",\n [wordClass[\"noun-zh\"]]: \"Nome\",\n [wordClass.nounPhrase]: \"Nomengihppu\",\n [wordClass.onomatopoeia]: \"Onomatopoetikon\",\n [wordClass.particle]: \"Partihkkalat\",\n [wordClass.demonstrative]: \"Čujuhusat\",\n [wordClass.personalPronoun]: \"Persovnnalaš pronomen\",\n [wordClass.preposition]: \"Preposišuvdna\",\n [wordClass.pronoun]: \"Pronomen\",\n [wordClass.questionWord]: \"Jearaldatsánit\",\n [wordClass.locationWord]: \"Báikesánit\",\n [wordClass.suffix]: \"Suffivssat\",\n [wordClass.numeral]: \"Lohkosánit\",\n [wordClass.timeWord]: \"Áigebágo\",\n [wordClass.timeExpression]: \"Áigemearka\",\n [wordClass.stativeVerb]: \"Dili-vearbba\",\n [wordClass.subordinatingConjunction]: \"Subjunkšuvdna\",\n [wordClass.exclamationWord]: \"Ii-rohkossátni\",\n [wordClass.expression]: \"Ovdanbuktin\",\n [wordClass.verb]: \"Vearbbat\",\n [wordClass.verbComplement]: \"Vearbasuorggideapmi\",\n [wordClass.verbObject]: \"Vearbaobjeakta\",\n },\n login: \"Čálit sisa\",\n component: {\n tagsInput: {\n clearTriggerLabel: \"Fjern alle emneknagger\",\n deleteTagTriggerLabel: \"Fjern emneknagg {{tag}}\",\n tagAdded: \"Emneknagg {{tag}} lagt til\",\n tagsPasted: \"Limte inn {{length}} emneknagger\",\n tagEdited: \"Redigerer emneknagg {{tag}}. Trykk enter for å lagre, eller esc for å avbryte.\",\n tagUpdated: \"Emneknagg oppdatert til {{tag}}\",\n tagDeleted: \"Emneknagg {{tag}} slettet\",\n tagSelected: \"Emneknagg {{tag}} valgt. Trykk enter for å redigere. Trykk backspace eller delete for å slette\",\n },\n combobox: {\n triggerLabel: \"Vis resultater\",\n clearTriggerLabel: \"Fjern valg\",\n },\n pagination: {\n rootLabel: \"Sidenavigering\",\n prevTriggerLabel: \"Forrige side\",\n nextTriggerLabel: \"Neste side\",\n lastPage: \"Siste side, side {{page}}\",\n page: \"Side {{page}}\",\n },\n imageSearch: {\n searchPlaceholder: \"Søk i bilder\",\n searchButtonTitle: \"Søk\",\n imagePreview: {\n creatorsLabel: \"Bilde\",\n license: \"Lisens\",\n caption: \"Bildetekst\",\n altText: \"Alt-tekst\",\n modelRelease: \"Modellklarert\",\n tags: \"Emneknagger\",\n checkboxLabel: \"Sett som metabilde\",\n close: \"Lukk\",\n useImageTitle: \"Bruk bildet\",\n },\n },\n audioSearch: {\n searchPlaceholder: \"Søk i lydfiler\",\n searchButtonTitle: \"Søk\",\n useAudio: \"Velg lyd\",\n noResults: \"Ingen resultater funnet\",\n },\n videoSearch: {\n searchPlaceholder: \"Søk i videoar\",\n searchButtonTitle: \"Søk\",\n loadMoreVideos: \"Last fleire videoar\",\n noResults: \"Ingen videoar funnet\",\n addVideo: \"Bruk video\",\n previewVideo: \"Forhåndsvis\",\n is360Video: \"VR-video\",\n close: \"Lukk\",\n },\n datePicker: {\n dayCell: {\n unavailable: \"Ikke tilgjengelig dato. {{date}}\",\n selected: \"Valgt dato. {{date}}\",\n select: \"Velg dato. {{date}}\",\n },\n nextTrigger: {\n day: \"Gå til neste måned\",\n month: \"Gå til neste år\",\n year: \"Gå til neste tiår\",\n },\n prevTrigger: {\n day: \"Gå til forrige måned\",\n month: \"Gå til forrige år\",\n year: \"Gå til forrige tiår\",\n },\n monthSelect: \"Velg måned\",\n yearSelect: \"Velg år\",\n viewTrigger: {\n day: \"Bytt til dagvisning\",\n month: \"Bytt til månedvisning\",\n year: \"Bytt til årvisning\",\n },\n presetTrigger: {\n single: \"Velg {{date}}\",\n range: \"Velg fra {{start}} til {{end}}\",\n },\n clearTrigger: \"Fjern valgte datoer\",\n trigger: {\n open: \"Åpne datovelger\",\n close: \"Lukk datovelger\",\n },\n content: \"Kalender\",\n },\n },\n richTextEditor: {\n tooltip: {\n bold: \"Fet ({{shortcut}})\",\n code: \"Kode ({{shortcut}})\",\n sub: \"Senket skrift ({{shortcut}})\",\n sup: \"Hevet skrift ({{shortcut}})\",\n underlined: \"Understreket ({{shortcut}})\",\n italic: \"Kursiv ({{shortcut}})\",\n \"numbered-list\": \"Nummerert liste ({{shortcut}})\",\n \"letter-list\": \"Bokstavliste ({{shortcut}})\",\n \"bulleted-list\": \"Punktliste ({{shortcut}})\",\n heading: \"Overskrift {{level}} ({{shortcut}})\",\n paragraph: \"Paragraf ({{shortcut}})\",\n section: \"Seksjon ({{shortcut}})\",\n link: \"Lenke ({{shortcut}})\",\n },\n },\n};\n\nexport default messages;\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,WAAW;CACf,GAAG,OAAO,QAAQ,iBAAiB,CAAC,QAAgC,KAAK,SAAS;AAChF,MAAI,KAAK,MAAM,KAAK,GAAG;AACvB,SAAO;IACN,EAAE,CAAC;CACN,SAAS;CACT,mBAAmB;GAChB,kBAAkB,kBAAkB;GACpC,kBAAkB,mBAAmB;GACrC,kBAAkB,gBAAgB;GAClC,kBAAkB,QAAQ;GAC1B,aAAa,sBAAsB;EACrC;CACD,cAAc;GACX,aAAa,kBAAkB;GAC/B,aAAa,eAAe;GAC5B,aAAa,sBAAsB;GACnC,aAAa,UAAU;EACzB;CACD,MAAM;EACJ,aACE;EACF,UAAU;EACX;CACD,MAAM,EACJ,SAAS,kCACV;CACD,SAAS;EACP,aAAa;EACb,YAAY;EACZ,sBAAsB;EACtB,2BAA2B;EAC3B,uBAAuB;EACvB,oBAAoB;EACpB,gBAAgB;EAChB,aAAa;EACb,mBAAmB;EACnB,qBAAqB;EACrB,WAAW;EACX,QAAQ,EACN,aAAa,yFACd;EACD,WAAW;EACZ;CACD,UAAU,EACR,aAAa,wBACd;CACD,cAAc;EACZ,YAAY;EACZ,aAAa;EACd;CACD,SAAS;EACP,WAAW;EACX,gBAAgB;EAChB,OAAO;EACP,aAAa;EACb,UAAU;GACR,KAAK;GACL,SAAS;GACT,IAAI;GACJ,UAAU;GACV,SAAS;GACT,gBAAgB;GAChB,UAAU;GACX;EACD,UAAU;EACV,UAAU;EACV,MAAM;GACJ,MAAM;GACN,QAAQ;GACR,OAAO;GACP,OAAO;GACP,KAAK;GACL,OAAO;GACP,WAAW;GACX,SAAS;GACT,OAAO;GACP,SAAS;GACT,OAAO;GACR;EACD,WAAW;GACT,SAAS;GACT,aAAa;GACb,WAAW;GACX,gBAAgB;GACjB;EACD,OAAO,EACL,OAAO,oCACR;EACD,QAAQ;GACN,SAAS;GACT,aAAa;GACb,OAAO;GACP,WAAW;IACT,WAAW;IACX,sBAAsB;IACtB,yBAAyB;IACzB,cAAc;IACd,gBAAgB;IACjB;GACD,aAAa;GACb,mBAAmB;GACpB;EACD,MAAM;GACJ,SAAS;GACT,aAAa;GACb,OAAO;GACP,WAAW;GACX,aAAa;GACb,mBAAmB;GACpB;EACD,OAAO;GACL,SAAS;GACT,aAAa;GACb,OAAO;GACP,aAAa;GACb,mBAAmB;GACpB;EACD,SAAS;GACP,SAAS;GACT,aAAa;GACb,OAAO;GACP,aAAa;GACb,mBAAmB;GACpB;EACD,OAAO;GACL,SAAS;GACT,aAAa;GACb,OAAO;GACP,WAAW,EACT,WAAW,2BACZ;GACD,aAAa;GACb,mBAAmB;GACpB;EACD,OAAO;GACL,SAAS;GACT,aAAa;GACb,WAAW,EACT,WAAW,qBACZ;GACF;EACD,KAAK;GACH,SAAS;GACT,aAAa;GACb,OAAO;GACP,aAAa;GACb,mBAAmB;GACpB;EACD,SAAS;GACP,SAAS;GACT,aAAa;GACb,OAAO;GACP,WAAW;IACT,SAAS;IACT,aAAa;IACb,WAAW;IACX,gBAAgB;IACjB;GACD,aAAa;GACb,mBAAmB;GACpB;EACD,OAAO;GACL,SAAS;GACT,aACE;GACF,OAAO;GACP,oBAAoB;GACpB,WAAW;IACT,SAAS;IACT,aAAa;IACb,WAAW;IACX,gBAAgB;IACjB;GACD,aAAa;GACb,mBAAmB;GACpB;EACD,OAAO;GACL,SAAS;GACT,aAAa;GACb,OAAO;GACP,WAAW,EACT,WAAW,qBACZ;GACF;EACD,WAAW;EACZ;CACD,cAAc;EACZ,OAAO;EACP,aAAa;EACb,MAAM;EACN,eAAe;EAChB;CACD,QAAQ,EACN,QAAQ;EACN,aAAa;EACb,UAAU;EACX,EACF;CACD,cAAc;EACZ,KAAK;EACL,SAAS;EACT,SAAS;EAC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,YAAY;GACV,SAAS;IACP,aAAa;IACb,UAAU;IACV,QAAQ;IACT;GACD,aAAa;IACX,KAAK;IACL,OAAO;IACP,MAAM;IACP;GACD,aAAa;IACX,KAAK;IACL,OAAO;IACP,MAAM;IACP;GACD,aAAa;GACb,YAAY;GACZ,aAAa;IACX,KAAK;IACL,OAAO;IACP,MAAM;IACP;GACD,eAAe;IACb,QAAQ;IACR,OAAO;IACR;GACD,cAAc;GACd,SAAS;IACP,MAAM;IACN,OAAO;IACR;GACD,SAAS;GACV;EACF;CACD,gBAAgB,EACd,SAAS;EACP,MAAM;EACN,MAAM;EACN,KAAK;EACL,KAAK;EACL,YAAY;EACZ,QAAQ;EACR,iBAAiB;EACjB,eAAe;EACf,iBAAiB;EACjB,SAAS;EACT,WAAW;EACX,SAAS;EACT,MAAM;EACP,EACF;CACF;AAED,0BAAe"}
|
|
1
|
+
{"version":3,"file":"messages-se.mjs","names":[],"sources":["../../src/locale/messages-se.ts"],"sourcesContent":["/**\n * Copyright (c) 2018-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 { contributorTypes } from \"@ndla/licenses\";\nimport { subjectCategories } from \"../model/SubjectCategories\";\nimport { subjectTypes } from \"../model/SubjectTypes\";\nimport { wordClass } from \"../model/WordClass\";\n\nconst messages = {\n ...Object.entries(contributorTypes).reduce<Record<string, string>>((acc, curr) => {\n acc[curr[0]] = curr[1].nb;\n return acc;\n }, {}),\n askNDLA: \"Jeara NDLA:s\",\n subjectCategories: {\n [subjectCategories.ACTIVE_SUBJECTS]: \"Doaimmas\",\n [subjectCategories.ARCHIVE_SUBJECTS]: \"Ii doaimmas šat\",\n [subjectCategories.BETA_SUBJECTS]: \"Boahttevaš\",\n [subjectCategories.OTHER]: \"Eará resurssat\",\n [subjectTypes.RESOURCE_COLLECTION]: \"Resursačoakkáldat\",\n },\n subjectTypes: {\n [subjectTypes.ARCHIVE_SUBJECT]: \"Arkivfag\",\n [subjectTypes.BETA_SUBJECT]: \"Betafága\",\n [subjectTypes.RESOURCE_COLLECTION]: \"Resursačoakkáldat\",\n [subjectTypes.SUBJECT]: \"Fága\",\n },\n meta: {\n description:\n \"Kvalitehta sihkarasttojuvvon ja nuvttá olamuttos neahttavuđot oahpponeavvut joatkkaskuvlla oahpahussii\",\n keywords: \"oahpponeavvu, fága, skuvla, joatkka, fidnohárjehalli, pensuma, fágaávnnas\",\n },\n logo: {\n altText: \"Našunála digitála oahppanarena\",\n },\n article: {\n lastUpdated: \"Maŋemusat ođastuvvon\",\n useContent: \"Čujuhit vai ođđasit atnit?\",\n authorsLabel_article: \"Dán lea/leat čállán \",\n authorsLabel_learningPath: \"Laget av\",\n authorsLabel_external: \"Denne lenken er lagt til av\",\n copyPageLinkCopied: \"Liŋka máŋgejuvvon\",\n copyHeaderLink: \"Máŋge liŋka bajilčállagii\",\n conjunction: \"ja\",\n supplierLabel_one: \"Vuoigatvuođaguoddi:\",\n supplierLabel_other: \"Vuoigatvuođaguoddit:\",\n printPage: \"Čálit teavstta\",\n access: {\n onlyTeacher: \"Dát resursa lea dušše olamuttus oahpaheddjiide geat leat Feide bokte sisaloggejuvvon.\",\n },\n footnotes: \"Fotnotar\",\n },\n external: {\n lastUpdated: \"Maŋemusat ođastuvvon\",\n },\n learningPath: {\n copiedFrom: \"Dette er en remiks av en annen læringsti\",\n lastUpdated: \"Maŋemusat ođastuvvon\",\n },\n license: {\n copyTitle: \"Máŋge gáldooainnu\",\n hasCopiedTitle: \"Máŋgejuvvon!\",\n embed: \"Hukse sisa\",\n embedCopied: \"Máŋgejuvvon sisahuksenkoda!\",\n copyText: {\n now: \"dál\",\n podcast: \"podkásta\",\n by: \"geas\",\n internet: \"[Interneahtta]. \",\n noTitle: \"Tihttela haga\",\n downloadedFrom: \"Gos vižžojuvvon: \",\n readDate: \"Lohkan: \",\n },\n download: \"Viečča\",\n openLink: \"Raba ođđa gilkoris\",\n tabs: {\n text: \"Teaksta\",\n images: \"Govat\",\n audio: \"Jietna\",\n video: \"Video\",\n h5p: \"H5P\",\n files: \"Fiillat\",\n embedlink: \"Sisahuksenliŋka\",\n concept: \"Čilgehusat\",\n gloss: \"Gloser\",\n podcast: \"Podkásta\",\n other: \"Eará sisdoallu\",\n },\n embedlink: {\n heading: \"Ná čájehat artihkkala eará sisdoalus\",\n description: \"Dát liŋka čájeha artihkkala konteavstta haga (fállu ja vuolleteaksta)\",\n copyTitle: \"Máŋge liŋkka\",\n hasCopiedTitle: \"Liŋka máŋgejuvvon\",\n },\n image: {\n rules: \"Njuolggadusat gova geavaheapmái:\",\n },\n images: {\n heading: \"Ná geavahat govaid ođđasit\",\n description: \"Muitte máŋget teavstta mii galgá mielddusin govvii go geavahat dan.\",\n rules: \"Njuolggadusat gova geavaheapmái\",\n itemImage: {\n ariaLabel: \"Raba gova ođđa siiddus\",\n zoomImageButtonLabel: \"Stuorit gova\",\n zoomOutImageButtonLabel: \"Unnit gova\",\n expandByline: \"Čájet byline\",\n minimizeByline: \"Čiega byline\",\n },\n licenseText: \"Dán govas lea liseansa\",\n restrictedUseText: \"Dán govas lea\",\n },\n text: {\n heading: \"Ná geavahat teavstta ođđasit\",\n description: \"Muitte čujuhit gáldui go nuppi teavstta anát.\",\n rules: \"Njuolggadusat teavstta geavaheapmái\",\n published: \"Almmuhanbeaivi\",\n licenseText: \"Dán teavsttas lea liseansa\",\n restrictedUseText: \"Dán teavsttas lea\",\n },\n audio: {\n heading: \"Ná geavahat jietnafiilla ođđasit\",\n description: \"Muitte máŋget teavstta mii galgá čuovvut jietnafiilla doppe gos geavahuvvo.\",\n rules: \"Njuolggadusat jietnafiilla geavaheapmái\",\n licenseText: \"Dán jietnafiillas lea liseansa\",\n restrictedUseText: \"Dán jietnafiillas lea\",\n },\n podcast: {\n heading: \"Ná geavahat podkásta ođđasit\",\n description: \"Muitte máŋget teavstta mii galgá čuovvut podkásta doppe gos geavahuvvo.\",\n rules: \"Njuolggadusat podkásta geavaheapmái\",\n licenseText: \"Dán podkasttas lea liseansa\",\n restrictedUseText: \"Dán podkasttas lea\",\n },\n video: {\n heading: \"Ná geavahat video ođđasit\",\n description: \"Muitte máŋget teavstta mii galgá čuovvut video doppe gos dat geavahuvvo.\",\n rules: \"Njuolggadusat video geavaheapmái\",\n itemImage: {\n ariaLabel: \"Raba video ođđa siiddus\",\n },\n licenseText: \"Dán videoi lea liseansa\",\n restrictedUseText: \"Dán videoi lea\",\n },\n other: {\n heading: \"Ná geavahat eará sisdoalu ođđasit\",\n description: \"Njuolggadusaid sisdoalu geavaheapmái gávnnat sisdoalloelemeanttas\",\n itemImage: {\n ariaLabel: \"Raba ođđa siiddus\",\n },\n },\n h5p: {\n heading: \"Ná geavahat H5P-sisdoalu ođđasit\",\n description: \"Njuolggadusaid sisdoalu geavaheapmái gávnnat H5P-elemeanttas\",\n rules: \"Njuolggadusat H5P geavaheapmái\",\n licenseText: \"Dát interaktiiva bargu (H5P) lea ožžon liseanssa\",\n restrictedUseText: \"Dát interaktiiva bargu (H5P) lea ožžon\",\n },\n concept: {\n heading: \"Ná geavahat čilgehusaid ođđasit\",\n description: \"Husk at innebygd innhald i ei forklaring kan ha ein anna lisens enn sjølve forklaringsteksten\",\n rules: \"Njuolggadusat čilgehusa geavaheapmái\",\n embedlink: {\n heading: \"Ná čájehat čilgehusa eará sisdoalus\",\n description: \"Dát liŋka čájeha čilgehusa konteavstta haga (fállu ja vuolleteaksta)\",\n copyTitle: \"Máŋge sisahuksenliŋkka\",\n hasCopiedTitle: \"Sisahuksenliŋka máŋgejuvvon\",\n },\n licenseText: \"Dán čilgehusas lea liseansa\",\n restrictedUseText: \"Dán čilgehusas lea\",\n },\n gloss: {\n heading: \"Movt geavahit ođđasit dajaldagaid\",\n description:\n \"Muitte ahte sisdoalus mii lea vuojuhuvvon ovtta gihppagii sáhttá leat eará liseansa go dušše jietnadat.\",\n rules: \"Glossa geavaheami njuolggadusat\",\n showOrHideExamples: \"Čájet dahje čiega ovdamearkkaid\",\n embedlink: {\n heading: \"Čájet jietnadaga eará sisdoaluin\",\n description: \"Dát liŋka čájeha teavstta konteavstta haga (fállu ja juolgeteaksta)\",\n copyTitle: \"Máŋge sisačálihanliŋkka\",\n hasCopiedTitle: \"Sajáiduhttinliŋka mángejuvvon\",\n },\n licenseText: \"Dán jietnadagas lea liseansa\",\n restrictedUseText: \"Dán jietnadagas lea\",\n },\n files: {\n heading: \"Ná geavahat fiillaid ođđasit\",\n description: \"Muitte máŋget teavsttaid mat galget čuovvut fiillaid doppe gos dat geavahuvvet.\",\n rules: \"Njuolggadusat fiilla geavaheapmái\",\n itemImage: {\n ariaLabel: \"Raba ođđa siiddus\",\n },\n },\n processed: \"Sisdoallu lea rievdaduvvon.\",\n },\n errorMessage: {\n title: \"Ops, juoga manai boastut\",\n description: \"Šállošit, boasttuvuohta čuožžilii.\",\n back: \"Mana ruovttoluotta\",\n goToFrontPage: \"Mana ovdasiidui\",\n },\n figure: {\n button: {\n alternative: \"Lonut siidui mas dulkojuvvo oaidninváttuid ektui\",\n original: \"Lonut orginála videoi\",\n },\n },\n contentTypes: {\n all: \"Buot\",\n article: \"Artikkel\",\n subject: \"Fága\",\n \"topic-article\": \"Fáddá\",\n learningpath: \"Oahppanbálggis\",\n \"learning-path\": \"Oahppanbálggis\",\n \"subject-material\": \"Fágaávdnasat\",\n \"tasks-and-activities\": \"Bihtát ja doaimmat\",\n \"source-material\": \"Gáldomateriála\",\n \"assessment-resources\": \"Árvoštallanresursa\",\n topic: \"Fáddá\",\n multidisciplinary: \"Fágaidrasttideaddji fáddá\",\n image: \"Govva\",\n concept: \"Čilgehus\",\n audio: \"Jietna\",\n podcast: \"Podkásta\",\n h5p: \"H5P\",\n video: \"Video\",\n missing: \"Ukjent\",\n external: \"Ekstern\",\n gloss: \"Glose\",\n programme: \"Programfag\",\n \"podcast-series\": \"Podkast-serie\",\n \"frontpage-article\": \"Om NDLA-artikkel\",\n },\n languages: {\n nb: \"Girjedárogiella\",\n nn: \"Ođđadárogiella\",\n en: \"Eŋgelasgiella\",\n fr: \"Fránskkagiella\",\n de: \"Duiskkagiella\",\n se: \"Davvisámegiella\",\n sma: \"Máttasámegiella\",\n es: \"Espánnjagiella\",\n zh: \"Kiinnágiella\",\n ukr: \"Ukrainsk\",\n unknown: \"Amas\",\n prefixChangeLanguage: \"Vállje giela\",\n },\n breadcrumb: {\n toFrontpage: \"NDLA ovdasiidu\",\n breadcrumb: \"Láibemoallobálggis\",\n },\n codeBlock: {\n copiedCode: \"Koda lea máŋgejuvvon vuorkátávvalii\",\n copyCode: \"Máŋge koda vuorkátávvalii\",\n },\n close: \"Govčča\",\n loading: \"Viežžá\",\n title: \"Tihttel\",\n cancel: \"Botkke\",\n save: \"Vurke\",\n email: \"E-boasta\",\n finished: \"Ferdig\",\n audio: {\n play: \"Čuojat\",\n pause: \"Boatkke\",\n progressBar: \"Fremdriftsindikator\",\n valueText: \"{{start}} av {{end}}\",\n controls: {\n forward15sec: \"Sirdde 15 sekundda ovddas\",\n rewind15sec: \"Sirdde 15 sekundda maŋos\",\n selectSpeed: \"Vállje čuojahanleahtu\",\n adjustVolume: \"Rievdat voluma\",\n },\n textVersion: {\n heading: \"Teakstavearšuvdna\",\n close: \"Govčča teakstavearšuvnna\",\n },\n readMoreDescriptionLabel: \"Čájet eanet\",\n readLessDescriptionLabel: \"Čájet unnit\",\n },\n source: \"Gáldu\",\n related: {\n title: \"Guoskevaš sisdoallu\",\n linkInfo: \"Neahttasiidu čuovvuvaččas\",\n showMore: \"Čájet eanet guoskevaš sisdoalu\",\n showLess: \"Čájet unnit\",\n },\n download: \"Viečča fiilla: \",\n factbox: {\n open: \"Raba fáktádoasa\",\n close: \"Govčča fáktádoasa\",\n },\n embed: {\n linkError: \"Ii sáhttán čájehit liŋkka.\",\n unsupported: `Embed {{type}} ii dorjojuvvo.`,\n embedError: `Šattai meattáhus {{type}} vieččadettiin. Geahččal viežžat siiddu ođđasit.`,\n type: {\n image: \"Govva\",\n video: \"Video\",\n audio: \"Jietna\",\n podcast: \"Podkast\",\n concept: \"Čilgehus\",\n h5p: \"H5P\",\n external: \"Olgguldas resursa\",\n gloss: \"Glose\",\n copyright: \"Tekst\",\n code: \"Kodeblokk\",\n disclaimer: \"UU-advarsel\",\n },\n },\n uuDisclaimer: { title: \"Tilgjengelighet\" },\n gloss: {\n examples: \"Ovdamearkkat\",\n showExamples: \"Vis eksempler\",\n wordClass: \"Sátneluohkká\",\n play: \"Čuojat glose\",\n transcriptions: {\n traditional: \"Árbevirolaš čállinvuohki\",\n pinyin: \"Pinyin\",\n },\n },\n wordClass: {\n [wordClass.adjective]: \"Adjektiivvat\",\n [wordClass.adverb]: \"Advearba\",\n [wordClass.properNoun]: \"Iežas namma\",\n [wordClass.auxiliary]: \"Veahkkesánit\",\n [wordClass.complement]: \"Dievasmahttin\",\n [wordClass.conjunction]: \"Konjunksjon\",\n [wordClass.coverb]: \"Koverb\",\n [wordClass.determiner]: \"Mearrádussánit\",\n [wordClass.interjection]: \"Ovttastuvvon\",\n [wordClass.quantifier]: \"Kvantor\",\n [wordClass.marker]: \"Sieván\",\n [wordClass.modalVerb]: \"Modálavearba\",\n [wordClass.measureWord]: \"Olahussátni\",\n [wordClass.noun]: \"Substantiivvat\",\n [wordClass[\"noun-zh\"]]: \"Nome\",\n [wordClass.nounPhrase]: \"Nomengihppu\",\n [wordClass.onomatopoeia]: \"Onomatopoetikon\",\n [wordClass.particle]: \"Partihkkalat\",\n [wordClass.demonstrative]: \"Čujuhusat\",\n [wordClass.personalPronoun]: \"Persovnnalaš pronomen\",\n [wordClass.preposition]: \"Preposišuvdna\",\n [wordClass.pronoun]: \"Pronomen\",\n [wordClass.questionWord]: \"Jearaldatsánit\",\n [wordClass.locationWord]: \"Báikesánit\",\n [wordClass.suffix]: \"Suffivssat\",\n [wordClass.numeral]: \"Lohkosánit\",\n [wordClass.timeWord]: \"Áigebágo\",\n [wordClass.timeExpression]: \"Áigemearka\",\n [wordClass.stativeVerb]: \"Dili-vearbba\",\n [wordClass.subordinatingConjunction]: \"Subjunkšuvdna\",\n [wordClass.exclamationWord]: \"Ii-rohkossátni\",\n [wordClass.expression]: \"Ovdanbuktin\",\n [wordClass.verb]: \"Vearbbat\",\n [wordClass.verbComplement]: \"Vearbasuorggideapmi\",\n [wordClass.verbObject]: \"Vearbaobjeakta\",\n },\n login: \"Čálit sisa\",\n component: {\n tagsInput: {\n clearTriggerLabel: \"Fjern alle emneknagger\",\n deleteTagTriggerLabel: \"Fjern emneknagg {{tag}}\",\n tagAdded: \"Emneknagg {{tag}} lagt til\",\n tagsPasted: \"Limte inn {{length}} emneknagger\",\n tagEdited: \"Redigerer emneknagg {{tag}}. Trykk enter for å lagre, eller esc for å avbryte.\",\n tagUpdated: \"Emneknagg oppdatert til {{tag}}\",\n tagDeleted: \"Emneknagg {{tag}} slettet\",\n tagSelected: \"Emneknagg {{tag}} valgt. Trykk enter for å redigere. Trykk backspace eller delete for å slette\",\n },\n combobox: {\n triggerLabel: \"Vis resultater\",\n clearTriggerLabel: \"Fjern valg\",\n },\n pagination: {\n rootLabel: \"Sidenavigering\",\n prevTriggerLabel: \"Forrige side\",\n nextTriggerLabel: \"Neste side\",\n lastPage: \"Siste side, side {{page}}\",\n page: \"Side {{page}}\",\n },\n imageSearch: {\n searchPlaceholder: \"Søk i bilder\",\n searchButtonTitle: \"Søk\",\n imagePreview: {\n creatorsLabel: \"Bilde\",\n license: \"Lisens\",\n caption: \"Bildetekst\",\n altText: \"Alt-tekst\",\n modelRelease: \"Modellklarert\",\n tags: \"Emneknagger\",\n checkboxLabel: \"Sett som metabilde\",\n close: \"Lukk\",\n useImageTitle: \"Bruk bildet\",\n },\n },\n audioSearch: {\n searchPlaceholder: \"Søk i lydfiler\",\n searchButtonTitle: \"Søk\",\n useAudio: \"Velg lyd\",\n noResults: \"Ingen resultater funnet\",\n },\n videoSearch: {\n searchPlaceholder: \"Søk i videoar\",\n searchButtonTitle: \"Søk\",\n loadMoreVideos: \"Last fleire videoar\",\n noResults: \"Ingen videoar funnet\",\n addVideo: \"Bruk video\",\n previewVideo: \"Forhåndsvis\",\n is360Video: \"VR-video\",\n close: \"Lukk\",\n },\n datePicker: {\n dayCell: {\n unavailable: \"Ikke tilgjengelig dato. {{date}}\",\n selected: \"Valgt dato. {{date}}\",\n select: \"Velg dato. {{date}}\",\n },\n nextTrigger: {\n day: \"Gå til neste måned\",\n month: \"Gå til neste år\",\n year: \"Gå til neste tiår\",\n },\n prevTrigger: {\n day: \"Gå til forrige måned\",\n month: \"Gå til forrige år\",\n year: \"Gå til forrige tiår\",\n },\n monthSelect: \"Velg måned\",\n yearSelect: \"Velg år\",\n viewTrigger: {\n day: \"Bytt til dagvisning\",\n month: \"Bytt til månedvisning\",\n year: \"Bytt til årvisning\",\n },\n presetTrigger: {\n single: \"Velg {{date}}\",\n range: \"Velg fra {{start}} til {{end}}\",\n },\n clearTrigger: \"Fjern valgte datoer\",\n trigger: {\n open: \"Åpne datovelger\",\n close: \"Lukk datovelger\",\n },\n content: \"Kalender\",\n },\n },\n richTextEditor: {\n tooltip: {\n bold: \"Fet ({{shortcut}})\",\n code: \"Kode ({{shortcut}})\",\n sub: \"Senket skrift ({{shortcut}})\",\n sup: \"Hevet skrift ({{shortcut}})\",\n underlined: \"Understreket ({{shortcut}})\",\n italic: \"Kursiv ({{shortcut}})\",\n \"numbered-list\": \"Nummerert liste ({{shortcut}})\",\n \"letter-list\": \"Bokstavliste ({{shortcut}})\",\n \"bulleted-list\": \"Punktliste ({{shortcut}})\",\n heading: \"Overskrift {{level}} ({{shortcut}})\",\n paragraph: \"Paragraf ({{shortcut}})\",\n section: \"Seksjon ({{shortcut}})\",\n link: \"Lenke ({{shortcut}})\",\n },\n },\n articleTraits: {\n VIDEO: \"Video\",\n AUDIO: \"Lyd\",\n H5P: \"Interaktivt innhold\",\n PODCAST: \"Podkast\",\n },\n relevance: {\n core: \"Kjernestoff\",\n supplementary: \"Tilleggsstoff\",\n },\n};\n\nexport default messages;\n"],"mappings":";;;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Ac;IACd,gBAAgB;IACjB;GACD,aAAa;GACb,mBAAmB;GACpB;EACD,MAAM;GACJ,SAAS;GACT,aAAa;GACb,OAAO;GACP,WAAW;GACX,aAAa;GACb,mBAAmB;GACpB;EACD,OAAO;GACL,SAAS;GACT,aAAa;GACb,OAAO;GACP,aAAa;GACb,mBAAmB;GACpB;EACD,SAAS;GACP,SAAS;GACT,aAAa;GACb,OAAO;GACP,aAAa;GACb,mBAAmB;GACpB;EACD,OAAO;GACL,SAAS;GACT,aAAa;GACb,OAAO;GACP,WAAW,EACT,WAAW,2BACZ;GACD,aAAa;GACb,mBAAmB;GACpB;EACD,OAAO;GACL,SAAS;GACT,aAAa;GACb,WAAW,EACT,WAAW,qBACZ;GACF;EACD,KAAK;GACH,SAAS;GACT,aAAa;GACb,OAAO;GACP,aAAa;GACb,mBAAmB;GACpB;EACD,SAAS;GACP,SAAS;GACT,aAAa;GACb,OAAO;GACP,WAAW;IACT,SAAS;IACT,aAAa;IACb,WAAW;IACX,gBAAgB;IACjB;GACD,aAAa;GACb,mBAAmB;GACpB;EACD,OAAO;GACL,SAAS;GACT,aACE;GACF,OAAO;GACP,oBAAoB;GACpB,WAAW;IACT,SAAS;IACT,aAAa;IACb,WAAW;IACX,gBAAgB;IACjB;GACD,aAAa;GACb,mBAAmB;GACpB;EACD,OAAO;GACL,SAAS;GACT,aAAa;GACb,OAAO;GACP,WAAW,EACT,WAAW,qBACZ;GACF;EACD,WAAW;EACZ;CACD,cAAc;EACZ,OAAO;EACP,aAAa;EACb,MAAM;EACN,eAAe;EAChB;CACD,QAAQ,EACN,QAAQ;EACN,aAAa;EACb,UAAU;EACX,EACF;CACD,cAAc;EACZ,KAAK;EACL,SAAS;EACT,SAAS;EACT,iBAAiB;EACjB,cAAc;EACd,iBAAiB;EACjB,oBAAoB;EACpB,wBAAwB;EACxB,mBAAmB;EACnB,wBAAwB;EACxB,OAAO;EACP,mBAAmB;EACnB,OAAO;EACP,SAAS;EACT,OAAO;EACP,SAAS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;GACb,YAAY;GACZ,aAAa;IACX,KAAK;IACL,OAAO;IACP,MAAM;IACP;GACD,eAAe;IACb,QAAQ;IACR,OAAO;IACR;GACD,cAAc;GACd,SAAS;IACP,MAAM;IACN,OAAO;IACR;GACD,SAAS;GACV;EACF;CACD,gBAAgB,EACd,SAAS;EACP,MAAM;EACN,MAAM;EACN,KAAK;EACL,KAAK;EACL,YAAY;EACZ,QAAQ;EACR,iBAAiB;EACjB,eAAe;EACf,iBAAiB;EACjB,SAAS;EACT,WAAW;EACX,SAAS;EACT,MAAM;EACP,EACF;CACD,eAAe;EACb,OAAO;EACP,OAAO;EACP,KAAK;EACL,SAAS;EACV;CACD,WAAW;EACT,MAAM;EACN,eAAe;EAChB;CACF;AAED,0BAAe"}
|
package/lib/Article/Article.d.ts
CHANGED
|
@@ -22,8 +22,9 @@ interface ArticleTitleProps {
|
|
|
22
22
|
title?: ReactNode;
|
|
23
23
|
introduction?: ReactNode;
|
|
24
24
|
disclaimer?: ReactNode;
|
|
25
|
+
children?: ReactNode;
|
|
25
26
|
}
|
|
26
|
-
export declare const ArticleTitle: ({ badges, heartButton, title, lang, id, introduction, competenceGoals, disclaimer, }: ArticleTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare const ArticleTitle: ({ badges, heartButton, title, lang, id, introduction, competenceGoals, disclaimer, children, }: ArticleTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
28
|
interface Props {
|
|
28
29
|
badges?: ReactNode;
|
|
29
30
|
heartButton?: ReactNode;
|
package/lib/Article/Article.js
CHANGED
|
@@ -17,7 +17,7 @@ let __ndla_styled_system_css = require("@ndla/styled-system/css");
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
const StyledArticleContent = (0, __ndla_styled_system_jsx.styled)(__ark_ui_react.ark.section, {}, { baseComponent: true });
|
|
20
|
-
const ArticleContent = (0, react.forwardRef)(({ className
|
|
20
|
+
const ArticleContent = (0, react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledArticleContent, {
|
|
21
21
|
className: (0, __ndla_styled_system_css.cx)("ndla-article", className),
|
|
22
22
|
...props,
|
|
23
23
|
ref
|
|
@@ -80,7 +80,7 @@ const StyledWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
|
80
80
|
flexWrap: "wrap",
|
|
81
81
|
alignItems: "center"
|
|
82
82
|
} });
|
|
83
|
-
const ArticleTitle = ({ badges, heartButton, title, lang, id, introduction, competenceGoals, disclaimer }) => {
|
|
83
|
+
const ArticleTitle = ({ badges, heartButton, title, lang, id, introduction, competenceGoals, disclaimer, children }) => {
|
|
84
84
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ArticleHeader, { children: [
|
|
85
85
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ArticleHGroup, { children: [(!!badges || !!heartButton) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(InfoWrapper, { children: [!!badges && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BadgesContainer.BadgesContainer, { children: badges }), heartButton] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Heading, {
|
|
86
86
|
textStyle: "heading.medium",
|
|
@@ -96,7 +96,8 @@ const ArticleTitle = ({ badges, heartButton, title, lang, id, introduction, comp
|
|
|
96
96
|
consumeCss: true,
|
|
97
97
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: introduction })
|
|
98
98
|
}),
|
|
99
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledWrapper, { children: [competenceGoals, disclaimer] })
|
|
99
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledWrapper, { children: [competenceGoals, disclaimer] }),
|
|
100
|
+
children
|
|
100
101
|
] });
|
|
101
102
|
};
|
|
102
103
|
const Article = ({ badges, article, licenseBox, children, competenceGoals, id, heartButton, lang, disclaimer }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Article.js","names":["ark","BadgesContainer","Heading","Text","ArticleByline"],"sources":["../../src/Article/Article.tsx"],"sourcesContent":["/**\n * Copyright (c) 2016-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\";\nimport { Heading, Text } from \"@ndla/primitives\";\nimport { cx } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { ArticleByline } from \"./ArticleByline\";\nimport { BadgesContainer } from \"./BadgesContainer\";\nimport type { Article as ArticleType } from \"../types\";\n\nconst StyledArticleContent = styled(ark.section, {}, { baseComponent: true });\n\nexport const ArticleContent = forwardRef<HTMLElement, HTMLArkProps<\"div\"> & StyledProps>(\n ({ className, ...props }, ref) => (\n <StyledArticleContent className={cx(\"ndla-article\", className)} {...props} ref={ref} />\n ),\n);\n\nconst StyledArticleWrapper = styled(\n ark.article,\n {\n base: {\n background: \"background.default\",\n display: \"flex\",\n flexDirection: \"column\",\n color: \"text.default\",\n alignItems: \"center\",\n width: \"100%\",\n overflowWrap: \"break-word\",\n position: \"relative\",\n \"& mjx-stretchy-v > mjx-ext > mjx-c\": {\n transform: \"scaleY(100) translateY(0.075em)\",\n },\n _after: {\n content: \"\",\n display: \"table\",\n clear: \"both\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleWrapper = forwardRef<HTMLElement, ComponentPropsWithRef<\"article\"> & StyledProps>((props, ref) => (\n <StyledArticleWrapper data-ndla-article=\"\" ref={ref} {...props} />\n));\n\nexport const ArticleHGroup = styled(\n ark.hgroup,\n {\n base: {\n display: \"flex\",\n width: \"100%\",\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n \"& h1\": {\n overflowWrap: \"anywhere\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleHeader = styled(\n ark.header,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n alignItems: \"flex-start\",\n width: \"100%\",\n paddingBlockStart: \"xxlarge\",\n overflowWrap: \"anywhere\",\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleFooter = styled(\n ark.footer,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xxlarge\",\n width: \"100%\",\n \"& > :is(:last-child)\": {\n paddingBlockEnd: \"5xlarge\",\n },\n },\n },\n { baseComponent: true },\n);\n\nconst InfoWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n gap: \"small\",\n width: \"100%\",\n minHeight: \"xxlarge\",\n },\n});\n\nconst StyledWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"small\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n },\n});\n\ninterface ArticleTitleProps {\n badges?: ReactNode;\n heartButton?: ReactNode;\n competenceGoals?: ReactNode;\n id: string;\n lang?: string;\n title?: ReactNode;\n introduction?: ReactNode;\n disclaimer?: ReactNode;\n}\n\nexport const ArticleTitle = ({\n badges,\n heartButton,\n title,\n lang,\n id,\n introduction,\n competenceGoals,\n disclaimer,\n}: ArticleTitleProps) => {\n return (\n <ArticleHeader>\n <ArticleHGroup>\n {(!!badges || !!heartButton) && (\n <InfoWrapper>\n {!!badges && <BadgesContainer>{badges}</BadgesContainer>}\n {heartButton}\n </InfoWrapper>\n )}\n <Heading textStyle=\"heading.medium\" id={id} lang={lang} property=\"dct:title\">\n {title}\n </Heading>\n </ArticleHGroup>\n {!!introduction && (\n <Text lang={lang} textStyle=\"body.xlarge\" asChild consumeCss>\n <div>{introduction}</div>\n </Text>\n )}\n <StyledWrapper>\n {competenceGoals}\n {disclaimer}\n </StyledWrapper>\n </ArticleHeader>\n );\n};\n\ninterface Props {\n badges?: ReactNode;\n heartButton?: ReactNode;\n article: ArticleType;\n licenseBox?: ReactNode;\n children?: ReactNode;\n competenceGoals?: ReactNode;\n id: string;\n lang?: string;\n disclaimer?: ReactNode;\n}\n\nexport const Article = ({\n badges,\n article,\n licenseBox,\n children,\n competenceGoals,\n id,\n heartButton,\n lang,\n disclaimer,\n}: Props) => {\n const { title, introduction, published, content, footNotes, copyright } = article;\n\n const authors =\n copyright?.creators.length || copyright?.rightsholders.length ? copyright.creators : copyright?.processors;\n\n return (\n <ArticleWrapper>\n <ArticleTitle\n id={id}\n badges={badges}\n heartButton={heartButton}\n title={title}\n introduction={introduction}\n competenceGoals={competenceGoals}\n lang={lang}\n disclaimer={disclaimer}\n />\n <ArticleContent>{content}</ArticleContent>\n <ArticleFooter>\n <ArticleByline\n lang={lang}\n footnotes={footNotes}\n authors={authors}\n suppliers={copyright?.rightsholders}\n published={published}\n licenseBox={licenseBox}\n />\n {children}\n </ArticleFooter>\n </ArticleWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,4DAA8BA,mBAAI,SAAS,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAE7E,MAAa,wCACV,EAAE,
|
|
1
|
+
{"version":3,"file":"Article.js","names":["ark","BadgesContainer","Heading","Text","ArticleByline"],"sources":["../../src/Article/Article.tsx"],"sourcesContent":["/**\n * Copyright (c) 2016-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\";\nimport { Heading, Text } from \"@ndla/primitives\";\nimport { cx } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\nimport { ArticleByline } from \"./ArticleByline\";\nimport { BadgesContainer } from \"./BadgesContainer\";\nimport type { Article as ArticleType } from \"../types\";\n\nconst StyledArticleContent = styled(ark.section, {}, { baseComponent: true });\n\nexport const ArticleContent = forwardRef<HTMLElement, HTMLArkProps<\"div\"> & StyledProps>(\n ({ className, ...props }, ref) => (\n <StyledArticleContent className={cx(\"ndla-article\", className)} {...props} ref={ref} />\n ),\n);\n\nconst StyledArticleWrapper = styled(\n ark.article,\n {\n base: {\n background: \"background.default\",\n display: \"flex\",\n flexDirection: \"column\",\n color: \"text.default\",\n alignItems: \"center\",\n width: \"100%\",\n overflowWrap: \"break-word\",\n position: \"relative\",\n \"& mjx-stretchy-v > mjx-ext > mjx-c\": {\n transform: \"scaleY(100) translateY(0.075em)\",\n },\n _after: {\n content: \"\",\n display: \"table\",\n clear: \"both\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleWrapper = forwardRef<HTMLElement, ComponentPropsWithRef<\"article\"> & StyledProps>((props, ref) => (\n <StyledArticleWrapper data-ndla-article=\"\" ref={ref} {...props} />\n));\n\nexport const ArticleHGroup = styled(\n ark.hgroup,\n {\n base: {\n display: \"flex\",\n width: \"100%\",\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n \"& h1\": {\n overflowWrap: \"anywhere\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleHeader = styled(\n ark.header,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n alignItems: \"flex-start\",\n width: \"100%\",\n paddingBlockStart: \"xxlarge\",\n overflowWrap: \"anywhere\",\n },\n },\n { baseComponent: true },\n);\n\nexport const ArticleFooter = styled(\n ark.footer,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xxlarge\",\n width: \"100%\",\n \"& > :is(:last-child)\": {\n paddingBlockEnd: \"5xlarge\",\n },\n },\n },\n { baseComponent: true },\n);\n\nconst InfoWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n gap: \"small\",\n width: \"100%\",\n minHeight: \"xxlarge\",\n },\n});\n\nconst StyledWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n gap: \"small\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n },\n});\n\ninterface ArticleTitleProps {\n badges?: ReactNode;\n heartButton?: ReactNode;\n competenceGoals?: ReactNode;\n id: string;\n lang?: string;\n title?: ReactNode;\n introduction?: ReactNode;\n disclaimer?: ReactNode;\n children?: ReactNode;\n}\n\nexport const ArticleTitle = ({\n badges,\n heartButton,\n title,\n lang,\n id,\n introduction,\n competenceGoals,\n disclaimer,\n children,\n}: ArticleTitleProps) => {\n return (\n <ArticleHeader>\n <ArticleHGroup>\n {(!!badges || !!heartButton) && (\n <InfoWrapper>\n {!!badges && <BadgesContainer>{badges}</BadgesContainer>}\n {heartButton}\n </InfoWrapper>\n )}\n <Heading textStyle=\"heading.medium\" id={id} lang={lang} property=\"dct:title\">\n {title}\n </Heading>\n </ArticleHGroup>\n {!!introduction && (\n <Text lang={lang} textStyle=\"body.xlarge\" asChild consumeCss>\n <div>{introduction}</div>\n </Text>\n )}\n <StyledWrapper>\n {competenceGoals}\n {disclaimer}\n </StyledWrapper>\n {children}\n </ArticleHeader>\n );\n};\n\ninterface Props {\n badges?: ReactNode;\n heartButton?: ReactNode;\n article: ArticleType;\n licenseBox?: ReactNode;\n children?: ReactNode;\n competenceGoals?: ReactNode;\n id: string;\n lang?: string;\n disclaimer?: ReactNode;\n}\n\nexport const Article = ({\n badges,\n article,\n licenseBox,\n children,\n competenceGoals,\n id,\n heartButton,\n lang,\n disclaimer,\n}: Props) => {\n const { title, introduction, published, content, footNotes, copyright } = article;\n\n const authors =\n copyright?.creators.length || copyright?.rightsholders.length ? copyright.creators : copyright?.processors;\n\n return (\n <ArticleWrapper>\n <ArticleTitle\n id={id}\n badges={badges}\n heartButton={heartButton}\n title={title}\n introduction={introduction}\n competenceGoals={competenceGoals}\n lang={lang}\n disclaimer={disclaimer}\n />\n <ArticleContent>{content}</ArticleContent>\n <ArticleFooter>\n <ArticleByline\n lang={lang}\n footnotes={footNotes}\n authors={authors}\n suppliers={copyright?.rightsholders}\n published={published}\n licenseBox={licenseBox}\n />\n {children}\n </ArticleFooter>\n </ArticleWrapper>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,4DAA8BA,mBAAI,SAAS,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC;AAE7E,MAAa,wCACV,EAAE,WAAW,GAAG,SAAS,QACxB,2CAAC;CAAqB,4CAAc,gBAAgB,UAAU;CAAE,GAAI;CAAY;EAAO,CAE1F;AAED,MAAM,4DACJA,mBAAI,SACJ,EACE,MAAM;CACJ,YAAY;CACZ,SAAS;CACT,eAAe;CACf,OAAO;CACP,YAAY;CACZ,OAAO;CACP,cAAc;CACd,UAAU;CACV,sCAAsC,EACpC,WAAW,mCACZ;CACD,QAAQ;EACN,SAAS;EACT,SAAS;EACT,OAAO;EACR;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAED,MAAa,wCAA0F,OAAO,QAC5G,2CAAC;CAAqB,qBAAkB;CAAQ;CAAK,GAAI;EAAS,CAClE;AAEF,MAAa,qDACXA,mBAAI,QACJ,EACE,MAAM;CACJ,SAAS;CACT,OAAO;CACP,eAAe;CACf,YAAY;CACZ,QAAQ,EACN,cAAc,YACf;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAED,MAAa,qDACXA,mBAAI,QACJ,EACE,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,YAAY;CACZ,OAAO;CACP,mBAAmB;CACnB,cAAc;CACf,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAED,MAAa,qDACXA,mBAAI,QACJ,EACE,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,OAAO;CACP,wBAAwB,EACtB,iBAAiB,WAClB;CACF,EACF,EACD,EAAE,eAAe,MAAM,CACxB;AAED,MAAM,mDAAqB,OAAO,EAChC,MAAM;CACJ,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,KAAK;CACL,OAAO;CACP,WAAW;CACZ,EACF,CAAC;AAEF,MAAM,qDAAuB,OAAO,EAClC,MAAM;CACJ,SAAS;CACT,KAAK;CACL,UAAU;CACV,YAAY;CACb,EACF,CAAC;AAcF,MAAa,gBAAgB,EAC3B,QACA,aACA,OACA,MACA,IACA,cACA,iBACA,YACA,eACuB;AACvB,QACE,4CAAC;EACC,4CAAC,6BACG,CAAC,CAAC,UAAU,CAAC,CAAC,gBACd,4CAAC,0BACE,CAAC,CAAC,UAAU,2CAACC,qDAAiB,SAAyB,EACvD,eACW,EAEhB,2CAACC;GAAQ,WAAU;GAAqB;GAAU;GAAM,UAAS;aAC9D;IACO,IACI;EACf,CAAC,CAAC,gBACD,2CAACC;GAAW;GAAM,WAAU;GAAc;GAAQ;aAChD,2CAAC,mBAAK,eAAmB;IACpB;EAET,4CAAC,4BACE,iBACA,cACa;EACf;KACa;;AAgBpB,MAAa,WAAW,EACtB,QACA,SACA,YACA,UACA,iBACA,IACA,aACA,MACA,iBACW;CACX,MAAM,EAAE,OAAO,cAAc,WAAW,SAAS,WAAW,cAAc;CAE1E,MAAM,UACJ,WAAW,SAAS,UAAU,WAAW,cAAc,SAAS,UAAU,WAAW,WAAW;AAElG,QACE,4CAAC;EACC,2CAAC;GACK;GACI;GACK;GACN;GACO;GACG;GACX;GACM;IACZ;EACF,2CAAC,4BAAgB,UAAyB;EAC1C,4CAAC,4BACC,2CAACC;GACO;GACN,WAAW;GACF;GACT,WAAW,WAAW;GACX;GACC;IACZ,EACD,YACa;KACD"}
|
|
@@ -104,7 +104,7 @@ const ArticleByline = ({ lang, authors = [], suppliers = [], footnotes, licenseB
|
|
|
104
104
|
})]
|
|
105
105
|
})] });
|
|
106
106
|
};
|
|
107
|
-
const ArticleBylineAccordionItem = (0, react.forwardRef)(({ value, accordionTitle, children
|
|
107
|
+
const ArticleBylineAccordionItem = (0, react.forwardRef)(({ value, accordionTitle, children, ...props }, ref) => {
|
|
108
108
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__ndla_primitives.AccordionItem, {
|
|
109
109
|
value,
|
|
110
110
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArticleByline.js","names":["AccordionRoot","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\";\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, i18n } = 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 ?? i18n.language, { 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":";;;;;;;;;;;;;;;;;;;AA0BA,MAAM,+CAAiB,OAAO,EAC5B,MAAM;CAEJ,kBAAkB;CAClB,mBAAmB;CACnB,WAAW;CACX,aAAa;CACd,EACF,CAAC;AAEF,MAAM,mDAAqB,OAAO;CAChC,MAAM;EACJ,SAAS;EACT,e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IAAI,KAAK,WAAW,QAAQ,KAAK,UAAU;EAAE,OAAO;EAAQ,MAAM;EAAe,CAAC;AAExG,QACE,4CAAC,sBACE,CAAC,CAAC,iBACD,4CAAC;EAAY,cAAc,eAAe;;GACvC,CAAC,CAAC,2BACD,4CAAC,qBACE,QAAQ,SAAS,KAChB,GAAG,EAAE,wBAAwB,EAAE,SAAS,YAAY,CAAC,CAAC,GAAG,WAAW,SAAS,cAAc,CAAC,KAC7F,UAAU,SAAS,KAClB,GAAG,EAAE,yBAAyB,EAAE,OAAO,UAAU,QAAQ,CAAC,CAAC,GAAG,WAAW,WAAW,cAAc,CAAC,MAChG;GAER,yBACC,2CAACC;IAAS,IAAI;cAAyB,EAAE,0BAA0B;KAAY,GAC7E;GACH,YACC,4CAAC;IAAI,qBAAmB;;KACrB,EAAE,GAAG,WAAW,cAAc;KAAC;KAAE;;KAC9B,GACJ;GACH;;GACW,GAEd,CAAC,CAAC,cAAc,CAAC,CAAC,WAAW,WAC7B,4CAAC;EACC;EACA,OAAO;EACP,gBAAgB,YAAY,kBAAkB,QAAQ,MAAM;aAE3D,CAAC,CAAC,cACD,2CAAC;GAA2B,OAAO;GAAoB,gBAAgB,EAAE,qBAAqB;aAC3F;IAC0B,EAE9B,CAAC,CAAC,WAAW,UACZ,2CAAC;GAA2B,OAAO;GAAsB,gBAAgB,EAAE,oBAAoB;aAC7F,2CAACC,6CAAiB,WAAW,YAAa;IACf;GAEX,IAEhB;;AAQd,MAAa,oDACV,EAAE,OAAO,gBAAgB,
|
|
1
|
+
{"version":3,"file":"ArticleByline.js","names":["AccordionRoot","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\";\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, i18n } = 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 ?? i18n.language, { 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":";;;;;;;;;;;;;;;;;;;AA0BA,MAAM,+CAAiB,OAAO,EAC5B,MAAM;CAEJ,kBAAkB;CAClB,mBAAmB;CACnB,WAAW;CACX,aAAa;CACd,EACF,CAAC;AAEF,MAAM,mDAAqB,OAAO;CAChC,MAAM;EACJ,SAAS;EACT,eAAe;EACf,KAAK;EACL,OAAO;EACP,gBAAgB;EAChB,cAAc;EACd,WAAW;EACX,mCAAiC,EAC/B,mBAAmB,QACpB;EACF;CACD,UAAU,EACR,cAAc;EACZ,MAAM,EAAE;EACR,OAAO,EACL,YAAY,EACV,eAAe,OAChB,EACF;EACF,EACF;CACF,CAAC;AAuBF,SAAS,WAAW,MAAuB,eAAgC;AACzE,QAAO,cAAc,OAAO,KAAK,KAAK,MAAM,EAAE,KAAK,CAAC;;AAGtD,MAAM,2DAA6BA,iCAAe,EAChD,MAAM,EACJ,mBAA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AC,CAAC,GAAG,WAAW,WAAW,cAAc,CAAC,MAChG;GAER,yBACC,2CAACC;IAAS,IAAI;cAAyB,EAAE,0BAA0B;KAAY,GAC7E;GACH,YACC,4CAAC;IAAI,qBAAmB;;KACrB,EAAE,GAAG,WAAW,cAAc;KAAC;KAAE;;KAC9B,GACJ;GACH;;GACW,GAEd,CAAC,CAAC,cAAc,CAAC,CAAC,WAAW,WAC7B,4CAAC;EACC;EACA,OAAO;EACP,gBAAgB,YAAY,kBAAkB,QAAQ,MAAM;aAE3D,CAAC,CAAC,cACD,2CAAC;GAA2B,OAAO;GAAoB,gBAAgB,EAAE,qBAAqB;aAC3F;IAC0B,EAE9B,CAAC,CAAC,WAAW,UACZ,2CAAC;GAA2B,OAAO;GAAsB,gBAAgB,EAAE,oBAAoB;aAC7F,2CAACC,6CAAiB,WAAW,YAAa;IACf;GAEX,IAEhB;;AAQd,MAAa,oDACV,EAAE,OAAO,gBAAgB,UAAU,GAAG,SAAS,QAAQ;AACtD,QACE,4CAACC;EAAqB;EAAY;EAAK,GAAI;aACzC,2CAACC;GAAQ;GAAQ;GAAW,WAAU;GAAe,YAAW;aAC9D,2CAAC,kBACC,4CAACC,qDACE,gBACD,2CAACC;IAAuB;cACtB,2CAACC,oCAAqB;KACC,IACJ,GACpB;IACG,EACV,2CAACC,0CAAsB,WAAgC;GACzC;EAGrB"}
|
|
@@ -90,24 +90,21 @@ const Controls = ({ src, title }) => {
|
|
|
90
90
|
const [speedValue, setSpeedValue] = (0, react.useState)(1);
|
|
91
91
|
const [volumeValue, setVolumeValue] = (0, react.useState)(100);
|
|
92
92
|
const [currentTime, setCurrentTime] = (0, react.useState)(0);
|
|
93
|
-
const [
|
|
93
|
+
const [duration, setDuration] = (0, react.useState)(0);
|
|
94
94
|
const [playing, setPlaying] = (0, react.useState)(false);
|
|
95
95
|
const audioRef = (0, react.useRef)(null);
|
|
96
|
-
(0, react.useEffect)(() => {
|
|
97
|
-
if (audioRef.current) audioRef.current.playbackRate = speedValue;
|
|
98
|
-
}, [speedValue]);
|
|
99
96
|
(0, react.useEffect)(() => {
|
|
100
97
|
if (audioRef.current) {
|
|
101
98
|
const audioElement = audioRef.current;
|
|
102
99
|
const handleTimeUpdate = () => {
|
|
103
|
-
const { currentTime: currentTime$1, duration } = audioElement;
|
|
100
|
+
const { currentTime: currentTime$1, duration: duration$1 } = audioElement;
|
|
104
101
|
setCurrentTime(Math.round(currentTime$1));
|
|
105
|
-
|
|
102
|
+
setDuration(Math.round(duration$1));
|
|
106
103
|
};
|
|
107
104
|
const handleLoadedMetaData = () => {
|
|
108
|
-
const { currentTime: currentTime$1, duration } = audioElement;
|
|
105
|
+
const { currentTime: currentTime$1, duration: duration$1 } = audioElement;
|
|
109
106
|
setCurrentTime(Math.round(currentTime$1));
|
|
110
|
-
|
|
107
|
+
setDuration(Math.round(duration$1));
|
|
111
108
|
};
|
|
112
109
|
const handleTimeEnded = () => {
|
|
113
110
|
setPlaying(false);
|
|
@@ -130,6 +127,10 @@ const Controls = ({ src, title }) => {
|
|
|
130
127
|
setPlaying(!playing);
|
|
131
128
|
}
|
|
132
129
|
};
|
|
130
|
+
const onPlaybackRateChange = (rate) => {
|
|
131
|
+
setSpeedValue(rate);
|
|
132
|
+
if (audioRef.current) audioRef.current.playbackRate = rate;
|
|
133
|
+
};
|
|
133
134
|
const onSeekSeconds = (seconds) => {
|
|
134
135
|
if (audioRef.current) audioRef.current.currentTime += seconds;
|
|
135
136
|
};
|
|
@@ -177,14 +178,14 @@ const Controls = ({ src, title }) => {
|
|
|
177
178
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: formatTime(currentTime) })
|
|
178
179
|
}),
|
|
179
180
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__ndla_primitives.SliderRoot, {
|
|
180
|
-
value: [
|
|
181
|
+
value: [currentTime],
|
|
181
182
|
defaultValue: [0],
|
|
182
183
|
step: 1,
|
|
183
|
-
max:
|
|
184
|
+
max: duration,
|
|
184
185
|
onValueChange: handleSliderChange,
|
|
185
186
|
getAriaValueText: (value) => t("audio.valueText", {
|
|
186
187
|
start: formatTime(Math.round(value.value)),
|
|
187
|
-
end: formatTime(Math.round(
|
|
188
|
+
end: formatTime(Math.round(duration))
|
|
188
189
|
}),
|
|
189
190
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.SliderLabel, {
|
|
190
191
|
srOnly: true,
|
|
@@ -198,13 +199,13 @@ const Controls = ({ src, title }) => {
|
|
|
198
199
|
textStyle: "label.medium",
|
|
199
200
|
asChild: true,
|
|
200
201
|
consumeCss: true,
|
|
201
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: ["-", formatTime(
|
|
202
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: ["-", formatTime(Math.round(duration - currentTime))] })
|
|
202
203
|
})
|
|
203
204
|
] }),
|
|
204
205
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.FieldRoot, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledSelectRoot, {
|
|
205
206
|
collection: speedValues,
|
|
206
207
|
value: [speedValue.toString()],
|
|
207
|
-
onValueChange: (details) =>
|
|
208
|
+
onValueChange: (details) => onPlaybackRateChange(parseFloat(details.value[0])),
|
|
208
209
|
positioning: { placement: "top" },
|
|
209
210
|
children: [
|
|
210
211
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.SelectLabel, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Controls.js","names":["IconButton","Text","Button","SelectRoot","SliderControl","PopoverContent","currentTime","Replay15Line","PauseLine","PlayFill","Forward15Line","SliderRoot","SliderLabel","SliderTrack","SliderRange","SliderThumb","SliderHiddenInput","FieldRoot","SelectLabel","SelectControl","SelectTrigger","SelectContent","SelectItem","SelectItemText","SelectItemIndicator","CheckLine","PopoverRoot","PopoverTrigger","VolumeUpFill"],"sources":["../../src/AudioPlayer/Controls.tsx"],"sourcesContent":["/**\n * Copyright (c) 2021-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { type SliderValueChangeDetails, createListCollection } from \"@ark-ui/react\";\nimport { Replay15Line, Forward15Line, PlayFill, PauseLine, VolumeUpFill, CheckLine } from \"@ndla/icons\";\nimport {\n Button,\n FieldRoot,\n IconButton,\n PopoverContent,\n PopoverRoot,\n PopoverTrigger,\n SelectContent,\n SelectControl,\n SelectItem,\n SelectItemIndicator,\n SelectItemText,\n SelectLabel,\n SelectRoot,\n SelectTrigger,\n SliderControl,\n SliderHiddenInput,\n SliderLabel,\n SliderRange,\n SliderRoot,\n SliderThumb,\n SliderTrack,\n Text,\n} from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst ControlsWrapper = styled(\"div\", {\n base: {\n borderBlockStart: \"1px solid\",\n borderColor: \"stroke.default\",\n borderBottomRadius: \"xsmall\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"background.default\",\n gap: \"xsmall\",\n paddingBlock: \"xsmall\",\n paddingInline: \"medium\",\n tabletWideDown: {\n display: \"grid\",\n paddingBlock: \"xsmall\",\n paddingInline: \"xsmall\",\n gridTemplateColumns: \"1fr repeat(5, auto) 1fr\",\n gridTemplateAreas: `\n \"track track track track track track track\"\n \". speed backwards play forwards volume .\"\n`,\n },\n mobileWideDown: {\n columnGap: \"3xsmall\",\n },\n },\n});\n\nconst PlayButton = styled(IconButton, {\n base: {\n gridArea: \"play\",\n },\n});\n\nconst Forward15SecButton = styled(IconButton, {\n base: {\n gridArea: \"forwards\",\n },\n});\n\nconst Back15SecButton = styled(IconButton, {\n base: {\n gridArea: \"backwards\",\n },\n});\n\nconst ProgressWrapper = styled(\"div\", {\n base: {\n flex: \"1\",\n display: \"flex\",\n alignItems: \"center\",\n gap: \"xxsmall\",\n gridArea: \"track\",\n paddingBlock: \"xsmall\",\n mobileDown: {\n paddingInline: \"xsmall\",\n },\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n minWidth: \"xxlarge\",\n flexShrink: \"0\",\n textAlign: \"center\",\n },\n});\n\nconst VolumeButton = styled(IconButton, {\n base: {\n gridArea: \"volume\",\n },\n});\n\nconst SpeedButton = styled(Button, {\n base: {\n paddingBlock: \"auto\",\n paddingInline: \"auto\",\n maxWidth: \"xxlarge\",\n maxHeight: \"xxlarge\",\n minWidth: \"xxlarge\",\n minHeight: \"xxlarge\",\n \"& span\": {\n flex: \"1\",\n },\n },\n});\n\nconst StyledSelectRoot = styled(SelectRoot<string>, {\n base: {\n gridArea: \"speed\",\n },\n});\n\nconst StyledSliderControl = styled(SliderControl, {\n base: {\n height: \"surface.3xsmall\",\n minWidth: \"small\",\n },\n});\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n paddingInline: \"small\",\n },\n});\n\nconst formatTime = (seconds: number) => {\n const minutes = Math.floor(seconds / 60);\n const currentSeconds = seconds % 60;\n\n const formattedSeconds = currentSeconds < 10 ? `0${currentSeconds}` : currentSeconds;\n return `${minutes}:${formattedSeconds}`;\n};\n\nconst speedValues = createListCollection({ items: [\"0.5\", \"0.75\", \"1\", \"1.25\", \"1.5\", \"1.75\", \"2\"] });\n\ninterface Props {\n src: string;\n title: string;\n}\n\nexport const Controls = ({ src, title }: Props) => {\n const { t } = useTranslation();\n const [speedValue, setSpeedValue] = useState(1);\n const [volumeValue, setVolumeValue] = useState(100);\n const [currentTime, setCurrentTime] = useState(0);\n const [remainingTime, setRemainingTime] = useState(0);\n const [playing, setPlaying] = useState(false);\n const audioRef = useRef<HTMLAudioElement>(null);\n\n useEffect(() => {\n if (audioRef.current) {\n audioRef.current.playbackRate = speedValue;\n }\n }, [speedValue]);\n\n useEffect(() => {\n if (audioRef.current) {\n const audioElement = audioRef.current;\n const handleTimeUpdate = () => {\n const { currentTime, duration } = audioElement;\n setCurrentTime(Math.round(currentTime));\n setRemainingTime(Math.round(duration - currentTime));\n };\n\n const handleLoadedMetaData = () => {\n const { currentTime, duration } = audioElement;\n setCurrentTime(Math.round(currentTime));\n setRemainingTime(Math.round(duration - currentTime));\n };\n\n const handleTimeEnded = () => {\n setPlaying(false);\n };\n\n audioElement.addEventListener(\"timeupdate\", handleTimeUpdate);\n audioElement.addEventListener(\"loadedmetadata\", handleLoadedMetaData);\n audioElement.addEventListener(\"ended\", handleTimeEnded);\n return () => {\n audioElement.removeEventListener(\"timeupdate\", handleTimeUpdate);\n audioElement.removeEventListener(\"loadedmetadata\", handleLoadedMetaData);\n audioElement.removeEventListener(\"ended\", handleTimeEnded);\n };\n }\n }, []);\n\n const togglePlay = () => {\n if (audioRef.current) {\n const audioElement = audioRef.current;\n if (!playing) {\n audioElement.play();\n } else {\n audioElement.pause();\n }\n setPlaying(!playing);\n }\n };\n\n const onSeekSeconds = (seconds: number) => {\n if (audioRef.current) {\n audioRef.current.currentTime += seconds;\n }\n };\n\n const handleSliderChange = (details: SliderValueChangeDetails) => {\n const newValue = details.value[0];\n if (audioRef.current && newValue != null && !isNaN(newValue)) {\n audioRef.current.currentTime = details.value[0];\n }\n };\n\n const handleVolumeSliderChange = (details: SliderValueChangeDetails) => {\n if (audioRef.current) {\n audioRef.current.volume = details.value[0] / 100;\n setVolumeValue(details.value[0]);\n }\n };\n\n return (\n <div>\n {/* TODO: We should tie this up to the textual description somehow */}\n {/* eslint-disable-next-line jsx-a11y/media-has-caption */}\n <audio ref={audioRef} src={src} title={title} preload=\"metadata\" />\n <ControlsWrapper>\n <Back15SecButton\n variant=\"tertiary\"\n title={t(\"audio.controls.rewind15sec\")}\n aria-label={t(\"audio.controls.rewind15sec\")}\n onClick={() => onSeekSeconds(-15)}\n >\n <Replay15Line />\n </Back15SecButton>\n <PlayButton aria-label={t(playing ? t(\"audio.pause\") : t(\"audio.play\"))} variant=\"primary\" onClick={togglePlay}>\n {playing ? <PauseLine /> : <PlayFill />}\n </PlayButton>\n <Forward15SecButton\n variant=\"tertiary\"\n title={t(\"audio.controls.forward15sec\")}\n aria-label={t(\"audio.controls.forward15sec\")}\n onClick={() => onSeekSeconds(15)}\n >\n <Forward15Line />\n </Forward15SecButton>\n <ProgressWrapper>\n <StyledText textStyle=\"label.medium\" asChild consumeCss>\n <div>{formatTime(currentTime)}</div>\n </StyledText>\n <SliderRoot\n value={[audioRef.current?.currentTime || 0]}\n defaultValue={[0]}\n step={1}\n max={Math.round(audioRef.current?.duration || 0)}\n onValueChange={handleSliderChange}\n getAriaValueText={(value) =>\n t(\"audio.valueText\", {\n start: formatTime(Math.round(value.value)),\n end: formatTime(Math.round(audioRef.current?.duration ?? 0)),\n })\n }\n >\n <SliderLabel srOnly>{t(\"audio.progressBar\")}</SliderLabel>\n <SliderControl>\n <SliderTrack>\n <SliderRange />\n </SliderTrack>\n <SliderThumb index={0}>\n <SliderHiddenInput />\n </SliderThumb>\n </SliderControl>\n </SliderRoot>\n <StyledText textStyle=\"label.medium\" asChild consumeCss>\n <div>-{formatTime(remainingTime)}</div>\n </StyledText>\n </ProgressWrapper>\n <FieldRoot>\n <StyledSelectRoot\n collection={speedValues}\n value={[speedValue.toString()]}\n onValueChange={(details) => setSpeedValue(parseFloat(details.value[0]))}\n positioning={{ placement: \"top\" }}\n >\n <SelectLabel srOnly>{t(\"audio.controls.selectSpeed\")}</SelectLabel>\n <SelectControl>\n <SelectTrigger asChild>\n <SpeedButton\n variant=\"tertiary\"\n title={t(\"audio.controls.selectSpeed\")}\n aria-label={t(\"audio.controls.selectSpeed\")}\n >\n <span>{`${speedValue}x`}</span>\n </SpeedButton>\n </SelectTrigger>\n </SelectControl>\n <SelectContent>\n {speedValues.items.map((speed) => (\n <SelectItem key={speed} item={speed}>\n <SelectItemText>{speed}x</SelectItemText>\n <SelectItemIndicator>\n <CheckLine />\n </SelectItemIndicator>\n </SelectItem>\n ))}\n </SelectContent>\n </StyledSelectRoot>\n </FieldRoot>\n <PopoverRoot positioning={{ placement: \"top\" }}>\n <PopoverTrigger asChild>\n <VolumeButton variant=\"tertiary\" aria-label={t(\"audio.controls.adjustVolume\")}>\n <VolumeUpFill />\n </VolumeButton>\n </PopoverTrigger>\n <StyledPopoverContent>\n <SliderRoot\n orientation=\"vertical\"\n value={[volumeValue]}\n min={0}\n max={100}\n defaultValue={[100]}\n step={1}\n onValueChange={handleVolumeSliderChange}\n >\n <SliderLabel srOnly>{t(\"audio.controls.adjustVolume\")}</SliderLabel>\n <StyledSliderControl>\n <SliderTrack>\n <SliderRange />\n </SliderTrack>\n <SliderThumb index={0}>\n <SliderHiddenInput />\n </SliderThumb>\n </StyledSliderControl>\n </SliderRoot>\n </StyledPopoverContent>\n </PopoverRoot>\n </ControlsWrapper>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAsCA,MAAM,uDAAyB,OAAO,EACpC,MAAM;CACJ,kBAAkB;CAClB,aAAa;CACb,oBAAoB;CACpB,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,YAAY;CACZ,KAAK;CACL,cAAc;CACd,eAAe;CACf,gBAAgB;EACd,SAAS;EACT,cAAc;EACd,eAAe;EACf,qBAAqB;EACrB,mBAAmB;;;;EAIpB;CACD,gBAAgB,EACd,WAAW,WACZ;CACF,EACF,CAAC;AAEF,MAAM,kDAAoBA,8BAAY,EACpC,MAAM,EACJ,UAAU,QACX,EACF,CAAC;AAEF,MAAM,0DAA4BA,8BAAY,EAC5C,MAAM,EACJ,UAAU,YACX,EACF,CAAC;AAEF,MAAM,uDAAyBA,8BAAY,EACzC,MAAM,EACJ,UAAU,aACX,EACF,CAAC;AAEF,MAAM,uDAAyB,OAAO,EACpC,MAAM;CACJ,MAAM;CACN,SAAS;CACT,YAAY;CACZ,KAAK;CACL,UAAU;CACV,cAAc;CACd,YAAY,EACV,eAAe,UAChB;CACF,EACF,CAAC;AAEF,MAAM,kDAAoBC,wBAAM,EAC9B,MAAM;CAC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R,OAAO,EAAE,6BAA6B;MACtC,cAAY,EAAE,6BAA6B;gBAE3C,2CAAC,oBAAM,GAAG,WAAW,KAAU;OACnB;MACA,GACF;IAChB,2CAACC,6CACE,YAAY,MAAM,KAAK,UACtB,4CAACC;KAAuB,MAAM;gBAC5B,4CAACC,+CAAgB,OAAM,OAAkB,EACzC,2CAACC,mDACC,2CAACC,2BAAY,GACO;OAJP,MAKJ,CACb,GACY;;IACC,GACT;EACZ,4CAACC;GAAY,aAAa,EAAE,WAAW,OAAO;cAC5C,2CAACC;IAAe;cACd,2CAAC;KAAa,SAAQ;KAAW,cAAY,EAAE,8BAA8B;eAC3E,2CAACC,8BAAe;MACH;KACA,EACjB,2CAAC,kCACC,4CAACjB;IACC,aAAY;IACZ,OAAO,CAAC,YAAY;IACpB,KAAK;IACL,KAAK;IACL,cAAc,CAAC,IAAI;IACnB,MAAM;IACN,eAAe;eAEf,2CAACC;KAAY;eAAQ,EAAE,8BAA8B;MAAe,EACpE,4CAAC,kCACC,2CAACC,2CACC,2CAACC,kCAAc,GACH,EACd,2CAACC;KAAY,OAAO;eAClB,2CAACC,wCAAoB;MACT,IACM;KACX,GACQ;IACX;KACE,IACd"}
|
|
1
|
+
{"version":3,"file":"Controls.js","names":["IconButton","Text","Button","SelectRoot","SliderControl","PopoverContent","currentTime","duration","Replay15Line","PauseLine","PlayFill","Forward15Line","SliderRoot","SliderLabel","SliderTrack","SliderRange","SliderThumb","SliderHiddenInput","FieldRoot","SelectLabel","SelectControl","SelectTrigger","SelectContent","SelectItem","SelectItemText","SelectItemIndicator","CheckLine","PopoverRoot","PopoverTrigger","VolumeUpFill"],"sources":["../../src/AudioPlayer/Controls.tsx"],"sourcesContent":["/**\n * Copyright (c) 2021-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { type SliderValueChangeDetails, createListCollection } from \"@ark-ui/react\";\nimport { Replay15Line, Forward15Line, PlayFill, PauseLine, VolumeUpFill, CheckLine } from \"@ndla/icons\";\nimport {\n Button,\n FieldRoot,\n IconButton,\n PopoverContent,\n PopoverRoot,\n PopoverTrigger,\n SelectContent,\n SelectControl,\n SelectItem,\n SelectItemIndicator,\n SelectItemText,\n SelectLabel,\n SelectRoot,\n SelectTrigger,\n SliderControl,\n SliderHiddenInput,\n SliderLabel,\n SliderRange,\n SliderRoot,\n SliderThumb,\n SliderTrack,\n Text,\n} from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst ControlsWrapper = styled(\"div\", {\n base: {\n borderBlockStart: \"1px solid\",\n borderColor: \"stroke.default\",\n borderBottomRadius: \"xsmall\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"background.default\",\n gap: \"xsmall\",\n paddingBlock: \"xsmall\",\n paddingInline: \"medium\",\n tabletWideDown: {\n display: \"grid\",\n paddingBlock: \"xsmall\",\n paddingInline: \"xsmall\",\n gridTemplateColumns: \"1fr repeat(5, auto) 1fr\",\n gridTemplateAreas: `\n \"track track track track track track track\"\n \". speed backwards play forwards volume .\"\n`,\n },\n mobileWideDown: {\n columnGap: \"3xsmall\",\n },\n },\n});\n\nconst PlayButton = styled(IconButton, {\n base: {\n gridArea: \"play\",\n },\n});\n\nconst Forward15SecButton = styled(IconButton, {\n base: {\n gridArea: \"forwards\",\n },\n});\n\nconst Back15SecButton = styled(IconButton, {\n base: {\n gridArea: \"backwards\",\n },\n});\n\nconst ProgressWrapper = styled(\"div\", {\n base: {\n flex: \"1\",\n display: \"flex\",\n alignItems: \"center\",\n gap: \"xxsmall\",\n gridArea: \"track\",\n paddingBlock: \"xsmall\",\n mobileDown: {\n paddingInline: \"xsmall\",\n },\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n minWidth: \"xxlarge\",\n flexShrink: \"0\",\n textAlign: \"center\",\n },\n});\n\nconst VolumeButton = styled(IconButton, {\n base: {\n gridArea: \"volume\",\n },\n});\n\nconst SpeedButton = styled(Button, {\n base: {\n paddingBlock: \"auto\",\n paddingInline: \"auto\",\n maxWidth: \"xxlarge\",\n maxHeight: \"xxlarge\",\n minWidth: \"xxlarge\",\n minHeight: \"xxlarge\",\n \"& span\": {\n flex: \"1\",\n },\n },\n});\n\nconst StyledSelectRoot = styled(SelectRoot<string>, {\n base: {\n gridArea: \"speed\",\n },\n});\n\nconst StyledSliderControl = styled(SliderControl, {\n base: {\n height: \"surface.3xsmall\",\n minWidth: \"small\",\n },\n});\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n paddingInline: \"small\",\n },\n});\n\nconst formatTime = (seconds: number) => {\n const minutes = Math.floor(seconds / 60);\n const currentSeconds = seconds % 60;\n\n const formattedSeconds = currentSeconds < 10 ? `0${currentSeconds}` : currentSeconds;\n return `${minutes}:${formattedSeconds}`;\n};\n\nconst speedValues = createListCollection({ items: [\"0.5\", \"0.75\", \"1\", \"1.25\", \"1.5\", \"1.75\", \"2\"] });\n\ninterface Props {\n src: string;\n title: string;\n}\n\nexport const Controls = ({ src, title }: Props) => {\n const { t } = useTranslation();\n const [speedValue, setSpeedValue] = useState(1);\n const [volumeValue, setVolumeValue] = useState(100);\n const [currentTime, setCurrentTime] = useState(0);\n const [duration, setDuration] = useState(0);\n const [playing, setPlaying] = useState(false);\n const audioRef = useRef<HTMLAudioElement>(null);\n\n useEffect(() => {\n if (audioRef.current) {\n const audioElement = audioRef.current;\n const handleTimeUpdate = () => {\n const { currentTime, duration } = audioElement;\n setCurrentTime(Math.round(currentTime));\n setDuration(Math.round(duration));\n };\n\n const handleLoadedMetaData = () => {\n const { currentTime, duration } = audioElement;\n setCurrentTime(Math.round(currentTime));\n setDuration(Math.round(duration));\n };\n\n const handleTimeEnded = () => {\n setPlaying(false);\n };\n\n audioElement.addEventListener(\"timeupdate\", handleTimeUpdate);\n audioElement.addEventListener(\"loadedmetadata\", handleLoadedMetaData);\n audioElement.addEventListener(\"ended\", handleTimeEnded);\n return () => {\n audioElement.removeEventListener(\"timeupdate\", handleTimeUpdate);\n audioElement.removeEventListener(\"loadedmetadata\", handleLoadedMetaData);\n audioElement.removeEventListener(\"ended\", handleTimeEnded);\n };\n }\n }, []);\n\n const togglePlay = () => {\n if (audioRef.current) {\n const audioElement = audioRef.current;\n if (!playing) {\n audioElement.play();\n } else {\n audioElement.pause();\n }\n setPlaying(!playing);\n }\n };\n\n const onPlaybackRateChange = (rate: number) => {\n setSpeedValue(rate);\n if (audioRef.current) {\n audioRef.current.playbackRate = rate;\n }\n };\n\n const onSeekSeconds = (seconds: number) => {\n if (audioRef.current) {\n audioRef.current.currentTime += seconds;\n }\n };\n\n const handleSliderChange = (details: SliderValueChangeDetails) => {\n const newValue = details.value[0];\n if (audioRef.current && newValue != null && !isNaN(newValue)) {\n audioRef.current.currentTime = details.value[0];\n }\n };\n\n const handleVolumeSliderChange = (details: SliderValueChangeDetails) => {\n if (audioRef.current) {\n audioRef.current.volume = details.value[0] / 100;\n setVolumeValue(details.value[0]);\n }\n };\n\n return (\n <div>\n {/* TODO: We should tie this up to the textual description somehow */}\n {/* eslint-disable-next-line jsx-a11y/media-has-caption */}\n <audio ref={audioRef} src={src} title={title} preload=\"metadata\" />\n <ControlsWrapper>\n <Back15SecButton\n variant=\"tertiary\"\n title={t(\"audio.controls.rewind15sec\")}\n aria-label={t(\"audio.controls.rewind15sec\")}\n onClick={() => onSeekSeconds(-15)}\n >\n <Replay15Line />\n </Back15SecButton>\n <PlayButton aria-label={t(playing ? t(\"audio.pause\") : t(\"audio.play\"))} variant=\"primary\" onClick={togglePlay}>\n {playing ? <PauseLine /> : <PlayFill />}\n </PlayButton>\n <Forward15SecButton\n variant=\"tertiary\"\n title={t(\"audio.controls.forward15sec\")}\n aria-label={t(\"audio.controls.forward15sec\")}\n onClick={() => onSeekSeconds(15)}\n >\n <Forward15Line />\n </Forward15SecButton>\n <ProgressWrapper>\n <StyledText textStyle=\"label.medium\" asChild consumeCss>\n <div>{formatTime(currentTime)}</div>\n </StyledText>\n <SliderRoot\n value={[currentTime]}\n defaultValue={[0]}\n step={1}\n max={duration}\n onValueChange={handleSliderChange}\n getAriaValueText={(value) =>\n t(\"audio.valueText\", {\n start: formatTime(Math.round(value.value)),\n end: formatTime(Math.round(duration)),\n })\n }\n >\n <SliderLabel srOnly>{t(\"audio.progressBar\")}</SliderLabel>\n <SliderControl>\n <SliderTrack>\n <SliderRange />\n </SliderTrack>\n <SliderThumb index={0}>\n <SliderHiddenInput />\n </SliderThumb>\n </SliderControl>\n </SliderRoot>\n <StyledText textStyle=\"label.medium\" asChild consumeCss>\n <div>-{formatTime(Math.round(duration - currentTime))}</div>\n </StyledText>\n </ProgressWrapper>\n <FieldRoot>\n <StyledSelectRoot\n collection={speedValues}\n value={[speedValue.toString()]}\n onValueChange={(details) => onPlaybackRateChange(parseFloat(details.value[0]))}\n positioning={{ placement: \"top\" }}\n >\n <SelectLabel srOnly>{t(\"audio.controls.selectSpeed\")}</SelectLabel>\n <SelectControl>\n <SelectTrigger asChild>\n <SpeedButton\n variant=\"tertiary\"\n title={t(\"audio.controls.selectSpeed\")}\n aria-label={t(\"audio.controls.selectSpeed\")}\n >\n <span>{`${speedValue}x`}</span>\n </SpeedButton>\n </SelectTrigger>\n </SelectControl>\n <SelectContent>\n {speedValues.items.map((speed) => (\n <SelectItem key={speed} item={speed}>\n <SelectItemText>{speed}x</SelectItemText>\n <SelectItemIndicator>\n <CheckLine />\n </SelectItemIndicator>\n </SelectItem>\n ))}\n </SelectContent>\n </StyledSelectRoot>\n </FieldRoot>\n <PopoverRoot positioning={{ placement: \"top\" }}>\n <PopoverTrigger asChild>\n <VolumeButton variant=\"tertiary\" aria-label={t(\"audio.controls.adjustVolume\")}>\n <VolumeUpFill />\n </VolumeButton>\n </PopoverTrigger>\n <StyledPopoverContent>\n <SliderRoot\n orientation=\"vertical\"\n value={[volumeValue]}\n min={0}\n max={100}\n defaultValue={[100]}\n step={1}\n onValueChange={handleVolumeSliderChange}\n >\n <SliderLabel srOnly>{t(\"audio.controls.adjustVolume\")}</SliderLabel>\n <StyledSliderControl>\n <SliderTrack>\n <SliderRange />\n </SliderTrack>\n <SliderThumb index={0}>\n <SliderHiddenInput />\n </SliderThumb>\n </StyledSliderControl>\n </SliderRoot>\n </StyledPopoverContent>\n </PopoverRoot>\n </ControlsWrapper>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAsCA,MAAM,uDAAyB,OAAO,EACpC,MAAM;CACJ,kBAAkB;CAClB,aAAa;CACb,oBAAoB;CACpB,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,YAAY;CACZ,KAAK;CACL,cAAc;CACd,eAAe;CACf,gBAAgB;EACd,SAAS;EACT,cAAc;EACd,eAAe;EACf,qBAAqB;EACrB,mBAAmB;;;;EAIpB;CACD,gBAAgB,EACd,WAAW,WACZ;CACF,EACF,CAAC;AAEF,MAAM,kDAAoBA,8BAAY,EACpC,MAAM,EACJ,UAAU,QACX,EACF,CAAC;AAEF,MAAM,0DAA4BA,8BAAY,EAC5C,MAAM,EACJ,UAAU,YACX,EACF,CAAC;AAEF,MAAM,uDAAyBA,8BAAY,EACzC,MAAM,EACJ,UAAU,aACX,EACF,CAAC;AAEF,MAAM,uDAAyB,OAAO,EACpC,MAAM;CACJ,MAAM;CACN,SAAS;CACT,YAAY;CACZ,KAAK;CACL,UAAU;CACV,cAAc;CACd,YAAY,EACV,eAAe,UAChB;CACF,EACF,CAAC;AAEF,MAAM,kDAAoBC,wBAAM,EAC9B,MAAM;CACJ,UAAU;CACV,YAAY;CACZ,WAAW;CACZ,EACF,CAAC;AAEF,MAAM,oDAAsBD,8BAAY,EACtC,MAAM,EACJ,UAAU,UACX,EACF,CAAC;AAEF,MAAM,mDAAqBE,0BAAQ,EACjC,MAAM;CACJ,cAAc;CACd,eAAe;CACf,UAAU;CACV,WAAW;CACX,UAAU;CACV,WAAW;CACX,UAAU,EACR,MAAM,KACP;CACF,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AE,WAAW,OAAO;cAC5C,2CAACC;IAAe;cACd,2CAAC;KAAa,SAAQ;KAAW,cAAY,EAAE,8BAA8B;eAC3E,2CAACC,8BAAe;MACH;KACA,EACjB,2CAAC,kCACC,4CAACjB;IACC,aAAY;IACZ,OAAO,CAAC,YAAY;IACpB,KAAK;IACL,KAAK;IACL,cAAc,CAAC,IAAI;IACnB,MAAM;IACN,eAAe;eAEf,2CAACC;KAAY;eAAQ,EAAE,8BAA8B;MAAe,EACpE,4CAAC,kCACC,2CAACC,2CACC,2CAACC,kCAAc,GACH,EACd,2CAACC;KAAY,OAAO;eAClB,2CAACC,wCAAoB;MACT,IACM;KACX,GACQ;IACX;KACE,IACd"}
|
|
@@ -13,7 +13,7 @@ let __ndla_styled_system_css = require("@ndla/styled-system/css");
|
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
15
|
const Pre = (0, __ndla_styled_system_jsx.styled)("pre", {});
|
|
16
|
-
const CodeBlock = (0, react.forwardRef)(({ highlightedCode, format, className
|
|
16
|
+
const CodeBlock = (0, react.forwardRef)(({ highlightedCode, format, className, ...props }, ref) => {
|
|
17
17
|
const codeWithLineNumbers = (0, react.useMemo)(() => {
|
|
18
18
|
return highlightedCode.split("\n").map((line, i) => {
|
|
19
19
|
return `<span class="linenumber">${i + 1}</span>${line}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.js","names":[],"sources":["../../src/CodeBlock/CodeBlock.tsx"],"sourcesContent":["/**\n * Copyright (c) 2020-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentPropsWithRef, forwardRef, useMemo } from \"react\";\nimport { cx } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\n\ninterface Props extends StyledProps, ComponentPropsWithRef<\"pre\"> {\n highlightedCode: string;\n format: string;\n}\n\nconst Pre = styled(\"pre\", {});\n\nexport const CodeBlock = forwardRef<HTMLPreElement, Props>(({ highlightedCode, format, className, ...props }, ref) => {\n const codeWithLineNumbers = useMemo(() => {\n return highlightedCode\n .split(\"\\n\")\n .map((line, i) => {\n return `<span class=\"linenumber\">${i + 1}</span>${line}`;\n })\n .join(\"\\n\");\n }, [highlightedCode]);\n\n return (\n <Pre\n className={cx(\"codeblock\", `language-${format}`, className)}\n {...props}\n dangerouslySetInnerHTML={{ __html: codeWithLineNumbers }}\n ref={ref}\n />\n );\n});\n"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,2CAAa,OAAO,EAAE,CAAC;AAE7B,MAAa,mCAA+C,EAAE,iBAAiB,QAAQ,
|
|
1
|
+
{"version":3,"file":"CodeBlock.js","names":[],"sources":["../../src/CodeBlock/CodeBlock.tsx"],"sourcesContent":["/**\n * Copyright (c) 2020-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentPropsWithRef, forwardRef, useMemo } from \"react\";\nimport { cx } from \"@ndla/styled-system/css\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { StyledProps } from \"@ndla/styled-system/types\";\n\ninterface Props extends StyledProps, ComponentPropsWithRef<\"pre\"> {\n highlightedCode: string;\n format: string;\n}\n\nconst Pre = styled(\"pre\", {});\n\nexport const CodeBlock = forwardRef<HTMLPreElement, Props>(({ highlightedCode, format, className, ...props }, ref) => {\n const codeWithLineNumbers = useMemo(() => {\n return highlightedCode\n .split(\"\\n\")\n .map((line, i) => {\n return `<span class=\"linenumber\">${i + 1}</span>${line}`;\n })\n .join(\"\\n\");\n }, [highlightedCode]);\n\n return (\n <Pre\n className={cx(\"codeblock\", `language-${format}`, className)}\n {...props}\n dangerouslySetInnerHTML={{ __html: codeWithLineNumbers }}\n ref={ref}\n />\n );\n});\n"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAM,2CAAa,OAAO,EAAE,CAAC;AAE7B,MAAa,mCAA+C,EAAE,iBAAiB,QAAQ,WAAW,GAAG,SAAS,QAAQ;CACpH,MAAM,+CAAoC;AACxC,SAAO,gBACJ,MAAM,KAAK,CACX,KAAK,MAAM,MAAM;AAChB,UAAO,4BAA4B,IAAI,EAAE,SAAS;IAClD,CACD,KAAK,KAAK;IACZ,CAAC,gBAAgB,CAAC;AAErB,QACE,2CAAC;EACC,4CAAc,aAAa,YAAY,UAAU,UAAU;EAC3D,GAAI;EACJ,yBAAyB,EAAE,QAAQ,qBAAqB;EACnD;GACL;EAEJ"}
|
package/lib/Concept/Concept.js
CHANGED
|
@@ -29,7 +29,7 @@ const ContentWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
|
29
29
|
display: "inline",
|
|
30
30
|
"& p": { display: "inline" }
|
|
31
31
|
} });
|
|
32
|
-
const Concept = (0, react.forwardRef)(({ copyright, visualElement, lang, children, title, source, previewAlt
|
|
32
|
+
const Concept = (0, react.forwardRef)(({ copyright, visualElement, lang, children, title, source, previewAlt, ...rest }, ref) => {
|
|
33
33
|
const licenseProps = require_licenseAttributes.licenseAttributes(copyright?.license?.license, lang, source);
|
|
34
34
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledFigure, {
|
|
35
35
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Concept.js","names":["Figure","licenseAttributes","ImageEmbed","BrightcoveEmbed","H5pEmbed","IframeEmbed","ExternalEmbed","EmbedByline"],"sources":["../../src/Concept/Concept.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { DraftCopyrightDTO as ConceptCopyright } from \"@ndla/types-backend/concept-api\";\nimport type { ConceptVisualElementMeta } from \"@ndla/types-embed\";\nimport { BrightcoveEmbed } from \"../Embed/BrightcoveEmbed\";\nimport { ExternalEmbed } from \"../Embed/ExternalEmbed\";\nimport { H5pEmbed } from \"../Embed/H5pEmbed\";\nimport { IframeEmbed } from \"../Embed/IframeEmbed\";\nimport { ImageEmbed } from \"../Embed/ImageEmbed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nexport interface ConceptProps extends Omit<ComponentPropsWithRef<\"figure\">, \"title\"> {\n copyright?: ConceptCopyright;\n visualElement?: ConceptVisualElementMeta;\n lang?: string;\n title?: ReactNode;\n children?: ReactNode;\n source?: string;\n previewAlt?: boolean;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n textStyle: \"body.large\",\n display: \"inline\",\n \"& p\": {\n display: \"inline\",\n },\n },\n});\n\nexport const Concept = forwardRef<HTMLElement, ConceptProps>(\n ({ copyright, visualElement, lang, children, title, source, previewAlt, ...rest }, ref) => {\n const licenseProps = licenseAttributes(copyright?.license?.license, lang, source);\n\n return (\n <StyledFigure ref={ref} {...rest} {...licenseProps}>\n <ContentWrapper lang={lang}>\n {!!title && (\n <>\n <b>{title}</b>\n {` – `}\n </>\n )}\n {children}\n </ContentWrapper>\n {visualElement?.resource === \"image\" ? (\n <ImageEmbed embed={visualElement} lang={lang} previewAlt={previewAlt} />\n ) : visualElement?.resource === \"brightcove\" ? (\n <BrightcoveEmbed embed={visualElement} />\n ) : visualElement?.resource === \"h5p\" ? (\n <H5pEmbed embed={visualElement} />\n ) : visualElement?.resource === \"iframe\" ? (\n <IframeEmbed embed={visualElement} />\n ) : visualElement?.resource === \"external\" ? (\n <ExternalEmbed embed={visualElement} />\n ) : null}\n {!!copyright && <EmbedByline copyright={copyright} type=\"concept\" />}\n </StyledFigure>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACN,EACF,CAAC;AAEF,MAAM,sDAAwB,OAAO,EACnC,MAAM;CACJ,WAAW;CACX,SAAS;CACT,OAAO,EACL,SAAS,UACV;CACF,EACF,CAAC;AAEF,MAAa,iCACV,EAAE,WAAW,eAAe,MAAM,UAAU,OAAO,QAAQ,
|
|
1
|
+
{"version":3,"file":"Concept.js","names":["Figure","licenseAttributes","ImageEmbed","BrightcoveEmbed","H5pEmbed","IframeEmbed","ExternalEmbed","EmbedByline"],"sources":["../../src/Concept/Concept.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentPropsWithRef, type ReactNode, forwardRef } from \"react\";\nimport { Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { DraftCopyrightDTO as ConceptCopyright } from \"@ndla/types-backend/concept-api\";\nimport type { ConceptVisualElementMeta } from \"@ndla/types-embed\";\nimport { BrightcoveEmbed } from \"../Embed/BrightcoveEmbed\";\nimport { ExternalEmbed } from \"../Embed/ExternalEmbed\";\nimport { H5pEmbed } from \"../Embed/H5pEmbed\";\nimport { IframeEmbed } from \"../Embed/IframeEmbed\";\nimport { ImageEmbed } from \"../Embed/ImageEmbed\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\nexport interface ConceptProps extends Omit<ComponentPropsWithRef<\"figure\">, \"title\"> {\n copyright?: ConceptCopyright;\n visualElement?: ConceptVisualElementMeta;\n lang?: string;\n title?: ReactNode;\n children?: ReactNode;\n source?: string;\n previewAlt?: boolean;\n}\n\nconst StyledFigure = styled(Figure, {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"medium\",\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n textStyle: \"body.large\",\n display: \"inline\",\n \"& p\": {\n display: \"inline\",\n },\n },\n});\n\nexport const Concept = forwardRef<HTMLElement, ConceptProps>(\n ({ copyright, visualElement, lang, children, title, source, previewAlt, ...rest }, ref) => {\n const licenseProps = licenseAttributes(copyright?.license?.license, lang, source);\n\n return (\n <StyledFigure ref={ref} {...rest} {...licenseProps}>\n <ContentWrapper lang={lang}>\n {!!title && (\n <>\n <b>{title}</b>\n {` – `}\n </>\n )}\n {children}\n </ContentWrapper>\n {visualElement?.resource === \"image\" ? (\n <ImageEmbed embed={visualElement} lang={lang} previewAlt={previewAlt} />\n ) : visualElement?.resource === \"brightcove\" ? (\n <BrightcoveEmbed embed={visualElement} />\n ) : visualElement?.resource === \"h5p\" ? (\n <H5pEmbed embed={visualElement} />\n ) : visualElement?.resource === \"iframe\" ? (\n <IframeEmbed embed={visualElement} />\n ) : visualElement?.resource === \"external\" ? (\n <ExternalEmbed embed={visualElement} />\n ) : null}\n {!!copyright && <EmbedByline copyright={copyright} type=\"concept\" />}\n </StyledFigure>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,oDAAsBA,0BAAQ,EAClC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACN,EACF,CAAC;AAEF,MAAM,sDAAwB,OAAO,EACnC,MAAM;CACJ,WAAW;CACX,SAAS;CACT,OAAO,EACL,SAAS,UACV;CACF,EACF,CAAC;AAEF,MAAa,iCACV,EAAE,WAAW,eAAe,MAAM,UAAU,OAAO,QAAQ,YAAY,GAAG,QAAQ,QAAQ;CACzF,MAAM,eAAeC,4CAAkB,WAAW,SAAS,SAAS,MAAM,OAAO;AAEjF,QACE,4CAAC;EAAkB;EAAK,GAAI;EAAM,GAAI;;GACpC,4CAAC;IAAqB;eACnB,CAAC,CAAC,SACD,qFACE,2CAAC,iBAAG,QAAU,EACb,SACA,EAEJ;KACc;GAChB,eAAe,aAAa,UAC3B,2CAACC;IAAW,OAAO;IAAqB;IAAkB;KAAc,GACtE,eAAe,aAAa,eAC9B,2CAACC,2CAAgB,OAAO,gBAAiB,GACvC,eAAe,aAAa,QAC9B,2CAACC,6BAAS,OAAO,gBAAiB,GAChC,eAAe,aAAa,WAC9B,2CAACC,mCAAY,OAAO,gBAAiB,GACnC,eAAe,aAAa,aAC9B,2CAACC,uCAAc,OAAO,gBAAiB,GACrC;GACH,CAAC,CAAC,aAAa,2CAACC;IAAuB;IAAW,MAAK;KAAY;;GACvD;EAGpB"}
|
|
@@ -34,7 +34,7 @@ const contentTypeToBadgeVariantMap = {
|
|
|
34
34
|
[require_ContentType.PROGRAMME]: "neutral",
|
|
35
35
|
[require_ContentType.FRONTPAGE_ARTICLE]: "brand2"
|
|
36
36
|
};
|
|
37
|
-
const ContentTypeBadge = (0, react.forwardRef)(({ contentType, children
|
|
37
|
+
const ContentTypeBadge = (0, react.forwardRef)(({ contentType, children, ...props }, ref) => {
|
|
38
38
|
const { t } = (0, react_i18next.useTranslation)();
|
|
39
39
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Badge, {
|
|
40
40
|
colorTheme: contentTypeToBadgeVariantMap[contentType ?? "missing"] ?? contentTypeToBadgeVariantMap["missing"],
|
|
@@ -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;yCAC5C;6CACI;6CACA;gCACb;wCACQ;sCACF;8BACR;0CACY;gCACV;iCACC;8BACH;8BACA;gCACE;8BACF;gCACE;uCACO;8BACT;kCACI;0CACQ;CACnC;AAED,MAAa,0CACV,EAAE,aAAa,
|
|
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;yCAC5C;6CACI;6CACA;gCACb;wCACQ;sCACF;8BACR;0CACY;gCACV;iCACC;8BACH;8BACA;gCACE;8BACF;gCACE;uCACO;8BACT;kCACI;0CACQ;CACnC;AAED,MAAa,0CACV,EAAE,aAAa,UAAU,GAAG,SAAS,QAAQ;CAC5C,MAAM,EAAE,yCAAsB;AAC9B,QACE,2CAACC;EACC,YAAY,6BAA6B,eAAe,cAAc,6BAA6B;EACnG,GAAI;EACC;YAEJ,YAAY,EAAE,gBAAgB,cAAc;GACvC;EAGb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrightcoveEmbed.js","names":["Button","EmbedErrorPlaceholder","licenseAttributes","Figure","EmbedByline"],"sources":["../../src/Embed/BrightcoveEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport parse from \"html-react-parser\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Button, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { BrightcoveEmbedData, BrightcoveMetaData, BrightcoveVideoSource } from \"@ndla/types-embed\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport type { RenderContext } from \"./types\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\ninterface Props {\n embed: BrightcoveMetaData;\n renderContext?: RenderContext;\n lang?: string;\n}\n\nconst LinkedVideoButton = styled(Button, {\n base: {\n marginBlockStart: \"3xsmall\",\n },\n});\n\nconst BrightcoveIframe = styled(\"iframe\", {\n base: {\n border: 0,\n height: \"auto\",\n width: \"100%\",\n },\n});\n\nexport const makeIframeString = (url: string, width: string | number, height: string | number, title = \"\") => {\n const strippedWidth = typeof width === \"number\" ? width : width.replace(/\\s*px/, \"\");\n const strippedHeight = typeof height === \"number\" ? height : height.replace(/\\s*px/, \"\");\n const urlOrTitle = title || url;\n return `<iframe title=\"${urlOrTitle}\" aria-label=\"${urlOrTitle}\" src=\"${url}\" width=\"${strippedWidth}\" height=\"${strippedHeight}\" allowfullscreen scrolling=\"no\"
|
|
1
|
+
{"version":3,"file":"BrightcoveEmbed.js","names":["Button","EmbedErrorPlaceholder","licenseAttributes","Figure","EmbedByline"],"sources":["../../src/Embed/BrightcoveEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport parse from \"html-react-parser\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Button, Figure } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { BrightcoveEmbedData, BrightcoveMetaData, BrightcoveVideoSource } from \"@ndla/types-embed\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport type { RenderContext } from \"./types\";\nimport { EmbedByline } from \"../LicenseByline/EmbedByline\";\nimport { licenseAttributes } from \"../utils/licenseAttributes\";\n\ninterface Props {\n embed: BrightcoveMetaData;\n renderContext?: RenderContext;\n lang?: string;\n}\n\nconst LinkedVideoButton = styled(Button, {\n base: {\n marginBlockStart: \"3xsmall\",\n },\n});\n\nconst BrightcoveIframe = styled(\"iframe\", {\n base: {\n border: 0,\n height: \"auto\",\n width: \"100%\",\n },\n});\n\nexport const makeIframeString = (url: string, width: string | number, height: string | number, title = \"\") => {\n const strippedWidth = typeof width === \"number\" ? width : width.replace(/\\s*px/, \"\");\n const strippedHeight = typeof height === \"number\" ? height : height.replace(/\\s*px/, \"\");\n const urlOrTitle = title || url;\n return `<iframe title=\"${urlOrTitle}\" aria-label=\"${urlOrTitle}\" src=\"${url}\" width=\"${strippedWidth}\" height=\"${strippedHeight}\" allowfullscreen scrolling=\"no\" style=\"border: none;\" loading=\"lazy\"></iframe>`;\n};\n\nexport const isNumeric = (value: any) => !Number.isNaN(value - Number.parseFloat(value));\n\nconst getIframeProps = (data: BrightcoveEmbedData, sources: BrightcoveVideoSource[]) => {\n const { account, videoid, player = \"default\" } = data;\n\n const source = sources.filter((s) => s.width && s.height).toSorted((a, b) => a!.height! - b.height!)[0];\n\n return {\n src: `https://players.brightcove.net/${account}/${player}_default/index.html?videoId=${videoid}`,\n height: source?.height ?? \"480\",\n width: source?.width ?? \"640\",\n };\n};\nexport const BrightcoveEmbed = ({ embed, renderContext = \"article\", lang }: Props) => {\n const [showOriginalVideo, setShowOriginalVideo] = useState(true);\n const { t } = useTranslation();\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const { embedData } = embed;\n const fallbackTitle = `${t(\"embed.type.video\")}: ${embedData.videoid}`;\n const parsedDescription = useMemo(() => {\n if (embed.embedData.caption || renderContext === \"article\") {\n return embed.embedData.caption ? parse(embed.embedData.caption) : undefined;\n } else if (embed.status === \"success\" && embed.data.description) {\n return parse(embed.data.description);\n }\n }, [embed, renderContext]);\n\n useEffect(() => {\n const iframe = iframeRef.current;\n if (iframe) {\n const [width, height] = [parseInt(iframe.width), parseInt(iframe.height)];\n iframe.style.aspectRatio = `${width}/${height}`;\n iframe.width = \"\";\n iframe.height = \"\";\n }\n }, []);\n if (embed.status === \"error\") {\n return (\n <EmbedErrorPlaceholder type=\"video\">\n <BrightcoveIframe\n ref={iframeRef}\n title={embedData.alt || fallbackTitle}\n aria-label={embedData.alt || fallbackTitle}\n {...getIframeProps(embedData, [])}\n allow=\"fullscreen; encrypted-media\"\n />\n </EmbedErrorPlaceholder>\n );\n }\n const { data } = embed;\n\n const linkedVideoId = isNumeric(data.link?.text) ? data.link?.text : undefined;\n\n const originalVideoProps = getIframeProps(embedData, data.sources);\n const alternativeVideoProps = linkedVideoId\n ? getIframeProps({ ...embedData, videoid: linkedVideoId }, data.sources)\n : undefined;\n\n const licenseProps = licenseAttributes(data?.copyright?.license.license, lang, embedData.pageUrl);\n\n const title = data.name?.trim() ? `${t(\"embed.type.video\")}: ${data.name}` : fallbackTitle;\n\n return (\n <Figure data-embed-type=\"brightcove\" {...licenseProps}>\n <div className=\"brightcove-video\">\n <BrightcoveIframe\n ref={iframeRef}\n className=\"original\"\n title={title}\n aria-label={title}\n {...(alternativeVideoProps && !showOriginalVideo ? alternativeVideoProps : originalVideoProps)}\n allow=\"fullscreen; encrypted-media\"\n />\n </div>\n <EmbedByline type=\"video\" copyright={data.copyright!} description={parsedDescription}>\n <div>\n {!!linkedVideoId && (\n <LinkedVideoButton size=\"small\" variant=\"secondary\" onClick={() => setShowOriginalVideo((p) => !p)}>\n {t(`figure.button.${!showOriginalVideo ? \"original\" : \"alternative\"}`)}\n </LinkedVideoButton>\n )}\n </div>\n </EmbedByline>\n </Figure>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,yDAA2BA,0BAAQ,EACvC,MAAM,EACJ,kBAAkB,WACnB,EACF,CAAC;AAEF,MAAM,wDAA0B,UAAU,EACxC,MAAM;CACJ,QAAQ;CACR,QAAQ;CACR,OAAO;CACR,EACF,CAAC;AASF,MAAa,aAAa,UAAe,CAAC,OAAO,MAAM,QAAQ,OAAO,WAAW,MAAM,CAAC;AAExF,MAAM,kBAAkB,MAA2B,YAAqC;CACtF,MAAM,EAAE,SAAS,SAAS,SAAS,cAAc;CAEjD,MAAM,SAAS,QAAQ,QAAQ,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,UAAU,GAAG,MAAM,EAAG,SAAU,EAAE,OAAQ,CAAC;AAErG,QAAO;EACL,KAAK,kCAAkC,QAAQ,GAAG,OAAO,8BAA8B;EACvF,QAAQ,QAAQ,UAAU;EAC1B,OAAO,QAAQ,SAAS;EACzB;;AAEH,MAAa,mBAAmB,EAAE,OAAO,gBAAgB,WAAW,WAAkB;CACpF,MAAM,CAAC,mBAAmB,4CAAiC,KAAK;CAChE,MAAM,EAAE,yCAAsB;CAC9B,MAAM,8BAAsC,KAAK;CACjD,MAAM,EAAE,cA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BAAyB,CAAC,oBAAoB,wBAAwB;IAC3E,OAAM;KACN;IACE,EACN,2CAACC;GAAY,MAAK;GAAQ,WAAW,KAAK;GAAY,aAAa;aACjE,2CAAC,mBACE,CAAC,CAAC,iBACD,2CAAC;IAAkB,MAAK;IAAQ,SAAQ;IAAY,eAAe,sBAAsB,MAAM,CAAC,EAAE;cAC/F,EAAE,iBAAiB,CAAC,oBAAoB,aAAa,gBAAgB;KACpD,GAElB;IACM;GACP"}
|
|
@@ -54,7 +54,7 @@ const ConceptEmbed = ({ embed, renderContext, lang, previewAlt, children }) => {
|
|
|
54
54
|
children: parsedContent
|
|
55
55
|
});
|
|
56
56
|
};
|
|
57
|
-
const InlineConcept = (0, react.forwardRef)(({ linkContent, copyright, visualElement, previewAlt, lang, children, title, source
|
|
57
|
+
const InlineConcept = (0, react.forwardRef)(({ linkContent, copyright, visualElement, previewAlt, lang, children, title, source, ...rest }, ref) => {
|
|
58
58
|
const contentRef = (0, react.useRef)(null);
|
|
59
59
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__ndla_primitives.PopoverRoot, {
|
|
60
60
|
initialFocusEl: () => contentRef.current,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConceptEmbed.js","names":["PopoverContent","EmbedErrorPlaceholder","GlossEmbed","PopoverRoot","PopoverTrigger","ConceptInlineTriggerButton","Portal","Concept"],"sources":["../../src/Embed/ConceptEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport parse from \"html-react-parser\";\nimport { forwardRef, useMemo, useRef, type ReactNode } from \"react\";\nimport { Portal } from \"@ark-ui/react\";\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { ConceptMetaData } from \"@ndla/types-embed\";\nimport { ConceptInlineTriggerButton } from \"./ConceptInlineTriggerButton\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport { GlossEmbed } from \"./GlossEmbed\";\nimport type { RenderContext } from \"./types\";\nimport { Concept, type ConceptProps } from \"../Concept/Concept\";\n\ninterface BaseProps {\n renderContext?: RenderContext;\n lang?: string;\n previewAlt?: boolean;\n}\n\ninterface Props extends BaseProps {\n embed: ConceptMetaData;\n children?: ReactNode;\n}\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n width: \"surface.xlarge\",\n maxHeight: \"50vh\",\n overflowY: \"auto\",\n },\n});\n\nexport const ConceptEmbed = ({ embed, renderContext, lang, previewAlt, children }: Props) => {\n const parsedContent = useMemo(() => {\n if (embed.status === \"error\" || !embed.data.concept.content) return undefined;\n return parse(embed.data.concept.content.htmlContent);\n }, [embed]);\n\n const parsedTitle = useMemo(\n () => (embed.status === \"success\" ? parse(embed.data.concept.title.htmlTitle) : undefined),\n [embed],\n );\n\n if (embed.status === \"error\" && embed.embedData.type === \"inline\") {\n return <span>{children}</span>;\n }\n if (embed.status === \"error\") {\n // TODO: This could be either concept or gloss. We don't know if it errors out. :)\n return <EmbedErrorPlaceholder type=\"gloss\" />;\n }\n\n const { concept, visualElement } = embed.data;\n\n // TODO: Consider whether we should do this in article-converter instead.\n if (embed.data.concept.glossData) {\n return <GlossEmbed embed={embed} />;\n }\n\n if (embed.embedData.type === \"inline\") {\n return (\n <InlineConcept\n previewAlt={previewAlt}\n linkContent={children}\n copyright={concept.copyright}\n visualElement={visualElement}\n lang={lang}\n title={parsedTitle}\n source={concept.source}\n >\n {parsedContent}\n </InlineConcept>\n );\n }\n\n return (\n <BlockConcept\n previewAlt={previewAlt}\n copyright={concept.copyright}\n visualElement={visualElement}\n lang={lang}\n title={renderContext === \"embed\" ? undefined : parsedTitle}\n source={concept.source}\n >\n {parsedContent}\n </BlockConcept>\n );\n};\n\nexport interface InlineConceptProps extends ConceptProps, BaseProps {\n linkContent?: ReactNode;\n source?: string;\n}\n\nexport const InlineConcept = forwardRef<HTMLSpanElement, InlineConceptProps>(\n ({ linkContent, copyright, visualElement, previewAlt, lang, children, title, source, ...rest }, ref) => {\n const contentRef = useRef<HTMLDivElement>(null);\n return (\n <PopoverRoot initialFocusEl={() => contentRef.current}>\n {/* @ts-expect-error placing ref and rest on popover trigger somehow removes a bug where the popover target becomes a bit bigger */}\n <PopoverTrigger asChild ref={ref} {...rest}>\n <ConceptInlineTriggerButton>{linkContent}</ConceptInlineTriggerButton>\n </PopoverTrigger>\n <Portal>\n <StyledPopoverContent ref={contentRef}>\n <Concept\n copyright={copyright}\n visualElement={visualElement}\n title={title}\n lang={lang}\n source={source}\n previewAlt={previewAlt}\n >\n {children}\n </Concept>\n </StyledPopoverContent>\n </Portal>\n </PopoverRoot>\n );\n },\n);\n\nexport interface BlockConceptProps extends ConceptProps {}\n\nexport const BlockConcept = forwardRef<HTMLElement, BlockConceptProps>((props, ref) => (\n <Concept {...props} data-embed-type=\"concept\" ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,4DAA8BA,kCAAgB,EAClD,MAAM;CACJ,OAAO;CACP,WAAW;CACX,WAAW;CACZ,EACF,CAAC;AAEF,MAAa,gBAAgB,EAAE,OAAO,eAAe,MAAM,YAAY,eAAsB;CAC3F,MAAM,yCAA8B;AAClC,MAAI,MAAM,WAAW,WAAW,CAAC,MAAM,KAAK,QAAQ,QAAS,QAAO;AACpE,wCAAa,MAAM,KAAK,QAAQ,QAAQ,YAAY;IACnD,CAAC,MAAM,CAAC;CAEX,MAAM,uCACG,MAAM,WAAW,2CAAkB,MAAM,KAAK,QAAQ,MAAM,UAAU,GAAG,QAChF,CAAC,MAAM,CACR;AAED,KAAI,MAAM,WAAW,WAAW,MAAM,UAAU,SAAS,SACvD,QAAO,2CAAC,UAAM,WAAgB;AAEhC,KAAI,MAAM,WAAW,QAEnB,QAAO,2CAACC,uDAAsB,MAAK,UAAU;CAG/C,MAAM,EAAE,SAAS,kBAAkB,MAAM;AAGzC,KAAI,MAAM,KAAK,QAAQ,UACrB,QAAO,2CAACC,iCAAkB,QAAS;AAGrC,KAAI,MAAM,UAAU,SAAS,SAC3B,QACE,2CAAC;EACa;EACZ,aAAa;EACb,WAAW,QAAQ;EACJ;EACT;EACN,OAAO;EACP,QAAQ,QAAQ;YAEf;GACa;AAIpB,QACE,2CAAC;EACa;EACZ,WAAW,QAAQ;EACJ;EACT;EACN,OAAO,kBAAkB,UAAU,SAAY;EAC/C,QAAQ,QAAQ;YAEf;GACY;;AASnB,MAAa,uCACV,EAAE,aAAa,WAAW,eAAe,YAAY,MAAM,UAAU,OAAO,
|
|
1
|
+
{"version":3,"file":"ConceptEmbed.js","names":["PopoverContent","EmbedErrorPlaceholder","GlossEmbed","PopoverRoot","PopoverTrigger","ConceptInlineTriggerButton","Portal","Concept"],"sources":["../../src/Embed/ConceptEmbed.tsx"],"sourcesContent":["/**\n * Copyright (c) 2024-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport parse from \"html-react-parser\";\nimport { forwardRef, useMemo, useRef, type ReactNode } from \"react\";\nimport { Portal } from \"@ark-ui/react\";\nimport { PopoverContent, PopoverRoot, PopoverTrigger } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport type { ConceptMetaData } from \"@ndla/types-embed\";\nimport { ConceptInlineTriggerButton } from \"./ConceptInlineTriggerButton\";\nimport { EmbedErrorPlaceholder } from \"./EmbedErrorPlaceholder\";\nimport { GlossEmbed } from \"./GlossEmbed\";\nimport type { RenderContext } from \"./types\";\nimport { Concept, type ConceptProps } from \"../Concept/Concept\";\n\ninterface BaseProps {\n renderContext?: RenderContext;\n lang?: string;\n previewAlt?: boolean;\n}\n\ninterface Props extends BaseProps {\n embed: ConceptMetaData;\n children?: ReactNode;\n}\n\nconst StyledPopoverContent = styled(PopoverContent, {\n base: {\n width: \"surface.xlarge\",\n maxHeight: \"50vh\",\n overflowY: \"auto\",\n },\n});\n\nexport const ConceptEmbed = ({ embed, renderContext, lang, previewAlt, children }: Props) => {\n const parsedContent = useMemo(() => {\n if (embed.status === \"error\" || !embed.data.concept.content) return undefined;\n return parse(embed.data.concept.content.htmlContent);\n }, [embed]);\n\n const parsedTitle = useMemo(\n () => (embed.status === \"success\" ? parse(embed.data.concept.title.htmlTitle) : undefined),\n [embed],\n );\n\n if (embed.status === \"error\" && embed.embedData.type === \"inline\") {\n return <span>{children}</span>;\n }\n if (embed.status === \"error\") {\n // TODO: This could be either concept or gloss. We don't know if it errors out. :)\n return <EmbedErrorPlaceholder type=\"gloss\" />;\n }\n\n const { concept, visualElement } = embed.data;\n\n // TODO: Consider whether we should do this in article-converter instead.\n if (embed.data.concept.glossData) {\n return <GlossEmbed embed={embed} />;\n }\n\n if (embed.embedData.type === \"inline\") {\n return (\n <InlineConcept\n previewAlt={previewAlt}\n linkContent={children}\n copyright={concept.copyright}\n visualElement={visualElement}\n lang={lang}\n title={parsedTitle}\n source={concept.source}\n >\n {parsedContent}\n </InlineConcept>\n );\n }\n\n return (\n <BlockConcept\n previewAlt={previewAlt}\n copyright={concept.copyright}\n visualElement={visualElement}\n lang={lang}\n title={renderContext === \"embed\" ? undefined : parsedTitle}\n source={concept.source}\n >\n {parsedContent}\n </BlockConcept>\n );\n};\n\nexport interface InlineConceptProps extends ConceptProps, BaseProps {\n linkContent?: ReactNode;\n source?: string;\n}\n\nexport const InlineConcept = forwardRef<HTMLSpanElement, InlineConceptProps>(\n ({ linkContent, copyright, visualElement, previewAlt, lang, children, title, source, ...rest }, ref) => {\n const contentRef = useRef<HTMLDivElement>(null);\n return (\n <PopoverRoot initialFocusEl={() => contentRef.current}>\n {/* @ts-expect-error placing ref and rest on popover trigger somehow removes a bug where the popover target becomes a bit bigger */}\n <PopoverTrigger asChild ref={ref} {...rest}>\n <ConceptInlineTriggerButton>{linkContent}</ConceptInlineTriggerButton>\n </PopoverTrigger>\n <Portal>\n <StyledPopoverContent ref={contentRef}>\n <Concept\n copyright={copyright}\n visualElement={visualElement}\n title={title}\n lang={lang}\n source={source}\n previewAlt={previewAlt}\n >\n {children}\n </Concept>\n </StyledPopoverContent>\n </Portal>\n </PopoverRoot>\n );\n },\n);\n\nexport interface BlockConceptProps extends ConceptProps {}\n\nexport const BlockConcept = forwardRef<HTMLElement, BlockConceptProps>((props, ref) => (\n <Concept {...props} data-embed-type=\"concept\" ref={ref} />\n));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,4DAA8BA,kCAAgB,EAClD,MAAM;CACJ,OAAO;CACP,WAAW;CACX,WAAW;CACZ,EACF,CAAC;AAEF,MAAa,gBAAgB,EAAE,OAAO,eAAe,MAAM,YAAY,eAAsB;CAC3F,MAAM,yCAA8B;AAClC,MAAI,MAAM,WAAW,WAAW,CAAC,MAAM,KAAK,QAAQ,QAAS,QAAO;AACpE,wCAAa,MAAM,KAAK,QAAQ,QAAQ,YAAY;IACnD,CAAC,MAAM,CAAC;CAEX,MAAM,uCACG,MAAM,WAAW,2CAAkB,MAAM,KAAK,QAAQ,MAAM,UAAU,GAAG,QAChF,CAAC,MAAM,CACR;AAED,KAAI,MAAM,WAAW,WAAW,MAAM,UAAU,SAAS,SACvD,QAAO,2CAAC,UAAM,WAAgB;AAEhC,KAAI,MAAM,WAAW,QAEnB,QAAO,2CAACC,uDAAsB,MAAK,UAAU;CAG/C,MAAM,EAAE,SAAS,kBAAkB,MAAM;AAGzC,KAAI,MAAM,KAAK,QAAQ,UACrB,QAAO,2CAACC,iCAAkB,QAAS;AAGrC,KAAI,MAAM,UAAU,SAAS,SAC3B,QACE,2CAAC;EACa;EACZ,aAAa;EACb,WAAW,QAAQ;EACJ;EACT;EACN,OAAO;EACP,QAAQ,QAAQ;YAEf;GACa;AAIpB,QACE,2CAAC;EACa;EACZ,WAAW,QAAQ;EACJ;EACT;EACN,OAAO,kBAAkB,UAAU,SAAY;EAC/C,QAAQ,QAAQ;YAE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