@xyo-network/react-share 2.56.16 → 2.57.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.
@@ -12,16 +12,17 @@ const react_flexbox_1 = require("@xylabs/react-flexbox");
12
12
  const react_link_1 = require("@xylabs/react-link");
13
13
  const react_1 = require("react");
14
14
  const ShareButton = (_a) => {
15
- var { prepared = true } = _a, props = tslib_1.__rest(_a, ["prepared"]);
15
+ var { prepared = true, shareLink } = _a, props = tslib_1.__rest(_a, ["prepared", "shareLink"]);
16
16
  const [expanded, setExpanded] = (0, react_1.useState)(false);
17
17
  const anchorRef = (0, react_1.useRef)(null);
18
+ const link = shareLink !== null && shareLink !== void 0 ? shareLink : window.location.href;
18
19
  return ((0, jsx_runtime_1.jsxs)(react_flexbox_1.FlexRow, Object.assign({ gap: 1, ref: anchorRef }, { children: [(0, jsx_runtime_1.jsx)(react_button_1.ButtonEx, Object.assign({ variant: "text", minWidth: 32, size: "small", disabled: !prepared, onClick: () => {
19
20
  setExpanded(true);
20
21
  } }, props, { children: (0, jsx_runtime_1.jsx)(Share_1.default, { htmlColor: "gray", fontSize: "small" }) })), (0, jsx_runtime_1.jsx)(material_1.Popover, Object.assign({ open: prepared ? expanded : false, anchorEl: anchorRef.current, onClose: () => setExpanded(false), transitionDuration: 500 }, { children: (0, jsx_runtime_1.jsxs)(react_flexbox_1.FlexRow, Object.assign({ gap: 0.5, padding: 0.5 }, { children: [(0, jsx_runtime_1.jsx)(react_link_1.LinkEx, Object.assign({ lineHeight: 0, style: { color: '#1da1f2' }, onClick: () => {
21
- window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(window.location.href)}`);
22
+ window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`);
22
23
  setExpanded(false);
23
24
  } }, { children: (0, jsx_runtime_1.jsx)(Twitter_1.default, { fontSize: "small" }) })), (0, jsx_runtime_1.jsx)(react_link_1.LinkEx, Object.assign({ lineHeight: 0, style: { color: '#4267b2' }, onClick: () => {
24
- window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(window.location.href)}`);
25
+ window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`);
25
26
  setExpanded(false);
26
27
  } }, { children: (0, jsx_runtime_1.jsx)(Facebook_1.default, { fontSize: "small" }) }))] })) }))] })));
27
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ShareButton.js","sourceRoot":"","sources":["../../src/ShareButton.tsx"],"names":[],"mappings":";;;;;AAAA,oFAAuD;AACvD,8EAAiD;AACjD,kFAAqD;AACrD,4CAAuC;AACvC,uDAA8D;AAC9D,yDAA+C;AAC/C,mDAA2C;AAC3C,iCAAwC;AAMjC,MAAM,WAAW,GAA+B,CAAC,EAA6B,EAAE,EAAE;QAAjC,EAAE,QAAQ,GAAG,IAAI,OAAY,EAAP,KAAK,sBAA3B,YAA6B,CAAF;IACjF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAA;IAC/C,MAAM,SAAS,GAAG,IAAA,cAAM,EAAC,IAAI,CAAC,CAAA;IAE9B,OAAO,CACL,wBAAC,uBAAO,kBAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,iBAC7B,uBAAC,uBAAQ,kBACP,OAAO,EAAC,MAAM,EACd,QAAQ,EAAE,EAAE,EACZ,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,CAAC,QAAQ,EACnB,OAAO,EAAE,GAAG,EAAE;oBACZ,WAAW,CAAC,IAAI,CAAC,CAAA;gBACnB,CAAC,IACG,KAAK,cAET,uBAAC,eAAS,IAAC,SAAS,EAAC,MAAM,EAAC,QAAQ,EAAC,OAAO,GAAG,IACtC,EACX,uBAAC,kBAAO,kBAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,OA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Q,EAAC,OAAO,GAAG,IACzB,EACT,uBAAC,mBAAM,kBACL,UAAU,EAAE,CAAC,EACb,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAC3B,OAAO,EAAE,GAAG,EAAE;gCACZ,MAAM,CAAC,IAAI,CAAC,gDAAgD,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gCACvF,WAAW,CAAC,KAAK,CAAC,CAAA;4BACpB,CAAC,gBAED,uBAAC,kBAAY,IAAC,QAAQ,EAAC,OAAO,GAAG,IAC1B,KACD,IACF,KACF,CACX,CAAA;AACH,CAAC,CAAA;AA7CY,QAAA,WAAW,eA6CvB"}
@@ -7,16 +7,17 @@ import { ButtonEx } from '@xylabs/react-button';
7
7
  import { FlexRow } from '@xylabs/react-flexbox';
