@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arc-ui/community-components",
3
- "version": "3.13.0",
3
+ "version": "3.13.1",
4
4
  "type": "module",
5
5
  "homepage": "https://ui.digital-ent-int.bt.com",
6
6
  "author": "BT Business Digital UI Team <ui-digital-ent-int@bt.com>",
@@ -80,9 +80,9 @@
80
80
  "tslib": "^2.8.1",
81
81
  "typescript": "^5.6.3",
82
82
  "@arc-ui/community-build-utils": "^0.1.0",
83
- "@arc-ui/community-eslint-config": "^0.1.1",
84
83
  "@arc-ui/community-css-config": "^0.1.1",
85
84
  "@arc-ui/community-typescript-config": "^0.1.0",
85
+ "@arc-ui/community-eslint-config": "^0.1.1",
86
86
  "@arc-ui/community-utils": "^0.2.0"
87
87
  },
88
88
  "browserslist": [
@@ -1,4 +1,4 @@
1
- import React, { useId, useState } from "react";
1
+ import React, { useEffect, useId, useState } from "react";
2
2
  import classNames from "classnames";
3
3
 
4
4
  import { ArcIconSocialLinkedin } from "@arc-ui/icons/ArcIconSocialLinkedin";
@@ -33,11 +33,18 @@ export const ArticleSidebar: React.FC<ArticleSidebarProps> = ({
33
33
  share,
34
34
  additionalContent,
35
35
  linkSection,
36
+ url: providedUrl,
36
37
  ...props
37
38
  }) => {
38
39
  const id = useId();
39
40
  const [showToast, setShowToast] = useState(false);
40
- const url = location.href;
41
+ const [clientUrl, setClientUrl] = useState("");
42
+
43
+ useEffect(() => {
44
+ if (!providedUrl) setClientUrl(window.location.href);
45
+ }, [providedUrl]);
46
+
47
+ const url = providedUrl ?? clientUrl;
41
48
 
42
49
  const copyTextToClipBoard = async () => {
43
50
  await navigator.clipboard.writeText(url);
@@ -53,14 +60,14 @@ export const ArticleSidebar: React.FC<ArticleSidebarProps> = ({
53
60
  ariaLabel: share.clipboardAriaLabel || "Copy url to clipboard",
54
61
  },
55
62
  {
56
- href: `mailto:?subject=${share.articleTitle}&body=${url}`,
63
+ href: `mailto:?subject=${encodeURIComponent(share.articleTitle)}&body=${encodeURIComponent(url)}`,
57
64
  icon: BtIconEmailUnread,
58
65
  ariaLabel: share.emailAriaLabel || "Share by email",
59
66
  },
60
67
  ...(share.linkedin
61
68
  ? [
62
69
  {
63
- href: `https://www.linkedin.com/sharing/share-offsite/?url=${url}`,
70
+ href: `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}`,
64
71
  icon: ArcIconSocialLinkedin,
65
72
  ariaLabel: share.linkedInAriaLabel || "Share on LinkedIn",
66
73
  },
@@ -69,7 +76,7 @@ export const ArticleSidebar: React.FC<ArticleSidebarProps> = ({
69
76
  ...(share.x
70
77
  ? [
71
78
  {
72
- href: `https://twitter.com/intent/tweet?url=${url}`,
79
+ href: `https://twitter.com/intent/tweet?url=${encodeURIComponent(url)}`,
73
80
  icon: ArcIconSocialX,
74
81
  ariaLabel: share.xAriaLabel || "Share on x",
75
82
  },
@@ -80,7 +87,8 @@ export const ArticleSidebar: React.FC<ArticleSidebarProps> = ({
80
87
 
81
88
  const hasTopContent = Boolean(author || aboutSection || additionalContent);
82
89
 
83
- const hasBottomContent = Boolean(linkSection || topics || share);
90
+ const showShare = share && url;
91
+ const hasBottomContent = Boolean(linkSection || topics || showShare);
84
92
 
85
93
  return (
86
94
  <div {...filterAttrs(props)}>
@@ -139,14 +147,14 @@ export const ArticleSidebar: React.FC<ArticleSidebarProps> = ({
139
147
  </Heading>
140
148
 
141
149
  {linkSection.links.map(({ text, url, ariaLabel }) => (
142
- <>
150
+ <React.Fragment key={`${id}-${url}`}>
143
151
  <VerticalSpace size="8" />
144
- <div key={`${id}-${url}`}>
152
+ <div>
145
153
  <Link aria-label={ariaLabel} size="s" href={url}>
146
154
  {text}
147
155
  </Link>
148
156
  </div>
149
- </>
157
+ </React.Fragment>
150
158
  ))}
151
159
  </>
152
160
  )}
@@ -167,7 +175,7 @@ export const ArticleSidebar: React.FC<ArticleSidebarProps> = ({
167
175
  </>
168
176
  )}
169
177
 
170
- {share && (
178
+ {showShare && (
171
179
  <>
172
180
  {(linkSection || topics) && (
173
181
  <div data-testid="links-topics-content-rule">
@@ -244,4 +252,10 @@ export interface ArticleSidebarProps {
244
252
  * Sharing options for the article.
245
253
  */
246
254
  share?: Share;
255
+
256
+ /**
257
+ * The article URL used by the share buttons.
258
+ * If it is not provided, the component uses the current browser URL.
259
+ */
260
+ url?: string;
247
261
  }
package/versions.json CHANGED
@@ -1 +1 @@
1
- [{"version":"v3.13.0","date":null},{"version":"v3.12.0","date":"2026-07-08"},{"version":"v3.11.0","date":"2026-06-24"},{"version":"v3.10.0","date":"2026-06-16"},{"version":"v3.9.0","date":"2026-05-22"},{"version":"v3.8.1","date":"2026-05-13"},{"version":"v3.8.0","date":"2026-04-29"},{"version":"v3.7.1","date":"2026-04-22"},{"version":"v3.7.0","date":"2026-04-17"},{"version":"v3.6.0","date":"2026-04-10"},{"version":"v3.5.0","date":"2026-04-02"},{"version":"v3.4.0","date":"2026-03-26"},{"version":"v3.3.0","date":"2026-03-20"},{"version":"v3.2.0","date":"2026-03-09"},{"version":"v3.1.0","date":"2026-02-26"},{"version":"v3.0.1","date":null},{"version":"v3.0.0","date":"2026-02-18"},{"version":"v2.0.0","date":"2026-01-21"},{"version":"v1.1.0","date":"2025-11-19"},{"version":"v1.0.2","date":"2025-08-18"},{"version":"v1.0.1","date":"2025-08-05"},{"version":"v1.0.0","date":"2025-04-29"},{"version":"v0.1.0","date":null}]
1
+ [{"version":"v3.13.1","date":null},{"version":"v3.13.0","date":"2026-07-24"},{"version":"v3.12.0","date":"2026-07-08"},{"version":"v3.11.0","date":"2026-06-24"},{"version":"v3.10.0","date":"2026-06-16"},{"version":"v3.9.0","date":"2026-05-22"},{"version":"v3.8.1","date":"2026-05-13"},{"version":"v3.8.0","date":"2026-04-29"},{"version":"v3.7.1","date":"2026-04-22"},{"version":"v3.7.0","date":"2026-04-17"},{"version":"v3.6.0","date":"2026-04-10"},{"version":"v3.5.0","date":"2026-04-02"},{"version":"v3.4.0","date":"2026-03-26"},{"version":"v3.3.0","date":"2026-03-20"},{"version":"v3.2.0","date":"2026-03-09"},{"version":"v3.1.0","date":"2026-02-26"},{"version":"v3.0.1","date":null},{"version":"v3.0.0","date":"2026-02-18"},{"version":"v2.0.0","date":"2026-01-21"},{"version":"v1.1.0","date":"2025-11-19"},{"version":"v1.0.2","date":"2025-08-18"},{"version":"v1.0.1","date":"2025-08-05"},{"version":"v1.0.0","date":"2025-04-29"},{"version":"v0.1.0","date":null}]