@xyo-network/react-share 2.82.0 → 2.83.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/index.d.ts +60 -2
- package/dist/browser/index.mjs +224 -2
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +7 -22
- package/src/button/index.ts +1 -0
- package/src/icons/index.ts +1 -0
- package/src/icons/social/Facebook.tsx +10 -0
- package/src/icons/social/XTwitter.tsx +8 -0
- package/src/icons/social/index.ts +2 -0
- package/src/index.ts +3 -1
- package/src/out/CopyLinkTextField.stories.tsx +22 -0
- package/src/out/CopyLinkTextField.tsx +48 -0
- package/src/out/Dialog.stories.tsx +72 -0
- package/src/out/Dialog.tsx +42 -0
- package/src/out/Explanation.tsx +28 -0
- package/src/out/GenerateShareLinkButton.stories.tsx +22 -0
- package/src/out/GenerateShareLinkButton.tsx +26 -0
- package/src/out/HeadingFlexbox.tsx +24 -0
- package/src/out/SocialButtonsFlexbox.stories.tsx +22 -0
- package/src/out/SocialButtonsFlexbox.tsx +48 -0
- package/src/out/index.ts +6 -0
- package/xy.config.ts +12 -0
- package/dist/browser/ShareButton.d.cts +0 -8
- package/dist/browser/ShareButton.d.cts.map +0 -1
- package/dist/browser/ShareButton.d.mts +0 -8
- package/dist/browser/ShareButton.d.mts.map +0 -1
- package/dist/browser/ShareButton.d.ts +0 -8
- package/dist/browser/ShareButton.d.ts.map +0 -1
- package/dist/browser/index.cjs +0 -96
- package/dist/browser/index.cjs.map +0 -1
- package/dist/browser/index.d.cts +0 -2
- package/dist/browser/index.d.cts.map +0 -1
- package/dist/browser/index.d.mts +0 -2
- package/dist/browser/index.d.mts.map +0 -1
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/neutral/ShareButton.d.cts +0 -8
- package/dist/neutral/ShareButton.d.cts.map +0 -1
- package/dist/neutral/ShareButton.d.mts +0 -8
- package/dist/neutral/ShareButton.d.mts.map +0 -1
- package/dist/neutral/ShareButton.d.ts +0 -8
- package/dist/neutral/ShareButton.d.ts.map +0 -1
- package/dist/neutral/index.cjs +0 -96
- package/dist/neutral/index.cjs.map +0 -1
- package/dist/neutral/index.d.cts +0 -2
- package/dist/neutral/index.d.cts.map +0 -1
- package/dist/neutral/index.d.mts +0 -2
- package/dist/neutral/index.d.mts.map +0 -1
- package/dist/neutral/index.d.ts +0 -2
- package/dist/neutral/index.d.ts.map +0 -1
- package/dist/neutral/index.mjs +0 -65
- package/dist/neutral/index.mjs.map +0 -1
- package/dist/node/ShareButton.d.cts +0 -8
- package/dist/node/ShareButton.d.cts.map +0 -1
- package/dist/node/ShareButton.d.mts +0 -8
- package/dist/node/ShareButton.d.mts.map +0 -1
- package/dist/node/ShareButton.d.ts +0 -8
- package/dist/node/ShareButton.d.ts.map +0 -1
- package/dist/node/index.cjs +0 -100
- package/dist/node/index.cjs.map +0 -1
- package/dist/node/index.d.cts +0 -2
- package/dist/node/index.d.cts.map +0 -1
- package/dist/node/index.d.mts +0 -2
- package/dist/node/index.d.mts.map +0 -1
- package/dist/node/index.d.ts +0 -2
- package/dist/node/index.d.ts.map +0 -1
- package/dist/node/index.mjs +0 -65
- package/dist/node/index.mjs.map +0 -1
- /package/src/{ShareButton.stories.tsx → button/ShareButton.stories.tsx} +0 -0
- /package/src/{ShareButton.tsx → button/ShareButton.tsx} +0 -0
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,2 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ButtonExProps } from '@xylabs/react-button';
|
|
2
|
+
import React, { ComponentType, ReactNode } from 'react';
|
|
3
|
+
import * as _mui_material_OverridableComponent_js from '@mui/material/OverridableComponent.js';
|
|
4
|
+
import * as _mui_material from '@mui/material';
|
|
5
|
+
import { StandardTextFieldProps, DialogProps, ButtonProps } from '@mui/material';
|
|
6
|
+
import { FlexBoxProps } from '@xylabs/react-flexbox';
|
|
7
|
+
|
|
8
|
+
interface ShareButtonProps extends ButtonExProps {
|
|
9
|
+
prepared?: boolean;
|
|
10
|
+
shareLink?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const ShareButton: React.FC<ShareButtonProps>;
|
|
13
|
+
|
|
14
|
+
declare const FacebookSvgIcon: _mui_material_OverridableComponent_js.OverridableComponent<_mui_material.SvgIconTypeMap<{}, "svg">> & {
|
|
15
|
+
muiName: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
declare const XTwitterSvgIcon: _mui_material_OverridableComponent_js.OverridableComponent<_mui_material.SvgIconTypeMap<{}, "svg">> & {
|
|
19
|
+
muiName: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
interface CopyLinkTextFieldProps extends StandardTextFieldProps {
|
|
23
|
+
shareLinkName?: string;
|
|
24
|
+
shareUrl?: string;
|
|
25
|
+
}
|
|
26
|
+
declare const CopyLinkTextField: React.FC<CopyLinkTextFieldProps>;
|
|
27
|
+
|
|
28
|
+
interface ShareOutDialogProps extends DialogProps {
|
|
29
|
+
ShareOutDialogActions?: ComponentType<{
|
|
30
|
+
onClose?: () => void;
|
|
31
|
+
}>;
|
|
32
|
+
cardImg?: ReactNode;
|
|
33
|
+
shareOutDialogContent?: ReactNode;
|
|
34
|
+
subtitle?: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
}
|
|
37
|
+
declare const ShareOutDialog: React.FC<ShareOutDialogProps>;
|
|
38
|
+
|
|
39
|
+
interface ShareOutExplanationProps {
|
|
40
|
+
toolTipTitle?: string;
|
|
41
|
+
}
|
|
42
|
+
declare const ShareOutExplanation: React.FC<ShareOutExplanationProps>;
|
|
43
|
+
|
|
44
|
+
interface GenerateShareLinkButtonProps extends ButtonProps {
|
|
45
|
+
loading?: boolean;
|
|
46
|
+
}
|
|
47
|
+
declare const GenerateShareLinkButton: React.FC<GenerateShareLinkButtonProps>;
|
|
48
|
+
|
|
49
|
+
interface ShareOutHeadingFlexboxProps extends FlexBoxProps {
|
|
50
|
+
shareLinkName?: string;
|
|
51
|
+
shareUrl?: string;
|
|
52
|
+
}
|
|
53
|
+
declare const ShareOutHeadingFlexbox: React.FC<ShareOutHeadingFlexboxProps>;
|
|
54
|
+
|
|
55
|
+
interface SocialButtonsFlexboxProps extends FlexBoxProps {
|
|
56
|
+
shareUrl?: string;
|
|
57
|
+
}
|
|
58
|
+
declare const SocialButtonsFlexbox: React.FC<SocialButtonsFlexboxProps>;
|
|
59
|
+
|
|
60
|
+
export { CopyLinkTextField, type CopyLinkTextFieldProps, FacebookSvgIcon, GenerateShareLinkButton, type GenerateShareLinkButtonProps, ShareButton, type ShareButtonProps, ShareOutDialog, type ShareOutDialogProps, ShareOutExplanation, type ShareOutExplanationProps, ShareOutHeadingFlexbox, type ShareOutHeadingFlexboxProps, SocialButtonsFlexbox, type SocialButtonsFlexboxProps, XTwitterSvgIcon };
|
package/dist/browser/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
-
// src/ShareButton.tsx
|
|
4
|
+
// src/button/ShareButton.tsx
|
|
5
5
|
import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from "@mui/icons-material";
|
|
6
6
|
import { Popover } from "@mui/material";
|
|
7
7
|
import { ButtonEx } from "@xylabs/react-button";
|
|
@@ -59,7 +59,229 @@ var ShareButton = /* @__PURE__ */ __name(({ prepared = true, shareLink, ...props
|
|
|
59
59
|
fontSize: "small"
|
|
60
60
|
})))));
|
|
61
61
|
}, "ShareButton");
|
|
62
|
+
|
|
63
|
+
// src/icons/social/Facebook.tsx
|
|
64
|
+
import { createSvgIcon } from "@mui/material";
|
|
65
|
+
import React2 from "react";
|
|
66
|
+
var FacebookSvgIcon = createSvgIcon(/* @__PURE__ */ React2.createElement("svg", {
|
|
67
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
68
|
+
height: "800",
|
|
69
|
+
width: "1200",
|
|
70
|
+
viewBox: "-204.79995 -341.33325 1774.9329 2047.9995"
|
|
71
|
+
}, /* @__PURE__ */ React2.createElement("path", {
|
|
72
|
+
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",
|
|
73
|
+
fill: "#1877f2"
|
|
74
|
+
}), /* @__PURE__ */ React2.createElement("path", {
|
|
75
|
+
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",
|
|
76
|
+
fill: "#fff"
|
|
77
|
+
})), "Facebook");
|
|
78
|
+
|
|
79
|
+
// src/icons/social/XTwitter.tsx
|
|
80
|
+
import { createSvgIcon as createSvgIcon2 } from "@mui/material";
|
|
81
|
+
import React3 from "react";
|
|
82
|
+
var XTwitterSvgIcon = createSvgIcon2(/* @__PURE__ */ React3.createElement("svg", {
|
|
83
|
+
viewBox: "0 0 1200 1227",
|
|
84
|
+
fill: "none",
|
|
85
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
86
|
+
}, /* @__PURE__ */ React3.createElement("path", {
|
|
87
|
+
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",
|
|
88
|
+
fill: "white"
|
|
89
|
+
})), "XTwitterSvgIcon");
|
|
90
|
+
|
|
91
|
+
// src/out/CopyLinkTextField.tsx
|
|
92
|
+
import { CopyAllRounded } from "@mui/icons-material";
|
|
93
|
+
import { IconButton, InputAdornment, TextField } from "@mui/material";
|
|
94
|
+
import { forget } from "@xylabs/forget";
|
|
95
|
+
import React4, { useState as useState2 } from "react";
|
|
96
|
+
var CopyLinkTextField = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, ...props }) => {
|
|
97
|
+
const [error, setError] = useState2();
|
|
98
|
+
const copyToClipboard = /* @__PURE__ */ __name(async (link) => {
|
|
99
|
+
if (link) {
|
|
100
|
+
try {
|
|
101
|
+
await navigator.clipboard.writeText(link);
|
|
102
|
+
} catch (e) {
|
|
103
|
+
const message = "Error copying shareUrl to clipboard";
|
|
104
|
+
console.error(message, e, link);
|
|
105
|
+
setError(new Error(message));
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
console.warn("tried to copy shareUrl before it was generated");
|
|
109
|
+
}
|
|
110
|
+
}, "copyToClipboard");
|
|
111
|
+
return /* @__PURE__ */ React4.createElement(TextField, {
|
|
112
|
+
disabled: true,
|
|
113
|
+
error: !!error,
|
|
114
|
+
helperText: error?.message,
|
|
115
|
+
// to override the color that appears when it's a text field, only on dark mode
|
|
116
|
+
sx: {
|
|
117
|
+
input: {
|
|
118
|
+
WebkitTextFillColor: "lightgray !important"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
InputProps: {
|
|
122
|
+
endAdornment: /* @__PURE__ */ React4.createElement(InputAdornment, {
|
|
123
|
+
position: "end"
|
|
124
|
+
}, /* @__PURE__ */ React4.createElement(IconButton, {
|
|
125
|
+
"aria-label": `copy ${shareLinkName} link`,
|
|
126
|
+
onClick: /* @__PURE__ */ __name(() => forget(copyToClipboard(shareUrl)), "onClick"),
|
|
127
|
+
edge: "end"
|
|
128
|
+
}, /* @__PURE__ */ React4.createElement(CopyAllRounded, null)))
|
|
129
|
+
},
|
|
130
|
+
value: shareUrl,
|
|
131
|
+
...props
|
|
132
|
+
});
|
|
133
|
+
}, "CopyLinkTextField");
|
|
134
|
+
|
|
135
|
+
// src/out/Dialog.tsx
|
|
136
|
+
import { Dialog, DialogActions, DialogContent, DialogTitle, Stack, Typography } from "@mui/material";
|
|
137
|
+
import { FlexCol, FlexGrowCol } from "@xylabs/react-flexbox";
|
|
138
|
+
import React5 from "react";
|
|
139
|
+
var ShareOutDialog = /* @__PURE__ */ __name(({ ShareOutDialogActions, cardImg, open, onClose, shareOutDialogContent, subtitle, title, ...props }) => {
|
|
140
|
+
const handleClose = /* @__PURE__ */ __name(() => {
|
|
141
|
+
onClose?.("", "backdropClick");
|
|
142
|
+
}, "handleClose");
|
|
143
|
+
return /* @__PURE__ */ React5.createElement(Dialog, {
|
|
144
|
+
onClose,
|
|
145
|
+
open,
|
|
146
|
+
...props
|
|
147
|
+
}, /* @__PURE__ */ React5.createElement(DialogTitle, null, /* @__PURE__ */ React5.createElement(Stack, {
|
|
148
|
+
direction: "row",
|
|
149
|
+
spacing: 2
|
|
150
|
+
}, /* @__PURE__ */ React5.createElement(FlexGrowCol, {
|
|
151
|
+
alignItems: "flex-start",
|
|
152
|
+
width: "60%"
|
|
153
|
+
}, /* @__PURE__ */ React5.createElement(Typography, {
|
|
154
|
+
variant: "h5"
|
|
155
|
+
}, title), /* @__PURE__ */ React5.createElement(Typography, {
|
|
156
|
+
variant: "body1"
|
|
157
|
+
}, " ", subtitle)), /* @__PURE__ */ React5.createElement(FlexGrowCol, {
|
|
158
|
+
alignItems: "flex-end",
|
|
159
|
+
width: "40%"
|
|
160
|
+
}, cardImg))), /* @__PURE__ */ React5.createElement(DialogContent, null, shareOutDialogContent, /* @__PURE__ */ React5.createElement(FlexCol, {
|
|
161
|
+
alignItems: "stretch"
|
|
162
|
+
})), ShareOutDialogActions ? /* @__PURE__ */ React5.createElement(DialogActions, null, /* @__PURE__ */ React5.createElement(ShareOutDialogActions, {
|
|
163
|
+
onClose: handleClose
|
|
164
|
+
})) : null);
|
|
165
|
+
}, "ShareOutDialog");
|
|
166
|
+
|
|
167
|
+
// src/out/Explanation.tsx
|
|
168
|
+
import { InfoOutlined } from "@mui/icons-material";
|
|
169
|
+
import { Tooltip, Typography as Typography2, useTheme } from "@mui/material";
|
|
170
|
+
import { FlexGrowRow } from "@xylabs/react-flexbox";
|
|
171
|
+
import React6 from "react";
|
|
172
|
+
var ShareOutExplanation = /* @__PURE__ */ __name(({ toolTipTitle }) => {
|
|
173
|
+
const theme = useTheme();
|
|
174
|
+
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.";
|
|
175
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(FlexGrowRow, {
|
|
176
|
+
alignItems: "center"
|
|
177
|
+
}, /* @__PURE__ */ React6.createElement(Typography2, {
|
|
178
|
+
variant: "body2",
|
|
179
|
+
paddingRight: 0.5
|
|
180
|
+
}, "What am I sharing?"), /* @__PURE__ */ React6.createElement(Tooltip, {
|
|
181
|
+
title,
|
|
182
|
+
placement: "bottom"
|
|
183
|
+
}, /* @__PURE__ */ React6.createElement(InfoOutlined, {
|
|
184
|
+
fontSize: "small",
|
|
185
|
+
sx: {
|
|
186
|
+
fontSize: theme.typography.caption.fontSize
|
|
187
|
+
}
|
|
188
|
+
}))));
|
|
189
|
+
}, "ShareOutExplanation");
|
|
190
|
+
|
|
191
|
+
// src/out/GenerateShareLinkButton.tsx
|
|
192
|
+
import { Button, CircularProgress, styled } from "@mui/material";
|
|
193
|
+
import React7 from "react";
|
|
194
|
+
var GenerateShareLinkButton = /* @__PURE__ */ __name(({ children = "Generate My Share Link", loading, ...props }) => {
|
|
195
|
+
return /* @__PURE__ */ React7.createElement(Button, {
|
|
196
|
+
variant: "contained",
|
|
197
|
+
startIcon: loading ? /* @__PURE__ */ React7.createElement(StyledCircularProgress, {
|
|
198
|
+
size: "small"
|
|
199
|
+
}) : null,
|
|
200
|
+
...props
|
|
201
|
+
}, children);
|
|
202
|
+
}, "GenerateShareLinkButton");
|
|
203
|
+
var StyledCircularProgress = styled(CircularProgress, {
|
|
204
|
+
name: "StyledCircularProgress"
|
|
205
|
+
})(({ theme }) => ({
|
|
206
|
+
// ensure the color of the spinner is the same as the button color
|
|
207
|
+
color: theme.palette.getContrastText(theme.palette.primary.main),
|
|
208
|
+
height: "20px",
|
|
209
|
+
opacity: ".87",
|
|
210
|
+
width: "20px"
|
|
211
|
+
}));
|
|
212
|
+
|
|
213
|
+
// src/out/HeadingFlexbox.tsx
|
|
214
|
+
import { Typography as Typography3 } from "@mui/material";
|
|
215
|
+
import { FlexGrowCol as FlexGrowCol2 } from "@xylabs/react-flexbox";
|
|
216
|
+
import React8 from "react";
|
|
217
|
+
var ShareOutHeadingFlexbox = /* @__PURE__ */ __name(({ children, shareLinkName, shareUrl, ...props }) => {
|
|
218
|
+
const GenerateShareLinkExplanation = "When you generate your share link, we'll make a small amount of your data public so friends can check it out!";
|
|
219
|
+
return /* @__PURE__ */ React8.createElement(FlexGrowCol2, {
|
|
220
|
+
alignItems: "flex-start",
|
|
221
|
+
paddingBottom: 1,
|
|
222
|
+
...props
|
|
223
|
+
}, /* @__PURE__ */ React8.createElement(Typography3, {
|
|
224
|
+
variant: "body1",
|
|
225
|
+
gutterBottom: true
|
|
226
|
+
}, /* @__PURE__ */ React8.createElement("strong", null, "Your Share Link")), /* @__PURE__ */ React8.createElement(Typography3, {
|
|
227
|
+
variant: "body1"
|
|
228
|
+
}, shareUrl ? `Use this link or the buttons below to share ${shareLinkName}` : GenerateShareLinkExplanation), children);
|
|
229
|
+
}, "ShareOutHeadingFlexbox");
|
|
230
|
+
|
|
231
|
+
// src/out/SocialButtonsFlexbox.tsx
|
|
232
|
+
import { Typography as Typography4 } from "@mui/material";
|
|
233
|
+
import { ButtonEx as ButtonEx2 } from "@xylabs/react-button";
|
|
234
|
+
import { FlexGrowCol as FlexGrowCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
235
|
+
import React9 from "react";
|
|
236
|
+
var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, ...props }) => {
|
|
237
|
+
return /* @__PURE__ */ React9.createElement(FlexGrowCol3, {
|
|
238
|
+
alignItems: "stretch",
|
|
239
|
+
paddingTop: 2,
|
|
240
|
+
...props
|
|
241
|
+
}, /* @__PURE__ */ React9.createElement(Typography4, {
|
|
242
|
+
variant: "body1",
|
|
243
|
+
gutterBottom: true
|
|
244
|
+
}, /* @__PURE__ */ React9.createElement("strong", null, "Share on Social Media")), /* @__PURE__ */ React9.createElement(FlexRow2, {
|
|
245
|
+
gap: 0.5,
|
|
246
|
+
sx: {
|
|
247
|
+
flexDirection: {
|
|
248
|
+
md: "row",
|
|
249
|
+
xs: "column"
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}, shareUrl ? /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(ButtonEx2, {
|
|
253
|
+
variant: "contained",
|
|
254
|
+
style: {
|
|
255
|
+
backgroundColor: "#000",
|
|
256
|
+
color: "#fff"
|
|
257
|
+
},
|
|
258
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
259
|
+
window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(shareUrl)}`);
|
|
260
|
+
}, "onClick"),
|
|
261
|
+
startIcon: /* @__PURE__ */ React9.createElement(XTwitterSvgIcon, {
|
|
262
|
+
width: "20px"
|
|
263
|
+
})
|
|
264
|
+
}, "Share on X (Twitter)"), /* @__PURE__ */ React9.createElement(ButtonEx2, {
|
|
265
|
+
variant: "contained",
|
|
266
|
+
style: {
|
|
267
|
+
backgroundColor: "#4267b2",
|
|
268
|
+
color: "#fff"
|
|
269
|
+
},
|
|
270
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
271
|
+
window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`);
|
|
272
|
+
}, "onClick"),
|
|
273
|
+
startIcon: /* @__PURE__ */ React9.createElement(FacebookSvgIcon, null)
|
|
274
|
+
}, "Share on Facebook")) : null));
|
|
275
|
+
}, "SocialButtonsFlexbox");
|
|
62
276
|
export {
|
|
63
|
-
|
|
277
|
+
CopyLinkTextField,
|
|
278
|
+
FacebookSvgIcon,
|
|
279
|
+
GenerateShareLinkButton,
|
|
280
|
+
ShareButton,
|
|
281
|
+
ShareOutDialog,
|
|
282
|
+
ShareOutExplanation,
|
|
283
|
+
ShareOutHeadingFlexbox,
|
|
284
|
+
SocialButtonsFlexbox,
|
|
285
|
+
XTwitterSvgIcon
|
|
64
286
|
};
|
|
65
287
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ShareButton.tsx"],"sourcesContent":["import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from '@mui/icons-material'\nimport { Popover } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport React, { useRef, useState } from 'react'\n\nexport interface ShareButtonProps extends ButtonExProps {\n prepared?: boolean\n shareLink?: string\n}\n\nexport const ShareButton: React.FC<ShareButtonProps> = ({ prepared = true, shareLink, ...props }) => {\n const [expanded, setExpanded] = useState(false)\n const anchorRef = useRef(null)\n const link = shareLink ?? window.location.href\n\n return (\n <FlexRow gap={1} ref={anchorRef}>\n <ButtonEx\n variant=\"text\"\n minWidth={32}\n size=\"small\"\n disabled={!prepared}\n onClick={() => {\n setExpanded(true)\n }}\n {...props}\n >\n <ShareIcon htmlColor=\"gray\" fontSize=\"small\" />\n </ButtonEx>\n <Popover open={prepared ? expanded : false} anchorEl={anchorRef.current} onClose={() => setExpanded(false)} transitionDuration={500}>\n <FlexRow gap={0.5} padding={0.5}>\n <LinkEx\n lineHeight={0}\n style={{ color: '#1da1f2' }}\n onClick={() => {\n window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <TwitterIcon fontSize=\"small\" />\n </LinkEx>\n <LinkEx\n lineHeight={0}\n style={{ color: '#4267b2' }}\n onClick={() => {\n window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <FacebookIcon fontSize=\"small\" />\n </LinkEx>\n </FlexRow>\n </Popover>\n </FlexRow>\n )\n}\n"],"mappings":";;;;AAAA,SAASA,YAAYC,cAAcC,SAASC,WAAWC,WAAWC,mBAAmB;AACrF,SAASC,eAAe;AACxB,SAASC,gBAA+B;AACxC,SAASC,eAAe;AACxB,SAASC,cAAc;AACvB,OAAOC,SAASC,QAAQC,gBAAgB;AAOjC,IAAMC,cAA0C,wBAAC,EAAEC,WAAW,MAAMC,WAAW,GAAGC,MAAAA,MAAO;AAC9F,QAAM,CAACC,UAAUC,WAAAA,IAAeC,SAAS,KAAA;AACzC,QAAMC,YAAYC,OAAO,IAAA;AACzB,QAAMC,OAAOP,aAAaQ,OAAOC,SAASC;AAE1C,SACE,sBAAA,cAACC,SAAAA;IAAQC,KAAK;IAAGC,KAAKR;KACpB,sBAAA,cAACS,UAAAA;IACCC,SAAQ;IACRC,UAAU;IACVC,MAAK;IACLC,UAAU,CAACnB;IACXoB,SAAS,6BAAA;AACPhB,kBAAY,IAAA;IACd,GAFS;IAGR,GAAGF;KAEJ,sBAAA,cAACmB,WAAAA;IAAUC,WAAU;IAAOC,UAAS;OAEvC,sBAAA,cAACC,SAAAA;IAAQC,MAAMzB,WAAWG,WAAW;IAAOuB,UAAUpB,UAAUqB;IAASC,SAAS,6BAAMxB,YAAY,KAAA,GAAlB;IAA0ByB,oBAAoB;KAC9H,sBAAA,cAACjB,SAAAA;IAAQC,KAAK;IAAKiB,SAAS;KAC1B,sBAAA,cAACC,QAAAA;IACCC,YAAY;IACZC,OAAO;MAAEC,OAAO;IAAU;IAC1Bd,SAAS,6BAAA;AACPX,aAAOgB,KAAK,wCAAwCU,mBAAmB3B,IAAAA,CAAAA,EAAO;AAC9EJ,kBAAY,KAAA;IACd,GAHS;KAKT,sBAAA,cAACgC,aAAAA;IAAYb,UAAS;OAExB,sBAAA,cAACQ,QAAAA;IACCC,YAAY;IACZC,OAAO;MAAEC,OAAO;IAAU;IAC1Bd,SAAS,6BAAA;AACPX,aAAOgB,KAAK,gDAAgDU,mBAAmB3B,IAAAA,CAAAA,EAAO;AACtFJ,kBAAY,KAAA;IACd,GAHS;KAKT,sBAAA,cAACiC,cAAAA;IAAad,UAAS;;AAMnC,GA7CuD;","names":["Facebook","FacebookIcon","Share","ShareIcon","Twitter","TwitterIcon","Popover","ButtonEx","FlexRow","LinkEx","React","useRef","useState","ShareButton","prepared","shareLink","props","expanded","setExpanded","useState","anchorRef","useRef","link","window","location","href","FlexRow","gap","ref","ButtonEx","variant","minWidth","size","disabled","onClick","ShareIcon","htmlColor","fontSize","Popover","open","anchorEl","current","onClose","transitionDuration","padding","LinkEx","lineHeight","style","color","encodeURIComponent","TwitterIcon","FacebookIcon"]}
|
|
1
|
+
{"version":3,"sources":["../../src/button/ShareButton.tsx","../../src/icons/social/Facebook.tsx","../../src/icons/social/XTwitter.tsx","../../src/out/CopyLinkTextField.tsx","../../src/out/Dialog.tsx","../../src/out/Explanation.tsx","../../src/out/GenerateShareLinkButton.tsx","../../src/out/HeadingFlexbox.tsx","../../src/out/SocialButtonsFlexbox.tsx"],"sourcesContent":["import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from '@mui/icons-material'\nimport { Popover } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport React, { useRef, useState } from 'react'\n\nexport interface ShareButtonProps extends ButtonExProps {\n prepared?: boolean\n shareLink?: string\n}\n\nexport const ShareButton: React.FC<ShareButtonProps> = ({ prepared = true, shareLink, ...props }) => {\n const [expanded, setExpanded] = useState(false)\n const anchorRef = useRef(null)\n const link = shareLink ?? window.location.href\n\n return (\n <FlexRow gap={1} ref={anchorRef}>\n <ButtonEx\n variant=\"text\"\n minWidth={32}\n size=\"small\"\n disabled={!prepared}\n onClick={() => {\n setExpanded(true)\n }}\n {...props}\n >\n <ShareIcon htmlColor=\"gray\" fontSize=\"small\" />\n </ButtonEx>\n <Popover open={prepared ? expanded : false} anchorEl={anchorRef.current} onClose={() => setExpanded(false)} transitionDuration={500}>\n <FlexRow gap={0.5} padding={0.5}>\n <LinkEx\n lineHeight={0}\n style={{ color: '#1da1f2' }}\n onClick={() => {\n window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <TwitterIcon fontSize=\"small\" />\n </LinkEx>\n <LinkEx\n lineHeight={0}\n style={{ color: '#4267b2' }}\n onClick={() => {\n window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <FacebookIcon fontSize=\"small\" />\n </LinkEx>\n </FlexRow>\n </Popover>\n </FlexRow>\n )\n}\n","import { createSvgIcon } from '@mui/material'\nimport React from 'react'\n\nexport const FacebookSvgIcon = createSvgIcon(\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"800\" width=\"1200\" viewBox=\"-204.79995 -341.33325 1774.9329 2047.9995\">\n <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\" />\n <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\" />\n </svg>\n , 'Facebook',\n)\n","import { createSvgIcon } from '@mui/material'\nimport React from 'react'\n\nexport const XTwitterSvgIcon = createSvgIcon(\n <svg viewBox=\"0 0 1200 1227\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <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\" />\n </svg>\n , 'XTwitterSvgIcon')\n","import { CopyAllRounded } from '@mui/icons-material'\nimport { IconButton, InputAdornment, StandardTextFieldProps, TextField } from '@mui/material'\nimport { forget } from '@xylabs/forget'\nimport React, { useState } from 'react'\n\nexport interface CopyLinkTextFieldProps extends StandardTextFieldProps {\n shareLinkName?: string\n shareUrl?: string\n}\n\nexport const CopyLinkTextField: React.FC<CopyLinkTextFieldProps> = ({ shareLinkName, shareUrl, ...props }) => {\n const [error, setError] = useState<Error>()\n\n const copyToClipboard = async (link?: string) => {\n if (link) {\n try {\n await navigator.clipboard.writeText(link)\n } catch (e) {\n const message = 'Error copying shareUrl to clipboard'\n console.error(message, e, link)\n setError(new Error(message))\n }\n } else {\n console.warn('tried to copy shareUrl before it was generated')\n }\n }\n\n return (\n <TextField\n disabled\n error={!!error}\n helperText={error?.message}\n // to override the color that appears when it's a text field, only on dark mode\n sx={{ input: { WebkitTextFillColor: 'lightgray !important' } }}\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton aria-label={`copy ${shareLinkName} link`} onClick={() => forget(copyToClipboard(shareUrl))} edge=\"end\">\n <CopyAllRounded />\n </IconButton>\n </InputAdornment>\n ),\n }}\n value={shareUrl}\n {...props}\n />\n )\n}\n","import { Dialog, DialogActions, DialogContent, DialogProps, DialogTitle, Stack, Typography } from '@mui/material'\nimport { FlexCol, FlexGrowCol } from '@xylabs/react-flexbox'\nimport React, { ComponentType, ReactNode } from 'react'\n\nexport interface ShareOutDialogProps extends DialogProps {\n ShareOutDialogActions?: ComponentType<{ onClose?: () => void }>\n cardImg?: ReactNode\n shareOutDialogContent?: ReactNode\n subtitle?: string\n title?: string\n}\n\nexport const ShareOutDialog: React.FC<ShareOutDialogProps> = ({ ShareOutDialogActions, cardImg, open, onClose, shareOutDialogContent, subtitle, title, ...props }) => {\n const handleClose = () => {\n onClose?.('', 'backdropClick')\n }\n\n return (\n <Dialog onClose={onClose} open={open} {...props}>\n <DialogTitle>\n <Stack direction=\"row\" spacing={2}>\n <FlexGrowCol alignItems=\"flex-start\" width=\"60%\">\n <Typography variant=\"h5\">{title}</Typography>\n <Typography variant=\"body1\">\n {' '}\n {subtitle}\n </Typography>\n </FlexGrowCol>\n <FlexGrowCol alignItems=\"flex-end\" width=\"40%\">\n {cardImg}\n </FlexGrowCol>\n </Stack>\n </DialogTitle>\n <DialogContent>\n {shareOutDialogContent}\n <FlexCol alignItems=\"stretch\">\n </FlexCol>\n </DialogContent>\n {ShareOutDialogActions ? <DialogActions><ShareOutDialogActions onClose={handleClose} /></DialogActions> : null}\n </Dialog>\n )\n}\n","import { InfoOutlined } from '@mui/icons-material'\nimport { Tooltip, Typography, useTheme } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nexport interface ShareOutExplanationProps {\n toolTipTitle?: string\n}\n\nexport const ShareOutExplanation: React.FC<ShareOutExplanationProps> = ({ toolTipTitle }) => {\n const theme = useTheme()\n 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.'\n return (\n <>\n <FlexGrowRow alignItems=\"center\">\n <Typography variant=\"body2\" paddingRight={0.5}>\n What am I sharing?\n </Typography>\n <Tooltip\n title={title}\n placement=\"bottom\"\n >\n <InfoOutlined fontSize=\"small\" sx={{ fontSize: theme.typography.caption.fontSize }} />\n </Tooltip>\n </FlexGrowRow>\n </>\n )\n}\n","import { Button, ButtonProps, CircularProgress, styled } from '@mui/material'\nimport React from 'react'\n\nexport interface GenerateShareLinkButtonProps extends ButtonProps {\n loading?: boolean\n}\n\nexport const GenerateShareLinkButton: React.FC<GenerateShareLinkButtonProps> = ({ children = 'Generate My Share Link', loading, ...props }) => {\n return (\n <Button\n variant=\"contained\"\n startIcon={loading ? <StyledCircularProgress size=\"small\" /> : null}\n {...props}\n >\n {children}\n </Button>\n )\n}\n\nconst StyledCircularProgress = styled(CircularProgress, { name: 'StyledCircularProgress' })(({ theme }) => ({\n // ensure the color of the spinner is the same as the button color\n color: theme.palette.getContrastText(theme.palette.primary.main),\n height: '20px',\n opacity: '.87',\n width: '20px',\n}))\n","import { Typography } from '@mui/material'\nimport { FlexBoxProps, FlexGrowCol } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nexport interface ShareOutHeadingFlexboxProps extends FlexBoxProps {\n shareLinkName?: string\n shareUrl?: string\n}\n\nexport const ShareOutHeadingFlexbox: React.FC<ShareOutHeadingFlexboxProps> = ({ children, shareLinkName, shareUrl, ...props }) => {\n const GenerateShareLinkExplanation = \"When you generate your share link, we'll make a small amount of your data public so friends can check it out!\"\n\n return (\n <FlexGrowCol alignItems=\"flex-start\" paddingBottom={1} {...props}>\n <Typography variant=\"body1\" gutterBottom>\n <strong>Your Share Link</strong>\n </Typography>\n <Typography variant=\"body1\">\n {shareUrl ? `Use this link or the buttons below to share ${shareLinkName}` : GenerateShareLinkExplanation}\n </Typography>\n {children}\n </FlexGrowCol>\n )\n}\n","import { Typography } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { FlexBoxProps, FlexGrowCol, FlexRow } from '@xylabs/react-flexbox'\nimport React from 'react'\n\nimport { FacebookSvgIcon, XTwitterSvgIcon } from '../icons/index.ts'\n\nexport interface SocialButtonsFlexboxProps extends FlexBoxProps {\n shareUrl?: string\n}\n\nexport const SocialButtonsFlexbox: React.FC<SocialButtonsFlexboxProps> = ({ shareUrl, ...props }) => {\n return (\n <FlexGrowCol alignItems=\"stretch\" paddingTop={2} {...props}>\n <Typography variant=\"body1\" gutterBottom>\n <strong>Share on Social Media</strong>\n </Typography>\n <FlexRow gap={0.5} sx={{ flexDirection: { md: 'row', xs: 'column' } }}>\n {shareUrl\n ? (\n <>\n <ButtonEx\n variant=\"contained\"\n style={{ backgroundColor: '#000', color: '#fff' }}\n onClick={() => {\n window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(shareUrl)}`)\n }}\n startIcon={<XTwitterSvgIcon width=\"20px\" />}\n >\n Share on X (Twitter)\n </ButtonEx>\n <ButtonEx\n variant=\"contained\"\n style={{ backgroundColor: '#4267b2', color: '#fff' }}\n onClick={() => {\n window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`)\n }}\n startIcon={<FacebookSvgIcon />}\n >\n Share on Facebook\n </ButtonEx>\n </>\n )\n : null}\n </FlexRow>\n </FlexGrowCol>\n )\n}\n"],"mappings":";;;;AAAA,SAASA,YAAYC,cAAcC,SAASC,WAAWC,WAAWC,mBAAmB;AACrF,SAASC,eAAe;AACxB,SAASC,gBAA+B;AACxC,SAASC,eAAe;AACxB,SAASC,cAAc;AACvB,OAAOC,SAASC,QAAQC,gBAAgB;AAOjC,IAAMC,cAA0C,wBAAC,EAAEC,WAAW,MAAMC,WAAW,GAAGC,MAAAA,MAAO;AAC9F,QAAM,CAACC,UAAUC,WAAAA,IAAeC,SAAS,KAAA;AACzC,QAAMC,YAAYC,OAAO,IAAA;AACzB,QAAMC,OAAOP,aAAaQ,OAAOC,SAASC;AAE1C,SACE,sBAAA,cAACC,SAAAA;IAAQC,KAAK;IAAGC,KAAKR;KACpB,sBAAA,cAACS,UAAA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B;AAC3B,SAASC,YAAAA,iBAAgB;AACzB,SAAuBC,eAAAA,cAAaC,WAAAA,gBAAe;AACnD,OAAOC,YAAW;AAQX,IAAMC,uBAA4D,wBAAC,EAAEC,UAAU,GAAGC,MAAAA,MAAO;AAC9F,SACE,gBAAAC,OAAA,cAACC,cAAAA;IAAYC,YAAW;IAAUC,YAAY;IAAI,GAAGJ;KACnD,gBAAAC,OAAA,cAACI,aAAAA;IAAWC,SAAQ;IAAQC,cAAAA;KAC1B,gBAAAN,OAAA,cAACO,UAAAA,MAAO,uBAAA,CAAA,GAEV,gBAAAP,OAAA,cAACQ,UAAAA;IAAQC,KAAK;IAAKC,IAAI;MAAEC,eAAe;QAAEC,IAAI;QAAOC,IAAI;MAAS;IAAE;KACjEf,WAEK,gBAAAE,OAAA,cAAAA,OAAA,UAAA,MACE,gBAAAA,OAAA,cAACc,WAAAA;IACCT,SAAQ;IACRU,OAAO;MAAEC,iBAAiB;MAAQC,OAAO;IAAO;IAChDC,SAAS,6BAAA;AACPC,aAAOC,KAAK,wCAAwCC,mBAAmBvB,QAAAA,CAAAA,EAAW;IACpF,GAFS;IAGTwB,WAAW,gBAAAtB,OAAA,cAACuB,iBAAAA;MAAgBC,OAAM;;KACnC,sBAAA,GAGD,gBAAAxB,OAAA,cAACc,WAAAA;IACCT,SAAQ;IACRU,OAAO;MAAEC,iBAAiB;MAAWC,OAAO;IAAO;IACnDC,SAAS,6BAAA;AACPC,aAAOC,KAAK,gDAAgDC,mBAAmBvB,QAAAA,CAAAA,EAAW;IAC5F,GAFS;IAGTwB,WAAW,gBAAAtB,OAAA,cAACyB,iBAAAA,IAAAA;KACb,mBAAA,CAAA,IAKL,IAAA,CAAA;AAIZ,GApCyE;","names":["Facebook","FacebookIcon","Share","ShareIcon","Twitter","TwitterIcon","Popover","ButtonEx","FlexRow","LinkEx","React","useRef","useState","ShareButton","prepared","shareLink","props","expanded","setExpanded","useState","anchorRef","useRef","link","window","location","href","FlexRow","gap","ref","ButtonEx","variant","minWidth","size","disabled","onClick","ShareIcon","htmlColor","fontSize","Popover","open","anchorEl","current","onClose","transitionDuration","padding","LinkEx","lineHeight","style","color","encodeURIComponent","TwitterIcon","FacebookIcon","createSvgIcon","React","FacebookSvgIcon","svg","xmlns","height","width","viewBox","path","d","fill","createSvgIcon","React","XTwitterSvgIcon","svg","viewBox","fill","xmlns","path","d","CopyAllRounded","IconButton","InputAdornment","TextField","forget","React","useState","CopyLinkTextField","shareLinkName","shareUrl","props","error","setError","useState","copyToClipboard","link","navigator","clipboard","writeText","e","message","console","Error","warn","React","TextField","disabled","helperText","sx","input","WebkitTextFillColor","InputProps","endAdornment","InputAdornment","position","IconButton","aria-label","onClick","forget","edge","CopyAllRounded","value","Dialog","DialogActions","DialogContent","DialogTitle","Stack","Typography","FlexCol","FlexGrowCol","React","ShareOutDialog","ShareOutDialogActions","cardImg","open","onClose","shareOutDialogContent","subtitle","title","props","handleClose","React","Dialog","DialogTitle","Stack","direction","spacing","FlexGrowCol","alignItems","width","Typography","variant","DialogContent","FlexCol","DialogActions","InfoOutlined","Tooltip","Typography","useTheme","FlexGrowRow","React","ShareOutExplanation","toolTipTitle","theme","useTheme","title","React","FlexGrowRow","alignItems","Typography","variant","paddingRight","Tooltip","placement","InfoOutlined","fontSize","sx","typography","caption","Button","CircularProgress","styled","React","GenerateShareLinkButton","children","loading","props","React","Button","variant","startIcon","StyledCircularProgress","size","styled","CircularProgress","name","theme","color","palette","getContrastText","primary","main","height","opacity","width","Typography","FlexGrowCol","React","ShareOutHeadingFlexbox","children","shareLinkName","shareUrl","props","GenerateShareLinkExplanation","React","FlexGrowCol","alignItems","paddingBottom","Typography","variant","gutterBottom","strong","Typography","ButtonEx","FlexGrowCol","FlexRow","React","SocialButtonsFlexbox","shareUrl","props","React","FlexGrowCol","alignItems","paddingTop","Typography","variant","gutterBottom","strong","FlexRow","gap","sx","flexDirection","md","xs","ButtonEx","style","backgroundColor","color","onClick","window","open","encodeURIComponent","startIcon","XTwitterSvgIcon","width","FacebookSvgIcon"]}
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"@xylabs/forget": "^3.6.12",
|
|
13
14
|
"@xylabs/react-button": "^3.4.2",
|
|
14
15
|
"@xylabs/react-flexbox": "^3.4.2",
|
|
15
16
|
"@xylabs/react-link": "^3.4.2"
|
|
@@ -24,38 +25,22 @@
|
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"@storybook/react": "^8.2.7",
|
|
27
|
-
"@xylabs/ts-scripts-yarn3": "^
|
|
28
|
+
"@xylabs/ts-scripts-yarn3": "^4.0.0-rc.7",
|
|
28
29
|
"typescript": "^5.5.4"
|
|
29
30
|
},
|
|
30
31
|
"description": "Common React library for all XYO projects that use React",
|
|
31
32
|
"docs": "dist/docs.json",
|
|
32
33
|
"exports": {
|
|
33
34
|
".": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
"default": "./dist/node/index.mjs"
|
|
38
|
-
},
|
|
39
|
-
"require": {
|
|
40
|
-
"types": "./dist/node/index.d.cts",
|
|
41
|
-
"default": "./dist/node/index.cjs"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"browser": {
|
|
45
|
-
"import": {
|
|
46
|
-
"types": "./dist/browser/index.d.mts",
|
|
47
|
-
"default": "./dist/browser/index.mjs"
|
|
48
|
-
},
|
|
49
|
-
"require": {
|
|
50
|
-
"types": "./dist/browser/index.d.cts",
|
|
51
|
-
"default": "./dist/browser/index.cjs"
|
|
52
|
-
}
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/browser/index.d.ts",
|
|
37
|
+
"default": "./dist/browser/index.mjs"
|
|
53
38
|
},
|
|
39
|
+
"types": "./dist/browser/index.d.ts",
|
|
54
40
|
"default": "./dist/browser/index.mjs"
|
|
55
41
|
},
|
|
56
42
|
"./package.json": "./package.json"
|
|
57
43
|
},
|
|
58
|
-
"main": "dist/browser/index.cjs",
|
|
59
44
|
"module": "dist/browser/index.mjs",
|
|
60
45
|
"homepage": "https://xyo.network",
|
|
61
46
|
"keywords": [
|
|
@@ -78,6 +63,6 @@
|
|
|
78
63
|
},
|
|
79
64
|
"sideEffects": false,
|
|
80
65
|
"types": "dist/browser/index.d.ts",
|
|
81
|
-
"version": "2.
|
|
66
|
+
"version": "2.83.1",
|
|
82
67
|
"type": "module"
|
|
83
68
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ShareButton.tsx'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './social/index.ts'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createSvgIcon } from '@mui/material'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
export const FacebookSvgIcon = createSvgIcon(
|
|
5
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="800" width="1200" viewBox="-204.79995 -341.33325 1774.9329 2047.9995">
|
|
6
|
+
<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" />
|
|
7
|
+
<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" />
|
|
8
|
+
</svg>
|
|
9
|
+
, 'Facebook',
|
|
10
|
+
)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createSvgIcon } from '@mui/material'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
export const XTwitterSvgIcon = createSvgIcon(
|
|
5
|
+
<svg viewBox="0 0 1200 1227" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
+
<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" />
|
|
7
|
+
</svg>
|
|
8
|
+
, 'XTwitterSvgIcon')
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { CopyLinkTextField } from './CopyLinkTextField.tsx'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'modules/ShareOut/CopyLinkTextField',
|
|
8
|
+
} as Meta<typeof CopyLinkTextField>
|
|
9
|
+
|
|
10
|
+
const Template: StoryFn<typeof CopyLinkTextField> = (props) => {
|
|
11
|
+
return <CopyLinkTextField {...props} />
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Default = Template.bind({})
|
|
15
|
+
Default.args = {}
|
|
16
|
+
|
|
17
|
+
const WithShareUrl = Template.bind({})
|
|
18
|
+
WithShareUrl.args = {
|
|
19
|
+
shareUrl: 'https://google.com',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { Default, WithShareUrl }
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { CopyAllRounded } from '@mui/icons-material'
|
|
2
|
+
import { IconButton, InputAdornment, StandardTextFieldProps, TextField } from '@mui/material'
|
|
3
|
+
import { forget } from '@xylabs/forget'
|
|
4
|
+
import React, { useState } from 'react'
|
|
5
|
+
|
|
6
|
+
export interface CopyLinkTextFieldProps extends StandardTextFieldProps {
|
|
7
|
+
shareLinkName?: string
|
|
8
|
+
shareUrl?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const CopyLinkTextField: React.FC<CopyLinkTextFieldProps> = ({ shareLinkName, shareUrl, ...props }) => {
|
|
12
|
+
const [error, setError] = useState<Error>()
|
|
13
|
+
|
|
14
|
+
const copyToClipboard = async (link?: string) => {
|
|
15
|
+
if (link) {
|
|
16
|
+
try {
|
|
17
|
+
await navigator.clipboard.writeText(link)
|
|
18
|
+
} catch (e) {
|
|
19
|
+
const message = 'Error copying shareUrl to clipboard'
|
|
20
|
+
console.error(message, e, link)
|
|
21
|
+
setError(new Error(message))
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
console.warn('tried to copy shareUrl before it was generated')
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<TextField
|
|
30
|
+
disabled
|
|
31
|
+
error={!!error}
|
|
32
|
+
helperText={error?.message}
|
|
33
|
+
// to override the color that appears when it's a text field, only on dark mode
|
|
34
|
+
sx={{ input: { WebkitTextFillColor: 'lightgray !important' } }}
|
|
35
|
+
InputProps={{
|
|
36
|
+
endAdornment: (
|
|
37
|
+
<InputAdornment position="end">
|
|
38
|
+
<IconButton aria-label={`copy ${shareLinkName} link`} onClick={() => forget(copyToClipboard(shareUrl))} edge="end">
|
|
39
|
+
<CopyAllRounded />
|
|
40
|
+
</IconButton>
|
|
41
|
+
</InputAdornment>
|
|
42
|
+
),
|
|
43
|
+
}}
|
|
44
|
+
value={shareUrl}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Button } from '@mui/material'
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/react'
|
|
3
|
+
import { FlexGrowCol } from '@xylabs/react-flexbox'
|
|
4
|
+
import React, { useMemo, useState } from 'react'
|
|
5
|
+
|
|
6
|
+
import { CopyLinkTextField } from './CopyLinkTextField.tsx'
|
|
7
|
+
import { ShareOutDialog } from './Dialog.tsx'
|
|
8
|
+
import { ShareOutExplanation } from './Explanation.tsx'
|
|
9
|
+
import { GenerateShareLinkButton } from './GenerateShareLinkButton.tsx'
|
|
10
|
+
import { ShareOutHeadingFlexbox } from './HeadingFlexbox.tsx'
|
|
11
|
+
import { SocialButtonsFlexbox } from './SocialButtonsFlexbox.tsx'
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
title: 'modules/ShareOut/Dialog',
|
|
15
|
+
} as Meta<typeof ShareOutDialog>
|
|
16
|
+
|
|
17
|
+
const Template: StoryFn<typeof ShareOutDialog> = (props) => {
|
|
18
|
+
return <ShareOutDialog {...props} />
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const TemplateWithContent: StoryFn<typeof ShareOutDialog> = (props) => {
|
|
22
|
+
const [open, setOpen] = useState(false)
|
|
23
|
+
const onClose = () => setOpen(false)
|
|
24
|
+
const [shareUrl, setShareUrl] = useState('')
|
|
25
|
+
const [loading, setLoading] = useState(false)
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28
|
+
const { open: unused, ...restProps } = props
|
|
29
|
+
|
|
30
|
+
const cardImg = <img src="https://picsum.photos/100/100" height="100px" width="100px" />
|
|
31
|
+
const shareLinkName = 'My Share Link'
|
|
32
|
+
|
|
33
|
+
const generateLink = async () => {
|
|
34
|
+
setLoading(true)
|
|
35
|
+
await new Promise(resolve => setTimeout(() => {
|
|
36
|
+
setShareUrl('https://example.com')
|
|
37
|
+
setLoading(false)
|
|
38
|
+
resolve(null)
|
|
39
|
+
}, 2000))
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const shareOutDialogContent = useMemo(() => (
|
|
43
|
+
<FlexGrowCol gap={2}>
|
|
44
|
+
<ShareOutHeadingFlexbox shareLinkName={shareLinkName} shareUrl={shareUrl} />
|
|
45
|
+
{shareUrl
|
|
46
|
+
? (
|
|
47
|
+
<>
|
|
48
|
+
<CopyLinkTextField shareLinkName={shareLinkName} shareUrl={shareUrl} />
|
|
49
|
+
<SocialButtonsFlexbox shareUrl={shareUrl} />
|
|
50
|
+
</>
|
|
51
|
+
)
|
|
52
|
+
: <GenerateShareLinkButton loading={loading} onClick={generateLink} />}
|
|
53
|
+
<ShareOutExplanation />
|
|
54
|
+
</FlexGrowCol>
|
|
55
|
+
), [loading, generateLink, shareLinkName, shareUrl])
|
|
56
|
+
|
|
57
|
+
const shareOutDialogActions = ({ onClose }: { onClose?: () => void }) => <Button onClick={onClose} variant="outlined">Close</Button>
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<>
|
|
61
|
+
<Button onClick={() => setOpen(true)} variant="contained">Open</Button>
|
|
62
|
+
<ShareOutDialog cardImg={cardImg} onClose={onClose} ShareOutDialogActions={shareOutDialogActions} shareOutDialogContent={shareOutDialogContent} open={open} title="Share Out Dialog" subtitle="With a subtitle" {...restProps} />
|
|
63
|
+
</>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const Default = Template.bind({})
|
|
68
|
+
|
|
69
|
+
const WithContent = TemplateWithContent.bind({})
|
|
70
|
+
WithContent.args = {}
|
|
71
|
+
|
|
72
|
+
export { Default, WithContent }
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Dialog, DialogActions, DialogContent, DialogProps, DialogTitle, Stack, Typography } from '@mui/material'
|
|
2
|
+
import { FlexCol, FlexGrowCol } from '@xylabs/react-flexbox'
|
|
3
|
+
import React, { ComponentType, ReactNode } from 'react'
|
|
4
|
+
|
|
5
|
+
export interface ShareOutDialogProps extends DialogProps {
|
|
6
|
+
ShareOutDialogActions?: ComponentType<{ onClose?: () => void }>
|
|
7
|
+
cardImg?: ReactNode
|
|
8
|
+
shareOutDialogContent?: ReactNode
|
|
9
|
+
subtitle?: string
|
|
10
|
+
title?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const ShareOutDialog: React.FC<ShareOutDialogProps> = ({ ShareOutDialogActions, cardImg, open, onClose, shareOutDialogContent, subtitle, title, ...props }) => {
|
|
14
|
+
const handleClose = () => {
|
|
15
|
+
onClose?.('', 'backdropClick')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Dialog onClose={onClose} open={open} {...props}>
|
|
20
|
+
<DialogTitle>
|
|
21
|
+
<Stack direction="row" spacing={2}>
|
|
22
|
+
<FlexGrowCol alignItems="flex-start" width="60%">
|
|
23
|
+
<Typography variant="h5">{title}</Typography>
|
|
24
|
+
<Typography variant="body1">
|
|
25
|
+
{' '}
|
|
26
|
+
{subtitle}
|
|
27
|
+
</Typography>
|
|
28
|
+
</FlexGrowCol>
|
|
29
|
+
<FlexGrowCol alignItems="flex-end" width="40%">
|
|
30
|
+
{cardImg}
|
|
31
|
+
</FlexGrowCol>
|
|
32
|
+
</Stack>
|
|
33
|
+
</DialogTitle>
|
|
34
|
+
<DialogContent>
|
|
35
|
+
{shareOutDialogContent}
|
|
36
|
+
<FlexCol alignItems="stretch">
|
|
37
|
+
</FlexCol>
|
|
38
|
+
</DialogContent>
|
|
39
|
+
{ShareOutDialogActions ? <DialogActions><ShareOutDialogActions onClose={handleClose} /></DialogActions> : null}
|
|
40
|
+
</Dialog>
|
|
41
|
+
)
|
|
42
|
+
}
|