@aptos-labs/wallet-adapter-ant-design 4.0.10 → 4.0.12

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @aptos-labs/wallet-adapter-ant-design
2
2
 
3
+ ## 4.0.12
4
+
5
+ ### Patch Changes
6
+
7
+ - @aptos-labs/wallet-adapter-react@5.0.3
8
+
9
+ ## 4.0.11
10
+
11
+ ### Patch Changes
12
+
13
+ - @aptos-labs/wallet-adapter-react@5.0.2
14
+
3
15
  ## 4.0.10
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,11 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { WalletSortingOptions } from '@aptos-labs/wallet-adapter-react';
3
+ import { Dispatch, SetStateAction } from 'react';
4
+
5
+ interface WalletSelectorProps extends WalletSortingOptions {
6
+ isModalOpen?: boolean;
7
+ setModalOpen?: Dispatch<SetStateAction<boolean>>;
8
+ }
9
+ declare function WalletSelector({ isModalOpen, setModalOpen, ...walletSortingOptions }: WalletSelectorProps): react_jsx_runtime.JSX.Element;
10
+
11
+ export { WalletSelector };
package/dist/index.js CHANGED
@@ -1,8 +1,37 @@
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;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
8
  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
+ };
6
35
  var __export = (target, all) => {
7
36
  for (var name in all)
8
37
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -18,11 +47,11 @@ var __copyProps = (to, from, except, desc) => {
18
47
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
48
 
20
49
  // src/index.tsx
21
- var src_exports = {};
22
- __export(src_exports, {
50
+ var index_exports = {};
51
+ __export(index_exports, {
23
52
  WalletSelector: () => WalletSelector
24
53
  });
25
- module.exports = __toCommonJS(src_exports);
54
+ module.exports = __toCommonJS(index_exports);
26
55
 
27
56
  // src/WalletSelector.tsx
28
57
  var import_icons = require("@ant-design/icons");
@@ -31,12 +60,15 @@ var import_antd = require("antd");
31
60
  var import_react = require("react");
32
61
  var import_jsx_runtime = require("react/jsx-runtime");
33
62
  var { Text } = import_antd.Typography;
34
- function WalletSelector({
35
- isModalOpen,
36
- setModalOpen,
37
- ...walletSortingOptions
38
- }) {
39
- var _a;
63
+ function WalletSelector(_a) {
64
+ var _b = _a, {
65
+ isModalOpen,
66
+ setModalOpen
67
+ } = _b, walletSortingOptions = __objRest(_b, [
68
+ "isModalOpen",
69
+ "setModalOpen"
70
+ ]);
71
+ var _a2;
40
72
  const [walletSelectorModalOpen, setWalletSelectorModalOpen] = (0, import_react.useState)(false);
41
73
  (0, import_react.useEffect)(() => {
42
74
  if (isModalOpen !== void 0) {
@@ -68,7 +100,7 @@ function WalletSelector({
68
100
  setModalOpen(false);
69
101
  }
70
102
  };
71
- const buttonText = (account == null ? void 0 : account.ansName) || (0, import_wallet_adapter_react.truncateAddress)((_a = account == null ? void 0 : account.address) == null ? void 0 : _a.toString()) || "Unknown";
103
+ const buttonText = (account == null ? void 0 : account.ansName) || (0, import_wallet_adapter_react.truncateAddress)((_a2 = account == null ? void 0 : account.address) == null ? void 0 : _a2.toString()) || "Unknown";
72
104
  const modalProps = {
73
105
  centered: true,
74
106
  open: walletSelectorModalOpen,
@@ -77,229 +109,146 @@ function WalletSelector({
77
109
  zIndex: 9999,
78
110
  className: "wallet-selector-modal"
79
111
  };
80
- const renderEducationScreens = (screen) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Modal, {
81
- ...modalProps,
82
- afterClose: screen.cancel,
83
- title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
84
- className: "about-aptos-connect-header",
85
- children: [
86
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, {
87
- type: "text",
88
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ArrowLeftOutlined, {}),
89
- onClick: screen.cancel
90
- }),
91
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
92
- className: "wallet-modal-title",
93
- children: "About Aptos Connect"
94
- })
95
- ]
96
- }),
97
- children: [
98
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
99
- className: "about-aptos-connect-graphic-wrapper",
100
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(screen.Graphic, {})
101
- }),
102
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
103
- className: "about-aptos-connect-text-wrapper",
104
- children: [
105
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(screen.Title, {
106
- className: "about-aptos-connect-title"
107
- }),
108
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(screen.Description, {
109
- className: "about-aptos-connect-description"
110
- })
111
- ]
112
- }),
113
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
114
- className: "about-aptos-connect-footer-wrapper",
115
- children: [
116
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, {
112
+ const renderEducationScreens = (screen) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
113
+ import_antd.Modal,
114
+ __spreadProps(__spreadValues({}, modalProps), {
115
+ afterClose: screen.cancel,
116
+ title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "about-aptos-connect-header", children: [
117
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
118
+ import_antd.Button,
119
+ {
117
120
  type: "text",
118
- style: { justifySelf: "start" },
119
- onClick: screen.back,
120
- children: "Back"
121
- }),
122
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
123
- className: "about-aptos-connect-screen-indicators-wrapper",
124
- children: screen.screenIndicators.map((ScreenIndicator, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScreenIndicator, {
121
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ArrowLeftOutlined, {}),
122
+ onClick: screen.cancel
123
+ }
124
+ ),
125
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wallet-modal-title", children: "About Aptos Connect" })
126
+ ] }),
127
+ children: [
128
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "about-aptos-connect-graphic-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(screen.Graphic, {}) }),
129
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "about-aptos-connect-text-wrapper", children: [
130
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(screen.Title, { className: "about-aptos-connect-title" }),
131
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(screen.Description, { className: "about-aptos-connect-description" })
132
+ ] }),
133
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "about-aptos-connect-footer-wrapper", children: [
134
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
135
+ import_antd.Button,
136
+ {
137
+ type: "text",
138
+ style: { justifySelf: "start" },
139
+ onClick: screen.back,
140
+ children: "Back"
141
+ }
142
+ ),
143
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "about-aptos-connect-screen-indicators-wrapper", children: screen.screenIndicators.map((ScreenIndicator, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
144
+ ScreenIndicator,
145
+ {
125
146
  className: "about-aptos-connect-screen-indicator",
126
147
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {})
127
- }, i))
128
- }),
129
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, {
130
- type: "text",
131
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ArrowRightOutlined, {}),
132
- iconPosition: "end",
133
- style: { justifySelf: "end" },
134
- onClick: screen.next,
135
- children: screen.screenIndex === screen.totalScreens - 1 ? "Finish" : "Next"
136
- })
137
- ]
138
- })
139
- ]
140
- });
141
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
142
- children: [
143
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, {
144
- className: "wallet-button",
145
- onClick: onWalletButtonClick,
146
- children: connected ? buttonText : "Connect Wallet"
147
- }),
148
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.AboutAptosConnect, {
149
- renderEducationScreen: renderEducationScreens,
150
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Modal, {
151
- ...modalProps,
152
- title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
153
- className: "wallet-modal-title",
154
- children: hasAptosConnectWallets ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
155
- children: [
156
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
157
- children: "Log in or sign up"
158
- }),
159
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
160
- children: "with Social + Aptos Connect"
161
- })
148
+ },
149
+ i
150
+ )) }),
151
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
152
+ import_antd.Button,
153
+ {
154
+ type: "text",
155
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ArrowRightOutlined, {}),
156
+ iconPosition: "end",
157
+ style: { justifySelf: "end" },
158
+ onClick: screen.next,
159
+ children: screen.screenIndex === screen.totalScreens - 1 ? "Finish" : "Next"
160
+ }
161
+ )
162
+ ] })
163
+ ]
164
+ })
165
+ );
166
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
167
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, { className: "wallet-button", onClick: onWalletButtonClick, children: connected ? buttonText : "Connect Wallet" }),
168
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.AboutAptosConnect, { renderEducationScreen: renderEducationScreens, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
169
+ import_antd.Modal,
170
+ __spreadProps(__spreadValues({}, modalProps), {
171
+ title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wallet-modal-title", children: hasAptosConnectWallets ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
172
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Log in or sign up" }),
173
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "with Social + Aptos Connect" })
174
+ ] }) : "Connect Wallet" }),
175
+ children: !connected && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
176
+ hasAptosConnectWallets && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Flex, { vertical: true, gap: 12, children: [
177
+ aptosConnectWallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
178
+ AptosConnectWalletRow,
179
+ {
180
+ wallet,
181
+ onConnect: closeModal
182
+ },
183
+ wallet.name
184
+ )),
185
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "about-aptos-connect-trigger-wrapper", children: [
186
+ "Learn more about",
187
+ " ",
188
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_wallet_adapter_react.AboutAptosConnect.Trigger, { className: "about-aptos-connect-trigger", children: [
189
+ "Aptos Connect",
190
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ArrowRightOutlined, {})
191
+ ] })
192
+ ] }),
193
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_wallet_adapter_react.AptosPrivacyPolicy, { className: "aptos-connect-privacy-policy-wrapper", children: [
194
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "aptos-connect-privacy-policy-text", children: [
195
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.AptosPrivacyPolicy.Disclaimer, {}),
196
+ " ",
197
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.AptosPrivacyPolicy.Link, { className: "aptos-connect-privacy-policy-link" }),
198
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "." })
199
+ ] }),
200
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.AptosPrivacyPolicy.PoweredBy, { className: "aptos-connect-powered-by" })
201
+ ] }),
202
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Divider, { children: "Or" })
203
+ ] }),
204
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Flex, { vertical: true, gap: 12, children: availableWallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
205
+ WalletRow,
206
+ {
207
+ wallet,
208
+ onConnect: closeModal
209
+ },
210
+ wallet.name
211
+ )) }),
212
+ !!installableWallets.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
213
+ import_antd.Collapse,
214
+ {
215
+ ghost: true,
216
+ expandIconPosition: "end",
217
+ items: [
218
+ {
219
+ key: "more-wallets",
220
+ label: "More Wallets",
221
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Flex, { vertical: true, gap: 12, children: installableWallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
222
+ WalletRow,
223
+ {
224
+ wallet,
225
+ onConnect: closeModal
226
+ },
227
+ wallet.name
228
+ )) })
229
+ }
162
230
  ]
