@deframe-sdk/components 0.1.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 +174 -0
- package/dist/index.d.mts +556 -0
- package/dist/index.d.ts +556 -0
- package/dist/index.js +1678 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1618 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +2247 -0
- package/package.json +75 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1618 @@
|
|
|
1
|
+
import { twMerge } from 'tailwind-merge';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import * as React6 from 'react';
|
|
4
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
5
|
+
import { motion, AnimatePresence } from 'framer-motion';
|
|
6
|
+
import { MdCheckCircleOutline, MdErrorOutline, MdWarningAmber, MdInfoOutline, MdClose } from 'react-icons/md';
|
|
7
|
+
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __defProps = Object.defineProperties;
|
|
10
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
11
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
12
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
14
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15
|
+
var __spreadValues = (a, b) => {
|
|
16
|
+
for (var prop in b || (b = {}))
|
|
17
|
+
if (__hasOwnProp.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
if (__getOwnPropSymbols)
|
|
20
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
21
|
+
if (__propIsEnum.call(b, prop))
|
|
22
|
+
__defNormalProp(a, prop, b[prop]);
|
|
23
|
+
}
|
|
24
|
+
return a;
|
|
25
|
+
};
|
|
26
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
27
|
+
var __objRest = (source, exclude) => {
|
|
28
|
+
var target = {};
|
|
29
|
+
for (var prop in source)
|
|
30
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
if (source != null && __getOwnPropSymbols)
|
|
33
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
34
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
35
|
+
target[prop] = source[prop];
|
|
36
|
+
}
|
|
37
|
+
return target;
|
|
38
|
+
};
|
|
39
|
+
function ActionButton(_a) {
|
|
40
|
+
var _b = _a, {
|
|
41
|
+
children,
|
|
42
|
+
disabled = false,
|
|
43
|
+
className = "",
|
|
44
|
+
type = "button"
|
|
45
|
+
} = _b, props = __objRest(_b, [
|
|
46
|
+
"children",
|
|
47
|
+
"disabled",
|
|
48
|
+
"className",
|
|
49
|
+
"type"
|
|
50
|
+
]);
|
|
51
|
+
const getStyles = () => {
|
|
52
|
+
if (disabled) {
|
|
53
|
+
return {
|
|
54
|
+
container: "flex-1 h-12 rounded inline-flex flex-col justify-center items-center gap-2 overflow-hidden bg-bg-muted dark:bg-bg-muted-dark",
|
|
55
|
+
inner: "self-stretch flex-1 pl-4 pr-6 py-2.5 inline-flex justify-center items-center gap-2",
|
|
56
|
+
text: "opacity-state-disabled-content text-center justify-center text-text-disabled dark:text-text-disabled-dark text-sm font-semibold font-poppins leading-5"
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
container: "flex-1 h-12 bg-brand-primary rounded inline-flex flex-col justify-center items-center gap-2 overflow-hidden hover:shadow-md transition-shadow duration-200",
|
|
61
|
+
inner: "self-stretch flex-1 pl-4 pr-6 py-2.5 inline-flex justify-center items-center gap-2 hover:opacity-90 focus:opacity-85 active:opacity-85 transition-opacity duration-200",
|
|
62
|
+
text: "text-center justify-center text-text-inverse text-sm font-semibold font-poppins leading-5"
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
const styles = getStyles();
|
|
66
|
+
const containerClasses = twMerge(
|
|
67
|
+
"flex-1 px-2 py-1 rounded border border-border-subtle dark:border-border-subtle-dark bg-bg-muted dark:bg-bg-muted-dark text-text-secondary dark:text-text-secondary-dark text-sm font-semibold font-poppins leading-5 hover:border-border-default dark:hover:border-border-default-dark focus:outline-none focus:ring-2 focus:ring-brand-primary",
|
|
68
|
+
disabled && "cursor-not-allowed",
|
|
69
|
+
className
|
|
70
|
+
);
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
|
+
"button",
|
|
73
|
+
__spreadProps(__spreadValues({
|
|
74
|
+
type,
|
|
75
|
+
className: containerClasses,
|
|
76
|
+
disabled
|
|
77
|
+
}, props), {
|
|
78
|
+
children: /* @__PURE__ */ jsx("div", { className: styles.inner, children: /* @__PURE__ */ jsx("div", { className: styles.text, children }) })
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
function PercentageButton(_a) {
|
|
83
|
+
var _b = _a, {
|
|
84
|
+
children,
|
|
85
|
+
disabled = false,
|
|
86
|
+
className = "",
|
|
87
|
+
type = "button"
|
|
88
|
+
} = _b, props = __objRest(_b, [
|
|
89
|
+
"children",
|
|
90
|
+
"disabled",
|
|
91
|
+
"className",
|
|
92
|
+
"type"
|
|
93
|
+
]);
|
|
94
|
+
const containerClasses = twMerge(
|
|
95
|
+
"flex-1 px-2 py-1 rounded border border-border-subtle dark:border-border-subtle-dark bg-bg-muted dark:bg-bg-muted-dark text-text-secondary dark:text-text-secondary-dark text-sm font-semibold font-poppins leading-5 hover:border-border-default dark:hover:border-border-default-dark focus:outline-none focus:ring-2 focus:ring-brand-primary",
|
|
96
|
+
disabled && "cursor-not-allowed",
|
|
97
|
+
className
|
|
98
|
+
);
|
|
99
|
+
return /* @__PURE__ */ jsx(
|
|
100
|
+
"button",
|
|
101
|
+
__spreadProps(__spreadValues({
|
|
102
|
+
type,
|
|
103
|
+
className: containerClasses,
|
|
104
|
+
disabled
|
|
105
|
+
}, props), {
|
|
106
|
+
children
|
|
107
|
+
})
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
function PrimaryButton(_a) {
|
|
111
|
+
var _b = _a, {
|
|
112
|
+
children,
|
|
113
|
+
disabled = false,
|
|
114
|
+
className = "",
|
|
115
|
+
type = "button"
|
|
116
|
+
} = _b, props = __objRest(_b, [
|
|
117
|
+
"children",
|
|
118
|
+
"disabled",
|
|
119
|
+
"className",
|
|
120
|
+
"type"
|
|
121
|
+
]);
|
|
122
|
+
const baseStyles = disabled ? "h-12 w-full rounded px-6 py-2.5 inline-flex justify-center items-center gap-2 overflow-hidden cursor-not-allowed bg-bg-muted dark:bg-bg-muted-dark text-text-disabled dark:text-text-disabled-dark opacity-50 text-center text-sm font-semibold font-poppins leading-5" : "h-12 w-full rounded px-6 py-2.5 inline-flex justify-center items-center gap-2 overflow-hidden bg-brand-primary text-text-inverse hover:shadow-md hover:opacity-90 focus:opacity-85 active:opacity-85 transition-all duration-200 text-center text-sm font-semibold font-poppins leading-5 cursor-pointer";
|
|
123
|
+
const buttonClasses = twMerge(baseStyles, className);
|
|
124
|
+
return /* @__PURE__ */ jsx(
|
|
125
|
+
"button",
|
|
126
|
+
__spreadProps(__spreadValues({
|
|
127
|
+
type,
|
|
128
|
+
className: buttonClasses,
|
|
129
|
+
disabled
|
|
130
|
+
}, props), {
|
|
131
|
+
children
|
|
132
|
+
})
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
function SecondaryButton(_a) {
|
|
136
|
+
var _b = _a, {
|
|
137
|
+
children,
|
|
138
|
+
disabled = false,
|
|
139
|
+
className = "",
|
|
140
|
+
type = "button"
|
|
141
|
+
} = _b, props = __objRest(_b, [
|
|
142
|
+
"children",
|
|
143
|
+
"disabled",
|
|
144
|
+
"className",
|
|
145
|
+
"type"
|
|
146
|
+
]);
|
|
147
|
+
const getStyles = () => {
|
|
148
|
+
if (disabled) {
|
|
149
|
+
return {
|
|
150
|
+
container: "h-12 rounded outline outline-1 outline-offset-[-1px] outline-border-default dark:outline-border-default-dark inline-flex flex-col justify-center items-center gap-2 overflow-hidden",
|
|
151
|
+
inner: "self-stretch flex-1 px-6 py-2.5 inline-flex justify-center items-center gap-2",
|
|
152
|
+
text: "opacity-state-disabled-content text-center justify-center text-text-disabled dark:text-text-disabled-dark text-sm font-semibold font-poppins leading-5"
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
container: "h-12 rounded outline outline-1 outline-offset-[-1px] outline-border-subtle dark:outline-border-subtle-dark inline-flex flex-col justify-center items-center gap-2 overflow-hidden hover:outline-brand-primary focus:outline-brand-primary active:outline-border-default transition-colors duration-200 cursor-pointer",
|
|
157
|
+
inner: "self-stretch flex-1 px-6 py-2.5 inline-flex justify-center items-center gap-2 hover:bg-brand-secondary-20 focus:bg-brand-secondary-20 active:bg-transparent transition-colors duration-200",
|
|
158
|
+
text: "text-center justify-center text-brand-primary text-sm font-semibold font-poppins leading-5"
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
const styles = getStyles();
|
|
162
|
+
const containerClasses = twMerge(
|
|
163
|
+
styles.container,
|
|
164
|
+
disabled && "cursor-not-allowed",
|
|
165
|
+
className
|
|
166
|
+
);
|
|
167
|
+
return /* @__PURE__ */ jsx(
|
|
168
|
+
"button",
|
|
169
|
+
__spreadProps(__spreadValues({
|
|
170
|
+
type,
|
|
171
|
+
className: containerClasses,
|
|
172
|
+
disabled
|
|
173
|
+
}, props), {
|
|
174
|
+
children: /* @__PURE__ */ jsx("div", { className: styles.inner, children: /* @__PURE__ */ jsx("div", { className: styles.text, children }) })
|
|
175
|
+
})
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
function TertiaryButton(_a) {
|
|
179
|
+
var _b = _a, {
|
|
180
|
+
children,
|
|
181
|
+
disabled = false,
|
|
182
|
+
className = "",
|
|
183
|
+
type = "button"
|
|
184
|
+
} = _b, props = __objRest(_b, [
|
|
185
|
+
"children",
|
|
186
|
+
"disabled",
|
|
187
|
+
"className",
|
|
188
|
+
"type"
|
|
189
|
+
]);
|
|
190
|
+
const getStyles = () => {
|
|
191
|
+
if (disabled) {
|
|
192
|
+
return {
|
|
193
|
+
container: "h-12 rounded inline-flex flex-col justify-center items-center gap-2 overflow-hidden",
|
|
194
|
+
inner: "self-stretch flex-1 px-6 py-2.5 inline-flex justify-center items-center gap-2",
|
|
195
|
+
text: "opacity-state-disabled-content text-center justify-center text-text-disabled dark:text-text-disabled-dark text-sm font-semibold font-poppins leading-5"
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
container: "h-12 rounded inline-flex flex-col justify-center items-center gap-2 overflow-hidden hover:shadow-md transition-colors duration-200 cursor-pointer",
|
|
200
|
+
inner: "self-stretch flex-1 px-6 py-2.5 inline-flex justify-center items-center gap-2 hover:bg-brand-tint dark:hover:bg-brand-tint-dark focus:bg-brand-tint-75 dark:focus:bg-brand-tint-75-dark active:bg-brand-tint-60 dark:active:bg-brand-tint-60-dark transition-colors duration-200",
|
|
201
|
+
text: "text-center justify-center text-brand-primary text-sm font-semibold font-poppins leading-5"
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
const styles = getStyles();
|
|
205
|
+
const containerClasses = twMerge(
|
|
206
|
+
styles.container,
|
|
207
|
+
disabled && "cursor-not-allowed",
|
|
208
|
+
className
|
|
209
|
+
);
|
|
210
|
+
return /* @__PURE__ */ jsx(
|
|
211
|
+
"button",
|
|
212
|
+
__spreadProps(__spreadValues({
|
|
213
|
+
type,
|
|
214
|
+
className: containerClasses,
|
|
215
|
+
disabled
|
|
216
|
+
}, props), {
|
|
217
|
+
children: /* @__PURE__ */ jsx("div", { className: styles.inner, children: /* @__PURE__ */ jsx("div", { className: styles.text, children }) })
|
|
218
|
+
})
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
function Link(_a) {
|
|
222
|
+
var _b = _a, {
|
|
223
|
+
children,
|
|
224
|
+
href,
|
|
225
|
+
className = "",
|
|
226
|
+
target = "_self"
|
|
227
|
+
} = _b, props = __objRest(_b, [
|
|
228
|
+
"children",
|
|
229
|
+
"href",
|
|
230
|
+
"className",
|
|
231
|
+
"target"
|
|
232
|
+
]);
|
|
233
|
+
const styles = {
|
|
234
|
+
link: "text-sm font-medium font-poppins leading-5 cursor-pointer"
|
|
235
|
+
};
|
|
236
|
+
const linkClasses = twMerge(styles.link, className);
|
|
237
|
+
return /* @__PURE__ */ jsx(
|
|
238
|
+
"a",
|
|
239
|
+
__spreadProps(__spreadValues({
|
|
240
|
+
href,
|
|
241
|
+
target,
|
|
242
|
+
className: linkClasses,
|
|
243
|
+
rel: target === "_blank" ? "noopener noreferrer" : void 0
|
|
244
|
+
}, props), {
|
|
245
|
+
children
|
|
246
|
+
})
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
function Input(_a) {
|
|
250
|
+
var _b = _a, {
|
|
251
|
+
label,
|
|
252
|
+
error,
|
|
253
|
+
placeholder,
|
|
254
|
+
type = "text",
|
|
255
|
+
repassword = "Forgot password?",
|
|
256
|
+
disabled,
|
|
257
|
+
className
|
|
258
|
+
} = _b, props = __objRest(_b, [
|
|
259
|
+
"label",
|
|
260
|
+
"error",
|
|
261
|
+
"placeholder",
|
|
262
|
+
"type",
|
|
263
|
+
"repassword",
|
|
264
|
+
"disabled",
|
|
265
|
+
"className"
|
|
266
|
+
]);
|
|
267
|
+
const hasError = !!error;
|
|
268
|
+
const inputClasses = twMerge(
|
|
269
|
+
"w-full px-4 py-2 rounded",
|
|
270
|
+
"text-white placeholder-gray-400 text-base font-poppins",
|
|
271
|
+
hasError ? "border-red-500" : disabled ? "border-gray-600 opacity-60" : "border-gray-500",
|
|
272
|
+
className
|
|
273
|
+
);
|
|
274
|
+
const labelClasses = "block mb-1 text-xs text-white font-poppins";
|
|
275
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
276
|
+
label && /* @__PURE__ */ jsx("label", { className: labelClasses, children: label }),
|
|
277
|
+
/* @__PURE__ */ jsx(
|
|
278
|
+
"input",
|
|
279
|
+
__spreadValues({
|
|
280
|
+
type,
|
|
281
|
+
placeholder,
|
|
282
|
+
disabled,
|
|
283
|
+
className: inputClasses
|
|
284
|
+
}, props)
|
|
285
|
+
),
|
|
286
|
+
type === "password" && /* @__PURE__ */ jsx("div", { className: "text-right", children: /* @__PURE__ */ jsx(Link, { href: "#", children: repassword }) }),
|
|
287
|
+
error && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-red-500", children: error })
|
|
288
|
+
] });
|
|
289
|
+
}
|
|
290
|
+
var ListItem = ({
|
|
291
|
+
children,
|
|
292
|
+
className,
|
|
293
|
+
containerClassName,
|
|
294
|
+
onClick
|
|
295
|
+
}) => {
|
|
296
|
+
const containerClasses = twMerge(
|
|
297
|
+
"self-stretch min-h-16 relative rounded border border-border-default text-white dark:border-border-default-dark flex flex-col justify-center items-center hover:border-border-strong dark:hover:border-border-strong-dark transition-colors bg-bg-subtle dark:bg-bg-subtle-dark",
|
|
298
|
+
onClick && "cursor-pointer",
|
|
299
|
+
containerClassName
|
|
300
|
+
);
|
|
301
|
+
return /* @__PURE__ */ jsx("div", { className: containerClasses, onClick, children: /* @__PURE__ */ jsx(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
className: twMerge(
|
|
305
|
+
"self-stretch inline-flex justify-between items-center gap-md px-4 py-2 text-white",
|
|
306
|
+
className
|
|
307
|
+
),
|
|
308
|
+
children
|
|
309
|
+
}
|
|
310
|
+
) });
|
|
311
|
+
};
|
|
312
|
+
var ListItemLeftSide = ({ children, className }) => {
|
|
313
|
+
return /* @__PURE__ */ jsx(
|
|
314
|
+
"div",
|
|
315
|
+
{
|
|
316
|
+
className: twMerge("flex justify-center items-center text-white", className),
|
|
317
|
+
children
|
|
318
|
+
}
|
|
319
|
+
);
|
|
320
|
+
};
|
|
321
|
+
var ListItemContent = ({ children, className }) => {
|
|
322
|
+
return /* @__PURE__ */ jsx(
|
|
323
|
+
"div",
|
|
324
|
+
{
|
|
325
|
+
className: twMerge(
|
|
326
|
+
"flex-1 self-stretch inline-flex flex-col justify-center items-start overflow-hidden text-white",
|
|
327
|
+
className
|
|
328
|
+
),
|
|
329
|
+
children
|
|
330
|
+
}
|
|
331
|
+
);
|
|
332
|
+
};
|
|
333
|
+
var ListItemRightSide = ({ children, className }) => {
|
|
334
|
+
return /* @__PURE__ */ jsx(
|
|
335
|
+
"div",
|
|
336
|
+
{
|
|
337
|
+
className: twMerge(
|
|
338
|
+
"flex flex-col justify-start items-end text-white",
|
|
339
|
+
className
|
|
340
|
+
),
|
|
341
|
+
children
|
|
342
|
+
}
|
|
343
|
+
);
|
|
344
|
+
};
|
|
345
|
+
function WalletListContainer({
|
|
346
|
+
children,
|
|
347
|
+
className
|
|
348
|
+
}) {
|
|
349
|
+
return /* @__PURE__ */ jsx("div", { className: twMerge("flex flex-col gap-4", className), children });
|
|
350
|
+
}
|
|
351
|
+
var Text = React6.forwardRef(
|
|
352
|
+
(_a, ref) => {
|
|
353
|
+
var _b = _a, { as: Component = "p", variantClass, className, children } = _b, props = __objRest(_b, ["as", "variantClass", "className", "children"]);
|
|
354
|
+
return React6.createElement(
|
|
355
|
+
Component,
|
|
356
|
+
__spreadValues({
|
|
357
|
+
ref,
|
|
358
|
+
className: twMerge("font-poppins", variantClass, className)
|
|
359
|
+
}, props),
|
|
360
|
+
children
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
);
|
|
364
|
+
Text.displayName = "Text";
|
|
365
|
+
var Text_default = Text;
|
|
366
|
+
var accentVariants = {
|
|
367
|
+
"accent-large": "text-[15px] leading-[140%] font-semibold",
|
|
368
|
+
"accent-medium": "text-[14px] leading-[140%] font-semibold",
|
|
369
|
+
"accent-small": "text-[12px] leading-[140%] font-semibold"
|
|
370
|
+
};
|
|
371
|
+
var TextAccent = React6.forwardRef(
|
|
372
|
+
(_a, ref) => {
|
|
373
|
+
var _b = _a, { variant = "accent-medium", as = "span" } = _b, props = __objRest(_b, ["variant", "as"]);
|
|
374
|
+
const variantClass = accentVariants[variant];
|
|
375
|
+
return /* @__PURE__ */ jsx(Text_default, __spreadValues({ ref, as, variantClass }, props));
|
|
376
|
+
}
|
|
377
|
+
);
|
|
378
|
+
TextAccent.displayName = "TextAccent";
|
|
379
|
+
var TextAccent_default = TextAccent;
|
|
380
|
+
var bodyVariants = {
|
|
381
|
+
"text-large": "text-[15px] leading-[140%] font-normal",
|
|
382
|
+
"text-medium": "text-[14px] leading-[140%] font-normal",
|
|
383
|
+
"text-small": "text-[12px] leading-[140%] font-normal"
|
|
384
|
+
};
|
|
385
|
+
var TextBody = React6.forwardRef(
|
|
386
|
+
(_a, ref) => {
|
|
387
|
+
var _b = _a, { variant = "text-medium", as = "p" } = _b, props = __objRest(_b, ["variant", "as"]);
|
|
388
|
+
const variantClass = bodyVariants[variant];
|
|
389
|
+
return /* @__PURE__ */ jsx(Text_default, __spreadValues({ ref, as, variantClass }, props));
|
|
390
|
+
}
|
|
391
|
+
);
|
|
392
|
+
TextBody.displayName = "TextBody";
|
|
393
|
+
var TextBody_default = TextBody;
|
|
394
|
+
var headingVariants = {
|
|
395
|
+
"h-large": "text-[56px] leading-[100%] tracking-[0] font-extrabold",
|
|
396
|
+
h1: "text-[40px] leading-[110%] font-extrabold",
|
|
397
|
+
h2: "text-[28px] leading-[130%] font-extrabold",
|
|
398
|
+
h3: "text-[22px] leading-[120%] font-extrabold",
|
|
399
|
+
h4: "text-[18px] leading-[120%] font-extrabold",
|
|
400
|
+
h5: "text-[16px] leading-[120%] font-bold"
|
|
401
|
+
};
|
|
402
|
+
var TextHeading = React6.forwardRef(
|
|
403
|
+
(_a, ref) => {
|
|
404
|
+
var _b = _a, { variant = "h2", as } = _b, props = __objRest(_b, ["variant", "as"]);
|
|
405
|
+
const variantClass = headingVariants[variant];
|
|
406
|
+
return /* @__PURE__ */ jsx(
|
|
407
|
+
Text_default,
|
|
408
|
+
__spreadValues({
|
|
409
|
+
ref,
|
|
410
|
+
as: variant === "h-large" ? "h1" : variant,
|
|
411
|
+
variantClass
|
|
412
|
+
}, props)
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
);
|
|
416
|
+
TextHeading.displayName = "TextHeading";
|
|
417
|
+
var TextHeading_default = TextHeading;
|
|
418
|
+
function Title(_a) {
|
|
419
|
+
var _b = _a, {
|
|
420
|
+
variant = "h1"
|
|
421
|
+
} = _b, props = __objRest(_b, [
|
|
422
|
+
"variant"
|
|
423
|
+
]);
|
|
424
|
+
return /* @__PURE__ */ jsx(TextHeading_default, __spreadValues({ variant }, props));
|
|
425
|
+
}
|
|
426
|
+
function ConnectWalletList({
|
|
427
|
+
wallets,
|
|
428
|
+
className
|
|
429
|
+
}) {
|
|
430
|
+
const handleWalletClick = (wallet) => {
|
|
431
|
+
var _a;
|
|
432
|
+
(_a = wallet.onClick) == null ? void 0 : _a.call(wallet);
|
|
433
|
+
};
|
|
434
|
+
return /* @__PURE__ */ jsx("div", { className: twMerge("w-full", className), children: /* @__PURE__ */ jsx(WalletListContainer, { children: wallets.map((wallet) => /* @__PURE__ */ jsxs(ListItem, { onClick: () => handleWalletClick(wallet), children: [
|
|
435
|
+
/* @__PURE__ */ jsx(ListItemLeftSide, { children: typeof wallet.icon === "string" ? /* @__PURE__ */ jsx(
|
|
436
|
+
"img",
|
|
437
|
+
{
|
|
438
|
+
src: wallet.icon,
|
|
439
|
+
alt: wallet.name,
|
|
440
|
+
className: "w-10 h-10 rounded-full"
|
|
441
|
+
}
|
|
442
|
+
) : wallet.icon }),
|
|
443
|
+
/* @__PURE__ */ jsx(ListItemContent, { children: /* @__PURE__ */ jsx(Text_default, { children: wallet.name }) }),
|
|
444
|
+
/* @__PURE__ */ jsx(ListItemRightSide, { children: /* @__PURE__ */ jsx(
|
|
445
|
+
"svg",
|
|
446
|
+
{
|
|
447
|
+
className: "flex-shrink-0 w-5 h-5 text-gray-400",
|
|
448
|
+
fill: "none",
|
|
449
|
+
viewBox: "0 0 24 24",
|
|
450
|
+
stroke: "currentColor",
|
|
451
|
+
children: /* @__PURE__ */ jsx(
|
|
452
|
+
"path",
|
|
453
|
+
{
|
|
454
|
+
strokeLinecap: "round",
|
|
455
|
+
strokeLinejoin: "round",
|
|
456
|
+
strokeWidth: 2,
|
|
457
|
+
d: "M9 5l7 7-7 7"
|
|
458
|
+
}
|
|
459
|
+
)
|
|
460
|
+
}
|
|
461
|
+
) })
|
|
462
|
+
] }, wallet.id)) }) });
|
|
463
|
+
}
|
|
464
|
+
function WalletItem({
|
|
465
|
+
id,
|
|
466
|
+
name,
|
|
467
|
+
icon,
|
|
468
|
+
onClick,
|
|
469
|
+
className
|
|
470
|
+
}) {
|
|
471
|
+
return /* @__PURE__ */ jsxs(
|
|
472
|
+
"button",
|
|
473
|
+
{
|
|
474
|
+
onClick,
|
|
475
|
+
className: twMerge(
|
|
476
|
+
"w-full flex items-center gap-4 p-5",
|
|
477
|
+
"bg-[#1E1E1E] rounded-2xl",
|
|
478
|
+
"transition-all duration-200",
|
|
479
|
+
"hover:bg-[#2C2C2C] active:scale-[0.98]",
|
|
480
|
+
"focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50",
|
|
481
|
+
className
|
|
482
|
+
),
|
|
483
|
+
children: [
|
|
484
|
+
/* @__PURE__ */ jsx("div", { className: "flex-shrink-0 w-12 h-12 rounded-full overflow-hidden bg-white flex items-center justify-center", children: typeof icon === "string" ? /* @__PURE__ */ jsx(
|
|
485
|
+
"img",
|
|
486
|
+
{
|
|
487
|
+
src: icon,
|
|
488
|
+
alt: name,
|
|
489
|
+
className: "w-full h-full object-cover"
|
|
490
|
+
}
|
|
491
|
+
) : icon }),
|
|
492
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 text-left text-[15px] md:text-[17px] font-medium text-white", children: name }),
|
|
493
|
+
/* @__PURE__ */ jsx(
|
|
494
|
+
"svg",
|
|
495
|
+
{
|
|
496
|
+
className: "flex-shrink-0 w-5 h-5 text-gray-400",
|
|
497
|
+
fill: "none",
|
|
498
|
+
viewBox: "0 0 24 24",
|
|
499
|
+
stroke: "currentColor",
|
|
500
|
+
children: /* @__PURE__ */ jsx(
|
|
501
|
+
"path",
|
|
502
|
+
{
|
|
503
|
+
strokeLinecap: "round",
|
|
504
|
+
strokeLinejoin: "round",
|
|
505
|
+
strokeWidth: 2,
|
|
506
|
+
d: "M9 5l7 7-7 7"
|
|
507
|
+
}
|
|
508
|
+
)
|
|
509
|
+
}
|
|
510
|
+
)
|
|
511
|
+
]
|
|
512
|
+
},
|
|
513
|
+
id
|
|
514
|
+
);
|
|
515
|
+
}
|
|
516
|
+
var CURRENCY_CONFIG = {
|
|
517
|
+
symbols: {
|
|
518
|
+
USD: "$",
|
|
519
|
+
BRL: "R$",
|
|
520
|
+
EUR: "\u20AC",
|
|
521
|
+
BTC: "\u20BF",
|
|
522
|
+
ETH: "\u039E",
|
|
523
|
+
USDC: "$",
|
|
524
|
+
USDT: "$"
|
|
525
|
+
},
|
|
526
|
+
labels: {
|
|
527
|
+
USD: "USD",
|
|
528
|
+
BRL: "BRL",
|
|
529
|
+
EUR: "EUR",
|
|
530
|
+
BTC: "BTC",
|
|
531
|
+
ETH: "ETH",
|
|
532
|
+
USDC: "USDC",
|
|
533
|
+
USDT: "USDT"
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
var STYLE_CONFIG = {
|
|
537
|
+
alignment: {
|
|
538
|
+
left: "items-start",
|
|
539
|
+
center: "items-center",
|
|
540
|
+
right: "items-end"
|
|
541
|
+
},
|
|
542
|
+
size: {
|
|
543
|
+
sm: { primary: "text-3xl", secondary: "text-sm", gap: "gap-0.5" },
|
|
544
|
+
md: { primary: "text-5xl", secondary: "text-base", gap: "gap-1" },
|
|
545
|
+
lg: { primary: "text-6xl", secondary: "text-lg", gap: "gap-1" }
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
function Currency(props) {
|
|
549
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
550
|
+
const normalizedProps = "usdValue" in props ? {
|
|
551
|
+
amount: props.amount,
|
|
552
|
+
currency: "USD",
|
|
553
|
+
secondaryAmount: props.usdValue,
|
|
554
|
+
secondaryCurrency: void 0,
|
|
555
|
+
align: (_a = props.align) != null ? _a : "right",
|
|
556
|
+
size: (_b = props.size) != null ? _b : "lg",
|
|
557
|
+
showSymbol: false,
|
|
558
|
+
showLabel: false,
|
|
559
|
+
className: (_c = props.className) != null ? _c : ""
|
|
560
|
+
} : {
|
|
561
|
+
amount: props.amount,
|
|
562
|
+
currency: (_d = props.currency) != null ? _d : "USD",
|
|
563
|
+
secondaryAmount: props.secondaryAmount,
|
|
564
|
+
secondaryCurrency: props.secondaryCurrency,
|
|
565
|
+
align: (_e = props.align) != null ? _e : "right",
|
|
566
|
+
size: (_f = props.size) != null ? _f : "lg",
|
|
567
|
+
showSymbol: (_g = props.showSymbol) != null ? _g : true,
|
|
568
|
+
showLabel: (_h = props.showLabel) != null ? _h : false,
|
|
569
|
+
className: (_i = props.className) != null ? _i : ""
|
|
570
|
+
};
|
|
571
|
+
const {
|
|
572
|
+
amount,
|
|
573
|
+
currency,
|
|
574
|
+
secondaryAmount,
|
|
575
|
+
secondaryCurrency,
|
|
576
|
+
align,
|
|
577
|
+
size,
|
|
578
|
+
showSymbol,
|
|
579
|
+
showLabel,
|
|
580
|
+
className
|
|
581
|
+
} = normalizedProps;
|
|
582
|
+
const formatAmount = (value, curr, displaySymbol) => {
|
|
583
|
+
if (!displaySymbol && !showLabel) return value;
|
|
584
|
+
const symbol = displaySymbol ? CURRENCY_CONFIG.symbols[curr] : "";
|
|
585
|
+
const label = showLabel ? ` ${CURRENCY_CONFIG.labels[curr]}` : "";
|
|
586
|
+
if (["BTC", "ETH"].includes(curr) && !value.includes(".") && !value.includes(",")) {
|
|
587
|
+
return `${symbol}${value}${label}`;
|
|
588
|
+
}
|
|
589
|
+
return `${symbol} ${value}${label}`.trim();
|
|
590
|
+
};
|
|
591
|
+
return /* @__PURE__ */ jsxs(
|
|
592
|
+
"div",
|
|
593
|
+
{
|
|
594
|
+
className: twMerge(
|
|
595
|
+
"flex flex-col",
|
|
596
|
+
STYLE_CONFIG.alignment[align],
|
|
597
|
+
STYLE_CONFIG.size[size].gap,
|
|
598
|
+
className
|
|
599
|
+
),
|
|
600
|
+
children: [
|
|
601
|
+
/* @__PURE__ */ jsx(
|
|
602
|
+
"div",
|
|
603
|
+
{
|
|
604
|
+
className: twMerge(
|
|
605
|
+
"font-bold text-text-primary dark:text-text-primary-dark font-poppins",
|
|
606
|
+
STYLE_CONFIG.size[size].primary
|
|
607
|
+
),
|
|
608
|
+
children: formatAmount(amount, currency, showSymbol)
|
|
609
|
+
}
|
|
610
|
+
),
|
|
611
|
+
secondaryAmount && /* @__PURE__ */ jsx(
|
|
612
|
+
"div",
|
|
613
|
+
{
|
|
614
|
+
className: twMerge(
|
|
615
|
+
"text-text-secondary dark:text-text-secondary-dark font-poppins",
|
|
616
|
+
STYLE_CONFIG.size[size].secondary
|
|
617
|
+
),
|
|
618
|
+
children: secondaryCurrency ? formatAmount(secondaryAmount, secondaryCurrency, true) : secondaryAmount
|
|
619
|
+
}
|
|
620
|
+
)
|
|
621
|
+
]
|
|
622
|
+
}
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
var TabsContext = React6.createContext(
|
|
626
|
+
void 0
|
|
627
|
+
);
|
|
628
|
+
var useTabs = () => {
|
|
629
|
+
const ctx = React6.useContext(TabsContext);
|
|
630
|
+
if (!ctx) {
|
|
631
|
+
throw new Error("Tabs compound components must be used within <Tabs />");
|
|
632
|
+
}
|
|
633
|
+
return ctx;
|
|
634
|
+
};
|
|
635
|
+
var Tabs = React6.forwardRef(
|
|
636
|
+
(_a, ref) => {
|
|
637
|
+
var _b = _a, {
|
|
638
|
+
value: controlledValue,
|
|
639
|
+
defaultValue = "",
|
|
640
|
+
onValueChange,
|
|
641
|
+
variant = "secondary",
|
|
642
|
+
className,
|
|
643
|
+
children
|
|
644
|
+
} = _b, props = __objRest(_b, [
|
|
645
|
+
"value",
|
|
646
|
+
"defaultValue",
|
|
647
|
+
"onValueChange",
|
|
648
|
+
"variant",
|
|
649
|
+
"className",
|
|
650
|
+
"children"
|
|
651
|
+
]);
|
|
652
|
+
const [internal, setInternal] = React6.useState(defaultValue);
|
|
653
|
+
const isControlled = controlledValue !== void 0;
|
|
654
|
+
const activeValue = isControlled ? controlledValue : internal;
|
|
655
|
+
const handleChange = (v) => {
|
|
656
|
+
if (!isControlled) setInternal(v);
|
|
657
|
+
onValueChange == null ? void 0 : onValueChange(v);
|
|
658
|
+
};
|
|
659
|
+
return /* @__PURE__ */ jsx(
|
|
660
|
+
TabsContext.Provider,
|
|
661
|
+
{
|
|
662
|
+
value: {
|
|
663
|
+
value: activeValue,
|
|
664
|
+
onValueChange: handleChange,
|
|
665
|
+
variant
|
|
666
|
+
},
|
|
667
|
+
children: /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ ref, className: twMerge("w-full", className) }, props), { children }))
|
|
668
|
+
}
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
);
|
|
672
|
+
Tabs.displayName = "Tabs";
|
|
673
|
+
var TabsList = React6.forwardRef(
|
|
674
|
+
(_a, ref) => {
|
|
675
|
+
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
676
|
+
const { variant } = useTabs();
|
|
677
|
+
if (variant === "header") {
|
|
678
|
+
return /* @__PURE__ */ jsx(
|
|
679
|
+
"div",
|
|
680
|
+
__spreadProps(__spreadValues({
|
|
681
|
+
ref,
|
|
682
|
+
role: "tablist",
|
|
683
|
+
className: twMerge(
|
|
684
|
+
"relative w-full flex items-center justify-between pt-2",
|
|
685
|
+
className
|
|
686
|
+
),
|
|
687
|
+
style: {
|
|
688
|
+
paddingLeft: "var(--spacing-md, 16px)",
|
|
689
|
+
paddingRight: "var(--spacing-md, 16px)",
|
|
690
|
+
backgroundColor: "var(--color-bg-default, transparent)"
|
|
691
|
+
}
|
|
692
|
+
}, props), {
|
|
693
|
+
children
|
|
694
|
+
})
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
return /* @__PURE__ */ jsx(
|
|
698
|
+
"div",
|
|
699
|
+
__spreadProps(__spreadValues({
|
|
700
|
+
ref,
|
|
701
|
+
role: "tablist",
|
|
702
|
+
className: twMerge(
|
|
703
|
+
"relative w-full flex items-center bg-transparent border-b border-border-default dark:border-border-default-dark",
|
|
704
|
+
variant === "primary" ? "h-[72px] gap-6" : "h-12",
|
|
705
|
+
className
|
|
706
|
+
)
|
|
707
|
+
}, props), {
|
|
708
|
+
children
|
|
709
|
+
})
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
);
|
|
713
|
+
TabsList.displayName = "TabsList";
|
|
714
|
+
var TabsTrigger = React6.forwardRef(
|
|
715
|
+
(_a, ref) => {
|
|
716
|
+
var _b = _a, {
|
|
717
|
+
value,
|
|
718
|
+
className,
|
|
719
|
+
children,
|
|
720
|
+
style
|
|
721
|
+
} = _b, props = __objRest(_b, [
|
|
722
|
+
"value",
|
|
723
|
+
"className",
|
|
724
|
+
"children",
|
|
725
|
+
"style"
|
|
726
|
+
]);
|
|
727
|
+
const { value: activeValue, onValueChange, variant } = useTabs();
|
|
728
|
+
const isActive = activeValue === value;
|
|
729
|
+
const headerStyle = variant === "header" ? __spreadValues({
|
|
730
|
+
color: isActive ? "var(--color-brand-primary)" : "var(--color-text-secondary)"
|
|
731
|
+
}, style) : style;
|
|
732
|
+
return /* @__PURE__ */ jsxs(
|
|
733
|
+
"button",
|
|
734
|
+
__spreadProps(__spreadValues({
|
|
735
|
+
ref,
|
|
736
|
+
role: "tab",
|
|
737
|
+
"aria-selected": isActive,
|
|
738
|
+
onClick: () => onValueChange(value),
|
|
739
|
+
className: twMerge(
|
|
740
|
+
"relative inline-flex flex-col items-center justify-center whitespace-nowrap font-poppins transition-colors cursor-pointer disabled:pointer-events-none disabled:opacity-50 outline-none",
|
|
741
|
+
variant === "header" ? "flex-1 text-sm font-semibold py-3" : variant === "primary" ? "h-[72px] text-base font-medium px-0 pb-3 pt-2 flex-none" : "h-12 text-[12px] font-semibold px-4 flex-none",
|
|
742
|
+
variant !== "header" && (isActive ? "text-brand-primary" : "text-text-secondary dark:text-text-secondary-dark hover:text-text-primary dark:hover:text-text-primary-dark"),
|
|
743
|
+
className
|
|
744
|
+
),
|
|
745
|
+
style: headerStyle
|
|
746
|
+
}, props), {
|
|
747
|
+
children: [
|
|
748
|
+
/* @__PURE__ */ jsx("span", { children }),
|
|
749
|
+
isActive && variant === "header" && /* @__PURE__ */ jsx(
|
|
750
|
+
motion.span,
|
|
751
|
+
{
|
|
752
|
+
layoutId: "header-tab-indicator",
|
|
753
|
+
className: "absolute rounded-t-full",
|
|
754
|
+
style: {
|
|
755
|
+
bottom: 0,
|
|
756
|
+
left: 0,
|
|
757
|
+
right: 0,
|
|
758
|
+
marginLeft: "auto",
|
|
759
|
+
marginRight: "auto",
|
|
760
|
+
width: "3.5rem",
|
|
761
|
+
height: "3px",
|
|
762
|
+
backgroundColor: "var(--color-brand-primary)"
|
|
763
|
+
},
|
|
764
|
+
transition: { type: "spring", bounce: 0.2, duration: 0.6 }
|
|
765
|
+
}
|
|
766
|
+
),
|
|
767
|
+
isActive && variant !== "header" && /* @__PURE__ */ jsx(
|
|
768
|
+
motion.span,
|
|
769
|
+
{
|
|
770
|
+
layoutId: "tab-indicator",
|
|
771
|
+
className: "absolute bottom-0 left-0 right-0 h-0.5 bg-brand-primary z-10",
|
|
772
|
+
transition: { type: "spring", bounce: 0.2, duration: 0.6 }
|
|
773
|
+
}
|
|
774
|
+
)
|
|
775
|
+
]
|
|
776
|
+
})
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
);
|
|
780
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
781
|
+
var TabsContent = React6.forwardRef(
|
|
782
|
+
(_a, ref) => {
|
|
783
|
+
var _b = _a, { value, className, children } = _b, props = __objRest(_b, ["value", "className", "children"]);
|
|
784
|
+
const { value: activeValue, variant } = useTabs();
|
|
785
|
+
if (activeValue !== value) return null;
|
|
786
|
+
return /* @__PURE__ */ jsx(
|
|
787
|
+
"div",
|
|
788
|
+
__spreadProps(__spreadValues({
|
|
789
|
+
ref,
|
|
790
|
+
role: "tabpanel",
|
|
791
|
+
className: twMerge(
|
|
792
|
+
"focus-visible:outline-none",
|
|
793
|
+
variant === "primary" || variant === "header" ? "mt-0" : "mt-6",
|
|
794
|
+
className
|
|
795
|
+
)
|
|
796
|
+
}, props), {
|
|
797
|
+
children
|
|
798
|
+
})
|
|
799
|
+
);
|
|
800
|
+
}
|
|
801
|
+
);
|
|
802
|
+
TabsContent.displayName = "TabsContent";
|
|
803
|
+
var ChevronDownIcon = ({ className }) => /* @__PURE__ */ jsx(
|
|
804
|
+
"svg",
|
|
805
|
+
{
|
|
806
|
+
className,
|
|
807
|
+
viewBox: "0 0 20 20",
|
|
808
|
+
fill: "currentColor",
|
|
809
|
+
"aria-hidden": "true",
|
|
810
|
+
children: /* @__PURE__ */ jsx(
|
|
811
|
+
"path",
|
|
812
|
+
{
|
|
813
|
+
fillRule: "evenodd",
|
|
814
|
+
d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",
|
|
815
|
+
clipRule: "evenodd"
|
|
816
|
+
}
|
|
817
|
+
)
|
|
818
|
+
}
|
|
819
|
+
);
|
|
820
|
+
var Select = ({
|
|
821
|
+
value,
|
|
822
|
+
onValueChange,
|
|
823
|
+
disabled = false,
|
|
824
|
+
children,
|
|
825
|
+
className
|
|
826
|
+
}) => {
|
|
827
|
+
const [isOpen, setIsOpen] = React6.useState(false);
|
|
828
|
+
const [highlightedIndex, setHighlightedIndex] = React6.useState(-1);
|
|
829
|
+
const containerRef = React6.useRef(null);
|
|
830
|
+
const handleToggle = React6.useCallback(() => {
|
|
831
|
+
if (!disabled) {
|
|
832
|
+
setIsOpen((prev) => !prev);
|
|
833
|
+
if (!isOpen) setHighlightedIndex(0);
|
|
834
|
+
}
|
|
835
|
+
}, [disabled, isOpen]);
|
|
836
|
+
const handleSelect = React6.useCallback(
|
|
837
|
+
(newValue) => {
|
|
838
|
+
onValueChange(newValue);
|
|
839
|
+
setIsOpen(false);
|
|
840
|
+
setHighlightedIndex(-1);
|
|
841
|
+
},
|
|
842
|
+
[onValueChange]
|
|
843
|
+
);
|
|
844
|
+
React6.useEffect(() => {
|
|
845
|
+
const handleClickOutside = (event) => {
|
|
846
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
847
|
+
setIsOpen(false);
|
|
848
|
+
setHighlightedIndex(-1);
|
|
849
|
+
}
|
|
850
|
+
};
|
|
851
|
+
if (isOpen) {
|
|
852
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
853
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
854
|
+
}
|
|
855
|
+
}, [isOpen]);
|
|
856
|
+
React6.useEffect(() => {
|
|
857
|
+
const handleEscape = (event) => {
|
|
858
|
+
if (event.key === "Escape" && isOpen) {
|
|
859
|
+
setIsOpen(false);
|
|
860
|
+
setHighlightedIndex(-1);
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
document.addEventListener("keydown", handleEscape);
|
|
864
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
865
|
+
}, [isOpen]);
|
|
866
|
+
const enhancedChildren = React6.Children.map(children, (child) => {
|
|
867
|
+
if (!React6.isValidElement(child)) return child;
|
|
868
|
+
if (child.type === SelectTrigger) {
|
|
869
|
+
return React6.cloneElement(child, {
|
|
870
|
+
_isOpen: isOpen,
|
|
871
|
+
_disabled: disabled,
|
|
872
|
+
_onToggle: handleToggle
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
if (child.type === SelectContent) {
|
|
876
|
+
return React6.cloneElement(child, {
|
|
877
|
+
_isOpen: isOpen,
|
|
878
|
+
_value: value,
|
|
879
|
+
_onSelect: handleSelect,
|
|
880
|
+
_highlightedIndex: highlightedIndex,
|
|
881
|
+
_setHighlightedIndex: setHighlightedIndex
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
return child;
|
|
885
|
+
});
|
|
886
|
+
return /* @__PURE__ */ jsx("div", { ref: containerRef, className: twMerge("relative", className), children: enhancedChildren });
|
|
887
|
+
};
|
|
888
|
+
Select.displayName = "Select";
|
|
889
|
+
var SelectTrigger = React6.forwardRef(
|
|
890
|
+
({
|
|
891
|
+
placeholder = "Select...",
|
|
892
|
+
className,
|
|
893
|
+
children,
|
|
894
|
+
_isOpen,
|
|
895
|
+
_disabled,
|
|
896
|
+
_onToggle
|
|
897
|
+
}, ref) => {
|
|
898
|
+
const hasChildren = React6.Children.count(children) > 0;
|
|
899
|
+
return /* @__PURE__ */ jsxs(
|
|
900
|
+
"button",
|
|
901
|
+
{
|
|
902
|
+
ref,
|
|
903
|
+
type: "button",
|
|
904
|
+
onClick: _onToggle,
|
|
905
|
+
disabled: _disabled,
|
|
906
|
+
"aria-haspopup": "listbox",
|
|
907
|
+
"aria-expanded": _isOpen,
|
|
908
|
+
className: twMerge(
|
|
909
|
+
"w-full flex items-center justify-between gap-2",
|
|
910
|
+
"bg-[var(--color-bg-subtle,#1a1a1a)] border border-[var(--color-border-default,#333)] rounded px-3 py-1.5",
|
|
911
|
+
"text-sm text-[var(--color-text-primary,#fff)] text-left",
|
|
912
|
+
"transition-colors cursor-pointer",
|
|
913
|
+
"hover:border-[var(--color-border-strong,#555)]",
|
|
914
|
+
"focus:outline-none focus:ring-2 focus:ring-[var(--color-brand-primary,#7C3AED)]/50 focus:border-[var(--color-brand-primary,#7C3AED)]",
|
|
915
|
+
_disabled && "opacity-50 cursor-not-allowed",
|
|
916
|
+
className
|
|
917
|
+
),
|
|
918
|
+
children: [
|
|
919
|
+
/* @__PURE__ */ jsx(
|
|
920
|
+
"span",
|
|
921
|
+
{
|
|
922
|
+
className: !hasChildren ? "text-[var(--color-text-tertiary,#888)]" : void 0,
|
|
923
|
+
children: hasChildren ? children : placeholder
|
|
924
|
+
}
|
|
925
|
+
),
|
|
926
|
+
/* @__PURE__ */ jsx(
|
|
927
|
+
ChevronDownIcon,
|
|
928
|
+
{
|
|
929
|
+
className: twMerge(
|
|
930
|
+
"w-4 h-4 text-[var(--color-text-secondary,#999)] transition-transform",
|
|
931
|
+
_isOpen && "rotate-180"
|
|
932
|
+
)
|
|
933
|
+
}
|
|
934
|
+
)
|
|
935
|
+
]
|
|
936
|
+
}
|
|
937
|
+
);
|
|
938
|
+
}
|
|
939
|
+
);
|
|
940
|
+
SelectTrigger.displayName = "SelectTrigger";
|
|
941
|
+
var SelectContent = React6.forwardRef(
|
|
942
|
+
({
|
|
943
|
+
className,
|
|
944
|
+
children,
|
|
945
|
+
_isOpen,
|
|
946
|
+
_value,
|
|
947
|
+
_onSelect,
|
|
948
|
+
_highlightedIndex,
|
|
949
|
+
_setHighlightedIndex
|
|
950
|
+
}, ref) => {
|
|
951
|
+
const listRef = React6.useRef(null);
|
|
952
|
+
const mergedRef = React6.useCallback(
|
|
953
|
+
(node) => {
|
|
954
|
+
if (typeof ref === "function") {
|
|
955
|
+
ref(node);
|
|
956
|
+
} else if (ref) {
|
|
957
|
+
ref.current = node;
|
|
958
|
+
}
|
|
959
|
+
listRef.current = node;
|
|
960
|
+
},
|
|
961
|
+
[ref]
|
|
962
|
+
);
|
|
963
|
+
React6.useEffect(() => {
|
|
964
|
+
if (_isOpen && _highlightedIndex !== void 0 && _highlightedIndex >= 0 && listRef.current) {
|
|
965
|
+
const highlightedElement = listRef.current.children[_highlightedIndex];
|
|
966
|
+
if (highlightedElement) {
|
|
967
|
+
highlightedElement.scrollIntoView({ block: "nearest" });
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
}, [_isOpen, _highlightedIndex]);
|
|
971
|
+
let itemIndex = 0;
|
|
972
|
+
const enhancedChildren = React6.Children.map(children, (child) => {
|
|
973
|
+
if (!React6.isValidElement(child)) return child;
|
|
974
|
+
if (child.type === SelectItem) {
|
|
975
|
+
const currentIndex = itemIndex++;
|
|
976
|
+
const itemProps = child.props;
|
|
977
|
+
return React6.cloneElement(child, {
|
|
978
|
+
_index: currentIndex,
|
|
979
|
+
_isSelected: _value === itemProps.value,
|
|
980
|
+
_isHighlighted: _highlightedIndex === currentIndex,
|
|
981
|
+
_onSelect,
|
|
982
|
+
_onHighlight: _setHighlightedIndex
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
return child;
|
|
986
|
+
});
|
|
987
|
+
const contentVariants = {
|
|
988
|
+
hidden: { opacity: 0, y: -8 },
|
|
989
|
+
visible: {
|
|
990
|
+
opacity: 1,
|
|
991
|
+
y: 0,
|
|
992
|
+
transition: { type: "spring", damping: 25, stiffness: 400 }
|
|
993
|
+
},
|
|
994
|
+
exit: { opacity: 0, y: -8, transition: { duration: 0.1 } }
|
|
995
|
+
};
|
|
996
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: _isOpen && /* @__PURE__ */ jsx(
|
|
997
|
+
motion.ul,
|
|
998
|
+
{
|
|
999
|
+
ref: mergedRef,
|
|
1000
|
+
role: "listbox",
|
|
1001
|
+
variants: contentVariants,
|
|
1002
|
+
initial: "hidden",
|
|
1003
|
+
animate: "visible",
|
|
1004
|
+
exit: "exit",
|
|
1005
|
+
className: twMerge(
|
|
1006
|
+
"absolute z-50 w-full mt-1",
|
|
1007
|
+
"bg-[var(--color-bg-raised,#1f1f1f)] border border-[var(--color-border-default,#333)] rounded shadow-lg",
|
|
1008
|
+
"max-h-60 overflow-auto",
|
|
1009
|
+
"py-1",
|
|
1010
|
+
className
|
|
1011
|
+
),
|
|
1012
|
+
children: enhancedChildren
|
|
1013
|
+
}
|
|
1014
|
+
) });
|
|
1015
|
+
}
|
|
1016
|
+
);
|
|
1017
|
+
SelectContent.displayName = "SelectContent";
|
|
1018
|
+
var SelectItem = React6.forwardRef(
|
|
1019
|
+
({
|
|
1020
|
+
value,
|
|
1021
|
+
disabled = false,
|
|
1022
|
+
className,
|
|
1023
|
+
children,
|
|
1024
|
+
_index,
|
|
1025
|
+
_isSelected,
|
|
1026
|
+
_isHighlighted,
|
|
1027
|
+
_onSelect,
|
|
1028
|
+
_onHighlight
|
|
1029
|
+
}, ref) => {
|
|
1030
|
+
const handleClick = () => {
|
|
1031
|
+
if (!disabled && _onSelect) {
|
|
1032
|
+
_onSelect(value);
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
const handleMouseEnter = () => {
|
|
1036
|
+
if (!disabled && _onHighlight && _index !== void 0) {
|
|
1037
|
+
_onHighlight(_index);
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
return /* @__PURE__ */ jsx(
|
|
1041
|
+
"li",
|
|
1042
|
+
{
|
|
1043
|
+
ref,
|
|
1044
|
+
role: "option",
|
|
1045
|
+
"aria-selected": _isSelected,
|
|
1046
|
+
"aria-disabled": disabled,
|
|
1047
|
+
onClick: handleClick,
|
|
1048
|
+
onMouseEnter: handleMouseEnter,
|
|
1049
|
+
className: twMerge(
|
|
1050
|
+
"px-3 py-2 text-sm cursor-pointer transition-colors",
|
|
1051
|
+
"text-[var(--color-text-primary,#fff)]",
|
|
1052
|
+
_isSelected && "text-[var(--color-text-highlight,#7C3AED)]",
|
|
1053
|
+
_isHighlighted && "bg-[var(--color-bg-muted,#2a2a2a)]",
|
|
1054
|
+
disabled && "opacity-50 cursor-not-allowed",
|
|
1055
|
+
className
|
|
1056
|
+
),
|
|
1057
|
+
children
|
|
1058
|
+
}
|
|
1059
|
+
);
|
|
1060
|
+
}
|
|
1061
|
+
);
|
|
1062
|
+
SelectItem.displayName = "SelectItem";
|
|
1063
|
+
var Skeleton = (_a) => {
|
|
1064
|
+
var _b = _a, {
|
|
1065
|
+
width = "100%",
|
|
1066
|
+
height = "1rem",
|
|
1067
|
+
variant = "text",
|
|
1068
|
+
shimmer = true,
|
|
1069
|
+
className,
|
|
1070
|
+
style
|
|
1071
|
+
} = _b, props = __objRest(_b, [
|
|
1072
|
+
"width",
|
|
1073
|
+
"height",
|
|
1074
|
+
"variant",
|
|
1075
|
+
"shimmer",
|
|
1076
|
+
"className",
|
|
1077
|
+
"style"
|
|
1078
|
+
]);
|
|
1079
|
+
const defaultGradient = "linear-gradient(25deg, #2C2C2C 0%, #2C2C2C 60%, #121212 100%)";
|
|
1080
|
+
return /* @__PURE__ */ jsx(
|
|
1081
|
+
"div",
|
|
1082
|
+
__spreadProps(__spreadValues({
|
|
1083
|
+
className: twMerge(
|
|
1084
|
+
"relative overflow-hidden animate-fade-in",
|
|
1085
|
+
variant === "circle" ? "rounded-full" : "rounded",
|
|
1086
|
+
className
|
|
1087
|
+
),
|
|
1088
|
+
style: __spreadValues({
|
|
1089
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
1090
|
+
height: typeof height === "number" ? `${height}px` : height,
|
|
1091
|
+
background: defaultGradient
|
|
1092
|
+
}, style)
|
|
1093
|
+
}, props), {
|
|
1094
|
+
children: shimmer && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 animate-shimmer bg-gradient-to-r from-transparent via-white/20 to-transparent dark:via-gray-600/30" })
|
|
1095
|
+
})
|
|
1096
|
+
);
|
|
1097
|
+
};
|
|
1098
|
+
Skeleton.displayName = "Skeleton";
|
|
1099
|
+
var variantConfig = {
|
|
1100
|
+
info: { color: "#1890FF", icon: MdInfoOutline },
|
|
1101
|
+
warning: { color: "#F6A700", icon: MdWarningAmber },
|
|
1102
|
+
error: { color: "#FF4D4F", icon: MdErrorOutline },
|
|
1103
|
+
success: { color: "#2BA176", icon: MdCheckCircleOutline }
|
|
1104
|
+
};
|
|
1105
|
+
var positionStyles = {
|
|
1106
|
+
"top-right": "top-4 right-4",
|
|
1107
|
+
"top-left": "top-4 left-4",
|
|
1108
|
+
"top-center": "top-4 left-1/2 -translate-x-1/2",
|
|
1109
|
+
"bottom-right": "bottom-4 right-4",
|
|
1110
|
+
"bottom-left": "bottom-4 left-4",
|
|
1111
|
+
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2"
|
|
1112
|
+
};
|
|
1113
|
+
var BannerNotification = (_a) => {
|
|
1114
|
+
var _b = _a, {
|
|
1115
|
+
type = "inline",
|
|
1116
|
+
variant = "info",
|
|
1117
|
+
title,
|
|
1118
|
+
message,
|
|
1119
|
+
position = "top-right",
|
|
1120
|
+
autoHideDuration = 5e3,
|
|
1121
|
+
show = true,
|
|
1122
|
+
onClose,
|
|
1123
|
+
className
|
|
1124
|
+
} = _b, props = __objRest(_b, [
|
|
1125
|
+
"type",
|
|
1126
|
+
"variant",
|
|
1127
|
+
"title",
|
|
1128
|
+
"message",
|
|
1129
|
+
"position",
|
|
1130
|
+
"autoHideDuration",
|
|
1131
|
+
"show",
|
|
1132
|
+
"onClose",
|
|
1133
|
+
"className"
|
|
1134
|
+
]);
|
|
1135
|
+
const [isExiting, setIsExiting] = React6.useState(false);
|
|
1136
|
+
const timerRef = React6.useRef(null);
|
|
1137
|
+
const config = variantConfig[variant];
|
|
1138
|
+
const IconComponent = config.icon;
|
|
1139
|
+
const handleClose = () => {
|
|
1140
|
+
setIsExiting(true);
|
|
1141
|
+
setTimeout(() => {
|
|
1142
|
+
if (timerRef.current) {
|
|
1143
|
+
clearTimeout(timerRef.current);
|
|
1144
|
+
timerRef.current = null;
|
|
1145
|
+
}
|
|
1146
|
+
onClose == null ? void 0 : onClose();
|
|
1147
|
+
}, 300);
|
|
1148
|
+
};
|
|
1149
|
+
if (type === "toast" && show && autoHideDuration > 0 && !timerRef.current && !isExiting) {
|
|
1150
|
+
timerRef.current = setTimeout(() => {
|
|
1151
|
+
handleClose();
|
|
1152
|
+
}, autoHideDuration);
|
|
1153
|
+
}
|
|
1154
|
+
React6.useEffect(() => {
|
|
1155
|
+
return () => {
|
|
1156
|
+
if (timerRef.current) {
|
|
1157
|
+
clearTimeout(timerRef.current);
|
|
1158
|
+
timerRef.current = null;
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
}, []);
|
|
1162
|
+
if (!show) return null;
|
|
1163
|
+
const backgroundColor = type === "inline" ? `${config.color}33` : config.color;
|
|
1164
|
+
return /* @__PURE__ */ jsxs(
|
|
1165
|
+
"div",
|
|
1166
|
+
__spreadProps(__spreadValues({
|
|
1167
|
+
className: twMerge(
|
|
1168
|
+
"flex items-start gap-3 p-3 rounded border transition-all duration-300",
|
|
1169
|
+
isExiting && "opacity-0 -translate-y-2",
|
|
1170
|
+
className,
|
|
1171
|
+
type === "toast" && "fixed z-50 w-[clamp(18rem,40vw,30rem)] shadow-lg",
|
|
1172
|
+
type === "toast" && positionStyles[position]
|
|
1173
|
+
),
|
|
1174
|
+
style: {
|
|
1175
|
+
backgroundColor,
|
|
1176
|
+
borderColor: config.color
|
|
1177
|
+
},
|
|
1178
|
+
role: "alert"
|
|
1179
|
+
}, props), {
|
|
1180
|
+
children: [
|
|
1181
|
+
/* @__PURE__ */ jsx("div", { className: "flex-shrink-0 text-2xl", children: /* @__PURE__ */ jsx(IconComponent, {}) }),
|
|
1182
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
1183
|
+
title && /* @__PURE__ */ jsx("div", { className: "font-semibold text-sm mb-1", children: title }),
|
|
1184
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm", children: message })
|
|
1185
|
+
] }),
|
|
1186
|
+
/* @__PURE__ */ jsx(
|
|
1187
|
+
"button",
|
|
1188
|
+
{
|
|
1189
|
+
onClick: handleClose,
|
|
1190
|
+
className: "flex-shrink-0 text-xl transition-opacity hover:opacity-70 cursor-pointer",
|
|
1191
|
+
"aria-label": "Close notification",
|
|
1192
|
+
children: /* @__PURE__ */ jsx(MdClose, {})
|
|
1193
|
+
}
|
|
1194
|
+
)
|
|
1195
|
+
]
|
|
1196
|
+
})
|
|
1197
|
+
);
|
|
1198
|
+
};
|
|
1199
|
+
BannerNotification.displayName = "BannerNotification";
|
|
1200
|
+
var AddressDisplay = ({
|
|
1201
|
+
address,
|
|
1202
|
+
onCopy,
|
|
1203
|
+
className = "",
|
|
1204
|
+
textClassName = "",
|
|
1205
|
+
showCopyButton = true
|
|
1206
|
+
}) => {
|
|
1207
|
+
const [copied, setCopied] = React6.useState(false);
|
|
1208
|
+
const handleCopy = async () => {
|
|
1209
|
+
try {
|
|
1210
|
+
await navigator.clipboard.writeText(address);
|
|
1211
|
+
setCopied(true);
|
|
1212
|
+
onCopy == null ? void 0 : onCopy(address);
|
|
1213
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
1214
|
+
} catch (err) {
|
|
1215
|
+
console.error("Failed to copy address:", err);
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
return /* @__PURE__ */ jsxs(
|
|
1219
|
+
"div",
|
|
1220
|
+
{
|
|
1221
|
+
className: twMerge(
|
|
1222
|
+
"bg-[#121212] rounded p-3 flex items-center justify-between gap-2 border border-gray-700",
|
|
1223
|
+
className
|
|
1224
|
+
),
|
|
1225
|
+
children: [
|
|
1226
|
+
/* @__PURE__ */ jsx(
|
|
1227
|
+
TextBody_default,
|
|
1228
|
+
{
|
|
1229
|
+
className: twMerge(
|
|
1230
|
+
"block w-full whitespace-nowrap overflow-hidden",
|
|
1231
|
+
textClassName
|
|
1232
|
+
),
|
|
1233
|
+
children: address
|
|
1234
|
+
}
|
|
1235
|
+
),
|
|
1236
|
+
showCopyButton && /* @__PURE__ */ jsx(
|
|
1237
|
+
"button",
|
|
1238
|
+
{
|
|
1239
|
+
onClick: handleCopy,
|
|
1240
|
+
className: "text-gray-400 hover:text-white transition-colors flex-shrink-0 cursor-pointer",
|
|
1241
|
+
"aria-label": "Copy address",
|
|
1242
|
+
children: copied ? /* @__PURE__ */ jsx(
|
|
1243
|
+
"svg",
|
|
1244
|
+
{
|
|
1245
|
+
className: "w-5 h-5 text-green-500",
|
|
1246
|
+
fill: "none",
|
|
1247
|
+
stroke: "currentColor",
|
|
1248
|
+
viewBox: "0 0 24 24",
|
|
1249
|
+
children: /* @__PURE__ */ jsx(
|
|
1250
|
+
"path",
|
|
1251
|
+
{
|
|
1252
|
+
strokeLinecap: "round",
|
|
1253
|
+
strokeLinejoin: "round",
|
|
1254
|
+
strokeWidth: 2,
|
|
1255
|
+
d: "M5 13l4 4L19 7"
|
|
1256
|
+
}
|
|
1257
|
+
)
|
|
1258
|
+
}
|
|
1259
|
+
) : /* @__PURE__ */ jsx(
|
|
1260
|
+
"svg",
|
|
1261
|
+
{
|
|
1262
|
+
className: "w-5 h-5",
|
|
1263
|
+
fill: "none",
|
|
1264
|
+
stroke: "currentColor",
|
|
1265
|
+
viewBox: "0 0 24 24",
|
|
1266
|
+
children: /* @__PURE__ */ jsx(
|
|
1267
|
+
"path",
|
|
1268
|
+
{
|
|
1269
|
+
strokeLinecap: "round",
|
|
1270
|
+
strokeLinejoin: "round",
|
|
1271
|
+
strokeWidth: 2,
|
|
1272
|
+
d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
|
|
1273
|
+
}
|
|
1274
|
+
)
|
|
1275
|
+
}
|
|
1276
|
+
)
|
|
1277
|
+
}
|
|
1278
|
+
)
|
|
1279
|
+
]
|
|
1280
|
+
}
|
|
1281
|
+
);
|
|
1282
|
+
};
|
|
1283
|
+
AddressDisplay.displayName = "AddressDisplay";
|
|
1284
|
+
var SummaryDetails = ({
|
|
1285
|
+
title,
|
|
1286
|
+
items,
|
|
1287
|
+
defaultOpen = false,
|
|
1288
|
+
className = "",
|
|
1289
|
+
summaryClassName = "",
|
|
1290
|
+
contentClassName = "",
|
|
1291
|
+
showDividers = true
|
|
1292
|
+
}) => {
|
|
1293
|
+
return /* @__PURE__ */ jsxs(
|
|
1294
|
+
"details",
|
|
1295
|
+
{
|
|
1296
|
+
className: twMerge("bg-[#1A1A1A] rounded p-4 group", className),
|
|
1297
|
+
open: defaultOpen,
|
|
1298
|
+
children: [
|
|
1299
|
+
/* @__PURE__ */ jsx("summary", { className: twMerge("cursor-pointer block ", summaryClassName), children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1300
|
+
/* @__PURE__ */ jsx(TextBody_default, { className: "text-white font-medium", children: title }),
|
|
1301
|
+
/* @__PURE__ */ jsx(
|
|
1302
|
+
"svg",
|
|
1303
|
+
{
|
|
1304
|
+
className: "w-5 h-5 text-gray-400 transition-transform duration-300 group-open:rotate-180",
|
|
1305
|
+
fill: "none",
|
|
1306
|
+
stroke: "currentColor",
|
|
1307
|
+
viewBox: "0 0 24 24",
|
|
1308
|
+
"aria-hidden": "true",
|
|
1309
|
+
children: /* @__PURE__ */ jsx(
|
|
1310
|
+
"path",
|
|
1311
|
+
{
|
|
1312
|
+
strokeLinecap: "round",
|
|
1313
|
+
strokeLinejoin: "round",
|
|
1314
|
+
strokeWidth: 2,
|
|
1315
|
+
d: "M5 9l7 7 7-7"
|
|
1316
|
+
}
|
|
1317
|
+
)
|
|
1318
|
+
}
|
|
1319
|
+
)
|
|
1320
|
+
] }) }),
|
|
1321
|
+
/* @__PURE__ */ jsx(
|
|
1322
|
+
"div",
|
|
1323
|
+
{
|
|
1324
|
+
className: twMerge(
|
|
1325
|
+
"mt-4",
|
|
1326
|
+
showDividers && "divide-y divide-[#2A2A2A]",
|
|
1327
|
+
contentClassName
|
|
1328
|
+
),
|
|
1329
|
+
children: items.map((item, index) => /* @__PURE__ */ jsxs("div", { className: "flex justify-between py-2", children: [
|
|
1330
|
+
/* @__PURE__ */ jsx(
|
|
1331
|
+
TextBody_default,
|
|
1332
|
+
{
|
|
1333
|
+
variant: "text-small",
|
|
1334
|
+
className: twMerge("text-text-tertiary dark:text-text-tertiary-dark", item.labelClassName),
|
|
1335
|
+
children: item.label
|
|
1336
|
+
}
|
|
1337
|
+
),
|
|
1338
|
+
typeof item.value === "string" ? /* @__PURE__ */ jsx(
|
|
1339
|
+
TextBody_default,
|
|
1340
|
+
{
|
|
1341
|
+
variant: "text-small",
|
|
1342
|
+
className: twMerge("text-text-primary dark:text-text-primary-dark font-medium", item.valueClassName),
|
|
1343
|
+
children: item.value
|
|
1344
|
+
}
|
|
1345
|
+
) : /* @__PURE__ */ jsx("div", { className: item.valueClassName, children: item.value })
|
|
1346
|
+
] }, index))
|
|
1347
|
+
}
|
|
1348
|
+
)
|
|
1349
|
+
]
|
|
1350
|
+
}
|
|
1351
|
+
);
|
|
1352
|
+
};
|
|
1353
|
+
var ActionSheet = ({
|
|
1354
|
+
id,
|
|
1355
|
+
currentActionSheetId,
|
|
1356
|
+
isOpen,
|
|
1357
|
+
onClose,
|
|
1358
|
+
children,
|
|
1359
|
+
className = "",
|
|
1360
|
+
contentClassName = "",
|
|
1361
|
+
position = "bottom",
|
|
1362
|
+
height = "auto",
|
|
1363
|
+
closeOnBackdropClick = true
|
|
1364
|
+
}) => {
|
|
1365
|
+
const isThisSheetActive = isOpen && currentActionSheetId === id;
|
|
1366
|
+
React6.useEffect(() => {
|
|
1367
|
+
if (isThisSheetActive) {
|
|
1368
|
+
document.body.style.overflow = "hidden";
|
|
1369
|
+
} else {
|
|
1370
|
+
document.body.style.overflow = "";
|
|
1371
|
+
}
|
|
1372
|
+
return () => {
|
|
1373
|
+
document.body.style.overflow = "";
|
|
1374
|
+
};
|
|
1375
|
+
}, [isThisSheetActive]);
|
|
1376
|
+
React6.useEffect(() => {
|
|
1377
|
+
if (!isThisSheetActive) return;
|
|
1378
|
+
const handleEscape = (e) => {
|
|
1379
|
+
if (e.key === "Escape") {
|
|
1380
|
+
onClose();
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
document.addEventListener("keydown", handleEscape);
|
|
1384
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
1385
|
+
}, [isThisSheetActive, onClose]);
|
|
1386
|
+
const handleBackdropClick = (e) => {
|
|
1387
|
+
if (closeOnBackdropClick && e.target === e.currentTarget) {
|
|
1388
|
+
onClose();
|
|
1389
|
+
}
|
|
1390
|
+
};
|
|
1391
|
+
const backdropVariants = {
|
|
1392
|
+
hidden: { opacity: 0 },
|
|
1393
|
+
visible: { opacity: 1 },
|
|
1394
|
+
exit: { opacity: 0 }
|
|
1395
|
+
};
|
|
1396
|
+
const sheetVariants = {
|
|
1397
|
+
hidden: position === "bottom" ? { y: "100%" } : { opacity: 0, scale: 0.95 },
|
|
1398
|
+
visible: position === "bottom" ? {
|
|
1399
|
+
y: "0%",
|
|
1400
|
+
transition: {
|
|
1401
|
+
type: "spring",
|
|
1402
|
+
damping: 25,
|
|
1403
|
+
stiffness: 300
|
|
1404
|
+
}
|
|
1405
|
+
} : {
|
|
1406
|
+
opacity: 1,
|
|
1407
|
+
scale: 1,
|
|
1408
|
+
transition: {
|
|
1409
|
+
type: "spring",
|
|
1410
|
+
damping: 25,
|
|
1411
|
+
stiffness: 300
|
|
1412
|
+
}
|
|
1413
|
+
},
|
|
1414
|
+
exit: position === "bottom" ? {
|
|
1415
|
+
y: "100%",
|
|
1416
|
+
transition: {
|
|
1417
|
+
type: "spring",
|
|
1418
|
+
damping: 25,
|
|
1419
|
+
stiffness: 300
|
|
1420
|
+
}
|
|
1421
|
+
} : {
|
|
1422
|
+
opacity: 0,
|
|
1423
|
+
scale: 0.95,
|
|
1424
|
+
transition: {
|
|
1425
|
+
type: "spring",
|
|
1426
|
+
damping: 25,
|
|
1427
|
+
stiffness: 300
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1431
|
+
const getHeightClass = () => {
|
|
1432
|
+
switch (height) {
|
|
1433
|
+
case "full":
|
|
1434
|
+
return "h-full";
|
|
1435
|
+
case "half":
|
|
1436
|
+
return "h-[50vh]";
|
|
1437
|
+
case "auto":
|
|
1438
|
+
default:
|
|
1439
|
+
return "h-auto";
|
|
1440
|
+
}
|
|
1441
|
+
};
|
|
1442
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isThisSheetActive && /* @__PURE__ */ jsxs(
|
|
1443
|
+
motion.div,
|
|
1444
|
+
{
|
|
1445
|
+
className: twMerge(
|
|
1446
|
+
"fixed inset-0 z-50 flex justify-center",
|
|
1447
|
+
position === "bottom" ? "items-end" : "items-center",
|
|
1448
|
+
className
|
|
1449
|
+
),
|
|
1450
|
+
role: "dialog",
|
|
1451
|
+
"aria-modal": "true",
|
|
1452
|
+
onClick: handleBackdropClick,
|
|
1453
|
+
variants: backdropVariants,
|
|
1454
|
+
initial: "hidden",
|
|
1455
|
+
animate: "visible",
|
|
1456
|
+
exit: "exit",
|
|
1457
|
+
transition: { duration: 0.2 },
|
|
1458
|
+
children: [
|
|
1459
|
+
/* @__PURE__ */ jsx(
|
|
1460
|
+
"div",
|
|
1461
|
+
{
|
|
1462
|
+
className: "absolute inset-0 bg-black/50 backdrop-blur-sm",
|
|
1463
|
+
"aria-hidden": "true"
|
|
1464
|
+
}
|
|
1465
|
+
),
|
|
1466
|
+
/* @__PURE__ */ jsx(
|
|
1467
|
+
motion.div,
|
|
1468
|
+
{
|
|
1469
|
+
className: twMerge(
|
|
1470
|
+
"relative w-full bg-[var(--sheet-bg,#0A0A0A)] shadow-2xl overflow-hidden",
|
|
1471
|
+
position === "bottom" ? "max-w-full rounded-t-[32px]" : "max-w-lg rounded-2xl mx-4",
|
|
1472
|
+
getHeightClass(),
|
|
1473
|
+
contentClassName
|
|
1474
|
+
),
|
|
1475
|
+
variants: sheetVariants,
|
|
1476
|
+
initial: "hidden",
|
|
1477
|
+
animate: "visible",
|
|
1478
|
+
exit: "exit",
|
|
1479
|
+
children
|
|
1480
|
+
}
|
|
1481
|
+
)
|
|
1482
|
+
]
|
|
1483
|
+
}
|
|
1484
|
+
) });
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1487
|
+
// src/stories/providers/types.ts
|
|
1488
|
+
var defaultThemeColors = {
|
|
1489
|
+
// Brand
|
|
1490
|
+
brandPrimary: "#405EFF",
|
|
1491
|
+
brandSecondary: "#A9ABF7",
|
|
1492
|
+
// Backgrounds
|
|
1493
|
+
bgDefault: "#FFFFFF",
|
|
1494
|
+
bgSubtle: "#F8F9FA",
|
|
1495
|
+
bgMuted: "#E3E4E8",
|
|
1496
|
+
// Text
|
|
1497
|
+
textPrimary: "#252050",
|
|
1498
|
+
textSecondary: "#5C5F66",
|
|
1499
|
+
textDisabled: "#C6C8CC",
|
|
1500
|
+
textInverse: "#FFFFFF",
|
|
1501
|
+
// States
|
|
1502
|
+
stateSuccess: "#2BA176",
|
|
1503
|
+
stateError: "#FF4D4F",
|
|
1504
|
+
stateWarning: "#F6A700"
|
|
1505
|
+
};
|
|
1506
|
+
var darkThemeColors = {
|
|
1507
|
+
// Brand
|
|
1508
|
+
brandPrimary: "#405EFF",
|
|
1509
|
+
brandSecondary: "#A9ABF7",
|
|
1510
|
+
// Backgrounds
|
|
1511
|
+
bgDefault: "#121212",
|
|
1512
|
+
bgSubtle: "#1E1E1E",
|
|
1513
|
+
bgMuted: "#2C2C2C",
|
|
1514
|
+
// Text
|
|
1515
|
+
textPrimary: "#FFFFFF",
|
|
1516
|
+
textSecondary: "#E3E4E8",
|
|
1517
|
+
textDisabled: "#898D95",
|
|
1518
|
+
textInverse: "#252050",
|
|
1519
|
+
// States
|
|
1520
|
+
stateSuccess: "#2BA176",
|
|
1521
|
+
stateError: "#FF4D4F",
|
|
1522
|
+
stateWarning: "#F6A700"
|
|
1523
|
+
};
|
|
1524
|
+
var cryptocontrolThemeColors = {
|
|
1525
|
+
// Brand - green primary for cryptocontrol
|
|
1526
|
+
brandPrimary: "#1FC16B",
|
|
1527
|
+
brandSecondary: "#A9ABF7",
|
|
1528
|
+
// Backgrounds (same as dark)
|
|
1529
|
+
bgDefault: "#121212",
|
|
1530
|
+
bgSubtle: "#1E1E1E",
|
|
1531
|
+
bgMuted: "#2C2C2C",
|
|
1532
|
+
// Text (same as dark)
|
|
1533
|
+
textPrimary: "#FFFFFF",
|
|
1534
|
+
textSecondary: "#E3E4E8",
|
|
1535
|
+
textDisabled: "#898D95",
|
|
1536
|
+
textInverse: "#252050",
|
|
1537
|
+
// States
|
|
1538
|
+
stateSuccess: "#2BA176",
|
|
1539
|
+
stateError: "#FF4D4F",
|
|
1540
|
+
stateWarning: "#F6A700"
|
|
1541
|
+
};
|
|
1542
|
+
function themeToCSS(theme) {
|
|
1543
|
+
if (!(theme == null ? void 0 : theme.colors)) return {};
|
|
1544
|
+
const vars = {};
|
|
1545
|
+
const colors = theme.colors;
|
|
1546
|
+
if (colors.brandPrimary) vars["--deframe-brand-primary"] = colors.brandPrimary;
|
|
1547
|
+
if (colors.brandSecondary) vars["--deframe-brand-secondary"] = colors.brandSecondary;
|
|
1548
|
+
if (colors.bgDefault) vars["--deframe-bg-default"] = colors.bgDefault;
|
|
1549
|
+
if (colors.bgSubtle) vars["--deframe-bg-subtle"] = colors.bgSubtle;
|
|
1550
|
+
if (colors.bgMuted) vars["--deframe-bg-muted"] = colors.bgMuted;
|
|
1551
|
+
if (colors.textPrimary) vars["--deframe-text-primary"] = colors.textPrimary;
|
|
1552
|
+
if (colors.textSecondary) vars["--deframe-text-secondary"] = colors.textSecondary;
|
|
1553
|
+
if (colors.textDisabled) vars["--deframe-text-disabled"] = colors.textDisabled;
|
|
1554
|
+
if (colors.textInverse) vars["--deframe-text-inverse"] = colors.textInverse;
|
|
1555
|
+
if (colors.stateSuccess) vars["--deframe-state-success"] = colors.stateSuccess;
|
|
1556
|
+
if (colors.stateError) vars["--deframe-state-error"] = colors.stateError;
|
|
1557
|
+
if (colors.stateWarning) vars["--deframe-state-warning"] = colors.stateWarning;
|
|
1558
|
+
return vars;
|
|
1559
|
+
}
|
|
1560
|
+
function getSystemColorMode() {
|
|
1561
|
+
if (typeof window === "undefined" || !window.matchMedia) return "light";
|
|
1562
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
1563
|
+
}
|
|
1564
|
+
function resolveThemeConfig(config, systemMode) {
|
|
1565
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1566
|
+
const mode = (config == null ? void 0 : config.mode) === "auto" ? systemMode : (_a = config == null ? void 0 : config.mode) != null ? _a : "light";
|
|
1567
|
+
const preset = (_b = config == null ? void 0 : config.preset) != null ? _b : "default";
|
|
1568
|
+
const providerTheme = preset === "cryptocontrol" ? "cryptocontrol" : mode === "dark" ? "dark" : "light";
|
|
1569
|
+
const overrideColors = mode === "dark" ? (_d = (_c = config == null ? void 0 : config.overrides) == null ? void 0 : _c.dark) == null ? void 0 : _d.colors : (_f = (_e = config == null ? void 0 : config.overrides) == null ? void 0 : _e.light) == null ? void 0 : _f.colors;
|
|
1570
|
+
const customTheme = overrideColors ? { colors: overrideColors } : void 0;
|
|
1571
|
+
return { providerTheme, customTheme };
|
|
1572
|
+
}
|
|
1573
|
+
function DeframeComponentsProvider({
|
|
1574
|
+
theme = "light",
|
|
1575
|
+
themeConfig,
|
|
1576
|
+
customTheme,
|
|
1577
|
+
className,
|
|
1578
|
+
children
|
|
1579
|
+
}) {
|
|
1580
|
+
const [systemMode, setSystemMode] = useState(() => getSystemColorMode());
|
|
1581
|
+
useEffect(() => {
|
|
1582
|
+
var _a;
|
|
1583
|
+
const needsSystem = (themeConfig == null ? void 0 : themeConfig.mode) === "auto";
|
|
1584
|
+
if (!needsSystem || typeof window === "undefined" || !window.matchMedia) return;
|
|
1585
|
+
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1586
|
+
const handler = () => setSystemMode(mq.matches ? "dark" : "light");
|
|
1587
|
+
handler();
|
|
1588
|
+
(_a = mq.addEventListener) == null ? void 0 : _a.call(mq, "change", handler);
|
|
1589
|
+
return () => {
|
|
1590
|
+
var _a2;
|
|
1591
|
+
return (_a2 = mq.removeEventListener) == null ? void 0 : _a2.call(mq, "change", handler);
|
|
1592
|
+
};
|
|
1593
|
+
}, [themeConfig == null ? void 0 : themeConfig.mode]);
|
|
1594
|
+
const resolvedTheme = useMemo(() => {
|
|
1595
|
+
if (themeConfig) {
|
|
1596
|
+
return resolveThemeConfig(themeConfig, systemMode);
|
|
1597
|
+
}
|
|
1598
|
+
return {
|
|
1599
|
+
providerTheme: theme,
|
|
1600
|
+
customTheme
|
|
1601
|
+
};
|
|
1602
|
+
}, [themeConfig, theme, customTheme, systemMode]);
|
|
1603
|
+
const themeClass = resolvedTheme.providerTheme === "light" ? "" : resolvedTheme.providerTheme;
|
|
1604
|
+
const colorScheme = resolvedTheme.providerTheme === "light" ? "light" : "dark";
|
|
1605
|
+
const customCSSVars = themeToCSS(resolvedTheme.customTheme);
|
|
1606
|
+
return /* @__PURE__ */ jsx(
|
|
1607
|
+
"div",
|
|
1608
|
+
{
|
|
1609
|
+
className: twMerge("deframe-widget", themeClass, className),
|
|
1610
|
+
style: __spreadValues({ colorScheme }, customCSSVars),
|
|
1611
|
+
children
|
|
1612
|
+
}
|
|
1613
|
+
);
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
export { ActionButton, ActionSheet, AddressDisplay, BannerNotification, ConnectWalletList, Currency, DeframeComponentsProvider, Currency as Fiat, Input, Link, ListItem, ListItemContent, ListItemLeftSide, ListItemRightSide, PercentageButton, PrimaryButton, SecondaryButton, Select, SelectContent, SelectItem, SelectTrigger, Skeleton, SummaryDetails, Tabs, TabsContent, TabsList, TabsTrigger, TertiaryButton, Text_default as Text, TextAccent_default as TextAccent, TextBody_default as TextBody, TextHeading_default as TextHeading, Title, WalletItem, ConnectWalletList as WalletList, WalletListContainer, cryptocontrolThemeColors, darkThemeColors, defaultThemeColors, themeToCSS };
|
|
1617
|
+
//# sourceMappingURL=index.mjs.map
|
|
1618
|
+
//# sourceMappingURL=index.mjs.map
|