@aptos-labs/wallet-adapter-mui-design 5.5.4 → 5.5.6
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 +13 -0
- package/dist/index.js +36 -97
- package/dist/index.mjs +44 -108
- package/package.json +3 -4
- package/src/WalletButton.tsx +2 -1
- package/src/WalletConnector.tsx +1 -1
- package/src/WalletMenu.tsx +2 -2
- package/src/WalletModel.tsx +17 -18
- package/src/types.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @aptos-labs/wallet-adapter-mui-design
|
|
2
2
|
|
|
3
|
+
## 5.5.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @aptos-labs/wallet-adapter-react@8.3.3
|
|
8
|
+
|
|
9
|
+
## 5.5.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [b19c8c2]
|
|
14
|
+
- @aptos-labs/wallet-adapter-react@8.3.2
|
|
15
|
+
|
|
3
16
|
## 5.5.4
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
-
var __objRest = (source, exclude) => {
|
|
24
|
-
var target = {};
|
|
25
|
-
for (var prop in source)
|
|
26
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
-
target[prop] = source[prop];
|
|
28
|
-
if (source != null && __getOwnPropSymbols)
|
|
29
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
-
target[prop] = source[prop];
|
|
32
|
-
}
|
|
33
|
-
return target;
|
|
34
|
-
};
|
|
35
6
|
var __export = (target, all) => {
|
|
36
7
|
for (var name in all)
|
|
37
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -45,26 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
45
16
|
return to;
|
|
46
17
|
};
|
|
47
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
-
var __async = (__this, __arguments, generator) => {
|
|
49
|
-
return new Promise((resolve, reject) => {
|
|
50
|
-
var fulfilled = (value) => {
|
|
51
|
-
try {
|
|
52
|
-
step(generator.next(value));
|
|
53
|
-
} catch (e) {
|
|
54
|
-
reject(e);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
var rejected = (value) => {
|
|
58
|
-
try {
|
|
59
|
-
step(generator.throw(value));
|
|
60
|
-
} catch (e) {
|
|
61
|
-
reject(e);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
65
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
19
|
|
|
69
20
|
// src/index.tsx
|
|
70
21
|
var index_exports = {};
|
|
@@ -96,7 +47,7 @@ function WalletMenu({
|
|
|
96
47
|
const popoverOpen = Boolean(popoverAnchor);
|
|
97
48
|
const id = popoverOpen ? "wallet-popover" : void 0;
|
|
98
49
|
const onAccountOptionClicked = () => {
|
|
99
|
-
handleNavigate
|
|
50
|
+
handleNavigate?.();
|
|
100
51
|
handlePopoverClose();
|
|
101
52
|
};
|
|
102
53
|
const handleLogout = () => {
|
|
@@ -104,14 +55,13 @@ function WalletMenu({
|
|
|
104
55
|
handlePopoverClose();
|
|
105
56
|
};
|
|
106
57
|
const [tooltipOpen, setTooltipOpen] = (0, import_react.useState)(false);
|
|
107
|
-
const copyAddress = () =>
|
|
108
|
-
|
|
109
|
-
yield navigator.clipboard.writeText((_a = account == null ? void 0 : account.address) == null ? void 0 : _a.toString());
|
|
58
|
+
const copyAddress = async () => {
|
|
59
|
+
await navigator.clipboard.writeText(account?.address?.toString() ?? "");
|
|
110
60
|
setTooltipOpen(true);
|
|
111
61
|
setTimeout(() => {
|
|
112
62
|
setTooltipOpen(false);
|
|
113
63
|
}, 2e3);
|
|
114
|
-
}
|
|
64
|
+
};
|
|
115
65
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
116
66
|
import_material.Popover,
|
|
117
67
|
{
|
|
@@ -149,7 +99,6 @@ function WalletButton({
|
|
|
149
99
|
handleModalOpen,
|
|
150
100
|
handleNavigate
|
|
151
101
|
}) {
|
|
152
|
-
var _a;
|
|
153
102
|
const { connected, account, wallet } = (0, import_wallet_adapter_react2.useWallet)();
|
|
154
103
|
const [popoverAnchor, setPopoverAnchor] = (0, import_react2.useState)(
|
|
155
104
|
null
|
|
@@ -177,12 +126,12 @@ function WalletButton({
|
|
|
177
126
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
178
127
|
import_material2.Avatar,
|
|
179
128
|
{
|
|
180
|
-
alt: wallet
|
|
181
|
-
src: wallet
|
|
129
|
+
alt: wallet?.name,
|
|
130
|
+
src: wallet?.icon,
|
|
182
131
|
sx: { width: 24, height: 24 }
|
|
183
132
|
}
|
|
184
133
|
),
|
|
185
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Typography, { noWrap: true, ml: 2, children:
|
|
134
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Typography, { noWrap: true, ml: 2, children: account?.ansName || (0, import_wallet_adapter_react2.truncateAddress)(account?.address?.toString()) || "Unknown" })
|
|
186
135
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
187
136
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.AccountBalanceWalletOutlined, { sx: { marginRight: 1 } }),
|
|
188
137
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Typography, { noWrap: true, children: "Connect Wallet" })
|
|
@@ -202,7 +151,9 @@ function WalletButton({
|
|
|
202
151
|
|
|
203
152
|
// src/WalletModel.tsx
|
|
204
153
|
var import_wallet_adapter_react3 = require("@aptos-labs/wallet-adapter-react");
|
|
154
|
+
var import_icons_material2 = require("@mui/icons-material");
|
|
205
155
|
var import_material3 = require("@mui/material");
|
|
156
|
+
var import_react3 = require("react");
|
|
206
157
|
|
|
207
158
|
// src/aptosColorPalette.ts
|
|
208
159
|
var grey = {
|
|
@@ -220,27 +171,19 @@ var grey = {
|
|
|
220
171
|
};
|
|
221
172
|
|
|
222
173
|
// src/WalletModel.tsx
|
|
223
|
-
var import_icons_material2 = require("@mui/icons-material");
|
|
224
|
-
var import_react3 = require("react");
|
|
225
174
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
226
|
-
function WalletsModal(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
"handleClose",
|
|
235
|
-
"modalOpen",
|
|
236
|
-
"networkSupport",
|
|
237
|
-
"modalMaxWidth",
|
|
238
|
-
"crossChainWallets"
|
|
239
|
-
]);
|
|
175
|
+
function WalletsModal({
|
|
176
|
+
handleClose,
|
|
177
|
+
modalOpen,
|
|
178
|
+
networkSupport,
|
|
179
|
+
modalMaxWidth,
|
|
180
|
+
crossChainWallets,
|
|
181
|
+
...walletSortingOptions
|
|
182
|
+
}) {
|
|
240
183
|
const theme = (0, import_material3.useTheme)();
|
|
241
184
|
const [expanded, setExpanded] = (0, import_react3.useState)(false);
|
|
242
185
|
const [tabValue, setTabValue] = (0, import_react3.useState)(0);
|
|
243
|
-
const handleTabChange = (
|
|
186
|
+
const handleTabChange = (_event, newValue) => {
|
|
244
187
|
setTabValue(newValue);
|
|
245
188
|
};
|
|
246
189
|
const { wallets = [], notDetectedWallets = [] } = (0, import_wallet_adapter_react3.useWallet)();
|
|
@@ -324,7 +267,7 @@ function WalletsModal(_a) {
|
|
|
324
267
|
onClose: handleClose,
|
|
325
268
|
"aria-label": "wallet selector modal",
|
|
326
269
|
sx: { borderRadius: `${theme.shape.borderRadius}px` },
|
|
327
|
-
maxWidth: modalMaxWidth
|
|
270
|
+
maxWidth: modalMaxWidth ?? "xs",
|
|
328
271
|
fullWidth: true,
|
|
329
272
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
330
273
|
import_material3.Stack,
|
|
@@ -509,7 +452,7 @@ function WalletsModal(_a) {
|
|
|
509
452
|
indicatorColor: "secondary",
|
|
510
453
|
variant: "fullWidth",
|
|
511
454
|
"aria-label": "cross chain wallets tabs",
|
|
512
|
-
children: tabsConfig.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Tab,
|
|
455
|
+
children: tabsConfig.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Tab, { label: tab.label, ...a11yProps(index) }, tab.key))
|
|
513
456
|
}
|
|
514
457
|
),
|
|
515
458
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TabPanel, { value: tabValue, index: getTabIndex("aptos"), children: renderWalletList(aptosWallets, aptosInstallableWallets) }),
|
|
@@ -708,17 +651,17 @@ function renderEducationScreen(screen) {
|
|
|
708
651
|
] });
|
|
709
652
|
}
|
|
710
653
|
function TabPanel(props) {
|
|
711
|
-
const
|
|
654
|
+
const { children, value, index, ...other } = props;
|
|
712
655
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
713
656
|
"div",
|
|
714
|
-
|
|
657
|
+
{
|
|
715
658
|
role: "tabpanel",
|
|
716
659
|
hidden: value !== index,
|
|
717
660
|
id: `simple-tabpanel-${index}`,
|
|
718
|
-
"aria-labelledby": `simple-tab-${index}
|
|
719
|
-
|
|
661
|
+
"aria-labelledby": `simple-tab-${index}`,
|
|
662
|
+
...other,
|
|
720
663
|
children: value === index && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Stack, { sx: { gap: 1 }, children })
|
|
721
|
-
}
|
|
664
|
+
}
|
|
722
665
|
);
|
|
723
666
|
}
|
|
724
667
|
function a11yProps(index) {
|
|
@@ -730,18 +673,13 @@ function a11yProps(index) {
|
|
|
730
673
|
|
|
731
674
|
// src/WalletConnector.tsx
|
|
732
675
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
733
|
-
function WalletConnector(
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
"networkSupport",
|
|
741
|
-
"handleNavigate",
|
|
742
|
-
"modalMaxWidth",
|
|
743
|
-
"crossChainWallets"
|
|
744
|
-
]);
|
|
676
|
+
function WalletConnector({
|
|
677
|
+
networkSupport,
|
|
678
|
+
handleNavigate,
|
|
679
|
+
modalMaxWidth,
|
|
680
|
+
crossChainWallets,
|
|
681
|
+
...walletSortingOptions
|
|
682
|
+
}) {
|
|
745
683
|
const [modalOpen, setModalOpen] = (0, import_react4.useState)(false);
|
|
746
684
|
const handleModalOpen = () => setModalOpen(true);
|
|
747
685
|
const handleClose = () => setModalOpen(false);
|
|
@@ -755,13 +693,14 @@ function WalletConnector(_a) {
|
|
|
755
693
|
),
|
|
756
694
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
757
695
|
WalletsModal,
|
|
758
|
-
|
|
696
|
+
{
|
|
759
697
|
handleClose,
|
|
760
698
|
modalOpen,
|
|
761
699
|
networkSupport,
|
|
762
700
|
modalMaxWidth,
|
|
763
|
-
crossChainWallets
|
|
764
|
-
|
|
701
|
+
crossChainWallets,
|
|
702
|
+
...walletSortingOptions
|
|
703
|
+
}
|
|
765
704
|
)
|
|
766
705
|
] });
|
|
767
706
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,55 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
var __async = (__this, __arguments, generator) => {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
var fulfilled = (value) => {
|
|
35
|
-
try {
|
|
36
|
-
step(generator.next(value));
|
|
37
|
-
} catch (e) {
|
|
38
|
-
reject(e);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var rejected = (value) => {
|
|
42
|
-
try {
|
|
43
|
-
step(generator.throw(value));
|
|
44
|
-
} catch (e) {
|
|
45
|
-
reject(e);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
1
|
// src/WalletConnector.tsx
|
|
54
2
|
import { useState as useState4 } from "react";
|
|
55
3
|
|
|
@@ -80,7 +28,7 @@ function WalletMenu({
|
|
|
80
28
|
const popoverOpen = Boolean(popoverAnchor);
|
|
81
29
|
const id = popoverOpen ? "wallet-popover" : void 0;
|
|
82
30
|
const onAccountOptionClicked = () => {
|
|
83
|
-
handleNavigate
|
|
31
|
+
handleNavigate?.();
|
|
84
32
|
handlePopoverClose();
|
|
85
33
|
};
|
|
86
34
|
const handleLogout = () => {
|
|
@@ -88,14 +36,13 @@ function WalletMenu({
|
|
|
88
36
|
handlePopoverClose();
|
|
89
37
|
};
|
|
90
38
|
const [tooltipOpen, setTooltipOpen] = useState(false);
|
|
91
|
-
const copyAddress = () =>
|
|
92
|
-
|
|
93
|
-
yield navigator.clipboard.writeText((_a = account == null ? void 0 : account.address) == null ? void 0 : _a.toString());
|
|
39
|
+
const copyAddress = async () => {
|
|
40
|
+
await navigator.clipboard.writeText(account?.address?.toString() ?? "");
|
|
94
41
|
setTooltipOpen(true);
|
|
95
42
|
setTimeout(() => {
|
|
96
43
|
setTooltipOpen(false);
|
|
97
44
|
}, 2e3);
|
|
98
|
-
}
|
|
45
|
+
};
|
|
99
46
|
return /* @__PURE__ */ jsx(
|
|
100
47
|
Popover,
|
|
101
48
|
{
|
|
@@ -133,7 +80,6 @@ function WalletButton({
|
|
|
133
80
|
handleModalOpen,
|
|
134
81
|
handleNavigate
|
|
135
82
|
}) {
|
|
136
|
-
var _a;
|
|
137
83
|
const { connected, account, wallet } = useWallet2();
|
|
138
84
|
const [popoverAnchor, setPopoverAnchor] = useState2(
|
|
139
85
|
null
|
|
@@ -161,12 +107,12 @@ function WalletButton({
|
|
|
161
107
|
/* @__PURE__ */ jsx2(
|
|
162
108
|
Avatar,
|
|
163
109
|
{
|
|
164
|
-
alt: wallet
|
|
165
|
-
src: wallet
|
|
110
|
+
alt: wallet?.name,
|
|
111
|
+
src: wallet?.icon,
|
|
166
112
|
sx: { width: 24, height: 24 }
|
|
167
113
|
}
|
|
168
114
|
),
|
|
169
|
-
/* @__PURE__ */ jsx2(Typography, { noWrap: true, ml: 2, children:
|
|
115
|
+
/* @__PURE__ */ jsx2(Typography, { noWrap: true, ml: 2, children: account?.ansName || truncateAddress(account?.address?.toString()) || "Unknown" })
|
|
170
116
|
] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
171
117
|
/* @__PURE__ */ jsx2(AccountBalanceWalletOutlinedIcon, { sx: { marginRight: 1 } }),
|
|
172
118
|
/* @__PURE__ */ jsx2(Typography, { noWrap: true, children: "Connect Wallet" })
|
|
@@ -188,11 +134,18 @@ function WalletButton({
|
|
|
188
134
|
import {
|
|
189
135
|
AboutAptosConnect,
|
|
190
136
|
AptosPrivacyPolicy,
|
|
191
|
-
WalletItem,
|
|
192
137
|
groupAndSortWallets,
|
|
193
138
|
isInstallRequired,
|
|
194
|
-
useWallet as useWallet3
|
|
139
|
+
useWallet as useWallet3,
|
|
140
|
+
WalletItem
|
|
195
141
|
} from "@aptos-labs/wallet-adapter-react";
|
|
142
|
+
import {
|
|
143
|
+
ArrowBack,
|
|
144
|
+
ArrowForward,
|
|
145
|
+
Close as CloseIcon,
|
|
146
|
+
ExpandMore,
|
|
147
|
+
LanOutlined as LanOutlinedIcon
|
|
148
|
+
} from "@mui/icons-material";
|
|
196
149
|
import {
|
|
197
150
|
Box,
|
|
198
151
|
Button as Button2,
|
|
@@ -208,6 +161,7 @@ import {
|
|
|
208
161
|
Typography as Typography2,
|
|
209
162
|
useTheme
|
|
210
163
|
} from "@mui/material";
|
|
164
|
+
import { useState as useState3 } from "react";
|
|
211
165
|
|
|
212
166
|
// src/aptosColorPalette.ts
|
|
213
167
|
var grey = {
|
|
@@ -225,33 +179,19 @@ var grey = {
|
|
|
225
179
|
};
|
|
226
180
|
|
|
227
181
|
// src/WalletModel.tsx
|
|
228
|
-
import {
|
|
229
|
-
ArrowBack,
|
|
230
|
-
ArrowForward,
|
|
231
|
-
Close as CloseIcon,
|
|
232
|
-
ExpandMore,
|
|
233
|
-
LanOutlined as LanOutlinedIcon
|
|
234
|
-
} from "@mui/icons-material";
|
|
235
|
-
import { useState as useState3 } from "react";
|
|
236
182
|
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
237
|
-
function WalletsModal(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
"handleClose",
|
|
246
|
-
"modalOpen",
|
|
247
|
-
"networkSupport",
|
|
248
|
-
"modalMaxWidth",
|
|
249
|
-
"crossChainWallets"
|
|
250
|
-
]);
|
|
183
|
+
function WalletsModal({
|
|
184
|
+
handleClose,
|
|
185
|
+
modalOpen,
|
|
186
|
+
networkSupport,
|
|
187
|
+
modalMaxWidth,
|
|
188
|
+
crossChainWallets,
|
|
189
|
+
...walletSortingOptions
|
|
190
|
+
}) {
|
|
251
191
|
const theme = useTheme();
|
|
252
192
|
const [expanded, setExpanded] = useState3(false);
|
|
253
193
|
const [tabValue, setTabValue] = useState3(0);
|
|
254
|
-
const handleTabChange = (
|
|
194
|
+
const handleTabChange = (_event, newValue) => {
|
|
255
195
|
setTabValue(newValue);
|
|
256
196
|
};
|
|
257
197
|
const { wallets = [], notDetectedWallets = [] } = useWallet3();
|
|
@@ -335,7 +275,7 @@ function WalletsModal(_a) {
|
|
|
335
275
|
onClose: handleClose,
|
|
336
276
|
"aria-label": "wallet selector modal",
|
|
337
277
|
sx: { borderRadius: `${theme.shape.borderRadius}px` },
|
|
338
|
-
maxWidth: modalMaxWidth
|
|
278
|
+
maxWidth: modalMaxWidth ?? "xs",
|
|
339
279
|
fullWidth: true,
|
|
340
280
|
children: /* @__PURE__ */ jsxs3(
|
|
341
281
|
Stack,
|
|
@@ -520,7 +460,7 @@ function WalletsModal(_a) {
|
|
|
520
460
|
indicatorColor: "secondary",
|
|
521
461
|
variant: "fullWidth",
|
|
522
462
|
"aria-label": "cross chain wallets tabs",
|
|
523
|
-
children: tabsConfig.map((tab, index) => /* @__PURE__ */ jsx3(Tab,
|
|
463
|
+
children: tabsConfig.map((tab, index) => /* @__PURE__ */ jsx3(Tab, { label: tab.label, ...a11yProps(index) }, tab.key))
|
|
524
464
|
}
|
|
525
465
|
),
|
|
526
466
|
/* @__PURE__ */ jsx3(TabPanel, { value: tabValue, index: getTabIndex("aptos"), children: renderWalletList(aptosWallets, aptosInstallableWallets) }),
|
|
@@ -719,17 +659,17 @@ function renderEducationScreen(screen) {
|
|
|
719
659
|
] });
|
|
720
660
|
}
|
|
721
661
|
function TabPanel(props) {
|
|
722
|
-
const
|
|
662
|
+
const { children, value, index, ...other } = props;
|
|
723
663
|
return /* @__PURE__ */ jsx3(
|
|
724
664
|
"div",
|
|
725
|
-
|
|
665
|
+
{
|
|
726
666
|
role: "tabpanel",
|
|
727
667
|
hidden: value !== index,
|
|
728
668
|
id: `simple-tabpanel-${index}`,
|
|
729
|
-
"aria-labelledby": `simple-tab-${index}
|
|
730
|
-
|
|
669
|
+
"aria-labelledby": `simple-tab-${index}`,
|
|
670
|
+
...other,
|
|
731
671
|
children: value === index && /* @__PURE__ */ jsx3(Stack, { sx: { gap: 1 }, children })
|
|
732
|
-
}
|
|
672
|
+
}
|
|
733
673
|
);
|
|
734
674
|
}
|
|
735
675
|
function a11yProps(index) {
|
|
@@ -741,18 +681,13 @@ function a11yProps(index) {
|
|
|
741
681
|
|
|
742
682
|
// src/WalletConnector.tsx
|
|
743
683
|
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
744
|
-
function WalletConnector(
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
"networkSupport",
|
|
752
|
-
"handleNavigate",
|
|
753
|
-
"modalMaxWidth",
|
|
754
|
-
"crossChainWallets"
|
|
755
|
-
]);
|
|
684
|
+
function WalletConnector({
|
|
685
|
+
networkSupport,
|
|
686
|
+
handleNavigate,
|
|
687
|
+
modalMaxWidth,
|
|
688
|
+
crossChainWallets,
|
|
689
|
+
...walletSortingOptions
|
|
690
|
+
}) {
|
|
756
691
|
const [modalOpen, setModalOpen] = useState4(false);
|
|
757
692
|
const handleModalOpen = () => setModalOpen(true);
|
|
758
693
|
const handleClose = () => setModalOpen(false);
|
|
@@ -766,13 +701,14 @@ function WalletConnector(_a) {
|
|
|
766
701
|
),
|
|
767
702
|
/* @__PURE__ */ jsx4(
|
|
768
703
|
WalletsModal,
|
|
769
|
-
|
|
704
|
+
{
|
|
770
705
|
handleClose,
|
|
771
706
|
modalOpen,
|
|
772
707
|
networkSupport,
|
|
773
708
|
modalMaxWidth,
|
|
774
|
-
crossChainWallets
|
|
775
|
-
|
|
709
|
+
crossChainWallets,
|
|
710
|
+
...walletSortingOptions
|
|
711
|
+
}
|
|
776
712
|
)
|
|
777
713
|
] });
|
|
778
714
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-labs/wallet-adapter-mui-design",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.6",
|
|
4
4
|
"description": "Aptos Wallet Adapter mui design",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/react": "^18.3.3",
|
|
33
33
|
"@types/react-dom": "^18.3.0",
|
|
34
|
-
"eslint": "^8.57.1",
|
|
35
34
|
"tsup": "^8.4.0",
|
|
36
35
|
"typescript": "^5.8.3",
|
|
37
36
|
"@aptos-labs/wallet-adapter-tsconfig": "0.0.2"
|
|
@@ -41,7 +40,7 @@
|
|
|
41
40
|
"@emotion/styled": "^11.10.5",
|
|
42
41
|
"@mui/icons-material": "^5.11.0",
|
|
43
42
|
"@mui/material": "^5.11.6",
|
|
44
|
-
"@aptos-labs/wallet-adapter-react": "8.3.
|
|
43
|
+
"@aptos-labs/wallet-adapter-react": "8.3.3"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
47
46
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -52,6 +51,6 @@
|
|
|
52
51
|
"build": "tsup src/index.tsx --format esm,cjs --dts --external react",
|
|
53
52
|
"dev": "tsup src/index.tsx --format esm,cjs --watch --dts --external react",
|
|
54
53
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
55
|
-
"lint": "
|
|
54
|
+
"lint": "biome lint src"
|
|
56
55
|
}
|
|
57
56
|
}
|
package/src/WalletButton.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { truncateAddress, useWallet } from "@aptos-labs/wallet-adapter-react";
|
|
2
2
|
import { AccountBalanceWalletOutlined as AccountBalanceWalletOutlinedIcon } from "@mui/icons-material";
|
|
3
3
|
import { Avatar, Button, Typography } from "@mui/material";
|
|
4
|
-
import React
|
|
4
|
+
import type React from "react";
|
|
5
|
+
import { useState } from "react";
|
|
5
6
|
import WalletMenu from "./WalletMenu";
|
|
6
7
|
|
|
7
8
|
type WalletButtonProps = {
|
package/src/WalletConnector.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
+
import type { WalletConnectorProps } from "./types";
|
|
2
3
|
import WalletButton from "./WalletButton";
|
|
3
4
|
import WalletsModal from "./WalletModel";
|
|
4
|
-
import { WalletConnectorProps } from "./types";
|
|
5
5
|
|
|
6
6
|
export function WalletConnector({
|
|
7
7
|
networkSupport,
|
package/src/WalletMenu.tsx
CHANGED
|
@@ -25,7 +25,7 @@ export default function WalletMenu({
|
|
|
25
25
|
const id = popoverOpen ? "wallet-popover" : undefined;
|
|
26
26
|
|
|
27
27
|
const onAccountOptionClicked = () => {
|
|
28
|
-
handleNavigate
|
|
28
|
+
handleNavigate?.();
|
|
29
29
|
handlePopoverClose();
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -37,7 +37,7 @@ export default function WalletMenu({
|
|
|
37
37
|
const [tooltipOpen, setTooltipOpen] = useState<boolean>(false);
|
|
38
38
|
|
|
39
39
|
const copyAddress = async () => {
|
|
40
|
-
await navigator.clipboard.writeText(account?.address?.toString()
|
|
40
|
+
await navigator.clipboard.writeText(account?.address?.toString() ?? "");
|
|
41
41
|
|
|
42
42
|
setTooltipOpen(true);
|
|
43
43
|
|
package/src/WalletModel.tsx
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AboutAptosConnect,
|
|
3
|
-
AboutAptosConnectEducationScreen,
|
|
4
|
-
AdapterNotDetectedWallet,
|
|
5
|
-
AdapterWallet,
|
|
3
|
+
type AboutAptosConnectEducationScreen,
|
|
4
|
+
type AdapterNotDetectedWallet,
|
|
5
|
+
type AdapterWallet,
|
|
6
6
|
AptosPrivacyPolicy,
|
|
7
|
-
WalletItem,
|
|
8
|
-
WalletSortingOptions,
|
|
9
7
|
groupAndSortWallets,
|
|
10
8
|
isInstallRequired,
|
|
11
9
|
useWallet,
|
|
10
|
+
WalletItem,
|
|
11
|
+
type WalletSortingOptions,
|
|
12
12
|
} from "@aptos-labs/wallet-adapter-react";
|
|
13
|
+
// reported bug with loading mui icons with esm, therefore need to import like this https://github.com/mui/material-ui/issues/35233
|
|
14
|
+
import {
|
|
15
|
+
ArrowBack,
|
|
16
|
+
ArrowForward,
|
|
17
|
+
Close as CloseIcon,
|
|
18
|
+
ExpandMore,
|
|
19
|
+
LanOutlined as LanOutlinedIcon,
|
|
20
|
+
} from "@mui/icons-material";
|
|
13
21
|
import {
|
|
14
22
|
Box,
|
|
15
23
|
Button,
|
|
@@ -25,21 +33,12 @@ import {
|
|
|
25
33
|
Typography,
|
|
26
34
|
useTheme,
|
|
27
35
|
} from "@mui/material";
|
|
36
|
+
import { type SyntheticEvent, useState } from "react";
|
|
28
37
|
import { grey } from "./aptosColorPalette";
|
|
29
|
-
|
|
30
|
-
import {
|
|
31
|
-
ArrowBack,
|
|
32
|
-
ArrowForward,
|
|
33
|
-
Close as CloseIcon,
|
|
34
|
-
ExpandMore,
|
|
35
|
-
LanOutlined as LanOutlinedIcon,
|
|
36
|
-
} from "@mui/icons-material";
|
|
37
|
-
import { SyntheticEvent, useState } from "react";
|
|
38
|
-
import { WalletConnectorProps } from "./types";
|
|
38
|
+
import type { WalletConnectorProps } from "./types";
|
|
39
39
|
|
|
40
40
|
interface WalletsModalProps
|
|
41
|
-
extends
|
|
42
|
-
Pick<WalletConnectorProps, "networkSupport" | "modalMaxWidth">,
|
|
41
|
+
extends Pick<WalletConnectorProps, "networkSupport" | "modalMaxWidth">,
|
|
43
42
|
WalletSortingOptions {
|
|
44
43
|
handleClose: () => void;
|
|
45
44
|
modalOpen: boolean;
|
|
@@ -62,7 +61,7 @@ export default function WalletsModal({
|
|
|
62
61
|
const [expanded, setExpanded] = useState(false);
|
|
63
62
|
const [tabValue, setTabValue] = useState<number>(0);
|
|
64
63
|
|
|
65
|
-
const handleTabChange = (
|
|
64
|
+
const handleTabChange = (_event: SyntheticEvent, newValue: number) => {
|
|
66
65
|
setTabValue(newValue);
|
|
67
66
|
};
|
|
68
67
|
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WalletSortingOptions } from "@aptos-labs/wallet-adapter-react";
|
|
2
|
-
import { Breakpoint } from "@mui/material";
|
|
1
|
+
import type { WalletSortingOptions } from "@aptos-labs/wallet-adapter-react";
|
|
2
|
+
import type { Breakpoint } from "@mui/material";
|
|
3
3
|
|
|
4
4
|
export interface WalletConnectorProps extends WalletSortingOptions {
|
|
5
5
|
networkSupport?: string;
|