@rango-dev/ui 0.23.0 → 0.24.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 (211) hide show
  1. package/CHANGELOG.md +1 -86
  2. package/dist/index.js +6 -6
  3. package/dist/index.js.map +4 -4
  4. package/dist/translations/en.d.ts.map +1 -1
  5. package/dist/translations/es.d.ts.map +1 -1
  6. package/dist/translations/fr.d.ts.map +1 -1
  7. package/dist/translations/ja.d.ts.map +1 -1
  8. package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts +0 -157
  9. package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts.map +1 -1
  10. package/dist/widget/ui/src/components/BestRoute/BestRoute.d.ts +4 -0
  11. package/dist/widget/ui/src/components/BestRoute/BestRoute.d.ts.map +1 -0
  12. package/dist/widget/ui/src/components/BestRoute/BestRoute.stories.d.ts +7 -0
  13. package/dist/widget/ui/src/components/BestRoute/BestRoute.stories.d.ts.map +1 -0
  14. package/dist/widget/ui/src/components/BestRoute/BestRoute.styles.d.ts +1429 -0
  15. package/dist/widget/ui/src/components/BestRoute/BestRoute.styles.d.ts.map +1 -0
  16. package/dist/widget/ui/src/components/BestRoute/BestRoute.types.d.ts +34 -0
  17. package/dist/widget/ui/src/components/BestRoute/BestRoute.types.d.ts.map +1 -0
  18. package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.d.ts +4 -0
  19. package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.d.ts.map +1 -0
  20. package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.styles.d.ts +319 -0
  21. package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.styles.d.ts.map +1 -0
  22. package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.types.d.ts +6 -0
  23. package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.types.d.ts.map +1 -0
  24. package/dist/widget/ui/src/components/BestRoute/RouteSummary.d.ts +12 -0
  25. package/dist/widget/ui/src/components/BestRoute/RouteSummary.d.ts.map +1 -0
  26. package/dist/widget/ui/src/components/BestRoute/RouteSummary.styles.d.ts +158 -0
  27. package/dist/widget/ui/src/components/BestRoute/RouteSummary.styles.d.ts.map +1 -0
  28. package/dist/widget/ui/src/components/BestRoute/index.d.ts +5 -0
  29. package/dist/widget/ui/src/components/BestRoute/index.d.ts.map +1 -0
  30. package/dist/widget/ui/src/components/BestRoute/mock.d.ts +3 -0
  31. package/dist/widget/ui/src/components/BestRoute/mock.d.ts.map +1 -0
  32. package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +1 -1
  33. package/dist/widget/ui/src/components/Button/Button.d.ts +54 -54
  34. package/dist/widget/ui/src/components/Button/Button.styles.d.ts.map +1 -1
  35. package/dist/widget/ui/src/components/Checkbox/Checkbox.styles.d.ts.map +1 -1
  36. package/dist/widget/ui/src/components/ListItem/ListItem.styles.d.ts.map +1 -1
  37. package/dist/widget/ui/src/components/ListItemButton/ListItemButton.styles.d.ts.map +1 -1
  38. package/dist/widget/ui/src/components/PriceImpact/PriceImpact.styles.d.ts +0 -158
  39. package/dist/widget/ui/src/components/PriceImpact/PriceImpact.styles.d.ts.map +1 -1
  40. package/dist/widget/ui/src/components/Radio/Radio.styles.d.ts.map +1 -1
  41. package/dist/widget/ui/src/components/RouteCost/RouteCost.d.ts +4 -0
  42. package/dist/widget/ui/src/components/RouteCost/RouteCost.d.ts.map +1 -0
  43. package/dist/widget/ui/src/components/RouteCost/RouteCost.styles.d.ts +158 -0
  44. package/dist/widget/ui/src/components/RouteCost/RouteCost.styles.d.ts.map +1 -0
  45. package/dist/widget/ui/src/components/{QuoteCost/QuoteCost.types.d.ts → RouteCost/RouteCost.types.d.ts} +1 -1
  46. package/dist/widget/ui/src/components/RouteCost/RouteCost.types.d.ts.map +1 -0
  47. package/dist/widget/ui/src/components/RouteCost/index.d.ts +2 -0
  48. package/dist/widget/ui/src/components/RouteCost/index.d.ts.map +1 -0
  49. package/dist/widget/ui/src/components/RoutesOverview/RoutesOverview.d.ts.map +1 -1
  50. package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +1 -1
  51. package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +2 -16
  52. package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +1 -1
  53. package/dist/widget/ui/src/components/SelectableCategoryList/index.d.ts +0 -1
  54. package/dist/widget/ui/src/components/SelectableCategoryList/index.d.ts.map +1 -1
  55. package/dist/widget/ui/src/components/Skeleton/Skeleton.d.ts.map +1 -1
  56. package/dist/widget/ui/src/components/Skeleton/Skeleton.types.d.ts +1 -1
  57. package/dist/widget/ui/src/components/Skeleton/Skeleton.types.d.ts.map +1 -1
  58. package/dist/widget/ui/src/components/StepDetails/StepDetails.d.ts.map +1 -1
  59. package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts +1 -7
  60. package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts.map +1 -1
  61. package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts +2 -16
  62. package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts.map +1 -1
  63. package/dist/widget/ui/src/components/StepDetails/index.d.ts +1 -1
  64. package/dist/widget/ui/src/components/StepDetails/index.d.ts.map +1 -1
  65. package/dist/widget/ui/src/components/StepDetails/mock.d.ts +1 -1
  66. package/dist/widget/ui/src/components/StepDetails/mock.d.ts.map +1 -1
  67. package/dist/widget/ui/src/components/SwapListItem/mock.d.ts +1 -1
  68. package/dist/widget/ui/src/components/SwapListItem/mock.d.ts.map +1 -1
  69. package/dist/widget/ui/src/components/Switch/Switch.styles.d.ts.map +1 -1
  70. package/dist/widget/ui/src/components/TextField/TextField.d.ts.map +1 -1
  71. package/dist/widget/ui/src/components/TokenAmount/TokenAmount.d.ts.map +1 -1
  72. package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts +1 -471
  73. package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts.map +1 -1
  74. package/dist/widget/ui/src/components/Tooltip/Tooltip.d.ts.map +1 -1
  75. package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts +2 -2
  76. package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts.map +1 -1
  77. package/dist/widget/ui/src/components/Wallet/Wallet.types.d.ts +17 -3
  78. package/dist/widget/ui/src/components/Wallet/Wallet.types.d.ts.map +1 -1
  79. package/dist/widget/ui/src/components/common/Image.d.ts +0 -157
  80. package/dist/widget/ui/src/components/common/Image.d.ts.map +1 -1
  81. package/dist/widget/ui/src/components/common/index.d.ts +1 -1
  82. package/dist/widget/ui/src/components/common/index.d.ts.map +1 -1
  83. package/dist/widget/ui/src/components/index.d.ts +2 -1
  84. package/dist/widget/ui/src/components/index.d.ts.map +1 -1
  85. package/dist/widget/ui/src/containers/BlockchainSelector/BlockchainSelector.d.ts +3 -3
  86. package/dist/widget/ui/src/containers/BlockchainSelector/BlockchainSelector.d.ts.map +1 -1
  87. package/dist/widget/ui/src/containers/History/types.d.ts +2 -0
  88. package/dist/widget/ui/src/containers/History/types.d.ts.map +1 -0
  89. package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.d.ts +1 -1
  90. package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.d.ts.map +1 -1
  91. package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.stories.d.ts +2 -2
  92. package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.stories.d.ts.map +1 -1
  93. package/dist/widget/ui/src/containers/SwapHistory/mock.d.ts +1 -1
  94. package/dist/widget/ui/src/containers/SwapHistory/mock.d.ts.map +1 -1
  95. package/dist/widget/ui/src/containers/SwapInput/SwapInput.d.ts.map +1 -1
  96. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts +54 -1313
  97. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts.map +1 -1
  98. package/dist/widget/ui/src/containers/SwapInput/SwapInput.types.d.ts +0 -2
  99. package/dist/widget/ui/src/containers/SwapInput/SwapInput.types.d.ts.map +1 -1
  100. package/dist/widget/ui/src/containers/SwapInput/TokenSection.d.ts.map +1 -1
  101. package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts +54 -525
  102. package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts.map +1 -1
  103. package/dist/widget/ui/src/containers/TokenSelector/TokenSelector.d.ts +2 -2
  104. package/dist/widget/ui/src/containers/TokenSelector/TokenSelector.d.ts.map +1 -1
  105. package/dist/widget/ui/src/{utils → helper}/index.d.ts +3 -0
  106. package/dist/widget/ui/src/helper/index.d.ts.map +1 -0
  107. package/dist/widget/ui/src/icons/Icons.stories.d.ts +1 -1
  108. package/dist/widget/ui/src/icons/index.d.ts +0 -5
  109. package/dist/widget/ui/src/icons/index.d.ts.map +1 -1
  110. package/dist/widget/ui/src/index.d.ts +1 -0
  111. package/dist/widget/ui/src/index.d.ts.map +1 -1
  112. package/dist/widget/ui/src/types/index.d.ts +1 -0
  113. package/dist/widget/ui/src/types/index.d.ts.map +1 -1
  114. package/dist/widget/ui/src/types/swaps.d.ts +27 -1
  115. package/dist/widget/ui/src/types/swaps.d.ts.map +1 -1
  116. package/package.json +5 -6
  117. package/src/components/Alert/Alert.styles.ts +12 -9
  118. package/src/components/Alert/Alert.tsx +2 -2
  119. package/src/components/BestRoute/BestRoute.stories.tsx +17 -0
  120. package/src/components/BestRoute/BestRoute.styles.ts +213 -0
  121. package/src/components/BestRoute/BestRoute.tsx +176 -0
  122. package/src/components/BestRoute/BestRoute.types.ts +32 -0
  123. package/src/components/BestRoute/BestRouteSkeleton.styles.ts +110 -0
  124. package/src/components/BestRoute/BestRouteSkeleton.tsx +112 -0
  125. package/src/components/BestRoute/BestRouteSkeleton.types.ts +5 -0
  126. package/src/components/BestRoute/RouteSummary.styles.ts +15 -0
  127. package/src/components/BestRoute/RouteSummary.tsx +48 -0
  128. package/src/components/BestRoute/index.ts +4 -0
  129. package/src/components/BestRoute/mock.ts +142 -0
  130. package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +1 -2
  131. package/src/components/Button/Button.styles.tsx +0 -1
  132. package/src/components/Checkbox/Checkbox.styles.ts +1 -5
  133. package/src/components/ListItem/ListItem.styles.ts +0 -9
  134. package/src/components/ListItem/ListItem.tsx +1 -1
  135. package/src/components/ListItemButton/ListItemButton.styles.ts +0 -1
  136. package/src/components/PriceImpact/PriceImpact.styles.ts +1 -9
  137. package/src/components/PriceImpact/PriceImpact.tsx +5 -5
  138. package/src/components/Radio/Radio.styles.tsx +2 -5
  139. package/src/components/RouteCost/RouteCost.styles.ts +20 -0
  140. package/src/components/{QuoteCost/QuoteCost.tsx → RouteCost/RouteCost.tsx} +10 -14
  141. package/src/components/RouteCost/index.ts +1 -0
  142. package/src/components/RoutesOverview/RoutesOverview.tsx +2 -6
  143. package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +13 -40
  144. package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +46 -47
  145. package/src/components/SelectableCategoryList/index.ts +0 -1
  146. package/src/components/SelectableWalletList/SelectableWalletList.tsx +1 -1
  147. package/src/components/Skeleton/Skeleton.tsx +2 -3
  148. package/src/components/Skeleton/Skeleton.types.ts +1 -1
  149. package/src/components/StepDetails/StepDetails.stories.tsx +1 -1
  150. package/src/components/StepDetails/StepDetails.styles.ts +28 -36
  151. package/src/components/StepDetails/StepDetails.tsx +7 -11
  152. package/src/components/StepDetails/StepDetails.types.ts +2 -17
  153. package/src/components/StepDetails/index.ts +1 -1
  154. package/src/components/StepDetails/mock.ts +1 -1
  155. package/src/components/SvgIcon/SvgIcon.style.ts +1 -1
  156. package/src/components/SwapListItem/mock.ts +6 -21
  157. package/src/components/Switch/Switch.styles.tsx +6 -8
  158. package/src/components/TextField/TextField.tsx +5 -3
  159. package/src/components/TokenAmount/TokenAmount.styles.ts +10 -12
  160. package/src/components/TokenAmount/TokenAmount.tsx +17 -23
  161. package/src/components/Tooltip/Tooltip.styles.ts +5 -8
  162. package/src/components/Tooltip/Tooltip.tsx +3 -2
  163. package/src/components/Wallet/Wallet.styles.ts +1 -1
  164. package/src/components/Wallet/Wallet.types.ts +23 -3
  165. package/src/components/common/Image.tsx +2 -1
  166. package/src/components/common/index.ts +1 -1
  167. package/src/components/index.ts +2 -1
  168. package/src/containers/BlockchainSelector/BlockchainSelector.tsx +8 -9
  169. package/src/containers/History/types.tsx +1 -0
  170. package/src/containers/SwapHistory/SwapHistory.stories.tsx +2 -5
  171. package/src/containers/SwapHistory/SwapHistory.tsx +1 -1
  172. package/src/containers/SwapHistory/mock.ts +8 -24
  173. package/src/containers/SwapInput/SwapInput.styles.ts +27 -78
  174. package/src/containers/SwapInput/SwapInput.tsx +29 -37
  175. package/src/containers/SwapInput/SwapInput.types.ts +0 -2
  176. package/src/containers/SwapInput/TokenSection.styles.ts +12 -27
  177. package/src/containers/SwapInput/TokenSection.tsx +6 -15
  178. package/src/containers/TokenSelector/TokenSelector.tsx +10 -8
  179. package/src/helper/index.ts +99 -0
  180. package/src/icons/index.ts +0 -5
  181. package/src/index.ts +1 -0
  182. package/src/theme.ts +4 -4
  183. package/src/types/index.ts +1 -0
  184. package/src/types/swaps.ts +38 -0
  185. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.d.ts +0 -4
  186. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.d.ts.map +0 -1
  187. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts +0 -629
  188. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts.map +0 -1
  189. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.types.d.ts.map +0 -1
  190. package/dist/widget/ui/src/components/QuoteCost/index.d.ts +0 -2
  191. package/dist/widget/ui/src/components/QuoteCost/index.d.ts.map +0 -1
  192. package/dist/widget/ui/src/icons/CosmosCategory.d.ts +0 -5
  193. package/dist/widget/ui/src/icons/CosmosCategory.d.ts.map +0 -1
  194. package/dist/widget/ui/src/icons/EvmCategory.d.ts +0 -5
  195. package/dist/widget/ui/src/icons/EvmCategory.d.ts.map +0 -1
  196. package/dist/widget/ui/src/icons/Language.d.ts +0 -5
  197. package/dist/widget/ui/src/icons/Language.d.ts.map +0 -1
  198. package/dist/widget/ui/src/icons/OtherCategory.d.ts +0 -5
  199. package/dist/widget/ui/src/icons/OtherCategory.d.ts.map +0 -1
  200. package/dist/widget/ui/src/icons/UtxoCategory.d.ts +0 -5
  201. package/dist/widget/ui/src/icons/UtxoCategory.d.ts.map +0 -1
  202. package/dist/widget/ui/src/utils/index.d.ts.map +0 -1
  203. package/src/components/QuoteCost/QuoteCost.styles.ts +0 -29
  204. package/src/components/QuoteCost/index.ts +0 -1
  205. package/src/icons/CosmosCategory.tsx +0 -137
  206. package/src/icons/EvmCategory.tsx +0 -74
  207. package/src/icons/Language.tsx +0 -55
  208. package/src/icons/OtherCategory.tsx +0 -72
  209. package/src/icons/UtxoCategory.tsx +0 -44
  210. package/src/utils/index.ts +0 -23
  211. /package/src/components/{QuoteCost/QuoteCost.types.ts → RouteCost/RouteCost.types.ts} +0 -0