163
- }) : "Connect Wallet"
164
- }),
165
- children: !connected && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
166
- children: [
167
- hasAptosConnectWallets && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Flex, {
168
- vertical: true,
169
- gap: 12,
170
- children: [
171
- aptosConnectWallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AptosConnectWalletRow, {
172
- wallet,
173
- onConnect: closeModal
174
- }, wallet.name)),
175
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
176
- className: "about-aptos-connect-trigger-wrapper",
177
- children: [
178
- "Learn more about",
179
- " ",
180
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_wallet_adapter_react.AboutAptosConnect.Trigger, {
181
- className: "about-aptos-connect-trigger",
182
- children: [
183
- "Aptos Connect",
184
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ArrowRightOutlined, {})
185
- ]
186
- })
187
- ]
188
- }),
189
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_wallet_adapter_react.AptosPrivacyPolicy, {
190
- className: "aptos-connect-privacy-policy-wrapper",
191
- children: [
192
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
193
- className: "aptos-connect-privacy-policy-text",
194
- children: [
195
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.AptosPrivacyPolicy.Disclaimer, {}),
196
- " ",
197
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.AptosPrivacyPolicy.Link, {
198
- className: "aptos-connect-privacy-policy-link"
199
- }),
200
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
201
- children: "."
202
- })
203
- ]
204
- }),
205
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.AptosPrivacyPolicy.PoweredBy, {
206
- className: "aptos-connect-powered-by"
207
- })
208
- ]
209
- }),
210
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Divider, {
211
- children: "Or"
212
- })
213
- ]
214
- }),
215
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Flex, {
216
- vertical: true,
217
- gap: 12,
218
- children: availableWallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WalletRow, {
219
- wallet,
220
- onConnect: closeModal
221
- }, wallet.name))
222
- }),
223
- !!installableWallets.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Collapse, {
224
- ghost: true,
225
- expandIconPosition: "end",
226
- items: [
227
- {
228
- key: "more-wallets",
229
- label: "More Wallets",
230
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Flex, {
231
- vertical: true,
232
- gap: 12,
233
- children: installableWallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WalletRow, {
234
- wallet,
235
- onConnect: closeModal
236
- }, wallet.name))
237
- })
238
- }
239
- ]
240
- })
241
- ]
242
- })
243
- })
231
+ }
232
+ )
233
+ ] })
244
234
  })
