@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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react'
|
|
2
|
+
import styles from './styles.module.css'
|
|
3
|
+
|
|
4
|
+
interface ModalOverlayProps {
|
|
5
|
+
onClick: () => void
|
|
6
|
+
children: ReactNode
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function ModalOverlay({ onClick, children }: ModalOverlayProps) {
|
|
10
|
+
return (
|
|
11
|
+
<div className={styles.overlay} role="presentation" onClick={onClick}>
|
|
12
|
+
{children}
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.overlay {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
background: rgba(0, 0, 0, 0.25);
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
z-index: 999999;
|
|
9
|
+
padding: 16px;
|
|
10
|
+
animation: fadeIn 0.2s ease;
|
|
11
|
+
font-family: var(--tcui-font-family);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[data-tcui-theme='dark'] .overlay {
|
|
15
|
+
background: rgba(0, 0, 0, 0.6);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@keyframes fadeIn {
|
|
19
|
+
from {
|
|
20
|
+
opacity: 0;
|
|
21
|
+
}
|
|
22
|
+
to {
|
|
23
|
+
opacity: 1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Mobile styles */
|
|
28
|
+
@media (max-width: 768px) {
|
|
29
|
+
.overlay {
|
|
30
|
+
padding: 0;
|
|
31
|
+
align-items: flex-end;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode, type MouseEvent as ReactMouseEvent, type RefObject } from 'react'
|
|
2
|
+
import styles from './styles.module.css'
|
|
3
|
+
|
|
4
|
+
interface ModalWrapperProps {
|
|
5
|
+
children: ReactNode
|
|
6
|
+
onClick: (event: ReactMouseEvent<HTMLDivElement>) => void
|
|
7
|
+
wrapperRef?: RefObject<HTMLDivElement | null>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function ModalWrapper({ children, onClick, wrapperRef }: ModalWrapperProps) {
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
ref={wrapperRef}
|
|
14
|
+
className={styles.modal}
|
|
15
|
+
role="dialog"
|
|
16
|
+
aria-modal="true"
|
|
17
|
+
aria-label="TrustConnect modal"
|
|
18
|
+
onClick={onClick}
|
|
19
|
+
>
|
|
20
|
+
{children}
|
|
21
|
+
</div>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.modal {
|
|
2
|
+
width: 100%;
|
|
3
|
+
max-width: 400px;
|
|
4
|
+
max-height: calc(100vh - 32px);
|
|
5
|
+
background: var(--tcui-bg);
|
|
6
|
+
border: 1px solid var(--tcui-border);
|
|
7
|
+
border-radius: var(--tcui-radius-lg);
|
|
8
|
+
box-shadow: var(--tcui-shadow-lg);
|
|
9
|
+
color: var(--tcui-text);
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* Mobile styles */
|
|
16
|
+
@media (max-width: 768px) {
|
|
17
|
+
.modal {
|
|
18
|
+
max-width: 100%;
|
|
19
|
+
max-height: 90vh;
|
|
20
|
+
height: 80vh;
|
|
21
|
+
border-radius: 16px 16px 0 0;
|
|
22
|
+
border: none;
|
|
23
|
+
border-top: 1px solid var(--tcui-border);
|
|
24
|
+
animation: slideUpMobile 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styles from './styles.module.css'
|
|
2
|
+
|
|
3
|
+
interface MobileEmptyStateProps {
|
|
4
|
+
searchQuery?: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function MobileEmptyState({ searchQuery }: MobileEmptyStateProps) {
|
|
8
|
+
if (searchQuery) {
|
|
9
|
+
return <div className={styles.empty}>No wallets found for "{searchQuery}"</div>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return <div className={styles.empty}>No wallets available</div>
|
|
13
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useCopyToClipboard } from '@trustwallet/connect-ui-logic'
|
|
2
|
+
import { SearchBar } from '../../../../inputs/SearchBar'
|
|
3
|
+
import styles from './styles.module.css'
|
|
4
|
+
import { CheckIcon } from '../../../../icons/CheckIcon'
|
|
5
|
+
import { CopyIcon } from '../../../../icons/CopyIcon'
|
|
6
|
+
|
|
7
|
+
interface MobileSearchProps {
|
|
8
|
+
searchQuery: string
|
|
9
|
+
setSearchQuery: (query: string) => void
|
|
10
|
+
uri: string | undefined
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function MobileSearch({ searchQuery, setSearchQuery, uri }: MobileSearchProps) {
|
|
14
|
+
const { copied, copy } = useCopyToClipboard()
|
|
15
|
+
|
|
16
|
+
const handleCopyUri = async () => {
|
|
17
|
+
if (!uri) return
|
|
18
|
+
await copy(uri)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div className={styles.searchContainer}>
|
|
23
|
+
<SearchBar value={searchQuery} onChange={setSearchQuery} placeholder="Search wallets..." />
|
|
24
|
+
<button
|
|
25
|
+
type="button"
|
|
26
|
+
onClick={handleCopyUri}
|
|
27
|
+
className={styles.copyButton}
|
|
28
|
+
aria-label="Copy WalletConnect URI"
|
|
29
|
+
disabled={!uri}
|
|
30
|
+
data-copied={copied}
|
|
31
|
+
>
|
|
32
|
+
{copied ? <CheckIcon /> : <CopyIcon />}
|
|
33
|
+
</button>
|
|
34
|
+
</div>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.searchContainer {
|
|
2
|
+
padding: 0 0 16px 0;
|
|
3
|
+
flex-shrink: 0;
|
|
4
|
+
display: flex;
|
|
5
|
+
gap: 8px;
|
|
6
|
+
align-items: center;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.copyButton {
|
|
10
|
+
flex-shrink: 0;
|
|
11
|
+
width: 40px;
|
|
12
|
+
height: 40px;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
background: var(--tcui-bg-secondary);
|
|
17
|
+
border: 1px solid var(--tcui-border);
|
|
18
|
+
border-radius: var(--tcui-radius-full);
|
|
19
|
+
color: var(--tcui-text-secondary);
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
transition: all 0.2s ease;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.copyButton:hover {
|
|
25
|
+
background: var(--tcui-card-hover);
|
|
26
|
+
color: var(--tcui-text);
|
|
27
|
+
border-color: var(--tcui-primary);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.copyButton:active {
|
|
31
|
+
transform: scale(0.95);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.copyButton:disabled {
|
|
35
|
+
opacity: 0.5;
|
|
36
|
+
cursor: not-allowed;
|
|
37
|
+
pointer-events: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.copyButton[data-copied='true'] {
|
|
41
|
+
color: var(--tcui-accent);
|
|
42
|
+
border-color: var(--tcui-accent);
|
|
43
|
+
background: var(--tcui-connect-bg);
|
|
44
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { RefObject } from 'react'
|
|
2
|
+
import styles from './styles.module.css'
|
|
3
|
+
import { WalletButton } from '../../../../buttons/WalletButton'
|
|
4
|
+
import { Spinner } from '../../../../icons/Spinner'
|
|
5
|
+
import { ExplorerWallet } from '@trustwallet/connect-ui-logic/walletConnect'
|
|
6
|
+
|
|
7
|
+
interface MobileWalletsListProps {
|
|
8
|
+
wallets: ExplorerWallet[]
|
|
9
|
+
connectingWalletId: string | null
|
|
10
|
+
connectionError: string | null
|
|
11
|
+
isLoadingMore: boolean
|
|
12
|
+
scrollRef: RefObject<HTMLDivElement | null>
|
|
13
|
+
onWalletClick: (wallet: ExplorerWallet) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function MobileWalletsList({
|
|
17
|
+
wallets,
|
|
18
|
+
connectingWalletId,
|
|
19
|
+
connectionError,
|
|
20
|
+
isLoadingMore,
|
|
21
|
+
scrollRef,
|
|
22
|
+
onWalletClick,
|
|
23
|
+
}: MobileWalletsListProps) {
|
|
24
|
+
return (
|
|
25
|
+
<div className={styles.grid} ref={scrollRef}>
|
|
26
|
+
{wallets.map((wallet) => (
|
|
27
|
+
<WalletButton
|
|
28
|
+
key={wallet.id}
|
|
29
|
+
name={wallet.name}
|
|
30
|
+
icon={wallet.iconUrl}
|
|
31
|
+
active={false}
|
|
32
|
+
variant="default"
|
|
33
|
+
actionLabel="Connect"
|
|
34
|
+
onClick={() => onWalletClick(wallet)}
|
|
35
|
+
loading={connectingWalletId === wallet.id}
|
|
36
|
+
error={connectionError ?? undefined}
|
|
37
|
+
/>
|
|
38
|
+
))}
|
|
39
|
+
{isLoadingMore && (
|
|
40
|
+
<div className={styles.loadingMore}>
|
|
41
|
+
<Spinner />
|
|
42
|
+
</div>
|
|
43
|
+
)}
|
|
44
|
+
</div>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.grid {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 8px;
|
|
5
|
+
overflow-y: auto;
|
|
6
|
+
flex: 1;
|
|
7
|
+
padding-right: 4px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.grid::-webkit-scrollbar {
|
|
11
|
+
width: 6px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.grid::-webkit-scrollbar-track {
|
|
15
|
+
background: transparent;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.grid::-webkit-scrollbar-thumb {
|
|
19
|
+
background: var(--tcui-border);
|
|
20
|
+
border-radius: 3px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.grid::-webkit-scrollbar-thumb:hover {
|
|
24
|
+
background: var(--tcui-text-secondary);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.loadingMore {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
padding: 16px;
|
|
32
|
+
text-align: center;
|
|
33
|
+
color: var(--tcui-text-secondary);
|
|
34
|
+
font-size: 13px;
|
|
35
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import styles from './styles.module.css'
|
|
3
|
+
|
|
4
|
+
interface MobileWrapperProps {
|
|
5
|
+
children: ReactNode
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function MobileWrapper({ children }: MobileWrapperProps) {
|
|
9
|
+
return <div className={styles.container}>{children}</div>
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MobileWalletsViewLogic } from '@trustwallet/connect-ui-logic/walletConnect'
|
|
2
|
+
import { MobileEmptyState } from './components/MobileEmptyState'
|
|
3
|
+
import { MobileLoading } from './components/MobileLoading'
|
|
4
|
+
import { MobileSearch } from './components/MobileSearch'
|
|
5
|
+
import { MobileWalletsList } from './components/MobileWalletsList'
|
|
6
|
+
import { MobileWrapper } from './components/MobileWrapper'
|
|
7
|
+
import { Footer } from '../../components/Footer'
|
|
8
|
+
|
|
9
|
+
export function MobileWalletsView() {
|
|
10
|
+
return (
|
|
11
|
+
<MobileWalletsViewLogic
|
|
12
|
+
components={{
|
|
13
|
+
wrapper: MobileWrapper,
|
|
14
|
+
search: MobileSearch,
|
|
15
|
+
loading: MobileLoading,
|
|
16
|
+
emptyState: MobileEmptyState,
|
|
17
|
+
walletsList: MobileWalletsList,
|
|
18
|
+
footer: Footer,
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react'
|
|
2
|
+
import styles from './styles.module.css'
|
|
3
|
+
|
|
4
|
+
interface NamespaceGridProps {
|
|
5
|
+
children: ReactNode
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function NamespaceGrid({ children }: NamespaceGridProps) {
|
|
9
|
+
return <div className={styles.grid}>{children}</div>
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Wallet, CaipWallet } from '@trustwallet/connect-headless'
|
|
2
|
+
import styles from './styles.module.css'
|
|
3
|
+
|
|
4
|
+
interface NamespaceHeaderProps {
|
|
5
|
+
targetWallet?: Wallet | CaipWallet | null
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function NamespaceHeader({ targetWallet }: NamespaceHeaderProps) {
|
|
9
|
+
return (
|
|
10
|
+
<div className={styles.spacer}>
|
|
11
|
+
<h3 className={styles.sectionTitle}>Namespaces</h3>
|
|
12
|
+
{targetWallet && (
|
|
13
|
+
<span className={styles.badge}>
|
|
14
|
+
<img src={targetWallet.icon} alt={targetWallet.name} className={styles.badgeIcon} />
|
|
15
|
+
{targetWallet.name}
|
|
16
|
+
</span>
|
|
17
|
+
)}
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.spacer {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-between;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 12px;
|
|
6
|
+
margin-bottom: 8px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.sectionTitle {
|
|
10
|
+
font-size: 14px;
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
margin: 0;
|
|
13
|
+
color: var(--tcui-text-secondary);
|
|
14
|
+
letter-spacing: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.badge {
|
|
18
|
+
background: var(--tcui-bg-secondary);
|
|
19
|
+
border: 1px solid var(--tcui-border);
|
|
20
|
+
border-radius: 6px;
|
|
21
|
+
padding: 4px 10px;
|
|
22
|
+
font-size: 12px;
|
|
23
|
+
font-weight: 500;
|
|
24
|
+
color: var(--tcui-text-secondary);
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: 6px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.badgeIcon {
|
|
31
|
+
width: 16px;
|
|
32
|
+
height: 16px;
|
|
33
|
+
border-radius: 4px;
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NamespaceViewLogic } from '@trustwallet/connect-ui-logic'
|
|
2
|
+
import { NamespaceButton } from '../../buttons/NamespaceButton'
|
|
3
|
+
import { NamespaceHeader } from './components/NamespaceHeader'
|
|
4
|
+
import { NamespaceGrid } from './components/NamespaceGrid'
|
|
5
|
+
|
|
6
|
+
export function NamespaceView() {
|
|
7
|
+
return (
|
|
8
|
+
<NamespaceViewLogic
|
|
9
|
+
components={{
|
|
10
|
+
header: NamespaceHeader,
|
|
11
|
+
grid: NamespaceGrid,
|
|
12
|
+
namespaceButton: NamespaceButton,
|
|
13
|
+
}}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import styles from './styles.module.css'
|
|
3
|
+
|
|
4
|
+
type QRActionsProps = {
|
|
5
|
+
children: ReactNode
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Wraps the QRButton internally */
|
|
9
|
+
export function QRActions({ children }: QRActionsProps) {
|
|
10
|
+
return <div className={styles.actions}>{children}</div>
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styles from './styles.module.css'
|
|
2
|
+
|
|
3
|
+
type QRButtonProps = {
|
|
4
|
+
onClick: () => void
|
|
5
|
+
disabled?: boolean
|
|
6
|
+
children: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function QRButton({ onClick, disabled, children }: QRButtonProps) {
|
|
10
|
+
return (
|
|
11
|
+
<button className={styles.button} type="button" onClick={onClick} disabled={disabled}>
|
|
12
|
+
{children}
|
|
13
|
+
</button>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.button {
|
|
2
|
+
border: none;
|
|
3
|
+
background: var(--tcui-connect-bg);
|
|
4
|
+
color: var(--tcui-connect-text);
|
|
5
|
+
border-radius: var(--tcui-radius-full);
|
|
6
|
+
padding: 0 16px;
|
|
7
|
+
height: 36px;
|
|
8
|
+
font-weight: 600;
|
|
9
|
+
font-size: 14px;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
gap: 6px;
|
|
15
|
+
transition: all 0.15s ease;
|
|
16
|
+
white-space: nowrap;
|
|
17
|
+
font-family: inherit;
|
|
18
|
+
width: 85%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.button:hover:not(:disabled) {
|
|
22
|
+
background: var(--tcui-connect-hover);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.button:active:not(:disabled) {
|
|
26
|
+
transform: scale(0.98);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.button:disabled {
|
|
30
|
+
opacity: 0.5;
|
|
31
|
+
cursor: not-allowed;
|
|
32
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import styles from './styles.module.css'
|
|
3
|
+
|
|
4
|
+
type QRPlaceholderProps = {
|
|
5
|
+
children: ReactNode
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function QRPlaceholder({ children }: QRPlaceholderProps) {
|
|
9
|
+
return <div className={styles.placeholder}>{children}</div>
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import styles from './styles.module.css'
|
|
3
|
+
|
|
4
|
+
type QRWrapperProps = {
|
|
5
|
+
children: ReactNode
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function QRWrapper({ children }: QRWrapperProps) {
|
|
9
|
+
return (
|
|
10
|
+
<div className={styles.qr} role="region" aria-label="WalletConnect QR code">
|
|
11
|
+
{children}
|
|
12
|
+
</div>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.qr {
|
|
2
|
+
background: var(--tcui-card);
|
|
3
|
+
border: 1px solid var(--tcui-border);
|
|
4
|
+
border-radius: var(--tcui-radius);
|
|
5
|
+
padding: 24px;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 16px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.qr > :first-child {
|
|
13
|
+
width: 280px;
|
|
14
|
+
height: 280px;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.qr canvas {
|
|
21
|
+
border-radius: var(--tcui-radius);
|
|
22
|
+
box-shadow: 0 0 0 1px var(--tcui-border);
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { QRViewLogic } from '@trustwallet/connect-ui-logic/walletConnect'
|
|
2
|
+
import { QRWrapper } from './components/QRWrapper'
|
|
3
|
+
import { QRPlaceholder } from './components/QRPlaceholder'
|
|
4
|
+
import { QRActions } from './components/QRActions'
|
|
5
|
+
import { QRButton } from './components/QRButton'
|
|
6
|
+
import { QRError } from './components/QRError'
|
|
7
|
+
import { Cuer } from 'cuer'
|
|
8
|
+
import { Spinner } from '../../icons/Spinner'
|
|
9
|
+
|
|
10
|
+
export function QRView() {
|
|
11
|
+
return (
|
|
12
|
+
<QRViewLogic
|
|
13
|
+
components={{
|
|
14
|
+
wrapper: QRWrapper,
|
|
15
|
+
placeholder: QRPlaceholder,
|
|
16
|
+
qrCode: Cuer,
|
|
17
|
+
actions: QRActions,
|
|
18
|
+
button: QRButton,
|
|
19
|
+
error: QRError,
|
|
20
|
+
spinner: Spinner,
|
|
21
|
+
}}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import styles from './styles.module.css'
|
|
2
|
+
import { ReactNode } from 'react'
|
|
3
|
+
|
|
4
|
+
interface WalletsGridProps {
|
|
5
|
+
children: ReactNode
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function WalletsGrid({ children }: WalletsGridProps) {
|
|
9
|
+
return <div className={styles.grid}>{children}</div>
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WalletsViewLogic } from '@trustwallet/connect-ui-logic'
|
|
2
|
+
import { WalletButton } from '../../buttons/WalletButton'
|
|
3
|
+
import { WalletConnectButton } from '../../buttons/WalletConnectButton'
|
|
4
|
+
import { GetTrustButton } from '../../buttons/GetTrustButton'
|
|
5
|
+
import { WalletsHeader } from './components/WalletsHeader'
|
|
6
|
+
import { WalletsGrid } from './components/WalletsGrid'
|
|
7
|
+
|
|
8
|
+
export function WalletsView() {
|
|
9
|
+
return (
|
|
10
|
+
<WalletsViewLogic
|
|
11
|
+
components={{
|
|
12
|
+
emptyState: GetTrustButton,
|
|
13
|
+
header: WalletsHeader,
|
|
14
|
+
grid: WalletsGrid,
|
|
15
|
+
walletButton: WalletButton,
|
|
16
|
+
walletConnectButton: WalletConnectButton,
|
|
17
|
+
}}
|
|
18
|
+
/>
|
|
19
|
+
)
|
|
20
|
+
}
|