@unifold/ui-react 0.1.20 → 0.1.22

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Wallet, AutoSwapResponse, FiatCurrency, ExecutionStatus, FeaturedToken, PaymentNetwork } from '@unifold/core';
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,14 @@ 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
+ /** Show balance in deposit modal header. Defaults to false */
24
+ showBalanceHeader?: boolean;
25
+ /** Input variant for Transfer Crypto view: "single_input" or "double_input" (default) */
26
+ transferInputVariant?: "single_input" | "double_input";
23
27
  onDepositSuccess?: (data: {
24
28
  message: string;
25
29
  transaction?: unknown;
@@ -32,7 +36,7 @@ interface DepositModalProps {
32
36
  }) => void;
33
37
  theme?: "light" | "dark" | "auto";
34
38
  }
35
- declare function DepositModal({ open, onOpenChange, userId, publishableKey, modalTitle, destinationTokenSymbol, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, hideDepositTracker, onDepositSuccess, onDepositError, theme, }: DepositModalProps): react_jsx_runtime.JSX.Element;
39
+ declare function DepositModal({ open, onOpenChange, userId, publishableKey, modalTitle, destinationTokenSymbol, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, hideDepositTracker, showBalanceHeader, transferInputVariant, onDepositSuccess, onDepositError, theme, }: DepositModalProps): react_jsx_runtime.JSX.Element;
36
40
 
