@xyo-network/react-share 7.5.8 → 7.5.12

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.
Files changed (39) hide show
  1. package/dist/browser/button/ShareButton.d.ts.map +1 -1
  2. package/dist/browser/index.mjs +361 -338
  3. package/dist/browser/index.mjs.map +1 -1
  4. package/dist/browser/out/CopyLinkStack.d.ts.map +1 -1
  5. package/dist/browser/out/lib/AnimatedGradientTypography.d.ts +4 -2
  6. package/dist/browser/out/lib/AnimatedGradientTypography.d.ts.map +1 -1
  7. package/package.json +70 -29
  8. package/src/button/ShareButton.stories.tsx +0 -23
  9. package/src/button/ShareButton.tsx +0 -75
  10. package/src/button/index.ts +0 -1
  11. package/src/global.d.ts +0 -1
  12. package/src/icons/index.ts +0 -1
  13. package/src/icons/social/Facebook.tsx +0 -11
  14. package/src/icons/social/XTwitter.tsx +0 -10
  15. package/src/icons/social/index.ts +0 -2
  16. package/src/index.ts +0 -4
  17. package/src/meta-server/dynamic-share/DynamicShareImage.tsx +0 -23
  18. package/src/meta-server/dynamic-share/index.ts +0 -1
  19. package/src/meta-server/index.ts +0 -2
  20. package/src/meta-server/live-share/HideParentsFlexbox.tsx +0 -40
  21. package/src/meta-server/live-share/index.ts +0 -1
  22. package/src/out/CopyIconButton.tsx +0 -58
  23. package/src/out/CopyLinkStack.stories.tsx +0 -69
  24. package/src/out/CopyLinkStack.tsx +0 -77
  25. package/src/out/CopyLinkTextField.stories.tsx +0 -18
  26. package/src/out/CopyLinkTextField.tsx +0 -41
  27. package/src/out/Dialog.stories.tsx +0 -78
  28. package/src/out/Dialog.tsx +0 -48
  29. package/src/out/Explanation.tsx +0 -29
  30. package/src/out/GenerateShareLinkButton.stories.tsx +0 -18
  31. package/src/out/GenerateShareLinkButton.tsx +0 -31
  32. package/src/out/HeadingFlexbox.tsx +0 -27
  33. package/src/out/SocialButtonsFlexbox.stories.tsx +0 -41
  34. package/src/out/SocialButtonsFlexbox.tsx +0 -79
  35. package/src/out/index.ts +0 -7
  36. package/src/out/lib/AnimatedGradientTypography.tsx +0 -54
  37. package/src/out/lib/ShareLinkProps.ts +0 -8
  38. package/src/out/lib/index.ts +0 -3
  39. package/src/out/lib/splitAroundSubstring.ts +0 -19
@@ -1,115 +1,123 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
1
  // src/button/ShareButton.tsx
5
- import { Facebook as FacebookIcon, Share as ShareIcon, X as XIcon } from "@mui/icons-material";
2
+ import {
3
+ Facebook as FacebookIcon,
4
+ Share as ShareIcon,
5
+ X as XIcon
6
+ } from "@mui/icons-material";
6
7
  import { Popover } from "@mui/material";
7
8
  import { ButtonEx } from "@xylabs/react-button";
8
9
  import { FlexRow } from "@xylabs/react-flexbox";
9
10
  import { LinkEx } from "@xylabs/react-link";
