@ndla/ui 56.0.121-alpha.0 → 56.0.122-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/lib/i18n/index.d.ts +1 -1
- package/lib/i18n/useComponentTranslations.d.ts +2 -1
- package/lib/index.d.ts +1 -1
- package/lib/locale/messages-en.d.ts +34 -0
- package/lib/locale/messages-nb.d.ts +34 -0
- package/lib/locale/messages-nn.d.ts +34 -0
- package/lib/locale/messages-se.d.ts +34 -0
- package/package.json +6 -5
- package/src/Article/ArticleByline.tsx +1 -1
- package/src/i18n/index.ts +1 -0
- package/src/i18n/useComponentTranslations.ts +36 -1
- package/src/index.ts +1 -0
- package/src/locale/messages-en.ts +34 -0
- package/src/locale/messages-nb.ts +34 -0
- package/src/locale/messages-nn.ts +34 -0
- package/src/locale/messages-se.ts +34 -0
- package/es/Article/Article.js +0 -199
- package/es/Article/ArticleByline.js +0 -182
- package/es/Article/ArticleFootNotes.js +0 -60
- package/es/Article/index.js +0 -11
- package/es/AudioPlayer/AudioPlayer.js +0 -218
- package/es/AudioPlayer/Controls.js +0 -332
- package/es/AudioPlayer/SpeechControl.js +0 -56
- package/es/AudioPlayer/index.js +0 -10
- package/es/Breadcrumb/Breadcrumb.js +0 -60
- package/es/Breadcrumb/BreadcrumbItem.js +0 -62
- package/es/Breadcrumb/HomeBreadcrumb.js +0 -77
- package/es/Breadcrumb/index.js +0 -11
- package/es/CampaignBlock/CampaignBlock.js +0 -180
- package/es/CampaignBlock/index.js +0 -9
- package/es/CodeBlock/CodeBlock.js +0 -35
- package/es/CodeBlock/codeLanguageOptions.js +0 -84
- package/es/CodeBlock/index.js +0 -10
- package/es/Concept/Concept.js +0 -72
- package/es/ContactBlock/ContactBlock.js +0 -199
- package/es/ContactBlock/index.js +0 -9
- package/es/ContentTypeBadge/ContentTypeBadge.js +0 -50
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +0 -32
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +0 -32
- package/es/ContentTypeHero/ContentTypeHero.js +0 -50
- package/es/ContentTypeHero/index.js +0 -9
- package/es/CopyParagraphButton/CopyParagraphButton.js +0 -83
- package/es/CopyParagraphButton/index.js +0 -11
- package/es/Embed/AudioEmbed.js +0 -76
- package/es/Embed/BrightcoveEmbed.js +0 -133
- package/es/Embed/CodeEmbed.js +0 -79
- package/es/Embed/ConceptEmbed.js +0 -123
- package/es/Embed/ConceptInlineTriggerButton.js +0 -45
- package/es/Embed/ContentLinkEmbed.js +0 -51
- package/es/Embed/CopyrightEmbed.js +0 -33
- package/es/Embed/EmbedErrorPlaceholder.js +0 -58
- package/es/Embed/EmbedWrapper.js +0 -51
- package/es/Embed/ExternalEmbed.js +0 -74
- package/es/Embed/FootnoteEmbed.js +0 -44
- package/es/Embed/GlossEmbed.js +0 -80
- package/es/Embed/H5pEmbed.js +0 -61
- package/es/Embed/IframeEmbed.js +0 -93
- package/es/Embed/ImageEmbed.js +0 -238
- package/es/Embed/InlineTriggerButton.js +0 -37
- package/es/Embed/RelatedContentEmbed.js +0 -55
- package/es/Embed/UnknownEmbed.js +0 -31
- package/es/Embed/UuDisclaimerEmbed.js +0 -88
- package/es/Embed/index.js +0 -25
- package/es/Embed/types.js +0 -1
- package/es/ErrorMessage/ErrorMessage.js +0 -95
- package/es/ErrorMessage/index.js +0 -10
- package/es/FactBox/FactBox.js +0 -177
- package/es/FactBox/index.js +0 -10
- package/es/FileList/File.js +0 -101
- package/es/FileList/FileList.js +0 -47
- package/es/FileList/PdfFile.js +0 -50
- package/es/FileList/index.js +0 -11
- package/es/Gloss/Gloss.js +0 -175
- package/es/Gloss/GlossExample.js +0 -64
- package/es/Gloss/index.js +0 -10
- package/es/Grid/Grid.js +0 -94
- package/es/Grid/GridParallaxItem.js +0 -32
- package/es/Grid/index.js +0 -10
- package/es/KeyFigure/KeyFigure.js +0 -63
- package/es/KeyFigure/index.js +0 -9
- package/es/LicenseByline/EmbedByline.js +0 -212
- package/es/LicenseByline/LicenseLink.js +0 -56
- package/es/LicenseByline/index.js +0 -10
- package/es/LinkBlock/LinkBlock.js +0 -103
- package/es/LinkBlock/LinkBlockSection.js +0 -35
- package/es/LinkBlock/index.js +0 -10
- package/es/Pitch/Pitch.js +0 -83
- package/es/Pitch/index.js +0 -9
- package/es/RelatedArticleList/RelatedArticleList.js +0 -135
- package/es/RelatedArticleList/index.js +0 -11
- package/es/ResourceBox/ResourceBox.js +0 -99
- package/es/ResourceBox/index.js +0 -10
- package/es/TagSelector/TagSelector.js +0 -143
- package/es/ZendeskButton/ZendeskButton.js +0 -55
- package/es/i18n/formatNestedMessages.js +0 -25
- package/es/i18n/i18n.js +0 -35
- package/es/i18n/index.js +0 -11
- package/es/i18n/useComponentTranslations.js +0 -164
- package/es/index.js +0 -45
- package/es/locale/messages-en.js +0 -428
- package/es/locale/messages-nb.js +0 -428
- package/es/locale/messages-nn.js +0 -428
- package/es/locale/messages-se.js +0 -428
- package/es/model/ContentType.js +0 -68
- package/es/model/SubjectCategories.js +0 -12
- package/es/model/SubjectTypes.js +0 -11
- package/es/model/WordClass.js +0 -45
- package/es/model/index.js +0 -21
- package/es/types.js +0 -1
- package/es/utils/licenseAttributes.js +0 -18
- package/es/utils/relativeUrl.js +0 -37
- package/lib/Article/Article.js +0 -207
- package/lib/Article/ArticleByline.js +0 -189
- package/lib/Article/ArticleFootNotes.js +0 -67
- package/lib/Article/index.js +0 -68
- package/lib/AudioPlayer/AudioPlayer.js +0 -224
- package/lib/AudioPlayer/Controls.js +0 -338
- package/lib/AudioPlayer/SpeechControl.js +0 -62
- package/lib/AudioPlayer/index.js +0 -16
- package/lib/Breadcrumb/Breadcrumb.js +0 -67
- package/lib/Breadcrumb/BreadcrumbItem.js +0 -68
- package/lib/Breadcrumb/HomeBreadcrumb.js +0 -84
- package/lib/Breadcrumb/index.js +0 -23
- package/lib/CampaignBlock/CampaignBlock.js +0 -187
- package/lib/CampaignBlock/index.js +0 -13
- package/lib/CodeBlock/CodeBlock.js +0 -41
- package/lib/CodeBlock/codeLanguageOptions.js +0 -90
- package/lib/CodeBlock/index.js +0 -20
- package/lib/Concept/Concept.js +0 -78
- package/lib/ContactBlock/ContactBlock.js +0 -206
- package/lib/ContactBlock/index.js +0 -18
- package/lib/ContentTypeBadge/ContentTypeBadge.js +0 -57
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +0 -38
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +0 -38
- package/lib/ContentTypeHero/ContentTypeHero.js +0 -57
- package/lib/ContentTypeHero/index.js +0 -12
- package/lib/CopyParagraphButton/CopyParagraphButton.js +0 -89
- package/lib/CopyParagraphButton/index.js +0 -22
- package/lib/Embed/AudioEmbed.js +0 -84
- package/lib/Embed/BrightcoveEmbed.js +0 -142
- package/lib/Embed/CodeEmbed.js +0 -86
- package/lib/Embed/ConceptEmbed.js +0 -131
- package/lib/Embed/ConceptInlineTriggerButton.js +0 -51
- package/lib/Embed/ContentLinkEmbed.js +0 -57
- package/lib/Embed/CopyrightEmbed.js +0 -39
- package/lib/Embed/EmbedErrorPlaceholder.js +0 -64
- package/lib/Embed/EmbedWrapper.js +0 -57
- package/lib/Embed/ExternalEmbed.js +0 -81
- package/lib/Embed/FootnoteEmbed.js +0 -50
- package/lib/Embed/GlossEmbed.js +0 -88
- package/lib/Embed/H5pEmbed.js +0 -68
- package/lib/Embed/IframeEmbed.js +0 -100
- package/lib/Embed/ImageEmbed.js +0 -248
- package/lib/Embed/InlineTriggerButton.js +0 -43
- package/lib/Embed/RelatedContentEmbed.js +0 -61
- package/lib/Embed/UnknownEmbed.js +0 -37
- package/lib/Embed/UuDisclaimerEmbed.js +0 -94
- package/lib/Embed/index.js +0 -150
- package/lib/Embed/types.js +0 -5
- package/lib/ErrorMessage/ErrorMessage.js +0 -101
- package/lib/ErrorMessage/index.js +0 -16
- package/lib/FactBox/FactBox.js +0 -184
- package/lib/FactBox/index.js +0 -16
- package/lib/FileList/File.js +0 -108
- package/lib/FileList/FileList.js +0 -54
- package/lib/FileList/PdfFile.js +0 -57
- package/lib/FileList/index.js +0 -44
- package/lib/Gloss/Gloss.js +0 -181
- package/lib/Gloss/GlossExample.js +0 -70
- package/lib/Gloss/index.js +0 -20
- package/lib/Grid/Grid.js +0 -101
- package/lib/Grid/GridParallaxItem.js +0 -39
- package/lib/Grid/index.js +0 -19
- package/lib/KeyFigure/KeyFigure.js +0 -70
- package/lib/KeyFigure/index.js +0 -13
- package/lib/LicenseByline/EmbedByline.js +0 -220
- package/lib/LicenseByline/LicenseLink.js +0 -62
- package/lib/LicenseByline/index.js +0 -19
- package/lib/LinkBlock/LinkBlock.js +0 -110
- package/lib/LinkBlock/LinkBlockSection.js +0 -41
- package/lib/LinkBlock/index.js +0 -20
- package/lib/Pitch/Pitch.js +0 -91
- package/lib/Pitch/index.js +0 -12
- package/lib/RelatedArticleList/RelatedArticleList.js +0 -143
- package/lib/RelatedArticleList/index.js +0 -21
- package/lib/ResourceBox/ResourceBox.js +0 -106
- package/lib/ResourceBox/index.js +0 -13
- package/lib/TagSelector/TagSelector.js +0 -150
- package/lib/ZendeskButton/ZendeskButton.js +0 -61
- package/lib/i18n/formatNestedMessages.js +0 -32
- package/lib/i18n/i18n.js +0 -41
- package/lib/i18n/index.js +0 -62
- package/lib/i18n/useComponentTranslations.js +0 -176
- package/lib/index.js +0 -593
- package/lib/locale/messages-en.js +0 -435
- package/lib/locale/messages-nb.js +0 -435
- package/lib/locale/messages-nn.js +0 -435
- package/lib/locale/messages-se.js +0 -435
- package/lib/model/ContentType.js +0 -74
- package/lib/model/SubjectCategories.js +0 -18
- package/lib/model/SubjectTypes.js +0 -17
- package/lib/model/WordClass.js +0 -51
- package/lib/model/index.js +0 -28
- package/lib/types.js +0 -5
- package/lib/utils/licenseAttributes.js +0 -25
- package/lib/utils/relativeUrl.js +0 -44
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactI18next = require("react-i18next");
|
|
9
|
-
var _primitives = require("@ndla/primitives");
|
|
10
|
-
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
11
|
-
var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
|
|
12
|
-
var _ResourceBox = require("../ResourceBox");
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
/**
|
|
16
|
-
* Copyright (c) 2023-present, NDLA.
|
|
17
|
-
*
|
|
18
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
19
|
-
* LICENSE file in the root directory of this source tree.
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
const StyledFigure = (0, _jsx2.styled)(_primitives.Figure, {
|
|
24
|
-
base: {
|
|
25
|
-
"& iframe": {
|
|
26
|
-
height: "auto",
|
|
27
|
-
width: "100%"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
const ExternalEmbed = _ref => {
|
|
32
|
-
let {
|
|
33
|
-
embed
|
|
34
|
-
} = _ref;
|
|
35
|
-
const {
|
|
36
|
-
t
|
|
37
|
-
} = (0, _reactI18next.useTranslation)();
|
|
38
|
-
const figRef = (0, _react.useRef)(null);
|
|
39
|
-
(0, _react.useEffect)(() => {
|
|
40
|
-
const iframe = figRef.current?.querySelector("iframe");
|
|
41
|
-
if (iframe) {
|
|
42
|
-
const [width, height] = [Number.parseInt(iframe.width), Number.parseInt(iframe.height)];
|
|
43
|
-
iframe.style.aspectRatio = `${width ? width : 16}/${height ? height : 9}`;
|
|
44
|
-
iframe.width = "";
|
|
45
|
-
iframe.height = "";
|
|
46
|
-
}
|
|
47
|
-
}, []);
|
|
48
|
-
if (embed.status === "error") {
|
|
49
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmbedErrorPlaceholder.default, {
|
|
50
|
-
type: "external"
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
const {
|
|
54
|
-
embedData,
|
|
55
|
-
data
|
|
56
|
-
} = embed;
|
|
57
|
-
if (embedData.type === "fullscreen") {
|
|
58
|
-
const image = {
|
|
59
|
-
src: data.iframeImage?.image.imageUrl,
|
|
60
|
-
alt: embedData.alt !== undefined ? embedData.alt : data.iframeImage?.alttext?.alttext ?? ""
|
|
61
|
-
};
|
|
62
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Figure, {
|
|
63
|
-
"data-embed-type": "external",
|
|
64
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResourceBox.ResourceBox, {
|
|
65
|
-
image: image,
|
|
66
|
-
title: embedData.title ?? "",
|
|
67
|
-
url: embedData.url,
|
|
68
|
-
caption: embedData.caption ?? "",
|
|
69
|
-
buttonText: t("license.other.itemImage.ariaLabel")
|
|
70
|
-
})
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFigure, {
|
|
74
|
-
"data-embed-type": "external",
|
|
75
|
-
ref: figRef,
|
|
76
|
-
dangerouslySetInnerHTML: {
|
|
77
|
-
__html: data?.oembed?.html ?? ""
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
var _default = exports.default = ExternalEmbed;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _reactI18next = require("react-i18next");
|
|
8
|
-
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
/**
|
|
11
|
-
* Copyright (c) 2023-present, NDLA.
|
|
12
|
-
*
|
|
13
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
14
|
-
* LICENSE file in the root directory of this source tree.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
const StyledSup = (0, _jsx2.styled)("sup", {
|
|
19
|
-
base: {
|
|
20
|
-
"& a": {
|
|
21
|
-
textStyle: "label.xsmall",
|
|
22
|
-
marginInlineStart: "1"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
const FootnoteEmbed = _ref => {
|
|
27
|
-
let {
|
|
28
|
-
embed
|
|
29
|
-
} = _ref;
|
|
30
|
-
const {
|
|
31
|
-
t
|
|
32
|
-
} = (0, _reactI18next.useTranslation)();
|
|
33
|
-
if (embed.status === "error") {
|
|
34
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
35
|
-
children: t("error")
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
39
|
-
id: `ref${embed.data.entryNum}`,
|
|
40
|
-
"data-embed-type": "footnote",
|
|
41
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSup, {
|
|
42
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
43
|
-
href: `#note${embed.data.entryNum}`,
|
|
44
|
-
target: "_self",
|
|
45
|
-
children: `[${embed.data.entryNum}]`
|
|
46
|
-
})
|
|
47
|
-
})
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
var _default = exports.default = FootnoteEmbed;
|
package/lib/Embed/GlossEmbed.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.GlossEmbed = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _react2 = require("@ark-ui/react");
|
|
9
|
-
var _primitives = require("@ndla/primitives");
|
|
10
|
-
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
11
|
-
var _ConceptInlineTriggerButton = require("./ConceptInlineTriggerButton");
|
|
12
|
-
var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
|
|
13
|
-
var _Gloss = require("../Gloss");
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
/**
|
|
17
|
-
* Copyright (c) 2024-present, NDLA.
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
20
|
-
* LICENSE file in the root directory of this source tree.
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
const StyledPopoverContent = (0, _jsx2.styled)(_primitives.PopoverContent, {
|
|
25
|
-
base: {
|
|
26
|
-
width: "surface.xlarge"
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
const GlossEmbed = _ref => {
|
|
30
|
-
let {
|
|
31
|
-
embed
|
|
32
|
-
} = _ref;
|
|
33
|
-
const contentRef = (0, _react.useRef)(null);
|
|
34
|
-
if (embed.status === "error" && embed.embedData.type === "inline") {
|
|
35
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
36
|
-
children: embed.embedData.linkText
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
if (embed.status === "error" || !embed.data.concept.glossData) {
|
|
40
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmbedErrorPlaceholder.default, {
|
|
41
|
-
type: "gloss"
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
const {
|
|
45
|
-
concept,
|
|
46
|
-
visualElement
|
|
47
|
-
} = embed.data;
|
|
48
|
-
const audio = visualElement?.status === "success" && visualElement.resource === "audio" ? {
|
|
49
|
-
src: visualElement.data.audioFile.url,
|
|
50
|
-
title: visualElement.data.title.title
|
|
51
|
-
} : undefined;
|
|
52
|
-
if (embed.embedData.type === "inline") {
|
|
53
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.PopoverRoot, {
|
|
54
|
-
initialFocusEl: () => contentRef.current,
|
|
55
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.PopoverTrigger, {
|
|
56
|
-
asChild: true,
|
|
57
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConceptInlineTriggerButton.ConceptInlineTriggerButton, {
|
|
58
|
-
children: embed.embedData.linkText
|
|
59
|
-
})
|
|
60
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Portal, {
|
|
61
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledPopoverContent, {
|
|
62
|
-
ref: contentRef,
|
|
63
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Figure, {
|
|
64
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Gloss.Gloss, {
|
|
65
|
-
glossData: concept.glossData,
|
|
66
|
-
title: concept.title,
|
|
67
|
-
audio: audio,
|
|
68
|
-
exampleIds: embed.embedData.exampleIds,
|
|
69
|
-
exampleLangs: embed.embedData.exampleLangs
|
|
70
|
-
})
|
|
71
|
-
})
|
|
72
|
-
})
|
|
73
|
-
})]
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Figure, {
|
|
77
|
-
"data-embed-type": "gloss",
|
|
78
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Gloss.Gloss, {
|
|
79
|
-
glossData: concept.glossData,
|
|
80
|
-
title: concept.title,
|
|
81
|
-
audio: audio,
|
|
82
|
-
exampleIds: embed.embedData.exampleIds,
|
|
83
|
-
exampleLangs: embed.embedData.exampleLangs,
|
|
84
|
-
variant: "bordered"
|
|
85
|
-
})
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
exports.GlossEmbed = GlossEmbed;
|
package/lib/Embed/H5pEmbed.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _reactI18next = require("react-i18next");
|
|
8
|
-
var _primitives = require("@ndla/primitives");
|
|
9
|
-
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
10
|
-
var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
/**
|
|
14
|
-
* Copyright (c) 2023-present, NDLA.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const StyledFigure = (0, _jsx2.styled)(_primitives.Figure, {
|
|
22
|
-
base: {
|
|
23
|
-
"& iframe": {
|
|
24
|
-
height: "auto",
|
|
25
|
-
width: "100%"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
const FigureOembed = (0, _jsx2.styled)(_primitives.Figure, {
|
|
30
|
-
base: {
|
|
31
|
-
width: "100%",
|
|
32
|
-
"& iframe": {
|
|
33
|
-
width: "100%"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const H5pEmbed = _ref => {
|
|
38
|
-
let {
|
|
39
|
-
embed
|
|
40
|
-
} = _ref;
|
|
41
|
-
const {
|
|
42
|
-
t
|
|
43
|
-
} = (0, _reactI18next.useTranslation)();
|
|
44
|
-
if (embed.status === "error") {
|
|
45
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmbedErrorPlaceholder.default, {
|
|
46
|
-
type: "h5p"
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
if (embed.data.oembed) {
|
|
50
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(FigureOembed, {
|
|
51
|
-
"data-embed-type": "h5p",
|
|
52
|
-
dangerouslySetInnerHTML: {
|
|
53
|
-
__html: embed.data.oembed.html ?? ""
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
const title = embed.embedData.title?.trim() ? embed.embedData.title : embed.data.h5pLicenseInformation?.h5p.title?.trim() ? embed.data.h5pLicenseInformation.h5p.title : embed.embedData.url;
|
|
58
|
-
const titleWithPrefix = `${t("embed.type.h5p")}: ${title}`;
|
|
59
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFigure, {
|
|
60
|
-
"data-embed-type": "h5p",
|
|
61
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("iframe", {
|
|
62
|
-
title: titleWithPrefix,
|
|
63
|
-
"aria-label": titleWithPrefix,
|
|
64
|
-
src: embed.embedData.url
|
|
65
|
-
})
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
var _default = exports.default = H5pEmbed;
|
package/lib/Embed/IframeEmbed.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactI18next = require("react-i18next");
|
|
9
|
-
var _primitives = require("@ndla/primitives");
|
|
10
|
-
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
11
|
-
var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
|
|
12
|
-
var _ResourceBox = require("../ResourceBox");
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
/**
|
|
16
|
-
* Copyright (c) 2023-present, NDLA.
|
|
17
|
-
*
|
|
18
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
19
|
-
* LICENSE file in the root directory of this source tree.
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
const StyledIframe = (0, _jsx2.styled)("iframe", {
|
|
24
|
-
base: {
|
|
25
|
-
width: "100%",
|
|
26
|
-
border: 0
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
const StyledFigure = (0, _jsx2.styled)(_primitives.Figure, {
|
|
30
|
-
base: {
|
|
31
|
-
clear: "both"
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const IframeEmbed = _ref => {
|
|
35
|
-
let {
|
|
36
|
-
embed
|
|
37
|
-
} = _ref;
|
|
38
|
-
const {
|
|
39
|
-
t
|
|
40
|
-
} = (0, _reactI18next.useTranslation)();
|
|
41
|
-
const iframeRef = (0, _react.useRef)(null);
|
|
42
|
-
(0, _react.useEffect)(() => {
|
|
43
|
-
const iframe = iframeRef.current;
|
|
44
|
-
if (iframe) {
|
|
45
|
-
const [width, height] = [Number.parseInt(iframe.width), Number.parseInt(iframe.height)];
|
|
46
|
-
iframe.style.aspectRatio = `${width ? width : 16}/${height ? height : 9}`;
|
|
47
|
-
iframe.width = "";
|
|
48
|
-
iframe.height = "";
|
|
49
|
-
}
|
|
50
|
-
}, []);
|
|
51
|
-
if (embed.status === "error") {
|
|
52
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmbedErrorPlaceholder.default, {
|
|
53
|
-
type: "external"
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
const {
|
|
57
|
-
embedData,
|
|
58
|
-
data
|
|
59
|
-
} = embed;
|
|
60
|
-
if (embedData.type === "fullscreen") {
|
|
61
|
-
const iframeImage = embed.status === "success" ? data.iframeImage : undefined;
|
|
62
|
-
const alt = embedData.alt !== undefined ? embedData.alt : iframeImage?.alttext.alttext;
|
|
63
|
-
const image = {
|
|
64
|
-
src: iframeImage?.image.imageUrl,
|
|
65
|
-
alt: alt ?? ""
|
|
66
|
-
};
|
|
67
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFigure, {
|
|
68
|
-
"data-embed-type": "iframe",
|
|
69
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResourceBox.ResourceBox, {
|
|
70
|
-
image: image,
|
|
71
|
-
title: embedData.title ?? "",
|
|
72
|
-
url: embedData.url,
|
|
73
|
-
caption: embedData.caption ?? "",
|
|
74
|
-
buttonText: t("license.other.itemImage.ariaLabel")
|
|
75
|
-
})
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
const {
|
|
79
|
-
width,
|
|
80
|
-
height,
|
|
81
|
-
url
|
|
82
|
-
} = embedData;
|
|
83
|
-
const strippedWidth = typeof width === "number" ? width : width?.replace(/\s*px/, "");
|
|
84
|
-
const strippedHeight = typeof height === "number" ? height : height?.replace(/\s*px/, "");
|
|
85
|
-
const title = `${t("embed.type.external")}: ${embedData.title?.trim() ? embedData.title : url}`;
|
|
86
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFigure, {
|
|
87
|
-
"data-embed-type": "iframe",
|
|
88
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledIframe, {
|
|
89
|
-
ref: iframeRef,
|
|
90
|
-
title: title,
|
|
91
|
-
"aria-label": title,
|
|
92
|
-
src: url,
|
|
93
|
-
width: strippedWidth,
|
|
94
|
-
height: strippedHeight,
|
|
95
|
-
allow: "fullscreen; encrypted-media",
|
|
96
|
-
loading: "lazy"
|
|
97
|
-
})
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
var _default = exports.default = IframeEmbed;
|
package/lib/Embed/ImageEmbed.js
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getLicenseCredits = exports.getFocalPoint = exports.getCrop = exports.default = void 0;
|
|
7
|
-
var _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _reactI18next = require("react-i18next");
|
|
10
|
-
var _icons = require("@ndla/icons");
|
|
11
|
-
var _primitives = require("@ndla/primitives");
|
|
12
|
-
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
13
|
-
var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
|
|
14
|
-
var _LicenseByline = require("../LicenseByline");
|
|
15
|
-
var _licenseAttributes = require("../utils/licenseAttributes");
|
|
16
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
-
/**
|
|
19
|
-
* Copyright (c) 2023-present, NDLA.
|
|
20
|
-
*
|
|
21
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
22
|
-
* LICENSE file in the root directory of this source tree.
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
const getLicenseCredits = copyright => {
|
|
27
|
-
return {
|
|
28
|
-
creators: copyright?.creators ?? [],
|
|
29
|
-
rightsholders: copyright?.rightsholders ?? [],
|
|
30
|
-
processors: copyright?.processors ?? []
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
exports.getLicenseCredits = getLicenseCredits;
|
|
34
|
-
const getFigureProps = (size, float) => {
|
|
35
|
-
const actualFloat = float === "left" ? "left" : float === "right" ? "right" : undefined;
|
|
36
|
-
const replacedSize = size?.replace("-hide-byline", "") ?? "full";
|
|
37
|
-
const actualSize = replacedSize === "fullwidth" ? "full" : replacedSize;
|
|
38
|
-
return {
|
|
39
|
-
float: actualFloat,
|
|
40
|
-
// Figure expects you to set a size when floating. If you don't, the figure will simply take up the available width. Fallback to medium in those cases.
|
|
41
|
-
size: actualSize === "full" && float ? "medium" : actualSize
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
const getSizes = (size, align) => {
|
|
45
|
-
if (align && size === "full") {
|
|
46
|
-
return "(min-width: 1024px) 512px, (min-width: 768px) 350px, 100vw";
|
|
47
|
-
}
|
|
48
|
-
if (align && size === "small") {
|
|
49
|
-
return "(min-width: 1024px) 350px, (min-width: 768px) 180px, 100vw";
|
|
50
|
-
}
|
|
51
|
-
if (align && size === "xsmall") {
|
|
52
|
-
return "(min-width: 1024px) 180px, (min-width: 768px) 180px, 100vw";
|
|
53
|
-
}
|
|
54
|
-
return "(min-width: 1024px) 1024px, 100vw";
|
|
55
|
-
};
|
|
56
|
-
const getFocalPoint = data => {
|
|
57
|
-
const focalX = Number.parseFloat(data.focalX ?? "");
|
|
58
|
-
const focalY = Number.parseFloat(data.focalY ?? "");
|
|
59
|
-
if (!Number.isNaN(focalX) && !Number.isNaN(focalY)) {
|
|
60
|
-
return {
|
|
61
|
-
x: focalX,
|
|
62
|
-
y: focalY
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
return undefined;
|
|
66
|
-
};
|
|
67
|
-
exports.getFocalPoint = getFocalPoint;
|
|
68
|
-
const getCrop = data => {
|
|
69
|
-
const lowerRightX = Number.parseFloat(data.lowerRightX ?? "");
|
|
70
|
-
const lowerRightY = Number.parseFloat(data.lowerRightY ?? "");
|
|
71
|
-
const upperLeftX = Number.parseFloat(data.upperLeftX ?? "");
|
|
72
|
-
const upperLeftY = Number.parseFloat(data.upperLeftY ?? "");
|
|
73
|
-
if (!Number.isNaN(lowerRightX) && !Number.isNaN(lowerRightY) && !Number.isNaN(upperLeftX) && !Number.isNaN(upperLeftY)) {
|
|
74
|
-
return {
|
|
75
|
-
startX: lowerRightX,
|
|
76
|
-
startY: lowerRightY,
|
|
77
|
-
endX: upperLeftX,
|
|
78
|
-
endY: upperLeftY
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return undefined;
|
|
82
|
-
};
|
|
83
|
-
exports.getCrop = getCrop;
|
|
84
|
-
const expandedSizes = "(min-width: 1024px) 1024px, 100vw";
|
|
85
|
-
const ImageWrapper = (0, _jsx2.styled)("div", {
|
|
86
|
-
base: {
|
|
87
|
-
overflow: "hidden",
|
|
88
|
-
position: "relative",
|
|
89
|
-
width: "100%",
|
|
90
|
-
"& img": {
|
|
91
|
-
width: "100%"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
variants: {
|
|
95
|
-
svg: {
|
|
96
|
-
true: {
|
|
97
|
-
display: "flex",
|
|
98
|
-
justifyContent: "center"
|
|
99
|
-
},
|
|
100
|
-
false: {}
|
|
101
|
-
},
|
|
102
|
-
border: {
|
|
103
|
-
true: {
|
|
104
|
-
border: "1px solid",
|
|
105
|
-
borderColor: "stroke.subtle",
|
|
106
|
-
borderRadius: "xsmall",
|
|
107
|
-
"& img": {
|
|
108
|
-
borderRadius: "0"
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
false: {}
|
|
112
|
-
},
|
|
113
|
-
expandable: {
|
|
114
|
-
true: {
|
|
115
|
-
cursor: "pointer"
|
|
116
|
-
},
|
|
117
|
-
false: {}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
const StyledFigure = (0, _jsx2.styled)(_primitives.Figure, {
|
|
122
|
-
base: {
|
|
123
|
-
zIndex: "docked",
|
|
124
|
-
_hover: {
|
|
125
|
-
"& [data-byline-button]": {
|
|
126
|
-
background: "background.default"
|
|
127
|
-
},
|
|
128
|
-
"& button[data-expanded]": {
|
|
129
|
-
transform: "scale(1.2)"
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
"& button[data-expanded='true']": {
|
|
133
|
-
"& svg": {
|
|
134
|
-
transform: "rotate(-45deg)"
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
const ExpandButton = (0, _jsx2.styled)("button", {
|
|
140
|
-
base: {
|
|
141
|
-
display: "flex",
|
|
142
|
-
alignItems: "center",
|
|
143
|
-
justifyContent: "center",
|
|
144
|
-
cursor: "pointer",
|
|
145
|
-
position: "absolute",
|
|
146
|
-
padding: "0",
|
|
147
|
-
top: "xsmall",
|
|
148
|
-
right: "xsmall",
|
|
149
|
-
width: "medium",
|
|
150
|
-
height: "medium",
|
|
151
|
-
border: "2px solid",
|
|
152
|
-
borderColor: "background.default",
|
|
153
|
-
transitionProperty: "transform, background-color, color",
|
|
154
|
-
transitionDuration: "normal",
|
|
155
|
-
transitionTimingFunction: "ease-out",
|
|
156
|
-
color: "background.default",
|
|
157
|
-
backgroundColor: "surface.action",
|
|
158
|
-
borderRadius: "large",
|
|
159
|
-
"& svg": {
|
|
160
|
-
transitionProperty: "transform",
|
|
161
|
-
transitionDuration: "normal",
|
|
162
|
-
transitionTimingFunction: "ease-out"
|
|
163
|
-
},
|
|
164
|
-
tabletDown: {
|
|
165
|
-
display: "none"
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}, {
|
|
169
|
-
defaultProps: {
|
|
170
|
-
type: "button"
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
const ImageEmbed = _ref => {
|
|
174
|
-
let {
|
|
175
|
-
embed,
|
|
176
|
-
previewAlt,
|
|
177
|
-
lang,
|
|
178
|
-
renderContext = "article",
|
|
179
|
-
children
|
|
180
|
-
} = _ref;
|
|
181
|
-
const [imageSizes, setImageSizes] = (0, _react.useState)(undefined);
|
|
182
|
-
const figureProps = getFigureProps(embed.embedData.size, embed.embedData.align);
|
|
183
|
-
const {
|
|
184
|
-
t
|
|
185
|
-
} = (0, _reactI18next.useTranslation)();
|
|
186
|
-
const parsedDescription = (0, _react.useMemo)(() => {
|
|
187
|
-
if (embed.embedData.caption || renderContext === "article") {
|
|
188
|
-
return embed.embedData.caption ? (0, _htmlReactParser.default)(embed.embedData.caption) : undefined;
|
|
189
|
-
}
|
|
190
|
-
if (embed.status === "success" && embed.data.caption.caption) {
|
|
191
|
-
return (0, _htmlReactParser.default)(embed.data.caption.caption);
|
|
192
|
-
}
|
|
193
|
-
}, [embed, renderContext]);
|
|
194
|
-
if (embed.status === "error") {
|
|
195
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmbedErrorPlaceholder.default, {
|
|
196
|
-
type: "image",
|
|
197
|
-
figureType: figureProps?.size,
|
|
198
|
-
float: figureProps?.float
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
const {
|
|
202
|
-
data,
|
|
203
|
-
embedData
|
|
204
|
-
} = embed;
|
|
205
|
-
const altText = embedData.alt || "";
|
|
206
|
-
const sizes = getSizes(embedData.size, embedData.align);
|
|
207
|
-
const focalPoint = getFocalPoint(embedData);
|
|
208
|
-
const crop = getCrop(embedData);
|
|
209
|
-
const toggleImageSize = () => {
|
|
210
|
-
setImageSizes(sizes => !sizes ? expandedSizes : undefined);
|
|
211
|
-
};
|
|
212
|
-
const licenseProps = (0, _licenseAttributes.licenseAttributes)(data.copyright.license.license, lang, embedData.url);
|
|
213
|
-
const figureSize = figureProps?.float ? figureProps?.size ?? "medium" : "full";
|
|
214
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledFigure, {
|
|
215
|
-
float: figureProps?.float,
|
|
216
|
-
size: imageSizes ? "full" : figureSize,
|
|
217
|
-
"data-embed-type": "image",
|
|
218
|
-
...licenseProps,
|
|
219
|
-
children: [children, /*#__PURE__*/(0, _jsxRuntime.jsxs)(ImageWrapper, {
|
|
220
|
-
border: embedData.border === "true",
|
|
221
|
-
expandable: !!figureProps?.float,
|
|
222
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Image, {
|
|
223
|
-
focalPoint: focalPoint,
|
|
224
|
-
contentType: data.image.contentType,
|
|
225
|
-
crop: crop,
|
|
226
|
-
sizes: imageSizes ?? sizes,
|
|
227
|
-
alt: altText,
|
|
228
|
-
src: data.image.imageUrl,
|
|
229
|
-
lang: lang,
|
|
230
|
-
onClick: figureProps?.float ? toggleImageSize : undefined,
|
|
231
|
-
variant: "rounded"
|
|
232
|
-
}), (embedData.align === "right" || embedData.align === "left") && /*#__PURE__*/(0, _jsxRuntime.jsx)(ExpandButton, {
|
|
233
|
-
"aria-label": t(`license.images.itemImage.zoom${imageSizes ? "Out" : ""}ImageButtonLabel`),
|
|
234
|
-
onClick: toggleImageSize,
|
|
235
|
-
"data-expanded": !!imageSizes,
|
|
236
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.AddLine, {})
|
|
237
|
-
})]
|
|
238
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LicenseByline.EmbedByline, {
|
|
239
|
-
type: "image",
|
|
240
|
-
copyright: data.copyright,
|
|
241
|
-
description: parsedDescription,
|
|
242
|
-
hideDescription: embedData.hideCaption === "true",
|
|
243
|
-
hideCopyright: embedData.hideByline === "true",
|
|
244
|
-
visibleAlt: previewAlt ? embed.embedData.alt : ""
|
|
245
|
-
})]
|
|
246
|
-
});
|
|
247
|
-
};
|
|
248
|
-
var _default = exports.default = ImageEmbed;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.InlineTriggerButton = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
9
|
-
var _util = require("@ndla/util");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
/**
|
|
12
|
-
* Copyright (c) 2024-present, NDLA.
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
15
|
-
* LICENSE file in the root directory of this source tree.
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
const StyledSpan = (0, _jsx2.styled)("span", {
|
|
20
|
-
base: {}
|
|
21
|
-
});
|
|
22
|
-
const InlineTriggerButton = exports.InlineTriggerButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
23
|
-
let {
|
|
24
|
-
onClick,
|
|
25
|
-
...props
|
|
26
|
-
} = _ref;
|
|
27
|
-
const spanRef = (0, _react.useRef)(null);
|
|
28
|
-
|
|
29
|
-
// Emulate a button click when pressing Enter or Space
|
|
30
|
-
const onKeyboardEvent = (0, _react.useCallback)(event => {
|
|
31
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
32
|
-
spanRef.current?.click();
|
|
33
|
-
}
|
|
34
|
-
}, []);
|
|
35
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSpan, {
|
|
36
|
-
ref: (0, _util.composeRefs)(spanRef, ref),
|
|
37
|
-
onKeyUp: onKeyboardEvent,
|
|
38
|
-
onClick: onClick,
|
|
39
|
-
role: "button",
|
|
40
|
-
tabIndex: 0,
|
|
41
|
-
...props
|
|
42
|
-
});
|
|
43
|
-
});
|