@xyo-network/react-wallet 2.25.59 → 2.25.62
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/esm/components/WalletAccountSelect/Select.js +3 -4
- package/dist/esm/components/WalletAccountSelect/Select.js.map +1 -1
- package/package.json +7 -7
- package/src/components/WalletAccountSelect/Select.tsx +2 -7
- package/src/components/WalletAccountSelect/WalletAccountSelectWithProvider.stories.tsx +5 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { MenuItem
|
|
2
|
+
import { MenuItem } from '@mui/material';
|
|
3
3
|
import { SelectEx } from '@xylabs/react-common';
|
|
4
4
|
import { EthAccountBox } from '@xylabs/react-crypto';
|
|
5
5
|
import { EthAddress } from '@xylabs/sdk-js';
|
|
@@ -9,10 +9,9 @@ const arrayRange = (length, start = 0) => {
|
|
|
9
9
|
};
|
|
10
10
|
export const WalletAccountSelect = ({ size, iconSize, icons, iconOnly, ...props }) => {
|
|
11
11
|
const { wallet, activeAccountIndex = 0, setActiveAccountIndex } = useWallet();
|
|
12
|
-
|
|
13
|
-
return (_jsx(SelectEx, { SelectDisplayProps: { style: { paddingBottom: 0, paddingLeft: icons ? 0 : theme.spacing(1), paddingTop: 0 } }, renderValue: (selected) => {
|
|
12
|
+
return (_jsx(SelectEx, { renderValue: (selected) => {
|
|
14
13
|
const account = wallet?.getAccount(parseInt(`${selected}`));
|
|
15
|
-
return
|
|
14
|
+
return _jsx(EthAccountBox, { alignItems: "stretch", iconOnly: iconOnly, icon: icons, address: EthAddress.fromString(account?.addressValue.hex) });
|
|
16
15
|
}, value: activeAccountIndex, onChange: (event) => setActiveAccountIndex?.(parseInt(`${event.target.value}`)), size: size, variant: "outlined", ...props, children: wallet
|
|
17
16
|
? arrayRange(10).map((index) => {
|
|
18
17
|
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,
|
|
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,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;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAuC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACvH,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,CAAC,EAAE,qBAAqB,EAAE,GAAG,SAAS,EAAE,CAAA;IAE7E,OAAO,CACL,KAAC,QAAQ,IACP,WAAW,EAAE,CAAC,QAAQ,EAAE,EAAE;YACxB,MAAM,OAAO,GAAG,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAA;YAC3D,OAAO,KAAC,aAAa,IAAC,UAAU,EAAC,SAAS,EAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,GAAI,CAAA;QAC3I,CAAC,EACD,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,EAAE,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,EAC/E,IAAI,EAAE,IAAI,EACV,OAAO,EAAC,UAAU,KACd,KAAK,YAER,MAAM;YACL,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC3B,MAAM,OAAO,GAAG,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,CAAA;gBACzC,OAAO,CACL,KAAC,QAAQ,IAAa,KAAK,EAAE,KAAK,YAChC,KAAC,aAAa,IAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,GAAI,IAD/F,KAAK,CAET,CACZ,CAAA;YACH,CAAC,CAAC;YACJ,CAAC,CAAC,IAAI,GACC,CACZ,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"@emotion/react": "^11.9.3",
|
|
14
14
|
"@emotion/styled": "^11.9.3",
|
|
15
15
|
"@mui/material": "^5.8.3",
|
|
16
|
-
"@xylabs/react-common": "^2.12.
|
|
17
|
-
"@xylabs/react-crypto": "^2.12.
|
|
18
|
-
"@xylabs/react-flexbox": "^2.12.
|
|
19
|
-
"@xylabs/react-shared": "^2.12.
|
|
16
|
+
"@xylabs/react-common": "^2.12.24",
|
|
17
|
+
"@xylabs/react-crypto": "^2.12.24",
|
|
18
|
+
"@xylabs/react-flexbox": "^2.12.24",
|
|
19
|
+
"@xylabs/react-shared": "^2.12.24",
|
|
20
20
|
"@xylabs/sdk-js": "^2.5.7",
|
|
21
21
|
"@xyo-network/core": "^2.20.45",
|
|
22
|
-
"@xyo-network/react-network": "^2.25.
|
|
23
|
-
"@xyo-network/react-shared": "^2.25.
|
|
22
|
+
"@xyo-network/react-network": "^2.25.62",
|
|
23
|
+
"@xyo-network/react-shared": "^2.25.62",
|
|
24
24
|
"react": "^18.1.0",
|
|
25
25
|
"react-dom": "^18.1.0",
|
|
26
26
|
"react-router-dom": "^6.3.0",
|
|
@@ -83,6 +83,6 @@
|
|
|
83
83
|
},
|
|
84
84
|
"sideEffects": false,
|
|
85
85
|
"types": "dist/esm/index.d.ts",
|
|
86
|
-
"version": "2.25.
|
|
86
|
+
"version": "2.25.62",
|
|
87
87
|
"packageManager": "yarn@3.1.1"
|
|
88
88
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuItem, SelectProps
|
|
1
|
+
import { MenuItem, SelectProps } from '@mui/material'
|
|
2
2
|
import { SelectEx } from '@xylabs/react-common'
|
|
3
3
|
import { EthAccountBox } from '@xylabs/react-crypto'
|
|
4
4
|
import { EthAddress } from '@xylabs/sdk-js'
|
|
@@ -18,16 +18,11 @@ const arrayRange = (length: number, start = 0) => {
|
|
|
18
18
|
export const WalletAccountSelect: React.FC<WalletAccountSelectProps> = ({ size, iconSize, icons, iconOnly, ...props }) => {
|
|
19
19
|
const { wallet, activeAccountIndex = 0, setActiveAccountIndex } = useWallet()
|
|
20
20
|
|
|
21
|
-
const theme = useTheme()
|
|
22
|
-
|
|
23
21
|
return (
|
|
24
22
|
<SelectEx
|
|
25
|
-
SelectDisplayProps={{ style: { paddingBottom: 0, paddingLeft: icons ? 0 : theme.spacing(1), paddingTop: 0 } }}
|
|
26
23
|
renderValue={(selected) => {
|
|
27
24
|
const account = wallet?.getAccount(parseInt(`${selected}`))
|
|
28
|
-
return (
|
|
29
|
-
<EthAccountBox alignItems="stretch" height={size === 'small' ? 40 : 56} iconOnly={iconOnly} icon={icons} address={EthAddress.fromString(account?.addressValue.hex)} />
|
|
30
|
-
)
|
|
25
|
+
return <EthAccountBox alignItems="stretch" iconOnly={iconOnly} icon={icons} address={EthAddress.fromString(account?.addressValue.hex)} />
|
|
31
26
|
}}
|
|
32
27
|
value={activeAccountIndex}
|
|
33
28
|
onChange={(event) => setActiveAccountIndex?.(parseInt(`${event.target.value}`))}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable import/no-internal-modules */
|
|
2
1
|
import { ComponentMeta, ComponentStory } from '@storybook/react'
|
|
3
2
|
import { XyoWalletBase } from '@xyo-network/core'
|
|
4
3
|
|
|
@@ -25,7 +24,10 @@ const Template: ComponentStory<typeof WalletAccountSelect> = (args) => {
|
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
const Default = Template.bind({})
|
|
28
|
-
Default.args = {
|
|
27
|
+
Default.args = {}
|
|
28
|
+
|
|
29
|
+
const DefaultIcons = Template.bind({})
|
|
30
|
+
DefaultIcons.args = { icons: true }
|
|
29
31
|
|
|
30
32
|
const DefaultSmall = Template.bind({})
|
|
31
33
|
DefaultSmall.args = { size: 'small' }
|
|
@@ -39,7 +41,7 @@ IconsOnly.args = { iconOnly: true, icons: true }
|
|
|
39
41
|
const IconsOnlySmall = Template.bind({})
|
|
40
42
|
IconsOnlySmall.args = { iconOnly: true, icons: true, size: 'small' }
|
|
41
43
|
|
|
42
|
-
export { Default, DefaultSmall, DefaultSmallIcon, IconsOnly, IconsOnlySmall }
|
|
44
|
+
export { Default, DefaultIcons, DefaultSmall, DefaultSmallIcon, IconsOnly, IconsOnlySmall }
|
|
43
45
|
|
|
44
46
|
// eslint-disable-next-line import/no-default-export
|
|
45
47
|
export default StorybookEntry
|