@xyo-network/react-share 3.0.3 → 3.0.5
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.mjs +201 -47
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/out/CopyIconButton.d.ts +8 -0
- package/dist/browser/out/CopyIconButton.d.ts.map +1 -0
- package/dist/browser/out/CopyLinkStack.d.ts +9 -0
- package/dist/browser/out/CopyLinkStack.d.ts.map +1 -0
- package/dist/browser/out/CopyLinkTextField.d.ts.map +1 -1
- package/dist/browser/out/index.d.ts +1 -0
- package/dist/browser/out/index.d.ts.map +1 -1
- package/dist/browser/out/lib/AnimatedGradientTypography.d.ts +7 -0
- package/dist/browser/out/lib/AnimatedGradientTypography.d.ts.map +1 -0
- package/dist/browser/out/lib/ShareLinkProps.d.ts +6 -0
- package/dist/browser/out/lib/ShareLinkProps.d.ts.map +1 -0
- package/dist/browser/out/lib/index.d.ts +4 -0
- package/dist/browser/out/lib/index.d.ts.map +1 -0
- package/dist/browser/out/lib/splitAroundSubstring.d.ts +2 -0
- package/dist/browser/out/lib/splitAroundSubstring.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/out/CopyIconButton.tsx +46 -0
- package/src/out/CopyLinkStack.stories.tsx +41 -0
- package/src/out/CopyLinkStack.tsx +59 -0
- package/src/out/CopyLinkTextField.tsx +8 -22
- package/src/out/index.ts +1 -0
- package/src/out/lib/AnimatedGradientTypography.tsx +54 -0
- package/src/out/lib/ShareLinkProps.ts +5 -0
- package/src/out/lib/index.ts +3 -0
- package/src/out/lib/splitAroundSubstring.ts +19 -0
package/dist/browser/index.mjs
CHANGED
|
@@ -136,27 +136,180 @@ var HideParentsFlexbox = /* @__PURE__ */ __name(({ children, ...props }) => {
|
|
|
136
136
|
}, children);
|
|
137
137
|
}, "HideParentsFlexbox");
|
|
138
138
|
|
|
139
|
-
// src/out/
|
|
139
|
+
// src/out/CopyLinkStack.tsx
|
|
140
|
+
import { Cancel } from "@mui/icons-material";
|
|
141
|
+
import { Stack, Tooltip as Tooltip2, Typography as Typography2 } from "@mui/material";
|
|
142
|
+
import React7, { useCallback, useMemo, useState as useState3 } from "react";
|
|
143
|
+
|
|
144
|
+
// src/out/CopyIconButton.tsx
|
|
140
145
|
import { CopyAllRounded } from "@mui/icons-material";
|
|
141
|
-
import { IconButton,
|
|
146
|
+
import { IconButton, Tooltip } from "@mui/material";
|
|
142
147
|
import { forget } from "@xylabs/forget";
|
|
143
148
|
import React6, { useState as useState2 } from "react";
|
|
144
|
-
var
|
|
145
|
-
|
|
149
|
+
var CopyLink = "Copy Link";
|
|
150
|
+
var Copied = "Copied!";
|
|
151
|
+
var CopyIconButton = /* @__PURE__ */ __name(({ onCopyToClipboard, shareLinkName, shareUrl, ...props }) => {
|
|
152
|
+
const [copyTooltipTitle, setCopyToolTipTitle] = useState2(CopyLink);
|
|
146
153
|
const copyToClipboard = /* @__PURE__ */ __name(async (link) => {
|
|
147
154
|
if (link) {
|
|
148
155
|
try {
|
|
149
156
|
await navigator.clipboard.writeText(link);
|
|
157
|
+
onCopyToClipboard?.();
|
|
158
|
+
setCopyToolTipTitle(Copied);
|
|
159
|
+
setTimeout(() => setCopyToolTipTitle(CopyLink), 2e3);
|
|
150
160
|
} catch (e) {
|
|
151
161
|
const message = "Error copying shareUrl to clipboard";
|
|
152
162
|
console.error(message, e, link);
|
|
153
|
-
|
|
163
|
+
onCopyToClipboard?.(new Error(message));
|
|
154
164
|
}
|
|
155
165
|
} else {
|
|
156
166
|
console.warn("tried to copy shareUrl before it was generated");
|
|
157
167
|
}
|
|
158
168
|
}, "copyToClipboard");
|
|
159
|
-
return /* @__PURE__ */ React6.createElement(
|
|
169
|
+
return /* @__PURE__ */ React6.createElement(Tooltip, {
|
|
170
|
+
title: copyTooltipTitle
|
|
171
|
+
}, /* @__PURE__ */ React6.createElement(IconButton, {
|
|
172
|
+
"aria-label": `copy ${shareLinkName} link`,
|
|
173
|
+
onClick: /* @__PURE__ */ __name(() => forget(copyToClipboard(shareUrl)), "onClick"),
|
|
174
|
+
edge: "end",
|
|
175
|
+
...props
|
|
176
|
+
}, /* @__PURE__ */ React6.createElement(CopyAllRounded, null)));
|
|
177
|
+
}, "CopyIconButton");
|
|
178
|
+
|
|
179
|
+
// src/out/lib/AnimatedGradientTypography.tsx
|
|
180
|
+
import { keyframes, styled, Typography } from "@mui/material";
|
|
181
|
+
var moveBg = keyframes(`
|
|
182
|
+
0% {
|
|
183
|
+
background-position: 100% 0%;
|
|
184
|
+
}
|
|
185
|
+
100% {
|
|
186
|
+
background-position: 0% 0%;
|
|
187
|
+
}
|
|
188
|
+
`);
|
|
189
|
+
var AnimatedGradientTypography = styled(Typography, {
|
|
190
|
+
name: "AnimatedGradientTypography"
|
|
191
|
+
})(({ theme, color1, color2 }) => {
|
|
192
|
+
return {
|
|
193
|
+
// Set the color variables for the gradient
|
|
194
|
+
"--color-one": color1 ?? theme.palette.secondary.dark,
|
|
195
|
+
"--color-two": color2 ?? theme.palette.primary.light,
|
|
196
|
+
// set the gradient so it has the same start and end color for looping effect
|
|
197
|
+
"background": `linear-gradient(
|
|
198
|
+
.25turn,
|
|
199
|
+
var(--color-one),
|
|
200
|
+
var(--color-two),
|
|
201
|
+
var(--color-one)
|
|
202
|
+
)`,
|
|
203
|
+
// Set the text color to transparent so the gradient shows through
|
|
204
|
+
"color": "transparent",
|
|
205
|
+
// Clip the background to the text shape
|
|
206
|
+
"backgroundClip": "text",
|
|
207
|
+
// Set the background size to 800% so we don't see the third color initially creating the looping effect
|
|
208
|
+
"backgroundSize": "800%",
|
|
209
|
+
// Set the text to bold so the gradient is more visible
|
|
210
|
+
"fontWeight": "bold",
|
|
211
|
+
// Set the animation
|
|
212
|
+
"@media (prefers-reduced-motion: no-preference)": {
|
|
213
|
+
animationName: moveBg,
|
|
214
|
+
animationDuration: "2s",
|
|
215
|
+
animationIterationCount: "infinite"
|
|
216
|
+
},
|
|
217
|
+
// reset for users that prefer reduced motion
|
|
218
|
+
"@media (prefers-reduced-motion)": {
|
|
219
|
+
background: "none",
|
|
220
|
+
color: theme.palette.text.primary
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// src/out/lib/splitAroundSubstring.ts
|
|
226
|
+
var splitAroundSubstring = /* @__PURE__ */ __name((path, substring) => {
|
|
227
|
+
const index = path.indexOf(substring);
|
|
228
|
+
if (index === -1) {
|
|
229
|
+
throw new Error(`XNS name "${substring}" not found in path.`);
|
|
230
|
+
}
|
|
231
|
+
const part1 = path.slice(0, index);
|
|
232
|
+
const part2 = substring;
|
|
233
|
+
const part3 = path.slice(index + substring.length);
|
|
234
|
+
return [
|
|
235
|
+
part1,
|
|
236
|
+
part2,
|
|
237
|
+
part3
|
|
238
|
+
];
|
|
239
|
+
}, "splitAroundSubstring");
|
|
240
|
+
|
|
241
|
+
// src/out/CopyLinkStack.tsx
|
|
242
|
+
var CopyLinkStack = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, xnsName: xnsNameProp, xnsEndColor, xnsStartColor, ...props }) => {
|
|
243
|
+
const [error, setError] = useState3();
|
|
244
|
+
const onCopyToClipboard = useCallback((error2) => {
|
|
245
|
+
setError(error2);
|
|
246
|
+
}, []);
|
|
247
|
+
const parsedXnsName = useMemo(() => {
|
|
248
|
+
if (shareUrl && xnsNameProp) {
|
|
249
|
+
try {
|
|
250
|
+
const parts = splitAroundSubstring(shareUrl, xnsNameProp);
|
|
251
|
+
return parts;
|
|
252
|
+
} catch (e) {
|
|
253
|
+
setError(e);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}, []);
|
|
257
|
+
const [part1, xnsName, part3] = parsedXnsName || [];
|
|
258
|
+
return /* @__PURE__ */ React7.createElement(Stack, {
|
|
259
|
+
direction: "row",
|
|
260
|
+
alignItems: "center",
|
|
261
|
+
gap: 0.25,
|
|
262
|
+
...props
|
|
263
|
+
}, xnsName ? /* @__PURE__ */ React7.createElement(Stack, {
|
|
264
|
+
direction: "row",
|
|
265
|
+
maxWidth: "100%",
|
|
266
|
+
sx: {
|
|
267
|
+
overflowX: "auto"
|
|
268
|
+
}
|
|
269
|
+
}, /* @__PURE__ */ React7.createElement(Typography2, {
|
|
270
|
+
sx: {
|
|
271
|
+
display: "inline-flex"
|
|
272
|
+
}
|
|
273
|
+
}, part1), /* @__PURE__ */ React7.createElement(AnimatedGradientTypography, {
|
|
274
|
+
color1: xnsStartColor,
|
|
275
|
+
color2: xnsEndColor,
|
|
276
|
+
sx: {
|
|
277
|
+
display: "inline-flex"
|
|
278
|
+
}
|
|
279
|
+
}, xnsName), /* @__PURE__ */ React7.createElement(Typography2, {
|
|
280
|
+
sx: {
|
|
281
|
+
display: "inline-flex"
|
|
282
|
+
}
|
|
283
|
+
}, part3)) : /* @__PURE__ */ React7.createElement(Typography2, {
|
|
284
|
+
sx: {
|
|
285
|
+
display: "inline-flex"
|
|
286
|
+
}
|
|
287
|
+
}, shareUrl), /* @__PURE__ */ React7.createElement(CopyIconButton, {
|
|
288
|
+
onCopyToClipboard,
|
|
289
|
+
shareLinkName,
|
|
290
|
+
shareUrl,
|
|
291
|
+
sx: {
|
|
292
|
+
display: "inline-flex"
|
|
293
|
+
}
|
|
294
|
+
}), error ? /* @__PURE__ */ React7.createElement(Tooltip2, {
|
|
295
|
+
title: error.message
|
|
296
|
+
}, /* @__PURE__ */ React7.createElement(Cancel, {
|
|
297
|
+
color: "error",
|
|
298
|
+
sx: {
|
|
299
|
+
display: "inline-flex"
|
|
300
|
+
}
|
|
301
|
+
})) : null);
|
|
302
|
+
}, "CopyLinkStack");
|
|
303
|
+
|
|
304
|
+
// src/out/CopyLinkTextField.tsx
|
|
305
|
+
import { InputAdornment, TextField } from "@mui/material";
|
|
306
|
+
import React8, { useCallback as useCallback2, useState as useState4 } from "react";
|
|
307
|
+
var CopyLinkTextField = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, ...props }) => {
|
|
308
|
+
const [error, setError] = useState4();
|
|
309
|
+
const onCopyToClipboard = useCallback2((error2) => {
|
|
310
|
+
setError(error2);
|
|
311
|
+
}, []);
|
|
312
|
+
return /* @__PURE__ */ React8.createElement(TextField, {
|
|
160
313
|
disabled: true,
|
|
161
314
|
error: !!error,
|
|
162
315
|
helperText: error?.message,
|
|
@@ -167,13 +320,13 @@ var CopyLinkTextField = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, ...pr
|
|
|
167
320
|
}
|
|
168
321
|
},
|
|
169
322
|
InputProps: {
|
|
170
|
-
endAdornment: /* @__PURE__ */
|
|
323
|
+
endAdornment: /* @__PURE__ */ React8.createElement(InputAdornment, {
|
|
171
324
|
position: "end"
|
|
172
|
-
}, /* @__PURE__ */
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
325
|
+
}, /* @__PURE__ */ React8.createElement(CopyIconButton, {
|
|
326
|
+
shareLinkName,
|
|
327
|
+
shareUrl,
|
|
328
|
+
onCopyToClipboard
|
|
329
|
+
}))
|
|
177
330
|
},
|
|
178
331
|
value: shareUrl,
|
|
179
332
|
...props
|
|
@@ -181,54 +334,54 @@ var CopyLinkTextField = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, ...pr
|
|
|
181
334
|
}, "CopyLinkTextField");
|
|
182
335
|
|
|
183
336
|
// src/out/Dialog.tsx
|
|
184
|
-
import { Dialog, DialogActions, DialogContent, DialogTitle, Stack, Typography } from "@mui/material";
|
|
337
|
+
import { Dialog, DialogActions, DialogContent, DialogTitle, Stack as Stack2, Typography as Typography3 } from "@mui/material";
|
|
185
338
|
import { FlexCol, FlexGrowCol } from "@xylabs/react-flexbox";
|
|
186
|
-
import
|
|
339
|
+
import React9 from "react";
|
|
187
340
|
var ShareOutDialog = /* @__PURE__ */ __name(({ ShareOutDialogActions, cardImg, open, onClose, shareOutDialogContent, subtitle, title, ...props }) => {
|
|
188
341
|
const handleClose = /* @__PURE__ */ __name(() => {
|
|
189
342
|
onClose?.("", "backdropClick");
|
|
190
343
|
}, "handleClose");
|
|
191
|
-
return /* @__PURE__ */
|
|
344
|
+
return /* @__PURE__ */ React9.createElement(Dialog, {
|
|
192
345
|
onClose,
|
|
193
346
|
open,
|
|
194
347
|
...props
|
|
195
|
-
}, /* @__PURE__ */
|
|
348
|
+
}, /* @__PURE__ */ React9.createElement(DialogTitle, null, /* @__PURE__ */ React9.createElement(Stack2, {
|
|
196
349
|
direction: "row",
|
|
197
350
|
spacing: 2
|
|
198
|
-
}, /* @__PURE__ */
|
|
351
|
+
}, /* @__PURE__ */ React9.createElement(FlexGrowCol, {
|
|
199
352
|
alignItems: "flex-start",
|
|
200
353
|
width: "60%"
|
|
201
|
-
}, /* @__PURE__ */
|
|
354
|
+
}, /* @__PURE__ */ React9.createElement(Typography3, {
|
|
202
355
|
variant: "h5"
|
|
203
|
-
}, title), /* @__PURE__ */
|
|
356
|
+
}, title), /* @__PURE__ */ React9.createElement(Typography3, {
|
|
204
357
|
variant: "body1"
|
|
205
|
-
}, " ", subtitle)), /* @__PURE__ */
|
|
358
|
+
}, " ", subtitle)), /* @__PURE__ */ React9.createElement(FlexGrowCol, {
|
|
206
359
|
alignItems: "flex-end",
|
|
207
360
|
width: "40%"
|
|
208
|
-
}, cardImg))), /* @__PURE__ */
|
|
361
|
+
}, cardImg))), /* @__PURE__ */ React9.createElement(DialogContent, null, shareOutDialogContent, /* @__PURE__ */ React9.createElement(FlexCol, {
|
|
209
362
|
alignItems: "stretch"
|
|
210
|
-
})), ShareOutDialogActions ? /* @__PURE__ */
|
|
363
|
+
})), ShareOutDialogActions ? /* @__PURE__ */ React9.createElement(DialogActions, null, /* @__PURE__ */ React9.createElement(ShareOutDialogActions, {
|
|
211
364
|
onClose: handleClose
|
|
212
365
|
})) : null);
|
|
213
366
|
}, "ShareOutDialog");
|
|
214
367
|
|
|
215
368
|
// src/out/Explanation.tsx
|
|
216
369
|
import { InfoOutlined } from "@mui/icons-material";
|
|
217
|
-
import { Tooltip, Typography as
|
|
370
|
+
import { Tooltip as Tooltip3, Typography as Typography4, useTheme } from "@mui/material";
|
|
218
371
|
import { FlexGrowRow as FlexGrowRow2 } from "@xylabs/react-flexbox";
|
|
219
|
-
import
|
|
372
|
+
import React10 from "react";
|
|
220
373
|
var ShareOutExplanation = /* @__PURE__ */ __name(({ toolTipTitle }) => {
|
|
221
374
|
const theme = useTheme();
|
|
222
375
|
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.";
|
|
223
|
-
return /* @__PURE__ */
|
|
376
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(FlexGrowRow2, {
|
|
224
377
|
alignItems: "center"
|
|
225
|
-
}, /* @__PURE__ */
|
|
378
|
+
}, /* @__PURE__ */ React10.createElement(Typography4, {
|
|
226
379
|
variant: "body2",
|
|
227
380
|
paddingRight: 0.5
|
|
228
|
-
}, "What am I sharing?"), /* @__PURE__ */
|
|
381
|
+
}, "What am I sharing?"), /* @__PURE__ */ React10.createElement(Tooltip3, {
|
|
229
382
|
title,
|
|
230
383
|
placement: "bottom"
|
|
231
|
-
}, /* @__PURE__ */
|
|
384
|
+
}, /* @__PURE__ */ React10.createElement(InfoOutlined, {
|
|
232
385
|
fontSize: "small",
|
|
233
386
|
sx: {
|
|
234
387
|
fontSize: theme.typography.caption.fontSize
|
|
@@ -237,18 +390,18 @@ var ShareOutExplanation = /* @__PURE__ */ __name(({ toolTipTitle }) => {
|
|
|
237
390
|
}, "ShareOutExplanation");
|
|
238
391
|
|
|
239
392
|
// src/out/GenerateShareLinkButton.tsx
|
|
240
|
-
import { Button, CircularProgress, styled } from "@mui/material";
|
|
241
|
-
import
|
|
393
|
+
import { Button, CircularProgress, styled as styled2 } from "@mui/material";
|
|
394
|
+
import React11 from "react";
|
|
242
395
|
var GenerateShareLinkButton = /* @__PURE__ */ __name(({ children = "Generate My Share Link", loading, ...props }) => {
|
|
243
|
-
return /* @__PURE__ */
|
|
396
|
+
return /* @__PURE__ */ React11.createElement(Button, {
|
|
244
397
|
variant: "contained",
|
|
245
|
-
startIcon: loading ? /* @__PURE__ */
|
|
398
|
+
startIcon: loading ? /* @__PURE__ */ React11.createElement(StyledCircularProgress, {
|
|
246
399
|
size: "small"
|
|
247
400
|
}) : null,
|
|
248
401
|
...props
|
|
249
402
|
}, children);
|
|
250
403
|
}, "GenerateShareLinkButton");
|
|
251
|
-
var StyledCircularProgress =
|
|
404
|
+
var StyledCircularProgress = styled2(CircularProgress, {
|
|
252
405
|
name: "StyledCircularProgress"
|
|
253
406
|
})(({ theme }) => ({
|
|
254
407
|
// ensure the color of the spinner is the same as the button color
|
|
@@ -259,37 +412,37 @@ var StyledCircularProgress = styled(CircularProgress, {
|
|
|
259
412
|
}));
|
|
260
413
|
|
|
261
414
|
// src/out/HeadingFlexbox.tsx
|
|
262
|
-
import { Typography as
|
|
415
|
+
import { Typography as Typography5 } from "@mui/material";
|
|
263
416
|
import { FlexGrowCol as FlexGrowCol2 } from "@xylabs/react-flexbox";
|
|
264
|
-
import
|
|
417
|
+
import React12 from "react";
|
|
265
418
|
var ShareOutHeadingFlexbox = /* @__PURE__ */ __name(({ children, shareLinkName, shareUrl, ...props }) => {
|
|
266
419
|
const GenerateShareLinkExplanation = "When you generate your share link, we'll make a small amount of your data public so friends can check it out!";
|
|
267
|
-
return /* @__PURE__ */
|
|
420
|
+
return /* @__PURE__ */ React12.createElement(FlexGrowCol2, {
|
|
268
421
|
alignItems: "flex-start",
|
|
269
422
|
paddingBottom: 1,
|
|
270
423
|
...props
|
|
271
|
-
}, /* @__PURE__ */
|
|
424
|
+
}, /* @__PURE__ */ React12.createElement(Typography5, {
|
|
272
425
|
variant: "body1",
|
|
273
426
|
gutterBottom: true
|
|
274
|
-
}, /* @__PURE__ */
|
|
427
|
+
}, /* @__PURE__ */ React12.createElement("strong", null, "Your Share Link")), /* @__PURE__ */ React12.createElement(Typography5, {
|
|
275
428
|
variant: "body1"
|
|
276
429
|
}, shareUrl ? `Use this link or the buttons below to share ${shareLinkName}` : GenerateShareLinkExplanation), children);
|
|
277
430
|
}, "ShareOutHeadingFlexbox");
|
|
278
431
|
|
|
279
432
|
// src/out/SocialButtonsFlexbox.tsx
|
|
280
|
-
import { Typography as
|
|
433
|
+
import { Typography as Typography6 } from "@mui/material";
|
|
281
434
|
import { ButtonEx as ButtonEx2 } from "@xylabs/react-button";
|
|
282
435
|
import { FlexGrowCol as FlexGrowCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
283
|
-
import
|
|
436
|
+
import React13 from "react";
|
|
284
437
|
var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, ...props }) => {
|
|
285
|
-
return /* @__PURE__ */
|
|
438
|
+
return /* @__PURE__ */ React13.createElement(FlexGrowCol3, {
|
|
286
439
|
alignItems: "stretch",
|
|
287
440
|
paddingTop: 2,
|
|
288
441
|
...props
|
|
289
|
-
}, /* @__PURE__ */
|
|
442
|
+
}, /* @__PURE__ */ React13.createElement(Typography6, {
|
|
290
443
|
variant: "body1",
|
|
291
444
|
gutterBottom: true
|
|
292
|
-
}, /* @__PURE__ */
|
|
445
|
+
}, /* @__PURE__ */ React13.createElement("strong", null, "Share on Social Media")), /* @__PURE__ */ React13.createElement(FlexRow2, {
|
|
293
446
|
gap: 0.5,
|
|
294
447
|
sx: {
|
|
295
448
|
flexDirection: {
|
|
@@ -297,7 +450,7 @@ var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, ...props }) => {
|
|
|
297
450
|
xs: "column"
|
|
298
451
|
}
|
|
299
452
|
}
|
|
300
|
-
}, shareUrl ? /* @__PURE__ */
|
|
453
|
+
}, shareUrl ? /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(ButtonEx2, {
|
|
301
454
|
variant: "contained",
|
|
302
455
|
style: {
|
|
303
456
|
backgroundColor: "#000",
|
|
@@ -306,10 +459,10 @@ var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, ...props }) => {
|
|
|
306
459
|
onClick: /* @__PURE__ */ __name(() => {
|
|
307
460
|
window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(shareUrl)}`);
|
|
308
461
|
}, "onClick"),
|
|
309
|
-
startIcon: /* @__PURE__ */
|
|
462
|
+
startIcon: /* @__PURE__ */ React13.createElement(XTwitterSvgIcon, {
|
|
310
463
|
width: "20px"
|
|
311
464
|
})
|
|
312
|
-
}, "Share on X (Twitter)"), /* @__PURE__ */
|
|
465
|
+
}, "Share on X (Twitter)"), /* @__PURE__ */ React13.createElement(ButtonEx2, {
|
|
313
466
|
variant: "contained",
|
|
314
467
|
style: {
|
|
315
468
|
backgroundColor: "#4267b2",
|
|
@@ -318,10 +471,11 @@ var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, ...props }) => {
|
|
|
318
471
|
onClick: /* @__PURE__ */ __name(() => {
|
|
319
472
|
window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`);
|
|
320
473
|
}, "onClick"),
|
|
321
|
-
startIcon: /* @__PURE__ */
|
|
474
|
+
startIcon: /* @__PURE__ */ React13.createElement(FacebookSvgIcon, null)
|
|
322
475
|
}, "Share on Facebook")) : null));
|
|
323
476
|
}, "SocialButtonsFlexbox");
|
|
324
477
|
export {
|
|
478
|
+
CopyLinkStack,
|
|
325
479
|
CopyLinkTextField,
|
|
326
480
|
DynamicShareImage,
|
|
327
481
|
FacebookSvgIcon,
|
|
@@ -1 +1 @@
|
|
|
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 {\n Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon,\n} from '@mui/icons-material'\nimport { Popover } from '@mui/material'\nimport type { ButtonExProps } from '@xylabs/react-button'\nimport { ButtonEx } 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> = ({\n prepared = true, shareLink, ...props\n}) => {\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","/* eslint-disable @stylistic/max-len */\nimport { 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","/* eslint-disable @stylistic/max-len */\nimport { 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)\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 type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport type { 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 type { StandardTextFieldProps } from '@mui/material'\nimport {\n IconButton, InputAdornment, TextField,\n} 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> = ({\n shareLinkName, shareUrl, ...props\n}) => {\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 type { DialogProps } from '@mui/material'\nimport {\n Dialog, DialogActions, DialogContent, DialogTitle, Stack, Typography,\n} from '@mui/material'\nimport { FlexCol, FlexGrowCol } from '@xylabs/react-flexbox'\nimport type { ComponentType, ReactNode } from 'react'\nimport React 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> = ({\n ShareOutDialogActions, cardImg, open, onClose, shareOutDialogContent, subtitle, title, ...props\n}) => {\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 {\n Tooltip, Typography, useTheme,\n} 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 // eslint-disable-next-line @stylistic/max-len\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 type { ButtonProps } from '@mui/material'\nimport {\n Button, CircularProgress, styled,\n} from '@mui/material'\nimport React from 'react'\n\nexport interface GenerateShareLinkButtonProps extends ButtonProps {\n loading?: boolean\n}\n\nexport const GenerateShareLinkButton: React.FC<GenerateShareLinkButtonProps> = ({\n children = 'Generate My Share Link', loading, ...props\n}) => {\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 type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { 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> = ({\n children, shareLinkName, shareUrl, ...props\n}) => {\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 type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { 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\n gap={0.5}\n sx={{ flexDirection: { md: 'row', xs: 'column' } }}\n >\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,SACEA,YAAYC,cAAcC,SAASC,WAAWC,WAAWC,mBACpD;AACP,SAASC,eAAe;AAExB,SAASC,gBAAgB;AACzB,SAASC,eAAe;AACxB,SAASC,cAAc;AACvB,OAAOC,SAASC,QAAQC,gBAAgB;AAOjC,IAAMC,cAA0C,wBAAC,EACtDC,WAAW,MAAMC,WAAW,GAAGC,MAAAA,MAChC;AACC,QAAM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K;IACLC,IAAI;MAAEC,eAAe;QAAEC,IAAI;QAAOC,IAAI;MAAS;IAAE;KAEhDf,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,GAvCyE;","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"]}
|
|
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/CopyLinkStack.tsx","../../src/out/CopyIconButton.tsx","../../src/out/lib/AnimatedGradientTypography.tsx","../../src/out/lib/splitAroundSubstring.ts","../../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 {\n Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon,\n} from '@mui/icons-material'\nimport { Popover } from '@mui/material'\nimport type { ButtonExProps } from '@xylabs/react-button'\nimport { ButtonEx } 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> = ({\n prepared = true, shareLink, ...props\n}) => {\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","/* eslint-disable @stylistic/max-len */\nimport { 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","/* eslint-disable @stylistic/max-len */\nimport { 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)\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 type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport type { 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 { Cancel } from '@mui/icons-material'\nimport type { StackProps, TypographyProps } from '@mui/material'\nimport {\n Stack,\n Tooltip,\n Typography,\n} from '@mui/material'\nimport React, {\n useCallback, useMemo, useState,\n} from 'react'\n\nimport { CopyIconButton } from './CopyIconButton.tsx'\nimport {\n AnimatedGradientTypography, type ShareLinkProps, splitAroundSubstring,\n} from './lib/index.ts'\n\nexport interface CopyLinkStackProps extends ShareLinkProps, StackProps {\n xnsEndColor?: string\n xnsStartColor?: string\n}\n\nexport const CopyLinkStack: React.FC<CopyLinkStackProps> = ({\n shareLinkName, shareUrl, xnsName: xnsNameProp, xnsEndColor, xnsStartColor, ...props\n}) => {\n const [error, setError] = useState<Error>()\n\n const onCopyToClipboard = useCallback((error?: Error) => {\n setError(error)\n }, [])\n\n const parsedXnsName = useMemo(() => {\n if (shareUrl && xnsNameProp) {\n try {\n const parts = splitAroundSubstring(shareUrl, xnsNameProp)\n return parts\n } catch (e) {\n setError(e as Error)\n }\n }\n }, [])\n\n const [part1, xnsName, part3] = parsedXnsName || []\n\n return (\n <Stack direction=\"row\" alignItems=\"center\" gap={0.25} {...props}>\n {xnsName\n ? (\n <Stack direction=\"row\" maxWidth=\"100%\" sx={{ overflowX: 'auto' }}>\n <Typography sx={{ display: 'inline-flex' }}>{part1}</Typography>\n <AnimatedGradientTypography color1={xnsStartColor} color2={xnsEndColor} sx={{ display: 'inline-flex' }}>{xnsName}</AnimatedGradientTypography>\n <Typography sx={{ display: 'inline-flex' }}>{part3}</Typography>\n </Stack>\n )\n : <Typography sx={{ display: 'inline-flex' }}>{shareUrl}</Typography>}\n <CopyIconButton onCopyToClipboard={onCopyToClipboard} shareLinkName={shareLinkName} shareUrl={shareUrl} sx={{ display: 'inline-flex' }} />\n {error ? <Tooltip title={error.message}><Cancel color=\"error\" sx={{ display: 'inline-flex' }} /></Tooltip> : null}\n </Stack>\n )\n}\n","import { CopyAllRounded } from '@mui/icons-material'\nimport {\n type ButtonProps, IconButton, Tooltip,\n} from '@mui/material'\nimport { forget } from '@xylabs/forget'\nimport React, { useState } from 'react'\n\nimport type { ShareLinkProps } from './lib/index.ts'\n\nexport interface CopyIconButtonProps extends ButtonProps, ShareLinkProps {\n onCopyToClipboard?: (error?: Error) => void\n}\n\nconst CopyLink = 'Copy Link'\nconst Copied = 'Copied!'\n\nexport const CopyIconButton: React.FC<CopyIconButtonProps> = ({\n onCopyToClipboard, shareLinkName, shareUrl, ...props\n}) => {\n const [copyTooltipTitle, setCopyToolTipTitle] = useState(CopyLink)\n\n const copyToClipboard = async (link?: string) => {\n if (link) {\n try {\n await navigator.clipboard.writeText(link)\n onCopyToClipboard?.()\n setCopyToolTipTitle(Copied)\n setTimeout(() => setCopyToolTipTitle(CopyLink), 2000)\n } catch (e) {\n const message = 'Error copying shareUrl to clipboard'\n console.error(message, e, link)\n onCopyToClipboard?.(new Error(message))\n }\n } else {\n console.warn('tried to copy shareUrl before it was generated')\n }\n }\n\n return (\n <Tooltip title={copyTooltipTitle}>\n <IconButton aria-label={`copy ${shareLinkName} link`} onClick={() => forget(copyToClipboard(shareUrl))} edge=\"end\" {...props}>\n <CopyAllRounded />\n </IconButton>\n </Tooltip>\n )\n}\n","import {\n keyframes, styled, Typography,\n} from '@mui/material'\n\n/**\n * Start the animation at 100% to give the gradient a left to right effect\n */\nconst moveBg = keyframes(`\n 0% {\n background-position: 100% 0%;\n }\n 100% {\n background-position: 0% 0%;\n }\n`)\n\n/**\n * Adapted from - https://codepen.io/web-dot-dev/pen/vYrGPNE\n */\nexport const AnimatedGradientTypography = styled(Typography, { name: 'AnimatedGradientTypography' })<{ color1?: string; color2?: string }>(({\n theme, color1, color2,\n}) => {\n return {\n // Set the color variables for the gradient\n '--color-one': color1 ?? theme.palette.secondary.dark,\n '--color-two': color2 ?? theme.palette.primary.light,\n // set the gradient so it has the same start and end color for looping effect\n 'background': `linear-gradient(\n .25turn,\n var(--color-one),\n var(--color-two),\n var(--color-one)\n )`,\n // Set the text color to transparent so the gradient shows through\n 'color': 'transparent',\n // Clip the background to the text shape\n 'backgroundClip': 'text',\n // Set the background size to 800% so we don't see the third color initially creating the looping effect\n 'backgroundSize': '800%',\n // Set the text to bold so the gradient is more visible\n 'fontWeight': 'bold',\n // Set the animation\n '@media (prefers-reduced-motion: no-preference)': {\n animationName: moveBg,\n animationDuration: '2s',\n animationIterationCount: 'infinite',\n },\n // reset for users that prefer reduced motion\n '@media (prefers-reduced-motion)': {\n background: 'none',\n color: theme.palette.text.primary,\n },\n }\n})\n","export const splitAroundSubstring = (path: string, substring: string): [string, string, string] => {\n // Find the index of the substring\n const index = path.indexOf(substring)\n\n if (index === -1) {\n throw new Error(`XNS name \"${substring}\" not found in path.`)\n }\n\n // Extract the part before the substring\n const part1 = path.slice(0, index)\n\n // The substring itself is part2\n const part2 = substring\n\n // Extract the part after the substring\n const part3 = path.slice(index + substring.length)\n\n return [part1, part2, part3]\n}\n","import type { StandardTextFieldProps } from '@mui/material'\nimport { InputAdornment, TextField } from '@mui/material'\nimport React, { useCallback, useState } from 'react'\n\nimport { CopyIconButton } from './CopyIconButton.tsx'\n\nexport interface CopyLinkTextFieldProps extends StandardTextFieldProps {\n shareLinkName?: string\n shareUrl?: string\n}\n\nexport const CopyLinkTextField: React.FC<CopyLinkTextFieldProps> = ({\n shareLinkName, shareUrl, ...props\n}) => {\n const [error, setError] = useState<Error>()\n\n const onCopyToClipboard = useCallback((error?: Error) => {\n setError(error)\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 <CopyIconButton shareLinkName={shareLinkName} shareUrl={shareUrl} onCopyToClipboard={onCopyToClipboard} />\n </InputAdornment>\n ),\n }}\n value={shareUrl}\n {...props}\n />\n )\n}\n","import type { DialogProps } from '@mui/material'\nimport {\n Dialog, DialogActions, DialogContent, DialogTitle, Stack, Typography,\n} from '@mui/material'\nimport { FlexCol, FlexGrowCol } from '@xylabs/react-flexbox'\nimport type { ComponentType, ReactNode } from 'react'\nimport React 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> = ({\n ShareOutDialogActions, cardImg, open, onClose, shareOutDialogContent, subtitle, title, ...props\n}) => {\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 {\n Tooltip, Typography, useTheme,\n} 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 // eslint-disable-next-line @stylistic/max-len\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 type { ButtonProps } from '@mui/material'\nimport {\n Button, CircularProgress, styled,\n} from '@mui/material'\nimport React from 'react'\n\nexport interface GenerateShareLinkButtonProps extends ButtonProps {\n loading?: boolean\n}\n\nexport const GenerateShareLinkButton: React.FC<GenerateShareLinkButtonProps> = ({\n children = 'Generate My Share Link', loading, ...props\n}) => {\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 type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { 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> = ({\n children, shareLinkName, shareUrl, ...props\n}) => {\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 type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { 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\n gap={0.5}\n sx={{ flexDirection: { md: 'row', xs: 'column' } }}\n >\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,SACEA,YAAYC,cAAcC,SAASC,WAAWC,WAAWC,mBACpD;AACP,SAASC,eAAe;AAExB,SAASC,gBAAgB;AACzB,SAASC,eAAe;AACxB,SAASC,cAAc;AACvB,OAAOC,SAASC,QAAQC,gBAAgB;AAOjC,IAAMC,cAA0C,wBAAC,EACtDC,WAAW,MAAMC,WAAW,GAAGC,MAAAA,MAChC;AACC,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;AAC9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A,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,GAvCyE;","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","Cancel","Stack","Tooltip","Typography","React","useCallback","useMemo","useState","CopyAllRounded","IconButton","Tooltip","forget","React","useState","CopyLink","Copied","CopyIconButton","onCopyToClipboard","shareLinkName","shareUrl","props","copyTooltipTitle","setCopyToolTipTitle","useState","copyToClipboard","link","navigator","clipboard","writeText","setTimeout","e","message","console","error","Error","warn","React","Tooltip","title","IconButton","aria-label","onClick","forget","edge","CopyAllRounded","keyframes","styled","Typography","moveBg","AnimatedGradientTypography","name","theme","color1","color2","palette","secondary","dark","primary","light","animationName","animationDuration","animationIterationCount","background","color","text","splitAroundSubstring","path","substring","index","indexOf","Error","part1","slice","part2","part3","length","CopyLinkStack","shareLinkName","shareUrl","xnsName","xnsNameProp","xnsEndColor","xnsStartColor","props","error","setError","useState","onCopyToClipboard","useCallback","parsedXnsName","useMemo","parts","splitAroundSubstring","e","part1","part3","React","Stack","direction","alignItems","gap","maxWidth","sx","overflowX","Typography","display","AnimatedGradientTypography","color1","color2","CopyIconButton","Tooltip","title","message","Cancel","color","InputAdornment","TextField","React","useCallback","useState","CopyLinkTextField","shareLinkName","shareUrl","props","error","setError","useState","onCopyToClipboard","useCallback","React","TextField","disabled","helperText","message","sx","input","WebkitTextFillColor","InputProps","endAdornment","InputAdornment","position","CopyIconButton","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"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ButtonProps } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ShareLinkProps } from './lib/index.ts';
|
|
4
|
+
export interface CopyIconButtonProps extends ButtonProps, ShareLinkProps {
|
|
5
|
+
onCopyToClipboard?: (error?: Error) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const CopyIconButton: React.FC<CopyIconButtonProps>;
|
|
8
|
+
//# sourceMappingURL=CopyIconButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyIconButton.d.ts","sourceRoot":"","sources":["../../../src/out/CopyIconButton.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,WAAW,EACjB,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,WAAW,mBAAoB,SAAQ,WAAW,EAAE,cAAc;IACtE,iBAAiB,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAA;CAC5C;AAKD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA6BxD,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StackProps } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { type ShareLinkProps } from './lib/index.ts';
|
|
4
|
+
export interface CopyLinkStackProps extends ShareLinkProps, StackProps {
|
|
5
|
+
xnsEndColor?: string;
|
|
6
|
+
xnsStartColor?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const CopyLinkStack: React.FC<CopyLinkStackProps>;
|
|
9
|
+
//# sourceMappingURL=CopyLinkStack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyLinkStack.d.ts","sourceRoot":"","sources":["../../../src/out/CopyLinkStack.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,eAAe,CAAA;AAMhE,OAAO,KAEN,MAAM,OAAO,CAAA;AAGd,OAAO,EACuB,KAAK,cAAc,EAChD,MAAM,gBAAgB,CAAA;AAEvB,MAAM,WAAW,kBAAmB,SAAQ,cAAc,EAAE,UAAU;IACpE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAqCtD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyLinkTextField.d.ts","sourceRoot":"","sources":["../../../src/out/CopyLinkTextField.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CopyLinkTextField.d.ts","sourceRoot":"","sources":["../../../src/out/CopyLinkTextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAE3D,OAAO,KAAgC,MAAM,OAAO,CAAA;AAIpD,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACpE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA2B9D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/out/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/out/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const AnimatedGradientTypography: import("@emotion/styled").StyledComponent<Pick<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent.js").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
2
|
+
ref?: ((instance: HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
3
|
+
}, "className" | "style" | "classes" | "children" | "sx" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">, "className" | "style" | "classes" | "children" | "sx" | "tabIndex" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "content" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "translate" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "variant" | "ref" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
4
|
+
color1?: string;
|
|
5
|
+
color2?: string;
|
|
6
|
+
}, {}, {}>;
|
|
7
|
+
//# sourceMappingURL=AnimatedGradientTypography.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimatedGradientTypography.d.ts","sourceRoot":"","sources":["../../../../src/out/lib/AnimatedGradientTypography.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,0BAA0B;;;aAAyE,MAAM;aAAW,MAAM;UAkCrI,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShareLinkProps.d.ts","sourceRoot":"","sources":["../../../../src/out/lib/ShareLinkProps.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/out/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA;AAChD,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitAroundSubstring.d.ts","sourceRoot":"","sources":["../../../../src/out/lib/splitAroundSubstring.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,SAAU,MAAM,aAAa,MAAM,KAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAkB7F,CAAA"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CopyAllRounded } from '@mui/icons-material'
|
|
2
|
+
import {
|
|
3
|
+
type ButtonProps, IconButton, Tooltip,
|
|
4
|
+
} from '@mui/material'
|
|
5
|
+
import { forget } from '@xylabs/forget'
|
|
6
|
+
import React, { useState } from 'react'
|
|
7
|
+
|
|
8
|
+
import type { ShareLinkProps } from './lib/index.ts'
|
|
9
|
+
|
|
10
|
+
export interface CopyIconButtonProps extends ButtonProps, ShareLinkProps {
|
|
11
|
+
onCopyToClipboard?: (error?: Error) => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const CopyLink = 'Copy Link'
|
|
15
|
+
const Copied = 'Copied!'
|
|
16
|
+
|
|
17
|
+
export const CopyIconButton: React.FC<CopyIconButtonProps> = ({
|
|
18
|
+
onCopyToClipboard, shareLinkName, shareUrl, ...props
|
|
19
|
+
}) => {
|
|
20
|
+
const [copyTooltipTitle, setCopyToolTipTitle] = useState(CopyLink)
|
|
21
|
+
|
|
22
|
+
const copyToClipboard = async (link?: string) => {
|
|
23
|
+
if (link) {
|
|
24
|
+
try {
|
|
25
|
+
await navigator.clipboard.writeText(link)
|
|
26
|
+
onCopyToClipboard?.()
|
|
27
|
+
setCopyToolTipTitle(Copied)
|
|
28
|
+
setTimeout(() => setCopyToolTipTitle(CopyLink), 2000)
|
|
29
|
+
} catch (e) {
|
|
30
|
+
const message = 'Error copying shareUrl to clipboard'
|
|
31
|
+
console.error(message, e, link)
|
|
32
|
+
onCopyToClipboard?.(new Error(message))
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
console.warn('tried to copy shareUrl before it was generated')
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Tooltip title={copyTooltipTitle}>
|
|
41
|
+
<IconButton aria-label={`copy ${shareLinkName} link`} onClick={() => forget(copyToClipboard(shareUrl))} edge="end" {...props}>
|
|
42
|
+
<CopyAllRounded />
|
|
43
|
+
</IconButton>
|
|
44
|
+
</Tooltip>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { CopyLinkStack } from './CopyLinkStack.tsx'
|
|
5
|
+
|
|
6
|
+
export default { title: 'modules/ShareOut/CopyLinkStack' } as Meta<typeof CopyLinkStack>
|
|
7
|
+
|
|
8
|
+
const Template: StoryFn<typeof CopyLinkStack> = (props) => {
|
|
9
|
+
return <CopyLinkStack {...props} />
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const Default = Template.bind({})
|
|
13
|
+
Default.args = {}
|
|
14
|
+
|
|
15
|
+
const WithShareUrl = Template.bind({})
|
|
16
|
+
WithShareUrl.args = { shareUrl: 'https://google.com' }
|
|
17
|
+
|
|
18
|
+
const WithXnsName = Template.bind({})
|
|
19
|
+
WithXnsName.args = { shareUrl: 'https://beta.node.xyo.network.com/view/arietrouw.xyo/profile', xnsName: 'arietrouw.xyo' }
|
|
20
|
+
|
|
21
|
+
const WithXnsNameShortened = Template.bind({})
|
|
22
|
+
WithXnsNameShortened.args = {
|
|
23
|
+
shareUrl: 'https://beta.node.xyo.network.com/view/arietrouw.xyo/profile', xnsName: 'arietrouw.xyo', sx: { maxWidth: '200px' },
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const WithXnsNameInSubdomain = Template.bind({})
|
|
27
|
+
WithXnsNameInSubdomain.args = { shareUrl: 'https://arietrouw.xyo.network', xnsName: 'arietrouw.xyo' }
|
|
28
|
+
|
|
29
|
+
const WithXnsNameCustomColors = Template.bind({})
|
|
30
|
+
WithXnsNameCustomColors.args = {
|
|
31
|
+
shareUrl: 'https://arietrouw.xyo.network', xnsName: 'arietrouw.xyo', xnsStartColor: 'blue', xnsEndColor: 'red',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const WithError = Template.bind({})
|
|
35
|
+
WithError.args = { shareUrl: 'https://google.com', xnsName: 'foo.xyo' }
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
Default, WithError,
|
|
39
|
+
WithShareUrl, WithXnsName, WithXnsNameCustomColors,
|
|
40
|
+
WithXnsNameInSubdomain, WithXnsNameShortened,
|
|
41
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Cancel } from '@mui/icons-material'
|
|
2
|
+
import type { StackProps, TypographyProps } from '@mui/material'
|
|
3
|
+
import {
|
|
4
|
+
Stack,
|
|
5
|
+
Tooltip,
|
|
6
|
+
Typography,
|
|
7
|
+
} from '@mui/material'
|
|
8
|
+
import React, {
|
|
9
|
+
useCallback, useMemo, useState,
|
|
10
|
+
} from 'react'
|
|
11
|
+
|
|
12
|
+
import { CopyIconButton } from './CopyIconButton.tsx'
|
|
13
|
+
import {
|
|
14
|
+
AnimatedGradientTypography, type ShareLinkProps, splitAroundSubstring,
|
|
15
|
+
} from './lib/index.ts'
|
|
16
|
+
|
|
17
|
+
export interface CopyLinkStackProps extends ShareLinkProps, StackProps {
|
|
18
|
+
xnsEndColor?: string
|
|
19
|
+
xnsStartColor?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const CopyLinkStack: React.FC<CopyLinkStackProps> = ({
|
|
23
|
+
shareLinkName, shareUrl, xnsName: xnsNameProp, xnsEndColor, xnsStartColor, ...props
|
|
24
|
+
}) => {
|
|
25
|
+
const [error, setError] = useState<Error>()
|
|
26
|
+
|
|
27
|
+
const onCopyToClipboard = useCallback((error?: Error) => {
|
|
28
|
+
setError(error)
|
|
29
|
+
}, [])
|
|
30
|
+
|
|
31
|
+
const parsedXnsName = useMemo(() => {
|
|
32
|
+
if (shareUrl && xnsNameProp) {
|
|
33
|
+
try {
|
|
34
|
+
const parts = splitAroundSubstring(shareUrl, xnsNameProp)
|
|
35
|
+
return parts
|
|
36
|
+
} catch (e) {
|
|
37
|
+
setError(e as Error)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, [])
|
|
41
|
+
|
|
42
|
+
const [part1, xnsName, part3] = parsedXnsName || []
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Stack direction="row" alignItems="center" gap={0.25} {...props}>
|
|
46
|
+
{xnsName
|
|
47
|
+
? (
|
|
48
|
+
<Stack direction="row" maxWidth="100%" sx={{ overflowX: 'auto' }}>
|
|
49
|
+
<Typography sx={{ display: 'inline-flex' }}>{part1}</Typography>
|
|
50
|
+
<AnimatedGradientTypography color1={xnsStartColor} color2={xnsEndColor} sx={{ display: 'inline-flex' }}>{xnsName}</AnimatedGradientTypography>
|
|
51
|
+
<Typography sx={{ display: 'inline-flex' }}>{part3}</Typography>
|
|
52
|
+
</Stack>
|
|
53
|
+
)
|
|
54
|
+
: <Typography sx={{ display: 'inline-flex' }}>{shareUrl}</Typography>}
|
|
55
|
+
<CopyIconButton onCopyToClipboard={onCopyToClipboard} shareLinkName={shareLinkName} shareUrl={shareUrl} sx={{ display: 'inline-flex' }} />
|
|
56
|
+
{error ? <Tooltip title={error.message}><Cancel color="error" sx={{ display: 'inline-flex' }} /></Tooltip> : null}
|
|
57
|
+
</Stack>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { CopyAllRounded } from '@mui/icons-material'
|
|
2
1
|
import type { StandardTextFieldProps } from '@mui/material'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import React, { useState } from 'react'
|
|
2
|
+
import { InputAdornment, TextField } from '@mui/material'
|
|
3
|
+
import React, { useCallback, useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import { CopyIconButton } from './CopyIconButton.tsx'
|
|
8
6
|
|
|
9
7
|
export interface CopyLinkTextFieldProps extends StandardTextFieldProps {
|
|
10
8
|
shareLinkName?: string
|
|
@@ -16,19 +14,9 @@ export const CopyLinkTextField: React.FC<CopyLinkTextFieldProps> = ({
|
|
|
16
14
|
}) => {
|
|
17
15
|
const [error, setError] = useState<Error>()
|
|
18
16
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
await navigator.clipboard.writeText(link)
|
|
23
|
-
} catch (e) {
|
|
24
|
-
const message = 'Error copying shareUrl to clipboard'
|
|
25
|
-
console.error(message, e, link)
|
|
26
|
-
setError(new Error(message))
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
console.warn('tried to copy shareUrl before it was generated')
|
|
30
|
-
}
|
|
31
|
-
}
|
|
17
|
+
const onCopyToClipboard = useCallback((error?: Error) => {
|
|
18
|
+
setError(error)
|
|
19
|
+
}, [])
|
|
32
20
|
|
|
33
21
|
return (
|
|
34
22
|
<TextField
|
|
@@ -40,9 +28,7 @@ export const CopyLinkTextField: React.FC<CopyLinkTextFieldProps> = ({
|
|
|
40
28
|
InputProps={{
|
|
41
29
|
endAdornment: (
|
|
42
30
|
<InputAdornment position="end">
|
|
43
|
-
<
|
|
44
|
-
<CopyAllRounded />
|
|
45
|
-
</IconButton>
|
|
31
|
+
<CopyIconButton shareLinkName={shareLinkName} shareUrl={shareUrl} onCopyToClipboard={onCopyToClipboard} />
|
|
46
32
|
</InputAdornment>
|
|
47
33
|
),
|
|
48
34
|
}}
|
package/src/out/index.ts
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
keyframes, styled, Typography,
|
|
3
|
+
} from '@mui/material'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Start the animation at 100% to give the gradient a left to right effect
|
|
7
|
+
*/
|
|
8
|
+
const moveBg = keyframes(`
|
|
9
|
+
0% {
|
|
10
|
+
background-position: 100% 0%;
|
|
11
|
+
}
|
|
12
|
+
100% {
|
|
13
|
+
background-position: 0% 0%;
|
|
14
|
+
}
|
|
15
|
+
`)
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Adapted from - https://codepen.io/web-dot-dev/pen/vYrGPNE
|
|
19
|
+
*/
|
|
20
|
+
export const AnimatedGradientTypography = styled(Typography, { name: 'AnimatedGradientTypography' })<{ color1?: string; color2?: string }>(({
|
|
21
|
+
theme, color1, color2,
|
|
22
|
+
}) => {
|
|
23
|
+
return {
|
|
24
|
+
// Set the color variables for the gradient
|
|
25
|
+
'--color-one': color1 ?? theme.palette.secondary.dark,
|
|
26
|
+
'--color-two': color2 ?? theme.palette.primary.light,
|
|
27
|
+
// set the gradient so it has the same start and end color for looping effect
|
|
28
|
+
'background': `linear-gradient(
|
|
29
|
+
.25turn,
|
|
30
|
+
var(--color-one),
|
|
31
|
+
var(--color-two),
|
|
32
|
+
var(--color-one)
|
|
33
|
+
)`,
|
|
34
|
+
// Set the text color to transparent so the gradient shows through
|
|
35
|
+
'color': 'transparent',
|
|
36
|
+
// Clip the background to the text shape
|
|
37
|
+
'backgroundClip': 'text',
|
|
38
|
+
// Set the background size to 800% so we don't see the third color initially creating the looping effect
|
|
39
|
+
'backgroundSize': '800%',
|
|
40
|
+
// Set the text to bold so the gradient is more visible
|
|
41
|
+
'fontWeight': 'bold',
|
|
42
|
+
// Set the animation
|
|
43
|
+
'@media (prefers-reduced-motion: no-preference)': {
|
|
44
|
+
animationName: moveBg,
|
|
45
|
+
animationDuration: '2s',
|
|
46
|
+
animationIterationCount: 'infinite',
|
|
47
|
+
},
|
|
48
|
+
// reset for users that prefer reduced motion
|
|
49
|
+
'@media (prefers-reduced-motion)': {
|
|
50
|
+
background: 'none',
|
|
51
|
+
color: theme.palette.text.primary,
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const splitAroundSubstring = (path: string, substring: string): [string, string, string] => {
|
|
2
|
+
// Find the index of the substring
|
|
3
|
+
const index = path.indexOf(substring)
|
|
4
|
+
|
|
5
|
+
if (index === -1) {
|
|
6
|
+
throw new Error(`XNS name "${substring}" not found in path.`)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Extract the part before the substring
|
|
10
|
+
const part1 = path.slice(0, index)
|
|
11
|
+
|
|
12
|
+
// The substring itself is part2
|
|
13
|
+
const part2 = substring
|
|
14
|
+
|
|
15
|
+
// Extract the part after the substring
|
|
16
|
+
const part3 = path.slice(index + substring.length)
|
|
17
|
+
|
|
18
|
+
return [part1, part2, part3]
|
|
19
|
+
}
|