@aptos-labs/wallet-adapter-mui-design 5.3.0 → 5.3.1
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 +8 -0
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +124 -34
- package/dist/index.mjs +126 -34
- package/package.json +2 -2
- package/src/WalletModel.tsx +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @aptos-labs/wallet-adapter-mui-design
|
|
2
2
|
|
|
3
|
+
## 5.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 19e7e2a: Deprecate aptos connect functions and constants in favor of petra web
|
|
8
|
+
- Updated dependencies [19e7e2a]
|
|
9
|
+
- @aptos-labs/wallet-adapter-react@7.2.1
|
|
10
|
+
|
|
3
11
|
## 5.3.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -7,7 +7,12 @@ interface WalletConnectorProps extends WalletSortingOptions {
|
|
|
7
7
|
handleNavigate?: () => void;
|
|
8
8
|
/** The max width of the wallet selector modal. Defaults to `xs`. */
|
|
9
9
|
modalMaxWidth?: Breakpoint;
|
|
10
|
+
crossChainWallets?: {
|
|
11
|
+
evm: boolean;
|
|
12
|
+
solana: boolean;
|
|
13
|
+
};
|
|
10
14
|
}
|
|
11
|
-
declare function WalletConnector({ networkSupport, handleNavigate, modalMaxWidth, ...walletSortingOptions }: WalletConnectorProps): react_jsx_runtime.JSX.Element;
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
declare function WalletConnector({ networkSupport, handleNavigate, modalMaxWidth, crossChainWallets, ...walletSortingOptions }: WalletConnectorProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { WalletConnector };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,12 @@ interface WalletConnectorProps extends WalletSortingOptions {
|
|
|
7
7
|
handleNavigate?: () => void;
|
|
8
8
|
/** The max width of the wallet selector modal. Defaults to `xs`. */
|
|
9
9
|
modalMaxWidth?: Breakpoint;
|
|
10
|
+
crossChainWallets?: {
|
|
11
|
+
evm: boolean;
|
|
12
|
+
solana: boolean;
|
|
13
|
+
};
|
|
10
14
|
}
|
|
11
|
-
declare function WalletConnector({ networkSupport, handleNavigate, modalMaxWidth, ...walletSortingOptions }: WalletConnectorProps): react_jsx_runtime.JSX.Element;
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
declare function WalletConnector({ networkSupport, handleNavigate, modalMaxWidth, crossChainWallets, ...walletSortingOptions }: WalletConnectorProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { WalletConnector };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
7
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -17,6 +19,7 @@ var __spreadValues = (a, b) => {
|
|
|
17
19
|
}
|
|
18
20
|
return a;
|
|
19
21
|
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
23
|
var __objRest = (source, exclude) => {
|
|
21
24
|
var target = {};
|
|
22
25
|
for (var prop in source)
|
|
@@ -225,21 +228,95 @@ function WalletsModal(_a) {
|
|
|
225
228
|
handleClose,
|
|
226
229
|
modalOpen,
|
|
227
230
|
networkSupport,
|
|
228
|
-
modalMaxWidth
|
|
231
|
+
modalMaxWidth,
|
|
232
|
+
crossChainWallets
|
|
229
233
|
} = _b, walletSortingOptions = __objRest(_b, [
|
|
230
234
|
"handleClose",
|
|
231
235
|
"modalOpen",
|
|
232
236
|
"networkSupport",
|
|
233
|
-
"modalMaxWidth"
|
|
237
|
+
"modalMaxWidth",
|
|
238
|
+
"crossChainWallets"
|
|
234
239
|
]);
|
|
235
240
|
const theme = (0, import_material3.useTheme)();
|
|
236
241
|
const [expanded, setExpanded] = (0, import_react3.useState)(false);
|
|
242
|
+
const [tabValue, setTabValue] = (0, import_react3.useState)(0);
|
|
243
|
+
const handleTabChange = (event, newValue) => {
|
|
244
|
+
setTabValue(newValue);
|
|
245
|
+
};
|
|
237
246
|
const { wallets = [], notDetectedWallets = [] } = (0, import_wallet_adapter_react3.useWallet)();
|
|
238
247
|
const { aptosConnectWallets, availableWallets, installableWallets } = (0, import_wallet_adapter_react3.groupAndSortWallets)(
|
|
239
248
|
[...wallets, ...notDetectedWallets],
|
|
240
249
|
walletSortingOptions
|
|
241
250
|
);
|
|
242
251
|
const hasAptosConnectWallets = !!aptosConnectWallets.length;
|
|
252
|
+
const crossChainMode = crossChainWallets && (crossChainWallets.evm || crossChainWallets.solana);
|
|
253
|
+
const { evmWallets, solanaWallets, aptosWallets } = crossChainMode ? availableWallets.reduce(
|
|
254
|
+
(acc, wallet) => {
|
|
255
|
+
if (wallet.name.includes("Ethereum")) {
|
|
256
|
+
acc.evmWallets.push(wallet);
|
|
257
|
+
} else if (wallet.name.includes("Solana")) {
|
|
258
|
+
acc.solanaWallets.push(wallet);
|
|
259
|
+
} else {
|
|
260
|
+
acc.aptosWallets.push(wallet);
|
|
261
|
+
}
|
|
262
|
+
return acc;
|
|
263
|
+
},
|
|
264
|
+
{ evmWallets: [], solanaWallets: [], aptosWallets: [] }
|
|
265
|
+
) : { evmWallets: [], solanaWallets: [], aptosWallets: availableWallets };
|
|
266
|
+
const {
|
|
267
|
+
evmInstallableWallets,
|
|
268
|
+
solanaInstallableWallets,
|
|
269
|
+
aptosInstallableWallets
|
|
270
|
+
} = crossChainMode ? installableWallets.reduce(
|
|
271
|
+
(acc, wallet) => {
|
|
272
|
+
if (wallet.name.includes("Ethereum")) {
|
|
273
|
+
acc.evmInstallableWallets.push(wallet);
|
|
274
|
+
} else if (wallet.name.includes("Solana")) {
|
|
275
|
+
acc.solanaInstallableWallets.push(wallet);
|
|
276
|
+
} else {
|
|
277
|
+
acc.aptosInstallableWallets.push(wallet);
|
|
278
|
+
}
|
|
279
|
+
return acc;
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
evmInstallableWallets: [],
|
|
283
|
+
solanaInstallableWallets: [],
|
|
284
|
+
aptosInstallableWallets: []
|
|
285
|
+
}
|
|
286
|
+
) : {
|
|
287
|
+
evmInstallableWallets: [],
|
|
288
|
+
solanaInstallableWallets: [],
|
|
289
|
+
aptosInstallableWallets: installableWallets
|
|
290
|
+
};
|
|
291
|
+
const tabsConfig = crossChainMode ? [
|
|
292
|
+
{ key: "aptos", label: "Aptos", enabled: true },
|
|
293
|
+
{ key: "solana", label: "Solana", enabled: crossChainWallets.solana },
|
|
294
|
+
{ key: "evm", label: "Ethereum", enabled: crossChainWallets.evm }
|
|
295
|
+
].filter((tab) => tab.enabled) : [];
|
|
296
|
+
const getTabIndex = (key) => tabsConfig.findIndex((tab) => tab.key === key);
|
|
297
|
+
const renderWalletList = (wallets2, installableWallets2) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
298
|
+
wallets2.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(WalletRow, { wallet, onConnect: handleClose }, wallet.name)),
|
|
299
|
+
!!installableWallets2.length && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
300
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
301
|
+
import_material3.Button,
|
|
302
|
+
{
|
|
303
|
+
variant: "text",
|
|
304
|
+
size: "small",
|
|
305
|
+
onClick: () => setExpanded((prev) => !prev),
|
|
306
|
+
endIcon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons_material2.ExpandMore, { sx: { height: "20px", width: "20px" } }),
|
|
307
|
+
children: "More Wallets"
|
|
308
|
+
}
|
|
309
|
+
),
|
|
310
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Collapse, { in: expanded, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Stack, { sx: { gap: 1 }, children: installableWallets2.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
311
|
+
WalletRow,
|
|
312
|
+
{
|
|
313
|
+
wallet,
|
|
314
|
+
onConnect: handleClose
|
|
315
|
+
},
|
|
316
|
+
wallet.name
|
|
317
|
+
)) }) })
|
|
318
|
+
] })
|
|
319
|
+
] });
|
|
243
320
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
244
321
|
import_material3.Dialog,
|
|
245
322
|
{
|
|
@@ -422,36 +499,26 @@ function WalletsModal(_a) {
|
|
|
422
499
|
),
|
|
423
500
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Divider, { sx: { color: grey[400], pt: 2 }, children: "Or" })
|
|
424
501
|
] }),
|
|
425
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
426
|
-
|
|
427
|
-
|
|
502
|
+
crossChainMode ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
503
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
504
|
+
import_material3.Tabs,
|
|
428
505
|
{
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Collapse, { in: expanded, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Stack, { sx: { gap: 1 }, children: installableWallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
446
|
-
WalletRow,
|
|
447
|
-
{
|
|
448
|
-
wallet,
|
|
449
|
-
onConnect: handleClose
|
|
450
|
-
},
|
|
451
|
-
wallet.name
|
|
452
|
-
)) }) })
|
|
453
|
-
] })
|
|
454
|
-
] })
|
|
506
|
+
value: tabValue,
|
|
507
|
+
onChange: handleTabChange,
|
|
508
|
+
textColor: "secondary",
|
|
509
|
+
indicatorColor: "secondary",
|
|
510
|
+
variant: "fullWidth",
|
|
511
|
+
"aria-label": "cross chain wallets tabs",
|
|
512
|
+
children: tabsConfig.map((tab, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Tab, __spreadValues({ label: tab.label }, a11yProps(index)), tab.key))
|
|
513
|
+
}
|
|
514
|
+
),
|
|
515
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TabPanel, { value: tabValue, index: getTabIndex("aptos"), children: renderWalletList(aptosWallets, aptosInstallableWallets) }),
|
|
516
|
+
crossChainWallets.solana && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TabPanel, { value: tabValue, index: getTabIndex("solana"), children: renderWalletList(solanaWallets, solanaInstallableWallets) }),
|
|
517
|
+
crossChainWallets.evm && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TabPanel, { value: tabValue, index: getTabIndex("evm"), children: renderWalletList(evmWallets, evmInstallableWallets) })
|
|
518
|
+
] }) : (
|
|
519
|
+
// Simple list mode (original WalletModel behavior)
|
|
520
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Stack, { sx: { gap: 1 }, children: renderWalletList(availableWallets, installableWallets) })
|
|
521
|
+
)
|
|
455
522
|
] })
|
|
456
523
|
]
|
|
457
524
|
}
|
|
@@ -640,6 +707,26 @@ function renderEducationScreen(screen) {
|
|
|
640
707
|
)
|
|
641
708
|
] });
|
|
642
709
|
}
|
|
710
|
+
function TabPanel(props) {
|
|
711
|
+
const _a = props, { children, value, index } = _a, other = __objRest(_a, ["children", "value", "index"]);
|
|
712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
713
|
+
"div",
|
|
714
|
+
__spreadProps(__spreadValues({
|
|
715
|
+
role: "tabpanel",
|
|
716
|
+
hidden: value !== index,
|
|
717
|
+
id: `simple-tabpanel-${index}`,
|
|
718
|
+
"aria-labelledby": `simple-tab-${index}`
|
|
719
|
+
}, other), {
|
|
720
|
+
children: value === index && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Stack, { sx: { gap: 1 }, children })
|
|
721
|
+
})
|
|
722
|
+
);
|
|
723
|
+
}
|
|
724
|
+
function a11yProps(index) {
|
|
725
|
+
return {
|
|
726
|
+
id: `simple-tab-${index}`,
|
|
727
|
+
"aria-controls": `simple-tabpanel-${index}`
|
|
728
|
+
};
|
|
729
|
+
}
|
|
643
730
|
|
|
644
731
|
// src/WalletConnector.tsx
|
|
645
732
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -647,11 +734,13 @@ function WalletConnector(_a) {
|
|
|
647
734
|
var _b = _a, {
|
|
648
735
|
networkSupport,
|
|
649
736
|
handleNavigate,
|
|
650
|
-
modalMaxWidth
|
|
737
|
+
modalMaxWidth,
|
|
738
|
+
crossChainWallets
|
|
651
739
|
} = _b, walletSortingOptions = __objRest(_b, [
|
|
652
740
|
"networkSupport",
|
|
653
741
|
"handleNavigate",
|
|
654
|
-
"modalMaxWidth"
|
|
742
|
+
"modalMaxWidth",
|
|
743
|
+
"crossChainWallets"
|
|
655
744
|
]);
|
|
656
745
|
const [modalOpen, setModalOpen] = (0, import_react4.useState)(false);
|
|
657
746
|
const handleModalOpen = () => setModalOpen(true);
|
|
@@ -670,7 +759,8 @@ function WalletConnector(_a) {
|
|
|
670
759
|
handleClose,
|
|
671
760
|
modalOpen,
|
|
672
761
|
networkSupport,
|
|
673
|
-
modalMaxWidth
|
|
762
|
+
modalMaxWidth,
|
|
763
|
+
crossChainWallets
|
|
674
764
|
}, walletSortingOptions)
|
|
675
765
|
)
|
|
676
766
|
] });
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -14,6 +16,7 @@ var __spreadValues = (a, b) => {
|
|
|
14
16
|
}
|
|
15
17
|
return a;
|
|
16
18
|
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
17
20
|
var __objRest = (source, exclude) => {
|
|
18
21
|
var target = {};
|
|
19
22
|
for (var prop in source)
|
|
@@ -200,6 +203,8 @@ import {
|
|
|
200
203
|
ListItem as ListItem2,
|
|
201
204
|
ListItemText as ListItemText2,
|
|
202
205
|
Stack,
|
|
206
|
+
Tab,
|
|
207
|
+
Tabs,
|
|
203
208
|
Typography as Typography2,
|
|
204
209
|
useTheme
|
|
205
210
|
} from "@mui/material";
|
|
@@ -234,21 +239,95 @@ function WalletsModal(_a) {
|
|
|
234
239
|
handleClose,
|
|
235
240
|
modalOpen,
|
|
236
241
|
networkSupport,
|
|
237
|
-
modalMaxWidth
|
|
242
|
+
modalMaxWidth,
|
|
243
|
+
crossChainWallets
|
|
238
244
|
} = _b, walletSortingOptions = __objRest(_b, [
|
|
239
245
|
"handleClose",
|
|
240
246
|
"modalOpen",
|
|
241
247
|
"networkSupport",
|
|
242
|
-
"modalMaxWidth"
|
|
248
|
+
"modalMaxWidth",
|
|
249
|
+
"crossChainWallets"
|
|
243
250
|
]);
|
|
244
251
|
const theme = useTheme();
|
|
245
252
|
const [expanded, setExpanded] = useState3(false);
|
|
253
|
+
const [tabValue, setTabValue] = useState3(0);
|
|
254
|
+
const handleTabChange = (event, newValue) => {
|
|
255
|
+
setTabValue(newValue);
|
|
256
|
+
};
|
|
246
257
|
const { wallets = [], notDetectedWallets = [] } = useWallet3();
|
|
247
258
|
const { aptosConnectWallets, availableWallets, installableWallets } = groupAndSortWallets(
|
|
248
259
|
[...wallets, ...notDetectedWallets],
|
|
249
260
|
walletSortingOptions
|
|
250
261
|
);
|
|
251
262
|
const hasAptosConnectWallets = !!aptosConnectWallets.length;
|
|
263
|
+
const crossChainMode = crossChainWallets && (crossChainWallets.evm || crossChainWallets.solana);
|
|
264
|
+
const { evmWallets, solanaWallets, aptosWallets } = crossChainMode ? availableWallets.reduce(
|
|
265
|
+
(acc, wallet) => {
|
|
266
|
+
if (wallet.name.includes("Ethereum")) {
|
|
267
|
+
acc.evmWallets.push(wallet);
|
|
268
|
+
} else if (wallet.name.includes("Solana")) {
|
|
269
|
+
acc.solanaWallets.push(wallet);
|
|
270
|
+
} else {
|
|
271
|
+
acc.aptosWallets.push(wallet);
|
|
272
|
+
}
|
|
273
|
+
return acc;
|
|
274
|
+
},
|
|
275
|
+
{ evmWallets: [], solanaWallets: [], aptosWallets: [] }
|
|
276
|
+
) : { evmWallets: [], solanaWallets: [], aptosWallets: availableWallets };
|
|
277
|
+
const {
|
|
278
|
+
evmInstallableWallets,
|
|
279
|
+
solanaInstallableWallets,
|
|
280
|
+
aptosInstallableWallets
|
|
281
|
+
} = crossChainMode ? installableWallets.reduce(
|
|
282
|
+
(acc, wallet) => {
|
|
283
|
+
if (wallet.name.includes("Ethereum")) {
|
|
284
|
+
acc.evmInstallableWallets.push(wallet);
|
|
285
|
+
} else if (wallet.name.includes("Solana")) {
|
|
286
|
+
acc.solanaInstallableWallets.push(wallet);
|
|
287
|
+
} else {
|
|
288
|
+
acc.aptosInstallableWallets.push(wallet);
|
|
289
|
+
}
|
|
290
|
+
return acc;
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
evmInstallableWallets: [],
|
|
294
|
+
solanaInstallableWallets: [],
|
|
295
|
+
aptosInstallableWallets: []
|
|
296
|
+
}
|
|
297
|
+
) : {
|
|
298
|
+
evmInstallableWallets: [],
|
|
299
|
+
solanaInstallableWallets: [],
|
|
300
|
+
aptosInstallableWallets: installableWallets
|
|
301
|
+
};
|
|
302
|
+
const tabsConfig = crossChainMode ? [
|
|
303
|
+
{ key: "aptos", label: "Aptos", enabled: true },
|
|
304
|
+
{ key: "solana", label: "Solana", enabled: crossChainWallets.solana },
|
|
305
|
+
{ key: "evm", label: "Ethereum", enabled: crossChainWallets.evm }
|
|
306
|
+
].filter((tab) => tab.enabled) : [];
|
|
307
|
+
const getTabIndex = (key) => tabsConfig.findIndex((tab) => tab.key === key);
|
|
308
|
+
const renderWalletList = (wallets2, installableWallets2) => /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
309
|
+
wallets2.map((wallet) => /* @__PURE__ */ jsx3(WalletRow, { wallet, onConnect: handleClose }, wallet.name)),
|
|
310
|
+
!!installableWallets2.length && /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
311
|
+
/* @__PURE__ */ jsx3(
|
|
312
|
+
Button2,
|
|
313
|
+
{
|
|
314
|
+
variant: "text",
|
|
315
|
+
size: "small",
|
|
316
|
+
onClick: () => setExpanded((prev) => !prev),
|
|
317
|
+
endIcon: /* @__PURE__ */ jsx3(ExpandMore, { sx: { height: "20px", width: "20px" } }),
|
|
318
|
+
children: "More Wallets"
|
|
319
|
+
}
|
|
320
|
+
),
|
|
321
|
+
/* @__PURE__ */ jsx3(Collapse, { in: expanded, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsx3(Stack, { sx: { gap: 1 }, children: installableWallets2.map((wallet) => /* @__PURE__ */ jsx3(
|
|
322
|
+
WalletRow,
|
|
323
|
+
{
|
|
324
|
+
wallet,
|
|
325
|
+
onConnect: handleClose
|
|
326
|
+
},
|
|
327
|
+
wallet.name
|
|
328
|
+
)) }) })
|
|
329
|
+
] })
|
|
330
|
+
] });
|
|
252
331
|
return /* @__PURE__ */ jsx3(
|
|
253
332
|
Dialog,
|
|
254
333
|
{
|
|
@@ -431,36 +510,26 @@ function WalletsModal(_a) {
|
|
|
431
510
|
),
|
|
432
511
|
/* @__PURE__ */ jsx3(Divider, { sx: { color: grey[400], pt: 2 }, children: "Or" })
|
|
433
512
|
] }),
|
|
434
|
-
/* @__PURE__ */ jsxs3(
|
|
435
|
-
|
|
436
|
-
|
|
513
|
+
crossChainMode ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
514
|
+
/* @__PURE__ */ jsx3(
|
|
515
|
+
Tabs,
|
|
437
516
|
{
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
/* @__PURE__ */ jsx3(Collapse, { in: expanded, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsx3(Stack, { sx: { gap: 1 }, children: installableWallets.map((wallet) => /* @__PURE__ */ jsx3(
|
|
455
|
-
WalletRow,
|
|
456
|
-
{
|
|
457
|
-
wallet,
|
|
458
|
-
onConnect: handleClose
|
|
459
|
-
},
|
|
460
|
-
wallet.name
|
|
461
|
-
)) }) })
|
|
462
|
-
] })
|
|
463
|
-
] })
|
|
517
|
+
value: tabValue,
|
|
518
|
+
onChange: handleTabChange,
|
|
519
|
+
textColor: "secondary",
|
|
520
|
+
indicatorColor: "secondary",
|
|
521
|
+
variant: "fullWidth",
|
|
522
|
+
"aria-label": "cross chain wallets tabs",
|
|
523
|
+
children: tabsConfig.map((tab, index) => /* @__PURE__ */ jsx3(Tab, __spreadValues({ label: tab.label }, a11yProps(index)), tab.key))
|
|
524
|
+
}
|
|
525
|
+
),
|
|
526
|
+
/* @__PURE__ */ jsx3(TabPanel, { value: tabValue, index: getTabIndex("aptos"), children: renderWalletList(aptosWallets, aptosInstallableWallets) }),
|
|
527
|
+
crossChainWallets.solana && /* @__PURE__ */ jsx3(TabPanel, { value: tabValue, index: getTabIndex("solana"), children: renderWalletList(solanaWallets, solanaInstallableWallets) }),
|
|
528
|
+
crossChainWallets.evm && /* @__PURE__ */ jsx3(TabPanel, { value: tabValue, index: getTabIndex("evm"), children: renderWalletList(evmWallets, evmInstallableWallets) })
|
|
529
|
+
] }) : (
|
|
530
|
+
// Simple list mode (original WalletModel behavior)
|
|
531
|
+
/* @__PURE__ */ jsx3(Stack, { sx: { gap: 1 }, children: renderWalletList(availableWallets, installableWallets) })
|
|
532
|
+
)
|
|
464
533
|
] })
|
|
465
534
|
]
|
|
466
535
|
}
|
|
@@ -649,6 +718,26 @@ function renderEducationScreen(screen) {
|
|
|
649
718
|
)
|
|
650
719
|
] });
|
|
651
720
|
}
|
|
721
|
+
function TabPanel(props) {
|
|
722
|
+
const _a = props, { children, value, index } = _a, other = __objRest(_a, ["children", "value", "index"]);
|
|
723
|
+
return /* @__PURE__ */ jsx3(
|
|
724
|
+
"div",
|
|
725
|
+
__spreadProps(__spreadValues({
|
|
726
|
+
role: "tabpanel",
|
|
727
|
+
hidden: value !== index,
|
|
728
|
+
id: `simple-tabpanel-${index}`,
|
|
729
|
+
"aria-labelledby": `simple-tab-${index}`
|
|
730
|
+
}, other), {
|
|
731
|
+
children: value === index && /* @__PURE__ */ jsx3(Stack, { sx: { gap: 1 }, children })
|
|
732
|
+
})
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
function a11yProps(index) {
|
|
736
|
+
return {
|
|
737
|
+
id: `simple-tab-${index}`,
|
|
738
|
+
"aria-controls": `simple-tabpanel-${index}`
|
|
739
|
+
};
|
|
740
|
+
}
|
|
652
741
|
|
|
653
742
|
// src/WalletConnector.tsx
|
|
654
743
|
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -656,11 +745,13 @@ function WalletConnector(_a) {
|
|
|
656
745
|
var _b = _a, {
|
|
657
746
|
networkSupport,
|
|
658
747
|
handleNavigate,
|
|
659
|
-
modalMaxWidth
|
|
748
|
+
modalMaxWidth,
|
|
749
|
+
crossChainWallets
|
|
660
750
|
} = _b, walletSortingOptions = __objRest(_b, [
|
|
661
751
|
"networkSupport",
|
|
662
752
|
"handleNavigate",
|
|
663
|
-
"modalMaxWidth"
|
|
753
|
+
"modalMaxWidth",
|
|
754
|
+
"crossChainWallets"
|
|
664
755
|
]);
|
|
665
756
|
const [modalOpen, setModalOpen] = useState4(false);
|
|
666
757
|
const handleModalOpen = () => setModalOpen(true);
|
|
@@ -679,7 +770,8 @@ function WalletConnector(_a) {
|
|
|
679
770
|
handleClose,
|
|
680
771
|
modalOpen,
|
|
681
772
|
networkSupport,
|
|
682
|
-
modalMaxWidth
|
|
773
|
+
modalMaxWidth,
|
|
774
|
+
crossChainWallets
|
|
683
775
|
}, walletSortingOptions)
|
|
684
776
|
)
|
|
685
777
|
] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-labs/wallet-adapter-mui-design",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.1",
|
|
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": "7.2.
|
|
44
|
+
"@aptos-labs/wallet-adapter-react": "7.2.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^18.0.0 || ^19.0.0",
|
package/src/WalletModel.tsx
CHANGED
|
@@ -70,7 +70,7 @@ export default function WalletsModal({
|
|
|
70
70
|
const { aptosConnectWallets, availableWallets, installableWallets } =
|
|
71
71
|
groupAndSortWallets(
|
|
72
72
|
[...wallets, ...notDetectedWallets],
|
|
73
|
-
walletSortingOptions
|
|
73
|
+
walletSortingOptions,
|
|
74
74
|
);
|
|
75
75
|
|
|
76
76
|
const hasAptosConnectWallets = !!aptosConnectWallets.length;
|
|
@@ -96,7 +96,7 @@ export default function WalletsModal({
|
|
|
96
96
|
}
|
|
97
97
|
return acc;
|
|
98
98
|
},
|
|
99
|
-
{ evmWallets: [], solanaWallets: [], aptosWallets: [] }
|
|
99
|
+
{ evmWallets: [], solanaWallets: [], aptosWallets: [] },
|
|
100
100
|
)
|
|
101
101
|
: { evmWallets: [], solanaWallets: [], aptosWallets: availableWallets };
|
|
102
102
|
|
|
@@ -124,7 +124,7 @@ export default function WalletsModal({
|
|
|
124
124
|
evmInstallableWallets: [],
|
|
125
125
|
solanaInstallableWallets: [],
|
|
126
126
|
aptosInstallableWallets: [],
|
|
127
|
-
}
|
|
127
|
+
},
|
|
128
128
|
)
|
|
129
129
|
: {
|
|
130
130
|
evmInstallableWallets: [],
|
|
@@ -147,7 +147,7 @@ export default function WalletsModal({
|
|
|
147
147
|
// Render wallet list for a specific chain
|
|
148
148
|
const renderWalletList = (
|
|
149
149
|
wallets: AdapterWallet[],
|
|
150
|
-
installableWallets: AdapterNotDetectedWallet[]
|
|
150
|
+
installableWallets: AdapterNotDetectedWallet[],
|
|
151
151
|
) => (
|
|
152
152
|
<>
|
|
153
153
|
{wallets.map((wallet) => (
|