@xyo-network/react-share 2.83.1 → 2.83.2
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 +9 -1
- package/dist/browser/index.mjs +85 -35
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +7 -4
- package/src/index.ts +1 -0
- package/src/meta-server/dynamic-share/DynamicShareImage.tsx +23 -0
- package/src/meta-server/dynamic-share/index.ts +1 -0
- package/src/meta-server/index.ts +2 -0
- package/src/meta-server/live-share/HideParentsFlexbox.tsx +39 -0
- package/src/meta-server/live-share/index.ts +1 -0
package/dist/browser/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import * as _mui_material_OverridableComponent_js from '@mui/material/Overridabl
|
|
|
4
4
|
import * as _mui_material from '@mui/material';
|
|
5
5
|
import { StandardTextFieldProps, DialogProps, ButtonProps } from '@mui/material';
|
|
6
6
|
import { FlexBoxProps } from '@xylabs/react-flexbox';
|
|
7
|
+
import { WithChildren } from '@xylabs/react-shared';
|
|
7
8
|
|
|
8
9
|
interface ShareButtonProps extends ButtonExProps {
|
|
9
10
|
prepared?: boolean;
|
|
@@ -19,6 +20,13 @@ declare const XTwitterSvgIcon: _mui_material_OverridableComponent_js.Overridable
|
|
|
19
20
|
muiName: string;
|
|
20
21
|
};
|
|
21
22
|
|
|
23
|
+
interface DynamicShareImageProps {
|
|
24
|
+
image: string;
|
|
25
|
+
}
|
|
26
|
+
declare const DynamicShareImage: React.FC<DynamicShareImageProps>;
|
|
27
|
+
|
|
28
|
+
declare const HideParentsFlexbox: React.FC<WithChildren & FlexBoxProps>;
|
|
29
|
+
|
|
22
30
|
interface CopyLinkTextFieldProps extends StandardTextFieldProps {
|
|
23
31
|
shareLinkName?: string;
|
|
24
32
|
shareUrl?: string;
|
|
@@ -57,4 +65,4 @@ interface SocialButtonsFlexboxProps extends FlexBoxProps {
|
|
|
57
65
|
}
|
|
58
66
|
declare const SocialButtonsFlexbox: React.FC<SocialButtonsFlexboxProps>;
|
|
59
67
|
|
|
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 };
|
|
68
|
+
export { CopyLinkTextField, type CopyLinkTextFieldProps, DynamicShareImage, type DynamicShareImageProps, FacebookSvgIcon, GenerateShareLinkButton, type GenerateShareLinkButtonProps, HideParentsFlexbox, ShareButton, type ShareButtonProps, ShareOutDialog, type ShareOutDialogProps, ShareOutExplanation, type ShareOutExplanationProps, ShareOutHeadingFlexbox, type ShareOutHeadingFlexboxProps, SocialButtonsFlexbox, type SocialButtonsFlexboxProps, XTwitterSvgIcon };
|
package/dist/browser/index.mjs
CHANGED
|
@@ -88,11 +88,59 @@ var XTwitterSvgIcon = createSvgIcon2(/* @__PURE__ */ React3.createElement("svg",
|
|
|
88
88
|
fill: "white"
|
|
89
89
|
})), "XTwitterSvgIcon");
|
|
90
90
|
|
|
91
|
+
// src/meta-server/dynamic-share/DynamicShareImage.tsx
|
|
92
|
+
import React4 from "react";
|
|
93
|
+
import { Helmet } from "react-helmet";
|
|
94
|
+
var DynamicShareImage = /* @__PURE__ */ __name(({ image }) => {
|
|
95
|
+
return /* @__PURE__ */ React4.createElement(Helmet, null, /* @__PURE__ */ React4.createElement("meta", {
|
|
96
|
+
property: "xyo:og:image",
|
|
97
|
+
content: image
|
|
98
|
+
}));
|
|
99
|
+
}, "DynamicShareImage");
|
|
100
|
+
|
|
101
|
+
// src/meta-server/live-share/HideParentsFlexbox.tsx
|
|
102
|
+
import { FlexGrowRow } from "@xylabs/react-flexbox";
|
|
103
|
+
import React5, { useEffect } from "react";
|
|
104
|
+
var HideParentsFlexbox = /* @__PURE__ */ __name(({ children, ...props }) => {
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
const style = document.createElement("style");
|
|
107
|
+
document.head.append(style);
|
|
108
|
+
style.innerHTML = `
|
|
109
|
+
/** make all elements hidden */
|
|
110
|
+
* {
|
|
111
|
+
visibility: hidden;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** move the preview area to the top of the page */
|
|
115
|
+
#preview-area {
|
|
116
|
+
position: fixed;
|
|
117
|
+
top: 0;
|
|
118
|
+
left: 0;
|
|
119
|
+
width: 100%;
|
|
120
|
+
z-index: 9999;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** make the preview area and all its children visible */
|
|
124
|
+
#preview-area * {
|
|
125
|
+
visibility: visible;
|
|
126
|
+
}`;
|
|
127
|
+
return () => {
|
|
128
|
+
style.remove();
|
|
129
|
+
};
|
|
130
|
+
}, []);
|
|
131
|
+
return /* @__PURE__ */ React5.createElement(FlexGrowRow, {
|
|
132
|
+
alignItems: "stretch",
|
|
133
|
+
id: "preview-area",
|
|
134
|
+
justifyContent: "start",
|
|
135
|
+
...props
|
|
136
|
+
}, children);
|
|
137
|
+
}, "HideParentsFlexbox");
|
|
138
|
+
|
|
91
139
|
// src/out/CopyLinkTextField.tsx
|
|
92
140
|
import { CopyAllRounded } from "@mui/icons-material";
|
|
93
141
|
import { IconButton, InputAdornment, TextField } from "@mui/material";
|
|
94
142
|
import { forget } from "@xylabs/forget";
|
|
95
|
-
import
|
|
143
|
+
import React6, { useState as useState2 } from "react";
|
|
96
144
|
var CopyLinkTextField = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, ...props }) => {
|
|
97
145
|
const [error, setError] = useState2();
|
|
98
146
|
const copyToClipboard = /* @__PURE__ */ __name(async (link) => {
|
|
@@ -108,7 +156,7 @@ var CopyLinkTextField = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, ...pr
|
|
|
108
156
|
console.warn("tried to copy shareUrl before it was generated");
|
|
109
157
|
}
|
|
110
158
|
}, "copyToClipboard");
|
|
111
|
-
return /* @__PURE__ */
|
|
159
|
+
return /* @__PURE__ */ React6.createElement(TextField, {
|
|
112
160
|
disabled: true,
|
|
113
161
|
error: !!error,
|
|
114
162
|
helperText: error?.message,
|
|
@@ -119,13 +167,13 @@ var CopyLinkTextField = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, ...pr
|
|
|
119
167
|
}
|
|
120
168
|
},
|
|
121
169
|
InputProps: {
|
|
122
|
-
endAdornment: /* @__PURE__ */
|
|
170
|
+
endAdornment: /* @__PURE__ */ React6.createElement(InputAdornment, {
|
|
123
171
|
position: "end"
|
|
124
|
-
}, /* @__PURE__ */
|
|
172
|
+
}, /* @__PURE__ */ React6.createElement(IconButton, {
|
|
125
173
|
"aria-label": `copy ${shareLinkName} link`,
|
|
126
174
|
onClick: /* @__PURE__ */ __name(() => forget(copyToClipboard(shareUrl)), "onClick"),
|
|
127
175
|
edge: "end"
|
|
128
|
-
}, /* @__PURE__ */
|
|
176
|
+
}, /* @__PURE__ */ React6.createElement(CopyAllRounded, null)))
|
|
129
177
|
},
|
|
130
178
|
value: shareUrl,
|
|
131
179
|
...props
|
|
@@ -135,31 +183,31 @@ var CopyLinkTextField = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, ...pr
|
|
|
135
183
|
// src/out/Dialog.tsx
|
|
136
184
|
import { Dialog, DialogActions, DialogContent, DialogTitle, Stack, Typography } from "@mui/material";
|
|
137
185
|
import { FlexCol, FlexGrowCol } from "@xylabs/react-flexbox";
|
|
138
|
-
import
|
|
186
|
+
import React7 from "react";
|
|
139
187
|
var ShareOutDialog = /* @__PURE__ */ __name(({ ShareOutDialogActions, cardImg, open, onClose, shareOutDialogContent, subtitle, title, ...props }) => {
|
|
140
188
|
const handleClose = /* @__PURE__ */ __name(() => {
|
|
141
189
|
onClose?.("", "backdropClick");
|
|
142
190
|
}, "handleClose");
|
|
143
|
-
return /* @__PURE__ */
|
|
191
|
+
return /* @__PURE__ */ React7.createElement(Dialog, {
|
|
144
192
|
onClose,
|
|
145
193
|
open,
|
|
146
194
|
...props
|
|
147
|
-
}, /* @__PURE__ */
|
|
195
|
+
}, /* @__PURE__ */ React7.createElement(DialogTitle, null, /* @__PURE__ */ React7.createElement(Stack, {
|
|
148
196
|
direction: "row",
|
|
149
197
|
spacing: 2
|
|
150
|
-
}, /* @__PURE__ */
|
|
198
|
+
}, /* @__PURE__ */ React7.createElement(FlexGrowCol, {
|
|
151
199
|
alignItems: "flex-start",
|
|
152
200
|
width: "60%"
|
|
153
|
-
}, /* @__PURE__ */
|
|
201
|
+
}, /* @__PURE__ */ React7.createElement(Typography, {
|
|
154
202
|
variant: "h5"
|
|
155
|
-
}, title), /* @__PURE__ */
|
|
203
|
+
}, title), /* @__PURE__ */ React7.createElement(Typography, {
|
|
156
204
|
variant: "body1"
|
|
157
|
-
}, " ", subtitle)), /* @__PURE__ */
|
|
205
|
+
}, " ", subtitle)), /* @__PURE__ */ React7.createElement(FlexGrowCol, {
|
|
158
206
|
alignItems: "flex-end",
|
|
159
207
|
width: "40%"
|
|
160
|
-
}, cardImg))), /* @__PURE__ */
|
|
208
|
+
}, cardImg))), /* @__PURE__ */ React7.createElement(DialogContent, null, shareOutDialogContent, /* @__PURE__ */ React7.createElement(FlexCol, {
|
|
161
209
|
alignItems: "stretch"
|
|
162
|
-
})), ShareOutDialogActions ? /* @__PURE__ */
|
|
210
|
+
})), ShareOutDialogActions ? /* @__PURE__ */ React7.createElement(DialogActions, null, /* @__PURE__ */ React7.createElement(ShareOutDialogActions, {
|
|
163
211
|
onClose: handleClose
|
|
164
212
|
})) : null);
|
|
165
213
|
}, "ShareOutDialog");
|
|
@@ -167,20 +215,20 @@ var ShareOutDialog = /* @__PURE__ */ __name(({ ShareOutDialogActions, cardImg, o
|
|
|
167
215
|
// src/out/Explanation.tsx
|
|
168
216
|
import { InfoOutlined } from "@mui/icons-material";
|
|
169
217
|
import { Tooltip, Typography as Typography2, useTheme } from "@mui/material";
|
|
170
|
-
import { FlexGrowRow } from "@xylabs/react-flexbox";
|
|
171
|
-
import
|
|
218
|
+
import { FlexGrowRow as FlexGrowRow2 } from "@xylabs/react-flexbox";
|
|
219
|
+
import React8 from "react";
|
|
172
220
|
var ShareOutExplanation = /* @__PURE__ */ __name(({ toolTipTitle }) => {
|
|
173
221
|
const theme = useTheme();
|
|
174
222
|
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__ */
|
|
223
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(FlexGrowRow2, {
|
|
176
224
|
alignItems: "center"
|
|
177
|
-
}, /* @__PURE__ */
|
|
225
|
+
}, /* @__PURE__ */ React8.createElement(Typography2, {
|
|
178
226
|
variant: "body2",
|
|
179
227
|
paddingRight: 0.5
|
|
180
|
-
}, "What am I sharing?"), /* @__PURE__ */
|
|
228
|
+
}, "What am I sharing?"), /* @__PURE__ */ React8.createElement(Tooltip, {
|
|
181
229
|
title,
|
|
182
230
|
placement: "bottom"
|
|
183
|
-
}, /* @__PURE__ */
|
|
231
|
+
}, /* @__PURE__ */ React8.createElement(InfoOutlined, {
|
|
184
232
|
fontSize: "small",
|
|
185
233
|
sx: {
|
|
186
234
|
fontSize: theme.typography.caption.fontSize
|
|
@@ -190,11 +238,11 @@ var ShareOutExplanation = /* @__PURE__ */ __name(({ toolTipTitle }) => {
|
|
|
190
238
|
|
|
191
239
|
// src/out/GenerateShareLinkButton.tsx
|
|
192
240
|
import { Button, CircularProgress, styled } from "@mui/material";
|
|
193
|
-
import
|
|
241
|
+
import React9 from "react";
|
|
194
242
|
var GenerateShareLinkButton = /* @__PURE__ */ __name(({ children = "Generate My Share Link", loading, ...props }) => {
|
|
195
|
-
return /* @__PURE__ */
|
|
243
|
+
return /* @__PURE__ */ React9.createElement(Button, {
|
|
196
244
|
variant: "contained",
|
|
197
|
-
startIcon: loading ? /* @__PURE__ */
|
|
245
|
+
startIcon: loading ? /* @__PURE__ */ React9.createElement(StyledCircularProgress, {
|
|
198
246
|
size: "small"
|
|
199
247
|
}) : null,
|
|
200
248
|
...props
|
|
@@ -213,17 +261,17 @@ var StyledCircularProgress = styled(CircularProgress, {
|
|
|
213
261
|
// src/out/HeadingFlexbox.tsx
|
|
214
262
|
import { Typography as Typography3 } from "@mui/material";
|
|
215
263
|
import { FlexGrowCol as FlexGrowCol2 } from "@xylabs/react-flexbox";
|
|
216
|
-
import
|
|
264
|
+
import React10 from "react";
|
|
217
265
|
var ShareOutHeadingFlexbox = /* @__PURE__ */ __name(({ children, shareLinkName, shareUrl, ...props }) => {
|
|
218
266
|
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__ */
|
|
267
|
+
return /* @__PURE__ */ React10.createElement(FlexGrowCol2, {
|
|
220
268
|
alignItems: "flex-start",
|
|
221
269
|
paddingBottom: 1,
|
|
222
270
|
...props
|
|
223
|
-
}, /* @__PURE__ */
|
|
271
|
+
}, /* @__PURE__ */ React10.createElement(Typography3, {
|
|
224
272
|
variant: "body1",
|
|
225
273
|
gutterBottom: true
|
|
226
|
-
}, /* @__PURE__ */
|
|
274
|
+
}, /* @__PURE__ */ React10.createElement("strong", null, "Your Share Link")), /* @__PURE__ */ React10.createElement(Typography3, {
|
|
227
275
|
variant: "body1"
|
|
228
276
|
}, shareUrl ? `Use this link or the buttons below to share ${shareLinkName}` : GenerateShareLinkExplanation), children);
|
|
229
277
|
}, "ShareOutHeadingFlexbox");
|
|
@@ -232,16 +280,16 @@ var ShareOutHeadingFlexbox = /* @__PURE__ */ __name(({ children, shareLinkName,
|
|
|
232
280
|
import { Typography as Typography4 } from "@mui/material";
|
|
233
281
|
import { ButtonEx as ButtonEx2 } from "@xylabs/react-button";
|
|
234
282
|
import { FlexGrowCol as FlexGrowCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
235
|
-
import
|
|
283
|
+
import React11 from "react";
|
|
236
284
|
var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, ...props }) => {
|
|
237
|
-
return /* @__PURE__ */
|
|
285
|
+
return /* @__PURE__ */ React11.createElement(FlexGrowCol3, {
|
|
238
286
|
alignItems: "stretch",
|
|
239
287
|
paddingTop: 2,
|
|
240
288
|
...props
|
|
241
|
-
}, /* @__PURE__ */
|
|
289
|
+
}, /* @__PURE__ */ React11.createElement(Typography4, {
|
|
242
290
|
variant: "body1",
|
|
243
291
|
gutterBottom: true
|
|
244
|
-
}, /* @__PURE__ */
|
|
292
|
+
}, /* @__PURE__ */ React11.createElement("strong", null, "Share on Social Media")), /* @__PURE__ */ React11.createElement(FlexRow2, {
|
|
245
293
|
gap: 0.5,
|
|
246
294
|
sx: {
|
|
247
295
|
flexDirection: {
|
|
@@ -249,7 +297,7 @@ var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, ...props }) => {
|
|
|
249
297
|
xs: "column"
|
|
250
298
|
}
|
|
251
299
|
}
|
|
252
|
-
}, shareUrl ? /* @__PURE__ */
|
|
300
|
+
}, shareUrl ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(ButtonEx2, {
|
|
253
301
|
variant: "contained",
|
|
254
302
|
style: {
|
|
255
303
|
backgroundColor: "#000",
|
|
@@ -258,10 +306,10 @@ var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, ...props }) => {
|
|
|
258
306
|
onClick: /* @__PURE__ */ __name(() => {
|
|
259
307
|
window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(shareUrl)}`);
|
|
260
308
|
}, "onClick"),
|
|
261
|
-
startIcon: /* @__PURE__ */
|
|
309
|
+
startIcon: /* @__PURE__ */ React11.createElement(XTwitterSvgIcon, {
|
|
262
310
|
width: "20px"
|
|
263
311
|
})
|
|
264
|
-
}, "Share on X (Twitter)"), /* @__PURE__ */
|
|
312
|
+
}, "Share on X (Twitter)"), /* @__PURE__ */ React11.createElement(ButtonEx2, {
|
|
265
313
|
variant: "contained",
|
|
266
314
|
style: {
|
|
267
315
|
backgroundColor: "#4267b2",
|
|
@@ -270,13 +318,15 @@ var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, ...props }) => {
|
|
|
270
318
|
onClick: /* @__PURE__ */ __name(() => {
|
|
271
319
|
window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`);
|
|
272
320
|
}, "onClick"),
|
|
273
|
-
startIcon: /* @__PURE__ */
|
|
321
|
+
startIcon: /* @__PURE__ */ React11.createElement(FacebookSvgIcon, null)
|
|
274
322
|
}, "Share on Facebook")) : null));
|
|
275
323
|
}, "SocialButtonsFlexbox");
|
|
276
324
|
export {
|
|
277
325
|
CopyLinkTextField,
|
|
326
|
+
DynamicShareImage,
|
|
278
327
|
FacebookSvgIcon,
|
|
279
328
|
GenerateShareLinkButton,
|
|
329
|
+
HideParentsFlexbox,
|
|
280
330
|
ShareButton,
|
|
281
331
|
ShareOutDialog,
|
|
282
332
|
ShareOutExplanation,
|
|
@@ -1 +1 @@
|
|
|
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;IAAQ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AAA;AAGP,GAd6E;;;ACT7E,SAASa,cAAAA,mBAAkB;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"]}
|
|
1
|
+
{"version":3,"sources":["../../src/button/ShareButton.tsx","../../src/icons/social/Facebook.tsx","../../src/icons/social/XTwitter.tsx","../../src/meta-server/dynamic-share/DynamicShareImage.tsx","../../src/meta-server/live-share/HideParentsFlexbox.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 React from 'react'\nimport { Helmet } from 'react-helmet'\n\n/**\n * The props for the DynamicShareImage component.\n */\nexport interface DynamicShareImageProps {\n /**\n * The URL of the share image for the page.\n */\n image: string\n}\n\n/**\n * Used in conjunction with the XY Meta Server to dynamically set the share image for a page.\n */\nexport const DynamicShareImage: React.FC<DynamicShareImageProps> = ({ image }) => {\n return (\n <Helmet>\n <meta property=\"xyo:og:image\" content={image} />\n </Helmet>\n )\n}\n","import { FlexBoxProps, FlexGrowRow } from '@xylabs/react-flexbox'\nimport { WithChildren } from '@xylabs/react-shared'\nimport React, { useEffect } from 'react'\n\nexport const HideParentsFlexbox: React.FC<WithChildren & FlexBoxProps> = ({ children, ...props }) => {\n useEffect(() => {\n const style = document.createElement('style')\n document.head.append(style)\n style.innerHTML = `\n /** make all elements hidden */\n * {\n visibility: hidden;\n }\n\n /** move the preview area to the top of the page */\n #preview-area {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n z-index: 9999;\n }\n\n /** make the preview area and all its children visible */\n #preview-area * {\n visibility: visible;\n }`\n\n return () => {\n style.remove()\n }\n }, [])\n\n return (\n <FlexGrowRow alignItems=\"stretch\" id=\"preview-area\" justifyContent=\"start\" {...props}>\n {children}\n </FlexGrowRow>\n )\n}\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,GA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CAAA,GAEV,gBAAAP,QAAA,cAACQ,UAAAA;IAAQC,KAAK;IAAKC,IAAI;MAAEC,eAAe;QAAEC,IAAI;QAAOC,IAAI;MAAS;IAAE;KACjEf,WAEK,gBAAAE,QAAA,cAAAA,QAAA,UAAA,MACE,gBAAAA,QAAA,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,QAAA,cAACuB,iBAAAA;MAAgBC,OAAM;;KACnC,sBAAA,GAGD,gBAAAxB,QAAA,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,QAAA,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","React","Helmet","DynamicShareImage","image","React","Helmet","meta","property","content","FlexGrowRow","React","useEffect","HideParentsFlexbox","children","props","useEffect","style","document","createElement","head","append","innerHTML","remove","React","FlexGrowRow","alignItems","id","justifyContent","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
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
"@xylabs/forget": "^3.6.12",
|
|
14
14
|
"@xylabs/react-button": "^3.4.2",
|
|
15
15
|
"@xylabs/react-flexbox": "^3.4.2",
|
|
16
|
-
"@xylabs/react-link": "^3.4.2"
|
|
16
|
+
"@xylabs/react-link": "^3.4.2",
|
|
17
|
+
"@xylabs/react-shared": "^3.4.2",
|
|
18
|
+
"react-helmet": "^6.1.0"
|
|
17
19
|
},
|
|
18
20
|
"peerDependencies": {
|
|
19
21
|
"@mui/icons-material": "^5",
|
|
@@ -24,8 +26,9 @@
|
|
|
24
26
|
"react-icons": "^4"
|
|
25
27
|
},
|
|
26
28
|
"devDependencies": {
|
|
27
|
-
"@storybook/react": "^8.2.
|
|
28
|
-
"@
|
|
29
|
+
"@storybook/react": "^8.2.8",
|
|
30
|
+
"@types/react-helmet": "^6.1.11",
|
|
31
|
+
"@xylabs/ts-scripts-yarn3": "^4.0.0-rc.12",
|
|
29
32
|
"typescript": "^5.5.4"
|
|
30
33
|
},
|
|
31
34
|
"description": "Common React library for all XYO projects that use React",
|
|
@@ -63,6 +66,6 @@
|
|
|
63
66
|
},
|
|
64
67
|
"sideEffects": false,
|
|
65
68
|
"types": "dist/browser/index.d.ts",
|
|
66
|
-
"version": "2.83.
|
|
69
|
+
"version": "2.83.2",
|
|
67
70
|
"type": "module"
|
|
68
71
|
}
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Helmet } from 'react-helmet'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The props for the DynamicShareImage component.
|
|
6
|
+
*/
|
|
7
|
+
export interface DynamicShareImageProps {
|
|
8
|
+
/**
|
|
9
|
+
* The URL of the share image for the page.
|
|
10
|
+
*/
|
|
11
|
+
image: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Used in conjunction with the XY Meta Server to dynamically set the share image for a page.
|
|
16
|
+
*/
|
|
17
|
+
export const DynamicShareImage: React.FC<DynamicShareImageProps> = ({ image }) => {
|
|
18
|
+
return (
|
|
19
|
+
<Helmet>
|
|
20
|
+
<meta property="xyo:og:image" content={image} />
|
|
21
|
+
</Helmet>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DynamicShareImage.tsx'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FlexBoxProps, FlexGrowRow } from '@xylabs/react-flexbox'
|
|
2
|
+
import { WithChildren } from '@xylabs/react-shared'
|
|
3
|
+
import React, { useEffect } from 'react'
|
|
4
|
+
|
|
5
|
+
export const HideParentsFlexbox: React.FC<WithChildren & FlexBoxProps> = ({ children, ...props }) => {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const style = document.createElement('style')
|
|
8
|
+
document.head.append(style)
|
|
9
|
+
style.innerHTML = `
|
|
10
|
+
/** make all elements hidden */
|
|
11
|
+
* {
|
|
12
|
+
visibility: hidden;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** move the preview area to the top of the page */
|
|
16
|
+
#preview-area {
|
|
17
|
+
position: fixed;
|
|
18
|
+
top: 0;
|
|
19
|
+
left: 0;
|
|
20
|
+
width: 100%;
|
|
21
|
+
z-index: 9999;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** make the preview area and all its children visible */
|
|
25
|
+
#preview-area * {
|
|
26
|
+
visibility: visible;
|
|
27
|
+
}`
|
|
28
|
+
|
|
29
|
+
return () => {
|
|
30
|
+
style.remove()
|
|
31
|
+
}
|
|
32
|
+
}, [])
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<FlexGrowRow alignItems="stretch" id="preview-area" justifyContent="start" {...props}>
|
|
36
|
+
{children}
|
|
37
|
+
</FlexGrowRow>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HideParentsFlexbox.tsx'
|