@xyo-network/react-share 2.77.0 → 2.77.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.cjs +1 -81
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +1 -58
- package/dist/browser/index.js.map +1 -1
- package/dist/neutral/index.cjs +1 -81
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.js +1 -58
- package/dist/neutral/index.js.map +1 -1
- package/dist/node/index.cjs +1 -85
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +1 -58
- package/dist/node/index.js.map +1 -1
- package/package.json +2 -2
package/dist/browser/index.cjs
CHANGED
|
@@ -1,82 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
ShareButton: () => ShareButton
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
|
|
27
|
-
// src/ShareButton.tsx
|
|
28
|
-
var import_icons_material = require("@mui/icons-material");
|
|
29
|
-
var import_material = require("@mui/material");
|
|
30
|
-
var import_react_button = require("@xylabs/react-button");
|
|
31
|
-
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
32
|
-
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 }) => {
|
|
36
|
-
const [expanded, setExpanded] = (0, import_react.useState)(false);
|
|
37
|
-
const anchorRef = (0, import_react.useRef)(null);
|
|
38
|
-
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
|
-
};
|
|
1
|
+
"use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var k=(t,o)=>{for(var r in o)s(t,r,{get:o[r],enumerable:!0})},E=(t,o,r,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of w(o))!x.call(t,n)&&n!==r&&s(t,n,{get:()=>o[n],enumerable:!(i=u(o,n))||i.enumerable});return t};var S=t=>E(s({},"__esModule",{value:!0}),t);var R={};k(R,{ShareButton:()=>C});module.exports=S(R);var a=require("@mui/icons-material"),h=require("@mui/material"),d=require("@xylabs/react-button"),p=require("@xylabs/react-flexbox"),c=require("@xylabs/react-link"),l=require("react"),e=require("react/jsx-runtime"),C=({prepared:t=!0,shareLink:o,...r})=>{let[i,n]=(0,l.useState)(!1),f=(0,l.useRef)(null),m=o??window.location.href;return(0,e.jsxs)(p.FlexRow,{gap:1,ref:f,children:[(0,e.jsx)(d.ButtonEx,{variant:"text",minWidth:32,size:"small",disabled:!t,onClick:()=>{n(!0)},...r,children:(0,e.jsx)(a.Share,{htmlColor:"gray",fontSize:"small"})}),(0,e.jsx)(h.Popover,{open:t?i:!1,anchorEl:f.current,onClose:()=>n(!1),transitionDuration:500,children:(0,e.jsxs)(p.FlexRow,{gap:.5,padding:.5,children:[(0,e.jsx)(c.LinkEx,{lineHeight:0,style:{color:"#1da1f2"},onClick:()=>{window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(m)}`),n(!1)},children:(0,e.jsx)(a.Twitter,{fontSize:"small"})}),(0,e.jsx)(c.LinkEx,{lineHeight:0,style:{color:"#4267b2"},onClick:()=>{window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(m)}`),n(!1)},children:(0,e.jsx)(a.Facebook,{fontSize:"small"})})]})})]})};
|
|
82
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/ShareButton.tsx"],"sourcesContent":["export * from './ShareButton'\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":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/ShareButton.tsx"],"sourcesContent":["export * from './ShareButton'\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":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAqF,+BACrFC,EAAwB,yBACxBC,EAAwC,gCACxCC,EAAwB,iCACxBC,EAAuB,8BACvBC,EAAiC,iBAwBzBC,EAAA,6BAjBKC,EAA0C,CAAC,CAAE,SAAAC,EAAW,GAAM,UAAAC,EAAW,GAAGC,CAAM,IAAM,CACnG,GAAM,CAACC,EAAUC,CAAW,KAAI,YAAS,EAAK,EACxCC,KAAY,UAAO,IAAI,EACvBC,EAAOL,GAAa,OAAO,SAAS,KAE1C,SACE,QAAC,WAAQ,IAAK,EAAG,IAAKI,EACpB,oBAAC,YACC,QAAQ,OACR,SAAU,GACV,KAAK,QACL,SAAU,CAACL,EACX,QAAS,IAAM,CACbI,EAAY,EAAI,CAClB,EACC,GAAGF,EAEJ,mBAAC,EAAAK,MAAA,CAAU,UAAU,OAAO,SAAS,QAAQ,EAC/C,KACA,OAAC,WAAQ,KAAMP,EAAWG,EAAW,GAAO,SAAUE,EAAU,QAAS,QAAS,IAAMD,EAAY,EAAK,EAAG,mBAAoB,IAC9H,oBAAC,WAAQ,IAAK,GAAK,QAAS,GAC1B,oBAAC,UACC,WAAY,EACZ,MAAO,CAAE,MAAO,SAAU,EAC1B,QAAS,IAAM,CACb,OAAO,KAAK,wCAAwC,mBAAmBE,CAAI,CAAC,EAAE,EAC9EF,EAAY,EAAK,CACnB,EAEA,mBAAC,EAAAI,QAAA,CAAY,SAAS,QAAQ,EAChC,KACA,OAAC,UACC,WAAY,EACZ,MAAO,CAAE,MAAO,SAAU,EAC1B,QAAS,IAAM,CACb,OAAO,KAAK,gDAAgD,mBAAmBF,CAAI,CAAC,EAAE,EACtFF,EAAY,EAAK,CACnB,EAEA,mBAAC,EAAAK,SAAA,CAAa,SAAS,QAAQ,EACjC,GACF,EACF,GACF,CAEJ","names":["src_exports","__export","ShareButton","__toCommonJS","import_icons_material","import_material","import_react_button","import_react_flexbox","import_react_link","import_react","import_jsx_runtime","ShareButton","prepared","shareLink","props","expanded","setExpanded","anchorRef","link","ShareIcon","TwitterIcon","FacebookIcon"]}
|
package/dist/browser/index.js
CHANGED
|
@@ -1,59 +1,2 @@
|
|
|
1
|
-
|
|
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
|
-
};
|
|
1
|
+
import{Facebook as f,Share as m,Twitter as h}from"@mui/icons-material";import{Popover as d}from"@mui/material";import{ButtonEx as u}from"@xylabs/react-button";import{FlexRow as a}from"@xylabs/react-flexbox";import{LinkEx as i}from"@xylabs/react-link";import{useRef as w,useState as x}from"react";import{jsx as o,jsxs as l}from"react/jsx-runtime";var b=({prepared:t=!0,shareLink:s,...p})=>{let[c,e]=x(!1),n=w(null),r=s??window.location.href;return l(a,{gap:1,ref:n,children:[o(u,{variant:"text",minWidth:32,size:"small",disabled:!t,onClick:()=>{e(!0)},...p,children:o(m,{htmlColor:"gray",fontSize:"small"})}),o(d,{open:t?c:!1,anchorEl:n.current,onClose:()=>e(!1),transitionDuration:500,children:l(a,{gap:.5,padding:.5,children:[o(i,{lineHeight:0,style:{color:"#1da1f2"},onClick:()=>{window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(r)}`),e(!1)},children:o(h,{fontSize:"small"})}),o(i,{lineHeight:0,style:{color:"#4267b2"},onClick:()=>{window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(r)}`),e(!1)},children:o(f,{fontSize:"small"})})]})})]})};export{b as ShareButton};
|
|
59
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ShareButton.tsx"],"sourcesContent":["import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from '@mui/icons-material'\nimport { Popover } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport { 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":"
|
|
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,OAAS,YAAYA,EAAc,SAASC,EAAW,WAAWC,MAAmB,sBACrF,OAAS,WAAAC,MAAe,gBACxB,OAAS,YAAAC,MAA+B,uBACxC,OAAS,WAAAC,MAAe,wBACxB,OAAS,UAAAC,MAAc,qBACvB,OAAS,UAAAC,EAAQ,YAAAC,MAAgB,QAwBzB,cAAAC,EAGA,QAAAC,MAHA,oBAjBD,IAAMC,EAA0C,CAAC,CAAE,SAAAC,EAAW,GAAM,UAAAC,EAAW,GAAGC,CAAM,IAAM,CACnG,GAAM,CAACC,EAAUC,CAAW,EAAIR,EAAS,EAAK,EACxCS,EAAYV,EAAO,IAAI,EACvBW,EAAOL,GAAa,OAAO,SAAS,KAE1C,OACEH,EAACL,EAAA,CAAQ,IAAK,EAAG,IAAKY,EACpB,UAAAR,EAACL,EAAA,CACC,QAAQ,OACR,SAAU,GACV,KAAK,QACL,SAAU,CAACQ,EACX,QAAS,IAAM,CACbI,EAAY,EAAI,CAClB,EACC,GAAGF,EAEJ,SAAAL,EAACR,EAAA,CAAU,UAAU,OAAO,SAAS,QAAQ,EAC/C,EACAQ,EAACN,EAAA,CAAQ,KAAMS,EAAWG,EAAW,GAAO,SAAUE,EAAU,QAAS,QAAS,IAAMD,EAAY,EAAK,EAAG,mBAAoB,IAC9H,SAAAN,EAACL,EAAA,CAAQ,IAAK,GAAK,QAAS,GAC1B,UAAAI,EAACH,EAAA,CACC,WAAY,EACZ,MAAO,CAAE,MAAO,SAAU,EAC1B,QAAS,IAAM,CACb,OAAO,KAAK,wCAAwC,mBAAmBY,CAAI,CAAC,EAAE,EAC9EF,EAAY,EAAK,CACnB,EAEA,SAAAP,EAACP,EAAA,CAAY,SAAS,QAAQ,EAChC,EACAO,EAACH,EAAA,CACC,WAAY,EACZ,MAAO,CAAE,MAAO,SAAU,EAC1B,QAAS,IAAM,CACb,OAAO,KAAK,gDAAgD,mBAAmBY,CAAI,CAAC,EAAE,EACtFF,EAAY,EAAK,CACnB,EAEA,SAAAP,EAACT,EAAA,CAAa,SAAS,QAAQ,EACjC,GACF,EACF,GACF,CAEJ","names":["FacebookIcon","ShareIcon","TwitterIcon","Popover","ButtonEx","FlexRow","LinkEx","useRef","useState","jsx","jsxs","ShareButton","prepared","shareLink","props","expanded","setExpanded","anchorRef","link"]}
|
package/dist/neutral/index.cjs
CHANGED
|
@@ -1,82 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
ShareButton: () => ShareButton
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
|
|
27
|
-
// src/ShareButton.tsx
|
|
28
|
-
var import_icons_material = require("@mui/icons-material");
|
|
29
|
-
var import_material = require("@mui/material");
|
|
30
|
-
var import_react_button = require("@xylabs/react-button");
|
|
31
|
-
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
32
|
-
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 }) => {
|
|
36
|
-
const [expanded, setExpanded] = (0, import_react.useState)(false);
|
|
37
|
-
const anchorRef = (0, import_react.useRef)(null);
|
|
38
|
-
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
|
-
};
|
|
1
|
+
"use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var k=(t,o)=>{for(var r in o)s(t,r,{get:o[r],enumerable:!0})},E=(t,o,r,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of w(o))!x.call(t,n)&&n!==r&&s(t,n,{get:()=>o[n],enumerable:!(i=u(o,n))||i.enumerable});return t};var S=t=>E(s({},"__esModule",{value:!0}),t);var R={};k(R,{ShareButton:()=>C});module.exports=S(R);var a=require("@mui/icons-material"),h=require("@mui/material"),d=require("@xylabs/react-button"),p=require("@xylabs/react-flexbox"),c=require("@xylabs/react-link"),l=require("react"),e=require("react/jsx-runtime"),C=({prepared:t=!0,shareLink:o,...r})=>{let[i,n]=(0,l.useState)(!1),f=(0,l.useRef)(null),m=o??window.location.href;return(0,e.jsxs)(p.FlexRow,{gap:1,ref:f,children:[(0,e.jsx)(d.ButtonEx,{variant:"text",minWidth:32,size:"small",disabled:!t,onClick:()=>{n(!0)},...r,children:(0,e.jsx)(a.Share,{htmlColor:"gray",fontSize:"small"})}),(0,e.jsx)(h.Popover,{open:t?i:!1,anchorEl:f.current,onClose:()=>n(!1),transitionDuration:500,children:(0,e.jsxs)(p.FlexRow,{gap:.5,padding:.5,children:[(0,e.jsx)(c.LinkEx,{lineHeight:0,style:{color:"#1da1f2"},onClick:()=>{window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(m)}`),n(!1)},children:(0,e.jsx)(a.Twitter,{fontSize:"small"})}),(0,e.jsx)(c.LinkEx,{lineHeight:0,style:{color:"#4267b2"},onClick:()=>{window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(m)}`),n(!1)},children:(0,e.jsx)(a.Facebook,{fontSize:"small"})})]})})]})};
|
|
82
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/ShareButton.tsx"],"sourcesContent":["export * from './ShareButton'\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":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/ShareButton.tsx"],"sourcesContent":["export * from './ShareButton'\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":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAqF,+BACrFC,EAAwB,yBACxBC,EAAwC,gCACxCC,EAAwB,iCACxBC,EAAuB,8BACvBC,EAAiC,iBAwBzBC,EAAA,6BAjBKC,EAA0C,CAAC,CAAE,SAAAC,EAAW,GAAM,UAAAC,EAAW,GAAGC,CAAM,IAAM,CACnG,GAAM,CAACC,EAAUC,CAAW,KAAI,YAAS,EAAK,EACxCC,KAAY,UAAO,IAAI,EACvBC,EAAOL,GAAa,OAAO,SAAS,KAE1C,SACE,QAAC,WAAQ,IAAK,EAAG,IAAKI,EACpB,oBAAC,YACC,QAAQ,OACR,SAAU,GACV,KAAK,QACL,SAAU,CAACL,EACX,QAAS,IAAM,CACbI,EAAY,EAAI,CAClB,EACC,GAAGF,EAEJ,mBAAC,EAAAK,MAAA,CAAU,UAAU,OAAO,SAAS,QAAQ,EAC/C,KACA,OAAC,WAAQ,KAAMP,EAAWG,EAAW,GAAO,SAAUE,EAAU,QAAS,QAAS,IAAMD,EAAY,EAAK,EAAG,mBAAoB,IAC9H,oBAAC,WAAQ,IAAK,GAAK,QAAS,GAC1B,oBAAC,UACC,WAAY,EACZ,MAAO,CAAE,MAAO,SAAU,EAC1B,QAAS,IAAM,CACb,OAAO,KAAK,wCAAwC,mBAAmBE,CAAI,CAAC,EAAE,EAC9EF,EAAY,EAAK,CACnB,EAEA,mBAAC,EAAAI,QAAA,CAAY,SAAS,QAAQ,EAChC,KACA,OAAC,UACC,WAAY,EACZ,MAAO,CAAE,MAAO,SAAU,EAC1B,QAAS,IAAM,CACb,OAAO,KAAK,gDAAgD,mBAAmBF,CAAI,CAAC,EAAE,EACtFF,EAAY,EAAK,CACnB,EAEA,mBAAC,EAAAK,SAAA,CAAa,SAAS,QAAQ,EACjC,GACF,EACF,GACF,CAEJ","names":["src_exports","__export","ShareButton","__toCommonJS","import_icons_material","import_material","import_react_button","import_react_flexbox","import_react_link","import_react","import_jsx_runtime","ShareButton","prepared","shareLink","props","expanded","setExpanded","anchorRef","link","ShareIcon","TwitterIcon","FacebookIcon"]}
|
package/dist/neutral/index.js
CHANGED
|
@@ -1,59 +1,2 @@
|
|
|
1
|
-
|
|
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
|
-
};
|
|
1
|
+
import{Facebook as f,Share as m,Twitter as h}from"@mui/icons-material";import{Popover as d}from"@mui/material";import{ButtonEx as u}from"@xylabs/react-button";import{FlexRow as a}from"@xylabs/react-flexbox";import{LinkEx as i}from"@xylabs/react-link";import{useRef as w,useState as x}from"react";import{jsx as o,jsxs as l}from"react/jsx-runtime";var b=({prepared:t=!0,shareLink:s,...p})=>{let[c,e]=x(!1),n=w(null),r=s??window.location.href;return l(a,{gap:1,ref:n,children:[o(u,{variant:"text",minWidth:32,size:"small",disabled:!t,onClick:()=>{e(!0)},...p,children:o(m,{htmlColor:"gray",fontSize:"small"})}),o(d,{open:t?c:!1,anchorEl:n.current,onClose:()=>e(!1),transitionDuration:500,children:l(a,{gap:.5,padding:.5,children:[o(i,{lineHeight:0,style:{color:"#1da1f2"},onClick:()=>{window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(r)}`),e(!1)},children:o(h,{fontSize:"small"})}),o(i,{lineHeight:0,style:{color:"#4267b2"},onClick:()=>{window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(r)}`),e(!1)},children:o(f,{fontSize:"small"})})]})})]})};export{b as ShareButton};
|
|
59
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ShareButton.tsx"],"sourcesContent":["import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from '@mui/icons-material'\nimport { Popover } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport { 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":"
|
|
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,OAAS,YAAYA,EAAc,SAASC,EAAW,WAAWC,MAAmB,sBACrF,OAAS,WAAAC,MAAe,gBACxB,OAAS,YAAAC,MAA+B,uBACxC,OAAS,WAAAC,MAAe,wBACxB,OAAS,UAAAC,MAAc,qBACvB,OAAS,UAAAC,EAAQ,YAAAC,MAAgB,QAwBzB,cAAAC,EAGA,QAAAC,MAHA,oBAjBD,IAAMC,EAA0C,CAAC,CAAE,SAAAC,EAAW,GAAM,UAAAC,EAAW,GAAGC,CAAM,IAAM,CACnG,GAAM,CAACC,EAAUC,CAAW,EAAIR,EAAS,EAAK,EACxCS,EAAYV,EAAO,IAAI,EACvBW,EAAOL,GAAa,OAAO,SAAS,KAE1C,OACEH,EAACL,EAAA,CAAQ,IAAK,EAAG,IAAKY,EACpB,UAAAR,EAACL,EAAA,CACC,QAAQ,OACR,SAAU,GACV,KAAK,QACL,SAAU,CAACQ,EACX,QAAS,IAAM,CACbI,EAAY,EAAI,CAClB,EACC,GAAGF,EAEJ,SAAAL,EAACR,EAAA,CAAU,UAAU,OAAO,SAAS,QAAQ,EAC/C,EACAQ,EAACN,EAAA,CAAQ,KAAMS,EAAWG,EAAW,GAAO,SAAUE,EAAU,QAAS,QAAS,IAAMD,EAAY,EAAK,EAAG,mBAAoB,IAC9H,SAAAN,EAACL,EAAA,CAAQ,IAAK,GAAK,QAAS,GAC1B,UAAAI,EAACH,EAAA,CACC,WAAY,EACZ,MAAO,CAAE,MAAO,SAAU,EAC1B,QAAS,IAAM,CACb,OAAO,KAAK,wCAAwC,mBAAmBY,CAAI,CAAC,EAAE,EAC9EF,EAAY,EAAK,CACnB,EAEA,SAAAP,EAACP,EAAA,CAAY,SAAS,QAAQ,EAChC,EACAO,EAACH,EAAA,CACC,WAAY,EACZ,MAAO,CAAE,MAAO,SAAU,EAC1B,QAAS,IAAM,CACb,OAAO,KAAK,gDAAgD,mBAAmBY,CAAI,CAAC,EAAE,EACtFF,EAAY,EAAK,CACnB,EAEA,SAAAP,EAACT,EAAA,CAAa,SAAS,QAAQ,EACjC,GACF,EACF,GACF,CAEJ","names":["FacebookIcon","ShareIcon","TwitterIcon","Popover","ButtonEx","FlexRow","LinkEx","useRef","useState","jsx","jsxs","ShareButton","prepared","shareLink","props","expanded","setExpanded","anchorRef","link"]}
|
package/dist/node/index.cjs
CHANGED
|
@@ -1,86 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
ShareButton: () => ShareButton
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
|
|
27
|
-
// src/ShareButton.tsx
|
|
28
|
-
var import_icons_material = require("@mui/icons-material");
|
|
29
|
-
var import_material = require("@mui/material");
|
|
30
|
-
var import_react_button = require("@xylabs/react-button");
|
|
31
|
-
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
32
|
-
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 }) => {
|
|
36
|
-
const [expanded, setExpanded] = (0, import_react.useState)(false);
|
|
37
|
-
const anchorRef = (0, import_react.useRef)(null);
|
|
38
|
-
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
|
-
};
|
|
82
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
-
0 && (module.exports = {
|
|
84
|
-
ShareButton
|
|
85
|
-
});
|
|
1
|
+
"use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var k=(t,o)=>{for(var r in o)s(t,r,{get:o[r],enumerable:!0})},E=(t,o,r,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of w(o))!x.call(t,n)&&n!==r&&s(t,n,{get:()=>o[n],enumerable:!(i=u(o,n))||i.enumerable});return t};var S=t=>E(s({},"__esModule",{value:!0}),t);var R={};k(R,{ShareButton:()=>C});module.exports=S(R);var a=require("@mui/icons-material"),h=require("@mui/material"),d=require("@xylabs/react-button"),p=require("@xylabs/react-flexbox"),c=require("@xylabs/react-link"),l=require("react"),e=require("react/jsx-runtime"),C=({prepared:t=!0,shareLink:o,...r})=>{let[i,n]=(0,l.useState)(!1),f=(0,l.useRef)(null),m=o??window.location.href;return(0,e.jsxs)(p.FlexRow,{gap:1,ref:f,children:[(0,e.jsx)(d.ButtonEx,{variant:"text",minWidth:32,size:"small",disabled:!t,onClick:()=>{n(!0)},...r,children:(0,e.jsx)(a.Share,{htmlColor:"gray",fontSize:"small"})}),(0,e.jsx)(h.Popover,{open:t?i:!1,anchorEl:f.current,onClose:()=>n(!1),transitionDuration:500,children:(0,e.jsxs)(p.FlexRow,{gap:.5,padding:.5,children:[(0,e.jsx)(c.LinkEx,{lineHeight:0,style:{color:"#1da1f2"},onClick:()=>{window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(m)}`),n(!1)},children:(0,e.jsx)(a.Twitter,{fontSize:"small"})}),(0,e.jsx)(c.LinkEx,{lineHeight:0,style:{color:"#4267b2"},onClick:()=>{window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(m)}`),n(!1)},children:(0,e.jsx)(a.Facebook,{fontSize:"small"})})]})})]})};0&&(module.exports={ShareButton});
|
|
86
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/ShareButton.tsx"],"sourcesContent":["export * from './ShareButton'\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":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/ShareButton.tsx"],"sourcesContent":["export * from './ShareButton'\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":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAqF,+BACrFC,EAAwB,yBACxBC,EAAwC,gCACxCC,EAAwB,iCACxBC,EAAuB,8BACvBC,EAAiC,iBAwBzBC,EAAA,6BAjBKC,EAA0C,CAAC,CAAE,SAAAC,EAAW,GAAM,UAAAC,EAAW,GAAGC,CAAM,IAAM,CACnG,GAAM,CAACC,EAAUC,CAAW,KAAI,YAAS,EAAK,EACxCC,KAAY,UAAO,IAAI,EACvBC,EAAOL,GAAa,OAAO,SAAS,KAE1C,SACE,QAAC,WAAQ,IAAK,EAAG,IAAKI,EACpB,oBAAC,YACC,QAAQ,OACR,SAAU,GACV,KAAK,QACL,SAAU,CAACL,EACX,QAAS,IAAM,CACbI,EAAY,EAAI,CAClB,EACC,GAAGF,EAEJ,mBAAC,EAAAK,MAAA,CAAU,UAAU,OAAO,SAAS,QAAQ,EAC/C,KACA,OAAC,WAAQ,KAAMP,EAAWG,EAAW,GAAO,SAAUE,EAAU,QAAS,QAAS,IAAMD,EAAY,EAAK,EAAG,mBAAoB,IAC9H,oBAAC,WAAQ,IAAK,GAAK,QAAS,GAC1B,oBAAC,UACC,WAAY,EACZ,MAAO,CAAE,MAAO,SAAU,EAC1B,QAAS,IAAM,CACb,OAAO,KAAK,wCAAwC,mBAAmBE,CAAI,CAAC,EAAE,EAC9EF,EAAY,EAAK,CACnB,EAEA,mBAAC,EAAAI,QAAA,CAAY,SAAS,QAAQ,EAChC,KACA,OAAC,UACC,WAAY,EACZ,MAAO,CAAE,MAAO,SAAU,EAC1B,QAAS,IAAM,CACb,OAAO,KAAK,gDAAgD,mBAAmBF,CAAI,CAAC,EAAE,EACtFF,EAAY,EAAK,CACnB,EAEA,mBAAC,EAAAK,SAAA,CAAa,SAAS,QAAQ,EACjC,GACF,EACF,GACF,CAEJ","names":["src_exports","__export","ShareButton","__toCommonJS","import_icons_material","import_material","import_react_button","import_react_flexbox","import_react_link","import_react","import_jsx_runtime","ShareButton","prepared","shareLink","props","expanded","setExpanded","anchorRef","link","ShareIcon","TwitterIcon","FacebookIcon"]}
|
package/dist/node/index.js
CHANGED
|
@@ -1,59 +1,2 @@
|
|
|
1
|
-
|
|
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
|
-
};
|
|
1
|
+
import{Facebook as f,Share as m,Twitter as h}from"@mui/icons-material";import{Popover as d}from"@mui/material";import{ButtonEx as u}from"@xylabs/react-button";import{FlexRow as a}from"@xylabs/react-flexbox";import{LinkEx as i}from"@xylabs/react-link";import{useRef as w,useState as x}from"react";import{jsx as o,jsxs as l}from"react/jsx-runtime";var b=({prepared:t=!0,shareLink:s,...p})=>{let[c,e]=x(!1),n=w(null),r=s??window.location.href;return l(a,{gap:1,ref:n,children:[o(u,{variant:"text",minWidth:32,size:"small",disabled:!t,onClick:()=>{e(!0)},...p,children:o(m,{htmlColor:"gray",fontSize:"small"})}),o(d,{open:t?c:!1,anchorEl:n.current,onClose:()=>e(!1),transitionDuration:500,children:l(a,{gap:.5,padding:.5,children:[o(i,{lineHeight:0,style:{color:"#1da1f2"},onClick:()=>{window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(r)}`),e(!1)},children:o(h,{fontSize:"small"})}),o(i,{lineHeight:0,style:{color:"#4267b2"},onClick:()=>{window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(r)}`),e(!1)},children:o(f,{fontSize:"small"})})]})})]})};export{b as ShareButton};
|
|
59
2
|
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ShareButton.tsx"],"sourcesContent":["import { Facebook as FacebookIcon, Share as ShareIcon, Twitter as TwitterIcon } from '@mui/icons-material'\nimport { Popover } from '@mui/material'\nimport { ButtonEx, ButtonExProps } from '@xylabs/react-button'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport { 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":"
|
|
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,OAAS,YAAYA,EAAc,SAASC,EAAW,WAAWC,MAAmB,sBACrF,OAAS,WAAAC,MAAe,gBACxB,OAAS,YAAAC,MAA+B,uBACxC,OAAS,WAAAC,MAAe,wBACxB,OAAS,UAAAC,MAAc,qBACvB,OAAS,UAAAC,EAAQ,YAAAC,MAAgB,QAwBzB,cAAAC,EAGA,QAAAC,MAHA,oBAjBD,IAAMC,EAA0C,CAAC,CAAE,SAAAC,EAAW,GAAM,UAAAC,EAAW,GAAGC,CAAM,IAAM,CACnG,GAAM,CAACC,EAAUC,CAAW,EAAIR,EAAS,EAAK,EACxCS,EAAYV,EAAO,IAAI,EACvBW,EAAOL,GAAa,OAAO,SAAS,KAE1C,OACEH,EAACL,EAAA,CAAQ,IAAK,EAAG,IAAKY,EACpB,UAAAR,EAACL,EAAA,CACC,QAAQ,OACR,SAAU,GACV,KAAK,QACL,SAAU,CAACQ,EACX,QAAS,IAAM,CACbI,EAAY,EAAI,CAClB,EACC,GAAGF,EAEJ,SAAAL,EAACR,EAAA,CAAU,UAAU,OAAO,SAAS,QAAQ,EAC/C,EACAQ,EAACN,EAAA,CAAQ,KAAMS,EAAWG,EAAW,GAAO,SAAUE,EAAU,QAAS,QAAS,IAAMD,EAAY,EAAK,EAAG,mBAAoB,IAC9H,SAAAN,EAACL,EAAA,CAAQ,IAAK,GAAK,QAAS,GAC1B,UAAAI,EAACH,EAAA,CACC,WAAY,EACZ,MAAO,CAAE,MAAO,SAAU,EAC1B,QAAS,IAAM,CACb,OAAO,KAAK,wCAAwC,mBAAmBY,CAAI,CAAC,EAAE,EAC9EF,EAAY,EAAK,CACnB,EAEA,SAAAP,EAACP,EAAA,CAAY,SAAS,QAAQ,EAChC,EACAO,EAACH,EAAA,CACC,WAAY,EACZ,MAAO,CAAE,MAAO,SAAU,EAC1B,QAAS,IAAM,CACb,OAAO,KAAK,gDAAgD,mBAAmBY,CAAI,CAAC,EAAE,EACtFF,EAAY,EAAK,CACnB,EAEA,SAAAP,EAACT,EAAA,CAAa,SAAS,QAAQ,EACjC,GACF,EACF,GACF,CAEJ","names":["FacebookIcon","ShareIcon","TwitterIcon","Popover","ButtonEx","FlexRow","LinkEx","useRef","useState","jsx","jsxs","ShareButton","prepared","shareLink","props","expanded","setExpanded","anchorRef","link"]}
|
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@storybook/react": "^7.6.19",
|
|
27
|
-
"@xylabs/ts-scripts-yarn3": "^3.11.
|
|
27
|
+
"@xylabs/ts-scripts-yarn3": "^3.11.7",
|
|
28
28
|
"typescript": "^5.4.5"
|
|
29
29
|
},
|
|
30
30
|
"description": "Common React library for all XYO projects that use React",
|
|
@@ -78,6 +78,6 @@
|
|
|
78
78
|
},
|
|
79
79
|
"sideEffects": false,
|
|
80
80
|
"types": "dist/browser/index.d.ts",
|
|
81
|
-
"version": "2.77.
|
|
81
|
+
"version": "2.77.2",
|
|
82
82
|
"type": "module"
|
|
83
83
|
}
|