@rango-dev/ui 0.1.10-next.91 → 0.1.10

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 (116) hide show
  1. package/README.md +1 -181
  2. package/dist/components/Alert/Alert.d.ts +3 -2
  3. package/dist/components/Alert/LoadingFailedAlert.d.ts +2 -0
  4. package/dist/components/Alert/NotFoundAlert.d.ts +7 -0
  5. package/dist/components/Alert/index.d.ts +1 -0
  6. package/dist/components/BlockchainSelector/BlockchainSelector.d.ts +1 -1
  7. package/dist/components/Button/Button.d.ts +3 -3
  8. package/dist/components/Divider/Divider.d.ts +6 -0
  9. package/dist/components/Divider/index.d.ts +1 -0
  10. package/dist/components/Header/Header.d.ts +9 -0
  11. package/dist/components/Header/index.d.ts +1 -0
  12. package/dist/components/Icon/ArrowRightIcon.d.ts +3 -0
  13. package/dist/components/Icon/ChevronRightIcon.d.ts +3 -0
  14. package/dist/components/Icon/DisconnectIcon.d.ts +3 -0
  15. package/dist/components/Icon/index.d.ts +3 -0
  16. package/dist/components/Icon/types.d.ts +1 -1
  17. package/dist/components/LiquiditySourceList/LiquiditySourceList.d.ts +3 -1
  18. package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.d.ts +2 -1
  19. package/dist/components/SelectableWalletList/mock.d.ts +1 -1
  20. package/dist/components/Settings/Settings.d.ts +2 -1
  21. package/dist/components/Spacer/Spacer.d.ts +1 -1
  22. package/dist/components/SwapContainer/SwapContainer.d.ts +1 -0
  23. package/dist/components/SwapDetail/Token.d.ts +16 -0
  24. package/dist/components/TextField/TextField.stories.d.ts +1 -1
  25. package/dist/components/TokenSelector/TokenSelector.d.ts +3 -0
  26. package/dist/components/Typography/Typography.d.ts +3 -2
  27. package/dist/components/index.d.ts +2 -0
  28. package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +10 -17
  29. package/dist/containers/ConfirmSwap/ConfirmSwap.stories.d.ts +1 -0
  30. package/dist/containers/ConfirmSwap/mock.d.ts +3 -0
  31. package/dist/containers/History/History.d.ts +6 -1
  32. package/dist/containers/History/index.d.ts +1 -1
  33. package/dist/containers/History/types.d.ts +3 -24
  34. package/dist/containers/SwapHistory/SwapHistory.d.ts +16 -3
  35. package/dist/containers/SwapHistory/SwapMessages.d.ts +17 -0
  36. package/dist/containers/index.d.ts +0 -1
  37. package/dist/helper/index.d.ts +1 -0
  38. package/dist/types/meta.d.ts +1 -0
  39. package/dist/ui.cjs.development.js +1455 -1033
  40. package/dist/ui.cjs.development.js.map +1 -1
  41. package/dist/ui.cjs.production.min.js +1 -1
  42. package/dist/ui.cjs.production.min.js.map +1 -1
  43. package/dist/ui.esm.js +1463 -1046
  44. package/dist/ui.esm.js.map +1 -1
  45. package/package.json +3 -2
  46. package/src/components/Alert/Alert.tsx +63 -39
  47. package/src/components/Alert/LoadingFailedAlert.tsx +11 -0
  48. package/src/components/Alert/NotFoundAlert.tsx +19 -0
  49. package/src/components/Alert/index.ts +1 -0
  50. package/src/components/BestRoute/BestRoute.tsx +28 -19
  51. package/src/components/BestRoute/mock.ts +10 -0
  52. package/src/components/BlockchainSelector/BlockchainSelector.tsx +13 -21
  53. package/src/components/Button/Button.stories.tsx +1 -1
  54. package/src/components/Button/Button.tsx +36 -23
  55. package/src/components/Chip/Chip.tsx +7 -4
  56. package/src/components/ConnectWalletsModal/mockData.ts +16 -0
  57. package/src/components/Divider/Divider.tsx +41 -0
  58. package/src/components/Divider/index.ts +1 -0
  59. package/src/components/Header/Header.tsx +39 -0
  60. package/src/components/Header/index.ts +1 -0
  61. package/src/components/Icon/ArrowRightIcon.tsx +31 -0
  62. package/src/components/Icon/ChevronRightIcon.tsx +29 -0
  63. package/src/components/Icon/DisconnectIcon.tsx +31 -0
  64. package/src/components/Icon/HistoryIcon.tsx +12 -18
  65. package/src/components/Icon/RetryIcon.tsx +13 -13
  66. package/src/components/Icon/SettingIcon.tsx +6 -14
  67. package/src/components/Icon/index.ts +3 -0
  68. package/src/components/Icon/types.tsx +1 -1
  69. package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +104 -30
  70. package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +16 -11
  71. package/src/components/Radio/Radio.tsx +5 -4
  72. package/src/components/SecondaryPage/SecondaryPage.tsx +26 -52
  73. package/src/components/SelectableWalletList/SelectableWalletList.tsx +5 -1
  74. package/src/components/SelectableWalletList/mock.ts +4 -3
  75. package/src/components/Settings/Settings.tsx +47 -12
  76. package/src/components/Spacer/Spacer.tsx +31 -1
  77. package/src/components/StatusDrawer/StatusDrawer.tsx +1 -0
  78. package/src/components/StepDetail/StepDetail.tsx +19 -7
  79. package/src/components/SwapContainer/SwapContainer.tsx +22 -17
  80. package/src/components/SwapDetail/SwapDetail.tsx +77 -115
  81. package/src/components/SwapDetail/Token.tsx +68 -0
  82. package/src/components/SwapDetail/mock.ts +1 -0
  83. package/src/components/Switch/Switch.tsx +7 -5
  84. package/src/components/TextField/TextField.tsx +3 -1
  85. package/src/components/TokenList/TokenItem.tsx +4 -1
  86. package/src/components/TokenList/TokenList.tsx +16 -18
  87. package/src/components/TokenSelector/TokenSelector.tsx +47 -10
  88. package/src/components/Typography/Typography.stories.tsx +4 -0
  89. package/src/components/Typography/Typography.tsx +20 -9
  90. package/src/components/Wallet/State.tsx +2 -3
  91. package/src/components/Wallet/Wallet.tsx +33 -6
  92. package/src/components/index.ts +2 -0
  93. package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +11 -2
  94. package/src/containers/ConfirmSwap/ConfirmSwap.tsx +103 -119
  95. package/src/containers/ConfirmSwap/mock.ts +79 -2
  96. package/src/containers/History/History.tsx +57 -38
  97. package/src/containers/History/index.ts +1 -1
  98. package/src/containers/History/mock.ts +1 -0
  99. package/src/containers/History/types.tsx +2 -30
  100. package/src/containers/SwapHistory/SwapHistory.tsx +309 -165
  101. package/src/containers/SwapHistory/SwapMessages.tsx +116 -0
  102. package/src/containers/SwapHistory/mock.ts +1 -0
  103. package/src/containers/index.ts +0 -1
  104. package/src/helper/index.ts +14 -0
  105. package/src/theme.ts +4 -2
  106. package/src/types/meta.ts +2 -0
  107. package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +0 -18
  108. package/dist/containers/ConfirmWallets/ConfirmWallets.stories.d.ts +0 -6
  109. package/dist/containers/ConfirmWallets/index.d.ts +0 -1
  110. package/dist/containers/ConfirmWallets/mock.d.ts +0 -5
  111. package/dist/helper/swaps.d.ts +0 -5
  112. package/src/containers/ConfirmWallets/ConfirmWallets.stories.tsx +0 -26
  113. package/src/containers/ConfirmWallets/ConfirmWallets.tsx +0 -118
  114. package/src/containers/ConfirmWallets/index.ts +0 -1
  115. package/src/containers/ConfirmWallets/mock.ts +0 -222
  116. package/src/helper/swaps.ts +0 -23
