@xyo-network/react-share 2.56.14 → 2.56.16

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.
@@ -11,12 +11,13 @@ const react_button_1 = require("@xylabs/react-button");
11
11
  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
- const ShareButton = (props) => {
14
+ const ShareButton = (_a) => {
15
+ var { prepared = true } = _a, props = tslib_1.__rest(_a, ["prepared"]);
15
16
  const [expanded, setExpanded] = (0, react_1.useState)(false);
16
17
  const anchorRef = (0, react_1.useRef)(null);
17
- 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", onClick: () => {
18
+ 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: () => {
18
19
  setExpanded(true);
19
- } }, 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: expanded, 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: () => {
20
+ } }, 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: () => {
20
21
  window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(window.location.href)}`);
21
22
  setExpanded(false);
22
23
  } }, { 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: () => {
@@ -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;AAEjC,MAAM,WAAW,GAA4B,CAAC,KAAK,EAAE,EAAE;IAC5D,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,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,EAAE,QAAQ,EAAE,SAAS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AAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAC3B,OAAO,EAAE,GAAG,EAAE;gCACZ,MAAM,CAAC,IAAI,CAAC,gDAAgD,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gCACvG,WAAW,CAAC,KAAK,CAAC,CAAA;4BACpB,CAAC,gBAED,uBAAC,kBAAY,IAAC,QAAQ,EAAC,OAAO,GAAG,IAC1B,KACD,IACF,KACF,CACX,CAAA;AACH,CAAC,CAAA;AA5CY,QAAA,WAAW,eA4CvB"}
package/dist/docs.json CHANGED
@@ -7,6 +7,63 @@
7
7
  "children": [
8
8
  {
9
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,
10
67
  "name": "ShareButton",
11
68
  "variant": "declaration",
12
69
  "kind": 64,
@@ -14,14 +71,14 @@
14
71
  "sources": [
15
72
  {
16
73
  "fileName": "packages/sdk/packages/share/src/ShareButton.tsx",
17
- "line": 10,
74
+ "line": 14,
18
75
  "character": 13,
19
- "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/9c7967ef9eeb/packages/sdk/packages/share/src/ShareButton.tsx#L10"
76
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/73696a57f/packages/sdk/packages/share/src/ShareButton.tsx#L14"
20
77
  }
21
78
  ],
22
79
  "signatures": [
23
80
  {
24
- "id": 2,
81
+ "id": 4,
25
82
  "name": "ShareButton",
26
83
  "variant": "signature",
27
84
  "kind": 4096,
@@ -35,23 +92,20 @@
35
92
  ],
36
93
  "parameters": [
37
94
  {
38
- "id": 3,
95
+ "id": 5,
39
96
  "name": "props",
40
97
  "variant": "param",
41
98
  "kind": 32768,
42
99
  "flags": {},
43
100
  "type": {
44
101
  "type": "reference",
45
- "target": {
46
- "sourceFileName": "../../../../node_modules/@xylabs/react-button/src/components/ButtonExProps.tsx",
47
- "qualifiedName": "ButtonExProps"
48
- },
49
- "name": "ButtonExProps",
50
- "package": "@xylabs/react-button"
102
+ "target": 1,
103
+ "name": "ShareButtonProps",
104
+ "package": "@xyo-network/react-share"
51
105
  }
52
106
  },
53
107
  {
54
- "id": 4,
108
+ "id": 6,
55
109
  "name": "context",
56
110
  "variant": "param",
57
111
  "kind": 32768,
@@ -99,10 +153,16 @@
99
153
  ],
100
154
  "groups": [
101
155
  {
102
- "title": "Functions",
156
+ "title": "Interfaces",
103
157
  "children": [
104
158
  1
105
159
  ]
160
+ },
161
+ {
162
+ "title": "Functions",
163
+ "children": [
164
+ 3
165
+ ]
106
166
  }
107
167
  ],
108
168
  "packageName": "@xyo-network/react-share",
@@ -119,17 +179,25 @@
119
179
  },
120
180
  "1": {
121
181
  "sourceFileName": "src/ShareButton.tsx",
122
- "qualifiedName": "ShareButton"
182
+ "qualifiedName": "ShareButtonProps"
123
183
  },
124
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": {
125
193
  "sourceFileName": "../../../../node_modules/@types/react/ts5.0/index.d.ts",
126
194
  "qualifiedName": "ShareButton"
127
195
  },
128
- "3": {
196
+ "5": {
129
197
  "sourceFileName": "../../../../node_modules/@types/react/ts5.0/index.d.ts",
130
198
  "qualifiedName": "props"
131
199
  },
132
- "4": {
200
+ "6": {
133
201
  "sourceFileName": "../../../../node_modules/@types/react/ts5.0/index.d.ts",
134
202
  "qualifiedName": "context"
135
203
  }
@@ -7,12 +7,12 @@ 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 = (props) => {
10
+ export const ShareButton = ({ prepared = true, ...props }) => {
11
11
  const [expanded, setExpanded] = useState(false);
12
12
  const anchorRef = useRef(null);
13
- return (_jsxs(FlexRow, { gap: 1, ref: anchorRef, children: [_jsx(ButtonEx, { variant: "text", minWidth: 32, size: "small", onClick: () => {
13
+ return (_jsxs(FlexRow, { gap: 1, ref: anchorRef, children: [_jsx(ButtonEx, { variant: "text", minWidth: 32, size: "small", disabled: !prepared, onClick: () => {
14
14
  setExpanded(true);
15
- }, ...props, children: _jsx(ShareIcon, { htmlColor: "gray", fontSize: "small" }) }), _jsx(Popover, { open: expanded, 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: () => {
15
+ }, ...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
16
  window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(window.location.href)}`);
