@xyo-network/react-share 7.4.2 → 7.5.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/dist/browser/button/ShareButton.stories.d.ts +3 -3
- package/dist/browser/button/ShareButton.stories.d.ts.map +1 -1
- package/dist/browser/index.mjs +325 -345
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/out/CopyLinkStack.stories.d.ts +9 -9
- package/dist/browser/out/CopyLinkStack.stories.d.ts.map +1 -1
- package/dist/browser/out/CopyLinkTextField.stories.d.ts +2 -2
- package/dist/browser/out/CopyLinkTextField.stories.d.ts.map +1 -1
- package/dist/browser/out/Dialog.stories.d.ts +2 -2
- package/dist/browser/out/Dialog.stories.d.ts.map +1 -1
- package/dist/browser/out/GenerateShareLinkButton.stories.d.ts +2 -2
- package/dist/browser/out/GenerateShareLinkButton.stories.d.ts.map +1 -1
- package/dist/browser/out/SocialButtonsFlexbox.stories.d.ts +4 -4
- package/dist/browser/out/SocialButtonsFlexbox.stories.d.ts.map +1 -1
- package/dist/browser/out/lib/AnimatedGradientTypography.d.ts +1 -1
- package/package.json +17 -17
package/dist/browser/index.mjs
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
1
4
|
// src/button/ShareButton.tsx
|
|
2
|
-
import {
|
|
3
|
-
Facebook as FacebookIcon,
|
|
4
|
-
Share as ShareIcon,
|
|
5
|
-
X as XIcon
|
|
6
|
-
} from "@mui/icons-material";
|
|
5
|
+
import { Facebook as FacebookIcon, Share as ShareIcon, X as XIcon } from "@mui/icons-material";
|
|
7
6
|
import { Popover } from "@mui/material";
|
|
8
7
|
import { ButtonEx } from "@xylabs/react-button";
|
|
9
8
|
import { FlexRow } from "@xylabs/react-flexbox";
|
|
10
9
|
import { LinkEx } from "@xylabs/react-link";
|
|
11
|
-
import { useRef, useState } from "react";
|
|
12
|
-
|
|
13
|
-
var ShareButton = ({
|
|
14
|
-
prepared = true,
|
|
15
|
-
shareLink,
|
|
16
|
-
slot,
|
|
17
|
-
...props
|
|
18
|
-
}) => {
|
|
10
|
+
import React, { useRef, useState } from "react";
|
|
11
|
+
var ShareButton = /* @__PURE__ */ __name(({ prepared = true, shareLink, slot, ...props }) => {
|
|
19
12
|
const [expanded, setExpanded] = useState(false);
|
|
20
13
|
const anchorRef = useRef(null);
|
|
21
14
|
const link = shareLink ?? globalThis.location.href;
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
)
|
|
78
|
-
] });
|
|
79
|
-
};
|
|
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");
|
|
80
69
|
|
|
81
70
|
// src/icons/social/Facebook.tsx
|
|
82
71
|
import { createSvgIcon } from "@mui/material";
|
|
83
|
-
import
|
|
84
|
-
var FacebookSvgIcon = createSvgIcon(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
85
|
|
|
92
86
|
// src/icons/social/XTwitter.tsx
|
|
93
87
|
import { createSvgIcon as createSvgIcon2 } from "@mui/material";
|
|
94
|
-
import
|
|
95
|
-
var XTwitterSvgIcon = createSvgIcon2(
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
|
|
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");
|
|
99
97
|
|
|
100
98
|
// src/meta-server/dynamic-share/DynamicShareImage.tsx
|
|
99
|
+
import React4 from "react";
|
|
101
100
|
import { Helmet } from "react-helmet";
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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");
|
|
106
107
|
|
|
107
108
|
// src/meta-server/live-share/HideParentsFlexbox.tsx
|
|
108
109
|
import { FlexGrowRow } from "@xylabs/react-flexbox";
|
|
109
|
-
import { useEffect } from "react";
|
|
110
|
-
|
|
111
|
-
var HideParentsFlexbox = ({ children, ...props }) => {
|
|
110
|
+
import React5, { useEffect } from "react";
|
|
111
|
+
var HideParentsFlexbox = /* @__PURE__ */ __name(({ children, ...props }) => {
|
|
112
112
|
useEffect(() => {
|
|
113
113
|
const style = document.createElement("style");
|
|
114
114
|
document.head.append(style);
|
|
@@ -135,46 +135,30 @@ var HideParentsFlexbox = ({ children, ...props }) => {
|
|
|
135
135
|
style.remove();
|
|
136
136
|
};
|
|
137
137
|
}, []);
|
|
138
|
-
return /* @__PURE__ */
|
|
139
|
-
|
|
138
|
+
return /* @__PURE__ */ React5.createElement(FlexGrowRow, {
|
|
139
|
+
alignItems: "stretch",
|
|
140
|
+
id: "preview-area",
|
|
141
|
+
justifyContent: "start",
|
|
142
|
+
...props
|
|
143
|
+
}, children);
|
|
144
|
+
}, "HideParentsFlexbox");
|
|
140
145
|
|
|
141
146
|
// src/out/CopyLinkStack.tsx
|
|
142
147
|
import { Cancel } from "@mui/icons-material";
|
|
143
|
-
import {
|
|
144
|
-
|
|
145
|
-
Tooltip as Tooltip2,
|
|
146
|
-
Typography as Typography2
|
|
147
|
-
} from "@mui/material";
|
|
148
|
-
import {
|
|
149
|
-
useCallback,
|
|
150
|
-
useMemo,
|
|
151
|
-
useState as useState3
|
|
152
|
-
} from "react";
|
|
148
|
+
import { Stack, Tooltip as Tooltip2, Typography as Typography2 } from "@mui/material";
|
|
149
|
+
import React7, { useCallback, useMemo, useState as useState3 } from "react";
|
|
153
150
|
|
|
154
151
|
// src/out/CopyIconButton.tsx
|
|
155
152
|
import { CopyAllRounded } from "@mui/icons-material";
|
|
156
|
-
import {
|
|
157
|
-
CircularProgress,
|
|
158
|
-
IconButton,
|
|
159
|
-
Tooltip
|
|
160
|
-
} from "@mui/material";
|
|
153
|
+
import { CircularProgress, IconButton, Tooltip } from "@mui/material";
|
|
161
154
|
import { forget } from "@xylabs/forget";
|
|
162
|
-
import { useState as useState2 } from "react";
|
|
163
|
-
|
|
164
|
-
var CopyIconButton = ({
|
|
165
|
-
copyLinkText,
|
|
166
|
-
copiedLinkText,
|
|
167
|
-
onClickError,
|
|
168
|
-
shareLinkName,
|
|
169
|
-
shareUrl,
|
|
170
|
-
uploadPayloads,
|
|
171
|
-
...props
|
|
172
|
-
}) => {
|
|
155
|
+
import React6, { useState as useState2 } from "react";
|
|
156
|
+
var CopyIconButton = /* @__PURE__ */ __name(({ copyLinkText, copiedLinkText, onClickError, shareLinkName, shareUrl, uploadPayloads, ...props }) => {
|
|
173
157
|
const CopyLink = copyLinkText ?? "Copy Link";
|
|
174
158
|
const Copied = copiedLinkText ?? "Copied!";
|
|
175
159
|
const [copyTooltipTitle, setCopyToolTipTitle] = useState2(CopyLink);
|
|
176
160
|
const [loading, setLoading] = useState2(false);
|
|
177
|
-
const copyToClipboard = async (link) => {
|
|
161
|
+
const copyToClipboard = /* @__PURE__ */ __name(async (link) => {
|
|
178
162
|
if (link) {
|
|
179
163
|
try {
|
|
180
164
|
setLoading(true);
|
|
@@ -192,16 +176,21 @@ var CopyIconButton = ({
|
|
|
192
176
|
} else {
|
|
193
177
|
console.warn("tried to copy shareUrl before it was generated");
|
|
194
178
|
}
|
|
195
|
-
};
|
|
196
|
-
return /* @__PURE__ */
|
|
197
|
-
|
|
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");
|
|
198
191
|
|
|
199
192
|
// src/out/lib/AnimatedGradientTypography.tsx
|
|
200
|
-
import {
|
|
201
|
-
keyframes,
|
|
202
|
-
styled,
|
|
203
|
-
Typography
|
|
204
|
-
} from "@mui/material";
|
|
193
|
+
import { keyframes, styled, Typography } from "@mui/material";
|
|
205
194
|
var moveBg = keyframes(`
|
|
206
195
|
0% {
|
|
207
196
|
background-position: 100% 0%;
|
|
@@ -210,11 +199,9 @@ var moveBg = keyframes(`
|
|
|
210
199
|
background-position: 0% 0%;
|
|
211
200
|
}
|
|
212
201
|
`);
|
|
213
|
-
var AnimatedGradientTypography = styled(Typography, {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
color2
|
|
217
|
-
}) => {
|
|
202
|
+
var AnimatedGradientTypography = styled(Typography, {
|
|
203
|
+
name: "AnimatedGradientTypography"
|
|
204
|
+
})(({ theme, color1, color2 }) => {
|
|
218
205
|
return {
|
|
219
206
|
// Set the color variables for the gradient
|
|
220
207
|
"--color-one": color1 ?? theme.vars.palette.secondary.dark,
|
|
@@ -249,7 +236,7 @@ var AnimatedGradientTypography = styled(Typography, { name: "AnimatedGradientTyp
|
|
|
249
236
|
});
|
|
250
237
|
|
|
251
238
|
// src/out/lib/splitAroundSubstring.ts
|
|
252
|
-
var splitAroundSubstring = (path, substring) => {
|
|
239
|
+
var splitAroundSubstring = /* @__PURE__ */ __name((path, substring) => {
|
|
253
240
|
const index = path.indexOf(substring);
|
|
254
241
|
if (index === -1) {
|
|
255
242
|
throw new Error(`XNS name "${substring}" not found in path.`);
|
|
@@ -257,23 +244,15 @@ var splitAroundSubstring = (path, substring) => {
|
|
|
257
244
|
const part1 = path.slice(0, index);
|
|
258
245
|
const part2 = substring;
|
|
259
246
|
const part3 = path.slice(index + substring.length);
|
|
260
|
-
return [
|
|
261
|
-
|
|
247
|
+
return [
|
|
248
|
+
part1,
|
|
249
|
+
part2,
|
|
250
|
+
part3
|
|
251
|
+
];
|
|
252
|
+
}, "splitAroundSubstring");
|
|
262
253
|
|
|
263
254
|
// src/out/CopyLinkStack.tsx
|
|
264
|
-
|
|
265
|
-
var CopyLinkStack = ({
|
|
266
|
-
addToXnsName,
|
|
267
|
-
copiedLinkText,
|
|
268
|
-
copyLinkText,
|
|
269
|
-
shareLinkName,
|
|
270
|
-
shareUrl,
|
|
271
|
-
xnsName: xnsNameProp,
|
|
272
|
-
xnsEndColor,
|
|
273
|
-
uploadPayloads,
|
|
274
|
-
xnsStartColor,
|
|
275
|
-
...props
|
|
276
|
-
}) => {
|
|
255
|
+
var CopyLinkStack = /* @__PURE__ */ __name(({ addToXnsName, copiedLinkText, copyLinkText, shareLinkName, shareUrl, xnsName: xnsNameProp, xnsEndColor, uploadPayloads, xnsStartColor, ...props }) => {
|
|
277
256
|
const [error, setError] = useState3();
|
|
278
257
|
const onClickError = useCallback((error2) => {
|
|
279
258
|
setError(error2);
|
|
@@ -289,160 +268,162 @@ var CopyLinkStack = ({
|
|
|
289
268
|
}
|
|
290
269
|
}, []);
|
|
291
270
|
const [part1, xnsName, part3] = parsedXnsName || [];
|
|
292
|
-
return /* @__PURE__ */
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}
|
|
271
|
+
return /* @__PURE__ */ React7.createElement(Stack, {
|
|
272
|
+
direction: "row",
|
|
273
|
+
alignItems: "center",
|
|
274
|
+
gap: 0.25,
|
|
275
|
+
...props
|
|
276
|
+
}, xnsName && addToXnsName ? /* @__PURE__ */ React7.createElement(Stack, {
|
|
277
|
+
direction: "row",
|
|
278
|
+
maxWidth: "100%",
|
|
279
|
+
sx: {
|
|
280
|
+
overflowX: "auto"
|
|
281
|
+
}
|
|
282
|
+
}, /* @__PURE__ */ React7.createElement(Typography2, {
|
|
283
|
+
sx: {
|
|
284
|
+
display: "inline-flex"
|
|
285
|
+
}
|
|
286
|
+
}, part1), /* @__PURE__ */ React7.createElement(AnimatedGradientTypography, {
|
|
287
|
+
color1: xnsStartColor,
|
|
288
|
+
color2: xnsEndColor,
|
|
289
|
+
sx: {
|
|
290
|
+
display: "inline-flex"
|
|
291
|
+
}
|
|
292
|
+
}, xnsName), /* @__PURE__ */ React7.createElement(Typography2, {
|
|
293
|
+
sx: {
|
|
294
|
+
display: "inline-flex"
|
|
295
|
+
}
|
|
296
|
+
}, part3)) : /* @__PURE__ */ React7.createElement(Typography2, {
|
|
297
|
+
sx: {
|
|
298
|
+
display: "inline-flex",
|
|
299
|
+
maxWidth: "100%",
|
|
300
|
+
overflow: "auto"
|
|
301
|
+
}
|
|
302
|
+
}, shareUrl), /* @__PURE__ */ React7.createElement(CopyIconButton, {
|
|
303
|
+
copiedLinkText,
|
|
304
|
+
copyLinkText,
|
|
305
|
+
onClickError,
|
|
306
|
+
shareLinkName,
|
|
307
|
+
shareUrl,
|
|
308
|
+
sx: {
|
|
309
|
+
display: "inline-flex"
|
|
310
|
+
},
|
|
311
|
+
uploadPayloads
|
|
312
|
+
}), error ? /* @__PURE__ */ React7.createElement(Tooltip2, {
|
|
313
|
+
title: error.message
|
|
314
|
+
}, /* @__PURE__ */ React7.createElement(Cancel, {
|
|
315
|
+
color: "error",
|
|
316
|
+
sx: {
|
|
317
|
+
display: "inline-flex"
|
|
318
|
+
}
|
|
319
|
+
})) : null);
|
|
320
|
+
}, "CopyLinkStack");
|
|
323
321
|
|
|
324
322
|
// src/out/CopyLinkTextField.tsx
|
|
325
323
|
import { InputAdornment, TextField } from "@mui/material";
|
|
326
|
-
import { useCallback as useCallback2, useState as useState4 } from "react";
|
|
327
|
-
|
|
328
|
-
var CopyLinkTextField = ({
|
|
329
|
-
shareLinkName,
|
|
330
|
-
shareUrl,
|
|
331
|
-
...props
|
|
332
|
-
}) => {
|
|
324
|
+
import React8, { useCallback as useCallback2, useState as useState4 } from "react";
|
|
325
|
+
var CopyLinkTextField = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, ...props }) => {
|
|
333
326
|
const [error, setError] = useState4();
|
|
334
327
|
const onClickError = useCallback2((error2) => {
|
|
335
328
|
setError(error2);
|
|
336
329
|
}, []);
|
|
337
|
-
return /* @__PURE__ */
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
330
|
+
return /* @__PURE__ */ React8.createElement(TextField, {
|
|
331
|
+
disabled: true,
|
|
332
|
+
error: !!error,
|
|
333
|
+
helperText: error?.message,
|
|
334
|
+
// to override the color that appears when it's a text field, only on dark mode
|
|
335
|
+
sx: {
|
|
336
|
+
input: {
|
|
337
|
+
WebkitTextFillColor: "lightgray !important"
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
value: shareUrl,
|
|
341
|
+
...props,
|
|
342
|
+
slotProps: {
|
|
343
|
+
input: {
|
|
344
|
+
endAdornment: /* @__PURE__ */ React8.createElement(InputAdornment, {
|
|
345
|
+
position: "end"
|
|
346
|
+
}, /* @__PURE__ */ React8.createElement(CopyIconButton, {
|
|
347
|
+
shareLinkName,
|
|
348
|
+
shareUrl,
|
|
349
|
+
onClickError
|
|
350
|
+
}))
|
|
350
351
|
}
|
|
351
352
|
}
|
|
352
|
-
);
|
|
353
|
-
};
|
|
353
|
+
});
|
|
354
|
+
}, "CopyLinkTextField");
|
|
354
355
|
|
|
355
356
|
// src/out/Dialog.tsx
|
|
356
|
-
import {
|
|
357
|
-
Dialog,
|
|
358
|
-
DialogActions,
|
|
359
|
-
DialogContent,
|
|
360
|
-
DialogTitle,
|
|
361
|
-
Stack as Stack2,
|
|
362
|
-
Typography as Typography3
|
|
363
|
-
} from "@mui/material";
|
|
357
|
+
import { Dialog, DialogActions, DialogContent, DialogTitle, Stack as Stack2, Typography as Typography3 } from "@mui/material";
|
|
364
358
|
import { FlexCol, FlexGrowCol } from "@xylabs/react-flexbox";
|
|
365
|
-
import
|
|
366
|
-
var ShareOutDialog = ({
|
|
367
|
-
|
|
368
|
-
cardImg,
|
|
369
|
-
open,
|
|
370
|
-
onClose,
|
|
371
|
-
shareOutDialogContent,
|
|
372
|
-
subtitle,
|
|
373
|
-
title,
|
|
374
|
-
...props
|
|
375
|
-
}) => {
|
|
376
|
-
const handleClose = () => {
|
|
359
|
+
import React9 from "react";
|
|
360
|
+
var ShareOutDialog = /* @__PURE__ */ __name(({ ShareOutDialogActions, cardImg, open, onClose, shareOutDialogContent, subtitle, title, ...props }) => {
|
|
361
|
+
const handleClose = /* @__PURE__ */ __name(() => {
|
|
377
362
|
onClose?.("", "backdropClick");
|
|
378
|
-
};
|
|
379
|
-
return /* @__PURE__ */
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
363
|
+
}, "handleClose");
|
|
364
|
+
return /* @__PURE__ */ React9.createElement(Dialog, {
|
|
365
|
+
onClose,
|
|
366
|
+
open,
|
|
367
|
+
...props
|
|
368
|
+
}, /* @__PURE__ */ React9.createElement(DialogTitle, null, /* @__PURE__ */ React9.createElement(Stack2, {
|
|
369
|
+
direction: "row",
|
|
370
|
+
spacing: 2
|
|
371
|
+
}, /* @__PURE__ */ React9.createElement(FlexGrowCol, {
|
|
372
|
+
alignItems: "flex-start",
|
|
373
|
+
width: "60%"
|
|
374
|
+
}, /* @__PURE__ */ React9.createElement(Typography3, {
|
|
375
|
+
variant: "h5"
|
|
376
|
+
}, title), /* @__PURE__ */ React9.createElement(Typography3, {
|
|
377
|
+
variant: "body1"
|
|
378
|
+
}, " ", subtitle)), /* @__PURE__ */ React9.createElement(FlexGrowCol, {
|
|
379
|
+
alignItems: "flex-end",
|
|
380
|
+
width: "40%"
|
|
381
|
+
}, cardImg))), /* @__PURE__ */ React9.createElement(DialogContent, null, shareOutDialogContent, /* @__PURE__ */ React9.createElement(FlexCol, {
|
|
382
|
+
alignItems: "stretch"
|
|
383
|
+
})), ShareOutDialogActions ? /* @__PURE__ */ React9.createElement(DialogActions, null, /* @__PURE__ */ React9.createElement(ShareOutDialogActions, {
|
|
384
|
+
onClose: handleClose
|
|
385
|
+
})) : null);
|
|
386
|
+
}, "ShareOutDialog");
|
|
397
387
|
|
|
398
388
|
// src/out/Explanation.tsx
|
|
399
389
|
import { InfoOutlined } from "@mui/icons-material";
|
|
400
|
-
import {
|
|
401
|
-
Tooltip as Tooltip3,
|
|
402
|
-
Typography as Typography4,
|
|
403
|
-
useTheme
|
|
404
|
-
} from "@mui/material";
|
|
390
|
+
import { Tooltip as Tooltip3, Typography as Typography4, useTheme } from "@mui/material";
|
|
405
391
|
import { FlexGrowRow as FlexGrowRow2 } from "@xylabs/react-flexbox";
|
|
406
|
-
import
|
|
407
|
-
var ShareOutExplanation = ({ toolTipTitle }) => {
|
|
392
|
+
import React10 from "react";
|
|
393
|
+
var ShareOutExplanation = /* @__PURE__ */ __name(({ toolTipTitle }) => {
|
|
408
394
|
const theme = useTheme();
|
|
409
395
|
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.";
|
|
410
|
-
return /* @__PURE__ */
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
396
|
+
return /* @__PURE__ */ React10.createElement(FlexGrowRow2, {
|
|
397
|
+
alignItems: "center"
|
|
398
|
+
}, /* @__PURE__ */ React10.createElement(Typography4, {
|
|
399
|
+
variant: "body2",
|
|
400
|
+
paddingRight: 0.5
|
|
401
|
+
}, "What am I sharing?"), /* @__PURE__ */ React10.createElement(Tooltip3, {
|
|
402
|
+
title,
|
|
403
|
+
placement: "bottom"
|
|
404
|
+
}, /* @__PURE__ */ React10.createElement(InfoOutlined, {
|
|
405
|
+
fontSize: "small",
|
|
406
|
+
sx: {
|
|
407
|
+
fontSize: theme.typography.caption.fontSize
|
|
408
|
+
}
|
|
409
|
+
})));
|
|
410
|
+
}, "ShareOutExplanation");
|
|
422
411
|
|
|
423
412
|
// src/out/GenerateShareLinkButton.tsx
|
|
424
|
-
import {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
})
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
variant: "contained",
|
|
439
|
-
startIcon: loading ? /* @__PURE__ */ jsx11(StyledCircularProgress, { size: "small" }) : null,
|
|
440
|
-
...props,
|
|
441
|
-
children
|
|
442
|
-
}
|
|
443
|
-
);
|
|
444
|
-
};
|
|
445
|
-
var StyledCircularProgress = styled2(CircularProgress2, { name: "StyledCircularProgress" })(({ theme }) => ({
|
|
413
|
+
import { Button, CircularProgress as CircularProgress2, styled as styled2 } from "@mui/material";
|
|
414
|
+
import React11 from "react";
|
|
415
|
+
var GenerateShareLinkButton = /* @__PURE__ */ __name(({ children = "Generate My Share Link", loading, ...props }) => {
|
|
416
|
+
return /* @__PURE__ */ React11.createElement(Button, {
|
|
417
|
+
variant: "contained",
|
|
418
|
+
startIcon: loading ? /* @__PURE__ */ React11.createElement(StyledCircularProgress, {
|
|
419
|
+
size: "small"
|
|
420
|
+
}) : null,
|
|
421
|
+
...props
|
|
422
|
+
}, children);
|
|
423
|
+
}, "GenerateShareLinkButton");
|
|
424
|
+
var StyledCircularProgress = styled2(CircularProgress2, {
|
|
425
|
+
name: "StyledCircularProgress"
|
|
426
|
+
})(({ theme }) => ({
|
|
446
427
|
// ensure the color of the spinner is the same as the button color
|
|
447
428
|
color: theme.vars.palette.primary.contrastText,
|
|
448
429
|
height: "20px",
|
|
@@ -453,37 +434,32 @@ var StyledCircularProgress = styled2(CircularProgress2, { name: "StyledCircularP
|
|
|
453
434
|
// src/out/HeadingFlexbox.tsx
|
|
454
435
|
import { Typography as Typography5 } from "@mui/material";
|
|
455
436
|
import { FlexGrowCol as FlexGrowCol2 } from "@xylabs/react-flexbox";
|
|
456
|
-
import
|
|
457
|
-
var ShareOutHeadingFlexbox = ({
|
|
458
|
-
children,
|
|
459
|
-
shareLinkName,
|
|
460
|
-
shareUrl,
|
|
461
|
-
...props
|
|
462
|
-
}) => {
|
|
437
|
+
import React12 from "react";
|
|
438
|
+
var ShareOutHeadingFlexbox = /* @__PURE__ */ __name(({ children, shareLinkName, shareUrl, ...props }) => {
|
|
463
439
|
const GenerateShareLinkExplanation = "When you generate your share link, we'll make a small amount of your data public so friends can check it out!";
|
|
464
|
-
return /* @__PURE__ */
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
440
|
+
return /* @__PURE__ */ React12.createElement(FlexGrowCol2, {
|
|
441
|
+
alignItems: "flex-start",
|
|
442
|
+
paddingBottom: 1,
|
|
443
|
+
...props
|
|
444
|
+
}, /* @__PURE__ */ React12.createElement(Typography5, {
|
|
445
|
+
variant: "body1",
|
|
446
|
+
gutterBottom: true
|
|
447
|
+
}, /* @__PURE__ */ React12.createElement("strong", null, "Your Share Link")), /* @__PURE__ */ React12.createElement(Typography5, {
|
|
448
|
+
variant: "body1"
|
|
449
|
+
}, shareUrl ? `Use this link or the buttons below to share ${shareLinkName}` : GenerateShareLinkExplanation), children);
|
|
450
|
+
}, "ShareOutHeadingFlexbox");
|
|
470
451
|
|
|
471
452
|
// src/out/SocialButtonsFlexbox.tsx
|
|
472
453
|
import { Typography as Typography6 } from "@mui/material";
|
|
473
454
|
import { ButtonEx as ButtonEx2 } from "@xylabs/react-button";
|
|
474
455
|
import { ErrorRender } from "@xylabs/react-error";
|
|
475
456
|
import { FlexGrowCol as FlexGrowCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
476
|
-
import { useState as useState5 } from "react";
|
|
477
|
-
|
|
478
|
-
var SocialButtonsFlexbox = ({
|
|
479
|
-
shareUrl,
|
|
480
|
-
uploadPayloads,
|
|
481
|
-
...props
|
|
482
|
-
}) => {
|
|
457
|
+
import React13, { useState as useState5 } from "react";
|
|
458
|
+
var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, uploadPayloads, ...props }) => {
|
|
483
459
|
const [error, setError] = useState5();
|
|
484
460
|
const [xLoading, setXLoading] = useState5(false);
|
|
485
461
|
const [fbLoading, setFbLoading] = useState5(false);
|
|
486
|
-
const handleClick = async (openUrl, buttonName) => {
|
|
462
|
+
const handleClick = /* @__PURE__ */ __name(async (openUrl, buttonName) => {
|
|
487
463
|
const setLoading = buttonName === "x" ? setXLoading : setFbLoading;
|
|
488
464
|
try {
|
|
489
465
|
setLoading(true);
|
|
@@ -495,49 +471,53 @@ var SocialButtonsFlexbox = ({
|
|
|
495
471
|
console.error("Error uploading payloads", e);
|
|
496
472
|
setError(e);
|
|
497
473
|
}
|
|
498
|
-
};
|
|
499
|
-
return /* @__PURE__ */
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
busy: xLoading,
|
|
513
|
-
onClick: async () => {
|
|
514
|
-
const openUrl = () => window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(shareUrl)}`);
|
|
515
|
-
await handleClick(openUrl, "x");
|
|
516
|
-
},
|
|
517
|
-
startIcon: /* @__PURE__ */ jsx13(XTwitterSvgIcon, { width: "20px" }),
|
|
518
|
-
children: "Share on X (Twitter)"
|
|
519
|
-
}
|
|
520
|
-
),
|
|
521
|
-
/* @__PURE__ */ jsx13(
|
|
522
|
-
ButtonEx2,
|
|
523
|
-
{
|
|
524
|
-
busy: fbLoading,
|
|
525
|
-
variant: "contained",
|
|
526
|
-
style: { backgroundColor: "#4267b2", color: "#fff" },
|
|
527
|
-
onClick: async () => {
|
|
528
|
-
const openUrl = () => window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`);
|
|
529
|
-
await handleClick(openUrl, "fb");
|
|
530
|
-
},
|
|
531
|
-
startIcon: /* @__PURE__ */ jsx13(FacebookSvgIcon, {}),
|
|
532
|
-
children: "Share on Facebook"
|
|
533
|
-
}
|
|
534
|
-
)
|
|
535
|
-
] }) : null
|
|
474
|
+
}, "handleClick");
|
|
475
|
+
return /* @__PURE__ */ React13.createElement(FlexGrowCol3, {
|
|
476
|
+
alignItems: "stretch",
|
|
477
|
+
paddingTop: 2,
|
|
478
|
+
...props
|
|
479
|
+
}, /* @__PURE__ */ React13.createElement(Typography6, {
|
|
480
|
+
variant: "body1",
|
|
481
|
+
gutterBottom: true
|
|
482
|
+
}, /* @__PURE__ */ React13.createElement("strong", null, "Share on Social Media")), /* @__PURE__ */ React13.createElement(FlexRow2, {
|
|
483
|
+
gap: 0.5,
|
|
484
|
+
sx: {
|
|
485
|
+
flexDirection: {
|
|
486
|
+
md: "row",
|
|
487
|
+
xs: "column"
|
|
536
488
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
489
|
+
}
|
|
490
|
+
}, shareUrl ? /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(ButtonEx2, {
|
|
491
|
+
variant: "contained",
|
|
492
|
+
style: {
|
|
493
|
+
backgroundColor: "#000",
|
|
494
|
+
color: "#fff"
|
|
495
|
+
},
|
|
496
|
+
busy: xLoading,
|
|
497
|
+
onClick: /* @__PURE__ */ __name(async () => {
|
|
498
|
+
const openUrl = /* @__PURE__ */ __name(() => window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(shareUrl)}`), "openUrl");
|
|
499
|
+
await handleClick(openUrl, "x");
|
|
500
|
+
}, "onClick"),
|
|
501
|
+
startIcon: /* @__PURE__ */ React13.createElement(XTwitterSvgIcon, {
|
|
502
|
+
width: "20px"
|
|
503
|
+
})
|
|
504
|
+
}, "Share on X (Twitter)"), /* @__PURE__ */ React13.createElement(ButtonEx2, {
|
|
505
|
+
busy: fbLoading,
|
|
506
|
+
variant: "contained",
|
|
507
|
+
style: {
|
|
508
|
+
backgroundColor: "#4267b2",
|
|
509
|
+
color: "#fff"
|
|
510
|
+
},
|
|
511
|
+
onClick: /* @__PURE__ */ __name(async () => {
|
|
512
|
+
const openUrl = /* @__PURE__ */ __name(() => window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`), "openUrl");
|
|
513
|
+
await handleClick(openUrl, "fb");
|
|
514
|
+
}, "onClick"),
|
|
515
|
+
startIcon: /* @__PURE__ */ React13.createElement(FacebookSvgIcon, null)
|
|
516
|
+
}, "Share on Facebook")) : null), /* @__PURE__ */ React13.createElement(ErrorRender, {
|
|
517
|
+
error,
|
|
518
|
+
scope: "SocialButtonsFlexbox"
|
|
519
|
+
}));
|
|
520
|
+
}, "SocialButtonsFlexbox");
|
|
541
521
|
export {
|
|
542
522
|
CopyLinkStack,
|
|
543
523
|
CopyLinkTextField,
|