@rango-dev/widget-embedded 0.40.2-next.9 → 0.41.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.
Files changed (104) hide show
  1. package/dist/components/CustomTokenModal/CustomTokenModal.constants.d.ts +2 -0
  2. package/dist/components/CustomTokenModal/CustomTokenModal.constants.d.ts.map +1 -0
  3. package/dist/components/CustomTokenModal/CustomTokenModal.d.ts.map +1 -1
  4. package/dist/components/CustomTokenModal/CustomTokenModal.types.d.ts +1 -0
  5. package/dist/components/CustomTokenModal/CustomTokenModal.types.d.ts.map +1 -1
  6. package/dist/components/ImportCustomToken/ImportCustomToken.d.ts +4 -0
  7. package/dist/components/ImportCustomToken/ImportCustomToken.d.ts.map +1 -0
  8. package/dist/components/ImportCustomToken/ImportCustomToken.types.d.ts +15 -0
  9. package/dist/components/ImportCustomToken/ImportCustomToken.types.d.ts.map +1 -0
  10. package/dist/components/ImportCustomToken/index.d.ts +2 -0
  11. package/dist/components/ImportCustomToken/index.d.ts.map +1 -0
  12. package/dist/components/Quote/Quote.styles.d.ts +2 -2
  13. package/dist/components/SearchInput/SearchInput.d.ts.map +1 -1
  14. package/dist/components/SearchInput/SearchInput.types.d.ts +4 -2
  15. package/dist/components/SearchInput/SearchInput.types.d.ts.map +1 -1
  16. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +2 -2
  17. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
  18. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  19. package/dist/components/TokenList/TokenList.styles.d.ts +323 -1
  20. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  21. package/dist/components/TokenList/TokenList.types.d.ts +6 -1
  22. package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
  23. package/dist/constants/customTokens.d.ts +1 -0
  24. package/dist/constants/customTokens.d.ts.map +1 -1
  25. package/dist/containers/Inputs/Inputs.d.ts.map +1 -1
  26. package/dist/hooks/useFetchCustomToken.d.ts +8 -4
  27. package/dist/hooks/useFetchCustomToken.d.ts.map +1 -1
  28. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +2 -2
  29. package/dist/hooks/useSearchCustomTokens/index.d.ts +2 -0
  30. package/dist/hooks/useSearchCustomTokens/index.d.ts.map +1 -0
  31. package/dist/hooks/useSearchCustomTokens/types.d.ts +9 -0
  32. package/dist/hooks/useSearchCustomTokens/types.d.ts.map +1 -0
  33. package/dist/hooks/useSearchCustomTokens/useSearchCustomTokens.constants.d.ts +2 -0
  34. package/dist/hooks/useSearchCustomTokens/useSearchCustomTokens.constants.d.ts.map +1 -0
  35. package/dist/hooks/useSearchCustomTokens/useSearchCustomTokens.d.ts +3 -0
  36. package/dist/hooks/useSearchCustomTokens/useSearchCustomTokens.d.ts.map +1 -0
  37. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  38. package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.d.ts.map +1 -1
  39. package/dist/index.js +2 -2
  40. package/dist/index.js.map +4 -4
  41. package/dist/pages/AddCustomTokenPage.d.ts.map +1 -1
  42. package/dist/pages/CustomTokensPage.d.ts.map +1 -1
  43. package/dist/pages/SelectSwapItemPage/SelectSwapItemPage.constants.d.ts +3 -0
  44. package/dist/pages/SelectSwapItemPage/SelectSwapItemPage.constants.d.ts.map +1 -0
  45. package/dist/pages/SelectSwapItemPage/SelectSwapItemPage.helpers.d.ts +4 -0
  46. package/dist/pages/SelectSwapItemPage/SelectSwapItemPage.helpers.d.ts.map +1 -0
  47. package/dist/pages/SelectSwapItemPage/SelectSwapItemsPage.d.ts.map +1 -0
  48. package/dist/pages/SelectSwapItemPage/index.d.ts +2 -0
  49. package/dist/pages/SelectSwapItemPage/index.d.ts.map +1 -0
  50. package/dist/store/app.d.ts +1 -1
  51. package/dist/store/app.d.ts.map +1 -1
  52. package/dist/store/quote.d.ts +9 -6
  53. package/dist/store/quote.d.ts.map +1 -1
  54. package/dist/store/slices/settings.d.ts +4 -2
  55. package/dist/store/slices/settings.d.ts.map +1 -1
  56. package/dist/store/slices/wallets.d.ts +5 -1
  57. package/dist/store/slices/wallets.d.ts.map +1 -1
  58. package/dist/store/utils/wallets.d.ts +2 -1
  59. package/dist/store/utils/wallets.d.ts.map +1 -1
  60. package/dist/utils/quote.d.ts +1 -1
  61. package/dist/utils/quote.d.ts.map +1 -1
  62. package/dist/utils/settings.d.ts +1 -1
  63. package/dist/widget-embedded.build.json +1 -1
  64. package/package.json +12 -12
  65. package/src/components/AppRoutes.tsx +1 -1
  66. package/src/components/CustomTokenModal/CustomTokenModal.constants.ts +2 -0
  67. package/src/components/CustomTokenModal/CustomTokenModal.tsx +26 -5
  68. package/src/components/CustomTokenModal/CustomTokenModal.types.ts +1 -0
  69. package/src/components/ImportCustomToken/ImportCustomToken.tsx +121 -0
  70. package/src/components/ImportCustomToken/ImportCustomToken.types.ts +18 -0
  71. package/src/components/ImportCustomToken/index.ts +1 -0
  72. package/src/components/NotificationContent/NotificationContent.tsx +2 -2
  73. package/src/components/Quote/QuoteTrigger.tsx +5 -5
  74. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +2 -2
  75. package/src/components/QuoteSkeleton/StepSkeleton.tsx +2 -2
  76. package/src/components/SearchInput/SearchInput.tsx +13 -10
  77. package/src/components/SearchInput/SearchInput.types.ts +4 -2
  78. package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +2 -2
  79. package/src/components/TokenList/TokenList.styles.ts +40 -0
  80. package/src/components/TokenList/TokenList.tsx +134 -22
  81. package/src/components/TokenList/TokenList.types.ts +5 -1
  82. package/src/constants/customTokens.ts +3 -0
  83. package/src/containers/Inputs/Inputs.tsx +6 -4
  84. package/src/hooks/useFetchCustomToken.ts +39 -16
  85. package/src/hooks/useSearchCustomTokens/index.ts +1 -0
  86. package/src/hooks/useSearchCustomTokens/types.ts +9 -0
  87. package/src/hooks/useSearchCustomTokens/useSearchCustomTokens.constants.ts +1 -0
  88. package/src/hooks/useSearchCustomTokens/useSearchCustomTokens.ts +81 -0
  89. package/src/hooks/useSyncStoresWithConfig.ts +2 -3
  90. package/src/hooks/useSyncUrlAndStore/useSyncUrlAndStore.ts +1 -3
  91. package/src/pages/AddCustomTokenPage.tsx +24 -94
  92. package/src/pages/CustomTokensPage.tsx +1 -0
  93. package/src/pages/SelectSwapItemPage/SelectSwapItemPage.constants.ts +2 -0
  94. package/src/pages/SelectSwapItemPage/SelectSwapItemPage.helpers.ts +51 -0
  95. package/src/pages/{SelectSwapItemsPage.tsx → SelectSwapItemPage/SelectSwapItemsPage.tsx} +54 -13
  96. package/src/pages/SelectSwapItemPage/index.ts +1 -0
  97. package/src/store/app.ts +12 -1
  98. package/src/store/quote.ts +6 -3
  99. package/src/store/slices/settings.ts +11 -4
  100. package/src/store/slices/wallets.ts +105 -2
  101. package/src/store/utils/wallets.ts +31 -2
  102. package/src/utils/quote.ts +1 -1
  103. package/dist/pages/SelectSwapItemsPage.d.ts.map +0 -1
  104. /package/dist/pages/{SelectSwapItemsPage.d.ts → SelectSwapItemPage/SelectSwapItemsPage.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.40.2-next.9",
3
+ "version": "0.41.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -24,16 +24,16 @@
24
24
  "dependencies": {
25
25
  "@lingui/core": "4.2.1",
26
26
  "@lingui/react": "4.2.1",
27
- "@rango-dev/logging-core": "^0.7.1-next.1",
28
- "@rango-dev/provider-all": "^0.43.1-next.5",
29
- "@rango-dev/queue-manager-core": "^0.28.1-next.0",
30
- "@rango-dev/queue-manager-rango-preset": "^0.43.1-next.5",
31
- "@rango-dev/queue-manager-react": "^0.28.1-next.0",
32
- "@rango-dev/signer-solana": "^0.37.1-next.2",
33
- "@rango-dev/ui": "^0.44.1-next.5",
34
- "@rango-dev/wallets-core": "^0.41.1-next.4",
35
- "@rango-dev/wallets-react": "^0.28.1-next.4",
36
- "@rango-dev/wallets-shared": "^0.42.1-next.4",
27
+ "@rango-dev/logging-core": "^0.8.0",
28
+ "@rango-dev/provider-all": "^0.44.0",
29
+ "@rango-dev/queue-manager-core": "^0.29.0",
30
+ "@rango-dev/queue-manager-rango-preset": "^0.44.0",
31
+ "@rango-dev/queue-manager-react": "^0.29.0",
32
+ "@rango-dev/signer-solana": "^0.38.0",
33
+ "@rango-dev/ui": "^0.45.0",
34
+ "@rango-dev/wallets-core": "^0.42.0",
35
+ "@rango-dev/wallets-react": "^0.29.0",
36
+ "@rango-dev/wallets-shared": "^0.43.0",
37
37
  "bignumber.js": "^9.1.1",
38
38
  "copy-to-clipboard": "^3.3.3",
39
39
  "dayjs": "^1.11.7",
@@ -54,4 +54,4 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  }
57
- }
57
+ }
@@ -13,7 +13,7 @@ import { LanguagePage } from '../pages/LanguagePage';
13
13
  import { LiquiditySourcePage } from '../pages/LiquiditySourcePage';
