@xyo-network/react-share 2.81.10 → 2.82.0

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.
Files changed (58) hide show
  1. package/dist/browser/ShareButton.d.cts +1 -0
  2. package/dist/browser/ShareButton.d.cts.map +1 -1
  3. package/dist/browser/ShareButton.d.mts +1 -0
  4. package/dist/browser/ShareButton.d.mts.map +1 -1
  5. package/dist/browser/ShareButton.d.ts +1 -0
  6. package/dist/browser/ShareButton.d.ts.map +1 -1
  7. package/dist/browser/index.cjs +60 -46
  8. package/dist/browser/index.cjs.map +1 -1
  9. package/dist/browser/index.d.cts +1 -1
  10. package/dist/browser/index.d.cts.map +1 -1
  11. package/dist/browser/index.d.mts +1 -1
  12. package/dist/browser/index.d.mts.map +1 -1
  13. package/dist/browser/index.d.ts +1 -1
  14. package/dist/browser/index.d.ts.map +1 -1
  15. package/dist/browser/index.mjs +65 -0
  16. package/dist/browser/index.mjs.map +1 -0
  17. package/dist/neutral/ShareButton.d.cts +1 -0
  18. package/dist/neutral/ShareButton.d.cts.map +1 -1
  19. package/dist/neutral/ShareButton.d.mts +1 -0
  20. package/dist/neutral/ShareButton.d.mts.map +1 -1
  21. package/dist/neutral/ShareButton.d.ts +1 -0
  22. package/dist/neutral/ShareButton.d.ts.map +1 -1
  23. package/dist/neutral/index.cjs +60 -46
  24. package/dist/neutral/index.cjs.map +1 -1
  25. package/dist/neutral/index.d.cts +1 -1
  26. package/dist/neutral/index.d.cts.map +1 -1
  27. package/dist/neutral/index.d.mts +1 -1
  28. package/dist/neutral/index.d.mts.map +1 -1
  29. package/dist/neutral/index.d.ts +1 -1
  30. package/dist/neutral/index.d.ts.map +1 -1
  31. package/dist/neutral/index.mjs +65 -0
  32. package/dist/neutral/index.mjs.map +1 -0
  33. package/dist/node/ShareButton.d.cts +1 -0
  34. package/dist/node/ShareButton.d.cts.map +1 -1
  35. package/dist/node/ShareButton.d.mts +1 -0
  36. package/dist/node/ShareButton.d.mts.map +1 -1
  37. package/dist/node/ShareButton.d.ts +1 -0
  38. package/dist/node/ShareButton.d.ts.map +1 -1
  39. package/dist/node/index.cjs +60 -46
  40. package/dist/node/index.cjs.map +1 -1
  41. package/dist/node/index.d.cts +1 -1
  42. package/dist/node/index.d.cts.map +1 -1
  43. package/dist/node/index.d.mts +1 -1
  44. package/dist/node/index.d.mts.map +1 -1
  45. package/dist/node/index.d.ts +1 -1
  46. package/dist/node/index.d.ts.map +1 -1
  47. package/dist/node/index.mjs +65 -0
  48. package/dist/node/index.mjs.map +1 -0
  49. package/package.json +10 -10
  50. package/src/ShareButton.stories.tsx +2 -2
  51. package/src/ShareButton.tsx +1 -1
  52. package/src/index.ts +1 -1
  53. package/dist/browser/index.js +0 -59
  54. package/dist/browser/index.js.map +0 -1
  55. package/dist/neutral/index.js +0 -59
  56. package/dist/neutral/index.js.map +0 -1
  57. package/dist/node/index.js +0 -59
  58. package/dist/node/index.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import { ButtonExProps } from '@xylabs/react-button';