37
41
  interface DepositHeaderProps {
38
42
  title: string;
@@ -43,18 +47,23 @@ interface DepositHeaderProps {
43
47
  badge?: {
44
48
  count: number;
45
49
  };
50
+ showBalance?: boolean;
51
+ balanceAddress?: string;
52
+ balanceChainType?: "ethereum" | "solana" | "bitcoin";
53
+ balanceChainId?: string;
54
+ balanceTokenAddress?: string;
55
+ publishableKey?: string;
46
56
  }
47
- declare function DepositHeader({ title, showBack, showClose, onBack, onClose, badge, }: DepositHeaderProps): react_jsx_runtime.JSX.Element;
57
+ declare function DepositHeader({ title, showBack, showClose, onBack, onClose, badge, showBalance, balanceAddress, balanceChainType, balanceChainId, balanceTokenAddress, publishableKey, }: DepositHeaderProps): react_jsx_runtime.JSX.Element;
48
58
 
49
- interface TransferCryptoProps {
59
+ interface TransferCryptoSingleInputProps {
50
60
  userId: string;
51
61
  publishableKey: string;
52
62
  recipientAddress?: string;
53
- destinationChainType?: "ethereum" | "solana" | "bitcoin";
63
+ destinationChainType?: "ethereum" | "solana" | "bitcoin" | "algorand";
54
64
  destinationChainId?: string;
55
65
  destinationTokenAddress?: string;
56
- copyButtonMode?: "compact" | "fullWidth";
57
- onExecutionsChange?: (executions: any[]) => void;
66
+ onExecutionsChange?: (executions: AutoSwapResponse[]) => void;
58
67
  onDepositSuccess?: (data: {
59
68
  message: string;
60
69
  transaction?: unknown;
@@ -67,29 +76,15 @@ interface TransferCryptoProps {
67
76
  }) => void;
68
77
  wallets?: Wallet[];
69
78
  }
70
- declare function TransferCrypto(props: TransferCryptoProps): react_jsx_runtime.JSX.Element;
79
+ declare function TransferCryptoSingleInput({ userId, publishableKey, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, onExecutionsChange, onDepositSuccess, onDepositError, wallets: externalWallets, }: TransferCryptoSingleInputProps): react_jsx_runtime.JSX.Element;
71
80
 
72
- interface TransferCrypto2Props {
81
+ interface TransferCryptoDoubleInputProps {
73
82
  userId: string;
74
83
  publishableKey: string;
75
84
  recipientAddress?: string;
85
+ destinationChainType?: "ethereum" | "solana" | "bitcoin" | "algorand";
76
86
  destinationChainId?: string;
77
87
  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
88
  onExecutionsChange?: (executions: AutoSwapResponse[]) => void;
94
89
  onDepositSuccess?: (data: {
95
90
  message: string;
@@ -103,7 +98,7 @@ interface TransferCryptoBaseProps {
103
98
  }) => void;
104
99
  wallets?: Wallet[];
105
100
  }
106
- declare function TransferCryptoBase({ userId, publishableKey, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, layoutVariant, showDetailedDropdowns, onExecutionsChange, onDepositSuccess, onDepositError, wallets: externalWallets, }: TransferCryptoBaseProps): react_jsx_runtime.JSX.Element;
101
+ declare function TransferCryptoDoubleInput({ userId, publishableKey, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, onExecutionsChange, onDepositSuccess, onDepositError, wallets: externalWallets, }: TransferCryptoDoubleInputProps): react_jsx_runtime.JSX.Element;
107
102
 
108
103
  interface BuyWithCardProps {
109
104
  userId: string;
@@ -114,7 +109,7 @@ interface BuyWithCardProps {
114
109
  accentColor?: string;
115
110
  destinationTokenSymbol?: string;
116
111
  recipientAddress?: string;
117
- destinationChainType?: "ethereum" | "solana" | "bitcoin";
112
+ destinationChainType?: "ethereum" | "solana" | "bitcoin" | "algorand";
118
113
  destinationChainId?: string;
119
114
  destinationTokenAddress?: string;
120
115
  onDepositSuccess?: (data: {
@@ -131,7 +126,8 @@ interface BuyWithCardProps {
131
126
  wallets?: Wallet[];
132
127
  assetCdnUrl?: string;
133
128
  }
134
- declare function BuyWithCard({ userId, publishableKey, view: externalView, onViewChange, maxAmountUsd, accentColor, destinationTokenSymbol, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, themeClass, wallets: externalWallets, assetCdnUrl, }: BuyWithCardProps): react_jsx_runtime.JSX.Element;
129
+ declare function BuyWithCard({ userId, publishableKey, view: externalView, onViewChange, maxAmountUsd, accentColor, // Keep prop for backward compatibility but don't use default
130
+ destinationTokenSymbol, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, onDepositSuccess, onDepositError, themeClass, wallets: externalWallets, assetCdnUrl, }: BuyWithCardProps): react_jsx_runtime.JSX.Element;
135
131
 
136
132
  interface CurrencyModalProps {
137
133
  open: boolean;
@@ -231,7 +227,7 @@ declare function CurrencyListSection({ title, currencies, selectedCurrency, onSe
231
227
 
232
228
  declare const buttonVariants: (props?: ({
233
229
  variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
234
- size?: "default" | "sm" | "lg" | "icon" | null | undefined;
230
+ size?: "default" | "icon" | "sm" | "lg" | null | undefined;
235
231
  } & class_variance_authority_types.ClassProp) | undefined) => string;
236
232
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
237
233
  asChild?: boolean;
@@ -310,15 +306,257 @@ interface AllowedCountryResult {
310
306
  */
311
307
  declare function useAllowedCountry(publishableKey?: string): AllowedCountryResult;
312
308
 
309
+ /**
310
+ * Unifold color palette for React (Web)
311
+ * Matches the React Native theme colors
312
+ */
313
+ declare const defaultColors: {
314
+ light: {
315
+ background: string;
316
+ card: string;
317
+ cardHover: string;
318
+ foreground: string;
319
+ foregroundMuted: string;
320
+ foregroundSubtle: string;
321
+ border: string;
322
+ borderSecondary: string;
323
+ primary: string;
324
+ primaryForeground: string;
325
+ success: string;
326
+ successBackground: string;
327
+ warning: string;
328
+ warningBackground: string;
329
+ error: string;
330
+ errorBackground: string;
331
+ overlay: string;
332
+ };
333
+ dark: {
334
+ background: string;
335
+ card: string;
336
+ cardHover: string;
337
+ foreground: string;
338
+ foregroundMuted: string;
339
+ foregroundSubtle: string;
340
+ border: string;
341
+ borderSecondary: string;
342
+ primary: string;
343
+ primaryForeground: string;
344
+ success: string;
345
+ successBackground: string;
346
+ warning: string;
347
+ warningBackground: string;
348
+ error: string;
349
+ errorBackground: string;
350
+ overlay: string;
351
+ };
352
+ };
353
+ declare const colors: {
354
+ light: {
355
+ background: string;
356
+ card: string;
357
+ cardHover: string;
358
+ foreground: string;
359
+ foregroundMuted: string;
360
+ foregroundSubtle: string;
361
+ border: string;
362
+ borderSecondary: string;
363
+ primary: string;
364
+ primaryForeground: string;
365
+ success: string;
366
+ successBackground: string;
367
+ warning: string;
368
+ warningBackground: string;
369
+ error: string;
370
+ errorBackground: string;
371
+ overlay: string;
372
+ };
373
+ dark: {
374
+ background: string;
375
+ card: string;
376
+ cardHover: string;
377
+ foreground: string;
378
+ foregroundMuted: string;
379
+ foregroundSubtle: string;
380
+ border: string;
381
+ borderSecondary: string;
382
+ primary: string;
383
+ primaryForeground: string;
384
+ success: string;
385
+ successBackground: string;
386
+ warning: string;
387
+ warningBackground: string;
388
+ error: string;
389
+ errorBackground: string;
390
+ overlay: string;
391
+ };
392
+ };
393
+ type ThemeColors = typeof defaultColors.light;
394
+ type ThemeMode = "light" | "dark";
395
+ /** Partial theme colors for customization */
396
+ type CustomThemeColors = Partial<ThemeColors>;
397
+ /** Theme customization options */
398
+ interface ThemeConfig {
399
+ /** Override colors for light mode */
400
+ light?: CustomThemeColors;
401
+ /** Override colors for dark mode */
402
+ dark?: CustomThemeColors;
403
+ }
404
+ /** Font configuration */
405
+ interface FontConfig {
406
+ /** Regular weight font family */
407
+ regular?: string;
408
+ /** Medium weight font family */
409
+ medium?: string;
410
+ /** Semi-bold weight font family */
411
+ semibold?: string;
412
+ /** Bold weight font family */
413
+ bold?: string;
414
+ }
415
+ /** Header component tokens */
416
+ interface HeaderTokens {
417
+ titleColor: string;
418
+ buttonColor: string;
419
+ }
420
+ /** Card/button component tokens */
421
+ interface CardTokens {
422
+ backgroundColor: string;
423
+ titleColor: string;
424
+ subtitleColor: string;
425
+ labelColor: string;
426
+ headerColor: string;
427
+ labelRightColor: string;
428
+ labelHighlightRightColor: string;
429
+ textRightColor: string;
430
+ subtextRightColor: string;
431
+ rowLeftLabel: string;
432
+ rowRightLabel: string;
433
+ iconColor: string;
434
+ iconBackgroundColor: string;
435
+ actionColor: string;
436
+ actionIcon: string;
437
+ descriptionColor: string;
438
+ }
439
+ /** Input component tokens */
440
+ interface InputTokens {
441
+ backgroundColor: string;
442
+ textColor: string;
443
+ placeholderColor: string;
444
+ borderColor: string;
445
+ }
446
+ /** Button component tokens */
447
+ interface ButtonTokens {
448
+ primaryBackground: string;
449
+ primaryText: string;
450
+ secondaryBackground: string;
451
+ secondaryText: string;
452
+ }
453
+ /** Container/status display component tokens */
454
+ interface ContainerTokens {
455
+ titleColor: string;
456
+ subtitleColor: string;
457
+ actionColor: string;
458
+ actionTitle: string;
459
+ buttonColor: string;
460
+ buttonTitleColor: string;
461
+ iconBackgroundColor: string;
462
+ iconColor: string;
463
+ }
464
+ /** Search component tokens */
465
+ interface SearchTokens {
466
+ backgroundColor: string;
467
+ inputColor: string;
468
+ placeholderColor: string;
469
+ }
470
+ /** List component tokens */
471
+ interface ListTokens {
472
+ titleSectionColor: string;
473
+ }
474
+ /** All resolved component tokens */
475
+ interface ComponentTokens {
476
+ header: HeaderTokens;
477
+ card: CardTokens;
478
+ input: InputTokens;
479
+ button: ButtonTokens;
480
+ container: ContainerTokens;
481
+ search: SearchTokens;
482
+ list: ListTokens;
483
+ }
484
+ /** Per-component overrides structure */
485
+ interface ComponentOverrides {
486
+ header?: Partial<HeaderTokens>;
487
+ card?: Partial<CardTokens>;
488
+ input?: Partial<InputTokens>;
489
+ button?: Partial<ButtonTokens>;
490
+ container?: Partial<ContainerTokens>;
491
+ search?: Partial<SearchTokens>;
492
+ list?: Partial<ListTokens>;
493
+ }
494
+ /**
495
+ * User-provided component overrides (all optional)
496
+ * Can be flat (applies to both modes) or have light/dark variants
497
+ */
498
+ interface ComponentConfig extends ComponentOverrides {
499
+ /** Light mode specific overrides */
500
+ light?: ComponentOverrides;
501
+ /** Dark mode specific overrides */
502
+ dark?: ComponentOverrides;
503
+ }
504
+ /**
505
+ * Resolve component tokens from base colors + optional overrides
506
+ *
507
+ * Override priority (highest wins):
508
+ * 1. Mode-specific overrides (config.light or config.dark)
509
+ * 2. Flat overrides (config.header, config.card, etc.)
510
+ * 3. Base color defaults (semantic colors)
511
+ */
512
+ declare function resolveComponentTokens(baseColors: ThemeColors, overrides?: ComponentConfig, mode?: ThemeMode): ComponentTokens;
513
+ declare function getColors(mode: ThemeMode): ThemeColors;
514
+ /**
515
+ * Merge custom colors with default colors
516
+ */
517
+ declare function mergeColors(mode: ThemeMode, customColors?: CustomThemeColors, accentColor?: string): ThemeColors;
518
+
519
+ /** Resolved font families for use in styles */
520
+ interface ResolvedFonts {
521
+ regular: string | undefined;
522
+ medium: string | undefined;
523
+ semibold: string | undefined;
524
+ bold: string | undefined;
525
+ }
313
526
  interface ThemeContextValue {
527
+ /** Legacy theme class (uf-dark or empty string) for backward compatibility */
314
528
  themeClass: string;
529
+ /** Current theme mode */
530
+ mode: ThemeMode;
531
+ /** Resolved theme colors */
532
+ colors: ThemeColors;
533
+ /** Resolved font families */
534
+ fonts: ResolvedFonts;
535
+ /** Component-specific design tokens */
536
+ components: ComponentTokens;
537
+ /** Whether dark mode is active */
538
+ isDark: boolean;
315
539
  }
316
- declare function ThemeProvider({ children, themeClass, }: {
540
+ interface ThemeProviderProps {
317
541
  children: React.ReactNode;
318
- themeClass: string;
319
- }): react_jsx_runtime.JSX.Element;
542
+ /** Force a specific theme mode, or 'auto' to use system preference */
543
+ mode?: ThemeMode | "auto";
544
+ /** Simple accent/primary color override (applies to both light and dark) */
545
+ accentColor?: string;
546
+ /** Full theme customization per mode */
547
+ theme?: ThemeConfig;
548
+ /** Single font family for all weights */
549
+ fontFamily?: string;
550
+ /** Granular font family configuration */
551
+ fonts?: FontConfig;
552
+ /** Component-specific token overrides (optional, falls back to base colors) */
553
+ components?: ComponentConfig;
554
+ /** Legacy themeClass prop for backward compatibility */
555
+ themeClass?: string;
556
+ }
557
+ declare function ThemeProvider({ children, mode, accentColor, theme, fontFamily, fonts: fontConfig, components: componentConfig, themeClass: legacyThemeClass, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
320
558
  declare function useTheme(): ThemeContextValue;
321
559
 
322
560
  declare function cn(...inputs: ClassValue[]): string;
323
561
 
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, TransferCrypto, TransferCrypto2, TransferCryptoBase, TransferCryptoButton, buttonVariants, cn, useAllowedCountry, useTheme };
562
+ 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 };