8
8
  import { LinkEx } from '@xylabs/react-link';
9
9
  import { useRef, useState } from 'react';
10
- export const ShareButton = ({ prepared = true, ...props }) => {
10
+ export const ShareButton = ({ prepared = true, shareLink, ...props }) => {
11
11
  const [expanded, setExpanded] = useState(false);
12
12
  const anchorRef = useRef(null);
13
+ const link = shareLink ?? window.location.href;
13
14
  return (_jsxs(FlexRow, { gap: 1, ref: anchorRef, children: [_jsx(ButtonEx, { variant: "text", minWidth: 32, size: "small", disabled: !prepared, onClick: () => {
14
15
  setExpanded(true);
15
16
  }, ...props, children: _jsx(ShareIcon, { htmlColor: "gray", fontSize: "small" }) }), _jsx(Popover, { open: prepared ? expanded : false, anchorEl: anchorRef.current, onClose: () => setExpanded(false), transitionDuration: 500, children: _jsxs(FlexRow, { gap: 0.5, padding: 0.5, children: [_jsx(LinkEx, { lineHeight: 0, style: { color: '#1da1f2' }, onClick: () => {
16
- window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(window.location.href)}`);
17
+ window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`);
17
18
  setExpanded(false);
18
19
  }, children: _jsx(TwitterIcon, { fontSize: "small" }) }), _jsx(LinkEx, { lineHeight: 0, style: { color: '#4267b2' }, onClick: () => {
19
- window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(window.location.href)}`);
20
+ window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`);
20
21
  setExpanded(false);
21
22
  }, children: _jsx(FacebookIcon, { fontSize: "small" }) })] }) })] }));
22
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ShareButton.js","sourceRoot":"","sources":["../../src/ShareButton.tsx"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,8BAA8B,CAAA;AACvD,OAAO,SAAS,MAAM,2BAA2B,CAAA;AACjD,OAAO,WAAW,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAiB,MAAM,sBAAsB,CAAA;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAMxC,MAAM,CAAC,MAAM,WAAW,GAA+B,CAAC,EAAE,QAAQ,GAAG,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACvF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/C,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IAE9B,OAAO,CACL,MAAC,OAAO,IAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,aAC7B,KAAC,QAAQ,IACP,OAAO,EAAC,MAAM,EACd,QAAQ,EAAE,EAAE,EACZ,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,CAAC,QAAQ,EACnB,OAAO,EAAE,GAAG,EAAE;oBACZ,WAAW,CAAC,IAAI,CAAC,CAAA;gBACnB,CAAC,KACG,KAAK,YA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C,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,aAC7B,KAAC,MAAM,IACL,UAAU,EAAE,CAAC,EACb,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAC3B,OAAO,EAAE,GAAG,EAAE;gCACZ,MAAM,CAAC,IAAI,CAAC,wCAAwC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gCAC/E,WAAW,CAAC,KAAK,CAAC,CAAA;4BACpB,CAAC,YAED,KAAC,WAAW,IAAC,QAAQ,EAAC,OAAO,GAAG,GACzB,EACT,KAAC,MAAM,IACL,UAAU,EAAE,CAAC,EACb,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAC3B,OAAO,EAAE,GAAG,EAAE;gCACZ,MAAM,CAAC,IAAI,CAAC,gDAAgD,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gCACvF,WAAW,CAAC,KAAK,CAAC,CAAA;4BACpB,CAAC,YAED,KAAC,YAAY,IAAC,QAAQ,EAAC,OAAO,GAAG,GAC1B,IACD,GACF,IACF,CACX,CAAA;AACH,CAAC,CAAA"}
@@ -2,6 +2,7 @@
2
2
  import { ButtonExProps } from '@xylabs/react-button';
3
3
  export interface ShareButtonProps extends ButtonExProps {
4
4
  prepared?: boolean;
5
+ shareLink?: string;
5
6
  }
6
7
  export declare const ShareButton: React.FC<ShareButtonProps>;
7
8
  //# sourceMappingURL=ShareButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ShareButton.d.ts","sourceRoot":"","sources":["../../src/ShareButton.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAY,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAK9D,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA4ClD,CAAA"}