2
+ import React from 'react';
2
3
  export interface ShareButtonProps extends ButtonExProps {
3
4
  prepared?: boolean;
4
5
  shareLink?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ShareButton.d.ts","sourceRoot":"","sources":["../../src/ShareButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAK9D,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA6ClD,CAAA"}
1
+ {"version":3,"file":"ShareButton.d.ts","sourceRoot":"","sources":["../../src/ShareButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAG9D,OAAO,KAA2B,MAAM,OAAO,CAAA;AAE/C,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA6ClD,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { ButtonExProps } from '@xylabs/react-button';
2
+ import React from 'react';
2
3
  export interface ShareButtonProps extends ButtonExProps {
3
4
  prepared?: boolean;
4
5
  shareLink?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ShareButton.d.ts","sourceRoot":"","sources":["../../src/ShareButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAK9D,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA6ClD,CAAA"}
1
+ {"version":3,"file":"ShareButton.d.ts","sourceRoot":"","sources":["../../src/ShareButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAG9D,OAAO,KAA2B,MAAM,OAAO,CAAA;AAE/C,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA6ClD,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { ButtonExProps } from '@xylabs/react-button';
2
+ import React from 'react';
2
3
  export interface ShareButtonProps extends ButtonExProps {
3
4
  prepared?: boolean;
4
5
  shareLink?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ShareButton.d.ts","sourceRoot":"","sources":["../../src/ShareButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAK9D,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA6ClD,CAAA"}
1
+ {"version":3,"file":"ShareButton.d.ts","sourceRoot":"","sources":["../../src/ShareButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAG9D,OAAO,KAA2B,MAAM,OAAO,CAAA;AAE/C,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA6ClD,CAAA"}
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
9
  var __export = (target, all) => {
7
10
  for (var name in all)
8
11
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -15,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
15
18
  }
16
19
  return to;
17
20
  };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
18
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
30
 
20
31
  // src/index.ts
@@ -30,55 +41,58 @@ var import_material = require("@mui/material");
30
41
  var import_react_button = require("@xylabs/react-button");
31
42
  var import_react_flexbox = require("@xylabs/react-flexbox");
32
43
  var import_react_link = require("@xylabs/react-link");
33
- var import_react = require("react");
34
- var import_jsx_runtime = require("react/jsx-runtime");
35
- var ShareButton = ({ prepared = true, shareLink, ...props }) => {
44
+ var import_react = __toESM(require("react"), 1);
45
+ var ShareButton = /* @__PURE__ */ __name(({ prepared = true, shareLink, ...props }) => {
36
46
  const [expanded, setExpanded] = (0, import_react.useState)(false);
37
47
  const anchorRef = (0, import_react.useRef)(null);
38
48
  const link = shareLink ?? window.location.href;
39
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_flexbox.FlexRow, { gap: 1, ref: anchorRef, children: [
40
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
41
- import_react_button.ButtonEx,
42
- {
43
- variant: "text",
44
- minWidth: 32,
45
- size: "small",
46
- disabled: !prepared,
47
- onClick: () => {
48
- setExpanded(true);
49
- },
50
- ...props,
51
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Share, { htmlColor: "gray", fontSize: "small" })
52
- }
53
- ),
54
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Popover, { open: prepared ? expanded : false, anchorEl: anchorRef.current, onClose: () => setExpanded(false), transitionDuration: 500, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_flexbox.FlexRow, { gap: 0.5, padding: 0.5, children: [
55
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
56
- import_react_link.LinkEx,
57
- {
58
- lineHeight: 0,
59
- style: { color: "#1da1f2" },
60
- onClick: () => {
61
- window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`);
62
- setExpanded(false);
63
- },
64
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Twitter, { fontSize: "small" })
65
- }
66
- ),
67
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
68
- import_react_link.LinkEx,
69
- {
70
- lineHeight: 0,
71
- style: { color: "#4267b2" },
72
- onClick: () => {
73
- window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`);
74
- setExpanded(false);
75
- },
76
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Facebook, { fontSize: "small" })
77
- }
78
- )
79
- ] }) })
80
- ] });
81
- };
49
+ return /* @__PURE__ */ import_react.default.createElement(import_react_flexbox.FlexRow, {
50
+ gap: 1,
51
+ ref: anchorRef
52
+ }, /* @__PURE__ */ import_react.default.createElement(import_react_button.ButtonEx, {
53
+ variant: "text",
54
+ minWidth: 32,
55
+ size: "small",
56
+ disabled: !prepared,
57
+ onClick: /* @__PURE__ */ __name(() => {
58
+ setExpanded(true);
59
+ }, "onClick"),
60
+ ...props
61
+ }, /* @__PURE__ */ import_react.default.createElement(import_icons_material.Share, {
62
+ htmlColor: "gray",
63
+ fontSize: "small"
64
+ })), /* @__PURE__ */ import_react.default.createElement(import_material.Popover, {
65
+ open: prepared ? expanded : false,
66
+ anchorEl: anchorRef.current,
67
+ onClose: /* @__PURE__ */ __name(() => setExpanded(false), "onClose"),
68
+ transitionDuration: 500
69
+ }, /* @__PURE__ */ import_react.default.createElement(import_react_flexbox.FlexRow, {
70
+ gap: 0.5,
71
+ padding: 0.5
72
+ }, /* @__PURE__ */ import_react.default.createElement(import_react_link.LinkEx, {
73
+ lineHeight: 0,
74
+ style: {
75
+ color: "#1da1f2"
76
+ },
77
+ onClick: /* @__PURE__ */ __name(() => {
78
+ window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`);
79
+ setExpanded(false);
80
+ }, "onClick")
81
+ }, /* @__PURE__ */ import_react.default.createElement(import_icons_material.Twitter, {
82
+ fontSize: "small"
83
+ })), /* @__PURE__ */ import_react.default.createElement(import_react_link.LinkEx, {
84
+ lineHeight: 0,
85
+ style: {
86
+ color: "#4267b2"
87
+ },
88
+ onClick: /* @__PURE__ */ __name(() => {
89
+ window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`);
90
+ setExpanded(false);
91
+ }, "onClick")
92
+ }, /* @__PURE__ */ import_react.default.createElement(import_icons_material.Facebook, {
93
+ fontSize: "small"
94
+ })))));
95
+ }, "ShareButton");
82
96
  // Annotate the CommonJS export names for ESM import in node:
