@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
@@ -6,16 +6,12 @@ import { ChainToken } from '../ChainToken';
6
6
  import { PriceImpact } from '../PriceImpact/PriceImpact';
7
7
  import { Typography } from '../Typography';
8
8
 
9
- import {
10
- Container,
11
- tokenAmountStyles,
12
- usdValueStyles,
13
- } from './TokenAmount.styles';
9
+ import { Container } from './TokenAmount.styles';
14
10
 
15
11
  export function TokenAmount(props: PropTypes) {
16
12
  return (
17
13
  <Container direction={props.direction} centerAlign={props.centerAlign}>
18
- <div className={tokenAmountStyles()}>
14
+ <div className="token-amount">
19
15
  <ChainToken
20
16
  chainImage={props.chain.image}
21
17
  tokenImage={props.token.image}
@@ -45,23 +41,21 @@ export function TokenAmount(props: PropTypes) {
45
41
  </div>
46
42
  </div>
47
43
  </div>
48
- {props.price.usdValue && props.price.usdValue !== '0' && (
49
- <div className={usdValueStyles()}>
50
- {props.type === 'input' && (
51
- <Typography mr={4} size="small" variant="body" color="$neutral700">
52
- {`~$${props.price.usdValue}`}
53
- </Typography>
54
- )}
55
- {props.type === 'output' && (
56
- <PriceImpact
57
- size="small"
58
- outputUsdValue={props.price.usdValue}
59
- percentageChange={props.percentageChange}
60
- warningLevel={props.warningLevel}
61
- />
62
- )}
63
- </div>
64
- )}
44
+ <div className="usd-value">
45
+ {props.type === 'input' && (
46
+ <Typography mr={4} size="small" variant="body" color="$neutral700">
47
+ {`~$${props.price.usdValue}`}
48
+ </Typography>
49
+ )}
50
+ {props.type === 'output' && (
51
+ <PriceImpact
52
+ size="small"
53
+ outputUsdValue={props.price.usdValue}
54
+ percentageChange={props.percentageChange}
55
+ warningLevel={props.warningLevel}
56
+ />
57
+ )}
58
+ </div>
65
59
  </Container>
66
60
  );
67
61
  }
@@ -7,16 +7,13 @@ export const TooltipContent = styled(RadixTooltip.Content, {
7
7
  zIndex: '999999',
8
8
  });
9
9
 
10
+ export const TooltipArrow = styled(RadixTooltip.Arrow, {
11
+ fill: '$neutral100',
12
+ });
13
+
10
14
  export const TooltipTypography = styled(Typography, {
11
15
  borderRadius: '$md',
12
16
  padding: '$5 $10',
13
- boxShadow:
14
- 'inset 0 0 0.5px 1px rgba(255, 255, 255, 0.075), 0 0 0 1px rgba(0, 0, 0, 0.05), 0 0.3px 0.4px rgba(0, 0, 0, 0.02), 0.9px 1.5px rgba(0, 0, 0, 0.045), 0 3.5px 6px rgba(0, 0, 0, 0.09)',
17
+ boxShadow: '5px 5px 10px 0px rgba(0, 0, 0, 0.10)',
15
18
  backgroundColor: '$neutral100',
16
19
  });
17
-
18
- export const TriggerContent = styled('div', {
19
- display: 'flex',
20
- justifyContent: 'center',
21
- alignItems: 'center',
22
- });
@@ -5,9 +5,9 @@ import * as RadixTooltip from '@radix-ui/react-tooltip';
5
5
  import React from 'react';
6
6
 
7
7
  import {
8
+ TooltipArrow,
8
9
  TooltipContent,
9
10
  TooltipTypography,
10
- TriggerContent,
11
11
  } from './Tooltip.styles';
12
12
 
13
13
  export function Tooltip(props: PropsWithChildren<PropTypes>) {
@@ -24,13 +24,14 @@ export function Tooltip(props: PropsWithChildren<PropTypes>) {
24
24
  <RadixTooltip.Provider delayDuration={0}>
25
25
  <RadixTooltip.Root open={open}>
26
26
  <RadixTooltip.Trigger asChild>
27
- <TriggerContent>{children}</TriggerContent>
27
+ <div>{children}</div>
28
28
  </RadixTooltip.Trigger>
29
29
  <RadixTooltip.Portal container={container}>
30
30
  <TooltipContent side={side} sideOffset={sideOffset}>
31
31
  <TooltipTypography variant="label" size="medium" color={color}>
32
32
  {content}
33
33
  </TooltipTypography>
34
+ <TooltipArrow />
34
35
  </TooltipContent>
35
36
  </RadixTooltip.Portal>
36
37
  </RadixTooltip.Root>
@@ -30,7 +30,7 @@ export const WalletButton = styled('button', {
30
30
  backgroundColor: '$$color',
31
31
  alignItems: 'center',
32
32
  cursor: 'pointer',
33
- width: 100,
33
+ width: 110,
34
34
  position: 'relative',
35
35
  fontFamily: 'inherit',
36
36
  '&:hover': {
@@ -21,6 +21,26 @@ export interface Info {
21
21
  tooltipText: string;
22
22
  }
23
23
 
24
+ interface StateConnected {
25
+ state: WalletState.CONNECTED;
26
+ }
27
+ interface StateDisconnected {
28
+ state: WalletState.DISCONNECTED;
29
+ }
30
+ interface StateConnecting {
31
+ state: WalletState.CONNECTING;
32
+ }
33
+ interface StateNotInstalled {
34
+ state: WalletState.NOT_INSTALLED;
35
+ link: InstallObjects | string;
36
+ }
37
+
38
+ type State =
39
+ | StateConnected
40
+ | StateDisconnected
41
+ | StateConnecting
42
+ | StateNotInstalled;
43
+
24
44
  export interface ContentProps {
25
45
  image: string;
26
46
  title: string;
@@ -28,11 +48,9 @@ export interface ContentProps {
28
48
  descriptionColor?: string;
29
49
  }
30
50
 
31
- export interface WalletPropTypes {
32
- state: WalletState;
51
+ interface WalletProps {
33
52
  title: string;
34
53
  image: string;
35
- link: InstallObjects | string;
36
54
  type: WalletType;
37
55
  onClick: (type: WalletType) => void;
38
56
  selected?: boolean;
@@ -41,6 +59,8 @@ export interface WalletPropTypes {
41
59
  container?: HTMLElement;
42
60
  }
43
61
 
62
+ export type WalletPropTypes = State & WalletProps;
63
+
44
64
  export type SelectablePropTypes = WalletPropTypes & {
45
65
  selected: boolean;
46
66
  };
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  import { styled } from '../../theme';
4
4
 
5
- export const ImageContainer = styled('div', {
5
+ const ImageContainer = styled('div', {
6
6
  display: 'flex',
7
7
  justifyContent: 'center',
8
8
  alignItems: 'center',
@@ -37,6 +37,7 @@ export function Image(props: PropTypes) {
37
37
 
38
38
  return (
39
39
  <ImageContainer
40
+ className="image-container"
40
41
  css={{
41
42
  width: size + 'px',
42
43
  height: size + 'px',
@@ -1,2 +1,2 @@
1
1
  export { FilledCircle } from './FilledCircle';
2
- export { Image, ImageContainer } from './Image';
2
+ export { Image } from './Image';
@@ -1,5 +1,6 @@
1
1
  export * from './I18nManager';
2
2
  export * from './Alert';
3
+ export * from './BestRoute';
3
4
  export * from './BlockchainsChip';
4
5
  export * from './BottomLogo';
5
6
  export * from './Button';
@@ -44,7 +45,7 @@ export * from './ListItem';
44
45
  export * from './NotFound';
45
46
  export * from './MessageBox';
46
47
  export * from './IconButton';
47
- export * from './QuoteCost';
48
+ export * from './RouteCost';
48
49
  export * from './TokenAmount';
49
50
  export * from './StepDetails';
50
51
  export * from './Popover';
@@ -1,16 +1,14 @@
1
- import type { LoadingStatus } from '../../types/meta';
2
- import type { CSSProperties } from '@stitches/react';
3
- import type { BlockchainMeta } from 'rango-sdk';
4
-
5
1
  import React from 'react';
6
-
7
- import { LoadingFailedAlert } from '../../components/Alert/LoadingFailedAlert';
8
- import { NotFoundAlert } from '../../components/Alert/NotFoundAlert';
2
+ import { BlockchainMeta } from 'rango-sdk';
9
3
  import { BlockchainsList } from '../../components/BlockchainsList';
10
4
  import { SecondaryPage } from '../../components/SecondaryPage/SecondaryPage';
11
5
  import { Spinner } from '../../components/Spinner';
12
6
  import { styled } from '../../theme';
13
- import { containsText } from '../../utils';
7
+ import { CSSProperties } from '@stitches/react';
8
+ import { containsText } from '../../helper';
9
+ import { LoadingStatus } from '../../types/meta';
10
+ import { LoadingFailedAlert } from '../../components/Alert/LoadingFailedAlert';
11
+ import { NotFoundAlert } from '../../components/Alert/NotFoundAlert';
14
12
  import { LoaderContainer } from '../TokenSelector/TokenSelector';
15
13
 
16
14
  const ListContainer = styled('div', {
@@ -58,7 +56,8 @@ export function BlockchainSelector(props: PropTypes) {
58
56
  hasHeader={hasHeader}
59
57
  textFieldPlaceholder="Search blockchains by name"
60
58
  title={`Select ${type} Blockchain`}
61
- onBack={onBack}>
59
+ onBack={onBack}
60
+ >
62
61
  {(searchedFor) => {
63
62
  const filteredBlockchains = filterBlockchains(list, searchedFor);
64
63
  return (
@@ -0,0 +1 @@
1
+ export type { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
@@ -1,10 +1,7 @@
1
- import type { PropTypes } from './SwapHistory';
2
- import type { Meta } from '@storybook/react';
3
-
4
1
  import React from 'react';
5
-
2
+ import { Meta } from '@storybook/react';
3
+ import { PropTypes, SwapHistory } from './SwapHistory';
6
4
  import { pendingSwap } from './mock';
7
- import { SwapHistory } from './SwapHistory';
8
5
 
9
6
  export default {
10
7
  title: 'Containers/Swap History',
@@ -1,5 +1,5 @@
1
1
  import type { PropTypes as SwapMessagesPropTypes } from './SwapMessages';
2
- import type { PendingSwap } from 'rango-types';
2
+ import type { PendingSwap } from '../History/types';
3
3
 
4
4
  import React, { useState } from 'react';
5
5
 
@@ -1,8 +1,6 @@
1
- /* eslint-disable @typescript-eslint/no-magic-numbers */
2
- import type { PendingSwap } from 'rango-types';
3
-
1
+ // @ts-nocheck
4
2
  import { RoutingResultType, TransactionType } from 'rango-sdk';
5
- import { MessageSeverity } from 'rango-types';
3
+ import { PendingSwap } from '../History/types';
6
4
 
7
5
  export const pendingSwap: PendingSwap = {
8
6
  creationTime: '1673164511955',
@@ -18,7 +16,7 @@ export const pendingSwap: PendingSwap = {
18
16
  status: 'running',
19
17
  isPaused: false,
20
18
  extraMessage: null,
21
- extraMessageSeverity: MessageSeverity.info,
19
+ extraMessageSeverity: 'info',
22
20
  extraMessageDetail: '',
23
21
  extraMessageErrorCode: null,
24
22
  networkStatusExtraMessage: null,
@@ -36,14 +34,14 @@ export const pendingSwap: PendingSwap = {
36
34
  {
37
35
  swapperId: 'Osmosis',
38
36
  swapperType: 'DEX',
39
- swapperLogo: '',
37
+ swapperLogo: 'https://api.rango.exchange/swappers/osmosis.png',
40
38
  from: {
41
39
  symbol: 'JUNO',
42
40
  logo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
43
41
  address:
44
42
  'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
45
43
  blockchain: 'OSMOSIS',
46
- blockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
44
+ blockchainLogo: '',
47
45
  decimals: 6,
48
46
  usdPrice: 1.1091996179668873,
49
47
  },
@@ -53,7 +51,7 @@ export const pendingSwap: PendingSwap = {
53
51
  address: null,
54
52
  blockchain: 'OSMOSIS',
55
53
  decimals: 6,
56
- blockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
54
+ blockchainLogo: '',
57
55
  usdPrice: 0.7192435454440882,
58
56
  },
59
57
  fromAmount: '1.000000',
@@ -70,9 +68,8 @@ export const pendingSwap: PendingSwap = {
70
68
  address: null,
71
69
  },
72
70
  expenseType: 'FROM_SOURCE_WALLET',
73
- name: 'Network Fee',
74
71
  amount: '0',
75
- price: null,
72
+ name: 'Network Fee',
76
73
  },
77
74
  ],
78
75
  estimatedTimeInSeconds: 45,
@@ -148,7 +145,6 @@ export const pendingSwap: PendingSwap = {
148
145
  includesDestinationTx: false,
149
146
  maxRequiredSign: 1,
150
147
  warnings: [],
151
- internalSwaps: null,
152
148
  },
153
149
  ],
154
150
  },
@@ -158,25 +154,21 @@ export const pendingSwap: PendingSwap = {
158
154
  id: 1,
159
155
  fromBlockchain: 'OSMOSIS',
160
156
  fromSymbol: 'JUNO',
161
- swapperType: 'test',
162
157
  fromSymbolAddress:
163
158
  'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
164
159
  fromDecimals: 6,
165
160
  fromAmountPrecision: null,
166
- fromAmountRestrictionType: 'EXCLUSIVE',
167
- estimatedTimeInSeconds: 5,
168
161
  fromAmountMinValue: null,
169
162
  fromAmountMaxValue: null,
170
- fromUsdPrice: null,
171
163
  toBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
172
164
  fromBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
173
165
  toBlockchain: 'OSMOSIS',
174
166
  fromLogo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
175
167
  toSymbol: 'OSMO',
176
168
  toSymbolAddress: null,
169
+ swapperType: 'DEX',
177
170
  toDecimals: 6,
178
171
  toLogo: 'https://api.rango.exchange/i/mJQPS2',
179
- toUsdPrice: null,
180
172
  startTransactionTime: 1673164519916,
181
173
  swapperId: 'Osmosis',
182
174
  swapperLogo: 'https://api.rango.exchange/swappers/osmosis.png',
@@ -192,13 +184,6 @@ export const pendingSwap: PendingSwap = {
192
184
  description: null,
193
185
  },
194
186
  ],
195
- starknetApprovalTransaction: null,
196
- starknetTransaction: null,
197
- tronApprovalTransaction: null,
198
- tonTransaction: null,
199
- tronTransaction: null,
200
- feeInUsd: null,
201
- executedTransactionTime: null,
202
187
  cosmosTransaction: {
203
188
  type: TransactionType.COSMOS,
204
189
  fromWalletAddress: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
@@ -286,7 +271,6 @@ export const pendingSwap: PendingSwap = {
286
271
  transferTransaction: null,
287
272
  diagnosisUrl: null,
288
273
  internalSteps: null,
289
- internalSwaps: null,
290
274
  },
291
275
  ],
292
276
  };
@@ -1,7 +1,5 @@
1
- import { Button, TextField, Typography } from '../../components';
2
- import { css, darkTheme, styled } from '../../theme';
3
-
4
- export const textStyles = css();
1
+ import { Button, TextField } from '../../components';
2
+ import { darkTheme, styled } from '../../theme';
5
3
 
6
4
  export const Container = styled('div', {
7
5
  $$color: '$colors$neutral100',
@@ -19,22 +17,40 @@ export const Container = styled('div', {
19
17
  },
20
18
  },
21
19
  },
22
- [`& .${textStyles}`]: {
23
- $$color: '$colors$neutral600',
24
- [`.${darkTheme} &`]: {
25
- $$color: '$colors$neutral700',
26
- },
27
- color: '$$color',
20
+ '& .label__container': {
21
+ paddingBottom: '$5',
22
+ },
23
+ '& .label': {
24
+ display: 'flex',
25
+ justifyContent: 'space-between',
26
+ alignItems: 'center',
27
+ },
28
+ '& .balance': {
29
+ display: 'flex',
30
+ justifyContent: 'center',
31
+ alignItems: 'center',
32
+ },
33
+ '& .form': {
34
+ display: 'flex',
35
+ justifyContent: 'space-between',
36
+ alignItems: 'center',
37
+ },
38
+ '& .amount': {
39
+ display: 'flex',
40
+ flexDirection: 'column',
41
+ justifyContent: 'center',
42
+ alignItems: 'end',
43
+ flexGrow: 1,
28
44
  },
29
45
  });
30
46
 
31
47
  export const InputAmount = styled(TextField, {
32
- width: '100%',
33
48
  padding: '0',
34
49
  fontSize: '$18',
35
50
  lineHeight: '$26',
36
51
  fontWeight: '$medium',
37
52
  textAlign: 'right',
53
+ width: 140,
38
54
  '&:disabled': {
39
55
  cursor: 'unset',
40
56
  },
@@ -46,70 +62,3 @@ export const MaxButton = styled(Button, {
46
62
  },
47
63
  backgroundColor: '$$color',
48
64
  });
49
-
50
- export const ValueTypography = styled('div', {
51
- display: 'flex',
52
- width: '100%',
53
- textAlign: 'right',
54
- whiteSpace: 'nowrap',
55
- overflow: 'hidden',
56
- textOverflow: 'ellipsis',
57
- variants: {
58
- hasWarning: {
59
- true: {
60
- '& ._typography': {
61
- color: '$warning500',
62
- },
63
- },
64
- false: {
65
- '& ._typography': {
66
- $$color: '$colors$neutral600',
67
- [`.${darkTheme} &`]: {
68
- $$color: '$colors$neutral700',
69
- },
70
- color: '$$color',
71
- },
72
- },
73
- },
74
- },
75
- });
76
-
77
- export const formStyles = css({
78
- display: 'flex',
79
- justifyContent: 'space-between',
80
- alignItems: 'center',
81
- });
82
-
83
- export const labelStyles = css({
84
- display: 'flex',
85
- justifyContent: 'space-between',
86
- alignItems: 'center',
87
- });
88
-
89
- export const balanceStyles = css({
90
- display: 'flex',
91
- justifyContent: 'center',
92
- alignItems: 'center',
93
- });
94
-
95
- export const amountStyles = css({
96
- width: '45%',
97
- maxWidth: '170px',
98
- display: 'flex',
99
- flexDirection: 'column',
100
- justifyContent: 'center',
101
- alignItems: 'end',
102
- flexGrow: 1,
103
- });
104
-
105
- export const labelContainerStyles = css({
106
- paddingBottom: '$5',
107
- });
108
-
109
- export const UsdPrice = styled(Typography, {
110
- width: '100%',
111
- textAlign: 'right',
112
- whiteSpace: 'nowrap',
113
- overflow: 'hidden',
114
- textOverflow: 'ellipsis',
115
- });
@@ -5,37 +5,21 @@ import React from 'react';
5
5
 
6
6
  import { Divider, PriceImpact, Skeleton, Typography } from '../../components';
7
7
 
8
- import {
9
- amountStyles,
10
- balanceStyles,
11
- Container,
12
- formStyles,
13
- InputAmount,
14
- labelContainerStyles,
15
- labelStyles,
16
- MaxButton,
17
- textStyles,
18
- UsdPrice,
19
- ValueTypography,
20
- } from './SwapInput.styles';
8
+ import { Container, InputAmount, MaxButton } from './SwapInput.styles';
21
9
  import { TokenSection } from './TokenSection';
22
10
 
23
11
  export function SwapInput(props: SwapInputProps) {
24
- const showBalance =
25
- 'balance' in props && !props.loading && !props.loadingBalance;
26
- const showBalanceSkeleton =
27
- 'balance' in props && (props.loading || props.loadingBalance);
28
12
  return (
29
13
  <Container sharpBottomStyle={props.sharpBottomStyle}>
30
- <div className={labelContainerStyles()}>
31
- <div className={labelStyles()}>
32
- <Typography variant="body" size="small" className={textStyles()}>
14
+ <div className="label__container">
15
+ <div className="label">
16
+ <Typography variant="body" size="small" color="$neutral600">
33
17
  {props.label}
34
18
  </Typography>
35
- {showBalance && (
36
- <div className={balanceStyles()}>
19
+ {'balance' in props && !props.loading && (
20
+ <div className="balance">
37
21
  <Typography
38
- className={textStyles()}
22
+ color="$neutral600"
39
23
  mr={4}
40
24
  variant="body"
41
25
  size="xsmall">
@@ -51,14 +35,14 @@ export function SwapInput(props: SwapInputProps) {
51
35
  </MaxButton>
52
36
  </div>
53
37
  )}
54
- {showBalanceSkeleton && (
55
- <div className={balanceStyles()}>
38
+ {props.loading && (
39
+ <div className="balance">
56
40
  <Skeleton variant="text" size="large" width={105} />
57
41
  </div>
58
42
  )}
59
43
  </div>
60
44
  </div>
61
- <div className={formStyles()}>
45
+ <div className="form">
62
46
  <TokenSection
63
47
  chain={props.chain.displayName}
64
48
  tokenSymbol={props.token.displayName}
@@ -68,12 +52,12 @@ export function SwapInput(props: SwapInputProps) {
68
52
  onClick={props.onClickToken}
69
53
  loading={props.loading}
70
54
  />
71
- <div className={amountStyles()}>
72
- {props.loading || (props.mode === 'To' && props.fetchingQuote) ? (
55
+ <div className="amount">
56
+ {props.loading ? (
73
57
  <>
74
- <Skeleton variant="text" size="large" />
58
+ <Skeleton variant="text" size="large" width={92} />
75
59
  <Divider size={8} />
76
- <Skeleton variant="text" size="medium" />
60
+ <Skeleton variant="text" size="medium" width={92} />
77
61
  </>
78
62
  ) : (
79
63
  <>
@@ -100,13 +84,21 @@ export function SwapInput(props: SwapInputProps) {
100
84
  warningLevel={props.warningLevel}
101
85
  />
102
86
  ) : (
103
- <ValueTypography hasWarning={!!props.price.error}>
104
- <UsdPrice variant="body" size="medium">
105
- {props.price.usdValue
106
- ? `~$${props.price.usdValue}`
107
- : props.price.error}
108
- </UsdPrice>
109
- </ValueTypography>
87
+ <Typography
88
+ variant="body"
89
+ size="medium"
90
+ color={!props.price.error ? '$neutral600' : '$warning500'}
91
+ style={{
92
+ width: 140,
93
+ textAlign: 'right',
94
+ whiteSpace: 'nowrap',
95
+ overflow: 'hidden',
96
+ textOverflow: 'ellipsis',
97
+ }}>
98
+ {props.price.usdValue
99
+ ? `~$${props.price.usdValue}`
100
+ : props.price.error}
101
+ </Typography>
110
102
  )}
111
103
  </>
112
104
  )}
@@ -25,14 +25,12 @@ export type BaseProps = {
25
25
  type FromProps = {
26
26
  mode: 'From';
27
27
  balance?: string;
28
- loadingBalance: boolean;
29
28
  onSelectMaxBalance: () => void;
30
29
  onInputChange: (inputAmount: string) => void;
31
30
  };
32
31
 
33
32
  type ToProps = {
34
33
  mode: 'To';
35
- fetchingQuote?: boolean;
36
34
  percentageChange: string | null;
37
35
  warningLevel: PriceImpactWarningLevel;
38
36
  };