@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
package/es/FactBox/FactBox.js
CHANGED
|
@@ -1,177 +1,121 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016-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 React, { forwardRef, useCallback, useEffect, useId, useMemo, useState } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
|
-
import { ArrowDownShortLine } from "@ndla/icons";
|
|
12
2
|
import { IconButton } from "@ndla/primitives";
|
|
13
3
|
import { styled } from "@ndla/styled-system/jsx";
|
|
14
|
-
import {
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import { ArrowDownShortLine } from "@ndla/icons";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/FactBox/FactBox.tsx
|
|
15
9
|
const StyledAside = styled("aside", {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
"& > div": {
|
|
39
|
-
minHeight: "surface.3xsmall"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
variants: {
|
|
43
|
-
overflowHidden: {
|
|
44
|
-
true: {
|
|
45
|
-
"& > div": {
|
|
46
|
-
overflow: "hidden"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
const StyledContent = styled("div", {
|
|
53
|
-
base: {
|
|
54
|
-
position: "relative",
|
|
55
|
-
width: "100%",
|
|
56
|
-
// Reset the top margin of the very first child.
|
|
57
|
-
"& :first-child": {
|
|
58
|
-
marginBlockStart: "0"
|
|
59
|
-
},
|
|
60
|
-
_after: {
|
|
61
|
-
content: '""',
|
|
62
|
-
textAlign: "center",
|
|
63
|
-
position: "absolute",
|
|
64
|
-
inset: "0",
|
|
65
|
-
transitionProperty: "opacity",
|
|
66
|
-
transitionDuration: "slow",
|
|
67
|
-
transitionTimingFunction: "ease-in-out",
|
|
68
|
-
gradientFrom: "surface.default/20",
|
|
69
|
-
gradientTo: "surface.default/95",
|
|
70
|
-
backgroundGradient: "to-b",
|
|
71
|
-
opacity: "1",
|
|
72
|
-
zIndex: "base",
|
|
73
|
-
pointerEvents: "none"
|
|
74
|
-
},
|
|
75
|
-
_print: {
|
|
76
|
-
overflow: "visible",
|
|
77
|
-
_after: {
|
|
78
|
-
display: "none"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
_open: {
|
|
82
|
-
paddingBlockEnd: "xsmall",
|
|
83
|
-
_after: {
|
|
84
|
-
opacity: "0"
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
10
|
+
base: {
|
|
11
|
+
position: "relative",
|
|
12
|
+
padding: "medium",
|
|
13
|
+
display: "grid",
|
|
14
|
+
gridTemplateRows: "0fr",
|
|
15
|
+
transitionProperty: "grid-template-rows",
|
|
16
|
+
transitionDuration: "slow",
|
|
17
|
+
transitionTimingFunction: "ease-in-out",
|
|
18
|
+
justifyItems: "center",
|
|
19
|
+
border: "1px solid",
|
|
20
|
+
borderColor: "stroke.default",
|
|
21
|
+
borderRadius: "xsmall",
|
|
22
|
+
clear: "both",
|
|
23
|
+
_open: { gridTemplateRows: "1fr" },
|
|
24
|
+
_closed: { _print: {
|
|
25
|
+
overflow: "visible",
|
|
26
|
+
maxHeight: "500vh"
|
|
27
|
+
} },
|
|
28
|
+
"& > div": { minHeight: "surface.3xsmall" }
|
|
29
|
+
},
|
|
30
|
+
variants: { overflowHidden: { true: { "& > div": { overflow: "hidden" } } } }
|
|
88
31
|
});
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
32
|
+
const StyledContent = styled("div", { base: {
|
|
33
|
+
position: "relative",
|
|
34
|
+
width: "100%",
|
|
35
|
+
"& :first-child": { marginBlockStart: "0" },
|
|
36
|
+
_after: {
|
|
37
|
+
content: "\"\"",
|
|
38
|
+
textAlign: "center",
|
|
39
|
+
position: "absolute",
|
|
40
|
+
inset: "0",
|
|
41
|
+
transitionProperty: "opacity",
|
|
42
|
+
transitionDuration: "slow",
|
|
43
|
+
transitionTimingFunction: "ease-in-out",
|
|
44
|
+
gradientFrom: "surface.default/20",
|
|
45
|
+
gradientTo: "surface.default/95",
|
|
46
|
+
backgroundGradient: "to-b",
|
|
47
|
+
opacity: "1",
|
|
48
|
+
zIndex: "base",
|
|
49
|
+
pointerEvents: "none"
|
|
50
|
+
},
|
|
51
|
+
_print: {
|
|
52
|
+
overflow: "visible",
|
|
53
|
+
_after: { display: "none" }
|
|
54
|
+
},
|
|
55
|
+
_open: {
|
|
56
|
+
paddingBlockEnd: "xsmall",
|
|
57
|
+
_after: { opacity: "0" }
|
|
58
|
+
}
|
|
59
|
+
} });
|
|
60
|
+
const StyledIconButton = styled(IconButton, { base: {
|
|
61
|
+
position: "absolute",
|
|
62
|
+
bottom: "-medium",
|
|
63
|
+
zIndex: "base",
|
|
64
|
+
"& svg": {
|
|
65
|
+
transitionProperty: "transform",
|
|
66
|
+
transitionTimingFunction: "ease-in-out",
|
|
67
|
+
transitionDuration: "fast"
|
|
68
|
+
},
|
|
69
|
+
_open: { "& svg": { transform: "rotate(180deg)" } },
|
|
70
|
+
_print: { display: "none" }
|
|
71
|
+
} });
|
|
72
|
+
const FactBox = forwardRef(({ children, open, onOpenChange, defaultOpen = false,...rest }, ref) => {
|
|
73
|
+
const { t } = useTranslation();
|
|
74
|
+
const [state, setState] = useState(defaultOpen ? "open" : "closed");
|
|
75
|
+
const [overflowHidden, setOverflowHidden] = useState(!defaultOpen);
|
|
76
|
+
const contentId = useId();
|
|
77
|
+
const inertAttribute = useMemo(() => {
|
|
78
|
+
return state === "closed" ? { inert: typeof React.use === "function" ? true : "" } : {};
|
|
79
|
+
}, [state]);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (open !== void 0) setState(open ? "open" : "closed");
|
|
82
|
+
}, [open]);
|
|
83
|
+
const onClick = useCallback(() => {
|
|
84
|
+
const newState = state === "open" ? "closed" : "open";
|
|
85
|
+
setState(newState);
|
|
86
|
+
onOpenChange?.(newState === "open");
|
|
87
|
+
}, [state, onOpenChange]);
|
|
88
|
+
return /* @__PURE__ */ jsxs(StyledAside, {
|
|
89
|
+
"data-state": state,
|
|
90
|
+
"data-embed-type": "factbox",
|
|
91
|
+
...rest,
|
|
92
|
+
ref,
|
|
93
|
+
overflowHidden,
|
|
94
|
+
onTransitionStart: (e) => {
|
|
95
|
+
if (e.target === e.currentTarget && state === "closed") setOverflowHidden(true);
|
|
96
|
+
},
|
|
97
|
+
onTransitionEnd: (e) => {
|
|
98
|
+
if (e.target === e.currentTarget && state === "open") setOverflowHidden(false);
|
|
99
|
+
},
|
|
100
|
+
children: [/* @__PURE__ */ jsx(StyledIconButton, {
|
|
101
|
+
"data-state": state,
|
|
102
|
+
onClick,
|
|
103
|
+
contentEditable: false,
|
|
104
|
+
"aria-expanded": state === "open",
|
|
105
|
+
"aria-controls": contentId,
|
|
106
|
+
"aria-label": t(`factbox.${state === "open" ? "close" : "open"}`),
|
|
107
|
+
children: /* @__PURE__ */ jsx(ArrowDownShortLine, {})
|
|
108
|
+
}), /* @__PURE__ */ jsx(StyledContent, {
|
|
109
|
+
id: contentId,
|
|
110
|
+
"data-state": state,
|
|
111
|
+
"aria-hidden": state === "closed",
|
|
112
|
+
...inertAttribute,
|
|
113
|
+
children
|
|
114
|
+
})]
|
|
115
|
+
});
|
|
108
116
|
});
|
|
117
|
+
var FactBox_default = FactBox;
|
|
109
118
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
let {
|
|
114
|
-
children,
|
|
115
|
-
open,
|
|
116
|
-
onOpenChange,
|
|
117
|
-
defaultOpen = false,
|
|
118
|
-
...rest
|
|
119
|
-
} = _ref;
|
|
120
|
-
const {
|
|
121
|
-
t
|
|
122
|
-
} = useTranslation();
|
|
123
|
-
const [state, setState] = useState(defaultOpen ? "open" : "closed");
|
|
124
|
-
const [overflowHidden, setOverflowHidden] = useState(!defaultOpen);
|
|
125
|
-
const contentId = useId();
|
|
126
|
-
// Inert has existed since early 2023. It allows us to disable tabindex inside the content if it is closed, allowing us to be accessible for users with newish browsers. React 18 removes this because it doesn't recognize the attribute. This is a workaround for that.
|
|
127
|
-
// When running in React 18, we need to use an empty string instead of true.
|
|
128
|
-
// TODO: Remove this hack once we upgrade to React 19 as a peer dep.
|
|
129
|
-
const inertAttribute = useMemo(() => {
|
|
130
|
-
return state === "closed" ? {
|
|
131
|
-
inert: typeof React.use === "function" ? true : ""
|
|
132
|
-
} : {};
|
|
133
|
-
}, [state]);
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
if (open !== undefined) {
|
|
136
|
-
setState(open ? "open" : "closed");
|
|
137
|
-
}
|
|
138
|
-
}, [open]);
|
|
139
|
-
const onClick = useCallback(() => {
|
|
140
|
-
const newState = state === "open" ? "closed" : "open";
|
|
141
|
-
setState(newState);
|
|
142
|
-
onOpenChange?.(newState === "open");
|
|
143
|
-
}, [state, onOpenChange]);
|
|
144
|
-
return /*#__PURE__*/_jsxs(StyledAside, {
|
|
145
|
-
"data-state": state,
|
|
146
|
-
"data-embed-type": "factbox",
|
|
147
|
-
...rest,
|
|
148
|
-
ref: ref,
|
|
149
|
-
overflowHidden: overflowHidden,
|
|
150
|
-
onTransitionStart: e => {
|
|
151
|
-
if (e.target === e.currentTarget && state === "closed") {
|
|
152
|
-
setOverflowHidden(true);
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
onTransitionEnd: e => {
|
|
156
|
-
if (e.target === e.currentTarget && state === "open") {
|
|
157
|
-
setOverflowHidden(false);
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
children: [/*#__PURE__*/_jsx(StyledIconButton, {
|
|
161
|
-
"data-state": state,
|
|
162
|
-
onClick: onClick,
|
|
163
|
-
contentEditable: false,
|
|
164
|
-
"aria-expanded": state === "open",
|
|
165
|
-
"aria-controls": contentId,
|
|
166
|
-
"aria-label": t(`factbox.${state === "open" ? "close" : "open"}`),
|
|
167
|
-
children: /*#__PURE__*/_jsx(ArrowDownShortLine, {})
|
|
168
|
-
}), /*#__PURE__*/_jsx(StyledContent, {
|
|
169
|
-
id: contentId,
|
|
170
|
-
"data-state": state,
|
|
171
|
-
"aria-hidden": state === "closed",
|
|
172
|
-
...inertAttribute,
|
|
173
|
-
children: children
|
|
174
|
-
})]
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
export default FactBox;
|
|
119
|
+
//#endregion
|
|
120
|
+
export { FactBox_default };
|
|
121
|
+
//# sourceMappingURL=FactBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FactBox.js","names":[],"sources":["../../src/FactBox/FactBox.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 React, {\n type ComponentProps,\n type ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useState,\n} from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { ArrowDownShortLine } from \"@ndla/icons\";\nimport { IconButton } from \"@ndla/primitives\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\ninterface Props extends ComponentProps<\"aside\"> {\n children?: ReactNode;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nconst StyledAside = styled(\"aside\", {\n base: {\n position: \"relative\",\n padding: \"medium\",\n display: \"grid\",\n gridTemplateRows: \"0fr\",\n transitionProperty: \"grid-template-rows\",\n transitionDuration: \"slow\",\n transitionTimingFunction: \"ease-in-out\",\n justifyItems: \"center\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n borderRadius: \"xsmall\",\n clear: \"both\",\n _open: {\n gridTemplateRows: \"1fr\",\n },\n _closed: {\n _print: {\n overflow: \"visible\",\n maxHeight: \"500vh\",\n },\n },\n \"& > div\": {\n minHeight: \"surface.3xsmall\",\n },\n },\n variants: {\n overflowHidden: {\n true: {\n \"& > div\": {\n overflow: \"hidden\",\n },\n },\n },\n },\n});\n\nconst StyledContent = styled(\"div\", {\n base: {\n position: \"relative\",\n width: \"100%\",\n // Reset the top margin of the very first child.\n \"& :first-child\": {\n marginBlockStart: \"0\",\n },\n _after: {\n content: '\"\"',\n textAlign: \"center\",\n position: \"absolute\",\n inset: \"0\",\n transitionProperty: \"opacity\",\n transitionDuration: \"slow\",\n transitionTimingFunction: \"ease-in-out\",\n gradientFrom: \"surface.default/20\",\n gradientTo: \"surface.default/95\",\n backgroundGradient: \"to-b\",\n opacity: \"1\",\n zIndex: \"base\",\n pointerEvents: \"none\",\n },\n _print: {\n overflow: \"visible\",\n _after: {\n display: \"none\",\n },\n },\n _open: {\n paddingBlockEnd: \"xsmall\",\n _after: {\n opacity: \"0\",\n },\n },\n },\n});\n\nconst StyledIconButton = styled(IconButton, {\n base: {\n position: \"absolute\",\n bottom: \"-medium\",\n zIndex: \"base\",\n \"& svg\": {\n transitionProperty: \"transform\",\n transitionTimingFunction: \"ease-in-out\",\n transitionDuration: \"fast\",\n },\n _open: {\n \"& svg\": {\n transform: \"rotate(180deg)\",\n },\n },\n _print: {\n display: \"none\",\n },\n },\n});\n\n// TODO: Consider moving the open trigger depending on whether the content is open or closed.\n\nconst FactBox = forwardRef<HTMLElement, Props>(\n ({ children, open, onOpenChange, defaultOpen = false, ...rest }, ref) => {\n const { t } = useTranslation();\n const [state, setState] = useState<\"open\" | \"closed\">(defaultOpen ? \"open\" : \"closed\");\n const [overflowHidden, setOverflowHidden] = useState(!defaultOpen);\n const contentId = useId();\n // Inert has existed since early 2023. It allows us to disable tabindex inside the content if it is closed, allowing us to be accessible for users with newish browsers. React 18 removes this because it doesn't recognize the attribute. This is a workaround for that.\n // When running in React 18, we need to use an empty string instead of true.\n // TODO: Remove this hack once we upgrade to React 19 as a peer dep.\n const inertAttribute = useMemo(() => {\n return state === \"closed\" ? { inert: typeof React.use === \"function\" ? true : \"\" } : {};\n }, [state]) as { inert?: boolean };\n\n useEffect(() => {\n if (open !== undefined) {\n setState(open ? \"open\" : \"closed\");\n }\n }, [open]);\n\n const onClick = useCallback(() => {\n const newState = state === \"open\" ? \"closed\" : \"open\";\n setState(newState);\n onOpenChange?.(newState === \"open\");\n }, [state, onOpenChange]);\n\n return (\n <StyledAside\n data-state={state}\n data-embed-type=\"factbox\"\n {...rest}\n ref={ref}\n overflowHidden={overflowHidden}\n onTransitionStart={(e) => {\n if (e.target === e.currentTarget && state === \"closed\") {\n setOverflowHidden(true);\n }\n }}\n onTransitionEnd={(e) => {\n if (e.target === e.currentTarget && state === \"open\") {\n setOverflowHidden(false);\n }\n }}\n >\n <StyledIconButton\n data-state={state}\n onClick={onClick}\n contentEditable={false}\n aria-expanded={state === \"open\"}\n aria-controls={contentId}\n aria-label={t(`factbox.${state === \"open\" ? \"close\" : \"open\"}`)}\n >\n <ArrowDownShortLine />\n </StyledIconButton>\n <StyledContent id={contentId} data-state={state} aria-hidden={state === \"closed\"} {...inertAttribute}>\n {children}\n </StyledContent>\n </StyledAside>\n );\n },\n);\n\nexport default FactBox;\n"],"mappings":";;;;;;;;AA8BA,MAAM,cAAc,OAAO,SAAS;CAClC,MAAM;EACJ,UAAU;EACV,SAAS;EACT,SAAS;EACT,kBAAkB;EAClB,oBAAoB;EACpB,oBAAoB;EACpB,0BAA0B;EAC1B,cAAc;EACd,QAAQ;EACR,aAAa;EACb,cAAc;EACd,OAAO;EACP,OAAO,EACL,kBAAkB,MACnB;EACD,SAAS,EACP,QAAQ;GACN,UAAU;GACV,WAAW;EACZ,EACF;EACD,WAAW,EACT,WAAW,kBACZ;CACF;CACD,UAAU,EACR,gBAAgB,EACd,MAAM,EACJ,WAAW,EACT,UAAU,SACX,EACF,EACF,EACF;AACF,EAAC;AAEF,MAAM,gBAAgB,OAAO,OAAO,EAClC,MAAM;CACJ,UAAU;CACV,OAAO;CAEP,kBAAkB,EAChB,kBAAkB,IACnB;CACD,QAAQ;EACN,SAAS;EACT,WAAW;EACX,UAAU;EACV,OAAO;EACP,oBAAoB;EACpB,oBAAoB;EACpB,0BAA0B;EAC1B,cAAc;EACd,YAAY;EACZ,oBAAoB;EACpB,SAAS;EACT,QAAQ;EACR,eAAe;CAChB;CACD,QAAQ;EACN,UAAU;EACV,QAAQ,EACN,SAAS,OACV;CACF;CACD,OAAO;EACL,iBAAiB;EACjB,QAAQ,EACN,SAAS,IACV;CACF;AACF,EACF,EAAC;AAEF,MAAM,mBAAmB,OAAO,YAAY,EAC1C,MAAM;CACJ,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,SAAS;EACP,oBAAoB;EACpB,0BAA0B;EAC1B,oBAAoB;CACrB;CACD,OAAO,EACL,SAAS,EACP,WAAW,iBACZ,EACF;CACD,QAAQ,EACN,SAAS,OACV;AACF,EACF,EAAC;AAIF,MAAM,UAAU,WACd,CAAC,EAAE,UAAU,MAAM,cAAc,cAAc,MAAO,GAAG,MAAM,EAAE,QAAQ;CACvE,MAAM,EAAE,GAAG,GAAG,gBAAgB;CAC9B,MAAM,CAAC,OAAO,SAAS,GAAG,SAA4B,cAAc,SAAS,SAAS;CACtF,MAAM,CAAC,gBAAgB,kBAAkB,GAAG,UAAU,YAAY;CAClE,MAAM,YAAY,OAAO;CAIzB,MAAM,iBAAiB,QAAQ,MAAM;AACnC,SAAO,UAAU,WAAW,EAAE,cAAc,MAAM,QAAQ,aAAa,OAAO,GAAI,IAAG,CAAE;CACxF,GAAE,CAAC,KAAM,EAAC;AAEX,WAAU,MAAM;AACd,MAAI,gBACF,UAAS,OAAO,SAAS,SAAS;CAErC,GAAE,CAAC,IAAK,EAAC;CAEV,MAAM,UAAU,YAAY,MAAM;EAChC,MAAM,WAAW,UAAU,SAAS,WAAW;AAC/C,WAAS,SAAS;AAClB,iBAAe,aAAa,OAAO;CACpC,GAAE,CAAC,OAAO,YAAa,EAAC;AAEzB,wBACE,KAAC;EACC,cAAY;EACZ,mBAAgB;EAChB,GAAI;EACC;EACW;EAChB,mBAAmB,CAAC,MAAM;AACxB,OAAI,EAAE,WAAW,EAAE,iBAAiB,UAAU,SAC5C,mBAAkB,KAAK;EAE1B;EACD,iBAAiB,CAAC,MAAM;AACtB,OAAI,EAAE,WAAW,EAAE,iBAAiB,UAAU,OAC5C,mBAAkB,MAAM;EAE3B;6BAED,IAAC;GACC,cAAY;GACH;GACT,iBAAiB;GACjB,iBAAe,UAAU;GACzB,iBAAe;GACf,cAAY,GAAG,UAAU,UAAU,SAAS,UAAU,OAAO,EAAE;6BAE/D,IAAC,uBAAqB;IACL,kBACnB,IAAC;GAAc,IAAI;GAAW,cAAY;GAAO,eAAa,UAAU;GAAU,GAAI;GACnF;IACa;GACJ;AAEjB,EACF;AAED,sBAAe"}
|
package/es/FactBox/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (c) 2018-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 { FactBox_default } from "./FactBox.js";
|
|
8
2
|
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
//#region src/FactBox/index.ts
|
|
4
|
+
var FactBox_default$1 = FactBox_default;
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { FactBox_default$1 as FactBox_default };
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["FactBox"],"sources":["../../src/FactBox/index.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 FactBox from \"./FactBox\";\n\nexport default FactBox;\n"],"mappings":";;;AAUA,wBAAeA"}
|
package/es/FileList/File.js
CHANGED
|
@@ -1,101 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (c) 2023-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
|
-
|
|
1
|
+
import { FileListItem } from "./FileList.js";
|
|
9
2
|
import { forwardRef } from "react";
|
|
3
|
+
import { Text } from "@ndla/primitives";
|
|
4
|
+
import { HStack, styled } from "@ndla/styled-system/jsx";
|
|
10
5
|
import { useTranslation } from "react-i18next";
|
|
11
6
|
import { DownloadLine } from "@ndla/icons";
|
|
12
|
-
import { Text } from "@ndla/primitives";
|
|
13
7
|
import { SafeLink } from "@ndla/safelink";
|
|
14
|
-
import {
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
9
|
import { linkOverlay } from "@ndla/styled-system/patterns";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const StyledSafeLink = styled(SafeLink, {
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
children: ["(", fileType?.toUpperCase(), ")"]
|
|
72
|
-
})
|
|
73
|
-
})]
|
|
74
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
75
|
-
textStyle: "label.large",
|
|
76
|
-
asChild: true,
|
|
77
|
-
consumeCss: true,
|
|
78
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
79
|
-
children: fileSize
|
|
80
|
-
})
|
|
81
|
-
})]
|
|
82
|
-
});
|
|
10
|
+
|
|
11
|
+
//#region src/FileList/File.tsx
|
|
12
|
+
const StyledSafeLink = styled(SafeLink, { base: {
|
|
13
|
+
textUnderlineOffset: "2px",
|
|
14
|
+
textDecoration: "underline",
|
|
15
|
+
_hover: { textDecoration: "none" }
|
|
16
|
+
} });
|
|
17
|
+
const StyledHStack = styled(HStack, { base: {
|
|
18
|
+
position: "relative",
|
|
19
|
+
paddingBlock: "small",
|
|
20
|
+
paddingInlineEnd: "medium",
|
|
21
|
+
paddingInlineStart: "small",
|
|
22
|
+
width: "100%"
|
|
23
|
+
} });
|
|
24
|
+
const File = forwardRef(({ title, url, fileExists, fileType, fileSize,...rest }, ref) => {
|
|
25
|
+
const { t } = useTranslation();
|
|
26
|
+
const filename = `${title}-${url.split("/").pop() ?? ""}`;
|
|
27
|
+
const downloadUrl = `${url}?download=${filename}`;
|
|
28
|
+
const tooltip = `${t("download")} ${filename}`;
|
|
29
|
+
return /* @__PURE__ */ jsxs(StyledHStack, {
|
|
30
|
+
justify: "space-between",
|
|
31
|
+
ref,
|
|
32
|
+
...rest,
|
|
33
|
+
children: [/* @__PURE__ */ jsxs(HStack, {
|
|
34
|
+
gap: "xxsmall",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsx(DownloadLine, {}),
|
|
37
|
+
fileExists ? /* @__PURE__ */ jsx(StyledSafeLink, {
|
|
38
|
+
unstyled: true,
|
|
39
|
+
css: linkOverlay.raw(),
|
|
40
|
+
to: downloadUrl,
|
|
41
|
+
title: tooltip,
|
|
42
|
+
children: title
|
|
43
|
+
}) : /* @__PURE__ */ jsx(Text, {
|
|
44
|
+
textStyle: "label.medium",
|
|
45
|
+
children: title
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ jsx(Text, {
|
|
48
|
+
textStyle: "label.large",
|
|
49
|
+
asChild: true,
|
|
50
|
+
consumeCss: true,
|
|
51
|
+
children: /* @__PURE__ */ jsxs("span", { children: [
|
|
52
|
+
"(",
|
|
53
|
+
fileType?.toUpperCase(),
|
|
54
|
+
")"
|
|
55
|
+
] })
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
59
|
+
textStyle: "label.large",
|
|
60
|
+
asChild: true,
|
|
61
|
+
consumeCss: true,
|
|
62
|
+
children: /* @__PURE__ */ jsx("span", { children: fileSize })
|
|
63
|
+
})]
|
|
64
|
+
});
|
|
83
65
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
url: url,
|
|
96
|
-
fileExists: fileExists,
|
|
97
|
-
fileType: fileType,
|
|
98
|
-
fileSize: fileSize
|
|
99
|
-
})
|
|
100
|
-
});
|
|
101
|
-
};
|
|
66
|
+
const FileListElement = ({ title, url, fileExists, fileType, fileSize }) => /* @__PURE__ */ jsx(FileListItem, { children: /* @__PURE__ */ jsx(File, {
|
|
67
|
+
title,
|
|
68
|
+
url,
|
|
69
|
+
fileExists,
|
|
70
|
+
fileType,
|
|
71
|
+
fileSize
|
|
72
|
+
}) });
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
export { File, FileListElement };
|
|
76
|
+
//# sourceMappingURL=File.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"File.js","names":[],"sources":["../../src/FileList/File.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentPropsWithRef, forwardRef } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { DownloadLine } from \"@ndla/icons\";\nimport { Text } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { HStack, styled } from \"@ndla/styled-system/jsx\";\nimport { linkOverlay } from \"@ndla/styled-system/patterns\";\nimport { FileListItem } from \".\";\n\nexport interface FileProps extends ComponentPropsWithRef<\"div\"> {\n title: string;\n url: string;\n fileExists: boolean;\n fileType: string;\n fileSize?: string;\n}\n\nexport interface FileType {\n title: string;\n formats: FileFormat[];\n fileExists?: boolean;\n}\n\nexport interface FileFormat {\n url: string;\n fileType: string;\n tooltip: string;\n}\n\nconst StyledSafeLink = styled(SafeLink, {\n base: {\n textUnderlineOffset: \"2px\",\n textDecoration: \"underline\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n});\n\nconst StyledHStack = styled(HStack, {\n base: {\n position: \"relative\",\n paddingBlock: \"small\",\n paddingInlineEnd: \"medium\",\n paddingInlineStart: \"small\",\n width: \"100%\",\n },\n});\n\nexport const File = forwardRef<HTMLDivElement, FileProps>(\n ({ title, url, fileExists, fileType, fileSize, ...rest }, ref) => {\n const { t } = useTranslation();\n const filename = `${title}-${url.split(\"/\").pop() ?? \"\"}`;\n const downloadUrl = `${url}?download=${filename}`;\n const tooltip = `${t(\"download\")} ${filename}`;\n\n return (\n <StyledHStack justify=\"space-between\" ref={ref} {...rest}>\n <HStack gap=\"xxsmall\">\n <DownloadLine />\n {fileExists ? (\n <StyledSafeLink unstyled css={linkOverlay.raw()} to={downloadUrl} title={tooltip}>\n {title}\n </StyledSafeLink>\n ) : (\n <Text textStyle=\"label.medium\">{title}</Text>\n )}\n <Text textStyle=\"label.large\" asChild consumeCss>\n <span>({fileType?.toUpperCase()})</span>\n </Text>\n </HStack>\n <Text textStyle=\"label.large\" asChild consumeCss>\n <span>{fileSize}</span>\n </Text>\n </StyledHStack>\n );\n },\n);\n\nexport const FileListElement = ({ title, url, fileExists, fileType, fileSize }: FileProps) => (\n <FileListItem>\n <File title={title} url={url} fileExists={fileExists} fileType={fileType} fileSize={fileSize} />\n </FileListItem>\n);\n"],"mappings":";;;;;;;;;;;AAqCA,MAAM,iBAAiB,OAAO,UAAU,EACtC,MAAM;CACJ,qBAAqB;CACrB,gBAAgB;CAChB,QAAQ,EACN,gBAAgB,OACjB;AACF,EACF,EAAC;AAEF,MAAM,eAAe,OAAO,QAAQ,EAClC,MAAM;CACJ,UAAU;CACV,cAAc;CACd,kBAAkB;CAClB,oBAAoB;CACpB,OAAO;AACR,EACF,EAAC;AAEF,MAAa,OAAO,WAClB,CAAC,EAAE,OAAO,KAAK,YAAY,UAAU,SAAU,GAAG,MAAM,EAAE,QAAQ;CAChE,MAAM,EAAE,GAAG,GAAG,gBAAgB;CAC9B,MAAM,YAAY,EAAE,MAAM,GAAG,IAAI,MAAM,IAAI,CAAC,KAAK,IAAI,GAAG;CACxD,MAAM,eAAe,EAAE,IAAI,YAAY,SAAS;CAChD,MAAM,WAAW,EAAE,EAAE,WAAW,CAAC,GAAG,SAAS;AAE7C,wBACE,KAAC;EAAa,SAAQ;EAAqB;EAAK,GAAI;6BAClD,KAAC;GAAO,KAAI;;oBACV,IAAC,iBAAe;IACf,6BACC,IAAC;KAAe;KAAS,KAAK,YAAY,KAAK;KAAE,IAAI;KAAa,OAAO;eACtE;MACc,mBAEjB,IAAC;KAAK,WAAU;eAAgB;MAAa;oBAE/C,IAAC;KAAK,WAAU;KAAc;KAAQ;+BACpC,KAAC;MAAK;MAAE,UAAU,aAAa;MAAC;SAAQ;MACnC;;IACA,kBACT,IAAC;GAAK,WAAU;GAAc;GAAQ;6BACpC,IAAC,oBAAM,WAAgB;IAClB;GACM;AAElB,EACF;AAED,MAAa,kBAAkB,CAAC,EAAE,OAAO,KAAK,YAAY,UAAU,UAAqB,qBACvF,IAAC,0CACC,IAAC;CAAY;CAAY;CAAiB;CAAsB;CAAoB;EAAY,GACnF"}
|
package/es/FileList/FileList.js
CHANGED
|
@@ -1,47 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (c) 2023-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
|
-
import { ark } from "@ark-ui/react";
|
|
1
|
+
import "react";
|
|
10
2
|
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
-
import { jsx
|
|
12
|
-
|
|
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
|
-
} = _ref;
|
|
42
|
-
return /*#__PURE__*/_jsx(FileListWrapper, {
|
|
43
|
-
...rest,
|
|
44
|
-
"data-embed-type": "file-list",
|
|
45
|
-
children: children
|
|
46
|
-
});
|
|
47
|
-
};
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { ark } from "@ark-ui/react";
|
|
5
|
+
|
|
6
|
+
//#region src/FileList/FileList.tsx
|
|
7
|
+
const FileListWrapper = styled(ark.ul, { base: {
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: "column",
|
|
10
|
+
gap: "xsmall",
|
|
11
|
+
clear: "both"
|
|
12
|
+
} }, { baseComponent: true });
|
|
13
|
+
const FileListItem = styled(ark.li, { base: {
|
|
14
|
+
listStyle: "none",
|
|
15
|
+
background: "surface.infoSubtle",
|
|
16
|
+
borderBlockEnd: "1px solid",
|
|
17
|
+
borderColor: "stroke.default",
|
|
18
|
+
display: "flex",
|
|
19
|
+
justifyContent: "space-between",
|
|
20
|
+
_hover: { backgroundColor: "surface.infoSubtle.hover" }
|
|
21
|
+
} }, { baseComponent: true });
|
|
22
|
+
const FileListEmbed = ({ children,...rest }) => {
|
|
23
|
+
return /* @__PURE__ */ jsx(FileListWrapper, {
|
|
24
|
+
...rest,
|
|
25
|
+
"data-embed-type": "file-list",
|
|
26
|
+
children
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { FileListEmbed, FileListItem, FileListWrapper };
|
|
32
|
+
//# sourceMappingURL=FileList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileList.js","names":[],"sources":["../../src/FileList/FileList.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { type ComponentPropsWithoutRef } from \"react\";\nimport { ark } from \"@ark-ui/react\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\ninterface Props extends ComponentPropsWithoutRef<\"ul\"> {}\n\nexport const FileListWrapper = styled(\n ark.ul,\n {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"xsmall\",\n clear: \"both\",\n },\n },\n { baseComponent: true },\n);\n\nexport const FileListItem = styled(\n ark.li,\n {\n base: {\n listStyle: \"none\",\n background: \"surface.infoSubtle\",\n borderBlockEnd: \"1px solid\",\n borderColor: \"stroke.default\",\n display: \"flex\",\n justifyContent: \"space-between\",\n\n _hover: {\n backgroundColor: \"surface.infoSubtle.hover\",\n },\n },\n },\n { baseComponent: true },\n);\n\nexport const FileListEmbed = ({ children, ...rest }: Props) => {\n return (\n <FileListWrapper {...rest} data-embed-type=\"file-list\">\n {children}\n </FileListWrapper>\n );\n};\n"],"mappings":";;;;;;AAcA,MAAa,kBAAkB,OAC7B,IAAI,IACJ,EACE,MAAM;CACJ,SAAS;CACT,eAAe;CACf,KAAK;CACL,OAAO;AACR,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,eAAe,OAC1B,IAAI,IACJ,EACE,MAAM;CACJ,WAAW;CACX,YAAY;CACZ,gBAAgB;CAChB,aAAa;CACb,SAAS;CACT,gBAAgB;CAEhB,QAAQ,EACN,iBAAiB,2BAClB;AACF,EACF,GACD,EAAE,eAAe,KAAM,EACxB;AAED,MAAa,gBAAgB,CAAC,EAAE,SAAU,GAAG,MAAa,KAAK;AAC7D,wBACE,IAAC;EAAgB,GAAI;EAAM,mBAAgB;EACxC;GACe;AAErB"}
|