@arc-ui/community-components 3.13.0 → 3.13.1
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/.turbo/turbo-build.log +12 -12
- package/CHANGELOG.md +7 -0
- package/lib/ArticleSidebar/ArticleSidebar.cjs +15 -9
- package/lib/ArticleSidebar/ArticleSidebar.mjs +16 -10
- package/lib/index.cjs +15 -9
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +5 -0
- package/lib/index.d.mts +5 -0
- package/lib/index.mjs +15 -9
- package/lib/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/ArticleSidebar/ArticleSidebar.tsx +24 -10
- package/versions.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @arc-ui/community-components@3.13.
|
|
2
|
+
> @arc-ui/community-components@3.13.1 build /builds/enterprise/frontend/arc-community/packages/components
|
|
3
3
|
> rimraf lib dist && rollup -c && generate-subpath-css && pnpm run build:clean
|
|
4
4
|
|
|
5
5
|
Browserslist: browsers data (caniuse-lite) is 11 months old. Please run:
|
|
@@ -7,41 +7,41 @@ Browserslist: browsers data (caniuse-lite) is 11 months old. Please run:
|
|
|
7
7
|
Why you should do it regularly: https://github.com/browserslist/update-db#readme
|
|
8
8
|
[36m
|
|
9
9
|
[1msrc/index.ts[22m → [1mlib/index.cjs, lib/index.mjs[22m...[39m
|
|
10
|
-
[32mcreated [1mlib/index.cjs, lib/index.mjs[22m in [
|
|
10
|
+
[32mcreated [1mlib/index.cjs, lib/index.mjs[22m in [1m6.9s[22m[39m
|
|
11
11
|
[36m
|
|
12
12
|
[1m./lib/types/index.d.ts[22m → [1mlib/index.d.mts, lib/index.d.cts[22m...[39m
|
|
13
13
|
[1m[33m(!) Unresolved dependencies[39m[22m
|
|
14
14
|
[90mhttps://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency[39m
|
|
15
|
-
[1m@arc-ui/components/MediaCard[22m (imported by "lib/types/components/ArticleCarousel/ArticleCarousel.d.ts", "lib/types/components/PromoListing/PromoListing.d.ts" and "lib/types/components/BusinessSegmentSwitcher/types/types.d.ts")
|
|
16
|
-
[1m@arc-ui/components/Avatar[22m (imported by "lib/types/components/Author/Author.d.ts")
|
|
17
15
|
[1m@arc-ui/components/NavigationHeader[22m (imported by "lib/types/components/HeaderBarNotification/HeaderBarNotification.d.ts")
|
|
18
|
-
[1m@arc-ui/components/
|
|
19
|
-
[1m@arc-ui/components/VideoPlayer[22m (imported by "lib/types/components/CopyLead/CopyLead.d.ts" and "lib/types/components/FeaturePost/FeaturePost.d.ts")
|
|
16
|
+
[1m@arc-ui/components/Avatar[22m (imported by "lib/types/components/Author/Author.d.ts")
|
|
20
17
|
[1m@arc-ui/components/Download[22m (imported by "lib/types/components/DownloadList/DownloadList.d.ts")
|
|
18
|
+
[1m@arc-ui/components/Heading[22m (imported by "lib/types/components/CopyLead/CopyLead.d.ts", "lib/types/components/FeaturePost/FeaturePost.d.ts", "lib/types/components/Summary/Summary.d.ts", "lib/types/components/PromoListing/PromoListing.d.ts", "lib/types/components/BannerWithTabs/BannerWithTabs.d.ts", "lib/types/components/SectionHeading/SectionHeading.d.ts", "lib/types/components/PartnerBrandLogos/PartnerBrandLogos.d.ts", "lib/types/components/Accordion/components/AccordionHeading/AccordionHeading.d.ts", "lib/types/components/ArticleSidebar/types/link-section.d.ts", "lib/types/components/ArticleSidebar/types/topic.d.ts", "lib/types/components/ArticleSidebar/types/text-section.d.ts", "lib/types/components/ArticleSidebar/types/share.d.ts" and "lib/types/components/PartnerBrandLogos/components/PartnerLogoSubgroup/PartnerLogoSubgroup.d.ts")
|
|
19
|
+
[1m@arc-ui/components/VideoPlayer[22m (imported by "lib/types/components/CopyLead/CopyLead.d.ts" and "lib/types/components/FeaturePost/FeaturePost.d.ts")
|
|
20
|
+
[1m@arc-ui/components/MediaCard[22m (imported by "lib/types/components/ArticleCarousel/ArticleCarousel.d.ts", "lib/types/components/PromoListing/PromoListing.d.ts" and "lib/types/components/BusinessSegmentSwitcher/types/types.d.ts")
|
|
21
21
|
[1m@arc-ui/components/ButtonV2[22m (imported by "lib/types/components/Highlights/Highlights.d.ts" and "lib/types/components/PromoListing/PromoListing.d.ts")
|
|
22
22
|
[1m@arc-ui/components/ImpactCard[22m (imported by "lib/types/components/PromoListing/PromoListing.d.ts")
|
|
23
23
|
[1m@arc-ui/components/InformationCard[22m (imported by "lib/types/components/PromoListing/PromoListing.d.ts", "lib/types/components/BusinessSegmentSwitcher/types/types.d.ts" and "lib/types/components/ProductNavigation/types/product-list.d.ts")
|
|
24
24
|
[1m@arc-ui/components/TypographyCard[22m (imported by "lib/types/components/PromoListing/PromoListing.d.ts" and "lib/types/components/BusinessSegmentSwitcher/types/types.d.ts")
|
|
25
25
|
[1m@arc-ui/components/TemplateBanner[22m (imported by "lib/types/components/BannerWithTabs/BannerWithTabs.d.ts")
|
|
26
|
-
[1m@arc-ui/components/Image[22m (imported by "lib/types/components/SectionHeading/SectionHeading.d.ts", "lib/types/components/ThumbnailSignpost/ThumbnailSignpost.d.ts", "lib/types/components/Accordion/components/AccordionHeading/AccordionHeading.d.ts", "lib/types/components/
|
|
26
|
+
[1m@arc-ui/components/Image[22m (imported by "lib/types/components/SectionHeading/SectionHeading.d.ts", "lib/types/components/ThumbnailSignpost/ThumbnailSignpost.d.ts", "lib/types/components/Accordion/components/AccordionHeading/AccordionHeading.d.ts", "lib/types/components/FeaturePost/types/feature-post-image.d.ts" and "lib/types/components/CopyLead/types/copy-lead-image.d.ts")
|
|
27
27
|
[1m@arc-ui/components/VerticalSpace[22m (imported by "lib/types/components/PartnerBrandLogos/PartnerBrandLogos.d.ts")
|
|
28
28
|
[1m@arc-ui/components/Disclosure[22m (imported by "lib/types/components/Accordion/components/AccordionDisclosureList/AccordionDisclosureList.d.ts")
|
|
29
29
|
[1m@arc-ui/components/Tag[22m (imported by "lib/types/components/ArticleSidebar/types/topic.d.ts")
|
|
30
30
|
[1m@arc-ui/components/AppButton[22m (imported by "lib/types/components/FeaturePost/types/feature-post-app-button-footer.d.ts")
|
|
31
|
-
[1m@arc-ui/components/Button[22m (imported by "lib/types/components/
|
|
31
|
+
[1m@arc-ui/components/Button[22m (imported by "lib/types/components/FeaturePost/types/feature-post-cta-footer.d.ts" and "lib/types/components/CopyLead/types/copy-lead-button.d.ts")
|
|
32
32
|
[1mreact-player/types[22m (imported by "lib/types/internal/VideoCardPlayer/VideoCardPlayer.d.ts" and "lib/types/internal/VideoCardPlayer/types/player-props.d.ts")
|
|
33
33
|
[1m@arc-ui/components/Visible[22m (imported by "lib/types/internal/VideoCardPlayer/components/VideoCardThumbnail/VideoCardThumbnail.d.ts")
|
|
34
|
-
[32mcreated [1mlib/index.d.mts, lib/index.d.cts[22m in [
|
|
34
|
+
[32mcreated [1mlib/index.d.mts, lib/index.d.cts[22m in [1m154ms[22m[39m
|
|
35
35
|
[36m
|
|
36
36
|
[1m./src/components/Accordion/index.ts, ./src/components/ActionTile/index.ts, ./src/components/ArticleCarousel/index.ts, ./src/components/ArticleSidebar/index.ts, ./src/components/Author/index.ts, ./src/components/BannerWithTabs/index.ts, ./src/components/BusinessSegmentSwitcher/index.ts, ./src/components/ContentInfoWidget/index.ts, ./src/components/CopyLead/index.ts, ./src/components/DownloadList/index.ts, ./src/components/FAQs/index.ts, ./src/components/FeaturePost/index.ts, ./src/components/HeaderBarNotification/index.ts, ./src/components/Highlights/index.ts, ./src/components/InlineLinkGroup/index.ts, ./src/components/LinkTile/index.ts, ./src/components/PartnerBrandLogos/index.ts, ./src/components/ProductNavigation/index.ts, ./src/components/PromoListing/index.ts, ./src/components/PromoListingThumbnailSignpost/index.ts, ./src/components/Quote/index.ts, ./src/components/SectionHeading/index.ts, ./src/components/Statistics/index.ts, ./src/components/Summary/index.ts, ./src/components/ThumbnailSignpost/index.ts, ./src/components/VideoHeroCard/index.ts, ./src/components/VideoPortraitCard/index.ts[22m → [1mlib[22m...[39m
|
|
37
|
-
[32mcreated [1mlib[22m in [
|
|
37
|
+
[32mcreated [1mlib[22m in [1m7.6s[22m[39m
|
|
38
38
|
[36m
|
|
39
39
|
[1m./src/components/Accordion/index.ts, ./src/components/ActionTile/index.ts, ./src/components/ArticleCarousel/index.ts, ./src/components/ArticleSidebar/index.ts, ./src/components/Author/index.ts, ./src/components/BannerWithTabs/index.ts, ./src/components/BusinessSegmentSwitcher/index.ts, ./src/components/ContentInfoWidget/index.ts, ./src/components/CopyLead/index.ts, ./src/components/DownloadList/index.ts, ./src/components/FAQs/index.ts, ./src/components/FeaturePost/index.ts, ./src/components/HeaderBarNotification/index.ts, ./src/components/Highlights/index.ts, ./src/components/InlineLinkGroup/index.ts, ./src/components/LinkTile/index.ts, ./src/components/PartnerBrandLogos/index.ts, ./src/components/ProductNavigation/index.ts, ./src/components/PromoListing/index.ts, ./src/components/PromoListingThumbnailSignpost/index.ts, ./src/components/Quote/index.ts, ./src/components/SectionHeading/index.ts, ./src/components/Statistics/index.ts, ./src/components/Summary/index.ts, ./src/components/ThumbnailSignpost/index.ts, ./src/components/VideoHeroCard/index.ts, ./src/components/VideoPortraitCard/index.ts[22m → [1mlib[22m...[39m
|
|
40
|
-
[32mcreated [1mlib[22m in [
|
|
40
|
+
[32mcreated [1mlib[22m in [1m7.3s[22m[39m
|
|
41
41
|
Browserslist: browsers data (caniuse-lite) is 11 months old. Please run:
|
|
42
42
|
npx update-browserslist-db@latest
|
|
43
43
|
Why you should do it regularly: https://github.com/browserslist/update-db#readme
|
|
44
44
|
|
|
45
|
-
> @arc-ui/community-components@3.13.
|
|
45
|
+
> @arc-ui/community-components@3.13.1 build:clean /builds/enterprise/frontend/arc-community/packages/components
|
|
46
46
|
> rimraf ./lib/types ./lib/styles.js ./lib/index.js ./lib/index.js.map
|
|
47
47
|
|
package/CHANGELOG.md
CHANGED
|
@@ -55,10 +55,15 @@ var styles = {"tagGroup":"ArticleSidebar-module_tagGroup__rIPQc","textContent":"
|
|
|
55
55
|
*/
|
|
56
56
|
var ArticleSidebar = function (_a) {
|
|
57
57
|
var _b;
|
|
58
|
-
var author = _a.author, aboutSection = _a.aboutSection, topics = _a.topics, share = _a.share, additionalContent = _a.additionalContent, linkSection = _a.linkSection, props = tslib_es6.__rest(_a, ["author", "aboutSection", "topics", "share", "additionalContent", "linkSection"]);
|
|
58
|
+
var author = _a.author, aboutSection = _a.aboutSection, topics = _a.topics, share = _a.share, additionalContent = _a.additionalContent, linkSection = _a.linkSection, providedUrl = _a.url, props = tslib_es6.__rest(_a, ["author", "aboutSection", "topics", "share", "additionalContent", "linkSection", "url"]);
|
|
59
59
|
var id = React.useId();
|
|
60
60
|
var _c = React.useState(false), showToast = _c[0], setShowToast = _c[1];
|
|
61
|
-
var
|
|
61
|
+
var _d = React.useState(""), clientUrl = _d[0], setClientUrl = _d[1];
|
|
62
|
+
React.useEffect(function () {
|
|
63
|
+
if (!providedUrl)
|
|
64
|
+
setClientUrl(window.location.href);
|
|
65
|
+
}, [providedUrl]);
|
|
66
|
+
var url = providedUrl !== null && providedUrl !== void 0 ? providedUrl : clientUrl;
|
|
62
67
|
var copyTextToClipBoard = function () { return tslib_es6.__awaiter(void 0, void 0, void 0, function () {
|
|
63
68
|
return tslib_es6.__generator(this, function (_a) {
|
|
64
69
|
switch (_a.label) {
|
|
@@ -79,14 +84,14 @@ var ArticleSidebar = function (_a) {
|
|
|
79
84
|
ariaLabel: share.clipboardAriaLabel || "Copy url to clipboard",
|
|
80
85
|
},
|
|
81
86
|
{
|
|
82
|
-
href: "mailto:?subject=".concat(share.articleTitle, "&body=").concat(url),
|
|
87
|
+
href: "mailto:?subject=".concat(encodeURIComponent(share.articleTitle), "&body=").concat(encodeURIComponent(url)),
|
|
83
88
|
icon: BtIconEmailUnread,
|
|
84
89
|
ariaLabel: share.emailAriaLabel || "Share by email",
|
|
85
90
|
}
|
|
86
91
|
], (share.linkedin
|
|
87
92
|
? [
|
|
88
93
|
{
|
|
89
|
-
href: "https://www.linkedin.com/sharing/share-offsite/?url=".concat(url),
|
|
94
|
+
href: "https://www.linkedin.com/sharing/share-offsite/?url=".concat(encodeURIComponent(url)),
|
|
90
95
|
icon: ArcIconSocialLinkedin,
|
|
91
96
|
ariaLabel: share.linkedInAriaLabel || "Share on LinkedIn",
|
|
92
97
|
},
|
|
@@ -94,14 +99,15 @@ var ArticleSidebar = function (_a) {
|
|
|
94
99
|
: []), true), (share.x
|
|
95
100
|
? [
|
|
96
101
|
{
|
|
97
|
-
href: "https://twitter.com/intent/tweet?url=".concat(url),
|
|
102
|
+
href: "https://twitter.com/intent/tweet?url=".concat(encodeURIComponent(url)),
|
|
98
103
|
icon: ArcIconSocialX,
|
|
99
104
|
ariaLabel: share.xAriaLabel || "Share on x",
|
|
100
105
|
},
|
|
101
106
|
]
|
|
102
107
|
: []), true) : [];
|
|
103
108
|
var hasTopContent = Boolean(author || aboutSection || additionalContent);
|
|
104
|
-
var
|
|
109
|
+
var showShare = share && url;
|
|
110
|
+
var hasBottomContent = Boolean(linkSection || topics || showShare);
|
|
105
111
|
return (React.createElement("div", tslib_es6.__assign({}, filterAttrs.filterAttrs(props)),
|
|
106
112
|
React.createElement("div", { className: index.classNames((_b = {},
|
|
107
113
|
_b[styles.textContent] = hasTopContent,
|
|
@@ -129,9 +135,9 @@ var ArticleSidebar = function (_a) {
|
|
|
129
135
|
React.createElement(Heading.Heading, { level: linkSection.headingLevel }, linkSection.heading),
|
|
130
136
|
linkSection.links.map(function (_a) {
|
|
131
137
|
var text = _a.text, url = _a.url, ariaLabel = _a.ariaLabel;
|
|
132
|
-
return (React.createElement(React.Fragment,
|
|
138
|
+
return (React.createElement(React.Fragment, { key: "".concat(id, "-").concat(url) },
|
|
133
139
|
React.createElement(VerticalSpace.VerticalSpace, { size: "8" }),
|
|
134
|
-
React.createElement("div",
|
|
140
|
+
React.createElement("div", null,
|
|
135
141
|
React.createElement(Link.Link, { "aria-label": ariaLabel, size: "s", href: url }, text))));
|
|
136
142
|
}))),
|
|
137
143
|
topics && (React.createElement(React.Fragment, null,
|
|
@@ -139,7 +145,7 @@ var ArticleSidebar = function (_a) {
|
|
|
139
145
|
React.createElement(Heading.Heading, { level: topics.headingLevel }, topics.heading),
|
|
140
146
|
React.createElement(VerticalSpace.VerticalSpace, { size: "16" }),
|
|
141
147
|
React.createElement("div", { className: styles.tagGroup }, topics.tags.map(function (tag) { return (React.createElement(Tag.Tag, tslib_es6.__assign({ key: "".concat(id, "-").concat(tag.title) }, tag))); })))),
|
|
142
|
-
|
|
148
|
+
showShare && (React.createElement(React.Fragment, null,
|
|
143
149
|
(linkSection || topics) && (React.createElement("div", { "data-testid": "links-topics-content-rule" },
|
|
144
150
|
React.createElement(VerticalSpace.VerticalSpace, { size: "32" }),
|
|
145
151
|
React.createElement(Rule.Rule, null),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as __rest, b as __spreadArray, a as __assign, c as __awaiter, d as __generator } from '../_shared/esm/tslib.es6-BVXMhEem.mjs';
|
|
2
|
-
import React__default, { useId, useState } from 'react';
|
|
2
|
+
import React__default, { useId, useState, useEffect } from 'react';
|
|
3
3
|
import { c as classNames } from '../_shared/esm/index-BSO2EFem.mjs';
|
|
4
4
|
import { Heading } from '@arc-ui/components/Heading';
|
|
5
5
|
import { Icon } from '@arc-ui/components/Icon';
|
|
@@ -53,10 +53,15 @@ var styles = {"tagGroup":"ArticleSidebar-module_tagGroup__rIPQc","textContent":"
|
|
|
53
53
|
*/
|
|
54
54
|
var ArticleSidebar = function (_a) {
|
|
55
55
|
var _b;
|
|
56
|
-
var author = _a.author, aboutSection = _a.aboutSection, topics = _a.topics, share = _a.share, additionalContent = _a.additionalContent, linkSection = _a.linkSection, props = __rest(_a, ["author", "aboutSection", "topics", "share", "additionalContent", "linkSection"]);
|
|
56
|
+
var author = _a.author, aboutSection = _a.aboutSection, topics = _a.topics, share = _a.share, additionalContent = _a.additionalContent, linkSection = _a.linkSection, providedUrl = _a.url, props = __rest(_a, ["author", "aboutSection", "topics", "share", "additionalContent", "linkSection", "url"]);
|
|
57
57
|
var id = useId();
|
|
58
58
|
var _c = useState(false), showToast = _c[0], setShowToast = _c[1];
|
|
59
|
-
var
|
|
59
|
+
var _d = useState(""), clientUrl = _d[0], setClientUrl = _d[1];
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
if (!providedUrl)
|
|
62
|
+
setClientUrl(window.location.href);
|
|
63
|
+
}, [providedUrl]);
|
|
64
|
+
var url = providedUrl !== null && providedUrl !== void 0 ? providedUrl : clientUrl;
|
|
60
65
|
var copyTextToClipBoard = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
61
66
|
return __generator(this, function (_a) {
|
|
62
67
|
switch (_a.label) {
|
|
@@ -77,14 +82,14 @@ var ArticleSidebar = function (_a) {
|
|
|
77
82
|
ariaLabel: share.clipboardAriaLabel || "Copy url to clipboard",
|
|
78
83
|
},
|
|
79
84
|
{
|
|
80
|
-
href: "mailto:?subject=".concat(share.articleTitle, "&body=").concat(url),
|
|
85
|
+
href: "mailto:?subject=".concat(encodeURIComponent(share.articleTitle), "&body=").concat(encodeURIComponent(url)),
|
|
81
86
|
icon: BtIconEmailUnread,
|
|
82
87
|
ariaLabel: share.emailAriaLabel || "Share by email",
|
|
83
88
|
}
|
|
84
89
|
], (share.linkedin
|
|
85
90
|
? [
|
|
86
91
|
{
|
|
87
|
-
href: "https://www.linkedin.com/sharing/share-offsite/?url=".concat(url),
|
|
92
|
+
href: "https://www.linkedin.com/sharing/share-offsite/?url=".concat(encodeURIComponent(url)),
|
|
88
93
|
icon: ArcIconSocialLinkedin,
|
|
89
94
|
ariaLabel: share.linkedInAriaLabel || "Share on LinkedIn",
|
|
90
95
|
},
|
|
@@ -92,14 +97,15 @@ var ArticleSidebar = function (_a) {
|
|
|
92
97
|
: []), true), (share.x
|
|
93
98
|
? [
|
|
94
99
|
{
|
|
95
|
-
href: "https://twitter.com/intent/tweet?url=".concat(url),
|
|
100
|
+
href: "https://twitter.com/intent/tweet?url=".concat(encodeURIComponent(url)),
|
|
96
101
|
icon: ArcIconSocialX,
|
|
97
102
|
ariaLabel: share.xAriaLabel || "Share on x",
|
|
98
103
|
},
|
|
99
104
|
]
|
|
100
105
|
: []), true) : [];
|
|
101
106
|
var hasTopContent = Boolean(author || aboutSection || additionalContent);
|
|
102
|
-
var
|
|
107
|
+
var showShare = share && url;
|
|
108
|
+
var hasBottomContent = Boolean(linkSection || topics || showShare);
|
|
103
109
|
return (React__default.createElement("div", __assign({}, filterAttrs(props)),
|
|
104
110
|
React__default.createElement("div", { className: classNames((_b = {},
|
|
105
111
|
_b[styles.textContent] = hasTopContent,
|
|
@@ -127,9 +133,9 @@ var ArticleSidebar = function (_a) {
|
|
|
127
133
|
React__default.createElement(Heading, { level: linkSection.headingLevel }, linkSection.heading),
|
|
128
134
|
linkSection.links.map(function (_a) {
|
|
129
135
|
var text = _a.text, url = _a.url, ariaLabel = _a.ariaLabel;
|
|
130
|
-
return (React__default.createElement(React__default.Fragment,
|
|
136
|
+
return (React__default.createElement(React__default.Fragment, { key: "".concat(id, "-").concat(url) },
|
|
131
137
|
React__default.createElement(VerticalSpace, { size: "8" }),
|
|
132
|
-
React__default.createElement("div",
|
|
138
|
+
React__default.createElement("div", null,
|
|
133
139
|
React__default.createElement(Link, { "aria-label": ariaLabel, size: "s", href: url }, text))));
|
|
134
140
|
}))),
|
|
135
141
|
topics && (React__default.createElement(React__default.Fragment, null,
|
|
@@ -137,7 +143,7 @@ var ArticleSidebar = function (_a) {
|
|
|
137
143
|
React__default.createElement(Heading, { level: topics.headingLevel }, topics.heading),
|
|
138
144
|
React__default.createElement(VerticalSpace, { size: "16" }),
|
|
139
145
|
React__default.createElement("div", { className: styles.tagGroup }, topics.tags.map(function (tag) { return (React__default.createElement(Tag, __assign({ key: "".concat(id, "-").concat(tag.title) }, tag))); })))),
|
|
140
|
-
|
|
146
|
+
showShare && (React__default.createElement(React__default.Fragment, null,
|
|
141
147
|
(linkSection || topics) && (React__default.createElement("div", { "data-testid": "links-topics-content-rule" },
|
|
142
148
|
React__default.createElement(VerticalSpace, { size: "32" }),
|
|
143
149
|
React__default.createElement(Rule, null),
|
package/lib/index.cjs
CHANGED
|
@@ -3837,10 +3837,15 @@ var styles$e = {"tagGroup":"ArticleSidebar-module_tagGroup__rIPQc","textContent"
|
|
|
3837
3837
|
*/
|
|
3838
3838
|
var ArticleSidebar = function (_a) {
|
|
3839
3839
|
var _b;
|
|
3840
|
-
var author = _a.author, aboutSection = _a.aboutSection, topics = _a.topics, share = _a.share, additionalContent = _a.additionalContent, linkSection = _a.linkSection, props = __rest(_a, ["author", "aboutSection", "topics", "share", "additionalContent", "linkSection"]);
|
|
3840
|
+
var author = _a.author, aboutSection = _a.aboutSection, topics = _a.topics, share = _a.share, additionalContent = _a.additionalContent, linkSection = _a.linkSection, providedUrl = _a.url, props = __rest(_a, ["author", "aboutSection", "topics", "share", "additionalContent", "linkSection", "url"]);
|
|
3841
3841
|
var id = React.useId();
|
|
3842
3842
|
var _c = React.useState(false), showToast = _c[0], setShowToast = _c[1];
|
|
3843
|
-
var
|
|
3843
|
+
var _d = React.useState(""), clientUrl = _d[0], setClientUrl = _d[1];
|
|
3844
|
+
React.useEffect(function () {
|
|
3845
|
+
if (!providedUrl)
|
|
3846
|
+
setClientUrl(window.location.href);
|
|
3847
|
+
}, [providedUrl]);
|
|
3848
|
+
var url = providedUrl !== null && providedUrl !== void 0 ? providedUrl : clientUrl;
|
|
3844
3849
|
var copyTextToClipBoard = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
3845
3850
|
return __generator(this, function (_a) {
|
|
3846
3851
|
switch (_a.label) {
|
|
@@ -3861,14 +3866,14 @@ var ArticleSidebar = function (_a) {
|
|
|
3861
3866
|
ariaLabel: share.clipboardAriaLabel || "Copy url to clipboard",
|
|
3862
3867
|
},
|
|
3863
3868
|
{
|
|
3864
|
-
href: "mailto:?subject=".concat(share.articleTitle, "&body=").concat(url),
|
|
3869
|
+
href: "mailto:?subject=".concat(encodeURIComponent(share.articleTitle), "&body=").concat(encodeURIComponent(url)),
|
|
3865
3870
|
icon: BtIconEmailUnread,
|
|
3866
3871
|
ariaLabel: share.emailAriaLabel || "Share by email",
|
|
3867
3872
|
}
|
|
3868
3873
|
], (share.linkedin
|
|
3869
3874
|
? [
|
|
3870
3875
|
{
|
|
3871
|
-
href: "https://www.linkedin.com/sharing/share-offsite/?url=".concat(url),
|
|
3876
|
+
href: "https://www.linkedin.com/sharing/share-offsite/?url=".concat(encodeURIComponent(url)),
|
|
3872
3877
|
icon: ArcIconSocialLinkedin,
|
|
3873
3878
|
ariaLabel: share.linkedInAriaLabel || "Share on LinkedIn",
|
|
3874
3879
|
},
|
|
@@ -3876,14 +3881,15 @@ var ArticleSidebar = function (_a) {
|
|
|
3876
3881
|
: []), true), (share.x
|
|
3877
3882
|
? [
|
|
3878
3883
|
{
|
|
3879
|
-
href: "https://twitter.com/intent/tweet?url=".concat(url),
|
|
3884
|
+
href: "https://twitter.com/intent/tweet?url=".concat(encodeURIComponent(url)),
|
|
3880
3885
|
icon: ArcIconSocialX,
|
|
3881
3886
|
ariaLabel: share.xAriaLabel || "Share on x",
|
|
3882
3887
|
},
|
|
3883
3888
|
]
|
|
3884
3889
|
: []), true) : [];
|
|
3885
3890
|
var hasTopContent = Boolean(author || aboutSection || additionalContent);
|
|
3886
|
-
var
|
|
3891
|
+
var showShare = share && url;
|
|
3892
|
+
var hasBottomContent = Boolean(linkSection || topics || showShare);
|
|
3887
3893
|
return (React.createElement("div", __assign({}, filterAttrs(props)),
|
|
3888
3894
|
React.createElement("div", { className: classNames((_b = {},
|
|
3889
3895
|
_b[styles$e.textContent] = hasTopContent,
|
|
@@ -3911,9 +3917,9 @@ var ArticleSidebar = function (_a) {
|
|
|
3911
3917
|
React.createElement(Heading.Heading, { level: linkSection.headingLevel }, linkSection.heading),
|
|
3912
3918
|
linkSection.links.map(function (_a) {
|
|
3913
3919
|
var text = _a.text, url = _a.url, ariaLabel = _a.ariaLabel;
|
|
3914
|
-
return (React.createElement(React.Fragment,
|
|
3920
|
+
return (React.createElement(React.Fragment, { key: "".concat(id, "-").concat(url) },
|
|
3915
3921
|
React.createElement(VerticalSpace.VerticalSpace, { size: "8" }),
|
|
3916
|
-
React.createElement("div",
|
|
3922
|
+
React.createElement("div", null,
|
|
3917
3923
|
React.createElement(Link.Link, { "aria-label": ariaLabel, size: "s", href: url }, text))));
|
|
3918
3924
|
}))),
|
|
3919
3925
|
topics && (React.createElement(React.Fragment, null,
|
|
@@ -3921,7 +3927,7 @@ var ArticleSidebar = function (_a) {
|
|
|
3921
3927
|
React.createElement(Heading.Heading, { level: topics.headingLevel }, topics.heading),
|
|
3922
3928
|
React.createElement(VerticalSpace.VerticalSpace, { size: "16" }),
|
|
3923
3929
|
React.createElement("div", { className: styles$e.tagGroup }, topics.tags.map(function (tag) { return (React.createElement(Tag.Tag, __assign({ key: "".concat(id, "-").concat(tag.title) }, tag))); })))),
|
|
3924
|
-
|
|
3930
|
+
showShare && (React.createElement(React.Fragment, null,
|
|
3925
3931
|
(linkSection || topics) && (React.createElement("div", { "data-testid": "links-topics-content-rule" },
|
|
3926
3932
|
React.createElement(VerticalSpace.VerticalSpace, { size: "32" }),
|
|
3927
3933
|
React.createElement(Rule.Rule, null),
|