14
14
  import { RoutesPage } from '../pages/Routes';
15
15
  import { SelectBlockchainPage } from '../pages/SelectBlockchainPage';
16
- import { SelectSwapItemsPage } from '../pages/SelectSwapItemsPage';
16
+ import { SelectSwapItemsPage } from '../pages/SelectSwapItemPage/index';
17
17
  import { SettingsPage } from '../pages/SettingsPage';
18
18
  import { SwapDetailsPage } from '../pages/SwapDetailsPage';
19
19
  import { WalletsPage } from '../pages/WalletsPage';
@@ -0,0 +1,2 @@
1
+ export const CUSTOM_TOKEN_LEARN_MORE_LINK =
2
+ 'https://blog.rango.exchange/understanding-the-risks-of-using-custom-token-contract-addresses-96022308eca4';
@@ -10,27 +10,38 @@ import {
10
10
  } from '@rango-dev/ui';
11
11
  import React from 'react';
12
12
 
13
+ import { DEFAULT_TOKEN_IMAGE_SRC } from '../../constants/customTokens';
13
14
  import { getContainer } from '../../utils/common';
14
15
  import { WatermarkedModal } from '../common/WatermarkedModal';
15
16
 
17
+ import { CUSTOM_TOKEN_LEARN_MORE_LINK } from './CustomTokenModal.constants';
16
18
  import { generateExplorerLink } from './CustomTokenModal.helpers';