17
17
  setExpanded(false);
18
18
  }, children: _jsx(TwitterIcon, { fontSize: "small" }) }), _jsx(LinkEx, { lineHeight: 0, style: { color: '#4267b2' }, onClick: () => {
@@ -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;AAExC,MAAM,CAAC,MAAM,WAAW,GAA4B,CAAC,KAAK,EAAE,EAAE;IAC5D,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,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kB,EAAE,GAAG,YACjI,MAAC,OAAO,IAAC,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,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gCAC/F,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,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gCACvG,WAAW,CAAC,KAAK,CAAC,CAAA;4BACpB,CAAC,YAED,KAAC,YAAY,IAAC,QAAQ,EAAC,OAAO,GAAG,GAC1B,IACD,GACF,IACF,CACX,CAAA;AACH,CAAC,CAAA"}
@@ -1,4 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ButtonExProps } from '@xylabs/react-button';
3
- export declare const ShareButton: React.FC<ButtonExProps>;
3
+ export interface ShareButtonProps extends ButtonExProps {
4
+ prepared?: boolean;
5
+ }
6
+ export declare const ShareButton: React.FC<ShareButtonProps>;
4
7
  //# 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,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA2C/C,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;CACnB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA4ClD,CAAA"}
package/package.json CHANGED
@@ -25,7 +25,8 @@
25
25
  "react-router-dom": "^6"
26
26
  },
27
27
  "devDependencies": {
28
- "@xylabs/ts-scripts-yarn3": "^2.18.7",
28
+ "@storybook/react": "^7.0.26",
29
+ "@xylabs/ts-scripts-yarn3": "^2.18.10",
29
30
  "typescript": "^5.1.6"
30
31
  },
31
32
  "description": "Common React library for all XYO projects that use React",
@@ -71,5 +72,5 @@
71
72
  },
72
73
  "sideEffects": false,
73
74
  "types": "dist/types/index.d.ts",
74
- "version": "2.56.14"
75
+ "version": "2.56.16"
75
76
  }
@@ -0,0 +1,19 @@
1
+ import { Meta, StoryFn } from '@storybook/react'
2
+
3
+ import { ShareButton } from './ShareButton'
4
+
5
+ // eslint-disable-next-line import/no-default-export
6
+ export default {
7
+ title: 'modules/ShareButton',
8
+ } as Meta<typeof ShareButton>
9
+
10
+ const Template: StoryFn<typeof ShareButton> = (props) => {
11
+ return <ShareButton {...props} />
12
+ }
13
+
14
+ const Default = Template.bind({})
15
+ Default.args = {}
16
+ const WithUnPrepared = Template.bind({})
17
+ WithUnPrepared.args = { prepared: false }
18
+
19
+ export { Default, WithUnPrepared }
@@ -7,7 +7,11 @@ import { FlexRow } from '@xylabs/react-flexbox'
7
7
  import { LinkEx } from '@xylabs/react-link'
8
8
  import { useRef, useState } from 'react'
9
9
 
10
- export const ShareButton: React.FC<ButtonExProps> = (props) => {
10
+ export interface ShareButtonProps extends ButtonExProps {
11
+ prepared?: boolean
12
+ }
13
+
14
+ export const ShareButton: React.FC<ShareButtonProps> = ({ prepared = true, ...props }) => {
11
15
  const [expanded, setExpanded] = useState(false)
12
16
  const anchorRef = useRef(null)
13
17
 
@@ -17,6 +21,7 @@ export const ShareButton: React.FC<ButtonExProps> = (props) => {
17
21
  variant="text"
18
22
  minWidth={32}
19
23
  size="small"
24
+ disabled={!prepared}
20
25
  onClick={() => {
21
26
  setExpanded(true)
22
27
  }}
@@ -24,7 +29,7 @@ export const ShareButton: React.FC<ButtonExProps> = (props) => {
24
29
  >
25
30
  <ShareIcon htmlColor="gray" fontSize="small" />
26
31
  </ButtonEx>
27
- <Popover open={expanded} anchorEl={anchorRef.current} onClose={() => setExpanded(false)} transitionDuration={500}>
32
+ <Popover open={prepared ? expanded : false} anchorEl={anchorRef.current} onClose={() => setExpanded(false)} transitionDuration={500}>
28
33
  <FlexRow gap={0.5} padding={0.5}>
29
34
  <LinkEx
30
35
  lineHeight={0}