@xyo-network/react-share 7.5.8 → 7.5.11
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.d.ts.map +1 -1
- package/dist/browser/index.mjs +361 -338
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/out/CopyLinkStack.d.ts.map +1 -1
- package/dist/browser/out/lib/AnimatedGradientTypography.d.ts +4 -2
- package/dist/browser/out/lib/AnimatedGradientTypography.d.ts.map +1 -1
- package/package.json +70 -29
- package/src/button/ShareButton.stories.tsx +0 -23
- package/src/button/ShareButton.tsx +0 -75
- package/src/button/index.ts +0 -1
- package/src/global.d.ts +0 -1
- package/src/icons/index.ts +0 -1
- package/src/icons/social/Facebook.tsx +0 -11
- package/src/icons/social/XTwitter.tsx +0 -10
- package/src/icons/social/index.ts +0 -2
- package/src/index.ts +0 -4
- package/src/meta-server/dynamic-share/DynamicShareImage.tsx +0 -23
- package/src/meta-server/dynamic-share/index.ts +0 -1
- package/src/meta-server/index.ts +0 -2
- package/src/meta-server/live-share/HideParentsFlexbox.tsx +0 -40
- package/src/meta-server/live-share/index.ts +0 -1
- package/src/out/CopyIconButton.tsx +0 -58
- package/src/out/CopyLinkStack.stories.tsx +0 -69
- package/src/out/CopyLinkStack.tsx +0 -77
- package/src/out/CopyLinkTextField.stories.tsx +0 -18
- package/src/out/CopyLinkTextField.tsx +0 -41
- package/src/out/Dialog.stories.tsx +0 -78
- package/src/out/Dialog.tsx +0 -48
- package/src/out/Explanation.tsx +0 -29
- package/src/out/GenerateShareLinkButton.stories.tsx +0 -18
- package/src/out/GenerateShareLinkButton.tsx +0 -31
- package/src/out/HeadingFlexbox.tsx +0 -27
- package/src/out/SocialButtonsFlexbox.stories.tsx +0 -41
- package/src/out/SocialButtonsFlexbox.tsx +0 -79
- package/src/out/index.ts +0 -7
- package/src/out/lib/AnimatedGradientTypography.tsx +0 -54
- package/src/out/lib/ShareLinkProps.ts +0 -8
- package/src/out/lib/index.ts +0 -3
- package/src/out/lib/splitAroundSubstring.ts +0 -19
package/dist/browser/index.mjs
CHANGED
|
@@ -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 {
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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");
|
|
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
|
|
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");
|
|
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
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
|
111
|
-
|
|
112
|
-
|
|
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__ */
|
|
139
|
-
|
|
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 {
|
|
149
|
-
|
|
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 {
|
|
164
|
+
import {
|
|
165
|
+
CircularProgress,
|
|
166
|
+
IconButton,
|
|
167
|
+
Tooltip
|
|
168
|
+
} from "@mui/material";
|
|
154
169
|
import { forget } from "@xylabs/sdk-js";
|
|
155
|
-
import
|
|
156
|
-
|
|
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,
|
|
183
|
+
const [copyTooltipTitle, setCopyTooltipTitle] = useState2(CopyLink);
|
|
160
184
|
const [loading, setLoading] = useState2(false);
|
|
161
|
-
const copyToClipboard =
|
|
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
|
-
|
|
168
|
-
setTimeout(() =>
|
|
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
|
-
}
|
|
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");
|
|
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 {
|
|
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
|
-
|
|
204
|
-
|
|
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 =
|
|
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
|
-
|
|
249
|
-
part2,
|
|
250
|
-
part3
|
|
251
|
-
];
|
|
252
|
-
}, "splitAroundSubstring");
|
|
268
|
+
return [part1, part2, part3];
|
|
269
|
+
};
|
|
253
270
|
|
|
254
271
|
// src/out/CopyLinkStack.tsx
|
|
255
|
-
|
|
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
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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__ */
|
|
276
|
-
direction: "row",
|
|
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
|
-
|
|
303
|
-
|
|
304
|
-
|
|
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
|
|
329
|
-
|
|
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__ */
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
input: {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
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
|
-
}
|
|
359
|
+
);
|
|
360
|
+
};
|
|
359
361
|
|
|
360
362
|
// src/out/Dialog.tsx
|
|
361
|
-
import {
|
|
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
|
|
364
|
-
var ShareOutDialog =
|
|
365
|
-
|
|
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
|
-
}
|
|
368
|
-
return /* @__PURE__ */
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
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 {
|
|
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
|
|
397
|
-
var ShareOutExplanation =
|
|
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__ */
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
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 {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
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
|
|
442
|
-
var ShareOutHeadingFlexbox =
|
|
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__ */
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
}
|
|
449
|
-
|
|
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
|
|
462
|
-
|
|
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 =
|
|
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
|
-
}
|
|
479
|
-
return /* @__PURE__ */
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
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
|
-
|
|
495
|
-
|
|
496
|
-
|
|
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,
|