17
19
  import { Container, StyledLink } from './CustomTokenModal.styles';
18
20
 
19
21
  export function CustomTokenModal(props: PropTypes) {
20
- const { open, onClose, token, onSubmitClick, blockchain } = props;
22
+ const { open, onClose, token, onExit, onSubmitClick, blockchain } = props;
21
23
 
22
24
  const explorerLink = generateExplorerLink(token.address, blockchain);
23
25
 
26
+ const onClickLearnMore = () =>
27
+ window.open(CUSTOM_TOKEN_LEARN_MORE_LINK, '_blank');
28
+
24
29
  return (
25
30
  <WatermarkedModal
26
31
  open={open}
27
32
  dismissible
28
33
  onClose={onClose}
34
+ onExit={onExit}
29
35
  container={getContainer()}>
30
36
  <Container>
31
- <Image src={token.image} size={45} type="circular" />
37
+ <Image
38
+ src={token.image === '' ? DEFAULT_TOKEN_IMAGE_SRC : token.image}
39
+ size={45}
40
+ type="circular"
41
+ />
42
+ <Divider size={4} />
32
43
  <Typography variant="title" size="medium">
33
- {token.name}
44
+ {token.symbol}
34
45
  </Typography>
35
46
  <Typography variant="body" size="small" className="_blockchain-name">
36
47
  {blockchain.displayName}
@@ -72,7 +83,7 @@ export function CustomTokenModal(props: PropTypes) {
72
83
  variant="body"
73
84
  className="_custom-token-description">
74
85
  {i18n.t(
75
- `This token doesn't appear on the active token list(s). Make sure this is the token that you want to trade.`
86
+ `This token is not part of our verified token list. please verify its source and make sure to understand all associated risks before proceeding.`
76
87
  )}
77
88
  </Typography>
78
89
  </Container>
@@ -86,7 +97,17 @@ export function CustomTokenModal(props: PropTypes) {
86
97
  type="primary"
87
98
  fullWidth
88
99
  onClick={onSubmitClick}>
89
- {i18n.t('Import')}
100
+ {i18n.t('Import Anyway')}
101
+ </Button>
102
+ <Divider size={10} />
103
+ <Button
104
+ id="widget-custom-token-modal-learn-more-btn"
105
+ variant="outlined"
106
+ size="large"
107
+ type="primary"
108
+ fullWidth
109
+ onClick={onClickLearnMore}>
110
+ {i18n.t('Learn More')}
90
111
  </Button>
91
112
  </WatermarkedModal>
92
113
  );
@@ -3,6 +3,7 @@ import type { BlockchainMeta, Token } from 'rango-sdk';
3
3
  export type PropTypes = {
4
4
  open: boolean;
5
5
  onClose: () => void;
6
+ onExit: () => void;
6
7
  onSubmitClick: () => void;
7
8
  token: Token;
8
9
  blockchain: BlockchainMeta;
@@ -0,0 +1,121 @@
1
+ import type { PropTypes } from './ImportCustomToken.types';
2
+
3
+ import { i18n } from '@lingui/core';
4
+ import { Button, Divider, MessageBox } from '@rango-dev/ui';
5
+ import React, { useEffect, useState } from 'react';
6
+
7
+ import { useAppStore } from '../../store/AppStore';
8
+ import { getContainer } from '../../utils/common';
9
+ import { WatermarkedModal } from '../common/WatermarkedModal';
10
+ import { CustomTokenModal } from '../CustomTokenModal';
11
+
12
+ export function ImportCustomToken(props: PropTypes) {
13
+ const {
14
+ token,
15
+ blockchain,
16
+ error,
17
+ address,
18
+ fetchCustomToken,
19
+ onCloseErrorModal,
20
+ onImport,
21
+ onExitErrorModal,
22
+ onExitImportModal,
23
+ } = props;
24
+ const { setCustomToken } = useAppStore();
25
+ const [showErrorModal, setShowErrorModal] = useState<boolean>(false);
26
+ const [showImportModal, setShowImportModal] = useState<boolean>(false);
27
+ const [retryClicked, setRetryClicked] = useState(false);
28
+
29
+ const getCustomToken = () => {
30
+ if (blockchain) {
31
+ void fetchCustomToken?.({
32
+ blockchain: blockchain.name,
33
+ tokenAddress: address,
34
+ });
35
+ }
36
+ };
37
+
38
+ const closeErrorModal = () => {
39
+ if (error?.type !== 'network-error') {
40
+ onCloseErrorModal?.();
41
+ }
42
+ setShowErrorModal(false);
43
+ };
44
+
45
+ const handleErrorModalButtonClick = () => {
46
+ setRetryClicked(true);
47
+ closeErrorModal();
48
+ };
49
+
50
+ const handleExit = () => {
51
+ if (retryClicked && error?.type === 'network-error') {
52
+ setRetryClicked(false);
53
+ void getCustomToken();
54
+ }
55
+ onExitErrorModal();
56
+ };
57
+
58
+ const handleSubmit = () => {
59
+ if (token) {
60
+ setCustomToken(token);
61
+ onImport();
62
+ }
63
+ };
64
+
65
+ useEffect(() => {
66
+ if (!!error) {
67
+ setShowErrorModal(true);
68
+ }
69
+ }, [error]);
70
+
71
+ useEffect(() => {
72
+ if (blockchain && token) {
73
+ setShowImportModal(true);
74
+ }
75
+ }, [blockchain, token]);
76
+
77
+ return (
78
+ <>
79
+ <WatermarkedModal
80
+ open={showErrorModal}
81
+ dismissible
82
+ onClose={closeErrorModal}
83
+ onExit={handleExit}
84
+ container={getContainer()}>
85
+ <MessageBox
86
+ title={error?.title ?? ''}
87
+ type="error"
88
+ description={
89
+ error?.message || i18n.t('Failed Network, Please retry.')
90
+ }>
91
+ <Divider size={40} />
92
+ <Divider size={10} />
93
+ {/* eslint-disable-next-line jsx-id-attribute-enforcement/missing-ids */}
94
+ <Button
95
+ id={`widget-add-custom-token-${
96
+ error?.type === 'network-error' ? 'retry' : 'add-another'
97
+ }-btn`}
98
+ variant="contained"
99
+ size="large"
100
+ type="primary"
101
+ fullWidth
102
+ onClick={handleErrorModalButtonClick}>
103
+ {error?.type === 'network-error'
104
+ ? i18n.t('Retry')
105
+ : i18n.t('Add another custom token')}
106
+ </Button>
107
+ </MessageBox>
108
+ </WatermarkedModal>
109
+ {blockchain && token && (
110
+ <CustomTokenModal
111
+ blockchain={blockchain}
112
+ token={token}
113
+ onSubmitClick={handleSubmit}
114
+ onClose={() => setShowImportModal(false)}
115
+ open={showImportModal}
116
+ onExit={onExitImportModal}
117
+ />
118
+ )}
119
+ </>
120
+ );
121
+ }
@@ -0,0 +1,18 @@
1
+ import type {
2
+ CustomTokenError,
3
+ UseFetchCustomToken,
4
+ } from '../../hooks/useFetchCustomToken';
5
+ import type { TokenData } from '../TokenList/TokenList.types';
6
+ import type { BlockchainMeta } from 'rango-sdk';
7
+
8
+ export type PropTypes = {
9
+ token: TokenData | null;
10
+ error?: CustomTokenError;
11
+ blockchain?: BlockchainMeta;
12
+ address: string;
13
+ fetchCustomToken?: UseFetchCustomToken['fetchCustomToken'];
14
+ onCloseErrorModal?: () => void;
15
+ onImport: () => void;
16
+ onExitErrorModal: () => void;
17
+ onExitImportModal: () => void;
18
+ };
@@ -0,0 +1 @@
1
+ export { ImportCustomToken } from './ImportCustomToken';
@@ -26,9 +26,9 @@ export function NotificationContent() {
26
26
  <Notifications
27
27
  list={notifications}
28
28
  getBlockchainImage={(blockchain) =>
29
- getBlockchainImage(blockchain, blockchains) ?? ''
29
+ getBlockchainImage(blockchain, blockchains)
30
30
  }
31
- getTokenImage={(token) => findToken(token)?.image ?? ''}
31
+ getTokenImage={(token) => findToken(token)?.image}
32
32
  onClickItem={onClickItem}
33
33
  onClearAll={clearNotifications}
34
34
  />
@@ -77,7 +77,7 @@ export function QuoteTrigger(props: QuoteTriggerProps) {
77
77
  <React.Fragment key={key}>
78
78
  <ImageComponent
79
79
  content={step.swapper.displayName}
80
- src={step.swapper.image}
80
+ src={step.swapper.image ?? ''}
81
81
  state={step.state}
82
82
  container={container}
83
83
  />
@@ -90,7 +90,7 @@ export function QuoteTrigger(props: QuoteTriggerProps) {
90
90
  <>
91
91
  <ImageComponent
92
92
  content={step.swapper.displayName}
93
- src={step.swapper.image}
93
+ src={step.swapper.image ?? ''}
94
94
  state={step.state}
95
95
  container={container}
96
96
  />
@@ -113,7 +113,7 @@ export function QuoteTrigger(props: QuoteTriggerProps) {
113
113
  <React.Fragment key={key}>
114
114
  <ImageComponent
115
115
  content={step.swapper.displayName}
116
- src={step.swapper.image}
116
+ src={step.swapper.image ?? ''}
117
117
  state={step.state}
118
118
  open={false}
119
119
  />
@@ -162,7 +162,7 @@ export function QuoteTrigger(props: QuoteTriggerProps) {
162
162
  sideOffset={4}>
163
163
  <ImageComponent
164
164
  content={''}
165
- src={blockchain.image}
165
+ src={blockchain.image ?? ''}
166
166
  open={false}
167
167
  className={index !== 0 ? 'blockchainImage' : ''}
168
168
  />
@@ -182,7 +182,7 @@ export function QuoteTrigger(props: QuoteTriggerProps) {
182
182
  <ImageComponent
183
183
  key={chain.displayName}
184
184
  content={''}
185
- src={chain.image}
185
+ src={chain.image ?? ''}
186
186
  open={false}
187
187
  className={i > index ? 'blockchainImage' : ''}
188
188
  container={container}
@@ -23,7 +23,7 @@ export function QuoteSummarySkeleton(props: PropTypes) {
23
23
  const quotePreview = (
24
24
  <QuoteSummary>
25
25
  <TokenAmount>
26
- <ChainToken loading size="medium" chainImage="" tokenImage="" />
26
+ <ChainToken loading size="medium" />
27
27
  <Divider size={8} direction="horizontal" />
28
28
  <TokenAmountLabel>
29
29
  <Skeleton height={10} width={60} variant="rounded" />
@@ -72,7 +72,7 @@ export function QuoteSummarySkeleton(props: PropTypes) {
72
72
  {type === 'list-item' && (
73
73
  <Output>
74
74
  <OutputTokenInfo>
75
- <ChainToken loading size="medium" chainImage="" tokenImage="" />
75
+ <ChainToken loading size="medium" />
76
76
  <Divider direction="horizontal" size={4} />
77
77
  <Skeleton height={15} width={150} variant="rounded" />
78
78
  </OutputTokenInfo>
@@ -25,7 +25,7 @@ export function StepSkeleton(props: PropTypes) {
25
25
  <StepSeparator hideSeparator={!separator} />
26
26
  <StepTokens extraSpace={separator}>
27
27
  <StepTokenInfo>
28
- <ChainToken size="small" loading chainImage="" tokenImage="" />
28
+ <ChainToken size="small" loading />
29
29
  <Divider direction="horizontal" size={8} />
30
30
  <Skeleton height={12} variant="rounded" />
31
31
  </StepTokenInfo>
@@ -33,7 +33,7 @@ export function StepSkeleton(props: PropTypes) {
33
33
  <NextIcon color="gray" size={16} />
34
34
  </StepIconContainer>
35
35
  <StepTokenInfo>
36
- <ChainToken size="small" loading chainImage="" tokenImage="" />
36
+ <ChainToken size="small" loading />
37
37
  <Divider direction="horizontal" size={8} />
38
38
  <Skeleton height={12} variant="rounded" />
39
39
  </StepTokenInfo>
@@ -15,9 +15,21 @@ export function SearchInput(props: PropTypes) {
15
15
  value,
16
16
  style,
17
17
  setValue,
18
+ suffix,
18
19
  ...inputAttributes
19
20
  } = props;
20
21
 
22
+ let inputSuffix = !!value.length ? (
23
+ // eslint-disable-next-line jsx-id-attribute-enforcement/missing-ids
24
+ <IconButton variant="ghost" onClick={() => setValue?.('')} size="small">
25
+ <CloseIcon color="gray" size={10} />
26
+ </IconButton>
27
+ ) : null;
28
+
29
+ if (suffix) {
30
+ inputSuffix = suffix;
31
+ }
32
+
21
33
  return (
22
34
  <TextField
23
35
  prefix={
@@ -25,16 +37,7 @@ export function SearchInput(props: PropTypes) {
25
37
  <SearchIcon color="black" />
26
38
  </IconWrapper>
27
39
  }
28
- suffix={
29
- !!value.length && (
30
- <IconButton
31
- variant="ghost"
32
- onClick={() => setValue?.('')}
33
- size="small">
34
- <CloseIcon color="gray" size={10} />
35
- </IconButton>
36
- )
37
- }
40
+ suffix={inputSuffix}
38
41
  fullWidth={fullWidth}
39
42
  color={color}
40
43
  variant={variant}
@@ -1,5 +1,6 @@
1
+ import type { TextField } from '@rango-dev/ui';
1
2
  import type * as Stitches from '@stitches/react';
2
- import type React from 'react';
3
+ import type { ComponentProps, ReactElement } from 'react';
3
4
 
4
5
  export type PropTypes = {
5
6
  variant?: 'contained' | 'outlined' | 'ghost';
@@ -9,4 +10,5 @@ export type PropTypes = {
9
10
  value: string;
10
11
  setValue?: (value: string) => void;
11
12
  style?: Stitches.CSS;
12
- } & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'value'>;
13
+ suffix?: ReactElement;
14
+ } & ComponentProps<typeof TextField>;
@@ -31,11 +31,11 @@ export interface CompleteModalPropTypes {
31
31
  percentageChange: string;
32
32
  chain: {
33
33
  displayName?: string;
34
- image: string;
34
+ image?: string;
35
35
  };
36
36
  token: {
37
37
  displayName: string;
38
- image: string;
38
+ image?: string;
39
39
  };
40
40
  description?: React.ReactNode;
41
41
  diagnosisUrl?: string | null;
@@ -2,6 +2,7 @@ import {
2
2
  css,
3
3
  darkTheme,
4
4
  ImageContainer,
5
+ ListItemButton,
5
6
  styled,
6
7
  Typography,
7
8
  } from '@rango-dev/ui';
@@ -102,6 +103,18 @@ export const List = styled('ul', {
102
103
  },
103
104
  });
104
105
 
106
+ export const StyledListItemButton = styled(ListItemButton, {
107
+ variants: {
108
+ customToken: {
109
+ true: {
110
+ '&:hover': {
111
+ cursor: 'unset',
112
+ },
113
+ },
114
+ },
115
+ },
116
+ });
117
+
105
118
  export const Tag = styled('div', {
106
119
  paddingLeft: '$5',
107
120
  paddingRight: '$5',
@@ -165,3 +178,30 @@ export const StyledLink = styled('a', {
165
178
  color: '$colors$info',
166
179
  },
167
180
  });
181
+
182
+ export const ListItemContainer = styled('div', {
183
+ paddingRight: '$5',
184
+
185
+ '& .widget-token-list-item-btn': {
186
+ width: '100%',
187
+ overflow: 'hidden',
188
+ height: '60px',
189
+ },
190
+
191
+ '& .widget-token-list-item-import-btn': {
192
+ height: '$20',
193
+ padding: '0 $10',
194
+
195
+ '& ._text': {
196
+ display: 'flex',
197
+ justifyContent: 'center',
198
+ alignItems: 'center',
199
+ },
200
+
201
+ '& ._typography': {
202
+ [`.${darkTheme} &`]: {
203
+ color: '$foreground',
204
+ },
205
+ },
206
+ },
207
+ });