@emblemvault/emblem-auth-react 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +132 -0
- package/dist/components/index.cjs +909 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.cts +49 -0
- package/dist/components/index.d.ts +49 -0
- package/dist/components/index.js +906 -0
- package/dist/components/index.js.map +1 -0
- package/dist/hooks/index.cjs +204 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +135 -0
- package/dist/hooks/index.d.ts +135 -0
- package/dist/hooks/index.js +199 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.cjs +1146 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +1134 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/index.cjs +199 -0
- package/dist/providers/index.cjs.map +1 -0
- package/dist/providers/index.d.cts +3 -0
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.js +195 -0
- package/dist/providers/index.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,909 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
require('emblem-auth-sdk');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
var EmblemAuthContext = react.createContext(void 0);
|
|
8
|
+
function useEmblemAuth() {
|
|
9
|
+
const context = react.useContext(EmblemAuthContext);
|
|
10
|
+
if (context === void 0) {
|
|
11
|
+
throw new Error("useEmblemAuth must be used within an EmblemAuthProvider");
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/styles/tokens.ts
|
|
17
|
+
var defaults = {
|
|
18
|
+
colors: {
|
|
19
|
+
// Backgrounds
|
|
20
|
+
bgPrimary: "#0b0d10",
|
|
21
|
+
bgSecondary: "#12161b",
|
|
22
|
+
bgTertiary: "#1a1f25",
|
|
23
|
+
bgHover: "#252b33",
|
|
24
|
+
bgOverlay: "rgba(0, 0, 0, 0.7)",
|
|
25
|
+
// Borders
|
|
26
|
+
borderPrimary: "#222b35",
|
|
27
|
+
borderSecondary: "#333",
|
|
28
|
+
borderHover: "#444",
|
|
29
|
+
// Text
|
|
30
|
+
textPrimary: "#e6eef8",
|
|
31
|
+
textSecondary: "#8892a4",
|
|
32
|
+
textTertiary: "#6b7280",
|
|
33
|
+
textInverse: "#fff",
|
|
34
|
+
// Accent - Primary (blue)
|
|
35
|
+
accentPrimary: "#4c9aff",
|
|
36
|
+
accentPrimaryHover: "#7bb6ff",
|
|
37
|
+
accentPrimaryBg: "rgba(76, 154, 255, 0.1)",
|
|
38
|
+
// Accent - Success (green)
|
|
39
|
+
accentSuccess: "#10b981",
|
|
40
|
+
accentSuccessHover: "#34d399",
|
|
41
|
+
accentSuccessBg: "rgba(16, 185, 129, 0.1)",
|
|
42
|
+
// Accent - Warning (yellow/orange)
|
|
43
|
+
accentWarning: "#f59e0b",
|
|
44
|
+
accentWarningBg: "rgba(245, 158, 11, 0.1)",
|
|
45
|
+
// Accent - Error (red)
|
|
46
|
+
accentError: "#dc2626",
|
|
47
|
+
accentErrorHover: "#ef4444",
|
|
48
|
+
accentErrorBg: "rgba(239, 68, 68, 0.1)",
|
|
49
|
+
// Messages
|
|
50
|
+
msgUser: "#1e3a5f",
|
|
51
|
+
msgAssistant: "#1a2633"
|
|
52
|
+
},
|
|
53
|
+
typography: {
|
|
54
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
55
|
+
fontFamilyMono: '"SF Mono", Monaco, monospace',
|
|
56
|
+
fontSizeXs: "11px",
|
|
57
|
+
fontSizeSm: "13px",
|
|
58
|
+
fontSizeMd: "14px",
|
|
59
|
+
fontSizeLg: "16px",
|
|
60
|
+
fontSizeXl: "18px",
|
|
61
|
+
fontWeightNormal: "400",
|
|
62
|
+
fontWeightMedium: "500",
|
|
63
|
+
fontWeightSemibold: "600",
|
|
64
|
+
lineHeightTight: "1.3",
|
|
65
|
+
lineHeightNormal: "1.5",
|
|
66
|
+
lineHeightRelaxed: "1.7"
|
|
67
|
+
},
|
|
68
|
+
spacing: {
|
|
69
|
+
xs: "4px",
|
|
70
|
+
sm: "8px",
|
|
71
|
+
md: "12px",
|
|
72
|
+
lg: "16px",
|
|
73
|
+
xl: "20px",
|
|
74
|
+
xxl: "24px"
|
|
75
|
+
},
|
|
76
|
+
radius: {
|
|
77
|
+
sm: "4px",
|
|
78
|
+
md: "6px",
|
|
79
|
+
lg: "8px",
|
|
80
|
+
xl: "12px",
|
|
81
|
+
pill: "20px",
|
|
82
|
+
full: "50%"
|
|
83
|
+
},
|
|
84
|
+
shadows: {
|
|
85
|
+
sm: "0 2px 8px rgba(0,0,0,0.2)",
|
|
86
|
+
md: "0 4px 16px rgba(0,0,0,0.3)",
|
|
87
|
+
lg: "0 8px 32px rgba(0,0,0,0.4)",
|
|
88
|
+
xl: "0 16px 48px rgba(0,0,0,0.5)"
|
|
89
|
+
},
|
|
90
|
+
// Glow effects (for enhanced themes)
|
|
91
|
+
glows: {
|
|
92
|
+
primary: "rgba(76, 154, 255, 0.4)",
|
|
93
|
+
success: "rgba(16, 185, 129, 0.4)",
|
|
94
|
+
error: "rgba(239, 68, 68, 0.4)",
|
|
95
|
+
ambient: "rgba(76, 154, 255, 0.08)"
|
|
96
|
+
},
|
|
97
|
+
transitions: {
|
|
98
|
+
fast: "0.15s ease",
|
|
99
|
+
normal: "0.2s ease",
|
|
100
|
+
slow: "0.3s ease"
|
|
101
|
+
},
|
|
102
|
+
zIndex: {
|
|
103
|
+
dropdown: "100",
|
|
104
|
+
modal: "1000",
|
|
105
|
+
fullscreen: "1000",
|
|
106
|
+
modalOverFullscreen: "10000"
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
function toVarName(category, key) {
|
|
110
|
+
const kebab = key.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
111
|
+
return `--hustle-${category}-${kebab}`;
|
|
112
|
+
}
|
|
113
|
+
function generateCSSVariables() {
|
|
114
|
+
const lines = [":root {"];
|
|
115
|
+
for (const [key, value] of Object.entries(defaults.colors)) {
|
|
116
|
+
lines.push(` ${toVarName("color", key)}: ${value};`);
|
|
117
|
+
}
|
|
118
|
+
for (const [key, value] of Object.entries(defaults.typography)) {
|
|
119
|
+
lines.push(` ${toVarName("font", key)}: ${value};`);
|
|
120
|
+
}
|
|
121
|
+
for (const [key, value] of Object.entries(defaults.spacing)) {
|
|
122
|
+
lines.push(` ${toVarName("space", key)}: ${value};`);
|
|
123
|
+
}
|
|
124
|
+
for (const [key, value] of Object.entries(defaults.radius)) {
|
|
125
|
+
lines.push(` ${toVarName("radius", key)}: ${value};`);
|
|
126
|
+
}
|
|
127
|
+
for (const [key, value] of Object.entries(defaults.shadows)) {
|
|
128
|
+
lines.push(` ${toVarName("shadow", key)}: ${value};`);
|
|
129
|
+
}
|
|
130
|
+
for (const [key, value] of Object.entries(defaults.glows)) {
|
|
131
|
+
lines.push(` ${toVarName("glow", key)}: ${value};`);
|
|
132
|
+
}
|
|
133
|
+
for (const [key, value] of Object.entries(defaults.transitions)) {
|
|
134
|
+
lines.push(` ${toVarName("transition", key)}: ${value};`);
|
|
135
|
+
}
|
|
136
|
+
for (const [key, value] of Object.entries(defaults.zIndex)) {
|
|
137
|
+
lines.push(` ${toVarName("z", key)}: ${value};`);
|
|
138
|
+
}
|
|
139
|
+
lines.push("}");
|
|
140
|
+
return lines.join("\n");
|
|
141
|
+
}
|
|
142
|
+
generateCSSVariables();
|
|
143
|
+
function createColorTokens() {
|
|
144
|
+
const result = {};
|
|
145
|
+
for (const [key, defaultValue] of Object.entries(defaults.colors)) {
|
|
146
|
+
result[key] = `var(${toVarName("color", key)}, ${defaultValue})`;
|
|
147
|
+
}
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
function createTypographyTokens() {
|
|
151
|
+
const result = {};
|
|
152
|
+
for (const [key, defaultValue] of Object.entries(defaults.typography)) {
|
|
153
|
+
result[key] = `var(${toVarName("font", key)}, ${defaultValue})`;
|
|
154
|
+
}
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
function createSpacingTokens() {
|
|
158
|
+
const result = {};
|
|
159
|
+
for (const [key, defaultValue] of Object.entries(defaults.spacing)) {
|
|
160
|
+
result[key] = `var(${toVarName("space", key)}, ${defaultValue})`;
|
|
161
|
+
}
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
function createRadiusTokens() {
|
|
165
|
+
const result = {};
|
|
166
|
+
for (const [key, defaultValue] of Object.entries(defaults.radius)) {
|
|
167
|
+
result[key] = `var(${toVarName("radius", key)}, ${defaultValue})`;
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
171
|
+
function createShadowTokens() {
|
|
172
|
+
const result = {};
|
|
173
|
+
for (const [key, defaultValue] of Object.entries(defaults.shadows)) {
|
|
174
|
+
result[key] = `var(${toVarName("shadow", key)}, ${defaultValue})`;
|
|
175
|
+
}
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
function createGlowTokens() {
|
|
179
|
+
const result = {};
|
|
180
|
+
for (const [key, defaultValue] of Object.entries(defaults.glows)) {
|
|
181
|
+
result[key] = `var(${toVarName("glow", key)}, ${defaultValue})`;
|
|
182
|
+
}
|
|
183
|
+
return result;
|
|
184
|
+
}
|
|
185
|
+
function createTransitionTokens() {
|
|
186
|
+
const result = {};
|
|
187
|
+
for (const [key, defaultValue] of Object.entries(defaults.transitions)) {
|
|
188
|
+
result[key] = `var(${toVarName("transition", key)}, ${defaultValue})`;
|
|
189
|
+
}
|
|
190
|
+
return result;
|
|
191
|
+
}
|
|
192
|
+
function createZIndexTokens() {
|
|
193
|
+
const result = {};
|
|
194
|
+
for (const [key, defaultValue] of Object.entries(defaults.zIndex)) {
|
|
195
|
+
result[key] = parseInt(defaultValue, 10);
|
|
196
|
+
}
|
|
197
|
+
return result;
|
|
198
|
+
}
|
|
199
|
+
var tokens = {
|
|
200
|
+
colors: createColorTokens(),
|
|
201
|
+
typography: createTypographyTokens(),
|
|
202
|
+
spacing: createSpacingTokens(),
|
|
203
|
+
radius: createRadiusTokens(),
|
|
204
|
+
shadows: createShadowTokens(),
|
|
205
|
+
glows: createGlowTokens(),
|
|
206
|
+
transitions: createTransitionTokens(),
|
|
207
|
+
zIndex: createZIndexTokens()
|
|
208
|
+
};
|
|
209
|
+
var presets = {
|
|
210
|
+
base: {
|
|
211
|
+
fontFamily: tokens.typography.fontFamily,
|
|
212
|
+
fontSize: tokens.typography.fontSizeMd,
|
|
213
|
+
lineHeight: tokens.typography.lineHeightNormal,
|
|
214
|
+
color: tokens.colors.textPrimary
|
|
215
|
+
},
|
|
216
|
+
card: {
|
|
217
|
+
background: tokens.colors.bgSecondary,
|
|
218
|
+
border: `1px solid ${tokens.colors.borderPrimary}`,
|
|
219
|
+
borderRadius: tokens.radius.xl
|
|
220
|
+
},
|
|
221
|
+
input: {
|
|
222
|
+
background: tokens.colors.bgTertiary,
|
|
223
|
+
border: `1px solid ${tokens.colors.borderSecondary}`,
|
|
224
|
+
borderRadius: tokens.radius.lg,
|
|
225
|
+
color: tokens.colors.textPrimary,
|
|
226
|
+
fontSize: tokens.typography.fontSizeMd,
|
|
227
|
+
padding: `${tokens.spacing.md} ${tokens.spacing.lg}`,
|
|
228
|
+
transition: `border-color ${tokens.transitions.normal}`
|
|
229
|
+
},
|
|
230
|
+
button: {
|
|
231
|
+
display: "inline-flex",
|
|
232
|
+
alignItems: "center",
|
|
233
|
+
justifyContent: "center",
|
|
234
|
+
gap: tokens.spacing.sm,
|
|
235
|
+
padding: `${tokens.spacing.sm} ${tokens.spacing.lg}`,
|
|
236
|
+
borderRadius: tokens.radius.lg,
|
|
237
|
+
fontSize: tokens.typography.fontSizeMd,
|
|
238
|
+
fontWeight: tokens.typography.fontWeightMedium,
|
|
239
|
+
cursor: "pointer",
|
|
240
|
+
transition: `all ${tokens.transitions.normal}`,
|
|
241
|
+
border: `1px solid ${tokens.colors.borderSecondary}`,
|
|
242
|
+
outline: "none"
|
|
243
|
+
},
|
|
244
|
+
buttonPrimary: {
|
|
245
|
+
background: tokens.colors.accentPrimary,
|
|
246
|
+
color: tokens.colors.textInverse,
|
|
247
|
+
borderColor: tokens.colors.accentPrimary
|
|
248
|
+
},
|
|
249
|
+
buttonSecondary: {
|
|
250
|
+
background: tokens.colors.bgTertiary,
|
|
251
|
+
color: tokens.colors.textPrimary,
|
|
252
|
+
borderColor: tokens.colors.borderSecondary
|
|
253
|
+
},
|
|
254
|
+
buttonIcon: {
|
|
255
|
+
width: "36px",
|
|
256
|
+
height: "36px",
|
|
257
|
+
padding: 0,
|
|
258
|
+
// background inherited from global button styles
|
|
259
|
+
color: tokens.colors.textSecondary
|
|
260
|
+
},
|
|
261
|
+
mono: {
|
|
262
|
+
fontFamily: tokens.typography.fontFamilyMono,
|
|
263
|
+
fontSize: tokens.typography.fontSizeSm
|
|
264
|
+
},
|
|
265
|
+
label: {
|
|
266
|
+
fontSize: tokens.typography.fontSizeXs,
|
|
267
|
+
color: tokens.colors.textTertiary,
|
|
268
|
+
marginBottom: tokens.spacing.xs
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
var animations = `
|
|
272
|
+
@keyframes hustle-spin {
|
|
273
|
+
to { transform: rotate(360deg); }
|
|
274
|
+
}
|
|
275
|
+
@keyframes hustle-pulse {
|
|
276
|
+
0%, 100% { opacity: 1; }
|
|
277
|
+
50% { opacity: 0.5; }
|
|
278
|
+
}
|
|
279
|
+
@keyframes hustle-glow {
|
|
280
|
+
0%, 100% {
|
|
281
|
+
opacity: 1;
|
|
282
|
+
text-shadow: 0 0 4px ${defaults.colors.accentPrimaryBg};
|
|
283
|
+
}
|
|
284
|
+
50% {
|
|
285
|
+
opacity: 0.6;
|
|
286
|
+
text-shadow: 0 0 8px ${defaults.colors.accentPrimary};
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
`;
|
|
290
|
+
function truncateAddress(address) {
|
|
291
|
+
if (!address || address.length < 10) return address || "";
|
|
292
|
+
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
293
|
+
}
|
|
294
|
+
async function copyToClipboard(text) {
|
|
295
|
+
try {
|
|
296
|
+
await navigator.clipboard.writeText(text);
|
|
297
|
+
return true;
|
|
298
|
+
} catch {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
var styles = {
|
|
303
|
+
wrapper: {
|
|
304
|
+
position: "relative",
|
|
305
|
+
display: "inline-flex",
|
|
306
|
+
alignItems: "center",
|
|
307
|
+
gap: tokens.spacing.sm
|
|
308
|
+
},
|
|
309
|
+
button: {
|
|
310
|
+
...presets.button,
|
|
311
|
+
padding: `${tokens.spacing.sm} ${tokens.spacing.xl}`
|
|
312
|
+
},
|
|
313
|
+
disconnected: {
|
|
314
|
+
background: tokens.colors.bgTertiary,
|
|
315
|
+
color: tokens.colors.textPrimary,
|
|
316
|
+
borderColor: tokens.colors.borderSecondary
|
|
317
|
+
},
|
|
318
|
+
disconnectedHover: {
|
|
319
|
+
background: tokens.colors.bgHover,
|
|
320
|
+
borderColor: tokens.colors.borderHover
|
|
321
|
+
},
|
|
322
|
+
connected: {
|
|
323
|
+
background: "transparent",
|
|
324
|
+
color: tokens.colors.accentSuccess,
|
|
325
|
+
borderColor: tokens.colors.accentSuccess,
|
|
326
|
+
borderRadius: tokens.radius.pill
|
|
327
|
+
},
|
|
328
|
+
connectedHover: {
|
|
329
|
+
background: tokens.colors.accentSuccessBg
|
|
330
|
+
},
|
|
331
|
+
loading: {
|
|
332
|
+
background: tokens.colors.borderSecondary,
|
|
333
|
+
color: tokens.colors.textSecondary,
|
|
334
|
+
cursor: "wait"
|
|
335
|
+
},
|
|
336
|
+
disabled: {
|
|
337
|
+
background: tokens.colors.borderSecondary,
|
|
338
|
+
color: tokens.colors.textTertiary,
|
|
339
|
+
cursor: "not-allowed",
|
|
340
|
+
opacity: 0.5
|
|
341
|
+
},
|
|
342
|
+
icon: {
|
|
343
|
+
fontSize: tokens.typography.fontSizeLg
|
|
344
|
+
},
|
|
345
|
+
spinner: {
|
|
346
|
+
display: "inline-block",
|
|
347
|
+
width: "14px",
|
|
348
|
+
height: "14px",
|
|
349
|
+
border: "2px solid currentColor",
|
|
350
|
+
borderTopColor: "transparent",
|
|
351
|
+
borderRadius: tokens.radius.full,
|
|
352
|
+
animation: "hustle-spin 0.8s linear infinite"
|
|
353
|
+
},
|
|
354
|
+
address: {
|
|
355
|
+
...presets.mono,
|
|
356
|
+
color: tokens.colors.textPrimary
|
|
357
|
+
},
|
|
358
|
+
dot: {
|
|
359
|
+
color: tokens.colors.textSecondary
|
|
360
|
+
},
|
|
361
|
+
check: {
|
|
362
|
+
color: tokens.colors.accentSuccess
|
|
363
|
+
},
|
|
364
|
+
arrow: {
|
|
365
|
+
fontSize: "10px",
|
|
366
|
+
color: tokens.colors.textSecondary,
|
|
367
|
+
marginLeft: tokens.spacing.xs
|
|
368
|
+
},
|
|
369
|
+
// Disconnect button
|
|
370
|
+
disconnectBtn: {
|
|
371
|
+
display: "flex",
|
|
372
|
+
alignItems: "center",
|
|
373
|
+
justifyContent: "center",
|
|
374
|
+
width: "36px",
|
|
375
|
+
height: "36px",
|
|
376
|
+
background: "transparent",
|
|
377
|
+
border: `1px solid ${tokens.colors.borderSecondary}`,
|
|
378
|
+
borderRadius: tokens.radius.lg,
|
|
379
|
+
color: tokens.colors.textSecondary,
|
|
380
|
+
cursor: "pointer",
|
|
381
|
+
fontSize: "16px",
|
|
382
|
+
transition: `all ${tokens.transitions.normal}`
|
|
383
|
+
},
|
|
384
|
+
disconnectBtnHover: {
|
|
385
|
+
borderColor: tokens.colors.accentError,
|
|
386
|
+
color: tokens.colors.accentError
|
|
387
|
+
},
|
|
388
|
+
// Vault info dropdown
|
|
389
|
+
dropdown: {
|
|
390
|
+
position: "absolute",
|
|
391
|
+
top: "100%",
|
|
392
|
+
left: 0,
|
|
393
|
+
marginTop: tokens.spacing.xs,
|
|
394
|
+
background: tokens.colors.bgPrimary,
|
|
395
|
+
border: `1px solid ${tokens.colors.accentSuccess}`,
|
|
396
|
+
borderRadius: tokens.radius.xl,
|
|
397
|
+
padding: tokens.spacing.lg,
|
|
398
|
+
minWidth: "300px",
|
|
399
|
+
zIndex: tokens.zIndex.dropdown,
|
|
400
|
+
boxShadow: `0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px ${tokens.colors.accentSuccessBg}`
|
|
401
|
+
},
|
|
402
|
+
dropdownHeader: {
|
|
403
|
+
fontSize: tokens.typography.fontSizeXs,
|
|
404
|
+
fontWeight: tokens.typography.fontWeightSemibold,
|
|
405
|
+
color: tokens.colors.textSecondary,
|
|
406
|
+
letterSpacing: "0.5px",
|
|
407
|
+
marginBottom: tokens.spacing.lg,
|
|
408
|
+
textTransform: "uppercase"
|
|
409
|
+
},
|
|
410
|
+
dropdownRow: {
|
|
411
|
+
marginBottom: tokens.spacing.md
|
|
412
|
+
},
|
|
413
|
+
dropdownLabel: {
|
|
414
|
+
display: "block",
|
|
415
|
+
fontSize: tokens.typography.fontSizeXs,
|
|
416
|
+
color: tokens.colors.textTertiary,
|
|
417
|
+
marginBottom: tokens.spacing.xs
|
|
418
|
+
},
|
|
419
|
+
dropdownValueRow: {
|
|
420
|
+
display: "flex",
|
|
421
|
+
alignItems: "center",
|
|
422
|
+
justifyContent: "space-between",
|
|
423
|
+
gap: tokens.spacing.sm
|
|
424
|
+
},
|
|
425
|
+
dropdownValue: {
|
|
426
|
+
fontSize: tokens.typography.fontSizeMd,
|
|
427
|
+
color: tokens.colors.textPrimary,
|
|
428
|
+
fontWeight: tokens.typography.fontWeightMedium,
|
|
429
|
+
flex: 1
|
|
430
|
+
},
|
|
431
|
+
dropdownValueMono: {
|
|
432
|
+
...presets.mono,
|
|
433
|
+
wordBreak: "break-all"
|
|
434
|
+
},
|
|
435
|
+
copyBtn: {
|
|
436
|
+
background: "transparent",
|
|
437
|
+
border: `1px solid ${tokens.colors.borderSecondary}`,
|
|
438
|
+
color: tokens.colors.textSecondary,
|
|
439
|
+
padding: `${tokens.spacing.xs} ${tokens.spacing.sm}`,
|
|
440
|
+
borderRadius: tokens.radius.sm,
|
|
441
|
+
cursor: "pointer",
|
|
442
|
+
fontSize: tokens.typography.fontSizeXs,
|
|
443
|
+
transition: `all ${tokens.transitions.normal}`,
|
|
444
|
+
whiteSpace: "nowrap"
|
|
445
|
+
},
|
|
446
|
+
copyBtnHover: {
|
|
447
|
+
background: tokens.colors.bgHover,
|
|
448
|
+
borderColor: tokens.colors.accentPrimary,
|
|
449
|
+
color: tokens.colors.accentPrimary
|
|
450
|
+
},
|
|
451
|
+
copyBtnCopied: {
|
|
452
|
+
background: tokens.colors.accentSuccess,
|
|
453
|
+
borderColor: tokens.colors.accentSuccess,
|
|
454
|
+
color: tokens.colors.textInverse
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
function ConnectButton({
|
|
458
|
+
className = "",
|
|
459
|
+
style,
|
|
460
|
+
connectLabel = "Connect",
|
|
461
|
+
loadingLabel = "Connecting...",
|
|
462
|
+
onConnect,
|
|
463
|
+
onDisconnect,
|
|
464
|
+
showVaultInfo = true,
|
|
465
|
+
disabled = false
|
|
466
|
+
}) {
|
|
467
|
+
const {
|
|
468
|
+
isAuthenticated,
|
|
469
|
+
isLoading,
|
|
470
|
+
walletAddress,
|
|
471
|
+
vaultId,
|
|
472
|
+
openAuthModal,
|
|
473
|
+
logout
|
|
474
|
+
} = useEmblemAuth();
|
|
475
|
+
const [isHovered, setIsHovered] = react.useState(false);
|
|
476
|
+
const [showDropdown, setShowDropdown] = react.useState(false);
|
|
477
|
+
const [disconnectHovered, setDisconnectHovered] = react.useState(false);
|
|
478
|
+
const [copiedField, setCopiedField] = react.useState(null);
|
|
479
|
+
const [copyHovered, setCopyHovered] = react.useState(null);
|
|
480
|
+
const handleClick = react.useCallback(async () => {
|
|
481
|
+
if (disabled) return;
|
|
482
|
+
if (!isAuthenticated && !isLoading) {
|
|
483
|
+
await openAuthModal();
|
|
484
|
+
onConnect?.();
|
|
485
|
+
}
|
|
486
|
+
}, [disabled, isAuthenticated, isLoading, openAuthModal, onConnect]);
|
|
487
|
+
const handleDisconnect = react.useCallback(() => {
|
|
488
|
+
logout();
|
|
489
|
+
onDisconnect?.();
|
|
490
|
+
setShowDropdown(false);
|
|
491
|
+
}, [logout, onDisconnect]);
|
|
492
|
+
const handleCopy = react.useCallback(async (field, value) => {
|
|
493
|
+
const success = await copyToClipboard(value);
|
|
494
|
+
if (success) {
|
|
495
|
+
setCopiedField(field);
|
|
496
|
+
setTimeout(() => setCopiedField(null), 1500);
|
|
497
|
+
}
|
|
498
|
+
}, []);
|
|
499
|
+
let buttonStyle = { ...styles.button };
|
|
500
|
+
let content = connectLabel;
|
|
501
|
+
if (disabled) {
|
|
502
|
+
buttonStyle = { ...buttonStyle, ...styles.disconnected, ...styles.disabled };
|
|
503
|
+
} else if (isLoading) {
|
|
504
|
+
buttonStyle = { ...buttonStyle, ...styles.disconnected, ...styles.loading };
|
|
505
|
+
content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
506
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: styles.spinner }),
|
|
507
|
+
loadingLabel
|
|
508
|
+
] });
|
|
509
|
+
} else if (isAuthenticated) {
|
|
510
|
+
buttonStyle = { ...buttonStyle, ...styles.connected };
|
|
511
|
+
if (isHovered || showDropdown) {
|
|
512
|
+
buttonStyle = { ...buttonStyle, ...styles.connectedHover };
|
|
513
|
+
}
|
|
514
|
+
const truncated = truncateAddress(walletAddress || "");
|
|
515
|
+
content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
516
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: styles.check, children: "\u2713" }),
|
|
517
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Connected" }),
|
|
518
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: styles.dot, children: "\u2022" }),
|
|
519
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: styles.address, children: truncated }),
|
|
520
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: styles.arrow, children: "\u25BE" })
|
|
521
|
+
] });
|
|
522
|
+
} else {
|
|
523
|
+
buttonStyle = { ...buttonStyle, ...styles.disconnected };
|
|
524
|
+
if (isHovered) {
|
|
525
|
+
buttonStyle = { ...buttonStyle, ...styles.disconnectedHover };
|
|
526
|
+
}
|
|
527
|
+
content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
528
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: styles.icon, children: "\u2192" }),
|
|
529
|
+
connectLabel
|
|
530
|
+
] });
|
|
531
|
+
}
|
|
532
|
+
if (style) {
|
|
533
|
+
buttonStyle = { ...buttonStyle, ...style };
|
|
534
|
+
}
|
|
535
|
+
const renderCopyBtn = (field, value) => {
|
|
536
|
+
const isCopied = copiedField === field;
|
|
537
|
+
const isHover = copyHovered === field;
|
|
538
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
539
|
+
"button",
|
|
540
|
+
{
|
|
541
|
+
type: "button",
|
|
542
|
+
onClick: (e) => {
|
|
543
|
+
e.stopPropagation();
|
|
544
|
+
handleCopy(field, value);
|
|
545
|
+
},
|
|
546
|
+
style: {
|
|
547
|
+
...styles.copyBtn,
|
|
548
|
+
...isCopied ? styles.copyBtnCopied : isHover ? styles.copyBtnHover : {}
|
|
549
|
+
},
|
|
550
|
+
onMouseEnter: () => setCopyHovered(field),
|
|
551
|
+
onMouseLeave: () => setCopyHovered(null),
|
|
552
|
+
children: isCopied ? "Copied!" : "Copy"
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
};
|
|
556
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
557
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: animations }),
|
|
558
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
559
|
+
"div",
|
|
560
|
+
{
|
|
561
|
+
style: styles.wrapper,
|
|
562
|
+
onMouseEnter: () => isAuthenticated && showVaultInfo && setShowDropdown(true),
|
|
563
|
+
onMouseLeave: () => setShowDropdown(false),
|
|
564
|
+
children: [
|
|
565
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
566
|
+
"button",
|
|
567
|
+
{
|
|
568
|
+
type: "button",
|
|
569
|
+
onClick: handleClick,
|
|
570
|
+
disabled: disabled || isLoading,
|
|
571
|
+
className,
|
|
572
|
+
style: buttonStyle,
|
|
573
|
+
onMouseEnter: () => setIsHovered(true),
|
|
574
|
+
onMouseLeave: () => setIsHovered(false),
|
|
575
|
+
children: content
|
|
576
|
+
}
|
|
577
|
+
),
|
|
578
|
+
isAuthenticated && /* @__PURE__ */ jsxRuntime.jsx(
|
|
579
|
+
"button",
|
|
580
|
+
{
|
|
581
|
+
type: "button",
|
|
582
|
+
onClick: handleDisconnect,
|
|
583
|
+
style: {
|
|
584
|
+
...styles.disconnectBtn,
|
|
585
|
+
...disconnectHovered ? styles.disconnectBtnHover : {}
|
|
586
|
+
},
|
|
587
|
+
onMouseEnter: () => setDisconnectHovered(true),
|
|
588
|
+
onMouseLeave: () => setDisconnectHovered(false),
|
|
589
|
+
title: "Disconnect",
|
|
590
|
+
children: "\u23FB"
|
|
591
|
+
}
|
|
592
|
+
),
|
|
593
|
+
isAuthenticated && showVaultInfo && showDropdown && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.dropdown, children: [
|
|
594
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.dropdownHeader, children: "Vault Information" }),
|
|
595
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.dropdownRow, children: [
|
|
596
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: styles.dropdownLabel, children: "Vault ID" }),
|
|
597
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.dropdownValueRow, children: [
|
|
598
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: styles.dropdownValue, children: [
|
|
599
|
+
"#",
|
|
600
|
+
vaultId
|
|
601
|
+
] }),
|
|
602
|
+
renderCopyBtn("vaultId", vaultId || "")
|
|
603
|
+
] })
|
|
604
|
+
] }),
|
|
605
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...styles.dropdownRow, marginBottom: 0 }, children: [
|
|
606
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: styles.dropdownLabel, children: "Connected Wallet" }),
|
|
607
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.dropdownValueRow, children: [
|
|
608
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { ...styles.dropdownValue, ...styles.dropdownValueMono }, children: walletAddress }),
|
|
609
|
+
renderCopyBtn("wallet", walletAddress || "")
|
|
610
|
+
] })
|
|
611
|
+
] })
|
|
612
|
+
] })
|
|
613
|
+
]
|
|
614
|
+
}
|
|
615
|
+
)
|
|
616
|
+
] });
|
|
617
|
+
}
|
|
618
|
+
async function copyToClipboard2(text) {
|
|
619
|
+
try {
|
|
620
|
+
await navigator.clipboard.writeText(text);
|
|
621
|
+
return true;
|
|
622
|
+
} catch {
|
|
623
|
+
return false;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
var s = {
|
|
627
|
+
container: {
|
|
628
|
+
position: "relative",
|
|
629
|
+
display: "inline-flex",
|
|
630
|
+
alignItems: "center",
|
|
631
|
+
gap: tokens.spacing.sm,
|
|
632
|
+
fontFamily: tokens.typography.fontFamily
|
|
633
|
+
},
|
|
634
|
+
disconnected: {
|
|
635
|
+
display: "inline-flex",
|
|
636
|
+
alignItems: "center",
|
|
637
|
+
gap: tokens.spacing.sm,
|
|
638
|
+
color: tokens.colors.textSecondary,
|
|
639
|
+
fontSize: tokens.typography.fontSizeMd
|
|
640
|
+
},
|
|
641
|
+
dot: {
|
|
642
|
+
display: "inline-block",
|
|
643
|
+
width: "8px",
|
|
644
|
+
height: "8px",
|
|
645
|
+
borderRadius: tokens.radius.full,
|
|
646
|
+
backgroundColor: tokens.colors.textTertiary
|
|
647
|
+
},
|
|
648
|
+
dotConnected: {
|
|
649
|
+
backgroundColor: tokens.colors.accentSuccess
|
|
650
|
+
},
|
|
651
|
+
spinner: {
|
|
652
|
+
display: "inline-block",
|
|
653
|
+
width: "12px",
|
|
654
|
+
height: "12px",
|
|
655
|
+
border: `2px solid ${tokens.colors.textSecondary}`,
|
|
656
|
+
borderTopColor: "transparent",
|
|
657
|
+
borderRadius: tokens.radius.full,
|
|
658
|
+
animation: "hustle-spin 0.8s linear infinite"
|
|
659
|
+
},
|
|
660
|
+
logoutBtn: {
|
|
661
|
+
...presets.buttonIcon,
|
|
662
|
+
border: `1px solid ${tokens.colors.borderSecondary}`,
|
|
663
|
+
borderRadius: tokens.radius.lg,
|
|
664
|
+
transition: `all ${tokens.transitions.normal}`
|
|
665
|
+
},
|
|
666
|
+
logoutBtnHover: {
|
|
667
|
+
borderColor: tokens.colors.accentError,
|
|
668
|
+
color: tokens.colors.accentError
|
|
669
|
+
},
|
|
670
|
+
vaultInfoWrapper: {
|
|
671
|
+
position: "relative"
|
|
672
|
+
},
|
|
673
|
+
vaultInfo: {
|
|
674
|
+
position: "absolute",
|
|
675
|
+
top: "100%",
|
|
676
|
+
right: 0,
|
|
677
|
+
marginTop: tokens.spacing.sm,
|
|
678
|
+
background: tokens.colors.bgSecondary,
|
|
679
|
+
border: `1px solid ${tokens.colors.borderPrimary}`,
|
|
680
|
+
borderRadius: tokens.radius.xl,
|
|
681
|
+
padding: tokens.spacing.lg,
|
|
682
|
+
minWidth: "380px",
|
|
683
|
+
zIndex: tokens.zIndex.dropdown,
|
|
684
|
+
boxShadow: tokens.shadows.lg
|
|
685
|
+
},
|
|
686
|
+
vaultInfoHeader: {
|
|
687
|
+
fontSize: tokens.typography.fontSizeXs,
|
|
688
|
+
fontWeight: tokens.typography.fontWeightSemibold,
|
|
689
|
+
color: tokens.colors.textSecondary,
|
|
690
|
+
letterSpacing: "0.5px",
|
|
691
|
+
marginBottom: tokens.spacing.lg,
|
|
692
|
+
textTransform: "uppercase"
|
|
693
|
+
},
|
|
694
|
+
vaultInfoRow: {
|
|
695
|
+
marginBottom: tokens.spacing.md
|
|
696
|
+
},
|
|
697
|
+
vaultLabel: {
|
|
698
|
+
display: "block",
|
|
699
|
+
fontSize: "12px",
|
|
700
|
+
color: tokens.colors.textTertiary,
|
|
701
|
+
marginBottom: tokens.spacing.xs
|
|
702
|
+
},
|
|
703
|
+
vaultValueRow: {
|
|
704
|
+
display: "flex",
|
|
705
|
+
alignItems: "center",
|
|
706
|
+
justifyContent: "space-between",
|
|
707
|
+
gap: tokens.spacing.sm
|
|
708
|
+
},
|
|
709
|
+
vaultValue: {
|
|
710
|
+
fontSize: tokens.typography.fontSizeMd,
|
|
711
|
+
color: tokens.colors.textPrimary,
|
|
712
|
+
fontWeight: tokens.typography.fontWeightMedium,
|
|
713
|
+
flex: 1
|
|
714
|
+
},
|
|
715
|
+
vaultValueMono: {
|
|
716
|
+
...presets.mono,
|
|
717
|
+
wordBreak: "break-all"
|
|
718
|
+
},
|
|
719
|
+
copyBtn: {
|
|
720
|
+
background: "transparent",
|
|
721
|
+
border: `1px solid ${tokens.colors.borderSecondary}`,
|
|
722
|
+
color: tokens.colors.textSecondary,
|
|
723
|
+
padding: `${tokens.spacing.xs} ${tokens.spacing.sm}`,
|
|
724
|
+
borderRadius: tokens.radius.sm,
|
|
725
|
+
cursor: "pointer",
|
|
726
|
+
fontSize: tokens.typography.fontSizeXs,
|
|
727
|
+
transition: `all ${tokens.transitions.normal}`,
|
|
728
|
+
whiteSpace: "nowrap"
|
|
729
|
+
},
|
|
730
|
+
copyBtnHover: {
|
|
731
|
+
background: tokens.colors.bgHover,
|
|
732
|
+
borderColor: tokens.colors.accentPrimary,
|
|
733
|
+
color: tokens.colors.accentPrimary
|
|
734
|
+
},
|
|
735
|
+
copyBtnCopied: {
|
|
736
|
+
background: tokens.colors.accentSuccess,
|
|
737
|
+
borderColor: tokens.colors.accentSuccess,
|
|
738
|
+
color: tokens.colors.textInverse
|
|
739
|
+
}
|
|
740
|
+
};
|
|
741
|
+
function AuthStatus({
|
|
742
|
+
className = "",
|
|
743
|
+
style,
|
|
744
|
+
showVaultInfo = false,
|
|
745
|
+
showLogout = false
|
|
746
|
+
}) {
|
|
747
|
+
const {
|
|
748
|
+
isAuthenticated,
|
|
749
|
+
isLoading,
|
|
750
|
+
walletAddress,
|
|
751
|
+
vaultId,
|
|
752
|
+
vaultInfo,
|
|
753
|
+
logout
|
|
754
|
+
} = useEmblemAuth();
|
|
755
|
+
const [isHovered, setIsHovered] = react.useState(false);
|
|
756
|
+
const [logoutHovered, setLogoutHovered] = react.useState(false);
|
|
757
|
+
const [copiedField, setCopiedField] = react.useState(null);
|
|
758
|
+
const [copyHovered, setCopyHovered] = react.useState(null);
|
|
759
|
+
const handleCopy = react.useCallback(async (field, value) => {
|
|
760
|
+
const success = await copyToClipboard2(value);
|
|
761
|
+
if (success) {
|
|
762
|
+
setCopiedField(field);
|
|
763
|
+
setTimeout(() => setCopiedField(null), 1500);
|
|
764
|
+
}
|
|
765
|
+
}, []);
|
|
766
|
+
if (!isAuthenticated) {
|
|
767
|
+
if (isLoading) {
|
|
768
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
769
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: animations }),
|
|
770
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: { ...s.disconnected, ...style }, children: [
|
|
771
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.spinner }),
|
|
772
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Connecting..." })
|
|
773
|
+
] })
|
|
774
|
+
] });
|
|
775
|
+
}
|
|
776
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: { ...s.disconnected, ...style }, children: [
|
|
777
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.dot }),
|
|
778
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Not connected" })
|
|
779
|
+
] });
|
|
780
|
+
}
|
|
781
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
782
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: animations }),
|
|
783
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: { ...s.container, ...style }, children: [
|
|
784
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
785
|
+
"div",
|
|
786
|
+
{
|
|
787
|
+
style: s.vaultInfoWrapper,
|
|
788
|
+
onMouseEnter: () => showVaultInfo && setIsHovered(true),
|
|
789
|
+
onMouseLeave: () => showVaultInfo && setIsHovered(false),
|
|
790
|
+
children: [
|
|
791
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { ...s.dot, ...s.dotConnected }, title: "Connected" }),
|
|
792
|
+
showVaultInfo && isHovered && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.vaultInfo, children: [
|
|
793
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: s.vaultInfoHeader, children: "Vault Information" }),
|
|
794
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.vaultInfoRow, children: [
|
|
795
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.vaultLabel, children: "Vault ID" }),
|
|
796
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.vaultValueRow, children: [
|
|
797
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: s.vaultValue, children: [
|
|
798
|
+
"#",
|
|
799
|
+
vaultId
|
|
800
|
+
] }),
|
|
801
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
802
|
+
CopyButton,
|
|
803
|
+
{
|
|
804
|
+
field: "vaultId",
|
|
805
|
+
value: vaultId || "",
|
|
806
|
+
copiedField,
|
|
807
|
+
copyHovered,
|
|
808
|
+
setCopyHovered,
|
|
809
|
+
onCopy: handleCopy
|
|
810
|
+
}
|
|
811
|
+
)
|
|
812
|
+
] })
|
|
813
|
+
] }),
|
|
814
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.vaultInfoRow, children: [
|
|
815
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.vaultLabel, children: "Connected Wallet" }),
|
|
816
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.vaultValueRow, children: [
|
|
817
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { ...s.vaultValue, ...s.vaultValueMono }, children: walletAddress }),
|
|
818
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
819
|
+
CopyButton,
|
|
820
|
+
{
|
|
821
|
+
field: "wallet",
|
|
822
|
+
value: walletAddress || "",
|
|
823
|
+
copiedField,
|
|
824
|
+
copyHovered,
|
|
825
|
+
setCopyHovered,
|
|
826
|
+
onCopy: handleCopy
|
|
827
|
+
}
|
|
828
|
+
)
|
|
829
|
+
] })
|
|
830
|
+
] }),
|
|
831
|
+
vaultInfo?.evmAddress && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.vaultInfoRow, children: [
|
|
832
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.vaultLabel, children: "Vault EVM Address" }),
|
|
833
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.vaultValueRow, children: [
|
|
834
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { ...s.vaultValue, ...s.vaultValueMono }, children: vaultInfo.evmAddress }),
|
|
835
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
836
|
+
CopyButton,
|
|
837
|
+
{
|
|
838
|
+
field: "evmAddress",
|
|
839
|
+
value: vaultInfo.evmAddress,
|
|
840
|
+
copiedField,
|
|
841
|
+
copyHovered,
|
|
842
|
+
setCopyHovered,
|
|
843
|
+
onCopy: handleCopy
|
|
844
|
+
}
|
|
845
|
+
)
|
|
846
|
+
] })
|
|
847
|
+
] }),
|
|
848
|
+
vaultInfo?.solanaAddress && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.vaultInfoRow, children: [
|
|
849
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.vaultLabel, children: "Vault Solana Address" }),
|
|
850
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.vaultValueRow, children: [
|
|
851
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { ...s.vaultValue, ...s.vaultValueMono }, children: vaultInfo.solanaAddress }),
|
|
852
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
853
|
+
CopyButton,
|
|
854
|
+
{
|
|
855
|
+
field: "solAddress",
|
|
856
|
+
value: vaultInfo.solanaAddress,
|
|
857
|
+
copiedField,
|
|
858
|
+
copyHovered,
|
|
859
|
+
setCopyHovered,
|
|
860
|
+
onCopy: handleCopy
|
|
861
|
+
}
|
|
862
|
+
)
|
|
863
|
+
] })
|
|
864
|
+
] })
|
|
865
|
+
] })
|
|
866
|
+
]
|
|
867
|
+
}
|
|
868
|
+
),
|
|
869
|
+
showLogout && /* @__PURE__ */ jsxRuntime.jsx(
|
|
870
|
+
"button",
|
|
871
|
+
{
|
|
872
|
+
type: "button",
|
|
873
|
+
onClick: logout,
|
|
874
|
+
style: {
|
|
875
|
+
...s.logoutBtn,
|
|
876
|
+
...logoutHovered ? s.logoutBtnHover : {}
|
|
877
|
+
},
|
|
878
|
+
onMouseEnter: () => setLogoutHovered(true),
|
|
879
|
+
onMouseLeave: () => setLogoutHovered(false),
|
|
880
|
+
title: "Disconnect",
|
|
881
|
+
children: "\u23FB"
|
|
882
|
+
}
|
|
883
|
+
)
|
|
884
|
+
] })
|
|
885
|
+
] });
|
|
886
|
+
}
|
|
887
|
+
function CopyButton({ field, value, copiedField, copyHovered, setCopyHovered, onCopy }) {
|
|
888
|
+
const isCopied = copiedField === field;
|
|
889
|
+
const isHovered = copyHovered === field;
|
|
890
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
891
|
+
"button",
|
|
892
|
+
{
|
|
893
|
+
type: "button",
|
|
894
|
+
onClick: () => onCopy(field, value),
|
|
895
|
+
style: {
|
|
896
|
+
...s.copyBtn,
|
|
897
|
+
...isCopied ? s.copyBtnCopied : isHovered ? s.copyBtnHover : {}
|
|
898
|
+
},
|
|
899
|
+
onMouseEnter: () => setCopyHovered(field),
|
|
900
|
+
onMouseLeave: () => setCopyHovered(null),
|
|
901
|
+
children: isCopied ? "Copied!" : "Copy"
|
|
902
|
+
}
|
|
903
|
+
);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
exports.AuthStatus = AuthStatus;
|
|
907
|
+
exports.ConnectButton = ConnectButton;
|
|
908
|
+
//# sourceMappingURL=index.cjs.map
|
|
909
|
+
//# sourceMappingURL=index.cjs.map
|