@@ -8,6 +8,7 @@ export const walletsInfo: WalletInfo[] = [
8
8
  state: WalletState.DISCONNECTED,
9
9
  installLink: '',
10
10
  type: WalletType.COINBASE,
11
+ showOnMobile: true,
11
12
  },
12
13
  {
13
14
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -15,6 +16,7 @@ export const walletsInfo: WalletInfo[] = [
15
16
  state: WalletState.CONNECTED,
16
17
  installLink: '',
17
18
  type: WalletType.COINBASE,
19
+ showOnMobile: true,
18
20
  },
19
21
  {
20
22
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -22,12 +24,14 @@ export const walletsInfo: WalletInfo[] = [
22
24
  state: WalletState.CONNECTING,
23
25
  installLink: '',
24
26
  type: WalletType.COINBASE,
27
+ showOnMobile: true,
25
28
  },
26
29
  {
27
30
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
28
31
  name: 'Coinbase',
29
32
  state: WalletState.NOT_INSTALLED,
30
33
  type: WalletType.COINBASE,
34
+ showOnMobile: true,
31
35
  installLink:
32
36
  'https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad?hl=en',
33
37
  },
@@ -37,6 +41,7 @@ export const walletsInfo: WalletInfo[] = [
37
41
  state: WalletState.DISCONNECTED,
38
42
  installLink: '',
39
43
  type: WalletType.COINBASE,
44
+ showOnMobile: true,
40
45
  },
41
46
  {
42
47
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -44,6 +49,7 @@ export const walletsInfo: WalletInfo[] = [
44
49
  state: WalletState.CONNECTED,
45
50
  installLink: '',
46
51
  type: WalletType.COINBASE,
52
+ showOnMobile: true,
47
53
  },
48
54
  {
49
55
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -51,6 +57,7 @@ export const walletsInfo: WalletInfo[] = [
51
57
  state: WalletState.DISCONNECTED,
52
58
  installLink: '',
53
59
  type: WalletType.COINBASE,
60
+ showOnMobile: true,
54
61
  },
55
62
  {
56
63
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -58,6 +65,7 @@ export const walletsInfo: WalletInfo[] = [
58
65
  state: WalletState.DISCONNECTED,
59
66
  installLink: '',
60
67
  type: WalletType.COINBASE,
68
+ showOnMobile: true,
61
69
  },
62
70
  {
63
71
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -65,6 +73,7 @@ export const walletsInfo: WalletInfo[] = [
65
73
  state: WalletState.DISCONNECTED,
66
74
  installLink: '',
67
75
  type: WalletType.COINBASE,
76
+ showOnMobile: true,
68
77
  },
69
78
  {
70
79
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -72,6 +81,7 @@ export const walletsInfo: WalletInfo[] = [
72
81
  state: WalletState.DISCONNECTED,
73
82
  installLink: '',
74
83
  type: WalletType.COINBASE,
84
+ showOnMobile: true,
75
85
  },
76
86
  {
77
87
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -79,6 +89,7 @@ export const walletsInfo: WalletInfo[] = [
79
89
  state: WalletState.DISCONNECTED,
80
90
  installLink: '',
81
91
  type: WalletType.COINBASE,
92
+ showOnMobile: true,
82
93
  },
83
94
  {
84
95
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -86,6 +97,7 @@ export const walletsInfo: WalletInfo[] = [
86
97
  state: WalletState.DISCONNECTED,
87
98
  installLink: '',
88
99
  type: WalletType.COINBASE,
100
+ showOnMobile: true,
89
101
  },
90
102
  {
91
103
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -93,6 +105,7 @@ export const walletsInfo: WalletInfo[] = [
93
105
  state: WalletState.DISCONNECTED,
94
106
  installLink: '',
95
107
  type: WalletType.COINBASE,
108
+ showOnMobile: true,
96
109
  },
97
110
  {
98
111
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -100,6 +113,7 @@ export const walletsInfo: WalletInfo[] = [
100
113
  state: WalletState.DISCONNECTED,
101
114
  installLink: '',
102
115
  type: WalletType.COINBASE,
116
+ showOnMobile: true,
103
117
  },
104
118
  {
105
119
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -107,6 +121,7 @@ export const walletsInfo: WalletInfo[] = [
107
121
  state: WalletState.DISCONNECTED,
108
122
  installLink: '',
109
123
  type: WalletType.COINBASE,
124
+ showOnMobile: true,
110
125
  },
111
126
  {
112
127
  image: 'https://app.rango.exchange/wallets/coinbase.svg',
@@ -114,5 +129,6 @@ export const walletsInfo: WalletInfo[] = [
114
129
  state: WalletState.DISCONNECTED,
115
130
  installLink: '',
116
131
  type: WalletType.COINBASE,
132
+ showOnMobile: true,
117
133
  },
118
134
  ];
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { styled } from '../../theme';
3
+
4
+ const DividerContainer = styled('div', {
5
+ variants: {
6
+ size: {
7
+ 4: {
8
+ height: '$4',
9
+ },
10
+ 8: {
11
+ height: '$8',
12
+ },
13
+ 12: {
14
+ height: '$12',
15
+ },
16
+ 16: {
17
+ height: '$16',
18
+ },
19
+ 18: {
20
+ height: '$18',
21
+ },
22
+ 20: {
23
+ height: '$20',
24
+ },
25
+ 24: {
26
+ height: '$24',
27
+ },
28
+ 32: {
29
+ height: '$32',
30
+ },
31
+ },
32
+ },
33
+ });
34
+ export interface PropTypes {
35
+ size?: 4 | 8 | 12 | 16 | 18 | 20 | 24 | 32;
36
+ direction?: 'vertical' | 'horizontal';
37
+ }
38
+
39
+ export function Divider({ size = 12 }: PropTypes) {
40
+ return <DividerContainer size={size} />;
41
+ }
@@ -0,0 +1 @@
1
+ export { Divider } from './Divider';
@@ -0,0 +1,39 @@
1
+ import { styled } from '../../theme';
2
+ import React, { PropsWithChildren } from 'react';
3
+ import { AngleLeftIcon } from '../Icon';
4
+ import { Typography } from '../Typography';
5
+ import { Button } from '../Button';
6
+
7
+ const HeaderContainer = styled('div', {
8
+ display: 'flex',
9
+ justifyContent: 'space-between',
10
+ alignItems: 'center',
11
+ padding: '$8 0',
12
+ position: 'relative',
13
+ });
14
+
15
+ const BackButton = styled(Button, {
16
+ padding: '$8',
17
+ });
18
+
19
+ interface PropTypes {
20
+ onBack?: () => void;
21
+ prefix?: React.ReactNode;
22
+ suffix?: React.ReactNode;
23
+ title: string;
24
+ }
25
+
26
+ export function Header(props: PropsWithChildren<PropTypes>) {
27
+ return (
28
+ <HeaderContainer>
29
+ {props.onBack ? (
30
+ <BackButton variant="ghost" size="small" onClick={props.onBack}>
31
+ <AngleLeftIcon size={24} />
32
+ </BackButton>
33
+ ) : null}
34
+ {props.prefix}
35
+ <Typography variant="h4">{props.title}</Typography>
36
+ {props.suffix || <div></div>}
37
+ </HeaderContainer>
38
+ );
39
+ }
@@ -0,0 +1 @@
1
+ export { Header } from './Header';
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+ import { IconProps } from './types';
3
+ import { SvgWithStrokeColor } from './common';
4
+
5
+ export const ArrowRightIcon: React.FC<IconProps> = ({
6
+ size = 16,
7
+ color,
8
+ ...props
9
+ }) => {
10
+ return (
11
+ <SvgWithStrokeColor
12
+ width={size}
13
+ height={size}
14
+ viewBox="0 0 24 24"
15
+ color={color}
16
+ fill="none"
17
+ stroke="currentColor"
18
+ stroke-width="2"
19
+ stroke-linecap="round"
20
+ stroke-linejoin="round"
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ className="_icon"
23
+ {...props}
24
+ >
25
+ <line x1="5" y1="12" x2="19" y2="12"></line>
26
+ <polyline points="12 5 19 12 12 19"></polyline>
27
+ </SvgWithStrokeColor>
28
+ );
29
+ };
30
+
31
+ ArrowRightIcon.toString = () => '._icon';
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ import { SvgWithStrokeColor } from './common';
3
+ import { IconProps } from './types';
4
+
5
+ export const ChevronRightIcon = React.forwardRef<SVGSVGElement, IconProps>(
6
+ ({ color = 'black', size = 16, ...props }, forwardedRef) => {
7
+ return (
8
+ <SvgWithStrokeColor
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ width={size}
11
+ height={size}
12
+ color={color}
13
+ viewBox={`0 0 24 24`}
14
+ fill="none"
15
+ stroke="currentColor"
16
+ stroke-width="2"
17
+ stroke-linecap="round"
18
+ stroke-linejoin="round"
19
+ className="_icon"
20
+ {...props}
21
+ ref={forwardedRef}
22
+ >
23
+ <polyline points="9 18 15 12 9 6"></polyline>
24
+ </SvgWithStrokeColor>
25
+ );
26
+ }
27
+ );
28
+
29
+ ChevronRightIcon.toString = () => '._icon';
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+ import { SvgWithStrokeColor } from './common';
3
+ import { IconProps } from './types';
4
+
5
+ export const DisconnectIcon = React.forwardRef<SVGSVGElement, IconProps>(
6
+ ({ color = 'black', size = 16, ...props }, forwardedRef) => {
7
+ return (
8
+ <SvgWithStrokeColor
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ width={size}
11
+ height={size}
12
+ color={color}
13
+ viewBox={`0 0 24 24`}
14
+ fill="none"
15
+ stroke="currentColor"
16
+ stroke-width="2"
17
+ stroke-linecap="round"
18
+ stroke-linejoin="round"
19
+ className="_icon"
20
+ {...props}
21
+ ref={forwardedRef}
22
+ >
23
+ <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
24
+ <polyline points="16 17 21 12 16 7"></polyline>
25
+ <line x1="21" y1="12" x2="9" y2="12"></line>
26
+ </SvgWithStrokeColor>
27
+ );
28
+ }
29
+ );
30
+
31
+ DisconnectIcon.toString = () => '._icon';
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { SvgWithFillColor } from './common';
2
+ import { SvgWithStrokeColor } from './common';
3
3
  import { IconProps } from './types';
4
4
 
5
5
  export const HistoryIcon: React.FC<IconProps> = ({
@@ -8,32 +8,26 @@ export const HistoryIcon: React.FC<IconProps> = ({
8
8
  ...props
9
9
  }) => {
10
10
  return (
11
- <SvgWithFillColor
11
+ <SvgWithStrokeColor
12
12
  width={size}
13
13
  height={size}
14
14
  viewBox="0 0 24 24"
15
15
  color={color}
16
16
  fill="none"
17
+ stroke="currentColor"
18
+ stroke-width="2"
19
+ stroke-linecap="round"
20
+ stroke-linejoin="round"
17
21
  xmlns="http://www.w3.org/2000/svg"
18
22
  className="_icon"
19
23
  {...props}
20
24
  >
21
- <path
22
- fillRule="evenodd"
23
- clipRule="evenodd"
24
- d="M16.767 1.5c-.7.002-1.267.57-1.267 1.26V9h2.67c.63 0 1.07-.196 1.352-.478C19.804 8.24 20 7.8 20 7.17V4.75c0-.89-.363-1.704-.952-2.301a3.27 3.27 0 0 0-2.281-.949ZM14 2.76C14 1.23 15.25 0 16.77 0h.007a4.77 4.77 0 0 1 3.333 1.39l.004.003A4.775 4.775 0 0 1 21.5 4.75v2.42c0 .95-.304 1.8-.917 2.413-.613.613-1.462.917-2.413.917h-3.42a.75.75 0 0 1-.75-.75V2.76Z"
25
- />
26
- <path
27
- fillRule="evenodd"
28
- clipRule="evenodd"
29
- d="M1.057 1.431C1.862.5 3.097 0 4.75 0h12a.75.75 0 0 1 0 1.5c-.686 0-1.25.564-1.25 1.25v17c0 1.442-1.646 2.256-2.797 1.402l-.002-.002-1.718-1.285a.242.242 0 0 0-.313.025l-1.68 1.68a1.758 1.758 0 0 1-2.48 0l-.002-.001L4.85 19.9a.258.258 0 0 0-.34-.03l-1.707 1.278-.002.001C1.643 22.024 0 21.193 0 19.75v-15c0-1.203.27-2.408 1.057-3.319Zm13.245.069H4.75c-1.346 0-2.112.396-2.557.911C1.73 2.948 1.5 3.743 1.5 4.75v15c0 .216.235.325.397.202l.004-.002 1.709-1.28a1.757 1.757 0 0 1 2.3.17l.002.001L7.57 20.51a.259.259 0 0 0 .36 0l1.68-1.68c.61-.61 1.59-.688 2.283-.158l1.704 1.276c.17.125.403 0 .403-.198v-17c0-.45.109-.875.302-1.25Z"
30
- />
31
- <path
32
- fillRule="evenodd"
33
- clipRule="evenodd"
34
- d="M4 7.75A.75.75 0 0 1 4.75 7h6a.75.75 0 0 1 0 1.5h-6A.75.75 0 0 1 4 7.75ZM4.75 11.75A.75.75 0 0 1 5.5 11H10a.75.75 0 0 1 0 1.5H5.5a.75.75 0 0 1-.75-.75Z"
35
- />
36
- </SvgWithFillColor>
25
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
26
+ <polyline points="14 2 14 8 20 8"></polyline>
27
+ <line x1="16" y1="13" x2="8" y2="13"></line>
28
+ <line x1="16" y1="17" x2="8" y2="17"></line>
29
+ <polyline points="10 9 9 9 8 9"></polyline>
30
+ </SvgWithStrokeColor>
37
31
  );
38
32
  };
39
33
 
@@ -1,28 +1,28 @@
1
1
  import * as React from 'react';
2
- import { SvgWithFillColor } from './common';
2
+ import { SvgWithStrokeColor } from './common';
3
3
  import { IconProps } from './types';
4
4
 
5
5
  export const RetryIcon = React.forwardRef<SVGSVGElement, IconProps>(
6
- ({ color, size = 16, ...props }, forwardedRef) => {
6
+ ({ color = 'black', size = 16, ...props }, forwardedRef) => {
7
7
  return (
8
- <SvgWithFillColor
8
+ <SvgWithStrokeColor
9
+ xmlns="http://www.w3.org/2000/svg"
9
10
  width={size}
10
11
  height={size}
11
- fill="none"
12
- xmlns="http://www.w3.org/2000/svg"
13
- viewBox="0 0 24 24"
14
12
  color={color}
13
+ viewBox={`0 0 24 24`}
14
+ fill="none"
15
+ stroke="currentColor"
16
+ stroke-width="2"
17
+ stroke-linecap="round"
18
+ stroke-linejoin="round"
15
19
  className="_icon"
16
20
  {...props}
17
21
  ref={forwardedRef}
18
22
  >
19
- <path
20
- fillRule="evenodd"
21
- clipRule="evenodd"
22
- d="M17.016 13.45c.199-.384.002-.842-.397-1.005-.406-.166-.864.033-1.077.416A6.17 6.17 0 0 1 13 15.345a6.051 6.051 0 0 1-4.244.513 6.127 6.127 0 0 1-3.543-2.425 6.286 6.286 0 0 1 .73-8.095A6.089 6.089 0 0 1 9.86 3.604a6.07 6.07 0 0 1 4.083 1.286 6.196 6.196 0 0 1 1.65 1.97l-1.053.363a.302.302 0 0 0-.073.534l2.607 1.758a.3.3 0 0 0 .45-.155l1.01-3.007a.298.298 0 0 0-.38-.378l-1.057.365a7.79 7.79 0 0 0-2.194-2.713 7.627 7.627 0 0 0-5.13-1.615A7.65 7.65 0 0 0 4.852 4.19a7.898 7.898 0 0 0-.917 10.17 7.7 7.7 0 0 0 4.452 3.048 7.604 7.604 0 0 0 5.333-.644 7.757 7.757 0 0 0 3.297-3.315Z"
23
- fill={color}
24
- />
25
- </SvgWithFillColor>
23
+ <polyline points="23 4 23 10 17 10"></polyline>
24
+ <path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"></path>
25
+ </SvgWithStrokeColor>
26
26
  );
27
27
  }
28
28
  );
@@ -13,25 +13,17 @@ export const SettingsIcon: React.FC<IconProps> = ({
13
13
  height={size}
14
14
  viewBox="0 0 24 24"
15
15
  color={color}
16
+ stroke="currentColor"
17
+ stroke-width="2"
18
+ stroke-linecap="round"
19
+ stroke-linejoin="round"
16
20
  fill="none"
17
21
  xmlns="http://www.w3.org/2000/svg"
18
22
  className="_icon"
19
23
  {...props}
20
24
  >
21
- <path
22
- d="M12.5 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"
23
- strokeWidth={1.5}
24
- strokeMiterlimit={10}
25
- strokeLinecap="round"
26
- strokeLinejoin="round"
27
- />
28
- <path
29
- d="M2.5 12.88v-1.76c0-1.04.85-1.9 1.9-1.9 1.81 0 2.55-1.28 1.64-2.85-.52-.9-.21-2.07.7-2.59l1.73-.99c.79-.47 1.81-.19 2.28.6l.11.19c.9 1.57 2.38 1.57 3.29 0l.11-.19c.47-.79 1.49-1.07 2.28-.6l1.73.99c.91.52 1.22 1.69.7 2.59-.91 1.57-.17 2.85 1.64 2.85 1.04 0 1.9.85 1.9 1.9v1.76c0 1.04-.85 1.9-1.9 1.9-1.81 0-2.55 1.28-1.64 2.85.52.91.21 2.07-.7 2.59l-1.73.99c-.79.47-1.81.19-2.28-.6l-.11-.19c-.9-1.57-2.38-1.57-3.29 0l-.11.19c-.47.79-1.49 1.07-2.28.6l-1.73-.99a1.899 1.899 0 0 1-.7-2.59c.91-1.57.17-2.85-1.64-2.85-1.05 0-1.9-.86-1.9-1.9Z"
30
- strokeWidth={1.5}
31
- strokeMiterlimit={10}
32
- strokeLinecap="round"
33
- strokeLinejoin="round"
34
- />
25
+ <circle cx="12" cy="12" r="3"></circle>
26
+ <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
35
27
  </SvgWithStrokeColor>
36
28
  );
37
29
  };
@@ -23,6 +23,8 @@ export { AngleUpIcon } from './AngleUpIcon';
23
23
  export { AngleDownIcon } from './AngleDownIcon';
24
24
  export { AngleLeftIcon } from './AngleLeftIcon';
25
25
  export { DownloadIcon } from './DownloadIcon';
26
+ export { ChevronRightIcon } from './ChevronRightIcon';
27
+ export { ArrowRightIcon } from './ArrowRightIcon';
26
28
 
27
29
  export { RetryRightIcon } from './RetryRightIcon';
28
30
  export { RetryLeftIcon } from './RetryLeftIcon';
@@ -36,6 +38,7 @@ export { AddWalletIcon } from './AddWalletIcon';
36
38
  export { DeleteWalletIcon } from './DeleteWalletIcon';
37
39
  export { CheckWalletIcon } from './CheckWalletIcon';
38
40
  export { SwapWalletIcon } from './SwapWalletIcon';
41
+ export { DisconnectIcon } from './DisconnectIcon';
39
42
 
40
43
  export { BagIcon } from './BagIcon';
41
44
 
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  export interface IconProps extends React.SVGAttributes<SVGElement> {
4
- size?: 16 | 18 | 20 | 24 | 28 | 32 | 36 | 40;
4
+ size?: 12 | 16 | 18 | 20 | 24 | 28 | 32 | 36 | 40;
5
5
  color?: 'primary' | 'error' | 'warning' | 'success' | 'black' | 'white';
6
6
  }
7
7
 
@@ -1,11 +1,14 @@
1
1
  import { CSSProperties } from '@stitches/react';
2
2
  import React, { useEffect, useState } from 'react';
3
3
  import { styled } from '../../theme';
4
- import { LiquiditySource } from '../../types/meta';
4
+ import { LiquiditySource, LoadingStatus } from '../../types/meta';
5
5
  import { Button } from '../Button/Button';
6
6
  import { Spacer } from '../Spacer';
7
7
  import { Switch } from '../Switch';
8
8
  import { Typography } from '../Typography';
9
+ import { Spinner } from '../Spinner';
10
+ import { LoadingFailedAlert } from '../Alert/LoadingFailedAlert';
11
+ import { NotFoundAlert } from '../Alert/NotFoundAlert';
9
12
 
10
13
  const groupLiquiditySources = (
11
14
  liquiditySources: LiquiditySource[]
@@ -19,12 +22,22 @@ const groupLiquiditySources = (
19
22
  ),
20
23
  });
21
24
 
22
- const LiquiditySourceType = styled(Typography, {
25
+ const MainContainer = styled('div', {
26
+ variants: {
27
+ loaded: {
28
+ true: {
29
+ overflowY: 'auto',
30
+ },
31
+ },
32
+ },
33
+ });
34
+
35
+ const LiquiditySourceType = styled('div', {
23
36
  position: 'sticky',
24
- display: 'block',
37
+ display: 'flex',
38
+ justifyContent: 'space-between',
39
+ alignItems: 'center',
25
40
  top: '0',
26
- marginTop: '$8',
27
- marginBottom: '$8',
28
41
  backgroundColor: '$background',
29
42
  zIndex: '9999',
30
43
  paddingTop: '$8',
@@ -37,14 +50,22 @@ const LiquidityImage = styled('img', {
37
50
  marginRight: '$16',
38
51
  });
39
52
 
53
+ const LoaderContainer = styled('div', {
54
+ display: 'flex',
55
+ justifyContent: 'center',
56
+ });
57
+
40
58
  export interface PropTypes {
41
59
  list: LiquiditySource[];
42
60
  onChange: (liquiditySource: LiquiditySource) => void;
43
61
  listContainerStyle?: CSSProperties;
62
+ loadingStatus: LoadingStatus;
63
+ searchedFor: string;
44
64
  }
45
65
 
46
66
  export function LiquiditySourceList(props: PropTypes) {
47
- const { list, onChange, listContainerStyle } = props;
67
+ const { list, onChange, listContainerStyle, loadingStatus, searchedFor } =
68
+ props;
48
69
 
49
70
  const [selected, setSelected] = useState(
50
71
  list.filter((item) => item.selected)
@@ -66,34 +87,88 @@ export function LiquiditySourceList(props: PropTypes) {
66
87
  setSelected(list.filter((item) => item.selected));
67
88
  }, [list]);
68
89
 
90
+ const sections = groupLiquiditySources(list);
91
+ const bridges = sections.bridge;
92
+ const exchanges = sections.exchange;
93
+
94
+ const totalBridges = bridges.length;
95
+ const totalExchanges = exchanges.length;
96
+ // TODO: This is not performant
97
+ const totalSelectedBridges = bridges.filter(isSelected).length;
98
+ const totalSelectedExchanges = exchanges.filter(isSelected).length;
99
+
69
100
  return (
70
- <div style={{ height: '450px', ...listContainerStyle }}>
101
+ <MainContainer
102
+ style={listContainerStyle}
103
+ loaded={loadingStatus === 'success'}
104
+ >
71
105
  <div>
72
- <LiquiditySourceType variant="h5">Bridges</LiquiditySourceType>
73
- <Spacer size={16} direction="vertical" />
74
- {groupLiquiditySources(list).bridge.map((liquiditySource, index) => (
75
- <LiquiditySourceItem
76
- liquiditySource={liquiditySource}
77
- key={index}
78
- selected={isSelected(liquiditySource)}
79
- onChange={changeLiquiditySources}
80
- />
81
- ))}
106
+ <LiquiditySourceType>
107
+ <Typography variant="h5">Bridges</Typography>
108
+ <Typography variant="body1" color="neutrals800">
109
+ {totalSelectedBridges === totalBridges
110
+ ? totalBridges
111
+ : `${totalSelectedBridges} / ${totalBridges}`}
112
+ </Typography>
113
+ </LiquiditySourceType>
114
+ <Spacer size={12} direction="vertical" />
115
+ {loadingStatus === 'loading' && (
116
+ <LoaderContainer>
117
+ <Spinner size={24} />
118
+ </LoaderContainer>
119
+ )}
120
+ {loadingStatus === 'failed' && <LoadingFailedAlert />}
121
+ {loadingStatus === 'success' && (
122
+ <>
123
+ {totalBridges ? (
124
+ bridges.map((liquiditySource, index) => (
125
+ <LiquiditySourceItem
126
+ liquiditySource={liquiditySource}
127
+ key={index}
128
+ selected={isSelected(liquiditySource)}
129
+ onChange={changeLiquiditySources}
130
+ />
131
+ ))
132
+ ) : (
133
+ <NotFoundAlert catergory="Bridge" searchedFor={searchedFor} />
134
+ )}
135
+ </>
136
+ )}
82
137
  </div>
83
138
  <div>
84
- <LiquiditySourceType variant="h5">Exchanges</LiquiditySourceType>
85
- <Spacer size={16} direction="vertical" />
86
-
87
- {groupLiquiditySources(list).exchange.map((liquiditySource, index) => (
88
- <LiquiditySourceItem
89
- liquiditySource={liquiditySource}
90
- key={index}
91
- selected={isSelected(liquiditySource)}
92
- onChange={changeLiquiditySources}
93
- />
94
- ))}
139
+ <LiquiditySourceType>
140
+ <Typography variant="h5">Exchanges</Typography>
141
+ <Typography variant="body1" color="neutrals800">
142
+ {totalSelectedExchanges === totalExchanges
143
+ ? totalExchanges
144
+ : `${totalSelectedExchanges} / ${totalExchanges}`}
145
+ </Typography>
146
+ </LiquiditySourceType>
147
+ <Spacer size={12} direction="vertical" />
148
+ {loadingStatus === 'loading' && (
149
+ <LoaderContainer>
150
+ <Spinner size={24} />
151
+ </LoaderContainer>
152
+ )}
153
+ {loadingStatus === 'failed' && <LoadingFailedAlert />}
154
+ {loadingStatus == 'success' && (
155
+ <>
156
+ {totalExchanges ? (
157
+ exchanges.map((liquiditySource, index) => (
158
+ <LiquiditySourceItem
159
+ liquiditySource={liquiditySource}
160
+ key={index}
161
+ selected={isSelected(liquiditySource)}
162
+ onChange={changeLiquiditySources}
163
+ />
164
+ ))
165
+ ) : (
166
+ <NotFoundAlert catergory="Exchange" searchedFor={searchedFor} />
167
+ )}
168
+ </>
169
+ )}
95
170
  </div>
96
- </div>
171
+ </MainContainer>
97
172
  );
98
173
  }
99
174
 
@@ -113,7 +188,6 @@ const LiquiditySourceItem = ({
113
188
  prefix={<LiquidityImage src={liquiditySource.logo} />}
114
189
  suffix={<Switch checked={selected} />}
115
190
  style={{ marginBottom: '12px' }}
116
- type={selected ? 'primary' : undefined}
117
191
  onClick={onChange.bind(null, liquiditySource)}
118
192
  >
119
193
  <Typography variant="body1">{liquiditySource.title}</Typography>