@trustwallet/connect-react 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +76 -0
- package/README.md +567 -0
- package/cli.js +144 -0
- package/dist/global-NUJAOJRO.css +132 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +705 -0
- package/dist/styles.module-27BC6Q35.module.css +7 -0
- package/dist/styles.module-2IXPYHX5.module.css +33 -0
- package/dist/styles.module-4I5UVTXZ.module.css +34 -0
- package/dist/styles.module-4QHLSLTJ.module.css +9 -0
- package/dist/styles.module-5C4YIUDE.module.css +26 -0
- package/dist/styles.module-5FM5SDSC.module.css +8 -0
- package/dist/styles.module-5L4UXGVZ.module.css +62 -0
- package/dist/styles.module-5S7A3MI3.module.css +6 -0
- package/dist/styles.module-5TDOAM3X.module.css +5 -0
- package/dist/styles.module-BH6BB6HX.module.css +23 -0
- package/dist/styles.module-FMH4FUT5.module.css +35 -0
- package/dist/styles.module-GCRMKZIZ.module.css +9 -0
- package/dist/styles.module-GSNHG7ET.module.css +92 -0
- package/dist/styles.module-HR3VQZUH.module.css +44 -0
- package/dist/styles.module-IZSJLNB4.module.css +9 -0
- package/dist/styles.module-JFMC6A5G.module.css +6 -0
- package/dist/styles.module-KIOD6JAJ.module.css +5 -0
- package/dist/styles.module-NDDQJHO2.module.css +21 -0
- package/dist/styles.module-PXUDS327.module.css +7 -0
- package/dist/styles.module-RKS6GYHN.module.css +6 -0
- package/dist/styles.module-U5TRY5PT.module.css +123 -0
- package/dist/styles.module-U6N4VKTA.module.css +72 -0
- package/dist/styles.module-VWMJAIVE.module.css +20 -0
- package/dist/styles.module-WGWNXHEK.module.css +5 -0
- package/dist/styles.module-Y3MUWEOL.module.css +5 -0
- package/dist/styles.module-YJSZIZTZ.module.css +32 -0
- package/dist/styles.module-ZISFY5AO.module.css +15 -0
- package/dist/styles.module-ZPYBUUD6.module.css +8 -0
- package/package.json +53 -0
- package/src/context/index.tsx +25 -0
- package/src/index.ts +9 -0
- package/src/styles/global.css +132 -0
- package/src/types/css-modules.d.ts +4 -0
- package/src/ui/TrustModal.tsx +31 -0
- package/src/ui/buttons/GetTrustButton/components/GetTrustMessage/index.tsx +10 -0
- package/src/ui/buttons/GetTrustButton/components/GetTrustMessage/styles.module.css +7 -0
- package/src/ui/buttons/GetTrustButton/components/GetTrustWrapper/index.tsx +10 -0
- package/src/ui/buttons/GetTrustButton/components/GetTrustWrapper/styles.module.css +5 -0
- package/src/ui/buttons/GetTrustButton/index.tsx +21 -0
- package/src/ui/buttons/NamespaceButton/index.tsx +62 -0
- package/src/ui/buttons/NamespaceButton/styles.module.css +72 -0
- package/src/ui/buttons/WalletButton/index.tsx +76 -0
- package/src/ui/buttons/WalletButton/styles.module.css +123 -0
- package/src/ui/buttons/WalletConnectButton/components/WCGrid/index.tsx +10 -0
- package/src/ui/buttons/WalletConnectButton/components/WCGrid/styles.module.css +5 -0
- package/src/ui/buttons/WalletConnectButton/components/WCTitle/index.tsx +5 -0
- package/src/ui/buttons/WalletConnectButton/components/WCTitle/styles.module.css +8 -0
- package/src/ui/buttons/WalletConnectButton/index.tsx +16 -0
- package/src/ui/components/Footer/components/FooterDescription/index.tsx +10 -0
- package/src/ui/components/Footer/components/FooterDescription/styles.module.css +6 -0
- package/src/ui/components/Footer/components/FooterLink/index.tsx +15 -0
- package/src/ui/components/Footer/components/FooterLink/styles.module.css +20 -0
- package/src/ui/components/Footer/components/FooterWrapper/index.tsx +10 -0
- package/src/ui/components/Footer/components/FooterWrapper/styles.module.css +21 -0
- package/src/ui/components/Footer/index.tsx +16 -0
- package/src/ui/icons/BackIcon.tsx +14 -0
- package/src/ui/icons/CheckIcon.tsx +17 -0
- package/src/ui/icons/ClearIcon.tsx +13 -0
- package/src/ui/icons/CloseIcon.tsx +14 -0
- package/src/ui/icons/CopyIcon.tsx +16 -0
- package/src/ui/icons/SearchIcon.tsx +20 -0
- package/src/ui/icons/Spinner.tsx +7 -0
- package/src/ui/inputs/SearchBar/index.tsx +44 -0
- package/src/ui/inputs/SearchBar/styles.module.css +62 -0
- package/src/ui/layout/ModalBody/index.tsx +15 -0
- package/src/ui/layout/ModalBody/styles.module.css +15 -0
- package/src/ui/layout/ModalError/index.tsx +9 -0
- package/src/ui/layout/ModalError/styles.module.css +9 -0
- package/src/ui/layout/ModalHeader/index.tsx +26 -0
- package/src/ui/layout/ModalHeader/styles.module.css +92 -0
- package/src/ui/layout/ModalOverlay/index.tsx +15 -0
- package/src/ui/layout/ModalOverlay/styles.module.css +33 -0
- package/src/ui/layout/ModalWrapper/index.tsx +23 -0
- package/src/ui/layout/ModalWrapper/styles.module.css +26 -0
- package/src/ui/views/MobileWalletsView/components/MobileEmptyState/index.tsx +13 -0
- package/src/ui/views/MobileWalletsView/components/MobileEmptyState/styles.module.css +9 -0
- package/src/ui/views/MobileWalletsView/components/MobileLoading/index.tsx +5 -0
- package/src/ui/views/MobileWalletsView/components/MobileLoading/styles.module.css +9 -0
- package/src/ui/views/MobileWalletsView/components/MobileSearch/index.tsx +36 -0
- package/src/ui/views/MobileWalletsView/components/MobileSearch/styles.module.css +44 -0
- package/src/ui/views/MobileWalletsView/components/MobileWalletsList/index.tsx +46 -0
- package/src/ui/views/MobileWalletsView/components/MobileWalletsList/styles.module.css +35 -0
- package/src/ui/views/MobileWalletsView/components/MobileWrapper/index.tsx +10 -0
- package/src/ui/views/MobileWalletsView/components/MobileWrapper/styles.module.css +6 -0
- package/src/ui/views/MobileWalletsView/index.tsx +22 -0
- package/src/ui/views/NamespaceView/components/NamespaceGrid/index.tsx +10 -0
- package/src/ui/views/NamespaceView/components/NamespaceGrid/styles.module.css +5 -0
- package/src/ui/views/NamespaceView/components/NamespaceHeader/index.tsx +20 -0
- package/src/ui/views/NamespaceView/components/NamespaceHeader/styles.module.css +34 -0
- package/src/ui/views/NamespaceView/index.tsx +16 -0
- package/src/ui/views/QRView/components/QRActions/index.tsx +11 -0
- package/src/ui/views/QRView/components/QRActions/styles.module.css +8 -0
- package/src/ui/views/QRView/components/QRButton/index.tsx +15 -0
- package/src/ui/views/QRView/components/QRButton/styles.module.css +32 -0
- package/src/ui/views/QRView/components/QRError/index.tsx +9 -0
- package/src/ui/views/QRView/components/QRError/styles.module.css +5 -0
- package/src/ui/views/QRView/components/QRPlaceholder/index.tsx +10 -0
- package/src/ui/views/QRView/components/QRPlaceholder/styles.module.css +7 -0
- package/src/ui/views/QRView/components/QRWrapper/index.tsx +14 -0
- package/src/ui/views/QRView/components/QRWrapper/styles.module.css +23 -0
- package/src/ui/views/QRView/index.tsx +24 -0
- package/src/ui/views/WalletsView/components/WalletsGrid/index.tsx +10 -0
- package/src/ui/views/WalletsView/components/WalletsGrid/styles.module.css +5 -0
- package/src/ui/views/WalletsView/components/WalletsHeader/index.tsx +9 -0
- package/src/ui/views/WalletsView/components/WalletsHeader/styles.module.css +6 -0
- package/src/ui/views/WalletsView/index.tsx +20 -0
package/cli.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { dirname, join } from 'path';
|
|
5
|
+
import { copyFileSync, mkdirSync, existsSync, readdirSync, statSync } from 'fs';
|
|
6
|
+
import { execSync } from 'child_process';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
|
|
11
|
+
const args = process.argv.slice(2);
|
|
12
|
+
const command = args[0];
|
|
13
|
+
|
|
14
|
+
function showHelp() {
|
|
15
|
+
console.log(`
|
|
16
|
+
Trust Connect UI CLI
|
|
17
|
+
|
|
18
|
+
Usage:
|
|
19
|
+
npx @trustwallet/connect-ui add [options]
|
|
20
|
+
|
|
21
|
+
Commands:
|
|
22
|
+
add Copy UI components to your project
|
|
23
|
+
|
|
24
|
+
Options:
|
|
25
|
+
--path <path> Destination path (default: ./src/trustConnect)
|
|
26
|
+
--help Show this help message
|
|
27
|
+
|
|
28
|
+
Examples:
|
|
29
|
+
npx @trustwallet/connect-ui add
|
|
30
|
+
npx @trustwallet/connect-ui add --path ./src/components/trust
|
|
31
|
+
`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function copyRecursiveSync(src, dest) {
|
|
35
|
+
const exists = existsSync(src);
|
|
36
|
+
const stats = exists && statSync(src);
|
|
37
|
+
const isDirectory = exists && stats.isDirectory();
|
|
38
|
+
|
|
39
|
+
if (isDirectory) {
|
|
40
|
+
if (!existsSync(dest)) {
|
|
41
|
+
mkdirSync(dest, { recursive: true });
|
|
42
|
+
}
|
|
43
|
+
readdirSync(src).forEach((childItemName) => {
|
|
44
|
+
copyRecursiveSync(join(src, childItemName), join(dest, childItemName));
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
copyFileSync(src, dest);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function installDependencies() {
|
|
52
|
+
console.log('\n📦 Installing dependencies...');
|
|
53
|
+
|
|
54
|
+
const dependencies = [
|
|
55
|
+
'@trustwallet/connect-ui-logic',
|
|
56
|
+
'cuer@0.0.3'
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
// Check if package.json exists
|
|
61
|
+
if (!existsSync('./package.json')) {
|
|
62
|
+
console.error('❌ No package.json found in current directory');
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Detect package manager
|
|
67
|
+
let packageManager = 'npm';
|
|
68
|
+
if (existsSync('./pnpm-lock.yaml')) {
|
|
69
|
+
packageManager = 'pnpm';
|
|
70
|
+
} else if (existsSync('./yarn.lock')) {
|
|
71
|
+
packageManager = 'yarn';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
console.log(` Using ${packageManager}...`);
|
|
75
|
+
|
|
76
|
+
const installCommand = packageManager === 'yarn'
|
|
77
|
+
? `yarn add ${dependencies.join(' ')}`
|
|
78
|
+
: `${packageManager} install ${dependencies.join(' ')}`;
|
|
79
|
+
|
|
80
|
+
execSync(installCommand, { stdio: 'inherit' });
|
|
81
|
+
|
|
82
|
+
console.log('✅ Dependencies installed successfully');
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.error('❌ Failed to install dependencies:', error.message);
|
|
85
|
+
console.log('\n💡 You can manually install the dependencies:');
|
|
86
|
+
console.log(` npm install ${dependencies.join(' ')}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function add() {
|
|
91
|
+
const pathIndex = args.indexOf('--path');
|
|
92
|
+
const customPath = pathIndex !== -1 ? args[pathIndex + 1] : null;
|
|
93
|
+
const destPath = customPath || './src/trustConnect';
|
|
94
|
+
|
|
95
|
+
console.log('🚀 Adding Trust Connect UI components...\n');
|
|
96
|
+
|
|
97
|
+
// Source directory
|
|
98
|
+
const srcDir = join(__dirname, 'src');
|
|
99
|
+
|
|
100
|
+
if (!existsSync(srcDir)) {
|
|
101
|
+
console.error('❌ Source directory not found');
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Destination directory
|
|
106
|
+
const fullDestPath = join(process.cwd(), destPath);
|
|
107
|
+
|
|
108
|
+
if (existsSync(fullDestPath)) {
|
|
109
|
+
console.log(`⚠️ Directory ${destPath} already exists. Files will be overwritten.`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
console.log(`📁 Copying files to ${destPath}...`);
|
|
114
|
+
copyRecursiveSync(srcDir, fullDestPath);
|
|
115
|
+
console.log('✅ Files copied successfully\n');
|
|
116
|
+
|
|
117
|
+
installDependencies();
|
|
118
|
+
|
|
119
|
+
console.log('\n✨ Installation complete!');
|
|
120
|
+
console.log('\nNext steps:');
|
|
121
|
+
console.log(` 1. Import components from "${destPath}"`);
|
|
122
|
+
console.log(' 2. Make sure you have react and react-dom installed');
|
|
123
|
+
console.log('\nExample:');
|
|
124
|
+
console.log(` import { TrustModal } from '${destPath}/ui/TrustModal';`);
|
|
125
|
+
|
|
126
|
+
} catch (error) {
|
|
127
|
+
console.error('❌ Installation failed:', error.message);
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Main
|
|
133
|
+
if (!command || command === '--help' || command === '-h') {
|
|
134
|
+
showHelp();
|
|
135
|
+
process.exit(0);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (command === 'add') {
|
|
139
|
+
add();
|
|
140
|
+
} else {
|
|
141
|
+
console.error(`Unknown command: ${command}`);
|
|
142
|
+
showHelp();
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
:root,
|
|
2
|
+
[data-tcui-theme='light'] {
|
|
3
|
+
--tcui-font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
4
|
+
--tcui-bg: #f9fafb;
|
|
5
|
+
--tcui-bg-secondary: #f3f4f6;
|
|
6
|
+
--tcui-card: #ffffff;
|
|
7
|
+
--tcui-card-hover: #f9fafb;
|
|
8
|
+
--tcui-text: #111827;
|
|
9
|
+
--tcui-text-secondary: #6b7280;
|
|
10
|
+
--tcui-accent: #0500FF;
|
|
11
|
+
--tcui-border: #e5e7eb;
|
|
12
|
+
--tcui-success: #22c55e;
|
|
13
|
+
--tcui-danger: #dc2626;
|
|
14
|
+
--tcui-connect-bg: #eef2ff;
|
|
15
|
+
--tcui-connect-text: #0500FF;
|
|
16
|
+
--tcui-connect-hover: #e0e7ff;
|
|
17
|
+
--tcui-disconnect-bg: #f3f4f6;
|
|
18
|
+
--tcui-disconnect-text: #6b7280;
|
|
19
|
+
--tcui-disconnect-hover: #e5e7eb;
|
|
20
|
+
--tcui-radius: 14px;
|
|
21
|
+
--tcui-radius-sm: 8px;
|
|
22
|
+
--tcui-radius-lg: 20px;
|
|
23
|
+
--tcui-radius-full: 999px;
|
|
24
|
+
--tcui-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
|
|
25
|
+
--tcui-primary: #0500FF;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[data-tcui-theme='dark'] {
|
|
29
|
+
--tcui-bg: #121213;
|
|
30
|
+
--tcui-bg-secondary: #18181a;
|
|
31
|
+
--tcui-card: #161618;
|
|
32
|
+
--tcui-card-hover: #1f1f23;
|
|
33
|
+
--tcui-text: #eef5ef;
|
|
34
|
+
--tcui-text-secondary: #b3c1b6;
|
|
35
|
+
--tcui-accent: #48ff91;
|
|
36
|
+
--tcui-border: #2a2a2e;
|
|
37
|
+
--tcui-success: #48ff91;
|
|
38
|
+
--tcui-danger: #ff7d7d;
|
|
39
|
+
--tcui-connect-bg: rgba(72, 255, 145, 0.12);
|
|
40
|
+
--tcui-connect-text: #48ff91;
|
|
41
|
+
--tcui-connect-hover: rgba(72, 255, 145, 0.18);
|
|
42
|
+
--tcui-disconnect-bg: #242427;
|
|
43
|
+
--tcui-disconnect-text: #9ca4a2;
|
|
44
|
+
--tcui-disconnect-hover: #2e2e33;
|
|
45
|
+
--tcui-radius: 14px;
|
|
46
|
+
--tcui-radius-sm: 8px;
|
|
47
|
+
--tcui-radius-lg: 20px;
|
|
48
|
+
--tcui-radius-full: 999px;
|
|
49
|
+
--tcui-shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.6);
|
|
50
|
+
--tcui-primary: #48ff91;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
* {
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Shared utility classes for components that still need them */
|
|
58
|
+
.tcui-button {
|
|
59
|
+
border: none;
|
|
60
|
+
border-radius: var(--tcui-radius-full);
|
|
61
|
+
padding: 0 16px;
|
|
62
|
+
height: 36px;
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
font-size: 14px;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
display: inline-flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
gap: 6px;
|
|
70
|
+
transition: all 0.15s ease;
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
font-family: inherit;
|
|
73
|
+
min-width: fit-content;
|
|
74
|
+
background: var(--tcui-disconnect-bg);
|
|
75
|
+
color: var(--tcui-disconnect-text);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.tcui-button[data-loading='true'] {
|
|
79
|
+
min-width: 90px;
|
|
80
|
+
padding: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.tcui-button:hover:not(:disabled) {
|
|
84
|
+
background: var(--tcui-disconnect-hover);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.tcui-button:active:not(:disabled) {
|
|
88
|
+
transform: scale(0.98);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.tcui-button:disabled {
|
|
92
|
+
opacity: 0.5;
|
|
93
|
+
cursor: not-allowed;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.tcui-button-primary {
|
|
97
|
+
background: var(--tcui-connect-bg);
|
|
98
|
+
color: var(--tcui-connect-text);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.tcui-button-primary:hover:not(:disabled) {
|
|
102
|
+
background: var(--tcui-connect-hover);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.tcui-check-icon {
|
|
106
|
+
width: 14px;
|
|
107
|
+
height: 14px;
|
|
108
|
+
color: var(--tcui-success);
|
|
109
|
+
flex-shrink: 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
[data-tcui-theme='light'] .tcui-check-icon {
|
|
113
|
+
color: var(--tcui-connect-text);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.tcui-spinner {
|
|
117
|
+
width: 16px;
|
|
118
|
+
height: 16px;
|
|
119
|
+
border-radius: 50%;
|
|
120
|
+
border: 2px solid var(--tcui-border);
|
|
121
|
+
border-top-color: var(--tcui-accent);
|
|
122
|
+
animation: tcui-spin 0.7s linear infinite;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@keyframes tcui-spin {
|
|
126
|
+
from {
|
|
127
|
+
transform: rotate(0deg);
|
|
128
|
+
}
|
|
129
|
+
to {
|
|
130
|
+
transform: rotate(360deg);
|
|
131
|
+
}
|
|
132
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TrustConnectOptions, Theme } from '@trustwallet/connect-ui-logic';
|
|
2
|
+
export { Connections, NamespaceId, ResolvedTheme, RpcUrls, Theme, useConnect, useConnection, useConnections, useTheme, useTrustModal } from '@trustwallet/connect-ui-logic';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
type TrustConnectProviderProps = {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
config: TrustConnectOptions;
|
|
9
|
+
theme?: Theme;
|
|
10
|
+
};
|
|
11
|
+
declare function TrustConnectProvider({ children, config, theme }: TrustConnectProviderProps): react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { TrustConnectProvider };
|