@aptos-labs/wallet-adapter-ant-design 1.2.0 → 1.2.2
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 +4 -1
- package/dist/index.js +15 -2
- package/dist/index.mjs +15 -2
- package/package.json +1 -1
- package/src/WalletSelector.tsx +17 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @aptos-labs/wallet-adapter-ant-design
|
|
2
2
|
|
|
3
|
+
## 1.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a42a197: add action to control modal open or not
|
|
8
|
+
|
|
9
|
+
## 1.2.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- ae47ccd: give wallet adapter ant design modal higher zindex to make sure it always shows up on screen
|
|
14
|
+
|
|
3
15
|
## 1.2.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
|
|
1
3
|
declare type WalletSelectorProps = {
|
|
2
4
|
isModalOpen?: boolean;
|
|
5
|
+
setModalOpen?: Dispatch<SetStateAction<boolean>>;
|
|
3
6
|
};
|
|
4
|
-
declare function WalletSelector({ isModalOpen }: WalletSelectorProps): JSX.Element;
|
|
7
|
+
declare function WalletSelector({ isModalOpen, setModalOpen, }: WalletSelectorProps): JSX.Element;
|
|
5
8
|
|
|
6
9
|
export { WalletSelector };
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,10 @@ var truncateAddress = (address) => {
|
|
|
39
39
|
// src/WalletSelector.tsx
|
|
40
40
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
41
|
var { Text } = import_antd.Typography;
|
|
42
|
-
function WalletSelector({
|
|
42
|
+
function WalletSelector({
|
|
43
|
+
isModalOpen,
|
|
44
|
+
setModalOpen
|
|
45
|
+
}) {
|
|
43
46
|
const [walletSelectorModalOpen, setWalletSelectorModalOpen] = (0, import_react.useState)(false);
|
|
44
47
|
(0, import_react.useEffect)(() => {
|
|
45
48
|
if (isModalOpen !== void 0) {
|
|
@@ -57,6 +60,15 @@ function WalletSelector({ isModalOpen }) {
|
|
|
57
60
|
const onWalletSelected = (wallet) => {
|
|
58
61
|
connect(wallet);
|
|
59
62
|
setWalletSelectorModalOpen(false);
|
|
63
|
+
if (setModalOpen) {
|
|
64
|
+
setModalOpen(false);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const onCancel = () => {
|
|
68
|
+
setWalletSelectorModalOpen(false);
|
|
69
|
+
if (setModalOpen) {
|
|
70
|
+
setModalOpen(false);
|
|
71
|
+
}
|
|
60
72
|
};
|
|
61
73
|
const buttonText = (account == null ? void 0 : account.ansName) ? account == null ? void 0 : account.ansName : truncateAddress(account == null ? void 0 : account.address);
|
|
62
74
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
@@ -73,9 +85,10 @@ function WalletSelector({ isModalOpen }) {
|
|
|
73
85
|
}),
|
|
74
86
|
centered: true,
|
|
75
87
|
open: walletSelectorModalOpen,
|
|
76
|
-
onCancel
|
|
88
|
+
onCancel,
|
|
77
89
|
footer: [],
|
|
78
90
|
closable: false,
|
|
91
|
+
zIndex: 9999,
|
|
79
92
|
children: !connected && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Menu, {
|
|
80
93
|
children: wallets.map((wallet) => {
|
|
81
94
|
return walletView(wallet, onWalletSelected);
|
package/dist/index.mjs
CHANGED
|
@@ -17,7 +17,10 @@ var truncateAddress = (address) => {
|
|
|
17
17
|
// src/WalletSelector.tsx
|
|
18
18
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
19
19
|
var { Text } = Typography;
|
|
20
|
-
function WalletSelector({
|
|
20
|
+
function WalletSelector({
|
|
21
|
+
isModalOpen,
|
|
22
|
+
setModalOpen
|
|
23
|
+
}) {
|
|
21
24
|
const [walletSelectorModalOpen, setWalletSelectorModalOpen] = useState(false);
|
|
22
25
|
useEffect(() => {
|
|
23
26
|
if (isModalOpen !== void 0) {
|
|
@@ -35,6 +38,15 @@ function WalletSelector({ isModalOpen }) {
|
|
|
35
38
|
const onWalletSelected = (wallet) => {
|
|
36
39
|
connect(wallet);
|
|
37
40
|
setWalletSelectorModalOpen(false);
|
|
41
|
+
if (setModalOpen) {
|
|
42
|
+
setModalOpen(false);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const onCancel = () => {
|
|
46
|
+
setWalletSelectorModalOpen(false);
|
|
47
|
+
if (setModalOpen) {
|
|
48
|
+
setModalOpen(false);
|
|
49
|
+
}
|
|
38
50
|
};
|
|
39
51
|
const buttonText = (account == null ? void 0 : account.ansName) ? account == null ? void 0 : account.ansName : truncateAddress(account == null ? void 0 : account.address);
|
|
40
52
|
return /* @__PURE__ */ jsxs(Fragment, {
|
|
@@ -51,9 +63,10 @@ function WalletSelector({ isModalOpen }) {
|
|
|
51
63
|
}),
|
|
52
64
|
centered: true,
|
|
53
65
|
open: walletSelectorModalOpen,
|
|
54
|
-
onCancel
|
|
66
|
+
onCancel,
|
|
55
67
|
footer: [],
|
|
56
68
|
closable: false,
|
|
69
|
+
zIndex: 9999,
|
|
57
70
|
children: !connected && /* @__PURE__ */ jsx(Menu, {
|
|
58
71
|
children: wallets.map((wallet) => {
|
|
59
72
|
return walletView(wallet, onWalletSelected);
|
package/package.json
CHANGED
package/src/WalletSelector.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { Dispatch, SetStateAction, useEffect, useState } from "react";
|
|
2
2
|
import { Button, Menu, Modal, Typography } from "antd";
|
|
3
3
|
import {
|
|
4
4
|
isRedirectable,
|
|
@@ -13,9 +13,13 @@ const { Text } = Typography;
|
|
|
13
13
|
|
|
14
14
|
type WalletSelectorProps = {
|
|
15
15
|
isModalOpen?: boolean;
|
|
16
|
+
setModalOpen?: Dispatch<SetStateAction<boolean>>;
|
|
16
17
|
};
|
|
17
18
|
|
|
18
|
-
export function WalletSelector({
|
|
19
|
+
export function WalletSelector({
|
|
20
|
+
isModalOpen,
|
|
21
|
+
setModalOpen,
|
|
22
|
+
}: WalletSelectorProps) {
|
|
19
23
|
const [walletSelectorModalOpen, setWalletSelectorModalOpen] = useState(false);
|
|
20
24
|
|
|
21
25
|
useEffect(() => {
|
|
@@ -37,6 +41,15 @@ export function WalletSelector({ isModalOpen }: WalletSelectorProps) {
|
|
|
37
41
|
const onWalletSelected = (wallet: WalletName) => {
|
|
38
42
|
connect(wallet);
|
|
39
43
|
setWalletSelectorModalOpen(false);
|
|
44
|
+
if (setModalOpen) {
|
|
45
|
+
setModalOpen(false);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const onCancel = () => {
|
|
49
|
+
setWalletSelectorModalOpen(false);
|
|
50
|
+
if (setModalOpen) {
|
|
51
|
+
setModalOpen(false);
|
|
52
|
+
}
|
|
40
53
|
};
|
|
41
54
|
const buttonText = account?.ansName
|
|
42
55
|
? account?.ansName
|
|
@@ -50,9 +63,10 @@ export function WalletSelector({ isModalOpen }: WalletSelectorProps) {
|
|
|
50
63
|
title={<div className="wallet-modal-title">Connect Wallet</div>}
|
|
51
64
|
centered
|
|
52
65
|
open={walletSelectorModalOpen}
|
|
53
|
-
onCancel={
|
|
66
|
+
onCancel={onCancel}
|
|
54
67
|
footer={[]}
|
|
55
68
|
closable={false}
|
|
69
|
+
zIndex={9999}
|
|
56
70
|
>
|
|
57
71
|
{!connected && (
|
|
58
72
|
<Menu>
|