@@ -1,10 +1,7 @@
1
1
  import { Button } from '../../components';
2
- import { css, darkTheme, styled } from '../../theme';
2
+ import { darkTheme, styled } from '../../theme';
3
3
 
4
4
  export const Container = styled(Button, {
5
- maxWidth: '180px',
6
- minWidth: '130px',
7
- flexGrow: 1,
8
5
  backgroundColor: 'transparent',
9
6
  color: '$neutral700',
10
7
  '&:disabled': {
@@ -30,35 +27,23 @@ export const Container = styled(Button, {
30
27
  },
31
28
  });
32
29
 
33
- export const chainNameStyles = css();
34
-
35
30
  export const TokenSectionContainer = styled('div', {
36
- maxWidth: '170px',
31
+ width: '10.625rem',
37
32
  padding: '$2 $5',
38
33
  display: 'flex',
39
34
  borderRadius: '$xs',
40
35
  justifyContent: 'start',
41
36
  boxSizing: 'border-box',
42
37
  alignItems: 'center',
43
- [`& .${chainNameStyles}`]: {
44
- $$color: '$colors$neutral600',
45
- [`.${darkTheme} &`]: {
46
- $$color: '$colors$neutral700',
47
- },
48
- color: '$$color',
49
- },
50
- });
51
38
 
52
- export const tokenChainStyles = css({
53
- display: 'flex',
54
- flexDirection: 'column',
55
- justifyContent: 'center',
56
- alignItems: 'start',
57
- paddingLeft: '$10',
58
- flexGrow: 1,
59
- });
60
-
61
- export const skeletonStyles = css({
62
- width: '100%',
63
- padding: '$5 $0',
39
+ '& .token-chain-name': {
40
+ display: 'flex',
41
+ flexDirection: 'column',
42
+ justifyContent: 'center',
43
+ alignItems: 'start',
44
+ paddingLeft: '$10',
45
+ },
46
+ '& .token-chain-name__skeleton': {
47
+ padding: '$5 $0',
48
+ },
64
49
  });
@@ -5,13 +5,7 @@ import React from 'react';
5
5
 
6
6
  import { ChainToken, Divider, Skeleton, Typography } from '../../components';
7
7
 
8
- import {
9
- chainNameStyles,
10
- Container,
11
- skeletonStyles,
12
- tokenChainStyles,
13
- TokenSectionContainer,
14
- } from './TokenSection.styles';
8
+ import { Container, TokenSectionContainer } from './TokenSection.styles';
15
9
 
16
10
  export function TokenSection(props: TokenSectionProps) {
17
11
  const {
@@ -33,12 +27,12 @@ export function TokenSection(props: TokenSectionProps) {
33
27
  tokenImage={tokenImage}
34
28
  loading={loading}
35
29
  />
36
- <div className={tokenChainStyles()}>
30
+ <div className="token-chain-name">
37
31
  {loading ? (
38
- <div className={skeletonStyles()}>
39
- <Skeleton variant="text" size="large" />
32
+ <div className="token-chain-name__skeleton">
33
+ <Skeleton variant="text" size="large" width={92} />
40
34
  <Divider size={8} />
41
- <Skeleton variant="text" size="medium" />
35
+ <Skeleton variant="text" size="medium" width={92} />
42
36
  </div>
43
37
  ) : (
44
38
  <>
@@ -47,10 +41,7 @@ export function TokenSection(props: TokenSectionProps) {
47
41
  ? i18n.t('Token')
48
42
  : tokenSymbol}
49
43
  </Typography>
50
- <Typography
51
- variant="body"
52
- size="medium"
53
- className={chainNameStyles()}>
44
+ <Typography variant="body" size="medium" color="$neutral600">
54
45
  {error || (!loading && !chain) ? i18n.t('Chain') : chain}
55
46
  </Typography>
56
47
  </>
@@ -1,13 +1,14 @@
1
- import type { TokenWithAmount } from '../../components/TokenList/TokenList';
2
- import type { LoadingStatus } from '../../types/meta';
3
-
4
1
  import React from 'react';
2
+ import { containsText } from '../../helper';
5
3
 
6
- import { LoadingFailedAlert, SecondaryPage, Spinner } from '../../components';
7
- import { NotFoundAlert } from '../../components/Alert/NotFoundAlert';
8
- import { TokenList } from '../../components/TokenList/TokenList';
4
+ import { LoadingStatus } from '../../types/meta';
9
5
  import { styled } from '../../theme';
10
- import { containsText } from '../../utils';
6
+ import { NotFoundAlert } from '../../components/Alert/NotFoundAlert';
7
+ import { LoadingFailedAlert, SecondaryPage, Spinner } from '../../components';
8
+ import {
9
+ TokenList,
10
+ TokenWithAmount,
11
+ } from '../../components/TokenList/TokenList';
11
12
 
12
13
  export const LoaderContainer = styled('div', {
13
14
  display: 'flex',
@@ -44,7 +45,8 @@ export function TokenSelector(props: PropTypes) {
44
45
  hasHeader={hasHeader}
45
46
  title={`Select ${type} token`}
46
47
  onBack={onBack}
47
- textFieldPlaceholder="Search tokens by name">
48
+ textFieldPlaceholder="Search tokens by name"
49
+ >
48
50
  {(searchedFor) => {
49
51
  const filteredTokens = filterTokens(list, searchedFor);
50
52
 
@@ -0,0 +1,99 @@
1
+ /* eslint-disable @typescript-eslint/no-magic-numbers */
2
+
3
+ export function containsText(text: string, searchText: string): boolean {
4
+ return text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
5
+ }
6
+
7
+ export function getConciseAddress(
8
+ address: string | null,
9
+ maxChars = 8,
10
+ ellipsisLength = 3
11
+ ): string | null {
12
+ if (!address) {
13
+ return null;
14
+ }
15
+ if (address.length < 2 * maxChars + ellipsisLength) {
16
+ return address;
17
+ }
18
+ const start = Math.ceil((address.length - maxChars) / 2);
19
+ const end = address.length - maxChars;
20
+ return `${address.substr(start, maxChars)}${'.'.repeat(
21
+ ellipsisLength
22
+ )}${address.substr(end)}`;
23
+ }
24
+
25
+ const hexToRgb = (hex: string) =>
26
+ ((value) =>
27
+ value.length === 3
28
+ ? value.split('').map((c) => parseInt(c.repeat(2), 16))
29
+ : (value.match(/.{1,2}/g) || []).map((v) => parseInt(v, 16)))(
30
+ hex.replace('#', '')
31
+ );
32
+
33
+ const isHexTooDark = (hexColor: string) =>
34
+ (([r, g, b]) => 0.2126 * r + 0.7152 * g + 0.0722 * b < 40)(
35
+ hexToRgb(hexColor)
36
+ );
37
+
38
+ const isHexTooLight = (hexColor: string) =>
39
+ (([r, g, b]) => (r * 299 + g * 587 + b * 114) / 1000 > 155)(
40
+ hexToRgb(hexColor)
41
+ );
42
+
43
+ const colorShade = (col: string, amt: number) => {
44
+ col = col.replace(/^#/, '');
45
+ if (col.length === 3) {
46
+ col = col[0] + col[0] + col[1] + col[1] + col[2] + col[2];
47
+ }
48
+ let [r, g, b]: any = col.match(/.{2}/g);
49
+ [r, g, b] = [
50
+ parseInt(r, 16) + amt,
51
+ parseInt(g, 16) + amt,
52
+ parseInt(b, 16) + amt,
53
+ ];
54
+
55
+ r = Math.max(Math.min(255, r), 0).toString(16);
56
+ g = Math.max(Math.min(255, g), 0).toString(16);
57
+ b = Math.max(Math.min(255, b), 0).toString(16);
58
+
59
+ const rr = (r.length < 2 ? '0' : '') + r;
60
+ const gg = (g.length < 2 ? '0' : '') + g;
61
+ const bb = (b.length < 2 ? '0' : '') + b;
62
+
63
+ return `#${rr}${gg}${bb}`;
64
+ };
65
+
66
+ export const generateRangeColors = (
67
+ name: string,
68
+ mode: 'light' | 'dark',
69
+ color?: string
70
+ ) => {
71
+ let colors = { [name]: color };
72
+ if (color) {
73
+ let c = color;
74
+ if (isHexTooDark(color) || mode === 'dark') {
75
+ for (let i = 1; i < 10; i++) {
76
+ colors = {
77
+ ...colors,
78
+ [name + i * 100]:
79
+ name === 'neutral'
80
+ ? colorShade(c, i * 15)
81
+ : colorShade(color, i * 5),
82
+ };
83
+ }
84
+ }
85
+ if (isHexTooLight(color) || mode === 'light') {
86
+ for (let i = 1; i < 10; i++) {
87
+ c = colorShade(c, -(i * 5));
88
+ colors = {
89
+ ...colors,
90
+ [name + i * 100]:
91
+ name === 'neutral'
92
+ ? colorShade(c, -(i * 5))
93
+ : colorShade(color, -(i * 5)),
94
+ };
95
+ }
96
+ }
97
+ }
98
+ return colors;
99
+ };
@@ -7,13 +7,11 @@ export { default as ChevronUpIcon } from './ChevronUp';
7
7
  export { default as CloseIcon } from './Close';
8
8
  export { default as CompleteIcon } from './Complete';
9
9
  export { default as CopyIcon } from './Copy';
10
- export { default as CosmosCategoryIcon } from './CosmosCategory';
11
10
  export { default as CustomColorsIcon } from './CustomColors';
12
11
  export { default as DarkModeIcon } from './DarkMode';
13
12
  export { default as DeleteIcon } from './Delete';
14
13
  export { default as DesktopIcon } from './Desktop';
15
14
  export { default as DoneIcon } from './Done';
16
- export { default as EvmCategoryIcon } from './EvmCategory';
17
15
  export { default as ErrorIcon } from './Error';
18
16
  export { default as ExternalLinkIcon } from './ExternalLink';
19
17
  export { default as FontIcon } from './Font';
@@ -21,7 +19,6 @@ export { default as GasIcon } from './Gas';
21
19
  export { default as InProgressIcon } from './InProgress';
22
20
  export { default as InfoErrorIcon } from './InfoError';
23
21
  export { default as InfoIcon } from './Info';
24
- export { default as LanguageIcon } from './Language';
25
22
  export { default as LightModeIcon } from './LightMode';
26
23
  export { default as LinkIcon } from './Link';
27
24
  export { default as LoadingIcon } from './Loading';
@@ -32,7 +29,6 @@ export { default as NoNotificationIcon } from './NoNotification';
32
29
  export { default as NotificationNumberIcon } from './NotificationNumber';
33
30
  export { default as NotificationsIcon } from './Notifications';
34
31
  export { default as NumberIcon } from './Number';
35
- export { default as OtherCategoryIcon } from './OtherCategory';
36
32
  export { default as PinIcon } from './Pin';
37
33
  export { default as RefreshIcon } from './Refresh';
38
34
  export { default as ReverseIcon } from './Reverse';
@@ -40,7 +36,6 @@ export { default as RouteIcon } from './Route';
40
36
  export { default as SearchIcon } from './Search';
41
37
  export { default as TimeIcon } from './Time';
42
38
  export { default as TransactionIcon } from './Transaction';
43
- export { default as UtxoCategoryIcon } from './UtxoCategory';
44
39
  export { default as WalletIcon } from './Wallet';
45
40
  export { default as WarningIcon } from './Warning';
46
41
  export { default as ChainsIcon } from './Chains';
package/src/index.ts CHANGED
@@ -4,3 +4,4 @@ export * from './theme';
4
4
  export * from './types';
5
5
  export * from './hooks';
6
6
  export * from './icons';
7
+ export { generateRangeColors } from './helper';
package/src/theme.ts CHANGED
@@ -185,10 +185,10 @@ export const darkColors = {
185
185
  secondary600: '#2B3462',
186
186
 
187
187
  neutral: '#222222',
188
- neutral900: '#E9E9E9',
189
- neutral800: '#E6E6E6',
190
- neutral700: '#B8B8B8',
191
- neutral600: '#A2A2A2',
188
+ neutral900: '#F2F2F2',
189
+ neutral800: '#EEEEEE',
190
+ neutral700: '#E9E9E9',
191
+ neutral600: '#B8B8B8',
192
192
  neutral500: '#222222',
193
193
  neutral400: '#1B1B1B',
194
194
  neutral300: '#121212',
@@ -1 +1,2 @@
1
+ export type { BestRouteWithFee } from './swaps';
1
2
  export type { ConnectedWallet } from './wallet';
@@ -1,7 +1,45 @@
1
1
  import type {
2
+ BestRouteResponse,
2
3
  BlockchainValidationStatus,
4
+ SimulationResult,
5
+ SwapResult,
3
6
  WalletRequiredAssets,
4
7
  } from 'rango-sdk';
5
8
 
9
+ export type SwapStatus = 'running' | 'failed' | 'success';
10
+ export type MessageSeverity = 'error' | 'warning' | 'info' | 'success';
11
+
12
+ export type StepStatus =
13
+ | 'created'
14
+ | 'running'
15
+ | 'failed'
16
+ | 'success'
17
+ | 'waitingForApproval'
18
+ | 'approved';
19
+
20
+ export enum PendingSwapNetworkStatus {
21
+ WaitingForConnectingWallet = 'waitingForConnectingWallet',
22
+ WaitingForQueue = 'waitingForQueue',
23
+ WaitingForNetworkChange = 'waitingForNetworkChange',
24
+ NetworkChanged = 'networkChanged',
25
+ }
26
+
27
+ export type WalletTypeAndAddress = {
28
+ walletType: string;
29
+ address: string;
30
+ };
31
+ export type SwapSavedSettings = {
32
+ slippage: string;
33
+ disabledSwappersIds: string[];
34
+ disabledSwappersGroups: string[];
35
+ };
36
+
6
37
  export type SimulationAssetAndAmount = WalletRequiredAssets;
7
38
  export type SimulationValidationStatus = BlockchainValidationStatus;
39
+ export type BestRouteType = BestRouteResponse;
40
+
41
+ export type BestRouteWithFee = Omit<BestRouteResponse, 'result'> & {
42
+ result: Omit<SimulationResult, 'swaps'> & {
43
+ swaps: (SwapResult & { feeInUsd?: string })[];
44
+ };
45
+ };
@@ -1,4 +0,0 @@
1
- import type { PropTypes } from './QuoteCost.types';
2
- import React from 'react';
3
- export declare function QuoteCost(props: PropTypes): React.JSX.Element;
4
- //# sourceMappingURL=QuoteCost.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"QuoteCost.d.ts","sourceRoot":"","sources":["../../../../../../src/components/QuoteCost/QuoteCost.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,qBAgCzC"}