@wallet-ui/react 2.0.0-canary-20250814043428 → 2.0.0-canary-20250814162838
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/dist/index.browser.cjs +109 -102
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.mjs +86 -80
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.native.mjs +86 -80
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.node.cjs +109 -102
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +86 -80
- package/dist/index.node.mjs.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/use-wallet-ui-signer.d.ts +4 -1
- package/dist/types/use-wallet-ui-signer.d.ts.map +1 -1
- package/dist/types/wallet-ui-account-guard.d.ts +8 -0
- package/dist/types/wallet-ui-account-guard.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/index.browser.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React20, { createContext, useContext, useEffect, useId, useMemo, useState } from 'react';
|
|
2
2
|
import { useConnect, useDisconnect, useWallets, uiWalletAccountsAreSame, uiWalletAccountBelongsToUiWallet, getUiWalletAccountStorageKey } from '@wallet-standard/react';
|
|
3
3
|
export * from '@wallet-standard/react';
|
|
4
4
|
import { Portal, useMachine, normalizeProps } from '@zag-js/react';
|
|
@@ -15,13 +15,13 @@ export * from '@wallet-standard/core';
|
|
|
15
15
|
|
|
16
16
|
// src/base-button.tsx
|
|
17
17
|
function BaseButton({ className, label, leftSection, onClick, rightSection, size, ...props }) {
|
|
18
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ React20.createElement("button", { "data-wu": "base-button", className: `${size ?? "md"} ${className ?? ""}`, onClick, ...props }, leftSection ? /* @__PURE__ */ React20.createElement("span", { "data-wu": "base-button-left-section" }, leftSection) : null, label, rightSection ? /* @__PURE__ */ React20.createElement("span", { "data-wu": "base-button-right-section" }, rightSection) : null);
|
|
19
19
|
}
|
|
20
|
-
var WalletUiContext =
|
|
20
|
+
var WalletUiContext = React20.createContext({});
|
|
21
21
|
|
|
22
22
|
// src/use-wallet-ui.tsx
|
|
23
23
|
function useWalletUi() {
|
|
24
|
-
return
|
|
24
|
+
return React20.useContext(WalletUiContext);
|
|
25
25
|
}
|
|
26
26
|
var WalletUiAccountContext = createContext({});
|
|
27
27
|
|
|
@@ -59,7 +59,7 @@ function WalletUiIcon({ className, size = "md", wallet, ...props }) {
|
|
|
59
59
|
if (!wallet) {
|
|
60
60
|
return null;
|
|
61
61
|
}
|
|
62
|
-
return /* @__PURE__ */
|
|
62
|
+
return /* @__PURE__ */ React20.createElement(
|
|
63
63
|
"img",
|
|
64
64
|
{
|
|
65
65
|
"data-wu": "wallet-ui-icon",
|
|
@@ -82,17 +82,17 @@ var BaseDropdownItemType = /* @__PURE__ */ ((BaseDropdownItemType2) => {
|
|
|
82
82
|
})(BaseDropdownItemType || {});
|
|
83
83
|
function BaseDropdown({ buttonProps, dropdown, items, showIndicator, size = "md" }) {
|
|
84
84
|
const api = dropdown.api;
|
|
85
|
-
const trigger = /* @__PURE__ */
|
|
85
|
+
const trigger = /* @__PURE__ */ React20.createElement(
|
|
86
86
|
BaseButton,
|
|
87
87
|
{
|
|
88
88
|
...api.getTriggerProps(),
|
|
89
89
|
size,
|
|
90
|
-
rightSection: showIndicator ? /* @__PURE__ */
|
|
90
|
+
rightSection: showIndicator ? /* @__PURE__ */ React20.createElement("span", { ...api.getIndicatorProps() }, /* @__PURE__ */ React20.createElement(BaseDropdownChevronDown, { size: 12 })) : null,
|
|
91
91
|
...buttonProps
|
|
92
92
|
}
|
|
93
93
|
);
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
return /* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ React20.createElement("div", { "data-wu": "base-dropdown" }, trigger, /* @__PURE__ */ React20.createElement("div", { ...api.getPositionerProps(), "data-wu": "base-dropdown-wrapper" }, /* @__PURE__ */ React20.createElement("div", { ...api.getContentProps(), "data-wu": "base-dropdown-list", "data-part": "content" }, items.map((item) => {
|
|
95
|
+
return /* @__PURE__ */ React20.createElement(
|
|
96
96
|
BaseDropdownItem,
|
|
97
97
|
{
|
|
98
98
|
...api.getItemProps({ value: item.value }),
|
|
@@ -113,17 +113,17 @@ function BaseDropdown({ buttonProps, dropdown, items, showIndicator, size = "md"
|
|
|
113
113
|
}
|
|
114
114
|
function BaseDropdownItem({ afterClick, item, size }) {
|
|
115
115
|
if (!item.wallet) {
|
|
116
|
-
return /* @__PURE__ */
|
|
116
|
+
return /* @__PURE__ */ React20.createElement(BaseDropdownItemRender, { afterClick, item, size });
|
|
117
117
|
}
|
|
118
118
|
switch (item.type) {
|
|
119
119
|
case "Item" /* Item */:
|
|
120
|
-
return /* @__PURE__ */
|
|
120
|
+
return /* @__PURE__ */ React20.createElement(BaseDropdownItemRender, { afterClick, item, size });
|
|
121
121
|
case "WalletConnect" /* WalletConnect */:
|
|
122
|
-
return /* @__PURE__ */
|
|
122
|
+
return /* @__PURE__ */ React20.createElement(BaseDropdownItemWalletConnect, { afterClick, item, size, wallet: item.wallet });
|
|
123
123
|
case "WalletCopy" /* WalletCopy */:
|
|
124
|
-
return /* @__PURE__ */
|
|
124
|
+
return /* @__PURE__ */ React20.createElement(BaseDropdownItemRender, { afterClick, item, size });
|
|
125
125
|
case "WalletDisconnect" /* WalletDisconnect */:
|
|
126
|
-
return /* @__PURE__ */
|
|
126
|
+
return /* @__PURE__ */ React20.createElement(
|
|
127
127
|
BaseDropdownItemWalletDisconnect,
|
|
128
128
|
{
|
|
129
129
|
afterClick,
|
|
@@ -141,7 +141,7 @@ function BaseDropdownItemWalletConnect({
|
|
|
141
141
|
wallet
|
|
142
142
|
}) {
|
|
143
143
|
const { connect: connect3 } = useWalletUiWallet({ wallet });
|
|
144
|
-
return /* @__PURE__ */
|
|
144
|
+
return /* @__PURE__ */ React20.createElement(
|
|
145
145
|
BaseDropdownItemRender,
|
|
146
146
|
{
|
|
147
147
|
afterClick,
|
|
@@ -151,7 +151,7 @@ function BaseDropdownItemWalletConnect({
|
|
|
151
151
|
await connect3();
|
|
152
152
|
return await item.handler();
|
|
153
153
|
},
|
|
154
|
-
leftSection: wallet ? /* @__PURE__ */
|
|
154
|
+
leftSection: wallet ? /* @__PURE__ */ React20.createElement(WalletUiIcon, { wallet, size }) : void 0
|
|
155
155
|
},
|
|
156
156
|
size
|
|
157
157
|
}
|
|
@@ -164,7 +164,7 @@ function BaseDropdownItemWalletDisconnect({
|
|
|
164
164
|
wallet
|
|
165
165
|
}) {
|
|
166
166
|
const { disconnect } = useWalletUiWallet({ wallet });
|
|
167
|
-
return /* @__PURE__ */
|
|
167
|
+
return /* @__PURE__ */ React20.createElement(
|
|
168
168
|
BaseDropdownItemRender,
|
|
169
169
|
{
|
|
170
170
|
afterClick,
|
|
@@ -188,10 +188,10 @@ function BaseDropdownItemRender({ afterClick, item, size }) {
|
|
|
188
188
|
afterClick();
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
return /* @__PURE__ */
|
|
191
|
+
return /* @__PURE__ */ React20.createElement("button", { type: "button", "data-wu": "base-dropdown-item", className: size, "data-part": "item", onClick }, item.leftSection ? /* @__PURE__ */ React20.createElement("span", { "data-wu": "base-dropdown-item-left-section" }, item.leftSection) : null, item.label, item.rightSection ? /* @__PURE__ */ React20.createElement("span", { "data-wu": "base-dropdown-item-right-section" }, item.rightSection) : null);
|
|
192
192
|
}
|
|
193
193
|
function BaseDropdownChevronDown(props) {
|
|
194
|
-
return /* @__PURE__ */
|
|
194
|
+
return /* @__PURE__ */ React20.createElement(
|
|
195
195
|
"svg",
|
|
196
196
|
{
|
|
197
197
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -205,17 +205,17 @@ function BaseDropdownChevronDown(props) {
|
|
|
205
205
|
strokeLinejoin: "round",
|
|
206
206
|
...props
|
|
207
207
|
},
|
|
208
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ React20.createElement("path", { d: "m6 9 6 6 6-6" })
|
|
209
209
|
);
|
|
210
210
|
}
|
|
211
211
|
function BaseSvg({ sizes = {}, ...props }) {
|
|
212
212
|
const size = props.size ? sizes[props.size] : 12;
|
|
213
|
-
return /* @__PURE__ */
|
|
213
|
+
return /* @__PURE__ */ React20.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, ...props }, props.children);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
// src/wallet-ui-icon-close.tsx
|
|
217
217
|
function WalletUiIconClose({ size = "md", ...props }) {
|
|
218
|
-
return /* @__PURE__ */
|
|
218
|
+
return /* @__PURE__ */ React20.createElement(
|
|
219
219
|
BaseSvg,
|
|
220
220
|
{
|
|
221
221
|
size,
|
|
@@ -226,14 +226,14 @@ function WalletUiIconClose({ size = "md", ...props }) {
|
|
|
226
226
|
viewBox: "0 0 14 14",
|
|
227
227
|
...props
|
|
228
228
|
},
|
|
229
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ React20.createElement("path", { d: "M14 12.461 8.3 6.772l5.234-5.233L12.006 0 6.772 5.234 1.54 0 0 1.539l5.234 5.233L0 12.006l1.539 1.528L6.772 8.3l5.69 5.7L14 12.461z" })
|
|
230
230
|
);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
// src/base-modal.tsx
|
|
234
234
|
function BaseModal({ modal, buttonLabel, buttonProps = {}, size = "md", ...props }) {
|
|
235
235
|
const api = modal.api;
|
|
236
|
-
return /* @__PURE__ */
|
|
236
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, buttonLabel ? /* @__PURE__ */ React20.createElement(BaseButton, { label: buttonLabel, size, ...buttonProps, ...api.getTriggerProps() }) : null, api.open && /* @__PURE__ */ React20.createElement(Portal, null, /* @__PURE__ */ React20.createElement("div", { ...api.getBackdropProps() }), /* @__PURE__ */ React20.createElement("div", { ...api.getPositionerProps() }, /* @__PURE__ */ React20.createElement("div", { ...api.getContentProps(), className: size }, /* @__PURE__ */ React20.createElement("header", null, /* @__PURE__ */ React20.createElement("button", { ...api.getCloseTriggerProps() }, /* @__PURE__ */ React20.createElement(WalletUiIconClose, { size }))), props.description ? /* @__PURE__ */ React20.createElement("p", { ...api.getDescriptionProps() }, props.description) : null, /* @__PURE__ */ React20.createElement("main", null, props.children)))));
|
|
237
237
|
}
|
|
238
238
|
function useBaseDropdown() {
|
|
239
239
|
const service = useMachine(menu.machine, { id: useId() });
|
|
@@ -323,7 +323,7 @@ function useWalletUiDropdown({ size = "md" } = {}) {
|
|
|
323
323
|
const buttonProps = useMemo(() => {
|
|
324
324
|
return {
|
|
325
325
|
label: connected ? (account ? ellipsify(account.address) : wallet?.name) ?? "Connected" : "Select Wallet",
|
|
326
|
-
leftSection: connected ? /* @__PURE__ */
|
|
326
|
+
leftSection: connected ? /* @__PURE__ */ React20.createElement(WalletUiIcon, { size, wallet }) : void 0
|
|
327
327
|
};
|
|
328
328
|
}, [account, connected, size, wallet]);
|
|
329
329
|
return {
|
|
@@ -338,8 +338,8 @@ function ellipsify(str = "", len = 4, delimiter = "..") {
|
|
|
338
338
|
const limit = len * 2 + delimiter.length;
|
|
339
339
|
return strLen >= limit ? str.substring(0, len) + delimiter + str.substring(strLen - len, strLen) : str;
|
|
340
340
|
}
|
|
341
|
-
function useWalletUiSigner() {
|
|
342
|
-
const {
|
|
341
|
+
function useWalletUiSigner({ account }) {
|
|
342
|
+
const { cluster } = useWalletUi();
|
|
343
343
|
return useWalletAccountTransactionSendingSigner(account, cluster.id);
|
|
344
344
|
}
|
|
345
345
|
var WalletUiSolanaClientContext = createContext({});
|
|
@@ -452,7 +452,7 @@ function WalletUiAccountContextProvider({
|
|
|
452
452
|
}
|
|
453
453
|
return [cluster.id, getUiWalletAccountStorageKey(account)].filter(Boolean);
|
|
454
454
|
}, [account, cluster.id]);
|
|
455
|
-
return /* @__PURE__ */
|
|
455
|
+
return /* @__PURE__ */ React20.createElement(
|
|
456
456
|
WalletUiAccountContext.Provider,
|
|
457
457
|
{
|
|
458
458
|
value: useMemo(
|
|
@@ -491,7 +491,7 @@ function WalletUiClusterContextProvider({
|
|
|
491
491
|
storage.set(clusterId2);
|
|
492
492
|
}
|
|
493
493
|
};
|
|
494
|
-
return /* @__PURE__ */
|
|
494
|
+
return /* @__PURE__ */ React20.createElement(WalletUiClusterContext.Provider, { value }, render(value));
|
|
495
495
|
}
|
|
496
496
|
function WalletUiContextProvider({ children, size = "md" }) {
|
|
497
497
|
const { account, accountKeys, cluster, setAccount, wallet } = useWalletUiAccount();
|
|
@@ -523,13 +523,13 @@ function WalletUiContextProvider({ children, size = "md" }) {
|
|
|
523
523
|
wallet,
|
|
524
524
|
wallets
|
|
525
525
|
};
|
|
526
|
-
return /* @__PURE__ */
|
|
526
|
+
return /* @__PURE__ */ React20.createElement(WalletUiContext.Provider, { value }, children);
|
|
527
527
|
}
|
|
528
528
|
function WalletUiSolanaClientContextProvider({
|
|
529
529
|
children,
|
|
530
530
|
urlOrMoniker
|
|
531
531
|
}) {
|
|
532
|
-
return /* @__PURE__ */
|
|
532
|
+
return /* @__PURE__ */ React20.createElement(
|
|
533
533
|
WalletUiSolanaClientContext.Provider,
|
|
534
534
|
{
|
|
535
535
|
value: useMemo(() => createSolanaClient({ urlOrMoniker }), [urlOrMoniker])
|
|
@@ -543,24 +543,34 @@ function createWalletUiConfig(props) {
|
|
|
543
543
|
return { ...props };
|
|
544
544
|
}
|
|
545
545
|
function WalletUi({ children, config: { accountStorage, clusters, clusterStorage, ...config } }) {
|
|
546
|
-
return /* @__PURE__ */
|
|
546
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
|
|
547
547
|
WalletUiClusterContextProvider,
|
|
548
548
|
{
|
|
549
549
|
clusters,
|
|
550
550
|
storage: clusterStorage,
|
|
551
551
|
render: ({ cluster }) => {
|
|
552
|
-
return /* @__PURE__ */
|
|
552
|
+
return /* @__PURE__ */ React20.createElement(WalletUiSolanaClientContextProvider, { urlOrMoniker: cluster.urlOrMoniker }, /* @__PURE__ */ React20.createElement(WalletUiAccountContextProvider, { cluster, storage: accountStorage }, /* @__PURE__ */ React20.createElement(WalletUiContextProvider, { ...config }, children)));
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
555
|
));
|
|
556
556
|
}
|
|
557
|
+
function WalletUiDropdown({ size = "md", ...props }) {
|
|
558
|
+
const { buttonProps, items, dropdown } = useWalletUiDropdown({ size });
|
|
559
|
+
return /* @__PURE__ */ React20.createElement(BaseDropdown, { ...props, buttonProps: { ...buttonProps }, dropdown, items, size });
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// src/wallet-ui-account-guard.tsx
|
|
563
|
+
function WalletUiAccountGuard({ fallback = /* @__PURE__ */ React20.createElement(WalletUiDropdown, null), render }) {
|
|
564
|
+
const { account, accountKeys, cluster, wallet } = useWalletUiAccount();
|
|
565
|
+
return account ? render({ account, accountKeys, cluster, wallet }) : fallback;
|
|
566
|
+
}
|
|
557
567
|
function WalletUiButton({ ...props }) {
|
|
558
|
-
return /* @__PURE__ */
|
|
568
|
+
return /* @__PURE__ */ React20.createElement(BaseButton, { ...props, label: "CLICK" });
|
|
559
569
|
}
|
|
560
570
|
function WalletUiClusterDropdown({ buttonProps, size = "md", ...props }) {
|
|
561
571
|
const dropdown = useBaseDropdown();
|
|
562
572
|
const { cluster, clusters, setCluster } = useWalletUiCluster();
|
|
563
|
-
return /* @__PURE__ */
|
|
573
|
+
return /* @__PURE__ */ React20.createElement(
|
|
564
574
|
BaseDropdown,
|
|
565
575
|
{
|
|
566
576
|
size,
|
|
@@ -579,12 +589,8 @@ function WalletUiClusterDropdown({ buttonProps, size = "md", ...props }) {
|
|
|
579
589
|
}
|
|
580
590
|
);
|
|
581
591
|
}
|
|
582
|
-
function WalletUiDropdown({ size = "md", ...props }) {
|
|
583
|
-
const { buttonProps, items, dropdown } = useWalletUiDropdown({ size });
|
|
584
|
-
return /* @__PURE__ */ React19.createElement(BaseDropdown, { ...props, buttonProps: { ...buttonProps }, dropdown, items, size });
|
|
585
|
-
}
|
|
586
592
|
function WalletUiIconNoWallet({ size, ...props }) {
|
|
587
|
-
return /* @__PURE__ */
|
|
593
|
+
return /* @__PURE__ */ React20.createElement(BaseSvg, { size, sizes: { lg: 125, md: 100, sm: 75 }, fill: "none", viewBox: "0 0 97 96", ...props }, /* @__PURE__ */ React20.createElement("circle", { cx: "48.5", cy: "48", r: "48", fill: "url(#paint0_linear_880_5115)", fillOpacity: "0.1" }), /* @__PURE__ */ React20.createElement(
|
|
588
594
|
"circle",
|
|
589
595
|
{
|
|
590
596
|
cx: "48.5",
|
|
@@ -594,19 +600,19 @@ function WalletUiIconNoWallet({ size, ...props }) {
|
|
|
594
600
|
strokeOpacity: "0.4",
|
|
595
601
|
strokeWidth: "2"
|
|
596
602
|
}
|
|
597
|
-
), /* @__PURE__ */
|
|
603
|
+
), /* @__PURE__ */ React20.createElement("g", { clipPath: "url(#clip0_880_5115)" }, /* @__PURE__ */ React20.createElement(
|
|
598
604
|
"path",
|
|
599
605
|
{
|
|
600
606
|
d: "M65.5769 28.1523H31.4231C27.6057 28.1523 24.5 31.258 24.5 35.0754V60.9215C24.5 64.7389 27.6057 67.8446 31.4231 67.8446H65.5769C69.3943 67.8446 72.5 64.7389 72.5 60.9215V35.0754C72.5 31.258 69.3943 28.1523 65.5769 28.1523ZM69.7308 52.1523H59.5769C57.2865 52.1523 55.4231 50.289 55.4231 47.9985C55.4231 45.708 57.2864 43.8446 59.5769 43.8446H69.7308V52.1523ZM69.7308 41.0754H59.5769C55.7595 41.0754 52.6539 44.1811 52.6539 47.9985C52.6539 51.8159 55.7595 54.9215 59.5769 54.9215H69.7308V60.9215C69.7308 63.2119 67.8674 65.0754 65.5769 65.0754H31.4231C29.1327 65.0754 27.2692 63.212 27.2692 60.9215V35.0754C27.2692 32.785 29.1326 30.9215 31.4231 30.9215H65.5769C67.8673 30.9215 69.7308 32.7849 69.7308 35.0754V41.0754Z",
|
|
601
607
|
fill: "url(#paint2_linear_880_5115)"
|
|
602
608
|
}
|
|
603
|
-
), /* @__PURE__ */
|
|
609
|
+
), /* @__PURE__ */ React20.createElement(
|
|
604
610
|
"path",
|
|
605
611
|
{
|
|
606
612
|
d: "M61.4231 46.6172H59.577C58.8123 46.6172 58.1924 47.2371 58.1924 48.0018C58.1924 48.7665 58.8123 49.3863 59.577 49.3863H61.4231C62.1878 49.3863 62.8077 48.7664 62.8077 48.0018C62.8077 47.2371 62.1878 46.6172 61.4231 46.6172Z",
|
|
607
613
|
fill: "url(#paint3_linear_880_5115)"
|
|
608
614
|
}
|
|
609
|
-
)), /* @__PURE__ */
|
|
615
|
+
)), /* @__PURE__ */ React20.createElement("defs", null, /* @__PURE__ */ React20.createElement(
|
|
610
616
|
"linearGradient",
|
|
611
617
|
{
|
|
612
618
|
id: "paint0_linear_880_5115",
|
|
@@ -616,13 +622,13 @@ function WalletUiIconNoWallet({ size, ...props }) {
|
|
|
616
622
|
y2: "8.42498",
|
|
617
623
|
gradientUnits: "userSpaceOnUse"
|
|
618
624
|
},
|
|
619
|
-
/* @__PURE__ */
|
|
620
|
-
/* @__PURE__ */
|
|
621
|
-
/* @__PURE__ */
|
|
622
|
-
/* @__PURE__ */
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
), /* @__PURE__ */
|
|
625
|
+
/* @__PURE__ */ React20.createElement("stop", { stopColor: "#9945FF" }),
|
|
626
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.14", stopColor: "#8A53F4" }),
|
|
627
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.42", stopColor: "#6377D6" }),
|
|
628
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.79", stopColor: "#24B0A7" }),
|
|
629
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.99", stopColor: "#00D18C" }),
|
|
630
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "1", stopColor: "#00D18C" })
|
|
631
|
+
), /* @__PURE__ */ React20.createElement(
|
|
626
632
|
"linearGradient",
|
|
627
633
|
{
|
|
628
634
|
id: "paint1_linear_880_5115",
|
|
@@ -632,13 +638,13 @@ function WalletUiIconNoWallet({ size, ...props }) {
|
|
|
632
638
|
y2: "8.42498",
|
|
633
639
|
gradientUnits: "userSpaceOnUse"
|
|
634
640
|
},
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
/* @__PURE__ */
|
|
637
|
-
/* @__PURE__ */
|
|
638
|
-
/* @__PURE__ */
|
|
639
|
-
/* @__PURE__ */
|
|
640
|
-
/* @__PURE__ */
|
|
641
|
-
), /* @__PURE__ */
|
|
641
|
+
/* @__PURE__ */ React20.createElement("stop", { stopColor: "#9945FF" }),
|
|
642
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.14", stopColor: "#8A53F4" }),
|
|
643
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.42", stopColor: "#6377D6" }),
|
|
644
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.79", stopColor: "#24B0A7" }),
|
|
645
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.99", stopColor: "#00D18C" }),
|
|
646
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "1", stopColor: "#00D18C" })
|
|
647
|
+
), /* @__PURE__ */ React20.createElement(
|
|
642
648
|
"linearGradient",
|
|
643
649
|
{
|
|
644
650
|
id: "paint2_linear_880_5115",
|
|
@@ -648,13 +654,13 @@ function WalletUiIconNoWallet({ size, ...props }) {
|
|
|
648
654
|
y2: "23.7879",
|
|
649
655
|
gradientUnits: "userSpaceOnUse"
|
|
650
656
|
},
|
|
651
|
-
/* @__PURE__ */
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
/* @__PURE__ */
|
|
655
|
-
/* @__PURE__ */
|
|
656
|
-
/* @__PURE__ */
|
|
657
|
-
), /* @__PURE__ */
|
|
657
|
+
/* @__PURE__ */ React20.createElement("stop", { stopColor: "#9945FF" }),
|
|
658
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.14", stopColor: "#8A53F4" }),
|
|
659
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.42", stopColor: "#6377D6" }),
|
|
660
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.79", stopColor: "#24B0A7" }),
|
|
661
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.99", stopColor: "#00D18C" }),
|
|
662
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "1", stopColor: "#00D18C" })
|
|
663
|
+
), /* @__PURE__ */ React20.createElement(
|
|
658
664
|
"linearGradient",
|
|
659
665
|
{
|
|
660
666
|
id: "paint3_linear_880_5115",
|
|
@@ -664,22 +670,22 @@ function WalletUiIconNoWallet({ size, ...props }) {
|
|
|
664
670
|
y2: "45.4453",
|
|
665
671
|
gradientUnits: "userSpaceOnUse"
|
|
666
672
|
},
|
|
667
|
-
/* @__PURE__ */
|
|
668
|
-
/* @__PURE__ */
|
|
669
|
-
/* @__PURE__ */
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
/* @__PURE__ */
|
|
673
|
-
), /* @__PURE__ */
|
|
673
|
+
/* @__PURE__ */ React20.createElement("stop", { stopColor: "#9945FF" }),
|
|
674
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.14", stopColor: "#8A53F4" }),
|
|
675
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.42", stopColor: "#6377D6" }),
|
|
676
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.79", stopColor: "#24B0A7" }),
|
|
677
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "0.99", stopColor: "#00D18C" }),
|
|
678
|
+
/* @__PURE__ */ React20.createElement("stop", { offset: "1", stopColor: "#00D18C" })
|
|
679
|
+
), /* @__PURE__ */ React20.createElement("clipPath", { id: "clip0_880_5115" }, /* @__PURE__ */ React20.createElement("rect", { width: "48", height: "48", fill: "white", transform: "translate(24.5 24)" }))));
|
|
674
680
|
}
|
|
675
681
|
function WalletUiLabel({ className, size, wallet, ...props }) {
|
|
676
682
|
if (!wallet) {
|
|
677
683
|
return null;
|
|
678
684
|
}
|
|
679
|
-
return /* @__PURE__ */
|
|
685
|
+
return /* @__PURE__ */ React20.createElement("span", { "data-wu": "wallet-ui-label", className: `${size ?? "md"} ${className ?? ""}`, ...props }, wallet.name);
|
|
680
686
|
}
|
|
681
687
|
function WalletUiListButton({ className, select, size = "md", wallet, ...props }) {
|
|
682
|
-
const [pending, setPending] =
|
|
688
|
+
const [pending, setPending] = React20.useState(false);
|
|
683
689
|
function handleSelect() {
|
|
684
690
|
if (!select) {
|
|
685
691
|
return;
|
|
@@ -691,7 +697,7 @@ function WalletUiListButton({ className, select, size = "md", wallet, ...props }
|
|
|
691
697
|
}
|
|
692
698
|
void select(account).finally(() => setPending(false));
|
|
693
699
|
}
|
|
694
|
-
return /* @__PURE__ */
|
|
700
|
+
return /* @__PURE__ */ React20.createElement(
|
|
695
701
|
"button",
|
|
696
702
|
{
|
|
697
703
|
disabled: pending,
|
|
@@ -700,22 +706,22 @@ function WalletUiListButton({ className, select, size = "md", wallet, ...props }
|
|
|
700
706
|
onClick: handleSelect,
|
|
701
707
|
...props
|
|
702
708
|
},
|
|
703
|
-
/* @__PURE__ */
|
|
704
|
-
/* @__PURE__ */
|
|
709
|
+
/* @__PURE__ */ React20.createElement(WalletUiIcon, { wallet, size }),
|
|
710
|
+
/* @__PURE__ */ React20.createElement(WalletUiLabel, { wallet, size })
|
|
705
711
|
);
|
|
706
712
|
}
|
|
707
713
|
|
|
708
714
|
// src/wallet-ui-list.tsx
|
|
709
715
|
function WalletUiList({ className, select, size = "md", wallets, ...props }) {
|
|
710
|
-
return /* @__PURE__ */
|
|
716
|
+
return /* @__PURE__ */ React20.createElement("div", { "data-wu": "wallet-ui-list", className: `${size} ${className ?? ""}`, ...props }, wallets.map((wallet) => /* @__PURE__ */ React20.createElement(WalletUiListButton, { key: wallet.name, select, size, wallet })));
|
|
711
717
|
}
|
|
712
718
|
function WalletUiModal({ size = "md", wallets, select, ...props }) {
|
|
713
|
-
return /* @__PURE__ */
|
|
719
|
+
return /* @__PURE__ */ React20.createElement(BaseModal, { description: "Connect a wallet on Solana to continue", size, ...props }, /* @__PURE__ */ React20.createElement(WalletUiList, { size, wallets, select }));
|
|
714
720
|
}
|
|
715
721
|
function WalletUiModalTrigger({ label = "Select Wallet", modal, ...props }) {
|
|
716
|
-
return /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ React20.createElement(BaseButton, { label, onClick: () => void modal.open(), ...props });
|
|
717
723
|
}
|
|
718
724
|
|
|
719
|
-
export { BaseButton, BaseDropdown, BaseDropdownChevronDown, BaseDropdownItemType, BaseModal, BaseSvg, WalletUi, WalletUiAccountContext, WalletUiAccountContextProvider, WalletUiButton, WalletUiClusterContext, WalletUiClusterContextProvider, WalletUiClusterDropdown, WalletUiContext, WalletUiContextProvider, WalletUiDropdown, WalletUiIcon, WalletUiIconClose, WalletUiIconNoWallet, WalletUiLabel, WalletUiList, WalletUiListButton, WalletUiModal, WalletUiModalTrigger, WalletUiSolanaClientContext, WalletUiSolanaClientContextProvider, createWalletUiConfig, ellipsify, useBaseDropdown, useBaseModal, useWalletUi, useWalletUiAccount, useWalletUiCluster, useWalletUiDropdown, useWalletUiSignAndSend, useWalletUiSigner, useWalletUiSolanaClient, useWalletUiWallet, useWalletUiWallets };
|
|
725
|
+
export { BaseButton, BaseDropdown, BaseDropdownChevronDown, BaseDropdownItemType, BaseModal, BaseSvg, WalletUi, WalletUiAccountContext, WalletUiAccountContextProvider, WalletUiAccountGuard, WalletUiButton, WalletUiClusterContext, WalletUiClusterContextProvider, WalletUiClusterDropdown, WalletUiContext, WalletUiContextProvider, WalletUiDropdown, WalletUiIcon, WalletUiIconClose, WalletUiIconNoWallet, WalletUiLabel, WalletUiList, WalletUiListButton, WalletUiModal, WalletUiModalTrigger, WalletUiSolanaClientContext, WalletUiSolanaClientContextProvider, createWalletUiConfig, ellipsify, useBaseDropdown, useBaseModal, useWalletUi, useWalletUiAccount, useWalletUiCluster, useWalletUiDropdown, useWalletUiSignAndSend, useWalletUiSigner, useWalletUiSolanaClient, useWalletUiWallet, useWalletUiWallets };
|
|
720
726
|
//# sourceMappingURL=index.browser.mjs.map
|
|
721
727
|
//# sourceMappingURL=index.browser.mjs.map
|