1
+ {"version":3,"file":"ShareButton.d.ts","sourceRoot":"","sources":["../../src/ShareButton.tsx"],"names":[],"mappings":";AAIA,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/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "react-router-dom": "^6"
26
26
  },
27
27
  "devDependencies": {
28
- "@storybook/react": "^7.0.26",
28
+ "@storybook/react": "^7.0.27",
29
29
  "@xylabs/ts-scripts-yarn3": "^2.18.10",
30
30
  "typescript": "^5.1.6"
31
31
  },
@@ -72,5 +72,5 @@
72
72
  },
73
73
  "sideEffects": false,
74
74
  "types": "dist/types/index.d.ts",
75
- "version": "2.56.16"
75
+ "version": "2.57.0"
76
76
  }
@@ -13,7 +13,11 @@ const Template: StoryFn<typeof ShareButton> = (props) => {
13
13
 
14
14
  const Default = Template.bind({})
15
15
  Default.args = {}
16
+
16
17
  const WithUnPrepared = Template.bind({})
17
18
  WithUnPrepared.args = { prepared: false }
18
19
 
19
- export { Default, WithUnPrepared }
20
+ const WithCustomShareLink = Template.bind({})
21
+ WithCustomShareLink.args = { shareLink: 'http://explore.xyo.network' }
22
+
23
+ export { Default, WithCustomShareLink, WithUnPrepared }
@@ -9,11 +9,13 @@ import { useRef, useState } from 'react'
9
9
 
10
10
  export interface ShareButtonProps extends ButtonExProps {
11
11
  prepared?: boolean
12
+ shareLink?: string
12
13
  }
13
14
 
14
- export const ShareButton: React.FC<ShareButtonProps> = ({ prepared = true, ...props }) => {
15
+ export const ShareButton: React.FC<ShareButtonProps> = ({ prepared = true, shareLink, ...props }) => {
15
16
  const [expanded, setExpanded] = useState(false)
16
17
  const anchorRef = useRef(null)
18
+ const link = shareLink ?? window.location.href
17
19
 
18
20
  return (
19
21
  <FlexRow gap={1} ref={anchorRef}>
@@ -35,7 +37,7 @@ export const ShareButton: React.FC<ShareButtonProps> = ({ prepared = true, ...pr
35
37
  lineHeight={0}
36
38
  style={{ color: '#1da1f2' }}
37
39
  onClick={() => {
38
- window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(window.location.href)}`)
40
+ window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`)
39
41
  setExpanded(false)
40
42
  }}
41
43
  >
@@ -45,7 +47,7 @@ export const ShareButton: React.FC<ShareButtonProps> = ({ prepared = true, ...pr
45
47
  lineHeight={0}
46
48
  style={{ color: '#4267b2' }}
47
49
  onClick={() => {
48
- window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(window.location.href)}`)
50
+ window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`)
49
51
  setExpanded(false)
50
52
  }}
51
53
  >
package/dist/docs.json DELETED
@@ -1,205 +0,0 @@
1
- {
2
- "id": 0,
3
- "name": "@xyo-network/react-share",
4
- "variant": "project",
5
- "kind": 1,
6
- "flags": {},
7
- "children": [
8
- {
9
- "id": 1,
10
- "name": "ShareButtonProps",
11
- "variant": "declaration",
12
- "kind": 256,
13
- "flags": {},
14
- "children": [
15
- {
16
- "id": 2,
17
- "name": "prepared",
18
- "variant": "declaration",
19
- "kind": 1024,
20
- "flags": {
21
- "isOptional": true
22
- },
23
- "sources": [
24
- {
25
- "fileName": "packages/sdk/packages/share/src/ShareButton.tsx",
26
- "line": 11,
27
- "character": 2,
28
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/73696a57f/packages/sdk/packages/share/src/ShareButton.tsx#L11"
29
- }
30
- ],
31
- "type": {
32
- "type": "intrinsic",
33
- "name": "boolean"
34
- }
35
- }
36
- ],
37
- "groups": [
38
- {
39
- "title": "Properties",
40
- "children": [
41
- 2
42
- ]
43
- }
44
- ],
45
- "sources": [
46
- {
47
- "fileName": "packages/sdk/packages/share/src/ShareButton.tsx",
48
- "line": 10,
49
- "character": 17,
50
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/73696a57f/packages/sdk/packages/share/src/ShareButton.tsx#L10"
51
- }
52
- ],
53
- "extendedTypes": [
54
- {
55
- "type": "reference",
56
- "target": {
57
- "sourceFileName": "../../../../node_modules/@xylabs/react-button/src/components/ButtonExProps.tsx",
58
- "qualifiedName": "ButtonExProps"
59
- },
60
- "name": "ButtonExProps",
61
- "package": "@xylabs/react-button"
62
- }
63
- ]
64
- },
65
- {
66
- "id": 3,
67
- "name": "ShareButton",
68
- "variant": "declaration",
69
- "kind": 64,
70
- "flags": {},
71
- "sources": [
72
- {
73
- "fileName": "packages/sdk/packages/share/src/ShareButton.tsx",
74
- "line": 14,
75
- "character": 13,
76
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/73696a57f/packages/sdk/packages/share/src/ShareButton.tsx#L14"
77
- }
78
- ],
79
- "signatures": [
80
- {
81
- "id": 4,
82
- "name": "ShareButton",
83
- "variant": "signature",
84
- "kind": 4096,
85
- "flags": {},
86
- "sources": [
87
- {
88
- "fileName": "node_modules/@types/react/ts5.0/index.d.ts",
89
- "line": 525,
90
- "character": 8
91
- }
92
- ],
93
- "parameters": [
94
- {
95
- "id": 5,
96
- "name": "props",
97
- "variant": "param",
98
- "kind": 32768,
99
- "flags": {},
100
- "type": {
101
- "type": "reference",
102
- "target": 1,
103
- "name": "ShareButtonProps",
104
- "package": "@xyo-network/react-share"
105
- }
106
- },
107
- {
108
- "id": 6,
109
- "name": "context",
110
- "variant": "param",
111
- "kind": 32768,
112
- "flags": {
113
- "isOptional": true
114
- },
115
- "type": {
116
- "type": "intrinsic",
117
- "name": "any"
118
- }
119
- }
120
- ],
121
- "type": {
122
- "type": "union",
123
- "types": [
124
- {
125
- "type": "literal",
126
- "value": null
127
- },
128
- {
129
- "type": "reference",
130
- "target": {
131
- "sourceFileName": "../../../../node_modules/@types/react/ts5.0/index.d.ts",
132
- "qualifiedName": "React.ReactElement"
133
- },
134
- "typeArguments": [
135
- {
136
- "type": "intrinsic",
137
- "name": "any"
138
- },
139
- {
140
- "type": "intrinsic",
141
- "name": "any"
142
- }
143
- ],
144
- "name": "ReactElement",
145
- "package": "@types/react",
146
- "qualifiedName": "React.ReactElement"
147
- }
148
- ]
149
- }
150
- }
151
- ]
152
- }
153
- ],
154
- "groups": [
155
- {
156
- "title": "Interfaces",
157
- "children": [
158
- 1
159
- ]
160
- },
161
- {
162
- "title": "Functions",
163
- "children": [
164
- 3
165
- ]
166
- }
167
- ],
168
- "packageName": "@xyo-network/react-share",
169
- "readme": [
170
- {
171
- "kind": "text",
172
- "text": "[![logo][]](https://xyo.network)\n\nPart of [@xyo-network/sdk-xyo-react](https://www.npmjs.com/package/@xyo-network/sdk-xyo-react)\n\n## License\n\n> See the [LICENSE](LICENSE) file for license details\n\n## Credits\n\n[Made with 🔥 and ❄️ by XYO](https://xyo.network)\n\n[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png"
173
- }
174
- ],
175
- "symbolIdMap": {
176
- "0": {
177
- "sourceFileName": "src/index.ts",
178
- "qualifiedName": ""
179
- },
180
- "1": {
181
- "sourceFileName": "src/ShareButton.tsx",
182
- "qualifiedName": "ShareButtonProps"
183
- },
184
- "2": {
185
- "sourceFileName": "src/ShareButton.tsx",
186
- "qualifiedName": "ShareButtonProps.prepared"
187
- },
188
- "3": {
189
- "sourceFileName": "src/ShareButton.tsx",
190
- "qualifiedName": "ShareButton"
191
- },
192
- "4": {
193
- "sourceFileName": "../../../../node_modules/@types/react/ts5.0/index.d.ts",
194
- "qualifiedName": "ShareButton"
195
- },
196
- "5": {
197
- "sourceFileName": "../../../../node_modules/@types/react/ts5.0/index.d.ts",
198
- "qualifiedName": "props"
199
- },
200
- "6": {
201
- "sourceFileName": "../../../../node_modules/@types/react/ts5.0/index.d.ts",
202
- "qualifiedName": "context"
203
- }
204
- }
205
- }