@xyo-network/react-wallet 2.25.61 → 2.25.64
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/cjs/components/WalletAccountSelect/Select.js +2 -3
- package/dist/cjs/components/WalletAccountSelect/Select.js.map +1 -1
- package/dist/esm/components/WalletAccountSelect/Select.js +5 -3
- package/dist/esm/components/WalletAccountSelect/Select.js.map +1 -1
- package/package.json +13 -12
- package/src/components/WalletAccountSelect/Select.tsx +13 -2
- package/src/components/WalletAccountSelect/WalletAccountSelectBar.stories.tsx +4 -1
|
@@ -14,10 +14,9 @@ const arrayRange = (length, start = 0) => {
|
|
|
14
14
|
const WalletAccountSelect = (_a) => {
|
|
15
15
|
var { size, iconSize, icons, iconOnly } = _a, props = tslib_1.__rest(_a, ["size", "iconSize", "icons", "iconOnly"]);
|
|
16
16
|
const { wallet, activeAccountIndex = 0, setActiveAccountIndex } = (0, contexts_1.useWallet)();
|
|
17
|
-
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)(react_common_1.SelectEx, Object.assign({ SelectDisplayProps: { style: { paddingBottom: 0, paddingLeft: icons ? 0 : theme.spacing(1), paddingTop: 0 } }, renderValue: (selected) => {
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(react_common_1.SelectEx, Object.assign({ renderValue: (selected) => {
|
|
19
18
|
const account = wallet === null || wallet === void 0 ? void 0 : wallet.getAccount(parseInt(`${selected}`));
|
|
20
|
-
return (
|
|
19
|
+
return (0, jsx_runtime_1.jsx)(react_crypto_1.EthAccountBox, { alignItems: "stretch", iconOnly: iconOnly, icon: icons, address: sdk_js_1.EthAddress.fromString(account === null || account === void 0 ? void 0 : account.addressValue.hex) });
|
|
21
20
|
}, value: activeAccountIndex, onChange: (event) => setActiveAccountIndex === null || setActiveAccountIndex === void 0 ? void 0 : setActiveAccountIndex(parseInt(`${event.target.value}`)), size: size, variant: "outlined" }, props, { children: wallet
|
|
22
21
|
? arrayRange(10).map((index) => {
|
|
23
22
|
const account = wallet === null || wallet === void 0 ? void 0 : wallet.getAccount(index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../../src/components/WalletAccountSelect/Select.tsx"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../../src/components/WalletAccountSelect/Select.tsx"],"names":[],"mappings":";;;;;AAAA,4CAAqD;AACrD,uDAA+C;AAC/C,uDAAoD;AACpD,2CAA2C;AAE3C,6CAA0C;AAQ1C,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAA;AAC/D,CAAC,CAAA;AAEM,MAAM,mBAAmB,GAAuC,CAAC,EAA6C,EAAE,EAAE;QAAjD,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,OAAY,EAAP,KAAK,sBAA3C,yCAA6C,CAAF;IACjH,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,CAAC,EAAE,qBAAqB,EAAE,GAAG,IAAA,oBAAS,GAAE,CAAA;IAE7E,OAAO,CACL,uBAAC,uBAAQ,kBACP,WAAW,EAAE,CAAC,QAAQ,EAAE,EAAE;YACxB,MAAM,OAAO,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAA;YAC3D,OAAO,uBAAC,4BAAa,IAAC,UAAU,EAAC,SAAS,EAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,mBAAU,CAAC,UAAU,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,CAAC,GAAG,CAAC,GAAI,CAAA;QAC3I,CAAC,EACD,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAG,QAAQ,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,EAC/E,IAAI,EAAE,IAAI,EACV,OAAO,EAAC,UAAU,IACd,KAAK,cAER,MAAM;YACL,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC3B,MAAM,OAAO,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAC,KAAK,CAAC,CAAA;gBACzC,OAAO,CACL,uBAAC,mBAAQ,kBAAa,KAAK,EAAE,KAAK,gBAChC,uBAAC,4BAAa,IAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,mBAAU,CAAC,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,GAAI,KAD/F,KAAK,CAET,CACZ,CAAA;YACH,CAAC,CAAC;YACJ,CAAC,CAAC,IAAI,IACC,CACZ,CAAA;AACH,CAAC,CAAA;AA3BY,QAAA,mBAAmB,uBA2B/B"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { MenuItem } from '@mui/material';
|
|
3
3
|
import { SelectEx } from '@xylabs/react-common';
|
|
4
4
|
import { EthAccountBox } from '@xylabs/react-crypto';
|
|
5
|
+
import { FlexRow } from '@xylabs/react-flexbox';
|
|
6
|
+
import { Identicon } from '@xylabs/react-identicon';
|
|
5
7
|
import { EthAddress } from '@xylabs/sdk-js';
|
|
6
8
|
import { useWallet } from '../../contexts';
|
|
7
9
|
const arrayRange = (length, start = 0) => {
|
|
8
10
|
return Array.from(Array(length).keys()).map((x) => x + start);
|
|
9
11
|
};
|
|
10
|
-
export const WalletAccountSelect = ({ size, iconSize, icons, iconOnly, ...props }) => {
|
|
12
|
+
export const WalletAccountSelect = ({ size, iconSize = 24, icons, iconOnly, ...props }) => {
|
|
11
13
|
const { wallet, activeAccountIndex = 0, setActiveAccountIndex } = useWallet();
|
|
12
14
|
return (_jsx(SelectEx, { renderValue: (selected) => {
|
|
13
15
|
const account = wallet?.getAccount(parseInt(`${selected}`));
|
|
14
|
-
return _jsx(EthAccountBox, { alignItems: "stretch", iconOnly: iconOnly,
|
|
16
|
+
return (_jsxs(FlexRow, { justifyContent: "flex-start", gap: 1, children: [icons ? (_jsx(FlexRow, { children: _jsx(Identicon, { size: iconSize, value: account?.addressValue.hex }) })) : null, _jsx(EthAccountBox, { alignItems: "stretch", iconOnly: iconOnly, address: EthAddress.fromString(account?.addressValue.hex) })] }));
|
|
15
17
|
}, value: activeAccountIndex, onChange: (event) => setActiveAccountIndex?.(parseInt(`${event.target.value}`)), size: size, variant: "outlined", ...props, children: wallet
|
|
16
18
|
? arrayRange(10).map((index) => {
|
|
17
19
|
const account = wallet?.getAccount(index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../../src/components/WalletAccountSelect/Select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAe,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAQ1C,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,KAAK,GAAG,CAAC,EAAE,EAAE;IAC/C,OAAO,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,CACZ,CAAA;YACH,CAAC,CAAC;YACJ,CAAC,CAAC,IAAI,GACC,CACZ,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -12,17 +12,18 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@emotion/react": "^11.9.3",
|
|
14
14
|
"@emotion/styled": "^11.9.3",
|
|
15
|
-
"@mui/material": "^5.8.
|
|
16
|
-
"@xylabs/react-common": "^2.
|
|
17
|
-
"@xylabs/react-crypto": "^2.
|
|
18
|
-
"@xylabs/react-flexbox": "^2.
|
|
19
|
-
"@xylabs/react-
|
|
15
|
+
"@mui/material": "^5.8.4",
|
|
16
|
+
"@xylabs/react-common": "^2.14.3",
|
|
17
|
+
"@xylabs/react-crypto": "^2.14.3",
|
|
18
|
+
"@xylabs/react-flexbox": "^2.14.3",
|
|
19
|
+
"@xylabs/react-identicon": "^2.14.3",
|
|
20
|
+
"@xylabs/react-shared": "^2.14.3",
|
|
20
21
|
"@xylabs/sdk-js": "^2.5.7",
|
|
21
22
|
"@xyo-network/core": "^2.20.45",
|
|
22
|
-
"@xyo-network/react-network": "^2.25.
|
|
23
|
-
"@xyo-network/react-shared": "^2.25.
|
|
24
|
-
"react": "^18.
|
|
25
|
-
"react-dom": "^18.
|
|
23
|
+
"@xyo-network/react-network": "^2.25.64",
|
|
24
|
+
"@xyo-network/react-shared": "^2.25.64",
|
|
25
|
+
"react": "^18.2.0",
|
|
26
|
+
"react-dom": "^18.2.0",
|
|
26
27
|
"react-router-dom": "^6.3.0",
|
|
27
28
|
"tslib": "^2.4.0"
|
|
28
29
|
},
|
|
@@ -66,8 +67,8 @@
|
|
|
66
67
|
"resolutions": {
|
|
67
68
|
"@storybook/react/webpack": "^5",
|
|
68
69
|
"bn.js": "^5.2.0",
|
|
69
|
-
"react": "^18.
|
|
70
|
-
"react-dom": "^18.
|
|
70
|
+
"react": "^18.2.0",
|
|
71
|
+
"react-dom": "^18.2.0",
|
|
71
72
|
"webpack": "^5"
|
|
72
73
|
},
|
|
73
74
|
"publishConfig": {
|
|
@@ -83,6 +84,6 @@
|
|
|
83
84
|
},
|
|
84
85
|
"sideEffects": false,
|
|
85
86
|
"types": "dist/esm/index.d.ts",
|
|
86
|
-
"version": "2.25.
|
|
87
|
+
"version": "2.25.64",
|
|
87
88
|
"packageManager": "yarn@3.1.1"
|
|
88
89
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { MenuItem, SelectProps } from '@mui/material'
|
|
2
2
|
import { SelectEx } from '@xylabs/react-common'
|
|
3
3
|
import { EthAccountBox } from '@xylabs/react-crypto'
|
|
4
|
+
import { FlexRow } from '@xylabs/react-flexbox'
|
|
5
|
+
import { Identicon } from '@xylabs/react-identicon'
|
|
4
6
|
import { EthAddress } from '@xylabs/sdk-js'
|
|
5
7
|
|
|
6
8
|
import { useWallet } from '../../contexts'
|
|
@@ -15,14 +17,23 @@ const arrayRange = (length: number, start = 0) => {
|
|
|
15
17
|
return Array.from(Array(length).keys()).map((x) => x + start)
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
export const WalletAccountSelect: React.FC<WalletAccountSelectProps> = ({ size, iconSize, icons, iconOnly, ...props }) => {
|
|
20
|
+
export const WalletAccountSelect: React.FC<WalletAccountSelectProps> = ({ size, iconSize = 24, icons, iconOnly, ...props }) => {
|
|
19
21
|
const { wallet, activeAccountIndex = 0, setActiveAccountIndex } = useWallet()
|
|
20
22
|
|
|
21
23
|
return (
|
|
22
24
|
<SelectEx
|
|
23
25
|
renderValue={(selected) => {
|
|
24
26
|
const account = wallet?.getAccount(parseInt(`${selected}`))
|
|
25
|
-
return
|
|
27
|
+
return (
|
|
28
|
+
<FlexRow justifyContent="flex-start" gap={1}>
|
|
29
|
+
{icons ? (
|
|
30
|
+
<FlexRow>
|
|
31
|
+
<Identicon size={iconSize} value={account?.addressValue.hex} />
|
|
32
|
+
</FlexRow>
|
|
33
|
+
) : null}
|
|
34
|
+
<EthAccountBox alignItems="stretch" iconOnly={iconOnly} address={EthAddress.fromString(account?.addressValue.hex)} />
|
|
35
|
+
</FlexRow>
|
|
36
|
+
)
|
|
26
37
|
}}
|
|
27
38
|
value={activeAccountIndex}
|
|
28
39
|
onChange={(event) => setActiveAccountIndex?.(parseInt(`${event.target.value}`))}
|
|
@@ -34,7 +34,10 @@ Default.args = {}
|
|
|
34
34
|
const WithWallet = WithWalletTemplate.bind({})
|
|
35
35
|
WithWallet.args = {}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
const WithWalletIcon = WithWalletTemplate.bind({})
|
|
38
|
+
WithWalletIcon.args = { icons: true }
|
|
39
|
+
|
|
40
|
+
export { Default, WithWallet, WithWalletIcon }
|
|
38
41
|
|
|
39
42
|
// eslint-disable-next-line import/no-default-export
|
|
40
43
|
export default StorybookEntry
|