10
- import React, { useRef, useState } from "react";
11
- var ShareButton = /* @__PURE__ */ __name(({ prepared = true, shareLink, slot, ...props }) => {
11
+ import {
12
+ useEffect,
13
+ useRef,
14
+ useState
15
+ } from "react";
16
+ import { jsx, jsxs } from "react/jsx-runtime";
17
+ var ShareButton = ({
18
+ prepared = true,
19
+ shareLink,
20
+ slot,
21
+ ...props
22
+ }) => {
12
23
  const [expanded, setExpanded] = useState(false);
13
24
  const anchorRef = useRef(null);
25
+ const [anchorEl, setAnchorEl] = useState(null);
14
26
  const link = shareLink ?? globalThis.location.href;
15
- return /* @__PURE__ */ React.createElement(FlexRow, {
16
- gap: 1
17
- }, /* @__PURE__ */ React.createElement(ButtonEx, {
18
- variant: "text",
19
- minWidth: 32,
20
- size: "small",
21
- disabled: !prepared,
22
- onClick: /* @__PURE__ */ __name(() => {
23
- setExpanded(true);
24
- }, "onClick"),
25
- ...props
26
- }, /* @__PURE__ */ React.createElement(ShareIcon, {
27
- htmlColor: "gray",
28
- fontSize: "small",
29
- ref: anchorRef
30
- })), /* @__PURE__ */ React.createElement(Popover, {
31
- open: prepared ? expanded : false,
32
- anchorEl: anchorRef.current,
33
- anchorOrigin: {
34
- vertical: "top",
35
- horizontal: "right"
36
- },
37
- onClose: /* @__PURE__ */ __name(() => setExpanded(false), "onClose"),
38
- transitionDuration: 500,
39
- sx: {
40
- ml: 1,
41
- top: -4,
42
- ...slot?.popover?.sx
43
- },
44
- ...slot?.popover
45
- }, /* @__PURE__ */ React.createElement(FlexRow, {
46
- gap: 0.5,
47
- padding: 0.5
48
- }, /* @__PURE__ */ React.createElement(LinkEx, {
49
- lineHeight: 0,
50
- onClick: /* @__PURE__ */ __name(() => {
51
- window.open(`https://x.com/intent/tweet?url=${encodeURIComponent(link)}`);
52
- setExpanded(false);
53
- }, "onClick")
54
- }, /* @__PURE__ */ React.createElement(XIcon, {
55
- fontSize: "small"
56
- })), /* @__PURE__ */ React.createElement(LinkEx, {
57
- lineHeight: 0,
58
- style: {
59
- color: "#4267b2"
60
- },
61
- onClick: /* @__PURE__ */ __name(() => {
62
- window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`);
63
- setExpanded(false);
64
- }, "onClick")
65
- }, /* @__PURE__ */ React.createElement(FacebookIcon, {
66
- fontSize: "small"
67
- })))));
68
- }, "ShareButton");
27
+ useEffect(() => {
28
+ setAnchorEl(anchorRef.current);
29
+ }, []);
30
+ return /* @__PURE__ */ jsxs(FlexRow, { gap: 1, children: [
31
+ /* @__PURE__ */ jsx(
32
+ ButtonEx,
33
+ {
34
+ variant: "text",
35
+ minWidth: 32,
36
+ size: "small",
37
+ disabled: !prepared,
38
+ onClick: () => {
39
+ setExpanded(true);
40
+ },
41
+ ...props,
42
+ children: /* @__PURE__ */ jsx(ShareIcon, { htmlColor: "gray", fontSize: "small", ref: anchorRef })
43
+ }
44
+ ),
45
+ /* @__PURE__ */ jsx(
46
+ Popover,
47
+ {
48
+ open: prepared ? expanded : false,
49
+ anchorEl,
50
+ anchorOrigin: { vertical: "top", horizontal: "right" },
51
+ onClose: () => setExpanded(false),
52
+ transitionDuration: 500,
53
+ sx: {
54
+ ml: 1,
55
+ top: -4,
56
+ ...slot?.popover?.sx
57
+ },
58
+ ...slot?.popover,
59
+ children: /* @__PURE__ */ jsxs(FlexRow, { gap: 0.5, padding: 0.5, children: [
60
+ /* @__PURE__ */ jsx(
61
+ LinkEx,
62
+ {
63
+ lineHeight: 0,
64
+ onClick: () => {
65
+ window.open(`https://x.com/intent/tweet?url=${encodeURIComponent(link)}`);
66
+ setExpanded(false);
67
+ },
68
+ children: /* @__PURE__ */ jsx(XIcon, { fontSize: "small" })
69
+ }
70
+ ),
71
+ /* @__PURE__ */ jsx(
72
+ LinkEx,
73
+ {
74
+ lineHeight: 0,
75
+ style: { color: "#4267b2" },
76
+ onClick: () => {
77
+ window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`);
78
+ setExpanded(false);
79
+ },
80
+ children: /* @__PURE__ */ jsx(FacebookIcon, { fontSize: "small" })
81
+ }
82
+ )
83
+ ] })
84
+ }
85
+ )
86
+ ] });
87
+ };
69
88
 
70
89
  // src/icons/social/Facebook.tsx
71
90
  import { createSvgIcon } from "@mui/material";
72
- import React2 from "react";
73
- var FacebookSvgIcon = createSvgIcon(/* @__PURE__ */ React2.createElement("svg", {
74
- xmlns: "http://www.w3.org/2000/svg",
75
- height: "800",
76
- width: "1200",
77
- viewBox: "-204.79995 -341.33325 1774.9329 2047.9995"
78
- }, /* @__PURE__ */ React2.createElement("path", {
79
- d: "M1365.333 682.667C1365.333 305.64 1059.693 0 682.667 0 305.64 0 0 305.64 0 682.667c0 340.738 249.641 623.16 576 674.373V880H402.667V682.667H576v-150.4c0-171.094 101.917-265.6 257.853-265.6 74.69 0 152.814 13.333 152.814 13.333v168h-86.083c-84.804 0-111.25 52.623-111.25 106.61v128.057h189.333L948.4 880H789.333v477.04c326.359-51.213 576-333.635 576-674.373",
80
- fill: "#1877f2"
81
- }), /* @__PURE__ */ React2.createElement("path", {
82
- d: "M948.4 880l30.267-197.333H789.333V554.609C789.333 500.623 815.78 448 900.584 448h86.083V280s-78.124-13.333-152.814-13.333c-155.936 0-257.853 94.506-257.853 265.6v150.4H402.667V880H576v477.04a687.805 687.805 0 00106.667 8.293c36.288 0 71.91-2.84 106.666-8.293V880H948.4",
83
- fill: "#fff"
84
- })), "Facebook");
91
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
92
+ var FacebookSvgIcon = createSvgIcon(
93
+ /* @__PURE__ */ jsxs2("svg", { xmlns: "http://www.w3.org/2000/svg", height: "800", width: "1200", viewBox: "-204.79995 -341.33325 1774.9329 2047.9995", children: [
94
+ /* @__PURE__ */ jsx2("path", { d: "M1365.333 682.667C1365.333 305.64 1059.693 0 682.667 0 305.64 0 0 305.64 0 682.667c0 340.738 249.641 623.16 576 674.373V880H402.667V682.667H576v-150.4c0-171.094 101.917-265.6 257.853-265.6 74.69 0 152.814 13.333 152.814 13.333v168h-86.083c-84.804 0-111.25 52.623-111.25 106.61v128.057h189.333L948.4 880H789.333v477.04c326.359-51.213 576-333.635 576-674.373", fill: "#1877f2" }),
95
+ /* @__PURE__ */ jsx2("path", { d: "M948.4 880l30.267-197.333H789.333V554.609C789.333 500.623 815.78 448 900.584 448h86.083V280s-78.124-13.333-152.814-13.333c-155.936 0-257.853 94.506-257.853 265.6v150.4H402.667V880H576v477.04a687.805 687.805 0 00106.667 8.293c36.288 0 71.91-2.84 106.666-8.293V880H948.4", fill: "#fff" })
96
+ ] }),
97
+ "Facebook"
98
+ );
85
99
 
86
100
  // src/icons/social/XTwitter.tsx
87
101
  import { createSvgIcon as createSvgIcon2 } from "@mui/material";
88
- import React3 from "react";
89
- var XTwitterSvgIcon = createSvgIcon2(/* @__PURE__ */ React3.createElement("svg", {
90
- viewBox: "0 0 1200 1227",
91
- fill: "none",
92
- xmlns: "http://www.w3.org/2000/svg"
93
- }, /* @__PURE__ */ React3.createElement("path", {
94
- d: "M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z",
95
- fill: "white"
96
- })), "XTwitterSvgIcon");
102
+ import { jsx as jsx3 } from "react/jsx-runtime";
103
+ var XTwitterSvgIcon = createSvgIcon2(
104
+ /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 1200 1227", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx3("path", { d: "M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z", fill: "white" }) }),
105
+ "XTwitterSvgIcon"
106
+ );
97
107
 
98
108
  // src/meta-server/dynamic-share/DynamicShareImage.tsx
99
- import React4 from "react";
100
109
  import { Helmet } from "react-helmet";
101
- var DynamicShareImage = /* @__PURE__ */ __name(({ image }) => {
102
- return /* @__PURE__ */ React4.createElement(Helmet, null, /* @__PURE__ */ React4.createElement("meta", {
103
- property: "xyo:og:image",
104
- content: image
105
- }));
106
- }, "DynamicShareImage");
110
+ import { jsx as jsx4 } from "react/jsx-runtime";
111
+ var DynamicShareImage = ({ image }) => {
112
+ return /* @__PURE__ */ jsx4(Helmet, { children: /* @__PURE__ */ jsx4("meta", { property: "xyo:og:image", content: image }) });
113
+ };
107
114
 
108
115
  // src/meta-server/live-share/HideParentsFlexbox.tsx
109
116
  import { FlexGrowRow } from "@xylabs/react-flexbox";
110
- import React5, { useEffect } from "react";
111
- var HideParentsFlexbox = /* @__PURE__ */ __name(({ children, ...props }) => {
112
- useEffect(() => {
117
+ import { useEffect as useEffect2 } from "react";
118
+ import { jsx as jsx5 } from "react/jsx-runtime";
119
+ var HideParentsFlexbox = ({ children, ...props }) => {
120
+ useEffect2(() => {
113
121
  const style = document.createElement("style");
114
122
  document.head.append(style);
115
123
  style.innerHTML = `
@@ -135,37 +143,53 @@ var HideParentsFlexbox = /* @__PURE__ */ __name(({ children, ...props }) => {
135
143
  style.remove();
136
144
  };
137
145
  }, []);
138
- return /* @__PURE__ */ React5.createElement(FlexGrowRow, {
139
- alignItems: "stretch",
140
- id: "preview-area",
141
- justifyContent: "start",
142
- ...props
143
- }, children);
144
- }, "HideParentsFlexbox");
146
+ return /* @__PURE__ */ jsx5(FlexGrowRow, { alignItems: "stretch", id: "preview-area", justifyContent: "start", ...props, children });
147
+ };
145
148
 
146
149
  // src/out/CopyLinkStack.tsx
147
150
  import { Cancel } from "@mui/icons-material";
148
- import { Stack, Tooltip as Tooltip2, Typography as Typography2 } from "@mui/material";
149
- import React7, { useCallback, useMemo, useState as useState3 } from "react";
151
+ import {
152
+ Stack,
153
+ Tooltip as Tooltip2,
154
+ Typography as Typography2
155
+ } from "@mui/material";
156
+ import {
157
+ useCallback,
158
+ useMemo,
159
+ useState as useState3
160
+ } from "react";
150
161
 
151
162
  // src/out/CopyIconButton.tsx
152
163
  import { CopyAllRounded } from "@mui/icons-material";
153
- import { CircularProgress, IconButton, Tooltip } from "@mui/material";
164
+ import {
165
+ CircularProgress,
166
+ IconButton,
167
+ Tooltip
168
+ } from "@mui/material";
154
169
  import { forget } from "@xylabs/sdk-js";
155
- import React6, { useState as useState2 } from "react";
156
- var CopyIconButton = /* @__PURE__ */ __name(({ copyLinkText, copiedLinkText, onClickError, shareLinkName, shareUrl, uploadPayloads, ...props }) => {
170
+ import { useState as useState2 } from "react";
171
+ import { jsx as jsx6 } from "react/jsx-runtime";
172
+ var CopyIconButton = ({
173
+ copyLinkText,
174
+ copiedLinkText,
175
+ onClickError,
176
+ shareLinkName,
177
+ shareUrl,
178
+ uploadPayloads,
179
+ ...props
180
+ }) => {
157
181
  const CopyLink = copyLinkText ?? "Copy Link";
158
182
  const Copied = copiedLinkText ?? "Copied!";
159
- const [copyTooltipTitle, setCopyToolTipTitle] = useState2(CopyLink);
183
+ const [copyTooltipTitle, setCopyTooltipTitle] = useState2(CopyLink);
160
184
  const [loading, setLoading] = useState2(false);
161
- const copyToClipboard = /* @__PURE__ */ __name(async (link) => {
185
+ const copyToClipboard = async (link) => {
162
186
  if (link) {
163
187
  try {
164
188
  setLoading(true);
165
189
  await uploadPayloads?.();
166
190
  await navigator.clipboard.writeText(link);
167
- setCopyToolTipTitle(Copied);
168
- setTimeout(() => setCopyToolTipTitle(CopyLink), 2e3);
191
+ setCopyTooltipTitle(Copied);
192
+ setTimeout(() => setCopyTooltipTitle(CopyLink), 2e3);
169
193
  setLoading(false);
170
194
  } catch (e) {
171
195
  setLoading(false);
@@ -176,21 +200,16 @@ var CopyIconButton = /* @__PURE__ */ __name(({ copyLinkText, copiedLinkText, onC
176
200
  } else {
177
201
  console.warn("tried to copy shareUrl before it was generated");
178
202
  }
179
- }, "copyToClipboard");
180
- return /* @__PURE__ */ React6.createElement(Tooltip, {
181
- title: copyTooltipTitle
182
- }, loading ? /* @__PURE__ */ React6.createElement(IconButton, null, /* @__PURE__ */ React6.createElement(CircularProgress, {
183
- size: "24px"
184
- })) : /* @__PURE__ */ React6.createElement(IconButton, {
185
- "aria-label": `copy ${shareLinkName} link`,
186
- onClick: /* @__PURE__ */ __name(() => forget(copyToClipboard(shareUrl)), "onClick"),
187
- edge: "end",
188
- ...props
189
- }, /* @__PURE__ */ React6.createElement(CopyAllRounded, null)));
190
- }, "CopyIconButton");
203
+ };
204
+ return /* @__PURE__ */ jsx6(Tooltip, { title: copyTooltipTitle, children: loading ? /* @__PURE__ */ jsx6(IconButton, { children: /* @__PURE__ */ jsx6(CircularProgress, { size: "24px" }) }) : /* @__PURE__ */ jsx6(IconButton, { "aria-label": `copy ${shareLinkName} link`, onClick: () => forget(copyToClipboard(shareUrl)), edge: "end", ...props, children: /* @__PURE__ */ jsx6(CopyAllRounded, {}) }) });
205
+ };
191
206
 
192
207
  // src/out/lib/AnimatedGradientTypography.tsx
193
- import { keyframes, styled, Typography } from "@mui/material";
208
+ import {
209
+ keyframes,
210
+ styled,
211
+ Typography
212
+ } from "@mui/material";
194
213
  var moveBg = keyframes(`
195
214
  0% {
196
215
  background-position: 100% 0%;
@@ -199,9 +218,11 @@ var moveBg = keyframes(`
199
218
  background-position: 0% 0%;
200
219
  }
201
220
  `);
202
- var AnimatedGradientTypography = styled(Typography, {
203
- name: "AnimatedGradientTypography"
204
- })(({ theme, color1, color2 }) => {
221
+ var AnimatedGradientTypography = styled(Typography, { name: "AnimatedGradientTypography" })(({
222
+ theme,
223
+ color1,
224
+ color2
225
+ }) => {
205
226
  return {
206
227
  // Set the color variables for the gradient
207
228
  "--color-one": color1 ?? theme.vars.palette.secondary.dark,
@@ -236,7 +257,7 @@ var AnimatedGradientTypography = styled(Typography, {
236
257
  });
237
258
 
238
259
  // src/out/lib/splitAroundSubstring.ts
239
- var splitAroundSubstring = /* @__PURE__ */ __name((path, substring) => {
260
+ var splitAroundSubstring = (path, substring) => {
240
261
  const index = path.indexOf(substring);
241
262
  if (index === -1) {
242
263
  throw new Error(`XNS name "${substring}" not found in path.`);
@@ -244,15 +265,23 @@ var splitAroundSubstring = /* @__PURE__ */ __name((path, substring) => {
244
265
  const part1 = path.slice(0, index);
245
266
  const part2 = substring;
246
267
  const part3 = path.slice(index + substring.length);
247
- return [
248
- part1,
249
- part2,
250
- part3
251
- ];
252
- }, "splitAroundSubstring");
268
+ return [part1, part2, part3];
269
+ };
253
270
 
254
271
  // src/out/CopyLinkStack.tsx
255
- var CopyLinkStack = /* @__PURE__ */ __name(({ addToXnsName, copiedLinkText, copyLinkText, shareLinkName, shareUrl, xnsName: xnsNameProp, xnsEndColor, uploadPayloads, xnsStartColor, ...props }) => {
272
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
273
+ var CopyLinkStack = ({
274
+ addToXnsName,
275
+ copiedLinkText,
276
+ copyLinkText,
277
+ shareLinkName,
278
+ shareUrl,
279
+ xnsName: xnsNameProp,
280
+ xnsEndColor,
281
+ uploadPayloads,
282
+ xnsStartColor,
283
+ ...props
284
+ }) => {
256
285
  const [error, setError] = useState3();
257
286
  const onClickError = useCallback((error2) => {
258
287
  setError(error2);
@@ -260,174 +289,167 @@ var CopyLinkStack = /* @__PURE__ */ __name(({ addToXnsName, copiedLinkText, copy
260
289
  const parsedXnsName = useMemo(() => {
261
290
  if (shareUrl && xnsNameProp && addToXnsName) {
262
291
  try {
263
- const parts = splitAroundSubstring(shareUrl, xnsNameProp);
264
- return parts;
265
- } catch (e) {
266
- setError(e);
292
+ return splitAroundSubstring(shareUrl, xnsNameProp);
293
+ } catch {
294
+ return;
267
295
  }
268
296
  }
269
- }, [
270
- addToXnsName,
271
- shareUrl,
272
- xnsNameProp
273
- ]);
297
+ }, [addToXnsName, shareUrl, xnsNameProp]);
274
298
  const [part1, xnsName, part3] = parsedXnsName || [];
275
- return /* @__PURE__ */ React7.createElement(Stack, {
276
- direction: "row",
277
- alignItems: "center",
278
- gap: 0.25,
279
- ...props
280
- }, xnsName && addToXnsName ? /* @__PURE__ */ React7.createElement(Stack, {
281
- direction: "row",
282
- maxWidth: "100%",
283
- sx: {
284
- overflowX: "auto"
285
- }
286
- }, /* @__PURE__ */ React7.createElement(Typography2, {
287
- sx: {
288
- display: "inline-flex"
289
- }
290
- }, part1), /* @__PURE__ */ React7.createElement(AnimatedGradientTypography, {
291
- color1: xnsStartColor,
292
- color2: xnsEndColor,
293
- sx: {
294
- display: "inline-flex"
295
- }
296
- }, xnsName), /* @__PURE__ */ React7.createElement(Typography2, {
297
- sx: {
298
- display: "inline-flex"
299
- }
300
- }, part3)) : /* @__PURE__ */ React7.createElement(Typography2, {
301
- sx: {
302
- display: "inline-flex",
303
- maxWidth: "100%",
304
- overflow: "auto"
305
- }
306
- }, shareUrl), /* @__PURE__ */ React7.createElement(CopyIconButton, {
307
- copiedLinkText,
308
- copyLinkText,
309
- onClickError,
310
- shareLinkName,
311
- shareUrl,
312
- sx: {
313
- display: "inline-flex"
314
- },
315
- uploadPayloads
316
- }), error ? /* @__PURE__ */ React7.createElement(Tooltip2, {
317
- title: error.message
318
- }, /* @__PURE__ */ React7.createElement(Cancel, {
319
- color: "error",
320
- sx: {
321
- display: "inline-flex"
322
- }
323
- })) : null);
324
- }, "CopyLinkStack");
299
+ return /* @__PURE__ */ jsxs3(Stack, { direction: "row", alignItems: "center", gap: 0.25, ...props, children: [
300
+ xnsName && addToXnsName ? /* @__PURE__ */ jsxs3(Stack, { direction: "row", maxWidth: "100%", sx: { overflowX: "auto" }, children: [
301
+ /* @__PURE__ */ jsx7(Typography2, { sx: { display: "inline-flex" }, children: part1 }),
302
+ /* @__PURE__ */ jsx7(AnimatedGradientTypography, { color1: xnsStartColor, color2: xnsEndColor, sx: { display: "inline-flex" }, children: xnsName }),
303
+ /* @__PURE__ */ jsx7(Typography2, { sx: { display: "inline-flex" }, children: part3 })
304
+ ] }) : /* @__PURE__ */ jsx7(
305
+ Typography2,
306
+ {
307
+ sx: {
308
+ display: "inline-flex",
309
+ maxWidth: "100%",
310
+ overflow: "auto"
311
+ },
312
+ children: shareUrl
313
+ }
314
+ ),
315
+ /* @__PURE__ */ jsx7(
316
+ CopyIconButton,
317
+ {
318
+ copiedLinkText,
319
+ copyLinkText,
320
+ onClickError,
321
+ shareLinkName,
322
+ shareUrl,
323
+ sx: { display: "inline-flex" },
324
+ uploadPayloads
325
+ }
326
+ ),
327
+ error ? /* @__PURE__ */ jsx7(Tooltip2, { title: error.message, children: /* @__PURE__ */ jsx7(Cancel, { color: "error", sx: { display: "inline-flex" } }) }) : null
328
+ ] });
329
+ };
325
330
 
326
331
  // src/out/CopyLinkTextField.tsx
327
332
  import { InputAdornment, TextField } from "@mui/material";
328
- import React8, { useCallback as useCallback2, useState as useState4 } from "react";
329
- var CopyLinkTextField = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, ...props }) => {
333
+ import { useCallback as useCallback2, useState as useState4 } from "react";
334
+ import { jsx as jsx8 } from "react/jsx-runtime";
335
+ var CopyLinkTextField = ({
336
+ shareLinkName,
337
+ shareUrl,
338
+ ...props
339
+ }) => {
330
340
  const [error, setError] = useState4();
331
341
  const onClickError = useCallback2((error2) => {
332
342
  setError(error2);
333
343
  }, []);
334
- return /* @__PURE__ */ React8.createElement(TextField, {
335
- disabled: true,
336
- error: !!error,
337
- helperText: error?.message,
338
- // to override the color that appears when it's a text field, only on dark mode
339
- sx: {
340
- input: {
341
- WebkitTextFillColor: "lightgray !important"
342
- }
343
- },
344
- value: shareUrl,
345
- ...props,
346
- slotProps: {
347
- input: {
348
- endAdornment: /* @__PURE__ */ React8.createElement(InputAdornment, {
349
- position: "end"
350
- }, /* @__PURE__ */ React8.createElement(CopyIconButton, {
351
- shareLinkName,
352
- shareUrl,
353
- onClickError
354
- }))
344
+ return /* @__PURE__ */ jsx8(
345
+ TextField,
346
+ {
347
+ disabled: true,
348
+ error: !!error,
349
+ helperText: error?.message,
350
+ sx: { input: { WebkitTextFillColor: "lightgray !important" } },
351
+ value: shareUrl,
352
+ ...props,
353
+ slotProps: {
354
+ input: {
355
+ endAdornment: /* @__PURE__ */ jsx8(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx8(CopyIconButton, { shareLinkName, shareUrl, onClickError }) })
356
+ }
355
357
  }
356
358
  }
357
- });
358
- }, "CopyLinkTextField");
359
+ );
360
+ };
359
361
 
360
362
  // src/out/Dialog.tsx
361
- import { Dialog, DialogActions, DialogContent, DialogTitle, Stack as Stack2, Typography as Typography3 } from "@mui/material";
363
+ import {
364
+ Dialog,
365
+ DialogActions,
366
+ DialogContent,
367
+ DialogTitle,
368
+ Stack as Stack2,
369
+ Typography as Typography3
370
+ } from "@mui/material";
362
371
  import { FlexCol, FlexGrowCol } from "@xylabs/react-flexbox";
363
- import React9 from "react";
364
- var ShareOutDialog = /* @__PURE__ */ __name(({ ShareOutDialogActions, cardImg, open, onClose, shareOutDialogContent, subtitle, title, ...props }) => {
365
- const handleClose = /* @__PURE__ */ __name(() => {
372
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
373
+ var ShareOutDialog = ({
374
+ ShareOutDialogActions,
375
+ cardImg,
376
+ open,
377
+ onClose,
378
+ shareOutDialogContent,
379
+ subtitle,
380
+ title,
381
+ ...props
382
+ }) => {
383
+ const handleClose = () => {
366
384
  onClose?.("", "backdropClick");
367
- }, "handleClose");
368
- return /* @__PURE__ */ React9.createElement(Dialog, {
369
- onClose,
370
- open,
371
- ...props
372
- }, /* @__PURE__ */ React9.createElement(DialogTitle, null, /* @__PURE__ */ React9.createElement(Stack2, {
373
- direction: "row",
374
- spacing: 2
375
- }, /* @__PURE__ */ React9.createElement(FlexGrowCol, {
376
- alignItems: "flex-start",
377
- width: "60%"
378
- }, /* @__PURE__ */ React9.createElement(Typography3, {
379
- variant: "h5"
380
- }, title), /* @__PURE__ */ React9.createElement(Typography3, {
381
- variant: "body1"
382
- }, " ", subtitle)), /* @__PURE__ */ React9.createElement(FlexGrowCol, {
383
- alignItems: "flex-end",
384
- width: "40%"
385
- }, cardImg))), /* @__PURE__ */ React9.createElement(DialogContent, null, shareOutDialogContent, /* @__PURE__ */ React9.createElement(FlexCol, {
386
- alignItems: "stretch"
387
- })), ShareOutDialogActions ? /* @__PURE__ */ React9.createElement(DialogActions, null, /* @__PURE__ */ React9.createElement(ShareOutDialogActions, {
388
- onClose: handleClose
389
- })) : null);
390
- }, "ShareOutDialog");
385
+ };
386
+ return /* @__PURE__ */ jsxs4(Dialog, { onClose, open, ...props, children: [
387
+ /* @__PURE__ */ jsx9(DialogTitle, { children: /* @__PURE__ */ jsxs4(Stack2, { direction: "row", spacing: 2, children: [
388
+ /* @__PURE__ */ jsxs4(FlexGrowCol, { alignItems: "flex-start", width: "60%", children: [
389
+ /* @__PURE__ */ jsx9(Typography3, { variant: "h5", children: title }),
390
+ /* @__PURE__ */ jsxs4(Typography3, { variant: "body1", children: [
391
+ " ",
392
+ subtitle
393
+ ] })
394
+ ] }),
395
+ /* @__PURE__ */ jsx9(FlexGrowCol, { alignItems: "flex-end", width: "40%", children: cardImg })
396
+ ] }) }),
397
+ /* @__PURE__ */ jsxs4(DialogContent, { children: [
398
+ shareOutDialogContent,
399
+ /* @__PURE__ */ jsx9(FlexCol, { alignItems: "stretch" })
400
+ ] }),
401
+ ShareOutDialogActions ? /* @__PURE__ */ jsx9(DialogActions, { children: /* @__PURE__ */ jsx9(ShareOutDialogActions, { onClose: handleClose }) }) : null
402
+ ] });
403
+ };
391
404
 
392
405
  // src/out/Explanation.tsx
393
406
  import { InfoOutlined } from "@mui/icons-material";
394
- import { Tooltip as Tooltip3, Typography as Typography4, useTheme } from "@mui/material";
407
+ import {
408
+ Tooltip as Tooltip3,
409
+ Typography as Typography4,
410
+ useTheme
411
+ } from "@mui/material";
395
412
  import { FlexGrowRow as FlexGrowRow2 } from "@xylabs/react-flexbox";
396
- import React10 from "react";
397
- var ShareOutExplanation = /* @__PURE__ */ __name(({ toolTipTitle }) => {
413
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
414
+ var ShareOutExplanation = ({ toolTipTitle }) => {
398
415
  const theme = useTheme();
399
416
  const title = toolTipTitle ?? "In order for your data to be publicly viewable, it needs to be saved to the XYO Network Public Archivist. Public data can be seen by your friends, and XYO can generate preview images for easier sharing on social media.";
400
- return /* @__PURE__ */ React10.createElement(FlexGrowRow2, {
401
- alignItems: "center"
402
- }, /* @__PURE__ */ React10.createElement(Typography4, {
403
- variant: "body2",
404
- paddingRight: 0.5
405
- }, "What am I sharing?"), /* @__PURE__ */ React10.createElement(Tooltip3, {
406
- title,
407
- placement: "bottom"
408
- }, /* @__PURE__ */ React10.createElement(InfoOutlined, {
409
- fontSize: "small",
410
- sx: {
411
- fontSize: theme.typography.caption.fontSize
412
- }
413
- })));
414
- }, "ShareOutExplanation");
417
+ return /* @__PURE__ */ jsxs5(FlexGrowRow2, { alignItems: "center", children: [
418
+ /* @__PURE__ */ jsx10(Typography4, { variant: "body2", paddingRight: 0.5, children: "What am I sharing?" }),
419
+ /* @__PURE__ */ jsx10(
420
+ Tooltip3,
421
+ {
422
+ title,
423
+ placement: "bottom",
424
+ children: /* @__PURE__ */ jsx10(InfoOutlined, { fontSize: "small", sx: { fontSize: theme.typography.caption.fontSize } })
425
+ }
426
+ )
427
+ ] });
428
+ };
415
429
 
416
430
  // src/out/GenerateShareLinkButton.tsx
417
- import { Button, CircularProgress as CircularProgress2, styled as styled2 } from "@mui/material";
418
- import React11 from "react";
419
- var GenerateShareLinkButton = /* @__PURE__ */ __name(({ children = "Generate My Share Link", loading, ...props }) => {
420
- return /* @__PURE__ */ React11.createElement(Button, {
421
- variant: "contained",
422
- startIcon: loading ? /* @__PURE__ */ React11.createElement(StyledCircularProgress, {
423
- size: "small"
424
- }) : null,
425
- ...props
426
- }, children);
427
- }, "GenerateShareLinkButton");
428
- var StyledCircularProgress = styled2(CircularProgress2, {
429
- name: "StyledCircularProgress"
430
- })(({ theme }) => ({
431
+ import {
432
+ Button,
433
+ CircularProgress as CircularProgress2,
434
+ styled as styled2
435
+ } from "@mui/material";
436
+ import { jsx as jsx11 } from "react/jsx-runtime";
437
+ var GenerateShareLinkButton = ({
438
+ children = "Generate My Share Link",
439
+ loading,
440
+ ...props
441
+ }) => {
442
+ return /* @__PURE__ */ jsx11(
443
+ Button,
444
+ {
445
+ variant: "contained",
446
+ startIcon: loading ? /* @__PURE__ */ jsx11(StyledCircularProgress, { size: "small" }) : null,
447
+ ...props,
448
+ children
449
+ }
450
+ );
451
+ };
452
+ var StyledCircularProgress = styled2(CircularProgress2, { name: "StyledCircularProgress" })(({ theme }) => ({
431
453
  // ensure the color of the spinner is the same as the button color
432
454
  color: theme.vars.palette.primary.contrastText,
433
455
  height: "20px",
@@ -438,32 +460,37 @@ var StyledCircularProgress = styled2(CircularProgress2, {
438
460
  // src/out/HeadingFlexbox.tsx
439
461
  import { Typography as Typography5 } from "@mui/material";
440
462
  import { FlexGrowCol as FlexGrowCol2 } from "@xylabs/react-flexbox";
441
- import React12 from "react";
442
- var ShareOutHeadingFlexbox = /* @__PURE__ */ __name(({ children, shareLinkName, shareUrl, ...props }) => {
463
+ import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
464
+ var ShareOutHeadingFlexbox = ({
465
+ children,
466
+ shareLinkName,
467
+ shareUrl,
468
+ ...props
469
+ }) => {
443
470
  const GenerateShareLinkExplanation = "When you generate your share link, we'll make a small amount of your data public so friends can check it out!";
444
- return /* @__PURE__ */ React12.createElement(FlexGrowCol2, {
445
- alignItems: "flex-start",
446
- paddingBottom: 1,
447
- ...props
448
- }, /* @__PURE__ */ React12.createElement(Typography5, {
449
- variant: "body1",
450
- gutterBottom: true
451
- }, /* @__PURE__ */ React12.createElement("strong", null, "Your Share Link")), /* @__PURE__ */ React12.createElement(Typography5, {
452
- variant: "body1"
453
- }, shareUrl ? `Use this link or the buttons below to share ${shareLinkName}` : GenerateShareLinkExplanation), children);
454
- }, "ShareOutHeadingFlexbox");
471
+ return /* @__PURE__ */ jsxs6(FlexGrowCol2, { alignItems: "flex-start", paddingBottom: 1, ...props, children: [
472
+ /* @__PURE__ */ jsx12(Typography5, { variant: "body1", gutterBottom: true, children: /* @__PURE__ */ jsx12("strong", { children: "Your Share Link" }) }),
473
+ /* @__PURE__ */ jsx12(Typography5, { variant: "body1", children: shareUrl ? `Use this link or the buttons below to share ${shareLinkName}` : GenerateShareLinkExplanation }),
474
+ children
475
+ ] });
476
+ };
455
477
 
456
478
  // src/out/SocialButtonsFlexbox.tsx
457
479
  import { Typography as Typography6 } from "@mui/material";
458
480
  import { ButtonEx as ButtonEx2 } from "@xylabs/react-button";
459
481
  import { ErrorRender } from "@xylabs/react-error";
460
482
  import { FlexGrowCol as FlexGrowCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
461
- import React13, { useState as useState5 } from "react";
462
- var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, uploadPayloads, ...props }) => {
483
+ import { useState as useState5 } from "react";
484
+ import { Fragment, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
485
+ var SocialButtonsFlexbox = ({
486
+ shareUrl,
487
+ uploadPayloads,
488
+ ...props
489
+ }) => {
463
490
  const [error, setError] = useState5();
464
491
  const [xLoading, setXLoading] = useState5(false);
465
492
  const [fbLoading, setFbLoading] = useState5(false);
466
- const handleClick = /* @__PURE__ */ __name(async (openUrl, buttonName) => {
493
+ const handleClick = async (openUrl, buttonName) => {
467
494
  const setLoading = buttonName === "x" ? setXLoading : setFbLoading;
468
495
  try {
469
496
  setLoading(true);
@@ -475,53 +502,49 @@ var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, uploadPayloads, .
475
502
  console.error("Error uploading payloads", e);
476
503
  setError(e);
477
504
  }
478
- }, "handleClick");
479
- return /* @__PURE__ */ React13.createElement(FlexGrowCol3, {
480
- alignItems: "stretch",
481
- paddingTop: 2,
482
- ...props
483
- }, /* @__PURE__ */ React13.createElement(Typography6, {
484
- variant: "body1",
485
- gutterBottom: true
486
- }, /* @__PURE__ */ React13.createElement("strong", null, "Share on Social Media")), /* @__PURE__ */ React13.createElement(FlexRow2, {
487
- gap: 0.5,
488
- sx: {
489
- flexDirection: {
490
- md: "row",
491
- xs: "column"
505
+ };
506
+ return /* @__PURE__ */ jsxs7(FlexGrowCol3, { alignItems: "stretch", paddingTop: 2, ...props, children: [
507
+ /* @__PURE__ */ jsx13(Typography6, { variant: "body1", gutterBottom: true, children: /* @__PURE__ */ jsx13("strong", { children: "Share on Social Media" }) }),
508
+ /* @__PURE__ */ jsx13(
509
+ FlexRow2,
510
+ {
511
+ gap: 0.5,
512
+ sx: { flexDirection: { md: "row", xs: "column" } },
513
+ children: shareUrl ? /* @__PURE__ */ jsxs7(Fragment, { children: [
514
+ /* @__PURE__ */ jsx13(
515
+ ButtonEx2,
516
+ {
517
+ variant: "contained",
518
+ style: { backgroundColor: "#000", color: "#fff" },
519
+ busy: xLoading,
520
+ onClick: async () => {
521
+ const openUrl = () => window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(shareUrl)}`);
522
+ await handleClick(openUrl, "x");
523
+ },
524
+ startIcon: /* @__PURE__ */ jsx13(XTwitterSvgIcon, { width: "20px" }),
525
+ children: "Share on X (Twitter)"
526
+ }
527
+ ),
528
+ /* @__PURE__ */ jsx13(
529
+ ButtonEx2,
530
+ {
531
+ busy: fbLoading,
532
+ variant: "contained",
533
+ style: { backgroundColor: "#4267b2", color: "#fff" },
534
+ onClick: async () => {
535
+ const openUrl = () => window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`);
536
+ await handleClick(openUrl, "fb");
537
+ },
538
+ startIcon: /* @__PURE__ */ jsx13(FacebookSvgIcon, {}),
539
+ children: "Share on Facebook"
540
+ }
541
+ )
542
+ ] }) : null
492
543
  }
493
- }
494
- }, shareUrl ? /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(ButtonEx2, {
495
- variant: "contained",
496
- style: {
497
- backgroundColor: "#000",
498
- color: "#fff"
499
- },
500
- busy: xLoading,
501
- onClick: /* @__PURE__ */ __name(async () => {
502
- const openUrl = /* @__PURE__ */ __name(() => window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(shareUrl)}`), "openUrl");
503
- await handleClick(openUrl, "x");
504
- }, "onClick"),
505
- startIcon: /* @__PURE__ */ React13.createElement(XTwitterSvgIcon, {
506
- width: "20px"
507
- })
508
- }, "Share on X (Twitter)"), /* @__PURE__ */ React13.createElement(ButtonEx2, {
509
- busy: fbLoading,
510
- variant: "contained",
511
- style: {
512
- backgroundColor: "#4267b2",
513
- color: "#fff"
514
- },
515
- onClick: /* @__PURE__ */ __name(async () => {
516
- const openUrl = /* @__PURE__ */ __name(() => window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`), "openUrl");
517
- await handleClick(openUrl, "fb");
518
- }, "onClick"),
519
- startIcon: /* @__PURE__ */ React13.createElement(FacebookSvgIcon, null)
520
- }, "Share on Facebook")) : null), /* @__PURE__ */ React13.createElement(ErrorRender, {
521
- error,
522
- scope: "SocialButtonsFlexbox"
523
- }));
524
- }, "SocialButtonsFlexbox");
544
+ ),
545
+ /* @__PURE__ */ jsx13(ErrorRender, { error, scope: "SocialButtonsFlexbox" })
546
+ ] });
547
+ };
525
548
  export {
526
549
  CopyLinkStack,
527
550
  CopyLinkTextField,