@xyo-network/react-share 3.0.3 → 3.0.4

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.
@@ -137,26 +137,51 @@ var HideParentsFlexbox = /* @__PURE__ */ __name(({ children, ...props }) => {
137
137
  }, "HideParentsFlexbox");
138
138
 
139
139
  // src/out/CopyLinkTextField.tsx
140
+ import { InputAdornment, TextField } from "@mui/material";
141
+ import React7, { useCallback, useState as useState3 } from "react";
142
+
143
+ // src/out/CopyIconButton.tsx
140
144
  import { CopyAllRounded } from "@mui/icons-material";
141
- import { IconButton, InputAdornment, TextField } from "@mui/material";
145
+ import { IconButton, Tooltip } from "@mui/material";
142
146
  import { forget } from "@xylabs/forget";
143
147
  import React6, { useState as useState2 } from "react";
144
- var CopyLinkTextField = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, ...props }) => {
145
- const [error, setError] = useState2();
148
+ var CopyLink = "Copy Link";
149
+ var Copied = "Copied!";
150
+ var CopyIconButton = /* @__PURE__ */ __name(({ onCopyToClipboard, shareLinkName, shareUrl, ...props }) => {
151
+ const [copyTooltipTitle, setCopyToolTipTitle] = useState2(CopyLink);
146
152
  const copyToClipboard = /* @__PURE__ */ __name(async (link) => {
147
153
  if (link) {
148
154
  try {
149
155
  await navigator.clipboard.writeText(link);
156
+ onCopyToClipboard?.();
157
+ setCopyToolTipTitle(Copied);
158
+ setTimeout(() => setCopyToolTipTitle(CopyLink), 2e3);
150
159
  } catch (e) {
151
160
  const message = "Error copying shareUrl to clipboard";
152
161
  console.error(message, e, link);
153
- setError(new Error(message));
162
+ onCopyToClipboard?.(new Error(message));
154
163
  }
155
164
  } else {
156
165
  console.warn("tried to copy shareUrl before it was generated");
157
166
  }
158
167
  }, "copyToClipboard");
159
- return /* @__PURE__ */ React6.createElement(TextField, {
168
+ return /* @__PURE__ */ React6.createElement(Tooltip, {
169
+ title: copyTooltipTitle
170
+ }, /* @__PURE__ */ React6.createElement(IconButton, {
171
+ "aria-label": `copy ${shareLinkName} link`,
172
+ onClick: /* @__PURE__ */ __name(() => forget(copyToClipboard(shareUrl)), "onClick"),
173
+ edge: "end",
174
+ ...props
175
+ }, /* @__PURE__ */ React6.createElement(CopyAllRounded, null)));
176
+ }, "CopyIconButton");
177
+
178
+ // src/out/CopyLinkTextField.tsx
179
+ var CopyLinkTextField = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, ...props }) => {
180
+ const [error, setError] = useState3();
181
+ const onCopyToClipboard = useCallback((error2) => {
182
+ setError(error2);
183
+ }, []);
184
+ return /* @__PURE__ */ React7.createElement(TextField, {
160
185
  disabled: true,
161
186
  error: !!error,
162
187
  helperText: error?.message,
@@ -167,68 +192,193 @@ var CopyLinkTextField = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, ...pr
167
192
  }
168
193
  },
169
194
  InputProps: {
170
- endAdornment: /* @__PURE__ */ React6.createElement(InputAdornment, {
195
+ endAdornment: /* @__PURE__ */ React7.createElement(InputAdornment, {
171
196
  position: "end"
172
- }, /* @__PURE__ */ React6.createElement(IconButton, {
173
- "aria-label": `copy ${shareLinkName} link`,
174
- onClick: /* @__PURE__ */ __name(() => forget(copyToClipboard(shareUrl)), "onClick"),
175
- edge: "end"
176
- }, /* @__PURE__ */ React6.createElement(CopyAllRounded, null)))
197
+ }, /* @__PURE__ */ React7.createElement(CopyIconButton, {
198
+ shareLinkName,
199
+ shareUrl,
200
+ onCopyToClipboard
201
+ }))
177
202
  },
178
203
  value: shareUrl,
179
204
  ...props
180
205
  });
