@aurora-is-near/intents-swap-widget 3.18.0 → 3.18.2
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/chains.d.ts +5 -0
- package/dist/chains.js +15 -0
- package/dist/chains.js.map +1 -0
- package/dist/components/Accordion.js +13 -13
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/Banner.js +33 -19
- package/dist/components/Banner.js.map +1 -1
- package/dist/components/BlockingError.js +11 -16
- package/dist/components/BlockingError.js.map +1 -1
- package/dist/components/Button.d.ts +2 -2
- package/dist/components/Button.js +2 -2
- package/dist/components/Button.js.map +1 -1
- package/dist/components/CloseButton.js +6 -6
- package/dist/components/CloseButton.js.map +1 -1
- package/dist/components/CopyButton.js +4 -4
- package/dist/components/CopyButton.js.map +1 -1
- package/dist/components/DirectionSwitcher.js +12 -11
- package/dist/components/DirectionSwitcher.js.map +1 -1
- package/dist/components/Input.d.ts +5 -3
- package/dist/components/Input.js +16 -16
- package/dist/components/Input.js.map +1 -1
- package/dist/components/StatusWidget.js +8 -21
- package/dist/components/StatusWidget.js.map +1 -1
- package/dist/components/WidgetContainer.js +20 -17
- package/dist/components/WidgetContainer.js.map +1 -1
- package/dist/{config-BJ5jppn5.js → config-CgCb5P7j.js} +889 -860
- package/dist/{config-BJ5jppn5.js.map → config-CgCb5P7j.js.map} +1 -1
- package/dist/config.js +21 -5
- package/dist/config.js.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/ext/alchemy/index.js +1 -1
- package/dist/ext/index.js +1 -1
- package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
- package/dist/features/BalanceRpcLoader/index.js +1 -1
- package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
- package/dist/features/ChainsDropdown/AllNetworksIcon.js +3 -3
- package/dist/features/ChainsDropdown/AllNetworksIcon.js.map +1 -1
- package/dist/features/ChainsDropdown/ChainItem.js +7 -7
- package/dist/features/ChainsDropdown/ChainItem.js.map +1 -1
- package/dist/features/ChainsDropdown/index.js +45 -33
- package/dist/features/ChainsDropdown/index.js.map +1 -1
- package/dist/features/DepositMethodSwitcher.js +18 -17
- package/dist/features/DepositMethodSwitcher.js.map +1 -1
- package/dist/features/ErrorBoundary.js +1 -1
- package/dist/features/ExternalDeposit.js +22 -15
- package/dist/features/ExternalDeposit.js.map +1 -1
- package/dist/features/SendAddress/index.js +15 -14
- package/dist/features/SendAddress/index.js.map +1 -1
- package/dist/features/SendAddress/useNotification.js +1 -1
- package/dist/features/SubmitButton/index.js +1 -1
- package/dist/features/SuccessScreen/CheckIcon.js +4 -4
- package/dist/features/SuccessScreen/CheckIcon.js.map +1 -1
- package/dist/features/SuccessScreen/ExternalAction.js +6 -6
- package/dist/features/SuccessScreen/ExternalAction.js.map +1 -1
- package/dist/features/SuccessScreen/index.js +1 -1
- package/dist/features/SwapDirectionSwitcher.js +1 -1
- package/dist/features/SwapQuote/SwapQuote.js +1 -1
- package/dist/features/SwapQuote/index.js +1 -1
- package/dist/features/TokenInput/TokenInput.js +1 -1
- package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
- package/dist/features/TokenInput/TokenInputSource.js +1 -1
- package/dist/features/TokenInput/TokenInputTarget.js +1 -1
- package/dist/features/TokenInput/WalletBalance.js +1 -1
- package/dist/features/TokenInput/hooks/index.js +1 -1
- package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
- package/dist/features/TokenInput/index.js +1 -1
- package/dist/features/TokensList/TokenItem.js +1 -1
- package/dist/features/TokensList/TokensList.js +1 -1
- package/dist/features/TokensList/index.js +1 -1
- package/dist/features/TokensModal.js +11 -11
- package/dist/features/TokensModal.js.map +1 -1
- package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +19 -6
- package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js.map +1 -1
- package/dist/features/WalletCompatibilityCheck/index.js +1 -1
- package/dist/features/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useAllTokens.js +1 -1
- package/dist/hooks/useChains.js +1 -1
- package/dist/hooks/useCompatibilityCheck.js +1 -1
- package/dist/hooks/useDefaultToken.js +1 -1
- package/dist/hooks/useExternalDepositStatus/index.js +1 -1
- package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
- package/dist/hooks/useIntentsBalance.js +1 -1
- package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
- package/dist/hooks/useMakeDepositAddress.js +1 -1
- package/dist/hooks/useMakeIntentsTransfer.js +1 -1
- package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
- package/dist/hooks/useMakeQuote.js +1 -1
- package/dist/hooks/useMakeQuoteTransfer.js +1 -1
- package/dist/hooks/useMakeTransfer.js +1 -1
- package/dist/hooks/useMergedBalance.js +1 -1
- package/dist/hooks/useSwitchChain.js +1 -1
- package/dist/hooks/useTheme.js +1 -1
- package/dist/hooks/useTokenInputPair.js +1 -1
- package/dist/hooks/useTokens.js +1 -1
- package/dist/hooks/useTokensFiltered.js +1 -1
- package/dist/hooks/useTokensIntentsUnique.js +1 -1
- package/dist/icons/index.d.ts +2 -1
- package/dist/icons/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +87 -85
- package/dist/index.js.map +1 -1
- package/dist/machine/effects/index.js +1 -1
- package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
- package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
- package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
- package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
- package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
- package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
- package/dist/machine/effects/useWalletConnEffect.js +1 -1
- package/dist/machine/events/index.js +1 -1
- package/dist/machine/events/tokenSelect.js +1 -1
- package/dist/machine/events/validateInputAndMoveTo.js +1 -1
- package/dist/machine/events/validateInputs.js +1 -1
- package/dist/machine/index.js +1 -1
- package/dist/machine/snap.js +1 -1
- package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
- package/dist/machine/subscriptions/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +9 -0
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/types/theme.d.ts +3 -0
- package/dist/utils/intents/signers/near.js +1 -1
- package/dist/utils/intents/signers/privy.js +1 -1
- package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +18 -11
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js.map +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js +33 -22
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js.map +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +19 -9
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js.map +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
- package/package.json +2 -27
- package/src/chains.ts +14 -0
- package/src/components/Accordion.tsx +3 -3
- package/src/components/Banner.tsx +17 -8
- package/src/components/BlockingError.tsx +4 -6
- package/src/components/Button.tsx +9 -6
- package/src/components/CloseButton.tsx +2 -2
- package/src/components/CopyButton.tsx +2 -2
- package/src/components/DirectionSwitcher.tsx +4 -4
- package/src/components/Input.tsx +5 -4
- package/src/components/StatusWidget.tsx +4 -11
- package/src/components/WidgetContainer.tsx +7 -3
- package/src/features/ChainsDropdown/AllNetworksIcon.tsx +2 -2
- package/src/features/ChainsDropdown/ChainItem.tsx +2 -2
- package/src/features/ChainsDropdown/index.tsx +9 -3
- package/src/features/DepositMethodSwitcher.tsx +4 -3
- package/src/features/ExternalDeposit.tsx +2 -2
- package/src/features/SendAddress/index.tsx +3 -2
- package/src/features/SuccessScreen/CheckIcon.tsx +2 -2
- package/src/features/SuccessScreen/ExternalAction.tsx +2 -2
- package/src/features/TokensModal.tsx +2 -2
- package/src/features/WalletCompatibilityCheck/WalletCompatibilityModal.tsx +8 -9
- package/src/icons/index.tsx +5 -1
- package/src/index.ts +1 -0
- package/src/tailwind.css +9 -0
- package/src/theme/ThemeProvider.tsx +32 -5
- package/src/types/theme.ts +3 -0
- package/src/widgets/WidgetDeposit/WidgetDeposit.test.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aurora-is-near/intents-swap-widget",
|
|
3
|
-
"version": "3.18.
|
|
3
|
+
"version": "3.18.2",
|
|
4
4
|
"description": "Provides components and hooks to build your own Intents swap widget",
|
|
5
5
|
"author": "Maksim Vashchuk",
|
|
6
6
|
"license": "MIT",
|
|
@@ -82,11 +82,10 @@
|
|
|
82
82
|
"imask": "^7.6.1",
|
|
83
83
|
"jest-react-hooks-shallow": "^1.5.1",
|
|
84
84
|
"lodash.once": "^4.1.1",
|
|
85
|
-
"lucide-react": "^0.525.0",
|
|
86
85
|
"near-api-js": "^6.2.5",
|
|
87
86
|
"proxy-memoize": "^3.0.1",
|
|
88
87
|
"qrcode.react": "^4.2.0",
|
|
89
|
-
"qs": "^6.14.
|
|
88
|
+
"qs": "^6.14.1",
|
|
90
89
|
"react-error-boundary": "^6.0.0",
|
|
91
90
|
"react-helmet-async": "^2.0.5",
|
|
92
91
|
"react-i18next": "^15.7.3",
|
|
@@ -100,29 +99,5 @@
|
|
|
100
99
|
"viem": "^2.38.3",
|
|
101
100
|
"virtua": "^0.41.5",
|
|
102
101
|
"zod": "^3.25.51"
|
|
103
|
-
},
|
|
104
|
-
"devDependencies": {
|
|
105
|
-
"@jest/globals": "^30.2.0",
|
|
106
|
-
"@swc/core": "^1.15.2",
|
|
107
|
-
"@swc/jest": "^0.2.39",
|
|
108
|
-
"@testing-library/dom": "^10.4.1",
|
|
109
|
-
"@testing-library/jest-dom": "^6.9.1",
|
|
110
|
-
"@testing-library/react": "^16.3.0",
|
|
111
|
-
"@testing-library/user-event": "^14.6.1",
|
|
112
|
-
"@types/browser-or-node": "^1.3.2",
|
|
113
|
-
"@types/jest": "^30.0.0",
|
|
114
|
-
"@types/jest-image-snapshot": "^6.4.0",
|
|
115
|
-
"@types/puppeteer": "^7.0.4",
|
|
116
|
-
"glob": "^10.5.0",
|
|
117
|
-
"is-ci": "^4.1.0",
|
|
118
|
-
"jest-environment-jsdom": "^30.2.0",
|
|
119
|
-
"jest-image-snapshot": "^6.5.1",
|
|
120
|
-
"jest-puppeteer": "^11.0.0",
|
|
121
|
-
"jest-react-hooks-shallow": "^1.5.1",
|
|
122
|
-
"jest-transform-stub": "^2.0.0",
|
|
123
|
-
"jest-transformer-svg": "^2.1.0",
|
|
124
|
-
"puppeteer": "^24.31.0",
|
|
125
|
-
"ts-jest": "^29.4.5",
|
|
126
|
-
"vite-plugin-static-copy": "^3.1.4"
|
|
127
102
|
}
|
|
128
103
|
}
|
package/src/chains.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cloneElement } from 'react';
|
|
2
|
+
import { CHAINS_LIST } from './constants';
|
|
3
|
+
import { CHAIN_ICONS } from './icons';
|
|
4
|
+
|
|
5
|
+
export const CHAINS = Object.values(CHAINS_LIST).map((chain) => {
|
|
6
|
+
return {
|
|
7
|
+
id: chain.id,
|
|
8
|
+
label: chain.label,
|
|
9
|
+
icon: cloneElement(CHAIN_ICONS[chain.id], {
|
|
10
|
+
width: '100%',
|
|
11
|
+
height: '100%',
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { ChevronLeftW700 as ChevronLeft } from '@material-symbols-svg/react-rounded/icons/chevron-left';
|
|
3
3
|
import type { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
import { Hr } from './Hr';
|
|
@@ -44,9 +44,9 @@ export const Accordion = ({
|
|
|
44
44
|
)}
|
|
45
45
|
<button type="button" className="ml-sw-lg cursor-pointer">
|
|
46
46
|
{isExpanded ? (
|
|
47
|
-
<
|
|
47
|
+
<ChevronLeft className="h-sw-2xl w-sw-2xl text-sw-gray-200 rotate-90" />
|
|
48
48
|
) : (
|
|
49
|
-
<
|
|
49
|
+
<ChevronLeft className="h-sw-2xl w-sw-2xl text-sw-gray-200 -rotate-90" />
|
|
50
50
|
)}
|
|
51
51
|
</button>
|
|
52
52
|
</header>
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CloseW700 as Close } from '@material-symbols-svg/react-rounded/icons/close';
|
|
2
|
+
import { EmergencyW700 as Emergency } from '@material-symbols-svg/react-rounded/icons/emergency';
|
|
3
|
+
import { ErrorFillW700 as ErrorFill } from '@material-symbols-svg/react-rounded/icons/error';
|
|
4
|
+
import { VerifiedFillW700 as VerifiedFill } from '@material-symbols-svg/react-rounded/icons/verified';
|
|
5
|
+
import { useMemo } from 'react';
|
|
2
6
|
|
|
3
7
|
import { cn } from '@/utils/cn';
|
|
4
8
|
|
|
@@ -17,12 +21,17 @@ export const Banner = ({
|
|
|
17
21
|
className,
|
|
18
22
|
onDismiss,
|
|
19
23
|
}: Props) => {
|
|
20
|
-
const icon =
|
|
21
|
-
variant
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const icon = useMemo(() => {
|
|
25
|
+
switch (variant) {
|
|
26
|
+
case 'success':
|
|
27
|
+
return <VerifiedFill size={16} />;
|
|
28
|
+
case 'error':
|
|
29
|
+
return <ErrorFill size={16} />;
|
|
30
|
+
case 'warn':
|
|
31
|
+
default:
|
|
32
|
+
return <Emergency size={16} />;
|
|
33
|
+
}
|
|
34
|
+
}, [variant]);
|
|
26
35
|
|
|
27
36
|
return (
|
|
28
37
|
<div
|
|
@@ -46,7 +55,7 @@ export const Banner = ({
|
|
|
46
55
|
<div
|
|
47
56
|
onClick={onDismiss}
|
|
48
57
|
className="ml-auto flex cursor-pointer items-center justify-center transition-all hover:scale-125">
|
|
49
|
-
<
|
|
58
|
+
<Close size={16} />
|
|
50
59
|
</div>
|
|
51
60
|
)}
|
|
52
61
|
</div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CachedW700 as Cached } from '@material-symbols-svg/react-rounded/icons/cached';
|
|
2
|
+
import { CloseW700 as Close } from '@material-symbols-svg/react-rounded/icons/close';
|
|
2
3
|
|
|
3
4
|
import { Button } from './Button';
|
|
4
5
|
import { Card } from './Card';
|
|
@@ -13,10 +14,7 @@ export const BlockingError = ({ message, onClickRetry }: Props) => (
|
|
|
13
14
|
<div className="gap-sw-4xl py-6xl flex min-h-[200px] flex-col items-center justify-center w-full">
|
|
14
15
|
<div className="gap-sw-xl flex flex-col items-center justify-center">
|
|
15
16
|
<header className="gap-sw-md flex items-center">
|
|
16
|
-
<
|
|
17
|
-
strokeWidth={2.5}
|
|
18
|
-
className="text-sw-accent-500 h-sw-4xl w-sw-4xl"
|
|
19
|
-
/>
|
|
17
|
+
<Close className="text-sw-accent-500 h-sw-4xl w-sw-4xl" />
|
|
20
18
|
<h3 className="text-sw-value-lg text-sw-accent-500">Ooops...</h3>
|
|
21
19
|
</header>
|
|
22
20
|
<p className="text-sw-body-md text-center text-sw-gray-100">
|
|
@@ -26,7 +24,7 @@ export const BlockingError = ({ message, onClickRetry }: Props) => (
|
|
|
26
24
|
<Button
|
|
27
25
|
size="md"
|
|
28
26
|
variant="primary"
|
|
29
|
-
icon={
|
|
27
|
+
icon={Cached}
|
|
30
28
|
onClick={onClickRetry}
|
|
31
29
|
className="w-fit">
|
|
32
30
|
Try again
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Button as UIButton } from '@headlessui/react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { ProgressActivityW700 as ProgressActivity } from '@material-symbols-svg/react-rounded/icons/progress-activity';
|
|
3
|
+
import type {
|
|
4
|
+
IconProps,
|
|
5
|
+
MaterialSymbolsComponent,
|
|
6
|
+
} from '@material-symbols-svg/react';
|
|
4
7
|
|
|
5
8
|
import { cn as clsx } from '@/utils/cn';
|
|
6
9
|
|
|
@@ -17,7 +20,7 @@ type Props = {
|
|
|
17
20
|
onClick?: () => void;
|
|
18
21
|
fluid?: boolean;
|
|
19
22
|
} & (
|
|
20
|
-
| { icon:
|
|
23
|
+
| { icon: MaterialSymbolsComponent; iconPosition?: 'head' | 'tail' }
|
|
21
24
|
| { icon?: never; iconPosition?: never }
|
|
22
25
|
);
|
|
23
26
|
|
|
@@ -50,10 +53,10 @@ const ButtonChildren = ({
|
|
|
50
53
|
const Icon =
|
|
51
54
|
hasIcon && state !== 'loading'
|
|
52
55
|
? (icon ?? (() => <span />))
|
|
53
|
-
: ({ className, ...
|
|
54
|
-
<
|
|
56
|
+
: ({ className, ...iconProps }: IconProps) => (
|
|
57
|
+
<ProgressActivity
|
|
55
58
|
className={clsx(styles.icon, 'animate-spin', className)}
|
|
56
|
-
{...
|
|
59
|
+
{...iconProps}
|
|
57
60
|
/>
|
|
58
61
|
);
|
|
59
62
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CloseW700 as Close } from '@material-symbols-svg/react-rounded/icons/close';
|
|
2
2
|
|
|
3
3
|
import { cn } from '@/utils';
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ export const CloseButton = ({ className, onClick }: Props) => {
|
|
|
16
16
|
className,
|
|
17
17
|
)}
|
|
18
18
|
onClick={onClick}>
|
|
19
|
-
<
|
|
19
|
+
<Close size={18} />
|
|
20
20
|
</button>
|
|
21
21
|
);
|
|
22
22
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import copy from 'copy-text-to-clipboard';
|
|
2
|
-
import
|
|
2
|
+
import { ContentCopyW700 as ContentCopy } from '@material-symbols-svg/react-rounded/icons/content-copy';
|
|
3
3
|
|
|
4
4
|
export const CopyButton = ({ value }: { value: string }) => (
|
|
5
5
|
<button
|
|
6
6
|
type="button"
|
|
7
7
|
onClick={() => copy(value)}
|
|
8
8
|
className="text-sw-gray-200 hover:text-sw-gray-50 cursor-pointer transition-all duration-300 [transition-timing-function:cubic-bezier(0.175,0.885,0.32,1.275)] active:-translate-y-1 active:scale-x-90 active:scale-y-110">
|
|
9
|
-
<
|
|
9
|
+
<ContentCopy size={16} />
|
|
10
10
|
</button>
|
|
11
11
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { ArrowDownwardW700 as ArrowDownward } from '@material-symbols-svg/react-rounded/icons/arrow-downward';
|
|
2
|
+
import { ProgressActivityW700 as ProgressActivity } from '@material-symbols-svg/react-rounded/icons/progress-activity';
|
|
3
3
|
import { cn } from '@/utils/cn';
|
|
4
4
|
|
|
5
5
|
type Props = {
|
|
@@ -25,11 +25,11 @@ export const DirectionSwitcher = ({
|
|
|
25
25
|
)}>
|
|
26
26
|
{isLoading ? (
|
|
27
27
|
<div className="group relative inline-block">
|
|
28
|
-
<
|
|
28
|
+
<ProgressActivity className="h-sw-2xl w-sw-2xl animate-spin opacity-50 text-sw-accent-500" />
|
|
29
29
|
</div>
|
|
30
30
|
) : (
|
|
31
31
|
<div className="group relative inline-block">
|
|
32
|
-
<
|
|
32
|
+
<ArrowDownward
|
|
33
33
|
className={cn(
|
|
34
34
|
'h-sw-2xl w-sw-2xl transition-transform duration-300',
|
|
35
35
|
{
|
package/src/components/Input.tsx
CHANGED
|
@@ -7,19 +7,20 @@ import {
|
|
|
7
7
|
useState,
|
|
8
8
|
} from 'react';
|
|
9
9
|
import { Input as UIInput } from '@headlessui/react';
|
|
10
|
+
import { CloseW700 as Close } from '@material-symbols-svg/react-rounded/icons/close';
|
|
11
|
+
import type { MaterialSymbolsComponent } from '@material-symbols-svg/react';
|
|
10
12
|
import type { InputProps } from '@headlessui/react';
|
|
11
13
|
import type { PropsWithChildren } from 'react';
|
|
12
|
-
import type { LucideIcon } from 'lucide-react';
|
|
13
|
-
import * as Icons from 'lucide-react';
|
|
14
14
|
|
|
15
15
|
import { cn } from '@/utils/cn';
|
|
16
16
|
|
|
17
17
|
type State = 'default' | 'disabled' | 'error' | 'fixed';
|
|
18
18
|
|
|
19
19
|
export type Props = Omit<InputProps, 'size'> & {
|
|
20
|
-
icon?:
|
|
20
|
+
icon?: MaterialSymbolsComponent;
|
|
21
21
|
defaultValue?: string;
|
|
22
22
|
focusOnMount?: boolean;
|
|
23
|
+
fontSize?: 'sm' | 'md';
|
|
23
24
|
state?: State;
|
|
24
25
|
};
|
|
25
26
|
|
|
@@ -121,7 +122,7 @@ export const Input = forwardRef<HTMLInputElement, PropsWithChildren<Props>>(
|
|
|
121
122
|
},
|
|
122
123
|
)}
|
|
123
124
|
onClick={handleClear}>
|
|
124
|
-
<
|
|
125
|
+
<Close className="h-sw-xl w-sw-xl" />
|
|
125
126
|
</button>
|
|
126
127
|
) : null}
|
|
127
128
|
</div>
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CloseW700 as Close } from '@material-symbols-svg/react-rounded/icons/close';
|
|
2
|
+
import { CheckCircleFillW700 as CheckCircleFill } from '@material-symbols-svg/react-rounded/icons/check-circle';
|
|
2
3
|
|
|
3
4
|
const Error = ({ message }: { message: string }) => (
|
|
4
5
|
<div className="flex flex-col gap-sw-lg py-sw-6xl items-center justify-center">
|
|
5
|
-
<
|
|
6
|
-
size={36}
|
|
7
|
-
strokeWidth={1.5}
|
|
8
|
-
className="text-sw-status-error"
|
|
9
|
-
/>
|
|
6
|
+
<Close size={36} className="text-sw-status-error" />
|
|
10
7
|
<span className="text-sw-label-sm text-sw-status-error">{message}</span>
|
|
11
8
|
</div>
|
|
12
9
|
);
|
|
13
10
|
|
|
14
11
|
const Success = () => (
|
|
15
12
|
<div className="flex flex-col gap-sw-lg py-sw-6xl items-center justify-center">
|
|
16
|
-
<
|
|
17
|
-
size={36}
|
|
18
|
-
strokeWidth={1.5}
|
|
19
|
-
className="text-sw-status-success"
|
|
20
|
-
/>
|
|
13
|
+
<CheckCircleFill size={36} className="text-sw-status-success" />
|
|
21
14
|
<span className="text-sw-label-sm text-sw-status-success text-center">
|
|
22
15
|
Transaction detected
|
|
23
16
|
</span>
|
|
@@ -2,7 +2,7 @@ import { PropsWithChildren, ReactElement } from 'react';
|
|
|
2
2
|
import { cn } from '../utils';
|
|
3
3
|
import { useTheme } from '../hooks/useTheme';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const DEFAULT_FULL_PAGE_BACKGROUND_COLOR = '#24262d';
|
|
6
6
|
|
|
7
7
|
export type WidgetContainerProps = PropsWithChildren<{
|
|
8
8
|
HeaderComponent?: ReactElement | false | null;
|
|
@@ -22,7 +22,10 @@ export const WidgetContainer = ({
|
|
|
22
22
|
|
|
23
23
|
const jsx = (
|
|
24
24
|
<div
|
|
25
|
-
style={{
|
|
25
|
+
style={{
|
|
26
|
+
transform: isFullPage ? 'translateY(15dvh)' : 'none',
|
|
27
|
+
backgroundColor: theme?.backgroundColor,
|
|
28
|
+
}}
|
|
26
29
|
className={cn(
|
|
27
30
|
'w-full h-fit flex flex-col justify-center items-center relative',
|
|
28
31
|
className,
|
|
@@ -53,7 +56,8 @@ export const WidgetContainer = ({
|
|
|
53
56
|
className,
|
|
54
57
|
)}
|
|
55
58
|
style={{
|
|
56
|
-
backgroundColor:
|
|
59
|
+
backgroundColor:
|
|
60
|
+
theme?.backgroundColor ?? DEFAULT_FULL_PAGE_BACKGROUND_COLOR,
|
|
57
61
|
}}>
|
|
58
62
|
<div className="w-full h-fit max-w-[456px] min-w-[270px]">{jsx}</div>
|
|
59
63
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TargetW700 as Target } from '@material-symbols-svg/react-rounded/icons/target';
|
|
2
2
|
|
|
3
3
|
export const AllNetworksIcon = () => (
|
|
4
4
|
<div className="bg-sw-accent-500 flex h-[28px] w-[28px] items-center justify-center">
|
|
5
|
-
<
|
|
5
|
+
<Target size={16} className="text-sw-accent-950" />
|
|
6
6
|
</div>
|
|
7
7
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { CheckW700 as Check } from '@material-symbols-svg/react-rounded/icons/check';
|
|
3
3
|
|
|
4
4
|
import { cn } from '@/utils/cn';
|
|
5
5
|
import { Icon } from '@/components/Icon';
|
|
@@ -34,7 +34,7 @@ export const ChainItem = React.forwardRef<HTMLButtonElement, Props>(
|
|
|
34
34
|
)}>
|
|
35
35
|
<Icon radius={10} label={label} icon={icon} />
|
|
36
36
|
<span className="text-sw-label-md mr-auto">{label}</span>
|
|
37
|
-
{isSelected && <
|
|
37
|
+
{isSelected && <Check size={16} />}
|
|
38
38
|
</button>
|
|
39
39
|
),
|
|
40
40
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, useMemo } from 'react';
|
|
2
2
|
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/react';
|
|
3
|
+
import { ChevronLeftW700 as ChevronLeft } from '@material-symbols-svg/react-rounded/icons/chevron-left';
|
|
3
4
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
4
|
-
import * as Icons from 'lucide-react';
|
|
5
5
|
|
|
6
6
|
import { ChainItem } from './ChainItem';
|
|
7
7
|
import { AllNetworksIcon } from './AllNetworksIcon';
|
|
@@ -79,9 +79,15 @@ export const ChainsDropdown = ({
|
|
|
79
79
|
})()}
|
|
80
80
|
|
|
81
81
|
{isOpen ? (
|
|
82
|
-
<
|
|
82
|
+
<ChevronLeft
|
|
83
|
+
size={18}
|
|
84
|
+
className="text-sw-gray-50 rotate-90"
|
|
85
|
+
/>
|
|
83
86
|
) : (
|
|
84
|
-
<
|
|
87
|
+
<ChevronLeft
|
|
88
|
+
size={18}
|
|
89
|
+
className="text-sw-gray-50 -rotate-90"
|
|
90
|
+
/>
|
|
85
91
|
)}
|
|
86
92
|
</div>
|
|
87
93
|
)}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { QrCodeW700 as QrCode } from '@material-symbols-svg/react-rounded/icons/qr-code';
|
|
2
|
+
import { WalletW700 as Wallet } from '@material-symbols-svg/react-rounded/icons/wallet';
|
|
2
3
|
|
|
3
4
|
import { cn } from '@/utils/cn';
|
|
4
5
|
import { Card } from '@/components/Card';
|
|
@@ -26,7 +27,7 @@ export const DepositMethodSwitcher = ({ children, className }: Props) => {
|
|
|
26
27
|
<div className="flex gap-sw-lg">
|
|
27
28
|
<Button
|
|
28
29
|
size="md"
|
|
29
|
-
icon={
|
|
30
|
+
icon={Wallet}
|
|
30
31
|
state={ctx.isDepositFromExternalWallet ? 'default' : 'active'}
|
|
31
32
|
variant={ctx.isDepositFromExternalWallet ? 'outlined' : 'primary'}
|
|
32
33
|
onClick={() => onToggle(false)}>
|
|
@@ -34,7 +35,7 @@ export const DepositMethodSwitcher = ({ children, className }: Props) => {
|
|
|
34
35
|
</Button>
|
|
35
36
|
<Button
|
|
36
37
|
size="md"
|
|
37
|
-
icon={
|
|
38
|
+
icon={QrCode}
|
|
38
39
|
state={ctx.isDepositFromExternalWallet ? 'active' : 'default'}
|
|
39
40
|
variant={ctx.isDepositFromExternalWallet ? 'primary' : 'outlined'}
|
|
40
41
|
onClick={() => onToggle(true)}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { QRCodeSVG } from 'qrcode.react';
|
|
3
3
|
import { GetExecutionStatusResponse } from '@defuse-protocol/one-click-sdk-typescript';
|
|
4
|
-
import
|
|
4
|
+
import { ProgressActivityW700 as ProgressActivity } from '@material-symbols-svg/react-rounded/icons/progress-activity';
|
|
5
5
|
|
|
6
6
|
import { notReachable } from '@/utils';
|
|
7
7
|
import { CHAIN_IDS_MAP } from '@/constants/chains';
|
|
@@ -50,7 +50,7 @@ const Skeleton = () => {
|
|
|
50
50
|
<div className="flex flex-col gap-sw-2xl items-center">
|
|
51
51
|
<div className="bg-sw-gray-800 h-[180px] w-[180px] animate-pulse rounded-sw-md" />
|
|
52
52
|
<div className="bg-sw-gray-800 h-[44px] w-full animate-pulse rounded-sw-md flex items-center justify-center gap-sw-sm">
|
|
53
|
-
<
|
|
53
|
+
<ProgressActivity className="animate-spin text-sw-gray-100 h-sw-lg w-sw-lg" />
|
|
54
54
|
<span className="text-sw-gray-100 text-sw-label-sm">
|
|
55
55
|
{!isNotEmptyAmount(ctx.sourceTokenAmount)
|
|
56
56
|
? t('deposit.external.loading.waiting', 'Waiting for token amount')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as Icons from 'lucide-react';
|
|
2
1
|
import { Button } from '@headlessui/react';
|
|
3
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
4
3
|
import { useDebounce } from 'use-debounce';
|
|
4
|
+
import { WandShineW700 as WandShine } from '@material-symbols-svg/react-rounded/icons/wand-shine';
|
|
5
5
|
import type { ChangeEvent } from 'react';
|
|
6
6
|
|
|
7
7
|
import { useNotification } from './useNotification';
|
|
@@ -76,6 +76,7 @@ export const SendAddress = ({ error, className, onMsg }: Props) => {
|
|
|
76
76
|
{t('sendAddress.label', 'Send to')}
|
|
77
77
|
</h5>
|
|
78
78
|
<Input
|
|
79
|
+
fontSize="sm"
|
|
79
80
|
defaultValue={ctx.sendAddress}
|
|
80
81
|
state={inputState}
|
|
81
82
|
className="mb-sw-xl"
|
|
@@ -88,7 +89,7 @@ export const SendAddress = ({ error, className, onMsg }: Props) => {
|
|
|
88
89
|
<Button
|
|
89
90
|
className="absolute right-0 flex items-center gap-sw-md min-w-max cursor-pointer"
|
|
90
91
|
onClick={() => fireEvent('addressSet', ctx.walletAddress ?? '')}>
|
|
91
|
-
<
|
|
92
|
+
<WandShine size={14} />
|
|
92
93
|
<span className="text-sw-label-md">
|
|
93
94
|
{t('sendAddress.button.magic.label', 'My wallet')}
|
|
94
95
|
</span>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CheckW700 as Check } from '@material-symbols-svg/react-rounded/icons/check';
|
|
2
2
|
|
|
3
3
|
export const CheckIcon = () => (
|
|
4
4
|
<div className="mb-sw-xl bg-sw-status-success text-sw-gray-950 flex h-[44px] w-[44px] items-center justify-center rounded-full">
|
|
5
|
-
<
|
|
5
|
+
<Check size={24} />
|
|
6
6
|
</div>
|
|
7
7
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { OpenInNewW700 as OpenInNew } from '@material-symbols-svg/react-rounded/icons/open-in-new';
|
|
2
2
|
|
|
3
3
|
type Props = {
|
|
4
4
|
url: string;
|
|
@@ -10,6 +10,6 @@ export const ExternalAction = ({ url }: Props) => (
|
|
|
10
10
|
href={url}
|
|
11
11
|
className="text-sw-accent-300 hover:text-sw-accent-50 cursor-pointer"
|
|
12
12
|
rel="noreferrer">
|
|
13
|
-
<
|
|
13
|
+
<OpenInNew size={16} />
|
|
14
14
|
</a>
|
|
15
15
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { SearchW700 as Search } from '@material-symbols-svg/react-rounded/icons/search';
|
|
1
2
|
import { useRef, useState } from 'react';
|
|
2
|
-
import * as Icons from 'lucide-react';
|
|
3
3
|
|
|
4
4
|
import { TokensList } from './TokensList';
|
|
5
5
|
import { ChainsDropdown } from './ChainsDropdown';
|
|
@@ -99,7 +99,7 @@ export const TokensModal = ({
|
|
|
99
99
|
<div className="gap-sw-xl flex items-center">
|
|
100
100
|
<Input
|
|
101
101
|
focusOnMount
|
|
102
|
-
icon={
|
|
102
|
+
icon={Search}
|
|
103
103
|
ref={searchInputRef}
|
|
104
104
|
defaultValue={search}
|
|
105
105
|
className="w-full"
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from '@material-symbols-svg/react-rounded';
|
|
1
|
+
import { AccountBalanceWalletFillW700 as AccountBalanceWalletFill } from '@material-symbols-svg/react-rounded/icons/account-balance-wallet';
|
|
2
|
+
import { ArmingCountdownFillW700 as ArmingCountdownFill } from '@material-symbols-svg/react-rounded/icons/arming-countdown';
|
|
3
|
+
import { BeenhereFillW700 as BeenhereFill } from '@material-symbols-svg/react-rounded/icons/beenhere';
|
|
4
|
+
import { CheckCircleFillW700 as CheckCircleFill } from '@material-symbols-svg/react-rounded/icons/check-circle';
|
|
5
|
+
import { EncryptedFillW700 as EncryptedFill } from '@material-symbols-svg/react-rounded/icons/encrypted';
|
|
6
|
+
import { GppBadFillW700 as GppBadFill } from '@material-symbols-svg/react-rounded/icons/gpp-bad';
|
|
7
|
+
import type { MaterialSymbolsComponent } from '@material-symbols-svg/react-rounded';
|
|
8
|
+
|
|
10
9
|
import { useTimer } from 'use-timer';
|
|
11
10
|
import { useEffect } from 'react';
|
|
12
11
|
|
package/src/icons/index.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable import/extensions */
|
|
2
|
+
import { ReactElement, SVGAttributes } from 'react';
|
|
2
3
|
import AbgIcon from './abg.svg';
|
|
3
4
|
import ArbIcon from './arb.svg';
|
|
4
5
|
import AsterIcon from './aster.svg';
|
|
@@ -44,7 +45,10 @@ import type { Chains } from '@/types/chain';
|
|
|
44
45
|
|
|
45
46
|
export const UNKNOWN_ICON: React.ReactElement = <UnknownIcon />;
|
|
46
47
|
|
|
47
|
-
export const CHAIN_ICONS: Record<
|
|
48
|
+
export const CHAIN_ICONS: Record<
|
|
49
|
+
Chains,
|
|
50
|
+
ReactElement<SVGAttributes<SVGElement>>
|
|
51
|
+
> = {
|
|
48
52
|
arb: <ArbIcon />,
|
|
49
53
|
avax: <AvaxIcon />,
|
|
50
54
|
base: <BaseIcon />,
|
package/src/index.ts
CHANGED
package/src/tailwind.css
CHANGED
|
@@ -102,6 +102,15 @@
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
@utility text-sw-label-2sm {
|
|
106
|
+
@layer components {
|
|
107
|
+
@apply font-semibold;
|
|
108
|
+
font-size: 0.825rem;
|
|
109
|
+
line-height: 0.875rem;
|
|
110
|
+
letter-spacing: -0.01875rem;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
105
114
|
@utility text-sw-label-sm {
|
|
106
115
|
@layer components {
|
|
107
116
|
@apply font-semibold;
|
|
@@ -4,9 +4,9 @@ import { ColorPalette, ColorScheme, HexColor, Theme } from '../types/theme';
|
|
|
4
4
|
import { ColorStop, createColorPalette } from './createColorPalette';
|
|
5
5
|
import { useConfig } from '@/config';
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const setColorVariable = (
|
|
8
|
+
key: string,
|
|
9
|
+
value: string,
|
|
10
10
|
parentEl: Element | null,
|
|
11
11
|
) => {
|
|
12
12
|
let parentElement = document.body;
|
|
@@ -15,8 +15,16 @@ const setColorVariables = (
|
|
|
15
15
|
parentElement = parentEl;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
parentElement.style.setProperty(`--c-sw-${key}`, value);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const setColorVariables = (
|
|
22
|
+
palette: ColorPalette,
|
|
23
|
+
colorKey: string,
|
|
24
|
+
parentEl: Element | null,
|
|
25
|
+
) => {
|
|
18
26
|
Object.entries(palette).forEach(([key, value]) => {
|
|
19
|
-
|
|
27
|
+
setColorVariable(`${colorKey}-${key}`, value, parentEl);
|
|
20
28
|
});
|
|
21
29
|
};
|
|
22
30
|
|
|
@@ -37,7 +45,14 @@ const setColorPalette = (
|
|
|
37
45
|
};
|
|
38
46
|
|
|
39
47
|
const loadTheme = (parentEl: Element | null, theme: Theme) => {
|
|
40
|
-
const {
|
|
48
|
+
const {
|
|
49
|
+
primaryColor,
|
|
50
|
+
surfaceColor,
|
|
51
|
+
successColor,
|
|
52
|
+
warningColor,
|
|
53
|
+
errorColor,
|
|
54
|
+
colorScheme = 'dark',
|
|
55
|
+
} = theme;
|
|
41
56
|
|
|
42
57
|
if (primaryColor) {
|
|
43
58
|
setColorPalette('accent', 500, parentEl, primaryColor, colorScheme);
|
|
@@ -46,6 +61,18 @@ const loadTheme = (parentEl: Element | null, theme: Theme) => {
|
|
|
46
61
|
if (surfaceColor) {
|
|
47
62
|
setColorPalette('gray', 950, parentEl, surfaceColor, colorScheme);
|
|
48
63
|
}
|
|
64
|
+
|
|
65
|
+
if (successColor) {
|
|
66
|
+
setColorVariable('status-success', successColor, parentEl);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (warningColor) {
|
|
70
|
+
setColorVariable('status-warning', warningColor, parentEl);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (errorColor) {
|
|
74
|
+
setColorVariable('status-error', errorColor, parentEl);
|
|
75
|
+
}
|
|
49
76
|
};
|
|
50
77
|
|
|
51
78
|
export const ThemeContext = createContext<Theme | undefined>(undefined);
|
package/src/types/theme.ts
CHANGED