245
- ]
246
- });
235
+ ) })
236
+ ] });
247
237
  }
248
238
  function WalletRow({ wallet, onConnect }) {
249
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem, {
250
- wallet,
251
- onConnect,
252
- asChild: true,
253
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
254
- className: "wallet-menu-wrapper",
255
- children: [
256
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
257
- className: "wallet-name-wrapper",
258
- children: [
259
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.Icon, {
260
- className: "wallet-selector-icon"
261
- }),
262
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.Name, {
263
- asChild: true,
264
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
265
- className: "wallet-selector-text",
266
- children: wallet.name
267
- })
268
- })
269
- ]
270
- }),
271
- (0, import_wallet_adapter_react.isInstallRequired)(wallet) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.InstallLink, {
272
- className: "wallet-connect-install"
273
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.ConnectButton, {
274
- asChild: true,
275
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, {
276
- className: "wallet-connect-button",
277
- children: "Connect"
278
- })
279
- })
280
- ]
281
- })
282
- });
239
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem, { wallet, onConnect, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wallet-menu-wrapper", children: [
240
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wallet-name-wrapper", children: [
241
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.Icon, { className: "wallet-selector-icon" }),
242
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.Name, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { className: "wallet-selector-text", children: wallet.name }) })
243
+ ] }),
244
+ (0, import_wallet_adapter_react.isInstallRequired)(wallet) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.InstallLink, { className: "wallet-connect-install" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.ConnectButton, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, { className: "wallet-connect-button", children: "Connect" }) })
245
+ ] }) });
283
246
  }