181
206
  }, "CopyLinkTextField");
182
207
 
208
+ // src/out/CopyLinkTypography.tsx
209
+ import { Cancel } from "@mui/icons-material";
210
+ import { Stack, Tooltip as Tooltip2, Typography as Typography2 } from "@mui/material";
211
+ import React8, { useCallback as useCallback2, useMemo, useState as useState4 } from "react";
212
+
213
+ // src/out/lib/AnimatedGradientTypography.tsx
214
+ import { keyframes, styled, Typography } from "@mui/material";
215
+ var moveBg = keyframes(`
216
+ 0% {
217
+ background-position: 100% 0%;
218
+ }
219
+ 100% {
220
+ background-position: 0% 0%;
221
+ }
222
+ `);
223
+ var AnimatedGradientTypography = styled(Typography, {
224
+ name: "AnimatedGradientTypography"
225
+ })(({ theme }) => ({
226
+ // Set the color variables for the gradient
227
+ "--color-one": theme.palette.secondary.dark,
228
+ "--color-two": theme.palette.primary.light,
229
+ // set the gradient so it has the same start and end color for looping effect
230
+ "background": `linear-gradient(
231
+ .25turn,
232
+ var(--color-one),
233
+ var(--color-two),
234
+ var(--color-one)
235
+ )`,
236
+ // Set the text color to transparent so the gradient shows through
237
+ "color": "transparent",
238
+ // Clip the background to the text shape
239
+ "backgroundClip": "text",
240
+ // Set the background size to 800% so we don't see the third color initially creating the looping effect
241
+ "backgroundSize": "800%",
242
+ // Set the text to bold so the gradient is more visible
243
+ "fontWeight": "bold",
244
+ // Set the animation
245
+ "@media (prefers-reduced-motion: no-preference)": {
246
+ animationName: moveBg,
247
+ animationDuration: "2s",
248
+ animationIterationCount: "infinite"
249
+ },
250
+ // reset for users that prefer reduced motion
251
+ "@media (prefers-reduced-motion)": {
252
+ background: "none",
253
+ color: theme.palette.text.primary
254
+ }
255
+ }));
256
+
257
+ // src/out/lib/splitAroundSubstring.ts
258
+ var splitAroundSubstring = /* @__PURE__ */ __name((path, substring) => {
259
+ const index = path.indexOf(substring);
260
+ if (index === -1) {
261
+ throw new Error(`XNS name "${substring}" not found in path.`);
262
+ }
263
+ const part1 = path.slice(0, index);
264
+ const part2 = substring;
265
+ const part3 = path.slice(index + substring.length);
266
+ return [
267
+ part1,
268
+ part2,
269
+ part3
270
+ ];
271
+ }, "splitAroundSubstring");
272
+
273
+ // src/out/CopyLinkTypography.tsx
274
+ var CopyLinkTypography = /* @__PURE__ */ __name(({ shareLinkName, shareUrl, xnsName: xnsNameProp, ...props }) => {
275
+ const [error, setError] = useState4();
276
+ const onCopyToClipboard = useCallback2((error2) => {
277
+ setError(error2);
278
+ }, []);
279
+ const parsedXnsName = useMemo(() => {
280
+ if (shareUrl && xnsNameProp) {
281
+ try {
282
+ const parts = splitAroundSubstring(shareUrl, xnsNameProp);
283
+ return parts;
284
+ } catch (e) {
285
+ setError(e);
286
+ }
287
+ }
288
+ }, []);
289
+ const [part1, xnsName, part3] = parsedXnsName || [];
290
+ return /* @__PURE__ */ React8.createElement(Stack, {
291
+ direction: "row",
292
+ alignItems: "center",
293
+ gap: 0.25
294
+ }, xnsName ? /* @__PURE__ */ React8.createElement(Stack, {
295
+ direction: "row"
296
+ }, /* @__PURE__ */ React8.createElement(Typography2, {
297
+ sx: {
298
+ display: "inline-flex"
299
+ },
300
+ ...props
301
+ }, part1), /* @__PURE__ */ React8.createElement(AnimatedGradientTypography, {
302
+ sx: {
303
+ display: "inline-flex"
304
+ },
305
+ ...props
306
+ }, xnsName), /* @__PURE__ */ React8.createElement(Typography2, {
307
+ sx: {
308
+ display: "inline-flex"
309
+ },
310
+ ...props
311
+ }, part3)) : /* @__PURE__ */ React8.createElement(Typography2, {
312
+ sx: {
313
+ display: "inline-flex"
314
+ },
315
+ ...props
316
+ }, shareUrl), /* @__PURE__ */ React8.createElement(CopyIconButton, {
317
+ onCopyToClipboard,
318
+ shareLinkName,
319
+ shareUrl,
320
+ sx: {
321
+ display: "inline-flex"
322
+ }
323
+ }), error ? /* @__PURE__ */ React8.createElement(Tooltip2, {
324
+ title: error.message
325
+ }, /* @__PURE__ */ React8.createElement(Cancel, {
326
+ color: "error",
327
+ sx: {
328
+ display: "inline-flex"
329
+ }
330
+ })) : null);
331
+ }, "CopyLinkTypography");
332
+
183
333
  // src/out/Dialog.tsx
