@xyo-network/react-share 2.81.10 → 2.83.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.
- package/dist/browser/index.d.ts +10 -2
- package/dist/browser/index.mjs +65 -0
- package/dist/browser/index.mjs.map +1 -0
- package/package.json +12 -28
- package/src/ShareButton.stories.tsx +2 -2
- package/src/ShareButton.tsx +1 -1
- package/src/index.ts +1 -1
- package/xy.config.ts +12 -0
- package/dist/browser/ShareButton.d.cts +0 -7
- package/dist/browser/ShareButton.d.cts.map +0 -1
- package/dist/browser/ShareButton.d.mts +0 -7
- package/dist/browser/ShareButton.d.mts.map +0 -1
- package/dist/browser/ShareButton.d.ts +0 -7
- package/dist/browser/ShareButton.d.ts.map +0 -1
- package/dist/browser/index.cjs +0 -82
- package/dist/browser/index.cjs.map +0 -1
- package/dist/browser/index.d.cts +0 -2
- package/dist/browser/index.d.cts.map +0 -1
- package/dist/browser/index.d.mts +0 -2
- package/dist/browser/index.d.mts.map +0 -1
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.js +0 -59
- package/dist/browser/index.js.map +0 -1
- package/dist/neutral/ShareButton.d.cts +0 -7
- package/dist/neutral/ShareButton.d.cts.map +0 -1
- package/dist/neutral/ShareButton.d.mts +0 -7
- package/dist/neutral/ShareButton.d.mts.map +0 -1
- package/dist/neutral/ShareButton.d.ts +0 -7
- package/dist/neutral/ShareButton.d.ts.map +0 -1
- package/dist/neutral/index.cjs +0 -82
- package/dist/neutral/index.cjs.map +0 -1
- package/dist/neutral/index.d.cts +0 -2
- package/dist/neutral/index.d.cts.map +0 -1
- package/dist/neutral/index.d.mts +0 -2
- package/dist/neutral/index.d.mts.map +0 -1
- package/dist/neutral/index.d.ts +0 -2
- package/dist/neutral/index.d.ts.map +0 -1
- package/dist/neutral/index.js +0 -59
- package/dist/neutral/index.js.map +0 -1
- package/dist/node/ShareButton.d.cts +0 -7
- package/dist/node/ShareButton.d.cts.map +0 -1
- package/dist/node/ShareButton.d.mts +0 -7
- package/dist/node/ShareButton.d.mts.map +0 -1
- package/dist/node/ShareButton.d.ts +0 -7
- package/dist/node/ShareButton.d.ts.map +0 -1
- package/dist/node/index.cjs +0 -86
- package/dist/node/index.cjs.map +0 -1
- package/dist/node/index.d.cts +0 -2
- package/dist/node/index.d.cts.map +0 -1
- package/dist/node/index.d.mts +0 -2
- package/dist/node/index.d.mts.map +0 -1
- package/dist/node/index.d.ts +0 -2
- package/dist/node/index.d.ts.map +0 -1
- package/dist/node/index.js +0 -59
- package/dist/node/index.js.map +0 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ButtonExProps } from '@xylabs/react-button';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
interface ShareButtonProps extends ButtonExProps {
|
|
5
|
+
prepared?: boolean;
|
|
6
|
+
shareLink?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const ShareButton: React.FC<ShareButtonProps>;
|
|
9
|
+
|
|
10
|
+
export { ShareButton, type ShareButtonProps };
|
|
@@ -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.
|
|
14
|
-
"@xylabs/react-flexbox": "^3.4.
|
|
15
|
-
"@xylabs/react-link": "^3.4.
|
|
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,40 +23,24 @@
|
|
|
23
23
|
"react-icons": "^4"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@storybook/react": "^
|
|
27
|
-
"@xylabs/ts-scripts-yarn3": "^
|
|
26
|
+
"@storybook/react": "^8.2.7",
|
|
27
|
+
"@xylabs/ts-scripts-yarn3": "^4.0.0-rc.7",
|
|
28
28
|
"typescript": "^5.5.4"
|
|
29
29
|
},
|
|
30
30
|
"description": "Common React library for all XYO projects that use React",
|
|
31
31
|
"docs": "dist/docs.json",
|
|
32
32
|
"exports": {
|
|
33
33
|
".": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
"default": "./dist/node/index.js"
|
|
38
|
-
},
|
|
39
|
-
"require": {
|
|
40
|
-
"types": "./dist/node/index.d.cts",
|
|
41
|
-
"default": "./dist/node/index.cjs"
|
|
42
|
-
}
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./dist/browser/index.d.ts",
|
|
36
|
+
"default": "./dist/browser/index.mjs"
|
|
43
37
|
},
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
"types": "./dist/browser/index.d.mts",
|
|
47
|
-
"default": "./dist/browser/index.js"
|
|
48
|
-
},
|
|
49
|
-
"require": {
|
|
50
|
-
"types": "./dist/browser/index.d.cts",
|
|
51
|
-
"default": "./dist/browser/index.cjs"
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
"default": "./dist/browser/index.js"
|
|
38
|
+
"types": "./dist/browser/index.d.ts",
|
|
39
|
+
"default": "./dist/browser/index.mjs"
|
|
55
40
|
},
|
|
56
41
|
"./package.json": "./package.json"
|
|
57
42
|
},
|
|
58
|
-
"
|
|
59
|
-
"module": "dist/browser/index.js",
|
|
43
|
+
"module": "dist/browser/index.mjs",
|
|
60
44
|
"homepage": "https://xyo.network",
|
|
61
45
|
"keywords": [
|
|
62
46
|
"xyo",
|
|
@@ -78,6 +62,6 @@
|
|
|
78
62
|
},
|
|
79
63
|
"sideEffects": false,
|
|
80
64
|
"types": "dist/browser/index.d.ts",
|
|
81
|
-
"version": "2.
|
|
65
|
+
"version": "2.83.0",
|
|
82
66
|
"type": "module"
|
|
83
67
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import React from 'react'
|
|
2
3
|
|
|
3
|
-
import { ShareButton } from './ShareButton.
|
|
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>
|
package/src/ShareButton.tsx
CHANGED
|
@@ -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.
|
|
1
|
+
export * from './ShareButton.tsx'
|
package/xy.config.ts
ADDED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ButtonExProps } from '@xylabs/react-button';
|
|
2
|
-
export interface ShareButtonProps extends ButtonExProps {
|
|
3
|
-
prepared?: boolean;
|
|
4
|
-
shareLink?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const ShareButton: React.FC<ShareButtonProps>;
|
|
7
|
-
//# sourceMappingURL=ShareButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
1
|
-
import { ButtonExProps } from '@xylabs/react-button';
|
|
2
|
-
export interface ShareButtonProps extends ButtonExProps {
|
|
3
|
-
prepared?: boolean;
|
|
4
|
-
shareLink?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const ShareButton: React.FC<ShareButtonProps>;
|
|
7
|
-
//# sourceMappingURL=ShareButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
1
|
-
import { ButtonExProps } from '@xylabs/react-button';
|
|
2
|
-
export interface ShareButtonProps extends ButtonExProps {
|
|
3
|
-
prepared?: boolean;
|
|
4
|
-
shareLink?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const ShareButton: React.FC<ShareButtonProps>;
|
|
7
|
-
//# sourceMappingURL=ShareButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/browser/index.cjs
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
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
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
package/dist/browser/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
package/dist/browser/index.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
package/dist/browser/index.js
DELETED
|
@@ -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,7 +0,0 @@
|
|
|
1
|
-
import { ButtonExProps } from '@xylabs/react-button';
|
|
2
|
-
export interface ShareButtonProps extends ButtonExProps {
|
|
3
|
-
prepared?: boolean;
|
|
4
|
-
shareLink?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const ShareButton: React.FC<ShareButtonProps>;
|
|
7
|
-
//# sourceMappingURL=ShareButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
1
|
-
import { ButtonExProps } from '@xylabs/react-button';
|
|
2
|
-
export interface ShareButtonProps extends ButtonExProps {
|
|
3
|
-
prepared?: boolean;
|
|
4
|
-
shareLink?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const ShareButton: React.FC<ShareButtonProps>;
|
|
7
|
-
//# sourceMappingURL=ShareButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
1
|
-
import { ButtonExProps } from '@xylabs/react-button';
|
|
2
|
-
export interface ShareButtonProps extends ButtonExProps {
|
|
3
|
-
prepared?: boolean;
|
|
4
|
-
shareLink?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const ShareButton: React.FC<ShareButtonProps>;
|
|
7
|
-
//# sourceMappingURL=ShareButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/neutral/index.cjs
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
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
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
package/dist/neutral/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
package/dist/neutral/index.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
package/dist/neutral/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
package/dist/neutral/index.js
DELETED
|
@@ -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,7 +0,0 @@
|
|
|
1
|
-
import { ButtonExProps } from '@xylabs/react-button';
|
|
2
|
-
export interface ShareButtonProps extends ButtonExProps {
|
|
3
|
-
prepared?: boolean;
|
|
4
|
-
shareLink?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const ShareButton: React.FC<ShareButtonProps>;
|
|
7
|
-
//# sourceMappingURL=ShareButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
1
|
-
import { ButtonExProps } from '@xylabs/react-button';
|
|
2
|
-
export interface ShareButtonProps extends ButtonExProps {
|
|
3
|
-
prepared?: boolean;
|
|
4
|
-
shareLink?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const ShareButton: React.FC<ShareButtonProps>;
|
|
7
|
-
//# sourceMappingURL=ShareButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
1
|
-
import { ButtonExProps } from '@xylabs/react-button';
|
|
2
|
-
export interface ShareButtonProps extends ButtonExProps {
|
|
3
|
-
prepared?: boolean;
|
|
4
|
-
shareLink?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const ShareButton: React.FC<ShareButtonProps>;
|
|
7
|
-
//# sourceMappingURL=ShareButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/node/index.cjs
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
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
|
-
});
|
|
86
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/node/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
package/dist/node/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
package/dist/node/index.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
package/dist/node/index.d.ts
DELETED
package/dist/node/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
package/dist/node/index.js
DELETED
|
@@ -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
|
package/dist/node/index.js.map
DELETED
|
@@ -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":[]}
|