@aptos-labs/wallet-adapter-mui-design 2.6.0 → 2.7.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.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.ts +15 -4
- package/dist/index.js +13 -3
- package/dist/index.mjs +13 -3
- package/package.json +2 -2
- package/src/WalletConnector.tsx +17 -2
- package/src/WalletModel.tsx +12 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @aptos-labs/wallet-adapter-mui-design
|
|
2
2
|
|
|
3
|
+
## 2.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5bcae5e: Added `sortDefaultWallets` and `sortMoreWallets` props to `WalletConnector`.
|
|
8
|
+
- 5bcae5e: Exposed `WalletConnectorProps` interface.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [07ee265]
|
|
13
|
+
- @aptos-labs/wallet-adapter-react@3.3.0
|
|
14
|
+
|
|
3
15
|
## 2.6.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { AnyAptosWallet } from '@aptos-labs/wallet-adapter-react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
interface WalletConnectorProps {
|
|
4
5
|
networkSupport?: string;
|
|
5
6
|
handleNavigate?: () => void;
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* An optional function for sorting wallets that are currently installed or
|
|
9
|
+
* loadable in the wallet connector modal.
|
|
10
|
+
*/
|
|
11
|
+
sortDefaultWallets?: (a: AnyAptosWallet, b: AnyAptosWallet) => number;
|
|
12
|
+
/**
|
|
13
|
+
* An optional function for sorting wallets that are NOT currently installed or
|
|
14
|
+
* loadable in the wallet connector modal.
|
|
15
|
+
*/
|
|
16
|
+
sortMoreWallets?: (a: AnyAptosWallet, b: AnyAptosWallet) => number;
|
|
17
|
+
}
|
|
18
|
+
declare function WalletConnector({ networkSupport, handleNavigate, sortDefaultWallets, sortMoreWallets, }: WalletConnectorProps): react_jsx_runtime.JSX.Element;
|
|
8
19
|
|
|
9
|
-
export { WalletConnector };
|
|
20
|
+
export { WalletConnector, WalletConnectorProps };
|
package/dist/index.js
CHANGED
|
@@ -201,7 +201,9 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
201
201
|
function WalletsModal({
|
|
202
202
|
handleClose,
|
|
203
203
|
modalOpen,
|
|
204
|
-
networkSupport
|
|
204
|
+
networkSupport,
|
|
205
|
+
sortDefaultWallets,
|
|
206
|
+
sortMoreWallets
|
|
205
207
|
}) {
|
|
206
208
|
const theme = (0, import_material3.useTheme)();
|
|
207
209
|
const [expanded, setExpanded] = (0, import_react3.useState)(false);
|
|
@@ -214,6 +216,10 @@ function WalletsModal({
|
|
|
214
216
|
defaultWallets,
|
|
215
217
|
moreWallets
|
|
216
218
|
} = (0, import_wallet_adapter_react3.partitionWallets)(otherWallets);
|
|
219
|
+
if (sortDefaultWallets)
|
|
220
|
+
defaultWallets.sort(sortDefaultWallets);
|
|
221
|
+
if (sortMoreWallets)
|
|
222
|
+
moreWallets.sort(sortMoreWallets);
|
|
217
223
|
const hasAptosConnectWallets = !!aptosConnectWallets.length;
|
|
218
224
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material3.Dialog, {
|
|
219
225
|
open: modalOpen,
|
|
@@ -424,7 +430,9 @@ function AptosConnectWalletRow({ wallet, onConnect }) {
|
|
|
424
430
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
425
431
|
function WalletConnector({
|
|
426
432
|
networkSupport,
|
|
427
|
-
handleNavigate
|
|
433
|
+
handleNavigate,
|
|
434
|
+
sortDefaultWallets,
|
|
435
|
+
sortMoreWallets
|
|
428
436
|
}) {
|
|
429
437
|
const [modalOpen, setModalOpen] = (0, import_react4.useState)(false);
|
|
430
438
|
const handleModalOpen = () => setModalOpen(true);
|
|
@@ -438,7 +446,9 @@ function WalletConnector({
|
|
|
438
446
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(WalletsModal, {
|
|
439
447
|
handleClose,
|
|
440
448
|
modalOpen,
|
|
441
|
-
networkSupport
|
|
449
|
+
networkSupport,
|
|
450
|
+
sortDefaultWallets,
|
|
451
|
+
sortMoreWallets
|
|
442
452
|
})
|
|
443
453
|
]
|
|
444
454
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -204,7 +204,9 @@ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-run
|
|
|
204
204
|
function WalletsModal({
|
|
205
205
|
handleClose,
|
|
206
206
|
modalOpen,
|
|
207
|
-
networkSupport
|
|
207
|
+
networkSupport,
|
|
208
|
+
sortDefaultWallets,
|
|
209
|
+
sortMoreWallets
|
|
208
210
|
}) {
|
|
209
211
|
const theme = useTheme();
|
|
210
212
|
const [expanded, setExpanded] = useState3(false);
|
|
@@ -217,6 +219,10 @@ function WalletsModal({
|
|
|
217
219
|
defaultWallets,
|
|
218
220
|
moreWallets
|
|
219
221
|
} = partitionWallets(otherWallets);
|
|
222
|
+
if (sortDefaultWallets)
|
|
223
|
+
defaultWallets.sort(sortDefaultWallets);
|
|
224
|
+
if (sortMoreWallets)
|
|
225
|
+
moreWallets.sort(sortMoreWallets);
|
|
220
226
|
const hasAptosConnectWallets = !!aptosConnectWallets.length;
|
|
221
227
|
return /* @__PURE__ */ jsx3(Dialog, {
|
|
222
228
|
open: modalOpen,
|
|
@@ -427,7 +433,9 @@ function AptosConnectWalletRow({ wallet, onConnect }) {
|
|
|
427
433
|
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
428
434
|
function WalletConnector({
|
|
429
435
|
networkSupport,
|
|
430
|
-
handleNavigate
|
|
436
|
+
handleNavigate,
|
|
437
|
+
sortDefaultWallets,
|
|
438
|
+
sortMoreWallets
|
|
431
439
|
}) {
|
|
432
440
|
const [modalOpen, setModalOpen] = useState4(false);
|
|
433
441
|
const handleModalOpen = () => setModalOpen(true);
|
|
@@ -441,7 +449,9 @@ function WalletConnector({
|
|
|
441
449
|
/* @__PURE__ */ jsx4(WalletsModal, {
|
|
442
450
|
handleClose,
|
|
443
451
|
modalOpen,
|
|
444
|
-
networkSupport
|
|
452
|
+
networkSupport,
|
|
453
|
+
sortDefaultWallets,
|
|
454
|
+
sortMoreWallets
|
|
445
455
|
})
|
|
446
456
|
]
|
|
447
457
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-labs/wallet-adapter-mui-design",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Aptos Wallet Adapter mui design",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@emotion/styled": "^11.10.5",
|
|
42
42
|
"@mui/icons-material": "^5.11.0",
|
|
43
43
|
"@mui/material": "^5.11.6",
|
|
44
|
-
"@aptos-labs/wallet-adapter-react": "3.
|
|
44
|
+
"@aptos-labs/wallet-adapter-react": "3.3.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^18",
|
package/src/WalletConnector.tsx
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
|
+
import { AnyAptosWallet } from "@aptos-labs/wallet-adapter-react";
|
|
1
2
|
import { useState } from "react";
|
|
2
3
|
import WalletButton from "./WalletButton";
|
|
3
4
|
import WalletsModal from "./WalletModel";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
export interface WalletConnectorProps {
|
|
6
7
|
networkSupport?: string;
|
|
7
8
|
handleNavigate?: () => void;
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* An optional function for sorting wallets that are currently installed or
|
|
11
|
+
* loadable in the wallet connector modal.
|
|
12
|
+
*/
|
|
13
|
+
sortDefaultWallets?: (a: AnyAptosWallet, b: AnyAptosWallet) => number;
|
|
14
|
+
/**
|
|
15
|
+
* An optional function for sorting wallets that are NOT currently installed or
|
|
16
|
+
* loadable in the wallet connector modal.
|
|
17
|
+
*/
|
|
18
|
+
sortMoreWallets?: (a: AnyAptosWallet, b: AnyAptosWallet) => number;
|
|
19
|
+
}
|
|
9
20
|
|
|
10
21
|
export function WalletConnector({
|
|
11
22
|
networkSupport,
|
|
12
23
|
handleNavigate,
|
|
24
|
+
sortDefaultWallets,
|
|
25
|
+
sortMoreWallets,
|
|
13
26
|
}: WalletConnectorProps) {
|
|
14
27
|
const [modalOpen, setModalOpen] = useState(false);
|
|
15
28
|
const handleModalOpen = () => setModalOpen(true);
|
|
@@ -25,6 +38,8 @@ export function WalletConnector({
|
|
|
25
38
|
handleClose={handleClose}
|
|
26
39
|
modalOpen={modalOpen}
|
|
27
40
|
networkSupport={networkSupport}
|
|
41
|
+
sortDefaultWallets={sortDefaultWallets}
|
|
42
|
+
sortMoreWallets={sortMoreWallets}
|
|
28
43
|
/>
|
|
29
44
|
</>
|
|
30
45
|
);
|
package/src/WalletModel.tsx
CHANGED
|
@@ -27,17 +27,23 @@ import {
|
|
|
27
27
|
LanOutlined as LanOutlinedIcon,
|
|
28
28
|
} from "@mui/icons-material";
|
|
29
29
|
import { useState } from "react";
|
|
30
|
+
import { WalletConnectorProps } from "./WalletConnector";
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
interface WalletsModalProps
|
|
33
|
+
extends Pick<
|
|
34
|
+
WalletConnectorProps,
|
|
35
|
+
"networkSupport" | "sortDefaultWallets" | "sortMoreWallets"
|
|
36
|
+
> {
|
|
32
37
|
handleClose: () => void;
|
|
33
38
|
modalOpen: boolean;
|
|
34
|
-
|
|
35
|
-
};
|
|
39
|
+
}
|
|
36
40
|
|
|
37
41
|
export default function WalletsModal({
|
|
38
42
|
handleClose,
|
|
39
43
|
modalOpen,
|
|
40
44
|
networkSupport,
|
|
45
|
+
sortDefaultWallets,
|
|
46
|
+
sortMoreWallets,
|
|
41
47
|
}: WalletsModalProps): JSX.Element {
|
|
42
48
|
const theme = useTheme();
|
|
43
49
|
const [expanded, setExpanded] = useState(false);
|
|
@@ -58,6 +64,9 @@ export default function WalletsModal({
|
|
|
58
64
|
moreWallets,
|
|
59
65
|
} = partitionWallets(otherWallets);
|
|
60
66
|
|
|
67
|
+
if (sortDefaultWallets) defaultWallets.sort(sortDefaultWallets);
|
|
68
|
+
if (sortMoreWallets) moreWallets.sort(sortMoreWallets);
|
|
69
|
+
|
|
61
70
|
const hasAptosConnectWallets = !!aptosConnectWallets.length;
|
|
62
71
|
|
|
63
72
|
return (
|