@xyo-network/react-share 2.75.6 → 2.76.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.
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { ButtonExProps } from '@xylabs/react-button';
3
+ export interface ShareButtonProps extends ButtonExProps {
4
+ prepared?: boolean;
5
+ shareLink?: string;
6
+ }
7
+ export declare const ShareButton: React.FC<ShareButtonProps>;
8
+ //# sourceMappingURL=ShareButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShareButton.d.ts","sourceRoot":"","sources":["../../src/ShareButton.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAY,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAK9D,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA6ClD,CAAA"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { ButtonExProps } from '@xylabs/react-button';
3
+ export interface ShareButtonProps extends ButtonExProps {
4
+ prepared?: boolean;
5
+ shareLink?: string;
6
+ }
7
+ export declare const ShareButton: React.FC<ShareButtonProps>;
8
+ //# sourceMappingURL=ShareButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShareButton.d.ts","sourceRoot":"","sources":["../../src/ShareButton.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAY,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAK9D,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA6ClD,CAAA"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { ButtonExProps } from '@xylabs/react-button';
3
+ export interface ShareButtonProps extends ButtonExProps {
4
+ prepared?: boolean;
5
+ shareLink?: string;
6
+ }
7
+ export declare const ShareButton: React.FC<ShareButtonProps>;
8
+ //# sourceMappingURL=ShareButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShareButton.d.ts","sourceRoot":"","sources":["../../src/ShareButton.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAY,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAK9D,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA6ClD,CAAA"}
@@ -0,0 +1,82 @@
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
@@ -0,0 +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(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O,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"]}
@@ -0,0 +1,2 @@
1
+ export * from './ShareButton';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './ShareButton';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './ShareButton';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -0,0 +1,59 @@
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
@@ -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 { 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":[]}
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.1.6",
14
- "@xylabs/react-flexbox": "^3.1.6",
15
- "@xylabs/react-link": "^3.1.6"
13
+ "@xylabs/react-button": "^3.1.7",
14
+ "@xylabs/react-flexbox": "^3.1.7",
15
+ "@xylabs/react-link": "^3.1.7"
16
16
  },
17
17
  "peerDependencies": {
18
18
  "@mui/icons-material": "^5",
@@ -23,8 +23,8 @@
23
23
  "react-icons": "^4"
24
24
  },
25
25
  "devDependencies": {
26
- "@storybook/react": "^7.6.18",
27
- "@xylabs/ts-scripts-yarn3": "^3.9.1",
26
+ "@storybook/react": "^7.6.19",
27
+ "@xylabs/ts-scripts-yarn3": "^3.10.0",
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.75.6",
81
+ "version": "2.76.0",
82
82
  "type": "module"
83
83
  }