83
97
  0 && (module.exports = {
84
98
  ShareButton
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/ShareButton.tsx"],"sourcesContent":["export * from './ShareButton.js'\n","import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from '@mui/icons-material'\nimport { Popover } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport { useRef, useState } from 'react'\n\nexport interface ShareButtonProps extends ButtonExProps {\n prepared?: boolean\n shareLink?: string\n}\n\nexport const ShareButton: React.FC<ShareButtonProps> = ({ prepared = true, shareLink, ...props }) => {\n const [expanded, setExpanded] = useState(false)\n const anchorRef = useRef(null)\n const link = shareLink ?? window.location.href\n\n return (\n <FlexRow gap={1} ref={anchorRef}>\n <ButtonEx\n variant=\"text\"\n minWidth={32}\n size=\"small\"\n disabled={!prepared}\n onClick={() => {\n setExpanded(true)\n }}\n {...props}\n >\n <ShareIcon htmlColor=\"gray\" fontSize=\"small\" />\n </ButtonEx>\n <Popover open={prepared ? expanded : false} anchorEl={anchorRef.current} onClose={() => setExpanded(false)} transitionDuration={500}>\n <FlexRow gap={0.5} padding={0.5}>\n <LinkEx\n lineHeight={0}\n style={{ color: '#1da1f2' }}\n onClick={() => {\n window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <TwitterIcon fontSize=\"small\" />\n </LinkEx>\n <LinkEx\n lineHeight={0}\n style={{ color: '#4267b2' }}\n onClick={() => {\n window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <FacebookIcon fontSize=\"small\" />\n </LinkEx>\n </FlexRow>\n </Popover>\n </FlexRow>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,4BAAqF;AACrF,sBAAwB;AACxB,0BAAwC;AACxC,2BAAwB;AACxB,wBAAuB;AACvB,mBAAiC;AAwBzB;AAjBD,IAAM,cAA0C,CAAC,EAAE,WAAW,MAAM,WAAW,GAAG,MAAM,MAAM;AACnG,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAS,KAAK;AAC9C,QAAM,gBAAY,qBAAO,IAAI;AAC7B,QAAM,OAAO,aAAa,OAAO,SAAS;AAE1C,SACE,6CAAC,gCAAQ,KAAK,GAAG,KAAK,WACpB;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR,UAAU;AAAA,QACV,MAAK;AAAA,QACL,UAAU,CAAC;AAAA,QACX,SAAS,MAAM;AACb,sBAAY,IAAI;AAAA,QAClB;AAAA,QACC,GAAG;AAAA,QAEJ,sDAAC,sBAAAA,OAAA,EAAU,WAAU,QAAO,UAAS,SAAQ;AAAA;AAAA,IAC/C;AAAA,IACA,4CAAC,2BAAQ,MAAM,WAAW,WAAW,OAAO,UAAU,UAAU,SAAS,SAAS,MAAM,YAAY,KAAK,GAAG,oBAAoB,KAC9H,uDAAC,gCAAQ,KAAK,KAAK,SAAS,KAC1B;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,UACZ,OAAO,EAAE,OAAO,UAAU;AAAA,UAC1B,SAAS,MAAM;AACb,mBAAO,KAAK,wCAAwC,mBAAmB,IAAI,CAAC,EAAE;AAC9E,wBAAY,KAAK;AAAA,UACnB;AAAA,UAEA,sDAAC,sBAAAC,SAAA,EAAY,UAAS,SAAQ;AAAA;AAAA,MAChC;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,UACZ,OAAO,EAAE,OAAO,UAAU;AAAA,UAC1B,SAAS,MAAM;AACb,mBAAO,KAAK,gDAAgD,mBAAmB,IAAI,CAAC,EAAE;AACtF,wBAAY,KAAK;AAAA,UACnB;AAAA,UAEA,sDAAC,sBAAAC,UAAA,EAAa,UAAS,SAAQ;AAAA;AAAA,MACjC;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":["ShareIcon","TwitterIcon","FacebookIcon"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/ShareButton.tsx"],"sourcesContent":["export * from './ShareButton.tsx'\n","import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from '@mui/icons-material'\nimport { Popover } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport React, { useRef, useState } from 'react'\n\nexport interface ShareButtonProps extends ButtonExProps {\n prepared?: boolean\n shareLink?: string\n}\n\nexport const ShareButton: React.FC<ShareButtonProps> = ({ prepared = true, shareLink, ...props }) => {\n const [expanded, setExpanded] = useState(false)\n const anchorRef = useRef(null)\n const link = shareLink ?? window.location.href\n\n return (\n <FlexRow gap={1} ref={anchorRef}>\n <ButtonEx\n variant=\"text\"\n minWidth={32}\n size=\"small\"\n disabled={!prepared}\n onClick={() => {\n setExpanded(true)\n }}\n {...props}\n >\n <ShareIcon htmlColor=\"gray\" fontSize=\"small\" />\n </ButtonEx>\n <Popover open={prepared ? expanded : false} anchorEl={anchorRef.current} onClose={() => setExpanded(false)} transitionDuration={500}>\n <FlexRow gap={0.5} padding={0.5}>\n <LinkEx\n lineHeight={0}\n style={{ color: '#1da1f2' }}\n onClick={() => {\n window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <TwitterIcon fontSize=\"small\" />\n </LinkEx>\n <LinkEx\n lineHeight={0}\n style={{ color: '#4267b2' }}\n onClick={() => {\n window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <FacebookIcon fontSize=\"small\" />\n </LinkEx>\n </FlexRow>\n </Popover>\n </FlexRow>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,4BAAqF;AACrF,sBAAwB;AACxB,0BAAwC;AACxC,2BAAwB;AACxB,wBAAuB;AACvB,mBAAwC;AAOjC,IAAMA,cAA0C,wBAAC,EAAEC,WAAW,MAAMC,WAAW,GAAGC,MAAAA,MAAO;AAC9F,QAAM,CAACC,UAAUC,WAAAA,QAAeC,uBAAS,KAAA;AACzC,QAAMC,gBAAYC,qBAAO,IAAA;AACzB,QAAMC,OAAOP,aAAaQ,OAAOC,SAASC;AAE1C,SACE,6BAAAC,QAAA,cAACC,8BAAAA;IAAQC,KAAK;IAAGC,KAAKT;KACpB,6BAAAM,QAAA,cAACI,8BAAAA;IACCC,SAAQ;IACRC,UAAU;IACVC,MAAK;IACLC,UAAU,CAACpB;IACXqB,SAAS,6BAAA;AACPjB,kBAAY,IAAA;IACd,GAFS;IAGR,GAAGF;KAEJ,6BAAAU,QAAA,cAACU,sBAAAA,OAAAA;IAAUC,WAAU;IAAOC,UAAS;OAEvC,6BAAAZ,QAAA,cAACa,yBAAAA;IAAQC,MAAM1B,WAAWG,WAAW;IAAOwB,UAAUrB,UAAUsB;IAASC,SAAS,6BAAMzB,YAAY,KAAA,GAAlB;IAA0B0B,oBAAoB;KAC9H,6BAAAlB,QAAA,cAACC,8BAAAA;IAAQC,KAAK;IAAKiB,SAAS;KAC1B,6BAAAnB,QAAA,cAACoB,0BAAAA;IACCC,YAAY;IACZC,OAAO;MAAEC,OAAO;IAAU;IAC1Bd,SAAS,6BAAA;AACPZ,aAAOiB,KAAK,wCAAwCU,mBAAmB5B,IAAAA,CAAAA,EAAO;AAC9EJ,kBAAY,KAAA;IACd,GAHS;KAKT,6BAAAQ,QAAA,cAACyB,sBAAAA,SAAAA;IAAYb,UAAS;OAExB,6BAAAZ,QAAA,cAACoB,0BAAAA;IACCC,YAAY;IACZC,OAAO;MAAEC,OAAO;IAAU;IAC1Bd,SAAS,6BAAA;AACPZ,aAAOiB,KAAK,gDAAgDU,mBAAmB5B,IAAAA,CAAAA,EAAO;AACtFJ,kBAAY,KAAA;IACd,GAHS;KAKT,6BAAAQ,QAAA,cAAC0B,sBAAAA,UAAAA;IAAad,UAAS;;AAMnC,GA7CuD;","names":["ShareButton","prepared","shareLink","props","expanded","setExpanded","useState","anchorRef","useRef","link","window","location","href","React","FlexRow","gap","ref","ButtonEx","variant","minWidth","size","disabled","onClick","ShareIcon","htmlColor","fontSize","Popover","open","anchorEl","current","onClose","transitionDuration","padding","LinkEx","lineHeight","style","color","encodeURIComponent","TwitterIcon","FacebookIcon"]}
@@ -1,2 +1,2 @@
1
- export * from './ShareButton.js';
1
+ export * from './ShareButton.tsx';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './ShareButton.js';
1
+ export * from './ShareButton.tsx';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -1,2 +1,2 @@
1
- export * from './ShareButton.js';
1
+ export * from './ShareButton.tsx';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -0,0 +1,65 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/ShareButton.tsx
5
+ import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from "@mui/icons-material";
6
+ import { Popover } from "@mui/material";
7
+ import { ButtonEx } from "@xylabs/react-button";
8
+ import { FlexRow } from "@xylabs/react-flexbox";
9
+ import { LinkEx } from "@xylabs/react-link";
10
+ import React, { useRef, useState } from "react";
11
+ var ShareButton = /* @__PURE__ */ __name(({ prepared = true, shareLink, ...props }) => {
12
+ const [expanded, setExpanded] = useState(false);
13
+ const anchorRef = useRef(null);
14
+ const link = shareLink ?? window.location.href;
15
+ return /* @__PURE__ */ React.createElement(FlexRow, {
16
+ gap: 1,
17
+ ref: anchorRef
18
+ }, /* @__PURE__ */ React.createElement(ButtonEx, {
19
+ variant: "text",
20
+ minWidth: 32,
21
+ size: "small",
22
+ disabled: !prepared,
23
+ onClick: /* @__PURE__ */ __name(() => {
24
+ setExpanded(true);
25
+ }, "onClick"),
26
+ ...props
27
+ }, /* @__PURE__ */ React.createElement(ShareIcon, {
28
+ htmlColor: "gray",
29
+ fontSize: "small"
30
+ })), /* @__PURE__ */ React.createElement(Popover, {
31
+ open: prepared ? expanded : false,
32
+ anchorEl: anchorRef.current,
33
+ onClose: /* @__PURE__ */ __name(() => setExpanded(false), "onClose"),
34
+ transitionDuration: 500
35
+ }, /* @__PURE__ */ React.createElement(FlexRow, {
36
+ gap: 0.5,
37
+ padding: 0.5
38
+ }, /* @__PURE__ */ React.createElement(LinkEx, {
39
+ lineHeight: 0,
40
+ style: {
41
+ color: "#1da1f2"
42
+ },
43
+ onClick: /* @__PURE__ */ __name(() => {
44
+ window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`);
45
+ setExpanded(false);
46
+ }, "onClick")
47
+ }, /* @__PURE__ */ React.createElement(TwitterIcon, {
48
+ fontSize: "small"
49
+ })), /* @__PURE__ */ React.createElement(LinkEx, {
50
+ lineHeight: 0,
51
+ style: {
52
+ color: "#4267b2"
53
+ },
54
+ onClick: /* @__PURE__ */ __name(() => {
55
+ window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`);
56
+ setExpanded(false);
57
+ }, "onClick")
58
+ }, /* @__PURE__ */ React.createElement(FacebookIcon, {
59
+ fontSize: "small"
60
+ })))));
61
+ }, "ShareButton");
62
+ export {
63
+ ShareButton
64
+ };
65
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ShareButton.tsx"],"sourcesContent":["import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from '@mui/icons-material'\nimport { Popover } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport React, { useRef, useState } from 'react'\n\nexport interface ShareButtonProps extends ButtonExProps {\n prepared?: boolean\n shareLink?: string\n}\n\nexport const ShareButton: React.FC<ShareButtonProps> = ({ prepared = true, shareLink, ...props }) => {\n const [expanded, setExpanded] = useState(false)\n const anchorRef = useRef(null)\n const link = shareLink ?? window.location.href\n\n return (\n <FlexRow gap={1} ref={anchorRef}>\n <ButtonEx\n variant=\"text\"\n minWidth={32}\n size=\"small\"\n disabled={!prepared}\n onClick={() => {\n setExpanded(true)\n }}\n {...props}\n >\n <ShareIcon htmlColor=\"gray\" fontSize=\"small\" />\n </ButtonEx>\n <Popover open={prepared ? expanded : false} anchorEl={anchorRef.current} onClose={() => setExpanded(false)} transitionDuration={500}>\n <FlexRow gap={0.5} padding={0.5}>\n <LinkEx\n lineHeight={0}\n style={{ color: '#1da1f2' }}\n onClick={() => {\n window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <TwitterIcon fontSize=\"small\" />\n </LinkEx>\n <LinkEx\n lineHeight={0}\n style={{ color: '#4267b2' }}\n onClick={() => {\n window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <FacebookIcon fontSize=\"small\" />\n </LinkEx>\n </FlexRow>\n </Popover>\n </FlexRow>\n )\n}\n"],"mappings":";;;;AAAA,SAASA,YAAYC,cAAcC,SAASC,WAAWC,WAAWC,mBAAmB;AACrF,SAASC,eAAe;AACxB,SAASC,gBAA+B;AACxC,SAASC,eAAe;AACxB,SAASC,cAAc;AACvB,OAAOC,SAASC,QAAQC,gBAAgB;AAOjC,IAAMC,cAA0C,wBAAC,EAAEC,WAAW,MAAMC,WAAW,GAAGC,MAAAA,MAAO;AAC9F,QAAM,CAACC,UAAUC,WAAAA,IAAeC,SAAS,KAAA;AACzC,QAAMC,YAAYC,OAAO,IAAA;AACzB,QAAMC,OAAOP,aAAaQ,OAAOC,SAASC;AAE1C,SACE,sBAAA,cAACC,SAAAA;IAAQC,KAAK;IAAGC,KAAKR;KACpB,sBAAA,cAACS,UAAAA;IACCC,SAAQ;IACRC,UAAU;IACVC,MAAK;IACLC,UAAU,CAACnB;IACXoB,SAAS,6BAAA;AACPhB,kBAAY,IAAA;IACd,GAFS;IAGR,GAAGF;KAEJ,sBAAA,cAACmB,WAAAA;IAAUC,WAAU;IAAOC,UAAS;OAEvC,sBAAA,cAACC,SAAAA;IAAQC,MAAMzB,WAAWG,WAAW;IAAOuB,UAAUpB,UAAUqB;IAASC,SAAS,6BAAMxB,YAAY,KAAA,GAAlB;IAA0ByB,oBAAoB;KAC9H,sBAAA,cAACjB,SAAAA;IAAQC,KAAK;IAAKiB,SAAS;KAC1B,sBAAA,cAACC,QAAAA;IACCC,YAAY;IACZC,OAAO;MAAEC,OAAO;IAAU;IAC1Bd,SAAS,6BAAA;AACPX,aAAOgB,KAAK,wCAAwCU,mBAAmB3B,IAAAA,CAAAA,EAAO;AAC9EJ,kBAAY,KAAA;IACd,GAHS;KAKT,sBAAA,cAACgC,aAAAA;IAAYb,UAAS;OAExB,sBAAA,cAACQ,QAAAA;IACCC,YAAY;IACZC,OAAO;MAAEC,OAAO;IAAU;IAC1Bd,SAAS,6BAAA;AACPX,aAAOgB,KAAK,gDAAgDU,mBAAmB3B,IAAAA,CAAAA,EAAO;AACtFJ,kBAAY,KAAA;IACd,GAHS;KAKT,sBAAA,cAACiC,cAAAA;IAAad,UAAS;;AAMnC,GA7CuD;","names":["Facebook","FacebookIcon","Share","ShareIcon","Twitter","TwitterIcon","Popover","ButtonEx","FlexRow","LinkEx","React","useRef","useState","ShareButton","prepared","shareLink","props","expanded","setExpanded","useState","anchorRef","useRef","link","window","location","href","FlexRow","gap","ref","ButtonEx","variant","minWidth","size","disabled","onClick","ShareIcon","htmlColor","fontSize","Popover","open","anchorEl","current","onClose","transitionDuration","padding","LinkEx","lineHeight","style","color","encodeURIComponent","TwitterIcon","FacebookIcon"]}
package/package.json CHANGED
@@ -10,9 +10,9 @@
10
10
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/react-button": "^3.4.1",
14
- "@xylabs/react-flexbox": "^3.4.1",
15
- "@xylabs/react-link": "^3.4.1"
13
+ "@xylabs/react-button": "^3.4.2",
14
+ "@xylabs/react-flexbox": "^3.4.2",
15
+ "@xylabs/react-link": "^3.4.2"
16
16
  },
17
17
  "peerDependencies": {
18
18
  "@mui/icons-material": "^5",
@@ -23,8 +23,8 @@
23
23
  "react-icons": "^4"
24
24
  },
25
25
  "devDependencies": {
26
- "@storybook/react": "^7.6.20",
27
- "@xylabs/ts-scripts-yarn3": "^3.12.4",
26
+ "@storybook/react": "^8.2.7",
27
+ "@xylabs/ts-scripts-yarn3": "^3.15.16",
28
28
  "typescript": "^5.5.4"
29
29
  },
30
30
  "description": "Common React library for all XYO projects that use React",
@@ -34,7 +34,7 @@
34
34
  "node": {
35
35
  "import": {
36
36
  "types": "./dist/node/index.d.mts",
37
- "default": "./dist/node/index.js"
37
+ "default": "./dist/node/index.mjs"
38
38
  },
39
39
  "require": {
40
40
  "types": "./dist/node/index.d.cts",
@@ -44,19 +44,19 @@
44
44
  "browser": {
45
45
  "import": {
46
46
  "types": "./dist/browser/index.d.mts",
47
- "default": "./dist/browser/index.js"
47
+ "default": "./dist/browser/index.mjs"
48
48
  },
49
49
  "require": {
50
50
  "types": "./dist/browser/index.d.cts",
51
51
  "default": "./dist/browser/index.cjs"
52
52
  }
53
53
  },
54
- "default": "./dist/browser/index.js"
54
+ "default": "./dist/browser/index.mjs"
55
55
  },
56
56
  "./package.json": "./package.json"
57
57
  },
58
58
  "main": "dist/browser/index.cjs",
59
- "module": "dist/browser/index.js",
59
+ "module": "dist/browser/index.mjs",
60
60
  "homepage": "https://xyo.network",
61
61
  "keywords": [
62
62
  "xyo",
@@ -78,6 +78,6 @@
78
78
  },
79
79
  "sideEffects": false,
80
80
  "types": "dist/browser/index.d.ts",
81
- "version": "2.81.10",
81
+ "version": "2.82.0",
82
82
  "type": "module"
83
83
  }
@@ -1,8 +1,8 @@
1
1
  import { Meta, StoryFn } from '@storybook/react'
2
+ import React from 'react'
2
3
 
3
- import { ShareButton } from './ShareButton.js'
4
+ import { ShareButton } from './ShareButton.tsx'
4
5
 
5
- // eslint-disable-next-line import/no-default-export
6
6
  export default {
7
7
  title: 'modules/ShareButton',
8
8
  } as Meta<typeof ShareButton>
@@ -3,7 +3,7 @@ import { Popover } from '@mui/material'
3
3
  import { ButtonEx, ButtonExProps } from '@xylabs/react-button'
4
4
  import { FlexRow } from '@xylabs/react-flexbox'
5
5
  import { LinkEx } from '@xylabs/react-link'
6
- import { useRef, useState } from 'react'
6
+ import React, { useRef, useState } from 'react'
7
7
 
8
8
  export interface ShareButtonProps extends ButtonExProps {
9
9
  prepared?: boolean
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export * from './ShareButton.js'
1
+ export * from './ShareButton.tsx'
@@ -1,59 +0,0 @@
1
- // src/ShareButton.tsx
2
- import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from "@mui/icons-material";
3
- import { Popover } from "@mui/material";
4
- import { ButtonEx } from "@xylabs/react-button";
5
- import { FlexRow } from "@xylabs/react-flexbox";
6
- import { LinkEx } from "@xylabs/react-link";
7
- import { useRef, useState } from "react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
9
- var ShareButton = ({ prepared = true, shareLink, ...props }) => {
10
- const [expanded, setExpanded] = useState(false);
11
- const anchorRef = useRef(null);
12
- const link = shareLink ?? window.location.href;
13
- return /* @__PURE__ */ jsxs(FlexRow, { gap: 1, ref: anchorRef, children: [
14
- /* @__PURE__ */ jsx(
15
- ButtonEx,
16
- {
17
- variant: "text",
18
- minWidth: 32,
19
- size: "small",
20
- disabled: !prepared,
21
- onClick: () => {
22
- setExpanded(true);
23
- },
24
- ...props,
25
- children: /* @__PURE__ */ jsx(ShareIcon, { htmlColor: "gray", fontSize: "small" })
26
- }
27
- ),
28
- /* @__PURE__ */ jsx(Popover, { open: prepared ? expanded : false, anchorEl: anchorRef.current, onClose: () => setExpanded(false), transitionDuration: 500, children: /* @__PURE__ */ jsxs(FlexRow, { gap: 0.5, padding: 0.5, children: [
29
- /* @__PURE__ */ jsx(
30
- LinkEx,
31
- {
32
- lineHeight: 0,
33
- style: { color: "#1da1f2" },
34
- onClick: () => {
35
- window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`);
36
- setExpanded(false);
37
- },
38
- children: /* @__PURE__ */ jsx(TwitterIcon, { fontSize: "small" })
39
- }
40
- ),
41
- /* @__PURE__ */ jsx(
42
- LinkEx,
43
- {
44
- lineHeight: 0,
45
- style: { color: "#4267b2" },
46
- onClick: () => {
47
- window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`);
48
- setExpanded(false);
49
- },
50
- children: /* @__PURE__ */ jsx(FacebookIcon, { fontSize: "small" })
51
- }
52
- )
53
- ] }) })
54
- ] });
55
- };
56
- export {
57
- ShareButton
58
- };
59
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ShareButton.tsx"],"sourcesContent":["import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from '@mui/icons-material'\nimport { Popover } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport { useRef, useState } from 'react'\n\nexport interface ShareButtonProps extends ButtonExProps {\n prepared?: boolean\n shareLink?: string\n}\n\nexport const ShareButton: React.FC<ShareButtonProps> = ({ prepared = true, shareLink, ...props }) => {\n const [expanded, setExpanded] = useState(false)\n const anchorRef = useRef(null)\n const link = shareLink ?? window.location.href\n\n return (\n <FlexRow gap={1} ref={anchorRef}>\n <ButtonEx\n variant=\"text\"\n minWidth={32}\n size=\"small\"\n disabled={!prepared}\n onClick={() => {\n setExpanded(true)\n }}\n {...props}\n >\n <ShareIcon htmlColor=\"gray\" fontSize=\"small\" />\n </ButtonEx>\n <Popover open={prepared ? expanded : false} anchorEl={anchorRef.current} onClose={() => setExpanded(false)} transitionDuration={500}>\n <FlexRow gap={0.5} padding={0.5}>\n <LinkEx\n lineHeight={0}\n style={{ color: '#1da1f2' }}\n onClick={() => {\n window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <TwitterIcon fontSize=\"small\" />\n </LinkEx>\n <LinkEx\n lineHeight={0}\n style={{ color: '#4267b2' }}\n onClick={() => {\n window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <FacebookIcon fontSize=\"small\" />\n </LinkEx>\n </FlexRow>\n </Popover>\n </FlexRow>\n )\n}\n"],"mappings":";AAAA,SAAS,YAAY,cAAc,SAAS,WAAW,WAAW,mBAAmB;AACrF,SAAS,eAAe;AACxB,SAAS,gBAA+B;AACxC,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,QAAQ,gBAAgB;AAwBzB,cAGA,YAHA;AAjBD,IAAM,cAA0C,CAAC,EAAE,WAAW,MAAM,WAAW,GAAG,MAAM,MAAM;AACnG,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,YAAY,OAAO,IAAI;AAC7B,QAAM,OAAO,aAAa,OAAO,SAAS;AAE1C,SACE,qBAAC,WAAQ,KAAK,GAAG,KAAK,WACpB;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR,UAAU;AAAA,QACV,MAAK;AAAA,QACL,UAAU,CAAC;AAAA,QACX,SAAS,MAAM;AACb,sBAAY,IAAI;AAAA,QAClB;AAAA,QACC,GAAG;AAAA,QAEJ,8BAAC,aAAU,WAAU,QAAO,UAAS,SAAQ;AAAA;AAAA,IAC/C;AAAA,IACA,oBAAC,WAAQ,MAAM,WAAW,WAAW,OAAO,UAAU,UAAU,SAAS,SAAS,MAAM,YAAY,KAAK,GAAG,oBAAoB,KAC9H,+BAAC,WAAQ,KAAK,KAAK,SAAS,KAC1B;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,UACZ,OAAO,EAAE,OAAO,UAAU;AAAA,UAC1B,SAAS,MAAM;AACb,mBAAO,KAAK,wCAAwC,mBAAmB,IAAI,CAAC,EAAE;AAC9E,wBAAY,KAAK;AAAA,UACnB;AAAA,UAEA,8BAAC,eAAY,UAAS,SAAQ;AAAA;AAAA,MAChC;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,UACZ,OAAO,EAAE,OAAO,UAAU;AAAA,UAC1B,SAAS,MAAM;AACb,mBAAO,KAAK,gDAAgD,mBAAmB,IAAI,CAAC,EAAE;AACtF,wBAAY,KAAK;AAAA,UACnB;AAAA,UAEA,8BAAC,gBAAa,UAAS,SAAQ;AAAA;AAAA,MACjC;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1,59 +0,0 @@
1
- // src/ShareButton.tsx
2
- import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from "@mui/icons-material";
3
- import { Popover } from "@mui/material";
4
- import { ButtonEx } from "@xylabs/react-button";
5
- import { FlexRow } from "@xylabs/react-flexbox";
6
- import { LinkEx } from "@xylabs/react-link";
7
- import { useRef, useState } from "react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
9
- var ShareButton = ({ prepared = true, shareLink, ...props }) => {
10
- const [expanded, setExpanded] = useState(false);
11
- const anchorRef = useRef(null);
12
- const link = shareLink ?? window.location.href;
13
- return /* @__PURE__ */ jsxs(FlexRow, { gap: 1, ref: anchorRef, children: [
14
- /* @__PURE__ */ jsx(
15
- ButtonEx,
16
- {
17
- variant: "text",
18
- minWidth: 32,
19
- size: "small",
20
- disabled: !prepared,
21
- onClick: () => {
22
- setExpanded(true);
23
- },
24
- ...props,
25
- children: /* @__PURE__ */ jsx(ShareIcon, { htmlColor: "gray", fontSize: "small" })
26
- }
27
- ),
28
- /* @__PURE__ */ jsx(Popover, { open: prepared ? expanded : false, anchorEl: anchorRef.current, onClose: () => setExpanded(false), transitionDuration: 500, children: /* @__PURE__ */ jsxs(FlexRow, { gap: 0.5, padding: 0.5, children: [
29
- /* @__PURE__ */ jsx(
30
- LinkEx,
31
- {
32
- lineHeight: 0,
33
- style: { color: "#1da1f2" },
34
- onClick: () => {
35
- window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`);
36
- setExpanded(false);
37
- },
38
- children: /* @__PURE__ */ jsx(TwitterIcon, { fontSize: "small" })
39
- }
40
- ),
41
- /* @__PURE__ */ jsx(
42
- LinkEx,
43
- {
44
- lineHeight: 0,
45
- style: { color: "#4267b2" },
46
- onClick: () => {
47
- window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`);
48
- setExpanded(false);
49
- },
50
- children: /* @__PURE__ */ jsx(FacebookIcon, { fontSize: "small" })
51
- }
52
- )
53
- ] }) })
54
- ] });
55
- };
56
- export {
57
- ShareButton
58
- };
59
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ShareButton.tsx"],"sourcesContent":["import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from '@mui/icons-material'\nimport { Popover } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport { useRef, useState } from 'react'\n\nexport interface ShareButtonProps extends ButtonExProps {\n prepared?: boolean\n shareLink?: string\n}\n\nexport const ShareButton: React.FC<ShareButtonProps> = ({ prepared = true, shareLink, ...props }) => {\n const [expanded, setExpanded] = useState(false)\n const anchorRef = useRef(null)\n const link = shareLink ?? window.location.href\n\n return (\n <FlexRow gap={1} ref={anchorRef}>\n <ButtonEx\n variant=\"text\"\n minWidth={32}\n size=\"small\"\n disabled={!prepared}\n onClick={() => {\n setExpanded(true)\n }}\n {...props}\n >\n <ShareIcon htmlColor=\"gray\" fontSize=\"small\" />\n </ButtonEx>\n <Popover open={prepared ? expanded : false} anchorEl={anchorRef.current} onClose={() => setExpanded(false)} transitionDuration={500}>\n <FlexRow gap={0.5} padding={0.5}>\n <LinkEx\n lineHeight={0}\n style={{ color: '#1da1f2' }}\n onClick={() => {\n window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <TwitterIcon fontSize=\"small\" />\n </LinkEx>\n <LinkEx\n lineHeight={0}\n style={{ color: '#4267b2' }}\n onClick={() => {\n window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <FacebookIcon fontSize=\"small\" />\n </LinkEx>\n </FlexRow>\n </Popover>\n </FlexRow>\n )\n}\n"],"mappings":";AAAA,SAAS,YAAY,cAAc,SAAS,WAAW,WAAW,mBAAmB;AACrF,SAAS,eAAe;AACxB,SAAS,gBAA+B;AACxC,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,QAAQ,gBAAgB;AAwBzB,cAGA,YAHA;AAjBD,IAAM,cAA0C,CAAC,EAAE,WAAW,MAAM,WAAW,GAAG,MAAM,MAAM;AACnG,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,YAAY,OAAO,IAAI;AAC7B,QAAM,OAAO,aAAa,OAAO,SAAS;AAE1C,SACE,qBAAC,WAAQ,KAAK,GAAG,KAAK,WACpB;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR,UAAU;AAAA,QACV,MAAK;AAAA,QACL,UAAU,CAAC;AAAA,QACX,SAAS,MAAM;AACb,sBAAY,IAAI;AAAA,QAClB;AAAA,QACC,GAAG;AAAA,QAEJ,8BAAC,aAAU,WAAU,QAAO,UAAS,SAAQ;AAAA;AAAA,IAC/C;AAAA,IACA,oBAAC,WAAQ,MAAM,WAAW,WAAW,OAAO,UAAU,UAAU,SAAS,SAAS,MAAM,YAAY,KAAK,GAAG,oBAAoB,KAC9H,+BAAC,WAAQ,KAAK,KAAK,SAAS,KAC1B;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,UACZ,OAAO,EAAE,OAAO,UAAU;AAAA,UAC1B,SAAS,MAAM;AACb,mBAAO,KAAK,wCAAwC,mBAAmB,IAAI,CAAC,EAAE;AAC9E,wBAAY,KAAK;AAAA,UACnB;AAAA,UAEA,8BAAC,eAAY,UAAS,SAAQ;AAAA;AAAA,MAChC;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,UACZ,OAAO,EAAE,OAAO,UAAU;AAAA,UAC1B,SAAS,MAAM;AACb,mBAAO,KAAK,gDAAgD,mBAAmB,IAAI,CAAC,EAAE;AACtF,wBAAY,KAAK;AAAA,UACnB;AAAA,UAEA,8BAAC,gBAAa,UAAS,SAAQ;AAAA;AAAA,MACjC;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1,59 +0,0 @@
1
- // src/ShareButton.tsx
2
- import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from "@mui/icons-material";
3
- import { Popover } from "@mui/material";
4
- import { ButtonEx } from "@xylabs/react-button";
5
- import { FlexRow } from "@xylabs/react-flexbox";
6
- import { LinkEx } from "@xylabs/react-link";
7
- import { useRef, useState } from "react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
9
- var ShareButton = ({ prepared = true, shareLink, ...props }) => {
10
- const [expanded, setExpanded] = useState(false);
11
- const anchorRef = useRef(null);
12
- const link = shareLink ?? window.location.href;
13
- return /* @__PURE__ */ jsxs(FlexRow, { gap: 1, ref: anchorRef, children: [
14
- /* @__PURE__ */ jsx(
15
- ButtonEx,
16
- {
17
- variant: "text",
18
- minWidth: 32,
19
- size: "small",
20
- disabled: !prepared,
21
- onClick: () => {
22
- setExpanded(true);
23
- },
24
- ...props,
25
- children: /* @__PURE__ */ jsx(ShareIcon, { htmlColor: "gray", fontSize: "small" })
26
- }
27
- ),
28
- /* @__PURE__ */ jsx(Popover, { open: prepared ? expanded : false, anchorEl: anchorRef.current, onClose: () => setExpanded(false), transitionDuration: 500, children: /* @__PURE__ */ jsxs(FlexRow, { gap: 0.5, padding: 0.5, children: [
29
- /* @__PURE__ */ jsx(
30
- LinkEx,
31
- {
32
- lineHeight: 0,
33
- style: { color: "#1da1f2" },
34
- onClick: () => {
35
- window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`);
36
- setExpanded(false);
37
- },
38
- children: /* @__PURE__ */ jsx(TwitterIcon, { fontSize: "small" })
39
- }
40
- ),
41
- /* @__PURE__ */ jsx(
42
- LinkEx,
43
- {
44
- lineHeight: 0,
45
- style: { color: "#4267b2" },
46
- onClick: () => {
47
- window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`);
48
- setExpanded(false);
49
- },
50
- children: /* @__PURE__ */ jsx(FacebookIcon, { fontSize: "small" })
51
- }
52
- )
53
- ] }) })
54
- ] });
55
- };
56
- export {
57
- ShareButton
58
- };
59
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ShareButton.tsx"],"sourcesContent":["import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from '@mui/icons-material'\nimport { Popover } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport { useRef, useState } from 'react'\n\nexport interface ShareButtonProps extends ButtonExProps {\n prepared?: boolean\n shareLink?: string\n}\n\nexport const ShareButton: React.FC<ShareButtonProps> = ({ prepared = true, shareLink, ...props }) => {\n const [expanded, setExpanded] = useState(false)\n const anchorRef = useRef(null)\n const link = shareLink ?? window.location.href\n\n return (\n <FlexRow gap={1} ref={anchorRef}>\n <ButtonEx\n variant=\"text\"\n minWidth={32}\n size=\"small\"\n disabled={!prepared}\n onClick={() => {\n setExpanded(true)\n }}\n {...props}\n >\n <ShareIcon htmlColor=\"gray\" fontSize=\"small\" />\n </ButtonEx>\n <Popover open={prepared ? expanded : false} anchorEl={anchorRef.current} onClose={() => setExpanded(false)} transitionDuration={500}>\n <FlexRow gap={0.5} padding={0.5}>\n <LinkEx\n lineHeight={0}\n style={{ color: '#1da1f2' }}\n onClick={() => {\n window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <TwitterIcon fontSize=\"small\" />\n </LinkEx>\n <LinkEx\n lineHeight={0}\n style={{ color: '#4267b2' }}\n onClick={() => {\n window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`)\n setExpanded(false)\n }}\n >\n <FacebookIcon fontSize=\"small\" />\n </LinkEx>\n </FlexRow>\n </Popover>\n </FlexRow>\n )\n}\n"],"mappings":";AAAA,SAAS,YAAY,cAAc,SAAS,WAAW,WAAW,mBAAmB;AACrF,SAAS,eAAe;AACxB,SAAS,gBAA+B;AACxC,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,QAAQ,gBAAgB;AAwBzB,cAGA,YAHA;AAjBD,IAAM,cAA0C,CAAC,EAAE,WAAW,MAAM,WAAW,GAAG,MAAM,MAAM;AACnG,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,YAAY,OAAO,IAAI;AAC7B,QAAM,OAAO,aAAa,OAAO,SAAS;AAE1C,SACE,qBAAC,WAAQ,KAAK,GAAG,KAAK,WACpB;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR,UAAU;AAAA,QACV,MAAK;AAAA,QACL,UAAU,CAAC;AAAA,QACX,SAAS,MAAM;AACb,sBAAY,IAAI;AAAA,QAClB;AAAA,QACC,GAAG;AAAA,QAEJ,8BAAC,aAAU,WAAU,QAAO,UAAS,SAAQ;AAAA;AAAA,IAC/C;AAAA,IACA,oBAAC,WAAQ,MAAM,WAAW,WAAW,OAAO,UAAU,UAAU,SAAS,SAAS,MAAM,YAAY,KAAK,GAAG,oBAAoB,KAC9H,+BAAC,WAAQ,KAAK,KAAK,SAAS,KAC1B;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,UACZ,OAAO,EAAE,OAAO,UAAU;AAAA,UAC1B,SAAS,MAAM;AACb,mBAAO,KAAK,wCAAwC,mBAAmB,IAAI,CAAC,EAAE;AAC9E,wBAAY,KAAK;AAAA,UACnB;AAAA,UAEA,8BAAC,eAAY,UAAS,SAAQ;AAAA;AAAA,MAChC;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,YAAY;AAAA,UACZ,OAAO,EAAE,OAAO,UAAU;AAAA,UAC1B,SAAS,MAAM;AACb,mBAAO,KAAK,gDAAgD,mBAAmB,IAAI,CAAC,EAAE;AACtF,wBAAY,KAAK;AAAA,UACnB;AAAA,UAEA,8BAAC,gBAAa,UAAS,SAAQ;AAAA;AAAA,MACjC;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":[]}