@ndla/ui 56.0.123-alpha.0 → 56.0.124-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Article/Article.js +122 -194
- package/es/Article/Article.js.map +1 -0
- package/es/Article/ArticleByline.js +121 -170
- package/es/Article/ArticleByline.js.map +1 -0
- package/es/Article/ArticleFootNotes.js +38 -58
- package/es/Article/ArticleFootNotes.js.map +1 -0
- package/es/AudioPlayer/AudioPlayer.js +151 -212
- package/es/AudioPlayer/AudioPlayer.js.map +1 -0
- package/es/AudioPlayer/Controls.js +246 -324
- package/es/AudioPlayer/Controls.js.map +1 -0
- package/es/AudioPlayer/SpeechControl.js +36 -52
- package/es/AudioPlayer/SpeechControl.js.map +1 -0
- package/es/AudioPlayer/index.js +7 -9
- package/es/AudioPlayer/index.js.map +1 -0
- package/es/Breadcrumb/Breadcrumb.js +42 -58
- package/es/Breadcrumb/Breadcrumb.js.map +1 -0
- package/es/Breadcrumb/BreadcrumbItem.js +33 -59
- package/es/Breadcrumb/BreadcrumbItem.js.map +1 -0
- package/es/Breadcrumb/HomeBreadcrumb.js +41 -74
- package/es/Breadcrumb/HomeBreadcrumb.js.map +1 -0
- package/es/Breadcrumb/index.js +8 -10
- package/es/Breadcrumb/index.js.map +1 -0
- package/es/CampaignBlock/CampaignBlock.js +124 -173
- package/es/CampaignBlock/CampaignBlock.js.map +1 -0
- package/es/CodeBlock/CodeBlock.js +21 -31
- package/es/CodeBlock/CodeBlock.js.map +1 -0
- package/es/CodeBlock/codeLanguageOptions.js +112 -82
- package/es/CodeBlock/codeLanguageOptions.js.map +1 -0
- package/es/Concept/Concept.js +46 -68
- package/es/Concept/Concept.js.map +1 -0
- package/es/ContactBlock/ContactBlock.js +137 -191
- package/es/ContactBlock/ContactBlock.js.map +1 -0
- package/es/ContentTypeBadge/ContentTypeBadge.js +38 -47
- package/es/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +21 -28
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +21 -28
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
- package/es/ContentTypeHero/ContentTypeHero.js +36 -47
- package/es/ContentTypeHero/ContentTypeHero.js.map +1 -0
- package/es/CopyParagraphButton/CopyParagraphButton.js +57 -78
- package/es/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
- package/es/CopyParagraphButton/index.js +7 -10
- package/es/CopyParagraphButton/index.js.map +1 -0
- package/es/Embed/AudioEmbed.js +49 -73
- package/es/Embed/AudioEmbed.js.map +1 -0
- package/es/Embed/BrightcoveEmbed.js +90 -127
- package/es/Embed/BrightcoveEmbed.js.map +1 -0
- package/es/Embed/CodeEmbed.js +55 -73
- package/es/Embed/CodeEmbed.js.map +1 -0
- package/es/Embed/ConceptEmbed.js +72 -117
- package/es/Embed/ConceptEmbed.js.map +1 -0
- package/es/Embed/ConceptInlineTriggerButton.js +39 -44
- package/es/Embed/ConceptInlineTriggerButton.js.map +1 -0
- package/es/Embed/ContentLinkEmbed.js +29 -49
- package/es/Embed/ContentLinkEmbed.js.map +1 -0
- package/es/Embed/CopyrightEmbed.js +21 -31
- package/es/Embed/CopyrightEmbed.js.map +1 -0
- package/es/Embed/EmbedErrorPlaceholder.js +40 -55
- package/es/Embed/EmbedErrorPlaceholder.js.map +1 -0
- package/es/Embed/EmbedWrapper.js +21 -46
- package/es/Embed/EmbedWrapper.js.map +1 -0
- package/es/Embed/ExternalEmbed.js +50 -70
- package/es/Embed/ExternalEmbed.js.map +1 -0
- package/es/Embed/FootnoteEmbed.js +25 -42
- package/es/Embed/FootnoteEmbed.js.map +1 -0
- package/es/Embed/GlossEmbed.js +49 -77
- package/es/Embed/GlossEmbed.js.map +1 -0
- package/es/Embed/H5pEmbed.js +35 -58
- package/es/Embed/H5pEmbed.js.map +1 -0
- package/es/Embed/IframeEmbed.js +65 -89
- package/es/Embed/IframeEmbed.js.map +1 -0
- package/es/Embed/ImageEmbed.js +167 -225
- package/es/Embed/ImageEmbed.js.map +1 -0
- package/es/Embed/InlineTriggerButton.js +20 -32
- package/es/Embed/InlineTriggerButton.js.map +1 -0
- package/es/Embed/RelatedContentEmbed.js +36 -53
- package/es/Embed/RelatedContentEmbed.js.map +1 -0
- package/es/Embed/UnknownEmbed.js +18 -29
- package/es/Embed/UnknownEmbed.js.map +1 -0
- package/es/Embed/UuDisclaimerEmbed.js +51 -85
- package/es/Embed/UuDisclaimerEmbed.js.map +1 -0
- package/es/ErrorMessage/ErrorMessage.js +51 -92
- package/es/ErrorMessage/ErrorMessage.js.map +1 -0
- package/es/ErrorMessage/index.js +7 -9
- package/es/ErrorMessage/index.js.map +1 -0
- package/es/FactBox/FactBox.js +114 -170
- package/es/FactBox/FactBox.js.map +1 -0
- package/es/FactBox/index.js +7 -9
- package/es/FactBox/index.js.map +1 -0
- package/es/FileList/File.js +70 -95
- package/es/FileList/File.js.map +1 -0
- package/es/FileList/FileList.js +31 -46
- package/es/FileList/FileList.js.map +1 -0
- package/es/FileList/PdfFile.js +27 -49
- package/es/FileList/PdfFile.js.map +1 -0
- package/es/Gloss/Gloss.js +133 -166
- package/es/Gloss/Gloss.js.map +1 -0
- package/es/Gloss/GlossExample.js +42 -60
- package/es/Gloss/GlossExample.js.map +1 -0
- package/es/Grid/Grid.js +63 -91
- package/es/Grid/Grid.js.map +1 -0
- package/es/Grid/GridParallaxItem.js +19 -30
- package/es/Grid/GridParallaxItem.js.map +1 -0
- package/es/KeyFigure/KeyFigure.js +44 -61
- package/es/KeyFigure/KeyFigure.js.map +1 -0
- package/es/LicenseByline/EmbedByline.js +126 -206
- package/es/LicenseByline/EmbedByline.js.map +1 -0
- package/es/LicenseByline/LicenseLink.js +28 -53
- package/es/LicenseByline/LicenseLink.js.map +1 -0
- package/es/LinkBlock/LinkBlock.js +70 -99
- package/es/LinkBlock/LinkBlock.js.map +1 -0
- package/es/LinkBlock/LinkBlockSection.js +20 -32
- package/es/LinkBlock/LinkBlockSection.js.map +1 -0
- package/es/Pitch/Pitch.js +59 -80
- package/es/Pitch/Pitch.js.map +1 -0
- package/es/RelatedArticleList/RelatedArticleList.js +91 -129
- package/es/RelatedArticleList/RelatedArticleList.js.map +1 -0
- package/es/RelatedArticleList/index.js +7 -10
- package/es/RelatedArticleList/index.js.map +1 -0
- package/es/ResourceBox/ResourceBox.js +71 -96
- package/es/ResourceBox/ResourceBox.js.map +1 -0
- package/es/TagSelector/TagSelector.js +93 -136
- package/es/TagSelector/TagSelector.js.map +1 -0
- package/es/ZendeskButton/ZendeskButton.js +38 -52
- package/es/ZendeskButton/ZendeskButton.js.map +1 -0
- package/es/_virtual/rolldown_runtime.js +11 -0
- package/es/i18n/formatNestedMessages.js +16 -24
- package/es/i18n/formatNestedMessages.js.map +1 -0
- package/es/i18n/i18n.js +25 -31
- package/es/i18n/i18n.js.map +1 -0
- package/es/i18n/useComponentTranslations.js +147 -203
- package/es/i18n/useComponentTranslations.js.map +1 -0
- package/es/index.js +64 -44
- package/es/locale/messages-en.js +435 -459
- package/es/locale/messages-en.js.map +1 -0
- package/es/locale/messages-nb.js +435 -459
- package/es/locale/messages-nb.js.map +1 -0
- package/es/locale/messages-nn.js +435 -459
- package/es/locale/messages-nn.js.map +1 -0
- package/es/locale/messages-se.js +435 -459
- package/es/locale/messages-se.js.map +1 -0
- package/es/model/ContentType.js +69 -65
- package/es/model/ContentType.js.map +1 -0
- package/es/model/SubjectCategories.js +23 -10
- package/es/model/SubjectCategories.js.map +1 -0
- package/es/model/SubjectTypes.js +21 -9
- package/es/model/SubjectTypes.js.map +1 -0
- package/es/model/WordClass.js +51 -43
- package/es/model/WordClass.js.map +1 -0
- package/es/model/index.js +16 -18
- package/es/model/index.js.map +1 -0
- package/es/utils/licenseAttributes.js +15 -17
- package/es/utils/licenseAttributes.js.map +1 -0
- package/es/utils/relativeUrl.js +21 -32
- package/es/utils/relativeUrl.js.map +1 -0
- package/lib/Article/Article.js +130 -203
- package/lib/Article/Article.js.map +1 -0
- package/lib/Article/ArticleByline.js +125 -179
- package/lib/Article/ArticleByline.js.map +1 -0
- package/lib/Article/ArticleFootNotes.js +39 -65
- package/lib/Article/ArticleFootNotes.js.map +1 -0
- package/lib/AudioPlayer/AudioPlayer.js +155 -221
- package/lib/AudioPlayer/AudioPlayer.js.map +1 -0
- package/lib/AudioPlayer/Controls.js +249 -332
- package/lib/AudioPlayer/Controls.js.map +1 -0
- package/lib/AudioPlayer/SpeechControl.js +39 -60
- package/lib/AudioPlayer/SpeechControl.js.map +1 -0
- package/lib/AudioPlayer/index.js +7 -15
- package/lib/AudioPlayer/index.js.map +1 -0
- package/lib/Breadcrumb/Breadcrumb.js +43 -65
- package/lib/Breadcrumb/Breadcrumb.js.map +1 -0
- package/lib/Breadcrumb/BreadcrumbItem.js +34 -65
- package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -0
- package/lib/Breadcrumb/HomeBreadcrumb.js +43 -82
- package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -0
- package/lib/Breadcrumb/index.js +8 -22
- package/lib/Breadcrumb/index.js.map +1 -0
- package/lib/CampaignBlock/CampaignBlock.js +128 -183
- package/lib/CampaignBlock/CampaignBlock.js.map +1 -0
- package/lib/CodeBlock/CodeBlock.js +23 -38
- package/lib/CodeBlock/CodeBlock.js.map +1 -0
- package/lib/CodeBlock/codeLanguageOptions.js +112 -87
- package/lib/CodeBlock/codeLanguageOptions.js.map +1 -0
- package/lib/Concept/Concept.js +48 -75
- package/lib/Concept/Concept.js.map +1 -0
- package/lib/ContactBlock/ContactBlock.js +141 -200
- package/lib/ContactBlock/ContactBlock.js.map +1 -0
- package/lib/ContentTypeBadge/ContentTypeBadge.js +40 -54
- package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +23 -35
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +23 -35
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
- package/lib/ContentTypeHero/ContentTypeHero.js +37 -54
- package/lib/ContentTypeHero/ContentTypeHero.js.map +1 -0
- package/lib/CopyParagraphButton/CopyParagraphButton.js +61 -87
- package/lib/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
- package/lib/CopyParagraphButton/index.js +7 -21
- package/lib/CopyParagraphButton/index.js.map +1 -0
- package/lib/Embed/AudioEmbed.js +51 -82
- package/lib/Embed/AudioEmbed.js.map +1 -0
- package/lib/Embed/BrightcoveEmbed.js +93 -138
- package/lib/Embed/BrightcoveEmbed.js.map +1 -0
- package/lib/Embed/CodeEmbed.js +59 -83
- package/lib/Embed/CodeEmbed.js.map +1 -0
- package/lib/Embed/ConceptEmbed.js +77 -127
- package/lib/Embed/ConceptEmbed.js.map +1 -0
- package/lib/Embed/ConceptInlineTriggerButton.js +39 -49
- package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -0
- package/lib/Embed/ContentLinkEmbed.js +30 -55
- package/lib/Embed/ContentLinkEmbed.js.map +1 -0
- package/lib/Embed/CopyrightEmbed.js +22 -37
- package/lib/Embed/CopyrightEmbed.js.map +1 -0
- package/lib/Embed/EmbedErrorPlaceholder.js +42 -62
- package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -0
- package/lib/Embed/EmbedWrapper.js +24 -54
- package/lib/Embed/EmbedWrapper.js.map +1 -0
- package/lib/Embed/ExternalEmbed.js +53 -79
- package/lib/Embed/ExternalEmbed.js.map +1 -0
- package/lib/Embed/FootnoteEmbed.js +26 -48
- package/lib/Embed/FootnoteEmbed.js.map +1 -0
- package/lib/Embed/GlossEmbed.js +51 -86
- package/lib/Embed/GlossEmbed.js.map +1 -0
- package/lib/Embed/H5pEmbed.js +37 -66
- package/lib/Embed/H5pEmbed.js.map +1 -0
- package/lib/Embed/IframeEmbed.js +68 -98
- package/lib/Embed/IframeEmbed.js.map +1 -0
- package/lib/Embed/ImageEmbed.js +173 -238
- package/lib/Embed/ImageEmbed.js.map +1 -0
- package/lib/Embed/InlineTriggerButton.js +23 -40
- package/lib/Embed/InlineTriggerButton.js.map +1 -0
- package/lib/Embed/RelatedContentEmbed.js +37 -59
- package/lib/Embed/RelatedContentEmbed.js.map +1 -0
- package/lib/Embed/UnknownEmbed.js +19 -35
- package/lib/Embed/UnknownEmbed.js.map +1 -0
- package/lib/Embed/UuDisclaimerEmbed.js +53 -92
- package/lib/Embed/UuDisclaimerEmbed.js.map +1 -0
- package/lib/ErrorMessage/ErrorMessage.js +53 -99
- package/lib/ErrorMessage/ErrorMessage.js.map +1 -0
- package/lib/ErrorMessage/index.js +7 -15
- package/lib/ErrorMessage/index.js.map +1 -0
- package/lib/FactBox/FactBox.js +118 -180
- package/lib/FactBox/FactBox.js.map +1 -0
- package/lib/FactBox/index.js +7 -15
- package/lib/FactBox/index.js.map +1 -0
- package/lib/FileList/File.js +75 -105
- package/lib/FileList/File.js.map +1 -0
- package/lib/FileList/FileList.js +33 -52
- package/lib/FileList/FileList.js.map +1 -0
- package/lib/FileList/PdfFile.js +27 -55
- package/lib/FileList/PdfFile.js.map +1 -0
- package/lib/Gloss/Gloss.js +138 -176
- package/lib/Gloss/Gloss.js.map +1 -0
- package/lib/Gloss/GlossExample.js +45 -68
- package/lib/Gloss/GlossExample.js.map +1 -0
- package/lib/Grid/Grid.js +64 -98
- package/lib/Grid/Grid.js.map +1 -0
- package/lib/Grid/GridParallaxItem.js +19 -36
- package/lib/Grid/GridParallaxItem.js.map +1 -0
- package/lib/KeyFigure/KeyFigure.js +45 -68
- package/lib/KeyFigure/KeyFigure.js.map +1 -0
- package/lib/LicenseByline/EmbedByline.js +130 -216
- package/lib/LicenseByline/EmbedByline.js.map +1 -0
- package/lib/LicenseByline/LicenseLink.js +29 -59
- package/lib/LicenseByline/LicenseLink.js.map +1 -0
- package/lib/LinkBlock/LinkBlock.js +73 -108
- package/lib/LinkBlock/LinkBlock.js.map +1 -0
- package/lib/LinkBlock/LinkBlockSection.js +22 -39
- package/lib/LinkBlock/LinkBlockSection.js.map +1 -0
- package/lib/Pitch/Pitch.js +61 -89
- package/lib/Pitch/Pitch.js.map +1 -0
- package/lib/RelatedArticleList/RelatedArticleList.js +96 -140
- package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -0
- package/lib/RelatedArticleList/index.js +7 -20
- package/lib/RelatedArticleList/index.js.map +1 -0
- package/lib/ResourceBox/ResourceBox.js +73 -104
- package/lib/ResourceBox/ResourceBox.js.map +1 -0
- package/lib/TagSelector/TagSelector.js +103 -145
- package/lib/TagSelector/TagSelector.js.map +1 -0
- package/lib/ZendeskButton/ZendeskButton.js +39 -58
- package/lib/ZendeskButton/ZendeskButton.js.map +1 -0
- package/lib/_virtual/rolldown_runtime.js +42 -0
- package/lib/i18n/formatNestedMessages.js +16 -30
- package/lib/i18n/formatNestedMessages.js.map +1 -0
- package/lib/i18n/i18n.js +28 -38
- package/lib/i18n/i18n.js.map +1 -0
- package/lib/i18n/useComponentTranslations.js +154 -215
- package/lib/i18n/useComponentTranslations.js.map +1 -0
- package/lib/index.js +156 -598
- package/lib/locale/messages-en.js +436 -466
- package/lib/locale/messages-en.js.map +1 -0
- package/lib/locale/messages-nb.js +436 -466
- package/lib/locale/messages-nb.js.map +1 -0
- package/lib/locale/messages-nn.js +436 -466
- package/lib/locale/messages-nn.js.map +1 -0
- package/lib/locale/messages-se.js +436 -466
- package/lib/locale/messages-se.js.map +1 -0
- package/lib/model/ContentType.js +90 -70
- package/lib/model/ContentType.js.map +1 -0
- package/lib/model/SubjectCategories.js +26 -14
- package/lib/model/SubjectCategories.js.map +1 -0
- package/lib/model/SubjectTypes.js +24 -13
- package/lib/model/SubjectTypes.js.map +1 -0
- package/lib/model/WordClass.js +55 -48
- package/lib/model/WordClass.js.map +1 -0
- package/lib/model/index.js +16 -25
- package/lib/model/index.js.map +1 -0
- package/lib/utils/licenseAttributes.js +14 -22
- package/lib/utils/licenseAttributes.js.map +1 -0
- package/lib/utils/relativeUrl.js +20 -38
- package/lib/utils/relativeUrl.js.map +1 -0
- package/package.json +12 -11
- package/es/Article/index.js +0 -11
- package/es/CampaignBlock/index.js +0 -9
- package/es/CodeBlock/index.js +0 -10
- package/es/ContactBlock/index.js +0 -9
- package/es/ContentTypeHero/index.js +0 -9
- package/es/Embed/index.js +0 -25
- package/es/Embed/types.js +0 -1
- package/es/FileList/index.js +0 -11
- package/es/Gloss/index.js +0 -10
- package/es/Grid/index.js +0 -10
- package/es/KeyFigure/index.js +0 -9
- package/es/LicenseByline/index.js +0 -10
- package/es/LinkBlock/index.js +0 -10
- package/es/Pitch/index.js +0 -9
- package/es/ResourceBox/index.js +0 -10
- package/es/i18n/index.js +0 -11
- package/es/types.js +0 -1
- package/lib/Article/index.js +0 -68
- package/lib/CampaignBlock/index.js +0 -13
- package/lib/CodeBlock/index.js +0 -20
- package/lib/ContactBlock/index.js +0 -18
- package/lib/ContentTypeHero/index.js +0 -12
- package/lib/Embed/index.js +0 -150
- package/lib/Embed/types.js +0 -5
- package/lib/FileList/index.js +0 -44
- package/lib/Gloss/index.js +0 -20
- package/lib/Grid/index.js +0 -19
- package/lib/KeyFigure/index.js +0 -13
- package/lib/LicenseByline/index.js +0 -19
- package/lib/LinkBlock/index.js +0 -20
- package/lib/Pitch/index.js +0 -12
- package/lib/ResourceBox/index.js +0 -13
- package/lib/i18n/index.js +0 -68
- package/lib/types.js +0 -5
|
@@ -1,56 +1,40 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2021-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
1
|
import { useRef } from "react";
|
|
2
|
+
import { IconButton, TooltipContent, TooltipRoot, TooltipTrigger } from "@ndla/primitives";
|
|
10
3
|
import { useTranslation } from "react-i18next";
|
|
11
4
|
import { VolumeUpFill } from "@ndla/icons";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
children: [/*#__PURE__*/_jsx(TooltipTrigger, {
|
|
43
|
-
asChild: true,
|
|
44
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
|
45
|
-
variant: "tertiary",
|
|
46
|
-
"aria-label": t(`${type}.play`),
|
|
47
|
-
onClick: togglePlay,
|
|
48
|
-
children: /*#__PURE__*/_jsx(VolumeUpFill, {})
|
|
49
|
-
})
|
|
50
|
-
}), /*#__PURE__*/_jsx(TooltipContent, {
|
|
51
|
-
children: t(`${type}.play`)
|
|
52
|
-
})]
|
|
53
|
-
})]
|
|
54
|
-
});
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/AudioPlayer/SpeechControl.tsx
|
|
8
|
+
const SpeechControl = ({ src, title, type = "audio" }) => {
|
|
9
|
+
const { t } = useTranslation();
|
|
10
|
+
const audioRef = useRef(null);
|
|
11
|
+
const togglePlay = () => {
|
|
12
|
+
if (audioRef.current) {
|
|
13
|
+
const audioElement = audioRef.current;
|
|
14
|
+
if (audioElement.paused) audioElement.play();
|
|
15
|
+
else audioElement.pause();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
19
|
+
"data-embed-type": "speech",
|
|
20
|
+
children: [/* @__PURE__ */ jsx("audio", {
|
|
21
|
+
ref: audioRef,
|
|
22
|
+
src,
|
|
23
|
+
title,
|
|
24
|
+
preload: "metadata"
|
|
25
|
+
}), /* @__PURE__ */ jsxs(TooltipRoot, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
26
|
+
asChild: true,
|
|
27
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
28
|
+
variant: "tertiary",
|
|
29
|
+
"aria-label": t(`${type}.play`),
|
|
30
|
+
onClick: togglePlay,
|
|
31
|
+
children: /* @__PURE__ */ jsx(VolumeUpFill, {})
|
|
32
|
+
})
|
|
33
|
+
}), /* @__PURE__ */ jsx(TooltipContent, { children: t(`${type}.play`) })] })]
|
|
34
|
+
});
|
|
55
35
|
};
|
|
56
|
-
|
|
36
|
+
var SpeechControl_default = SpeechControl;
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { SpeechControl_default };
|
|
40
|
+
//# sourceMappingURL=SpeechControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpeechControl.js","names":[],"sources":["../../src/AudioPlayer/SpeechControl.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 { useRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { VolumeUpFill } from \"@ndla/icons\";\nimport { TooltipRoot, TooltipTrigger, TooltipContent, IconButton } from \"@ndla/primitives\";\n\ntype Props = {\n src: string;\n title: string;\n type?: \"gloss\" | \"audio\";\n};\n\nconst SpeechControl = ({ src, title, type = \"audio\" }: Props) => {\n const { t } = useTranslation();\n const audioRef = useRef<HTMLAudioElement>(null);\n\n const togglePlay = () => {\n if (audioRef.current) {\n const audioElement = audioRef.current;\n if (audioElement.paused) {\n audioElement.play();\n } else {\n audioElement.pause();\n }\n }\n };\n return (\n <div data-embed-type=\"speech\">\n {/* eslint-disable-next-line jsx-a11y/media-has-caption */}\n <audio ref={audioRef} src={src} title={title} preload=\"metadata\" />\n <TooltipRoot>\n <TooltipTrigger asChild>\n <IconButton variant=\"tertiary\" aria-label={t(`${type}.play`)} onClick={togglePlay}>\n <VolumeUpFill />\n </IconButton>\n </TooltipTrigger>\n <TooltipContent>{t(`${type}.play`)}</TooltipContent>\n </TooltipRoot>\n </div>\n );\n};\n\nexport default SpeechControl;\n"],"mappings":";;;;;;;AAmBA,MAAM,gBAAgB,CAAC,EAAE,KAAK,OAAO,OAAO,SAAgB,KAAK;CAC/D,MAAM,EAAE,GAAG,GAAG,gBAAgB;CAC9B,MAAM,WAAW,OAAyB,KAAK;CAE/C,MAAM,aAAa,MAAM;AACvB,MAAI,SAAS,SAAS;GACpB,MAAM,eAAe,SAAS;AAC9B,OAAI,aAAa,OACf,cAAa,MAAM;OAEnB,cAAa,OAAO;EAEvB;CACF;AACD,wBACE,KAAC;EAAI,mBAAgB;6BAEnB,IAAC;GAAM,KAAK;GAAe;GAAY;GAAO,SAAQ;IAAa,kBACnE,KAAC,0CACC,IAAC;GAAe;6BACd,IAAC;IAAW,SAAQ;IAAW,cAAY,GAAG,EAAE,KAAK,OAAO;IAAE,SAAS;8BACrE,IAAC,iBAAe;KACL;IACE,kBACjB,IAAC,4BAAgB,GAAG,EAAE,KAAK,OAAO,GAAkB,IACxC;GACV;AAET;AAED,4BAAe"}
|
package/es/AudioPlayer/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (c) 2021-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
1
|
+
import { AudioPlayer_default } from "./AudioPlayer.js";
|
|
8
2
|
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
//#region src/AudioPlayer/index.ts
|
|
4
|
+
var AudioPlayer_default$1 = AudioPlayer_default;
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { AudioPlayer_default$1 as AudioPlayer_default };
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["AudioPlayer"],"sources":["../../src/AudioPlayer/index.ts"],"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 AudioPlayer from \"./AudioPlayer\";\n\nexport default AudioPlayer;\n"],"mappings":";;;AAUA,4BAAeA"}
|
|
@@ -1,60 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { useTranslation } from "react-i18next";
|
|
1
|
+
import { BreadcrumbItem_default } from "./BreadcrumbItem.js";
|
|
2
|
+
import "react";
|
|
10
3
|
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
-
import
|
|
12
|
-
import { jsx
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
const Breadcrumb =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (element) {
|
|
47
|
-
element.setMaxWidth("none");
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
totalCount: items.length,
|
|
52
|
-
item: {
|
|
53
|
-
...item,
|
|
54
|
-
index
|
|
55
|
-
}
|
|
56
|
-
}, typeof item.to === "string" ? item.to : item.to.pathname))
|
|
57
|
-
})
|
|
58
|
-
});
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/Breadcrumb/Breadcrumb.tsx
|
|
8
|
+
const StyledList = styled("ol", { base: {
|
|
9
|
+
display: "flex",
|
|
10
|
+
flexWrap: "wrap",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
listStyle: "none",
|
|
13
|
+
gap: "xxsmall",
|
|
14
|
+
mobileDown: {
|
|
15
|
+
alignItems: "flex-start",
|
|
16
|
+
justifyContent: "center",
|
|
17
|
+
flexDirection: "column"
|
|
18
|
+
}
|
|
19
|
+
} });
|
|
20
|
+
const Breadcrumb = ({ items, renderItem, renderSeparator, collapseFirst, collapseLast = true }) => {
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
23
|
+
"aria-label": t("breadcrumb.breadcrumb"),
|
|
24
|
+
children: /* @__PURE__ */ jsx(StyledList, { children: items.map((item, index) => /* @__PURE__ */ jsx(BreadcrumbItem_default, {
|
|
25
|
+
renderItem,
|
|
26
|
+
renderSeparator,
|
|
27
|
+
ref: (element) => {
|
|
28
|
+
if (element === null || !collapseFirst && index === 0 || !collapseLast && index === items.length - 1) {
|
|
29
|
+
if (element) element.setMaxWidth("none");
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
totalCount: items.length,
|
|
33
|
+
item: {
|
|
34
|
+
...item,
|
|
35
|
+
index
|
|
36
|
+
}
|
|
37
|
+
}, typeof item.to === "string" ? item.to : item.to.pathname)) })
|
|
38
|
+
});
|
|
59
39
|
};
|
|
60
|
-
|
|
40
|
+
var Breadcrumb_default = Breadcrumb;
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { Breadcrumb_default };
|
|
44
|
+
//# sourceMappingURL=Breadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumb.js","names":["BreadcrumbItem"],"sources":["../../src/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["/**\n * Copyright (c) 2016-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport BreadcrumbItem, { type IndexedBreadcrumbItem, type SimpleBreadcrumbItem } from \"./BreadcrumbItem\";\n\ninterface Props {\n items: SimpleBreadcrumbItem[];\n collapseFirst?: boolean;\n collapseLast?: boolean;\n renderItem?: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n renderSeparator?: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n}\n\nconst StyledList = styled(\"ol\", {\n base: {\n display: \"flex\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n listStyle: \"none\",\n gap: \"xxsmall\",\n mobileDown: {\n alignItems: \"flex-start\",\n justifyContent: \"center\",\n flexDirection: \"column\",\n },\n },\n});\n\nconst Breadcrumb = ({ items, renderItem, renderSeparator, collapseFirst, collapseLast = true }: Props) => {\n const { t } = useTranslation();\n\n return (\n <nav aria-label={t(\"breadcrumb.breadcrumb\")}>\n <StyledList>\n {items.map((item, index) => (\n <BreadcrumbItem\n renderItem={renderItem}\n renderSeparator={renderSeparator}\n ref={(element) => {\n if (\n element === null ||\n (!collapseFirst && index === 0) ||\n (!collapseLast && index === items.length - 1)\n ) {\n if (element) {\n element.setMaxWidth(\"none\");\n }\n }\n }}\n key={typeof item.to === \"string\" ? item.to : item.to.pathname}\n totalCount={items.length}\n item={{ ...item, index }}\n />\n ))}\n </StyledList>\n </nav>\n );\n};\n\nexport default Breadcrumb;\n"],"mappings":";;;;;;;AAqBA,MAAM,aAAa,OAAO,MAAM,EAC9B,MAAM;CACJ,SAAS;CACT,UAAU;CACV,YAAY;CACZ,WAAW;CACX,KAAK;CACL,YAAY;EACV,YAAY;EACZ,gBAAgB;EAChB,eAAe;CAChB;AACF,EACF,EAAC;AAEF,MAAM,aAAa,CAAC,EAAE,OAAO,YAAY,iBAAiB,eAAe,eAAe,MAAa,KAAK;CACxG,MAAM,EAAE,GAAG,GAAG,gBAAgB;AAE9B,wBACE,IAAC;EAAI,cAAY,EAAE,wBAAwB;4BACzC,IAAC,wBACE,MAAM,IAAI,CAAC,MAAM,0BAChB,IAACA;GACa;GACK;GACjB,KAAK,CAAC,YAAY;AAChB,QACE,YAAY,SACV,iBAAiB,UAAU,MAC3B,gBAAgB,UAAU,MAAM,SAAS,GAE3C;SAAI,QACF,SAAQ,YAAY,OAAO;IAC5B;GAEJ;GAED,YAAY,MAAM;GAClB,MAAM;IAAE,GAAG;IAAM;GAAO;YAFZ,KAAK,OAAO,WAAW,KAAK,KAAK,KAAK,GAAG,SAGrD,CACF,GACS;GACT;AAET;AAED,yBAAe"}
|
|
@@ -1,62 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { useRef, useImperativeHandle, forwardRef } from "react";
|
|
1
|
+
import { forwardRef, useImperativeHandle, useRef } from "react";
|
|
2
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
10
3
|
import { ArrowRightShortLine } from "@ndla/icons";
|
|
11
4
|
import { SafeLink } from "@ndla/safelink";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
useImperativeHandle(ref, () => ({
|
|
39
|
-
setMaxWidth: maxWidth => {
|
|
40
|
-
liRef.current.children[0].style.maxWidth = maxWidth;
|
|
41
|
-
}
|
|
42
|
-
}));
|
|
43
|
-
const {
|
|
44
|
-
to,
|
|
45
|
-
name,
|
|
46
|
-
index
|
|
47
|
-
} = item;
|
|
48
|
-
const isLast = index === totalCount - 1;
|
|
49
|
-
return /*#__PURE__*/_jsxs(StyledListItem, {
|
|
50
|
-
ref: liRef,
|
|
51
|
-
"aria-current": isLast ? "page" : undefined,
|
|
52
|
-
children: [renderItem ? renderItem(item, totalCount) : isLast ? /*#__PURE__*/_jsx("span", {
|
|
53
|
-
children: name
|
|
54
|
-
}) : /*#__PURE__*/_jsx(SafeLink, {
|
|
55
|
-
to: to,
|
|
56
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
57
|
-
children: name
|
|
58
|
-
})
|
|
59
|
-
}), renderSeparator ? renderSeparator(item, totalCount) : !isLast && /*#__PURE__*/_jsx(ArrowRightShortLine, {})]
|
|
60
|
-
});
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/Breadcrumb/BreadcrumbItem.tsx
|
|
8
|
+
const StyledListItem = styled("li", { base: {
|
|
9
|
+
display: "flex",
|
|
10
|
+
color: "inherit",
|
|
11
|
+
gap: "3xsmall",
|
|
12
|
+
alignItems: "flex-end",
|
|
13
|
+
tabletDown: { display: "block" },
|
|
14
|
+
"& a": { _visited: { color: "inherit" } }
|
|
15
|
+
} });
|
|
16
|
+
const BreadcrumbItem = forwardRef(({ renderItem, renderSeparator, item, totalCount }, ref) => {
|
|
17
|
+
const liRef = useRef(null);
|
|
18
|
+
useImperativeHandle(ref, () => ({ setMaxWidth: (maxWidth) => {
|
|
19
|
+
liRef.current.children[0].style.maxWidth = maxWidth;
|
|
20
|
+
} }));
|
|
21
|
+
const { to, name, index } = item;
|
|
22
|
+
const isLast = index === totalCount - 1;
|
|
23
|
+
return /* @__PURE__ */ jsxs(StyledListItem, {
|
|
24
|
+
ref: liRef,
|
|
25
|
+
"aria-current": isLast ? "page" : void 0,
|
|
26
|
+
children: [renderItem ? renderItem(item, totalCount) : isLast ? /* @__PURE__ */ jsx("span", { children: name }) : /* @__PURE__ */ jsx(SafeLink, {
|
|
27
|
+
to,
|
|
28
|
+
children: /* @__PURE__ */ jsx("span", { children: name })
|
|
29
|
+
}), renderSeparator ? renderSeparator(item, totalCount) : !isLast && /* @__PURE__ */ jsx(ArrowRightShortLine, {})]
|
|
30
|
+
});
|
|
61
31
|
});
|
|
62
|
-
|
|
32
|
+
var BreadcrumbItem_default = BreadcrumbItem;
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { BreadcrumbItem_default };
|
|
36
|
+
//# sourceMappingURL=BreadcrumbItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BreadcrumbItem.js","names":["maxWidth: number"],"sources":["../../src/Breadcrumb/BreadcrumbItem.tsx"],"sourcesContent":["/**\n * Copyright (c) 2016-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { useRef, useImperativeHandle, type ReactNode, forwardRef } from \"react\";\nimport { ArrowRightShortLine } from \"@ndla/icons\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nexport interface SimpleBreadcrumbItem {\n to: string | Partial<Location>;\n name: ReactNode;\n}\n\nexport interface IndexedBreadcrumbItem extends SimpleBreadcrumbItem {\n index: number;\n}\n\nexport interface BreadcrumbRenderProps {\n item: IndexedBreadcrumbItem;\n totalCount: number;\n}\n\nconst StyledListItem = styled(\"li\", {\n base: {\n display: \"flex\",\n color: \"inherit\",\n gap: \"3xsmall\",\n alignItems: \"flex-end\",\n tabletDown: {\n display: \"block\",\n },\n \"& a\": {\n _visited: {\n color: \"inherit\",\n },\n },\n },\n});\n\ninterface Props {\n item: IndexedBreadcrumbItem;\n autoCollapse?: boolean;\n totalCount: number;\n renderItem?: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n renderSeparator?: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;\n}\n\nconst BreadcrumbItem = forwardRef<any, Props>(({ renderItem, renderSeparator, item, totalCount }, ref) => {\n const liRef = useRef<any>(null);\n\n useImperativeHandle(ref, () => ({\n setMaxWidth: (maxWidth: number) => {\n liRef.current.children[0].style.maxWidth = maxWidth;\n },\n }));\n\n const { to, name, index } = item;\n const isLast = index === totalCount - 1;\n return (\n <StyledListItem ref={liRef} aria-current={isLast ? \"page\" : undefined}>\n {renderItem ? (\n renderItem(item, totalCount)\n ) : isLast ? (\n <span>{name}</span>\n ) : (\n <SafeLink to={to}>\n <span>{name}</span>\n </SafeLink>\n )}\n {renderSeparator ? renderSeparator(item, totalCount) : !isLast && <ArrowRightShortLine />}\n </StyledListItem>\n );\n});\n\nexport default BreadcrumbItem;\n"],"mappings":";;;;;;;AA2BA,MAAM,iBAAiB,OAAO,MAAM,EAClC,MAAM;CACJ,SAAS;CACT,OAAO;CACP,KAAK;CACL,YAAY;CACZ,YAAY,EACV,SAAS,QACV;CACD,OAAO,EACL,UAAU,EACR,OAAO,UACR,EACF;AACF,EACF,EAAC;AAUF,MAAM,iBAAiB,WAAuB,CAAC,EAAE,YAAY,iBAAiB,MAAM,YAAY,EAAE,QAAQ;CACxG,MAAM,QAAQ,OAAY,KAAK;AAE/B,qBAAoB,KAAK,OAAO,EAC9B,aAAa,CAACA,aAAqB;AACjC,QAAM,QAAQ,SAAS,GAAG,MAAM,WAAW;CAC5C,EACF,GAAE;CAEH,MAAM,EAAE,IAAI,MAAM,OAAO,GAAG;CAC5B,MAAM,SAAS,UAAU,aAAa;AACtC,wBACE,KAAC;EAAe,KAAK;EAAO,gBAAc,SAAS;aAChD,aACC,WAAW,MAAM,WAAW,GAC1B,yBACF,IAAC,oBAAM,OAAY,mBAEnB,IAAC;GAAa;6BACZ,IAAC,oBAAM,OAAY;IACV,EAEZ,kBAAkB,gBAAgB,MAAM,WAAW,IAAI,0BAAU,IAAC,wBAAsB;GAC1E;AAEpB,EAAC;AAEF,6BAAe"}
|
|
@@ -1,77 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
1
|
+
import { Breadcrumb_default } from "./Breadcrumb.js";
|
|
2
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
9
3
|
import { ArrowRightShortLine, HomeLine } from "@ndla/icons";
|
|
10
4
|
import { SafeLink } from "@ndla/safelink";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const StyledSafeLink = styled(SafeLink, {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
children: item.name
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
if (item.index === 0 && typeof item.name === "string") {
|
|
49
|
-
return /*#__PURE__*/_jsx(IconSafeLink, {
|
|
50
|
-
"aria-label": item.name,
|
|
51
|
-
to: item.to,
|
|
52
|
-
children: /*#__PURE__*/_jsx(HomeLine, {
|
|
53
|
-
title: item.name
|
|
54
|
-
})
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
return /*#__PURE__*/_jsx(StyledSafeLink, {
|
|
58
|
-
to: item.to,
|
|
59
|
-
children: item.name
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
const renderSeparator = (item, totalCount) => {
|
|
63
|
-
if (item.index === totalCount - 1) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
if (item.index === 0) {
|
|
67
|
-
return /*#__PURE__*/_jsx(StyledArrowRight, {});
|
|
68
|
-
}
|
|
69
|
-
return /*#__PURE__*/_jsx(ArrowRightShortLine, {});
|
|
70
|
-
};
|
|
71
|
-
return /*#__PURE__*/_jsx(Breadcrumb, {
|
|
72
|
-
items: items,
|
|
73
|
-
renderItem: renderItem,
|
|
74
|
-
renderSeparator: renderSeparator
|
|
75
|
-
});
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/Breadcrumb/HomeBreadcrumb.tsx
|
|
8
|
+
const StyledSafeLink = styled(SafeLink, { base: {
|
|
9
|
+
color: "inherit",
|
|
10
|
+
textDecoration: "underline",
|
|
11
|
+
_hover: { textDecoration: "none" },
|
|
12
|
+
_focusVisible: { textDecoration: "none" }
|
|
13
|
+
} });
|
|
14
|
+
const StyledArrowRight = styled(ArrowRightShortLine, { base: { tabletDown: { display: "none" } } });
|
|
15
|
+
const IconSafeLink = styled(SafeLink, { base: { color: "inherit" } });
|
|
16
|
+
const HomeBreadcrumb = ({ items }) => {
|
|
17
|
+
const renderItem = (item, totalCount) => {
|
|
18
|
+
if (item.index === totalCount - 1) return /* @__PURE__ */ jsx("span", { children: item.name });
|
|
19
|
+
if (item.index === 0 && typeof item.name === "string") return /* @__PURE__ */ jsx(IconSafeLink, {
|
|
20
|
+
"aria-label": item.name,
|
|
21
|
+
to: item.to,
|
|
22
|
+
children: /* @__PURE__ */ jsx(HomeLine, { title: item.name })
|
|
23
|
+
});
|
|
24
|
+
return /* @__PURE__ */ jsx(StyledSafeLink, {
|
|
25
|
+
to: item.to,
|
|
26
|
+
children: item.name
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const renderSeparator = (item, totalCount) => {
|
|
30
|
+
if (item.index === totalCount - 1) return null;
|
|
31
|
+
if (item.index === 0) return /* @__PURE__ */ jsx(StyledArrowRight, {});
|
|
32
|
+
return /* @__PURE__ */ jsx(ArrowRightShortLine, {});
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ jsx(Breadcrumb_default, {
|
|
35
|
+
items,
|
|
36
|
+
renderItem,
|
|
37
|
+
renderSeparator
|
|
38
|
+
});
|
|
76
39
|
};
|
|
77
|
-
|
|
40
|
+
var HomeBreadcrumb_default = HomeBreadcrumb;
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { HomeBreadcrumb_default };
|
|
44
|
+
//# sourceMappingURL=HomeBreadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HomeBreadcrumb.js","names":["item: IndexedBreadcrumbItem","totalCount: number","Breadcrumb"],"sources":["../../src/Breadcrumb/HomeBreadcrumb.tsx"],"sourcesContent":["/**\n * Copyright (c) 2022-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { ArrowRightShortLine, HomeLine } from \"@ndla/icons\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport Breadcrumb from \"./Breadcrumb\";\nimport type { IndexedBreadcrumbItem, SimpleBreadcrumbItem } from \"./BreadcrumbItem\";\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n color: \"inherit\",\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n _focusVisible: {\n textDecoration: \"none\",\n },\n },\n});\n\nconst StyledArrowRight = styled(ArrowRightShortLine, {\n base: {\n tabletDown: {\n display: \"none\",\n },\n },\n});\n\nconst IconSafeLink = styled(SafeLink, {\n base: {\n color: \"inherit\",\n },\n});\n\ninterface Props {\n items: SimpleBreadcrumbItem[];\n}\n\nconst HomeBreadcrumb = ({ items }: Props) => {\n const renderItem = (item: IndexedBreadcrumbItem, totalCount: number) => {\n if (item.index === totalCount - 1) {\n return <span>{item.name}</span>;\n }\n if (item.index === 0 && typeof item.name === \"string\") {\n return (\n <IconSafeLink aria-label={item.name} to={item.to}>\n <HomeLine title={item.name} />\n </IconSafeLink>\n );\n }\n return <StyledSafeLink to={item.to}>{item.name}</StyledSafeLink>;\n };\n\n const renderSeparator = (item: IndexedBreadcrumbItem, totalCount: number) => {\n if (item.index === totalCount - 1) {\n return null;\n }\n if (item.index === 0) {\n return <StyledArrowRight />;\n }\n return <ArrowRightShortLine />;\n };\n\n return <Breadcrumb items={items} renderItem={renderItem} renderSeparator={renderSeparator} />;\n};\n\nexport default HomeBreadcrumb;\n"],"mappings":";;;;;;;AAcA,MAAM,iBAAiB,OAAO,UAAU,EACtC,MAAM;CACJ,OAAO;CACP,gBAAgB;CAChB,QAAQ,EACN,gBAAgB,OACjB;CACD,eAAe,EACb,gBAAgB,OACjB;AACF,EACF,EAAC;AAEF,MAAM,mBAAmB,OAAO,qBAAqB,EACnD,MAAM,EACJ,YAAY,EACV,SAAS,OACV,EACF,EACF,EAAC;AAEF,MAAM,eAAe,OAAO,UAAU,EACpC,MAAM,EACJ,OAAO,UACR,EACF,EAAC;AAMF,MAAM,iBAAiB,CAAC,EAAE,OAAc,KAAK;CAC3C,MAAM,aAAa,CAACA,MAA6BC,eAAuB;AACtE,MAAI,KAAK,UAAU,aAAa,EAC9B,wBAAO,IAAC,oBAAM,KAAK,OAAY;AAEjC,MAAI,KAAK,UAAU,YAAY,KAAK,SAAS,SAC3C,wBACE,IAAC;GAAa,cAAY,KAAK;GAAM,IAAI,KAAK;6BAC5C,IAAC,YAAS,OAAO,KAAK,OAAQ;IACjB;AAGnB,yBAAO,IAAC;GAAe,IAAI,KAAK;aAAK,KAAK;IAAsB;CACjE;CAED,MAAM,kBAAkB,CAACD,MAA6BC,eAAuB;AAC3E,MAAI,KAAK,UAAU,aAAa,EAC9B,QAAO;AAET,MAAI,KAAK,UAAU,EACjB,wBAAO,IAAC,qBAAmB;AAE7B,yBAAO,IAAC,wBAAsB;CAC/B;AAED,wBAAO,IAACC;EAAkB;EAAmB;EAA6B;GAAmB;AAC9F;AAED,6BAAe"}
|
package/es/Breadcrumb/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
1
|
+
import { Breadcrumb_default } from "./Breadcrumb.js";
|
|
2
|
+
import { HomeBreadcrumb_default } from "./HomeBreadcrumb.js";
|
|
8
3
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
//#region src/Breadcrumb/index.ts
|
|
5
|
+
var Breadcrumb_default$1 = Breadcrumb_default;
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Breadcrumb_default$1 as Breadcrumb_default };
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["Breadcrumb"],"sources":["../../src/Breadcrumb/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2016-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport Breadcrumb from \"./Breadcrumb\";\n\nexport type { SimpleBreadcrumbItem, IndexedBreadcrumbItem } from \"./BreadcrumbItem\";\n\nexport { default as HomeBreadcrumb } from \"./HomeBreadcrumb\";\n\nexport default Breadcrumb;\n"],"mappings":";;;;AAcA,2BAAeA"}
|