284
247
  function AptosConnectWalletRow({ wallet, onConnect }) {
285
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem, {
286
- wallet,
287
- onConnect,
288
- asChild: true,
289
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.ConnectButton, {
290
- asChild: true,
291
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Button, {
292
- size: "large",
293
- className: "aptos-connect-button",
294
- children: [
295
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.Icon, {
296
- className: "wallet-selector-icon"
297
- }),
298
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.Name, {})
299
- ]
300
- })
301
- })
302
- });
248
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem, { wallet, onConnect, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.ConnectButton, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd.Button, { size: "large", className: "aptos-connect-button", children: [
249
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.Icon, { className: "wallet-selector-icon" }),
250
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_wallet_adapter_react.WalletItem.Name, {})
251
+ ] }) }) });
303
252
  }
304
253
  // Annotate the CommonJS export names for ESM import in node:
305
254
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -1,3 +1,35 @@
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
+
1
33
  // src/WalletSelector.tsx
2
34
  import { ArrowLeftOutlined, ArrowRightOutlined } from "@ant-design/icons";
3
35
  import {
@@ -20,12 +52,15 @@ import {
20
52
  import { useEffect, useState } from "react";
21
53
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
22
54
  var { Text } = Typography;
23
- function WalletSelector({
24
- isModalOpen,
25
- setModalOpen,
26
- ...walletSortingOptions
27
- }) {
28
- var _a;
55
+ function WalletSelector(_a) {
56
+ var _b = _a, {
57
+ isModalOpen,
58
+ setModalOpen
59
+ } = _b, walletSortingOptions = __objRest(_b, [
60
+ "isModalOpen",
61
+ "setModalOpen"
62
+ ]);
63
+ var _a2;
29
64
  const [walletSelectorModalOpen, setWalletSelectorModalOpen] = useState(false);
30
65
  useEffect(() => {
31
66
  if (isModalOpen !== void 0) {
@@ -57,7 +92,7 @@ function WalletSelector({
57
92
  setModalOpen(false);
58
93
  }
59
94
  };
60
- const buttonText = (account == null ? void 0 : account.ansName) || truncateAddress((_a = account == null ? void 0 : account.address) == null ? void 0 : _a.toString()) || "Unknown";
95
+ const buttonText = (account == null ? void 0 : account.ansName) || truncateAddress((_a2 = account == null ? void 0 : account.address) == null ? void 0 : _a2.toString()) || "Unknown";
61
96
  const modalProps = {
62
97
  centered: true,
63
98
  open: walletSelectorModalOpen,
@@ -66,229 +101,146 @@ function WalletSelector({
66
101
  zIndex: 9999,
67
102
  className: "wallet-selector-modal"
68
103
  };
69
- const renderEducationScreens = (screen) => /* @__PURE__ */ jsxs(Modal, {
70
- ...modalProps,
71
- afterClose: screen.cancel,
72
- title: /* @__PURE__ */ jsxs("div", {
73
- className: "about-aptos-connect-header",
74
- children: [
75
- /* @__PURE__ */ jsx(Button, {
76
- type: "text",
77
- icon: /* @__PURE__ */ jsx(ArrowLeftOutlined, {}),
78
- onClick: screen.cancel
79
- }),
80
- /* @__PURE__ */ jsx("div", {
81
- className: "wallet-modal-title",
82
- children: "About Aptos Connect"
83
- })
84
- ]
85
- }),
86
- children: [
87
- /* @__PURE__ */ jsx("div", {
88
- className: "about-aptos-connect-graphic-wrapper",
89
- children: /* @__PURE__ */ jsx(screen.Graphic, {})
90
- }),
91
- /* @__PURE__ */ jsxs("div", {
92
- className: "about-aptos-connect-text-wrapper",
93
- children: [
94
- /* @__PURE__ */ jsx(screen.Title, {
95
- className: "about-aptos-connect-title"
96
- }),
97
- /* @__PURE__ */ jsx(screen.Description, {
98
- className: "about-aptos-connect-description"
99
- })
100
- ]
101
- }),
102
- /* @__PURE__ */ jsxs("div", {
103
- className: "about-aptos-connect-footer-wrapper",
104
- children: [
105
- /* @__PURE__ */ jsx(Button, {
104
+ const renderEducationScreens = (screen) => /* @__PURE__ */ jsxs(
105
+ Modal,
106
+ __spreadProps(__spreadValues({}, modalProps), {
107
+ afterClose: screen.cancel,
108
+ title: /* @__PURE__ */ jsxs("div", { className: "about-aptos-connect-header", children: [
109
+ /* @__PURE__ */ jsx(
110
+ Button,
111
+ {
106
112
  type: "text",
107
- style: { justifySelf: "start" },
108
- onClick: screen.back,
109
- children: "Back"
110
- }),
111
- /* @__PURE__ */ jsx("div", {
112
- className: "about-aptos-connect-screen-indicators-wrapper",
113
- children: screen.screenIndicators.map((ScreenIndicator, i) => /* @__PURE__ */ jsx(ScreenIndicator, {
113
+ icon: /* @__PURE__ */ jsx(ArrowLeftOutlined, {}),
114
+ onClick: screen.cancel
115
+ }
116
+ ),
117
+ /* @__PURE__ */ jsx("div", { className: "wallet-modal-title", children: "About Aptos Connect" })
118
+ ] }),
119
+ children: [
120
+ /* @__PURE__ */ jsx("div", { className: "about-aptos-connect-graphic-wrapper", children: /* @__PURE__ */ jsx(screen.Graphic, {}) }),
121
+ /* @__PURE__ */ jsxs("div", { className: "about-aptos-connect-text-wrapper", children: [
122
+ /* @__PURE__ */ jsx(screen.Title, { className: "about-aptos-connect-title" }),
123
+ /* @__PURE__ */ jsx(screen.Description, { className: "about-aptos-connect-description" })
124
+ ] }),
125
+ /* @__PURE__ */ jsxs("div", { className: "about-aptos-connect-footer-wrapper", children: [
126
+ /* @__PURE__ */ jsx(
127
+ Button,
128
+ {
129
+ type: "text",
130
+ style: { justifySelf: "start" },
131
+ onClick: screen.back,
132
+ children: "Back"
133
+ }
134
+ ),
135
+ /* @__PURE__ */ jsx("div", { className: "about-aptos-connect-screen-indicators-wrapper", children: screen.screenIndicators.map((ScreenIndicator, i) => /* @__PURE__ */ jsx(
136
+ ScreenIndicator,
137
+ {
114
138
  className: "about-aptos-connect-screen-indicator",
115
139
  children: /* @__PURE__ */ jsx("div", {})
116
- }, i))
117
- }),
118
- /* @__PURE__ */ jsx(Button, {
119
- type: "text",
120
- icon: /* @__PURE__ */ jsx(ArrowRightOutlined, {}),
121
- iconPosition: "end",
122
- style: { justifySelf: "end" },
123
- onClick: screen.next,
124
- children: screen.screenIndex === screen.totalScreens - 1 ? "Finish" : "Next"
125
- })
126
- ]
127
- })
128
- ]
129
- });
130
- return /* @__PURE__ */ jsxs(Fragment, {
131
- children: [
132
- /* @__PURE__ */ jsx(Button, {
133
- className: "wallet-button",
134
- onClick: onWalletButtonClick,
135
- children: connected ? buttonText : "Connect Wallet"
136
- }),
137
- /* @__PURE__ */ jsx(AboutAptosConnect, {
138
- renderEducationScreen: renderEducationScreens,
139
- children: /* @__PURE__ */ jsx(Modal, {
140
- ...modalProps,
141
- title: /* @__PURE__ */ jsx("div", {
142
- className: "wallet-modal-title",
143
- children: hasAptosConnectWallets ? /* @__PURE__ */ jsxs(Fragment, {
144
- children: [
145
- /* @__PURE__ */ jsx("span", {
146
- children: "Log in or sign up"
147
- }),
148
- /* @__PURE__ */ jsx("span", {
149
- children: "with Social + Aptos Connect"
150
- })
140
+ },
141
+ i
142
+ )) }),
143
+ /* @__PURE__ */ jsx(
144
+ Button,
145
+ {
146
+ type: "text",
147
+ icon: /* @__PURE__ */ jsx(ArrowRightOutlined, {}),
148
+ iconPosition: "end",
149
+ style: { justifySelf: "end" },
150
+ onClick: screen.next,
151
+ children: screen.screenIndex === screen.totalScreens - 1 ? "Finish" : "Next"
152
+ }
153
+ )
154
+ ] })
155
+ ]
156
+ })
157
+ );
158
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
159
+ /* @__PURE__ */ jsx(Button, { className: "wallet-button", onClick: onWalletButtonClick, children: connected ? buttonText : "Connect Wallet" }),
160
+ /* @__PURE__ */ jsx(AboutAptosConnect, { renderEducationScreen: renderEducationScreens, children: /* @__PURE__ */ jsx(
161
+ Modal,
162
+ __spreadProps(__spreadValues({}, modalProps), {
163
+ title: /* @__PURE__ */ jsx("div", { className: "wallet-modal-title", children: hasAptosConnectWallets ? /* @__PURE__ */ jsxs(Fragment, { children: [
164
+ /* @__PURE__ */ jsx("span", { children: "Log in or sign up" }),
165
+ /* @__PURE__ */ jsx("span", { children: "with Social + Aptos Connect" })
166
+ ] }) : "Connect Wallet" }),
167
+ children: !connected && /* @__PURE__ */ jsxs(Fragment, { children: [
168
+ hasAptosConnectWallets && /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 12, children: [
169
+ aptosConnectWallets.map((wallet) => /* @__PURE__ */ jsx(
170
+ AptosConnectWalletRow,
171
+ {
172
+ wallet,
173
+ onConnect: closeModal
174
+ },
175
+ wallet.name
176
+ )),
177
+ /* @__PURE__ */ jsxs("p", { className: "about-aptos-connect-trigger-wrapper", children: [
178
+ "Learn more about",
179
+ " ",
180
+ /* @__PURE__ */ jsxs(AboutAptosConnect.Trigger, { className: "about-aptos-connect-trigger", children: [
181
+ "Aptos Connect",
182
+ /* @__PURE__ */ jsx(ArrowRightOutlined, {})
183
+ ] })
184
+ ] }),
185
+ /* @__PURE__ */ jsxs(AptosPrivacyPolicy, { className: "aptos-connect-privacy-policy-wrapper", children: [
186
+ /* @__PURE__ */ jsxs("p", { className: "aptos-connect-privacy-policy-text", children: [
187
+ /* @__PURE__ */ jsx(AptosPrivacyPolicy.Disclaimer, {}),
188
+ " ",
189
+ /* @__PURE__ */ jsx(AptosPrivacyPolicy.Link, { className: "aptos-connect-privacy-policy-link" }),
190
+ /* @__PURE__ */ jsx("span", { children: "." })
191
+ ] }),
192
+ /* @__PURE__ */ jsx(AptosPrivacyPolicy.PoweredBy, { className: "aptos-connect-powered-by" })
193
+ ] }),
194
+ /* @__PURE__ */ jsx(Divider, { children: "Or" })
195
+ ] }),
196
+ /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 12, children: availableWallets.map((wallet) => /* @__PURE__ */ jsx(
197
+ WalletRow,
198
+ {
199
+ wallet,
200
+ onConnect: closeModal
201
+ },
202
+ wallet.name
203
+ )) }),
204
+ !!installableWallets.length && /* @__PURE__ */ jsx(
205
+ Collapse,
206
+ {
207
+ ghost: true,
208
+ expandIconPosition: "end",
209
+ items: [
210
+ {
211
+ key: "more-wallets",
212
+ label: "More Wallets",
213
+ children: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 12, children: installableWallets.map((wallet) => /* @__PURE__ */ jsx(
214
+ WalletRow,
215
+ {
216
+ wallet,
217
+ onConnect: closeModal
218
+ },
219
+ wallet.name
220
+ )) })
221
+ }
151
222
  ]
152
- }) : "Connect Wallet"
153
- }),
154
- children: !connected && /* @__PURE__ */ jsxs(Fragment, {
155
- children: [
156
- hasAptosConnectWallets && /* @__PURE__ */ jsxs(Flex, {
157
- vertical: true,
158
- gap: 12,
159
- children: [
160
- aptosConnectWallets.map((wallet) => /* @__PURE__ */ jsx(AptosConnectWalletRow, {
161
- wallet,
162
- onConnect: closeModal
163
- }, wallet.name)),
164
- /* @__PURE__ */ jsxs("p", {
165
- className: "about-aptos-connect-trigger-wrapper",
166
- children: [
167
- "Learn more about",
168
- " ",
169
- /* @__PURE__ */ jsxs(AboutAptosConnect.Trigger, {
170
- className: "about-aptos-connect-trigger",
171
- children: [
172
- "Aptos Connect",
173
- /* @__PURE__ */ jsx(ArrowRightOutlined, {})
174
- ]
175
- })
176
- ]
177
- }),
178
- /* @__PURE__ */ jsxs(AptosPrivacyPolicy, {
179
- className: "aptos-connect-privacy-policy-wrapper",
180
- children: [
181
- /* @__PURE__ */ jsxs("p", {
182
- className: "aptos-connect-privacy-policy-text",
183
- children: [
184
- /* @__PURE__ */ jsx(AptosPrivacyPolicy.Disclaimer, {}),
185
- " ",
186
- /* @__PURE__ */ jsx(AptosPrivacyPolicy.Link, {
187
- className: "aptos-connect-privacy-policy-link"
188
- }),
189
- /* @__PURE__ */ jsx("span", {
190
- children: "."
191
- })
192
- ]
193
- }),
194
- /* @__PURE__ */ jsx(AptosPrivacyPolicy.PoweredBy, {
195
- className: "aptos-connect-powered-by"
196
- })
197
- ]
198
- }),
199
- /* @__PURE__ */ jsx(Divider, {
200
- children: "Or"
201
- })
202
- ]
203
- }),
204
- /* @__PURE__ */ jsx(Flex, {
205
- vertical: true,
206
- gap: 12,
207
- children: availableWallets.map((wallet) => /* @__PURE__ */ jsx(WalletRow, {
208
- wallet,
209
- onConnect: closeModal
210
- }, wallet.name))
211
- }),
212
- !!installableWallets.length && /* @__PURE__ */ jsx(Collapse, {
213
- ghost: true,
214
- expandIconPosition: "end",
215
- items: [
216
- {
217
- key: "more-wallets",
218
- label: "More Wallets",
219
- children: /* @__PURE__ */ jsx(Flex, {
220
- vertical: true,
221
- gap: 12,
222
- children: installableWallets.map((wallet) => /* @__PURE__ */ jsx(WalletRow, {
223
- wallet,
224
- onConnect: closeModal
225
- }, wallet.name))
226
- })
227
- }
228
- ]
229
- })
230
- ]
231
- })
232
- })
223
+ }
224
+ )
225
+ ] })
233
226
  })
234
- ]
235
- });
227
+ ) })
228
+ ] });
236
229
  }
237
230
  function WalletRow({ wallet, onConnect }) {
238
- return /* @__PURE__ */ jsx(WalletItem, {
239
- wallet,
240
- onConnect,
241
- asChild: true,
242
- children: /* @__PURE__ */ jsxs("div", {
243
- className: "wallet-menu-wrapper",
244
- children: [
245
- /* @__PURE__ */ jsxs("div", {
246
- className: "wallet-name-wrapper",
247
- children: [
248
- /* @__PURE__ */ jsx(WalletItem.Icon, {
249
- className: "wallet-selector-icon"
250
- }),
251
- /* @__PURE__ */ jsx(WalletItem.Name, {
252
- asChild: true,
253
- children: /* @__PURE__ */ jsx(Text, {
254
- className: "wallet-selector-text",
255
- children: wallet.name
256
- })
257
- })
258
- ]
259
- }),
260
- isInstallRequired(wallet) ? /* @__PURE__ */ jsx(WalletItem.InstallLink, {
261
- className: "wallet-connect-install"
262
- }) : /* @__PURE__ */ jsx(WalletItem.ConnectButton, {
263
- asChild: true,
264
- children: /* @__PURE__ */ jsx(Button, {
265
- className: "wallet-connect-button",
266
- children: "Connect"
267
- })
268
- })
269
- ]
270
- })
271
- });
231
+ return /* @__PURE__ */ jsx(WalletItem, { wallet, onConnect, asChild: true, children: /* @__PURE__ */ jsxs("div", { className: "wallet-menu-wrapper", children: [
232
+ /* @__PURE__ */ jsxs("div", { className: "wallet-name-wrapper", children: [
233
+ /* @__PURE__ */ jsx(WalletItem.Icon, { className: "wallet-selector-icon" }),
234
+ /* @__PURE__ */ jsx(WalletItem.Name, { asChild: true, children: /* @__PURE__ */ jsx(Text, { className: "wallet-selector-text", children: wallet.name }) })
235
+ ] }),
236
+ isInstallRequired(wallet) ? /* @__PURE__ */ jsx(WalletItem.InstallLink, { className: "wallet-connect-install" }) : /* @__PURE__ */ jsx(WalletItem.ConnectButton, { asChild: true, children: /* @__PURE__ */ jsx(Button, { className: "wallet-connect-button", children: "Connect" }) })
237
+ ] }) });
272
238
  }
273
239
  function AptosConnectWalletRow({ wallet, onConnect }) {
274
- return /* @__PURE__ */ jsx(WalletItem, {
275
- wallet,
276
- onConnect,
277
- asChild: true,
278
- children: /* @__PURE__ */ jsx(WalletItem.ConnectButton, {
279
- asChild: true,
280
- children: /* @__PURE__ */ jsxs(Button, {
281
- size: "large",
282
- className: "aptos-connect-button",
283
- children: [
284
- /* @__PURE__ */ jsx(WalletItem.Icon, {
285
- className: "wallet-selector-icon"
286
- }),
287
- /* @__PURE__ */ jsx(WalletItem.Name, {})
288
- ]
289
- })
290
- })
291
- });
240
+ return /* @__PURE__ */ jsx(WalletItem, { wallet, onConnect, asChild: true, children: /* @__PURE__ */ jsx(WalletItem.ConnectButton, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { size: "large", className: "aptos-connect-button", children: [
241
+ /* @__PURE__ */ jsx(WalletItem.Icon, { className: "wallet-selector-icon" }),
242
+ /* @__PURE__ */ jsx(WalletItem.Name, {})
243
+ ] }) }) });
292
244
  }
