@aptos-labs/wallet-adapter-ant-design 1.1.3 → 1.2.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 +6 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +6 -1
- package/dist/index.mjs +7 -2
- package/package.json +1 -1
- package/src/WalletSelector.tsx +13 -2
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -39,8 +39,13 @@ 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({ isModalOpen }) {
|
|
43
43
|
const [walletSelectorModalOpen, setWalletSelectorModalOpen] = (0, import_react.useState)(false);
|
|
44
|
+
(0, import_react.useEffect)(() => {
|
|
45
|
+
if (isModalOpen !== void 0) {
|
|
46
|
+
setWalletSelectorModalOpen(isModalOpen);
|
|
47
|
+
}
|
|
48
|
+
}, [isModalOpen]);
|
|
44
49
|
const { connect, disconnect, account, wallets, connected } = (0, import_wallet_adapter_react.useWallet)();
|
|
45
50
|
const onWalletButtonClick = () => {
|
|
46
51
|
if (connected) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/WalletSelector.tsx
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
3
|
import { Button, Menu, Modal, Typography } from "antd";
|
|
4
4
|
import {
|
|
5
5
|
isRedirectable,
|
|
@@ -17,8 +17,13 @@ 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({ isModalOpen }) {
|
|
21
21
|
const [walletSelectorModalOpen, setWalletSelectorModalOpen] = useState(false);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (isModalOpen !== void 0) {
|
|
24
|
+
setWalletSelectorModalOpen(isModalOpen);
|
|
25
|
+
}
|
|
26
|
+
}, [isModalOpen]);
|
|
22
27
|
const { connect, disconnect, account, wallets, connected } = useWallet();
|
|
23
28
|
const onWalletButtonClick = () => {
|
|
24
29
|
if (connected) {
|
package/package.json
CHANGED
package/src/WalletSelector.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
2
|
import { Button, Menu, Modal, Typography } from "antd";
|
|
3
3
|
import {
|
|
4
4
|
isRedirectable,
|
|
@@ -11,8 +11,19 @@ import "./styles.css";
|
|
|
11
11
|
import { truncateAddress } from "./utils";
|
|
12
12
|
const { Text } = Typography;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
type WalletSelectorProps = {
|
|
15
|
+
isModalOpen?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function WalletSelector({ isModalOpen }: WalletSelectorProps) {
|
|
15
19
|
const [walletSelectorModalOpen, setWalletSelectorModalOpen] = useState(false);
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (isModalOpen !== undefined) {
|
|
23
|
+
setWalletSelectorModalOpen(isModalOpen);
|
|
24
|
+
}
|
|
25
|
+
}, [isModalOpen]);
|
|
26
|
+
|
|
16
27
|
const { connect, disconnect, account, wallets, connected } = useWallet();
|
|
17
28
|
|
|
18
29
|
const onWalletButtonClick = () => {
|