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