184
- import { Dialog, DialogActions, DialogContent, DialogTitle, Stack, Typography } from "@mui/material";
334
+ import { Dialog, DialogActions, DialogContent, DialogTitle, Stack as Stack2, Typography as Typography3 } from "@mui/material";
185
335
  import { FlexCol, FlexGrowCol } from "@xylabs/react-flexbox";
186
- import React7 from "react";
336
+ import React9 from "react";
187
337
  var ShareOutDialog = /* @__PURE__ */ __name(({ ShareOutDialogActions, cardImg, open, onClose, shareOutDialogContent, subtitle, title, ...props }) => {
188
338
  const handleClose = /* @__PURE__ */ __name(() => {
189
339
  onClose?.("", "backdropClick");
190
340
  }, "handleClose");
191
- return /* @__PURE__ */ React7.createElement(Dialog, {
341
+ return /* @__PURE__ */ React9.createElement(Dialog, {
192
342
  onClose,
193
343
  open,
194
344
  ...props
195
- }, /* @__PURE__ */ React7.createElement(DialogTitle, null, /* @__PURE__ */ React7.createElement(Stack, {
345
+ }, /* @__PURE__ */ React9.createElement(DialogTitle, null, /* @__PURE__ */ React9.createElement(Stack2, {
196
346
  direction: "row",
197
347
  spacing: 2
198
- }, /* @__PURE__ */ React7.createElement(FlexGrowCol, {
348
+ }, /* @__PURE__ */ React9.createElement(FlexGrowCol, {
199
349
  alignItems: "flex-start",
200
350
  width: "60%"
201
- }, /* @__PURE__ */ React7.createElement(Typography, {
351
+ }, /* @__PURE__ */ React9.createElement(Typography3, {
202
352
  variant: "h5"
203
- }, title), /* @__PURE__ */ React7.createElement(Typography, {
353
+ }, title), /* @__PURE__ */ React9.createElement(Typography3, {
204
354
  variant: "body1"
205
- }, " ", subtitle)), /* @__PURE__ */ React7.createElement(FlexGrowCol, {
355
+ }, " ", subtitle)), /* @__PURE__ */ React9.createElement(FlexGrowCol, {
206
356
  alignItems: "flex-end",
207
357
  width: "40%"
208
- }, cardImg))), /* @__PURE__ */ React7.createElement(DialogContent, null, shareOutDialogContent, /* @__PURE__ */ React7.createElement(FlexCol, {
358
+ }, cardImg))), /* @__PURE__ */ React9.createElement(DialogContent, null, shareOutDialogContent, /* @__PURE__ */ React9.createElement(FlexCol, {
209
359
  alignItems: "stretch"
210
- })), ShareOutDialogActions ? /* @__PURE__ */ React7.createElement(DialogActions, null, /* @__PURE__ */ React7.createElement(ShareOutDialogActions, {
360
+ })), ShareOutDialogActions ? /* @__PURE__ */ React9.createElement(DialogActions, null, /* @__PURE__ */ React9.createElement(ShareOutDialogActions, {
211
361
  onClose: handleClose
212
362
  })) : null);
213
363
  }, "ShareOutDialog");
214
364
 
215
365
  // src/out/Explanation.tsx
216
366
  import { InfoOutlined } from "@mui/icons-material";
217
- import { Tooltip, Typography as Typography2, useTheme } from "@mui/material";
367
+ import { Tooltip as Tooltip3, Typography as Typography4, useTheme } from "@mui/material";
218
368
  import { FlexGrowRow as FlexGrowRow2 } from "@xylabs/react-flexbox";
219
- import React8 from "react";
369
+ import React10 from "react";
220
370
  var ShareOutExplanation = /* @__PURE__ */ __name(({ toolTipTitle }) => {
221
371
  const theme = useTheme();
222
372
  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__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(FlexGrowRow2, {
373
+ return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(FlexGrowRow2, {
224
374
  alignItems: "center"
225
- }, /* @__PURE__ */ React8.createElement(Typography2, {
375
+ }, /* @__PURE__ */ React10.createElement(Typography4, {
226
376
  variant: "body2",
227
377
  paddingRight: 0.5
228
- }, "What am I sharing?"), /* @__PURE__ */ React8.createElement(Tooltip, {
378
+ }, "What am I sharing?"), /* @__PURE__ */ React10.createElement(Tooltip3, {
229
379
  title,
230
380
  placement: "bottom"
231
- }, /* @__PURE__ */ React8.createElement(InfoOutlined, {
381
+ }, /* @__PURE__ */ React10.createElement(InfoOutlined, {
232
382
  fontSize: "small",
233
383
  sx: {
234
384
  fontSize: theme.typography.caption.fontSize
@@ -237,18 +387,18 @@ var ShareOutExplanation = /* @__PURE__ */ __name(({ toolTipTitle }) => {
237
387
  }, "ShareOutExplanation");
238
388
 
239
389
  // src/out/GenerateShareLinkButton.tsx
240
- import { Button, CircularProgress, styled } from "@mui/material";
241
- import React9 from "react";
390
+ import { Button, CircularProgress, styled as styled2 } from "@mui/material";
391
+ import React11 from "react";
242
392
  var GenerateShareLinkButton = /* @__PURE__ */ __name(({ children = "Generate My Share Link", loading, ...props }) => {
243
- return /* @__PURE__ */ React9.createElement(Button, {
393
+ return /* @__PURE__ */ React11.createElement(Button, {
244
394
  variant: "contained",
245
- startIcon: loading ? /* @__PURE__ */ React9.createElement(StyledCircularProgress, {
395
+ startIcon: loading ? /* @__PURE__ */ React11.createElement(StyledCircularProgress, {
246
396
  size: "small"
247
397
  }) : null,
248
398
  ...props
249
399
  }, children);
250
400
  }, "GenerateShareLinkButton");
251
- var StyledCircularProgress = styled(CircularProgress, {
401
+ var StyledCircularProgress = styled2(CircularProgress, {
252
402
  name: "StyledCircularProgress"
253
403
  })(({ theme }) => ({
254
404
  // ensure the color of the spinner is the same as the button color
@@ -259,37 +409,37 @@ var StyledCircularProgress = styled(CircularProgress, {
259
409
  }));
260
410
 
261
411
  // src/out/HeadingFlexbox.tsx
262
- import { Typography as Typography3 } from "@mui/material";
412
+ import { Typography as Typography5 } from "@mui/material";
263
413
  import { FlexGrowCol as FlexGrowCol2 } from "@xylabs/react-flexbox";
264
- import React10 from "react";
414
+ import React12 from "react";
265
415
  var ShareOutHeadingFlexbox = /* @__PURE__ */ __name(({ children, shareLinkName, shareUrl, ...props }) => {
266
416
  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__ */ React10.createElement(FlexGrowCol2, {
417
+ return /* @__PURE__ */ React12.createElement(FlexGrowCol2, {
268
418
  alignItems: "flex-start",
269
419
  paddingBottom: 1,
270
420
  ...props
271
- }, /* @__PURE__ */ React10.createElement(Typography3, {
421
+ }, /* @__PURE__ */ React12.createElement(Typography5, {
272
422
  variant: "body1",
273
423
  gutterBottom: true
274
- }, /* @__PURE__ */ React10.createElement("strong", null, "Your Share Link")), /* @__PURE__ */ React10.createElement(Typography3, {
424
+ }, /* @__PURE__ */ React12.createElement("strong", null, "Your Share Link")), /* @__PURE__ */ React12.createElement(Typography5, {
275
425
  variant: "body1"
276
426
  }, shareUrl ? `Use this link or the buttons below to share ${shareLinkName}` : GenerateShareLinkExplanation), children);
277
427
  }, "ShareOutHeadingFlexbox");
278
428
 
279
429
  // src/out/SocialButtonsFlexbox.tsx
280
- import { Typography as Typography4 } from "@mui/material";
430
+ import { Typography as Typography6 } from "@mui/material";
281
431
  import { ButtonEx as ButtonEx2 } from "@xylabs/react-button";
282
432
  import { FlexGrowCol as FlexGrowCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
283
- import React11 from "react";
433
+ import React13 from "react";
284
434
  var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, ...props }) => {
285
- return /* @__PURE__ */ React11.createElement(FlexGrowCol3, {
435
+ return /* @__PURE__ */ React13.createElement(FlexGrowCol3, {
286
436
  alignItems: "stretch",
287
437
  paddingTop: 2,
288
438
  ...props
289
- }, /* @__PURE__ */ React11.createElement(Typography4, {
439
+ }, /* @__PURE__ */ React13.createElement(Typography6, {
290
440
  variant: "body1",
291
441
  gutterBottom: true
292
- }, /* @__PURE__ */ React11.createElement("strong", null, "Share on Social Media")), /* @__PURE__ */ React11.createElement(FlexRow2, {
442
+ }, /* @__PURE__ */ React13.createElement("strong", null, "Share on Social Media")), /* @__PURE__ */ React13.createElement(FlexRow2, {
293
443
  gap: 0.5,
294
444
  sx: {
295
445
  flexDirection: {
@@ -297,7 +447,7 @@ var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, ...props }) => {
297
447
  xs: "column"
298
448
  }
299
449
  }
300
- }, shareUrl ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(ButtonEx2, {
450
+ }, shareUrl ? /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(ButtonEx2, {
301
451
  variant: "contained",
302
452
  style: {
303
453
  backgroundColor: "#000",
@@ -306,10 +456,10 @@ var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, ...props }) => {
306
456
  onClick: /* @__PURE__ */ __name(() => {
307
457
  window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(shareUrl)}`);
308
458
  }, "onClick"),
309
- startIcon: /* @__PURE__ */ React11.createElement(XTwitterSvgIcon, {
459
+ startIcon: /* @__PURE__ */ React13.createElement(XTwitterSvgIcon, {
310
460
  width: "20px"
311
461
  })
312
- }, "Share on X (Twitter)"), /* @__PURE__ */ React11.createElement(ButtonEx2, {
462
+ }, "Share on X (Twitter)"), /* @__PURE__ */ React13.createElement(ButtonEx2, {
313
463
  variant: "contained",
314
464
  style: {
315
465
  backgroundColor: "#4267b2",
@@ -318,11 +468,12 @@ var SocialButtonsFlexbox = /* @__PURE__ */ __name(({ shareUrl, ...props }) => {
318
468
  onClick: /* @__PURE__ */ __name(() => {
319
469
  window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`);
320
470
  }, "onClick"),
321
- startIcon: /* @__PURE__ */ React11.createElement(FacebookSvgIcon, null)
471
+ startIcon: /* @__PURE__ */ React13.createElement(FacebookSvgIcon, null)
322
472
  }, "Share on Facebook")) : null));
323
473
  }, "SocialButtonsFlexbox");
324
474
  export {
325
475
  CopyLinkTextField,
476
+ CopyLinkTypography,
326
477
  DynamicShareImage,
327
478
  FacebookSvgIcon,
328
479
  GenerateShareLinkButton,
@@ -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,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,KAA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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/CopyLinkTextField.tsx","../../src/out/CopyIconButton.tsx","../../src/out/CopyLinkTypography.tsx","../../src/out/lib/AnimatedGradientTypography.tsx","../../src/out/lib/splitAroundSubstring.ts","../../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 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 { 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 { Cancel } from '@mui/icons-material'\nimport type { 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 CopyLinkTypographyProps extends ShareLinkProps, TypographyProps {}\n\nexport const CopyLinkTypography: React.FC<CopyLinkTypographyProps> = ({\n shareLinkName, shareUrl, xnsName: xnsNameProp, ...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}>\n {xnsName\n ? (\n <Stack direction=\"row\">\n <Typography sx={{ display: 'inline-flex' }} {...props}>{part1}</Typography>\n <AnimatedGradientTypography sx={{ display: 'inline-flex' }} {...props}>{xnsName}</AnimatedGradientTypography>\n <Typography sx={{ display: 'inline-flex' }} {...props}>{part3}</Typography>\n </Stack>\n )\n : <Typography sx={{ display: 'inline-flex' }} {...props}>{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 {\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' })(({ theme }) => ({\n // Set the color variables for the gradient\n '--color-one': theme.palette.secondary.dark,\n '--color-two': 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","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 { 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,S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witterIcon","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","InputAdornment","TextField","React","useCallback","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","CopyLinkTextField","shareLinkName","shareUrl","props","error","setError","useState","onCopyToClipboard","useCallback","React","TextField","disabled","helperText","message","sx","input","WebkitTextFillColor","InputProps","endAdornment","InputAdornment","position","CopyIconButton","value","Cancel","Stack","Tooltip","Typography","React","useCallback","useMemo","useState","keyframes","styled","Typography","moveBg","AnimatedGradientTypography","name","theme","palette","secondary","dark","primary","light","animationName","animationDuration","animationIterationCount","background","color","text","splitAroundSubstring","path","substring","index","indexOf","Error","part1","slice","part2","part3","length","CopyLinkTypography","shareLinkName","shareUrl","xnsName","xnsNameProp","props","error","setError","useState","onCopyToClipboard","useCallback","parsedXnsName","useMemo","parts","splitAroundSubstring","e","part1","part3","React","Stack","direction","alignItems","gap","Typography","sx","display","AnimatedGradientTypography","CopyIconButton","Tooltip","title","message","Cancel","color","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"}
@@ -1 +1 @@
1
- {"version":3,"file":"CopyLinkTextField.d.ts","sourceRoot":"","sources":["../../../src/out/CopyLinkTextField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAK3D,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,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,CAuC9D,CAAA"}
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"}
@@ -0,0 +1,7 @@
1
+ import type { TypographyProps } from '@mui/material';
2
+ import React from 'react';
3
+ import { type ShareLinkProps } from './lib/index.ts';
4
+ export interface CopyLinkTypographyProps extends ShareLinkProps, TypographyProps {
5
+ }
6
+ export declare const CopyLinkTypography: React.FC<CopyLinkTypographyProps>;
7
+ //# sourceMappingURL=CopyLinkTypography.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyLinkTypography.d.ts","sourceRoot":"","sources":["../../../src/out/CopyLinkTypography.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAMpD,OAAO,KAEN,MAAM,OAAO,CAAA;AAGd,OAAO,EACuB,KAAK,cAAc,EAChD,MAAM,gBAAgB,CAAA;AAEvB,MAAM,WAAW,uBAAwB,SAAQ,cAAc,EAAE,eAAe;CAAG;AAEnF,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAqChE,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export * from './CopyLinkTextField.tsx';
2
+ export * from './CopyLinkTypography.tsx';
2
3
  export * from './Dialog.tsx';
3
4
  export * from './Explanation.tsx';
4
5
  export * from './GenerateShareLinkButton.tsx';
@@ -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,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA"}
@@ -0,0 +1,4 @@
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
+ //# 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;;4vPA8BpC,CAAA"}
@@ -0,0 +1,6 @@
1
+ export interface ShareLinkProps {
2
+ shareLinkName?: string;
3
+ shareUrl?: string;
4
+ xnsName?: string;
5
+ }
6
+ //# sourceMappingURL=ShareLinkProps.d.ts.map
@@ -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,4 @@
1
+ export * from './AnimatedGradientTypography.tsx';
2
+ export * from './ShareLinkProps.ts';
3
+ export * from './splitAroundSubstring.ts';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -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,2 @@
1
+ export declare const splitAroundSubstring: (path: string, substring: string) => [string, string, string];
2
+ //# sourceMappingURL=splitAroundSubstring.d.ts.map
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/react-share",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "Common React library for all XYO projects that use React",
5
5
  "keywords": [
6
6
  "xyo",
@@ -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
+ }
@@ -1,10 +1,8 @@
1
- import { CopyAllRounded } from '@mui/icons-material'
2
1
  import type { StandardTextFieldProps } from '@mui/material'
3
- import {
4
- IconButton, InputAdornment, TextField,
5
- } from '@mui/material'
6
- import { forget } from '@xylabs/forget'
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 copyToClipboard = async (link?: string) => {
20
- if (link) {
21
- try {
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
- <IconButton aria-label={`copy ${shareLinkName} link`} onClick={() => forget(copyToClipboard(shareUrl))} edge="end">
44
- <CopyAllRounded />
45
- </IconButton>
31
+ <CopyIconButton shareLinkName={shareLinkName} shareUrl={shareUrl} onCopyToClipboard={onCopyToClipboard} />
46
32
  </InputAdornment>
47
33
  ),
48
34
  }}
@@ -0,0 +1,30 @@
1
+ import type { Meta, StoryFn } from '@storybook/react'
2
+ import React from 'react'
3
+
4
+ import { CopyLinkTypography } from './CopyLinkTypography.tsx'
5
+
6
+ export default { title: 'modules/ShareOut/CopyLinkTypography' } as Meta<typeof CopyLinkTypography>
7
+
8
+ const Template: StoryFn<typeof CopyLinkTypography> = (props) => {
9
+ return <CopyLinkTypography {...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 WithXnsNameInSubdomain = Template.bind({})
22
+ WithXnsNameInSubdomain.args = { shareUrl: 'https://arietrouw.xyo.network', xnsName: 'arietrouw.xyo' }
23
+
24
+ const WithError = Template.bind({})
25
+ WithError.args = { shareUrl: 'https://google.com', xnsName: 'foo.xyo' }
26
+
27
+ export {
28
+ Default, WithError,
29
+ WithShareUrl, WithXnsName, WithXnsNameInSubdomain,
30
+ }
@@ -0,0 +1,56 @@
1
+ import { Cancel } from '@mui/icons-material'
2
+ import type { 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 CopyLinkTypographyProps extends ShareLinkProps, TypographyProps {}
18
+
19
+ export const CopyLinkTypography: React.FC<CopyLinkTypographyProps> = ({
20
+ shareLinkName, shareUrl, xnsName: xnsNameProp, ...props
21
+ }) => {
22
+ const [error, setError] = useState<Error>()
23
+
24
+ const onCopyToClipboard = useCallback((error?: Error) => {
25
+ setError(error)
26
+ }, [])
27
+
28
+ const parsedXnsName = useMemo(() => {
29
+ if (shareUrl && xnsNameProp) {
30
+ try {
31
+ const parts = splitAroundSubstring(shareUrl, xnsNameProp)
32
+ return parts
33
+ } catch (e) {
34
+ setError(e as Error)
35
+ }
36
+ }
37
+ }, [])
38
+
39
+ const [part1, xnsName, part3] = parsedXnsName || []
40
+
41
+ return (
42
+ <Stack direction="row" alignItems="center" gap={0.25}>
43
+ {xnsName
44
+ ? (
45
+ <Stack direction="row">
46
+ <Typography sx={{ display: 'inline-flex' }} {...props}>{part1}</Typography>
47
+ <AnimatedGradientTypography sx={{ display: 'inline-flex' }} {...props}>{xnsName}</AnimatedGradientTypography>
48
+ <Typography sx={{ display: 'inline-flex' }} {...props}>{part3}</Typography>
49
+ </Stack>
50
+ )
51
+ : <Typography sx={{ display: 'inline-flex' }} {...props}>{shareUrl}</Typography>}
52
+ <CopyIconButton onCopyToClipboard={onCopyToClipboard} shareLinkName={shareLinkName} shareUrl={shareUrl} sx={{ display: 'inline-flex' }} />
53
+ {error ? <Tooltip title={error.message}><Cancel color="error" sx={{ display: 'inline-flex' }} /></Tooltip> : null}
54
+ </Stack>
55
+ )
56
+ }
package/src/out/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './CopyLinkTextField.tsx'
2
+ export * from './CopyLinkTypography.tsx'
2
3
  export * from './Dialog.tsx'
3
4
  export * from './Explanation.tsx'
4
5
  export * from './GenerateShareLinkButton.tsx'
@@ -0,0 +1,50 @@
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' })(({ theme }) => ({
21
+ // Set the color variables for the gradient
22
+ '--color-one': theme.palette.secondary.dark,
23
+ '--color-two': theme.palette.primary.light,
24
+ // set the gradient so it has the same start and end color for looping effect
25
+ 'background': `linear-gradient(
26
+ .25turn,
27
+ var(--color-one),
28
+ var(--color-two),
29
+ var(--color-one)
30
+ )`,
31
+ // Set the text color to transparent so the gradient shows through
32
+ 'color': 'transparent',
33
+ // Clip the background to the text shape
34
+ 'backgroundClip': 'text',
35
+ // Set the background size to 800% so we don't see the third color initially creating the looping effect
36
+ 'backgroundSize': '800%',
37
+ // Set the text to bold so the gradient is more visible
38
+ 'fontWeight': 'bold',
39
+ // Set the animation
40
+ '@media (prefers-reduced-motion: no-preference)': {
41
+ animationName: moveBg,
42
+ animationDuration: '2s',
43
+ animationIterationCount: 'infinite',
44
+ },
45
+ // reset for users that prefer reduced motion
46
+ '@media (prefers-reduced-motion)': {
47
+ background: 'none',
48
+ color: theme.palette.text.primary,
49
+ },
50
+ }))
@@ -0,0 +1,5 @@
1
+ export interface ShareLinkProps {
2
+ shareLinkName?: string
3
+ shareUrl?: string
4
+ xnsName?: string
5
+ }
@@ -0,0 +1,3 @@
1
+ export * from './AnimatedGradientTypography.tsx'
2
+ export * from './ShareLinkProps.ts'
3
+ export * from './splitAroundSubstring.ts'
@@ -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
+ }