293
245
  export {
294
246
  WalletSelector
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-labs/wallet-adapter-ant-design",
3
- "version": "4.0.10",
3
+ "version": "4.0.12",
4
4
  "description": "Aptos Wallet Adapter ant-design",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -8,9 +8,9 @@
8
8
  "license": "Apache-2.0",
9
9
  "exports": {
10
10
  ".": {
11
+ "types": "./dist/index.d.ts",
11
12
  "require": "./dist/index.js",
12
- "import": "./dist/index.mjs",
13
- "types": "./dist/index.d.ts"
13
+ "import": "./dist/index.mjs"
14
14
  },
15
15
  "./dist/index.css": {
16
16
  "import": "./dist/index.css",
@@ -38,14 +38,14 @@
38
38
  "@types/react": "^18.3.3",
39
39
  "@types/react-dom": "^18.3.0",
40
40
  "eslint": "^8.15.0",
41
- "tsup": "^5.10.1",
41
+ "tsup": "^8.4.0",
42
42
  "typescript": "^4.5.3",
43
43
  "@aptos-labs/wallet-adapter-tsconfig": "0.0.2"
44
44
  },
45
45
  "dependencies": {
46
46
  "@ant-design/icons": "^5.3.7",
47
47
  "antd": "^5.18.3",
48
- "@aptos-labs/wallet-adapter-react": "5.0.1"
48
+ "@aptos-labs/wallet-adapter-react": "5.0.3"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": "^18",