@unifold/ui-react 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +262 -32
- package/dist/index.d.ts +262 -32
- package/dist/index.js +4874 -2487
- package/dist/index.mjs +4961 -2559
- package/dist/styles-base.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { AutoSwapResponse, Wallet, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork } from '@unifold/core';
|
|
3
3
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { VariantProps } from 'class-variance-authority';
|
|
@@ -16,10 +16,12 @@ interface DepositModalProps {
|
|
|
16
16
|
modalTitle?: string;
|
|
17
17
|
destinationTokenSymbol?: string;
|
|
18
18
|
recipientAddress?: string;
|
|
19
|
-
destinationChainType?: "ethereum" | "solana" | "bitcoin";
|
|
19
|
+
destinationChainType?: "ethereum" | "solana" | "bitcoin" | "algorand";
|
|
20
20
|
destinationChainId?: string;
|
|
21
21
|
destinationTokenAddress?: string;
|
|
22
22
|
hideDepositTracker?: boolean;
|
|
23
|
+
/** Input variant for Transfer Crypto view: "single_input" or "double_input" (default) */
|
|
24
|
+
transferInputVariant?: "single_input" | "double_input";
|
|
23
25
|
onDepositSuccess?: (data: {
|
|
24
26
|
message: string;
|
|
25
27
|
transaction?: unknown;
|
|
@@ -32,7 +34,7 @@ interface DepositModalProps {
|
|
|
32
34
|
}) => void;
|
|
33
35
|
theme?: "light" | "dark" | "auto";
|
|
34
36
|
}
|
|
35
|
-
declare function DepositModal({ open, onOpenChange, userId, publishableKey, modalTitle, destinationTokenSymbol, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, hideDepositTracker, onDepositSuccess, onDepositError, theme, }: DepositModalProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function DepositModal({ open, onOpenChange, userId, publishableKey, modalTitle, destinationTokenSymbol, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, hideDepositTracker, transferInputVariant, onDepositSuccess, onDepositError, theme, }: DepositModalProps): react_jsx_runtime.JSX.Element;
|
|
36
38
|
|
|
37
39
|
interface DepositHeaderProps {
|
|
38
40
|
title: string;
|
|
@@ -46,15 +48,14 @@ interface DepositHeaderProps {
|
|
|
46
48
|
}
|
|
47
49
|
declare function DepositHeader({ title, showBack, showClose, onBack, onClose, badge, }: DepositHeaderProps): react_jsx_runtime.JSX.Element;
|
|
48
50
|
|
|
49
|
-
interface
|
|
51
|
+
interface TransferCryptoSingleInputProps {
|
|
50
52
|
userId: string;
|
|
51
53
|
publishableKey: string;
|
|
52
54
|
recipientAddress?: string;
|
|
53
|
-
destinationChainType?: "ethereum" | "solana" | "bitcoin";
|
|
55
|
+
destinationChainType?: "ethereum" | "solana" | "bitcoin" | "algorand";
|
|
54
56
|
destinationChainId?: string;
|
|
55
57
|
destinationTokenAddress?: string;
|
|
56
|
-
|
|
57
|
-
onExecutionsChange?: (executions: any[]) => void;
|
|
58
|
+
onExecutionsChange?: (executions: AutoSwapResponse[]) => void;
|
|
58
59
|
onDepositSuccess?: (data: {
|
|
59
60
|
message: string;
|
|
60
61
|
transaction?: unknown;
|
|
@@ -67,29 +68,15 @@ interface TransferCryptoProps {
|
|
|
67
68
|
}) => void;
|
|
68
69
|
wallets?: Wallet[];
|
|
69
70
|
}
|
|
70
|
-
declare function
|
|
71
|
+
declare function TransferCryptoSingleInput({ userId, publishableKey, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, onExecutionsChange, onDepositSuccess, onDepositError, wallets: externalWallets, }: TransferCryptoSingleInputProps): react_jsx_runtime.JSX.Element;
|
|
71
72
|
|
|
72
|
-
interface
|
|
73
|
+
interface TransferCryptoDoubleInputProps {
|
|
73
74
|
userId: string;
|
|
74
75
|
publishableKey: string;
|
|
75
76
|
recipientAddress?: string;
|
|
77
|
+
destinationChainType?: "ethereum" | "solana" | "bitcoin" | "algorand";
|
|
76
78
|
destinationChainId?: string;
|
|
77
79
|
destinationTokenAddress?: string;
|
|
78
|
-
copyButtonMode?: "compact" | "fullWidth";
|
|
79
|
-
onExecutionsChange?: (executions: any[]) => void;
|
|
80
|
-
}
|
|
81
|
-
declare function TransferCrypto2(props: TransferCrypto2Props): react_jsx_runtime.JSX.Element;
|
|
82
|
-
|
|
83
|
-
type LayoutVariant = "horizontal" | "vertical";
|
|
84
|
-
interface TransferCryptoBaseProps {
|
|
85
|
-
userId: string;
|
|
86
|
-
publishableKey: string;
|
|
87
|
-
recipientAddress?: string;
|
|
88
|
-
destinationChainType?: "ethereum" | "solana" | "bitcoin";
|
|
89
|
-
destinationChainId?: string;
|
|
90
|
-
destinationTokenAddress?: string;
|
|
91
|
-
layoutVariant?: LayoutVariant;
|
|
92
|
-
showDetailedDropdowns?: boolean;
|
|
93
80
|
onExecutionsChange?: (executions: AutoSwapResponse[]) => void;
|
|
94
81
|
onDepositSuccess?: (data: {
|
|
95
82
|
message: string;
|
|
@@ -103,7 +90,7 @@ interface TransferCryptoBaseProps {
|
|
|
103
90
|
}) => void;
|
|
104
91
|
wallets?: Wallet[];
|
|
105
92
|
}
|
|
106
|
-
declare function
|
|
93
|
+
declare function TransferCryptoDoubleInput({ userId, publishableKey, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, onExecutionsChange, onDepositSuccess, onDepositError, wallets: externalWallets, }: TransferCryptoDoubleInputProps): react_jsx_runtime.JSX.Element;
|
|
107
94
|
|
|
108
95
|
interface BuyWithCardProps {
|
|
109
96
|
userId: string;
|
|
@@ -114,7 +101,7 @@ interface BuyWithCardProps {
|
|
|
114
101
|
accentColor?: string;
|
|
115
102
|
destinationTokenSymbol?: string;
|
|
116
103
|
recipientAddress?: string;
|
|
117
|
-
destinationChainType?: "ethereum" | "solana" | "bitcoin";
|
|
104
|
+
destinationChainType?: "ethereum" | "solana" | "bitcoin" | "algorand";
|
|
118
105
|
destinationChainId?: string;
|
|
119
106
|
destinationTokenAddress?: string;
|
|
120
107
|
onDepositSuccess?: (data: {
|
|
@@ -131,7 +118,8 @@ interface BuyWithCardProps {
|
|
|
131
118
|
wallets?: Wallet[];
|
|
132
119
|
assetCdnUrl?: string;
|
|
133
120
|
}
|
|
134
|
-
declare function BuyWithCard({ userId, publishableKey, view: externalView, onViewChange, maxAmountUsd, accentColor,
|
|
121
|
+
declare function BuyWithCard({ userId, publishableKey, view: externalView, onViewChange, maxAmountUsd, accentColor, // Keep prop for backward compatibility but don't use default
|
|
122
|
+
destinationTokenSymbol, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, onDepositSuccess, onDepositError, themeClass, wallets: externalWallets, assetCdnUrl, }: BuyWithCardProps): react_jsx_runtime.JSX.Element;
|
|
135
123
|
|
|
136
124
|
interface CurrencyModalProps {
|
|
137
125
|
open: boolean;
|
|
@@ -231,7 +219,7 @@ declare function CurrencyListSection({ title, currencies, selectedCurrency, onSe
|
|
|
231
219
|
|
|
232
220
|
declare const buttonVariants: (props?: ({
|
|
233
221
|
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
234
|
-
size?: "default" | "
|
|
222
|
+
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
235
223
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
236
224
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
237
225
|
asChild?: boolean;
|
|
@@ -310,15 +298,257 @@ interface AllowedCountryResult {
|
|
|
310
298
|
*/
|
|
311
299
|
declare function useAllowedCountry(publishableKey?: string): AllowedCountryResult;
|
|
312
300
|
|
|
301
|
+
/**
|
|
302
|
+
* Unifold color palette for React (Web)
|
|
303
|
+
* Matches the React Native theme colors
|
|
304
|
+
*/
|
|
305
|
+
declare const defaultColors: {
|
|
306
|
+
light: {
|
|
307
|
+
background: string;
|
|
308
|
+
card: string;
|
|
309
|
+
cardHover: string;
|
|
310
|
+
foreground: string;
|
|
311
|
+
foregroundMuted: string;
|
|
312
|
+
foregroundSubtle: string;
|
|
313
|
+
border: string;
|
|
314
|
+
borderSecondary: string;
|
|
315
|
+
primary: string;
|
|
316
|
+
primaryForeground: string;
|
|
317
|
+
success: string;
|
|
318
|
+
successBackground: string;
|
|
319
|
+
warning: string;
|
|
320
|
+
warningBackground: string;
|
|
321
|
+
error: string;
|
|
322
|
+
errorBackground: string;
|
|
323
|
+
overlay: string;
|
|
324
|
+
};
|
|
325
|
+
dark: {
|
|
326
|
+
background: string;
|
|
327
|
+
card: string;
|
|
328
|
+
cardHover: string;
|
|
329
|
+
foreground: string;
|
|
330
|
+
foregroundMuted: string;
|
|
331
|
+
foregroundSubtle: string;
|
|
332
|
+
border: string;
|
|
333
|
+
borderSecondary: string;
|
|
334
|
+
primary: string;
|
|
335
|
+
primaryForeground: string;
|
|
336
|
+
success: string;
|
|
337
|
+
successBackground: string;
|
|
338
|
+
warning: string;
|
|
339
|
+
warningBackground: string;
|
|
340
|
+
error: string;
|
|
341
|
+
errorBackground: string;
|
|
342
|
+
overlay: string;
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
declare const colors: {
|
|
346
|
+
light: {
|
|
347
|
+
background: string;
|
|
348
|
+
card: string;
|
|
349
|
+
cardHover: string;
|
|
350
|
+
foreground: string;
|
|
351
|
+
foregroundMuted: string;
|
|
352
|
+
foregroundSubtle: string;
|
|
353
|
+
border: string;
|
|
354
|
+
borderSecondary: string;
|
|
355
|
+
primary: string;
|
|
356
|
+
primaryForeground: string;
|
|
357
|
+
success: string;
|
|
358
|
+
successBackground: string;
|
|
359
|
+
warning: string;
|
|
360
|
+
warningBackground: string;
|
|
361
|
+
error: string;
|
|
362
|
+
errorBackground: string;
|
|
363
|
+
overlay: string;
|
|
364
|
+
};
|
|
365
|
+
dark: {
|
|
366
|
+
background: string;
|
|
367
|
+
card: string;
|
|
368
|
+
cardHover: string;
|
|
369
|
+
foreground: string;
|
|
370
|
+
foregroundMuted: string;
|
|
371
|
+
foregroundSubtle: string;
|
|
372
|
+
border: string;
|
|
373
|
+
borderSecondary: string;
|
|
374
|
+
primary: string;
|
|
375
|
+
primaryForeground: string;
|
|
376
|
+
success: string;
|
|
377
|
+
successBackground: string;
|
|
378
|
+
warning: string;
|
|
379
|
+
warningBackground: string;
|
|
380
|
+
error: string;
|
|
381
|
+
errorBackground: string;
|
|
382
|
+
overlay: string;
|
|
383
|
+
};
|
|
384
|
+
};
|
|
385
|
+
type ThemeColors = typeof defaultColors.light;
|
|
386
|
+
type ThemeMode = "light" | "dark";
|
|
387
|
+
/** Partial theme colors for customization */
|
|
388
|
+
type CustomThemeColors = Partial<ThemeColors>;
|
|
389
|
+
/** Theme customization options */
|
|
390
|
+
interface ThemeConfig {
|
|
391
|
+
/** Override colors for light mode */
|
|
392
|
+
light?: CustomThemeColors;
|
|
393
|
+
/** Override colors for dark mode */
|
|
394
|
+
dark?: CustomThemeColors;
|
|
395
|
+
}
|
|
396
|
+
/** Font configuration */
|
|
397
|
+
interface FontConfig {
|
|
398
|
+
/** Regular weight font family */
|
|
399
|
+
regular?: string;
|
|
400
|
+
/** Medium weight font family */
|
|
401
|
+
medium?: string;
|
|
402
|
+
/** Semi-bold weight font family */
|
|
403
|
+
semibold?: string;
|
|
404
|
+
/** Bold weight font family */
|
|
405
|
+
bold?: string;
|
|
406
|
+
}
|
|
407
|
+
/** Header component tokens */
|
|
408
|
+
interface HeaderTokens {
|
|
409
|
+
titleColor: string;
|
|
410
|
+
buttonColor: string;
|
|
411
|
+
}
|
|
412
|
+
/** Card/button component tokens */
|
|
413
|
+
interface CardTokens {
|
|
414
|
+
backgroundColor: string;
|
|
415
|
+
titleColor: string;
|
|
416
|
+
subtitleColor: string;
|
|
417
|
+
labelColor: string;
|
|
418
|
+
headerColor: string;
|
|
419
|
+
labelRightColor: string;
|
|
420
|
+
labelHighlightRightColor: string;
|
|
421
|
+
textRightColor: string;
|
|
422
|
+
subtextRightColor: string;
|
|
423
|
+
rowLeftLabel: string;
|
|
424
|
+
rowRightLabel: string;
|
|
425
|
+
iconColor: string;
|
|
426
|
+
iconBackgroundColor: string;
|
|
427
|
+
actionColor: string;
|
|
428
|
+
actionIcon: string;
|
|
429
|
+
descriptionColor: string;
|
|
430
|
+
}
|
|
431
|
+
/** Input component tokens */
|
|
432
|
+
interface InputTokens {
|
|
433
|
+
backgroundColor: string;
|
|
434
|
+
textColor: string;
|
|
435
|
+
placeholderColor: string;
|
|
436
|
+
borderColor: string;
|
|
437
|
+
}
|
|
438
|
+
/** Button component tokens */
|
|
439
|
+
interface ButtonTokens {
|
|
440
|
+
primaryBackground: string;
|
|
441
|
+
primaryText: string;
|
|
442
|
+
secondaryBackground: string;
|
|
443
|
+
secondaryText: string;
|
|
444
|
+
}
|
|
445
|
+
/** Container/status display component tokens */
|
|
446
|
+
interface ContainerTokens {
|
|
447
|
+
titleColor: string;
|
|
448
|
+
subtitleColor: string;
|
|
449
|
+
actionColor: string;
|
|
450
|
+
actionTitle: string;
|
|
451
|
+
buttonColor: string;
|
|
452
|
+
buttonTitleColor: string;
|
|
453
|
+
iconBackgroundColor: string;
|
|
454
|
+
iconColor: string;
|
|
455
|
+
}
|
|
456
|
+
/** Search component tokens */
|
|
457
|
+
interface SearchTokens {
|
|
458
|
+
backgroundColor: string;
|
|
459
|
+
inputColor: string;
|
|
460
|
+
placeholderColor: string;
|
|
461
|
+
}
|
|
462
|
+
/** List component tokens */
|
|
463
|
+
interface ListTokens {
|
|
464
|
+
titleSectionColor: string;
|
|
465
|
+
}
|
|
466
|
+
/** All resolved component tokens */
|
|
467
|
+
interface ComponentTokens {
|
|
468
|
+
header: HeaderTokens;
|
|
469
|
+
card: CardTokens;
|
|
470
|
+
input: InputTokens;
|
|
471
|
+
button: ButtonTokens;
|
|
472
|
+
container: ContainerTokens;
|
|
473
|
+
search: SearchTokens;
|
|
474
|
+
list: ListTokens;
|
|
475
|
+
}
|
|
476
|
+
/** Per-component overrides structure */
|
|
477
|
+
interface ComponentOverrides {
|
|
478
|
+
header?: Partial<HeaderTokens>;
|
|
479
|
+
card?: Partial<CardTokens>;
|
|
480
|
+
input?: Partial<InputTokens>;
|
|
481
|
+
button?: Partial<ButtonTokens>;
|
|
482
|
+
container?: Partial<ContainerTokens>;
|
|
483
|
+
search?: Partial<SearchTokens>;
|
|
484
|
+
list?: Partial<ListTokens>;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* User-provided component overrides (all optional)
|
|
488
|
+
* Can be flat (applies to both modes) or have light/dark variants
|
|
489
|
+
*/
|
|
490
|
+
interface ComponentConfig extends ComponentOverrides {
|
|
491
|
+
/** Light mode specific overrides */
|
|
492
|
+
light?: ComponentOverrides;
|
|
493
|
+
/** Dark mode specific overrides */
|
|
494
|
+
dark?: ComponentOverrides;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Resolve component tokens from base colors + optional overrides
|
|
498
|
+
*
|
|
499
|
+
* Override priority (highest wins):
|
|
500
|
+
* 1. Mode-specific overrides (config.light or config.dark)
|
|
501
|
+
* 2. Flat overrides (config.header, config.card, etc.)
|
|
502
|
+
* 3. Base color defaults (semantic colors)
|
|
503
|
+
*/
|
|
504
|
+
declare function resolveComponentTokens(baseColors: ThemeColors, overrides?: ComponentConfig, mode?: ThemeMode): ComponentTokens;
|
|
505
|
+
declare function getColors(mode: ThemeMode): ThemeColors;
|
|
506
|
+
/**
|
|
507
|
+
* Merge custom colors with default colors
|
|
508
|
+
*/
|
|
509
|
+
declare function mergeColors(mode: ThemeMode, customColors?: CustomThemeColors, accentColor?: string): ThemeColors;
|
|
510
|
+
|
|
511
|
+
/** Resolved font families for use in styles */
|
|
512
|
+
interface ResolvedFonts {
|
|
513
|
+
regular: string | undefined;
|
|
514
|
+
medium: string | undefined;
|
|
515
|
+
semibold: string | undefined;
|
|
516
|
+
bold: string | undefined;
|
|
517
|
+
}
|
|
313
518
|
interface ThemeContextValue {
|
|
519
|
+
/** Legacy theme class (uf-dark or empty string) for backward compatibility */
|
|
314
520
|
themeClass: string;
|
|
521
|
+
/** Current theme mode */
|
|
522
|
+
mode: ThemeMode;
|
|
523
|
+
/** Resolved theme colors */
|
|
524
|
+
colors: ThemeColors;
|
|
525
|
+
/** Resolved font families */
|
|
526
|
+
fonts: ResolvedFonts;
|
|
527
|
+
/** Component-specific design tokens */
|
|
528
|
+
components: ComponentTokens;
|
|
529
|
+
/** Whether dark mode is active */
|
|
530
|
+
isDark: boolean;
|
|
315
531
|
}
|
|
316
|
-
|
|
532
|
+
interface ThemeProviderProps {
|
|
317
533
|
children: React.ReactNode;
|
|
318
|
-
|
|
319
|
-
|
|
534
|
+
/** Force a specific theme mode, or 'auto' to use system preference */
|
|
535
|
+
mode?: ThemeMode | "auto";
|
|
536
|
+
/** Simple accent/primary color override (applies to both light and dark) */
|
|
537
|
+
accentColor?: string;
|
|
538
|
+
/** Full theme customization per mode */
|
|
539
|
+
theme?: ThemeConfig;
|
|
540
|
+
/** Single font family for all weights */
|
|
541
|
+
fontFamily?: string;
|
|
542
|
+
/** Granular font family configuration */
|
|
543
|
+
fonts?: FontConfig;
|
|
544
|
+
/** Component-specific token overrides (optional, falls back to base colors) */
|
|
545
|
+
components?: ComponentConfig;
|
|
546
|
+
/** Legacy themeClass prop for backward compatibility */
|
|
547
|
+
themeClass?: string;
|
|
548
|
+
}
|
|
549
|
+
declare function ThemeProvider({ children, mode, accentColor, theme, fontFamily, fonts: fontConfig, components: componentConfig, themeClass: legacyThemeClass, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
320
550
|
declare function useTheme(): ThemeContextValue;
|
|
321
551
|
|
|
322
552
|
declare function cn(...inputs: ClassValue[]): string;
|
|
323
553
|
|
|
324
|
-
export { type AllowedCountryResult, Button, type ButtonProps, BuyWithCard, CurrencyListItem, CurrencyListSection, CurrencyModal, DepositDetailContent, DepositExecutionItem, DepositHeader, DepositModal, DepositSuccessToast, DepositTrackerButton, DepositWithCardButton, DepositsModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, StyledQRCode, ThemeProvider, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger,
|
|
554
|
+
export { type AllowedCountryResult, Button, type ButtonProps, type ButtonTokens, BuyWithCard, type CardTokens, type ComponentConfig, type ComponentOverrides, type ComponentTokens, type ContainerTokens, CurrencyListItem, CurrencyListSection, CurrencyModal, type CustomThemeColors, DepositDetailContent, DepositExecutionItem, DepositHeader, DepositModal, DepositSuccessToast, DepositTrackerButton, DepositWithCardButton, DepositsModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, type FontConfig, type HeaderTokens, type InputTokens, type ListTokens, type ResolvedFonts, type SearchTokens, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, StyledQRCode, type ThemeColors, type ThemeConfig, type ThemeMode, ThemeProvider, type ThemeProviderProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransferCryptoButton, TransferCryptoDoubleInput, TransferCryptoSingleInput, buttonVariants, cn, colors, defaultColors, getColors, mergeColors, resolveComponentTokens, useAllowedCountry, useTheme };
|