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

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 (47) hide show
  1. package/dist/components/Alert/Alert.d.ts +3 -2
  2. package/dist/components/Button/Button.d.ts +3 -3
  3. package/dist/components/Icon/ChevronRightIcon.d.ts +3 -0
  4. package/dist/components/Icon/DisconnectIcon.d.ts +3 -0
  5. package/dist/components/Icon/index.d.ts +2 -0
  6. package/dist/components/Icon/types.d.ts +1 -1
  7. package/dist/components/Spacer/Spacer.d.ts +1 -1
  8. package/dist/components/TextField/TextField.stories.d.ts +1 -1
  9. package/dist/components/Typography/Typography.d.ts +3 -2
  10. package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +3 -5
  11. package/dist/ui.cjs.development.js +643 -445
  12. package/dist/ui.cjs.development.js.map +1 -1
  13. package/dist/ui.cjs.production.min.js +1 -1
  14. package/dist/ui.cjs.production.min.js.map +1 -1
  15. package/dist/ui.esm.js +644 -448
  16. package/dist/ui.esm.js.map +1 -1
  17. package/package.json +1 -1
  18. package/src/components/Alert/Alert.tsx +40 -37
  19. package/src/components/BestRoute/BestRoute.tsx +28 -19
  20. package/src/components/BlockchainSelector/BlockchainSelector.tsx +1 -3
  21. package/src/components/Button/Button.stories.tsx +1 -1
  22. package/src/components/Button/Button.tsx +35 -23
  23. package/src/components/Chip/Chip.tsx +7 -4
  24. package/src/components/Icon/ChevronRightIcon.tsx +29 -0
  25. package/src/components/Icon/DisconnectIcon.tsx +31 -0
  26. package/src/components/Icon/HistoryIcon.tsx +12 -18
  27. package/src/components/Icon/RetryIcon.tsx +13 -13
  28. package/src/components/Icon/SettingIcon.tsx +6 -14
  29. package/src/components/Icon/index.ts +2 -0
  30. package/src/components/Icon/types.tsx +1 -1
  31. package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +34 -10
  32. package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +1 -1
  33. package/src/components/Radio/Radio.tsx +5 -4
  34. package/src/components/SelectableWalletList/SelectableWalletList.tsx +0 -1
  35. package/src/components/Settings/Settings.tsx +22 -6
  36. package/src/components/Spacer/Spacer.tsx +31 -1
  37. package/src/components/StepDetail/StepDetail.tsx +18 -7
  38. package/src/components/SwapContainer/SwapContainer.tsx +1 -1
  39. package/src/components/Switch/Switch.tsx +7 -5
  40. package/src/components/TextField/TextField.tsx +2 -1
  41. package/src/components/Typography/Typography.stories.tsx +4 -0
  42. package/src/components/Typography/Typography.tsx +20 -9
  43. package/src/components/Wallet/State.tsx +2 -3
  44. package/src/components/Wallet/Wallet.tsx +32 -5
  45. package/src/containers/ConfirmSwap/ConfirmSwap.tsx +0 -2
  46. package/src/containers/ConfirmWallets/ConfirmWallets.tsx +76 -51
  47. package/src/theme.ts +4 -2
@@ -1,6 +1,5 @@
1
- import { BestRouteResponse } from 'rango-sdk';
2
- import React, { PropsWithChildren } from 'react';
3
- import { Alert } from '../../components';
1
+ import React, { PropsWithChildren, ReactNode } from 'react';
2
+ import { Alert, Spacer } from '../../components';
4
3
  import { Button } from '../../components/Button';
5
4
  import { SecondaryPage } from '../../components/SecondaryPage/SecondaryPage';
6
5
  import { SelectableWalletList } from '../../components/SelectableWalletList';
@@ -8,6 +7,12 @@ import { Typography } from '../../components/Typography';
8
7
  import { styled } from '../../theme';
9
8
  import { SelectableWallet } from '../../types';
10
9
 
10
+ const Section = styled('div', {
11
+ paddingBottom: '$32',
12
+ marginBottom: '$32',
13
+ borderBottom: '1px solid $neutrals400',
14
+ });
15
+
11
16
  const Footer = styled('div', {
12
17
  display: 'flex',
13
18
  alignItems: 'center',
@@ -21,10 +26,29 @@ const ConfirmButton = styled(Button, {
21
26
  marginTop: '$16',
22
27
  });
23
28
 
29
+ const Container = styled('div', {
30
+ paddingBottom: '$24',
31
+
32
+ '.title': {
33
+ paddingBottom: '$8',
34
+ display: 'flex',
35
+ alignItems: 'center',
36
+ },
37
+ '.num': {
38
+ backgroundColor: '$neutrals300',
39
+ display: 'inline-flex',
40
+ width: '24px',
41
+ height: '24px',
42
+ color: '$neutrals800',
43
+ borderRadius: '50%',
44
+ fontSize: '$14',
45
+ border: '1px solid $neutrals400',
46
+ justifyContent: 'center',
47
+ alignItems: 'center',
48
+ },
49
+ });
50
+
24
51
  export interface PropTypes {
25
- swap: BestRouteResponse | null;
26
- fromAmount: string;
27
- toAmount: string;
28
52
  onBack: () => void;
29
53
  onConfirm?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
30
54
  confirmDisabled?: boolean;
@@ -34,26 +58,22 @@ export interface PropTypes {
34
58
  onChange: (w: SelectableWallet) => void;
35
59
  isExperimentalChain?: (wallet: string) => boolean;
36
60
  handleConnectChain?: (wallet: string) => void;
61
+ previewInputs?: ReactNode;
62
+ previewRoutes?: ReactNode;
37
63
  }
38
64
  export function ConfirmWallets(props: PropsWithChildren<PropTypes>) {
39
65
  const {
40
66
  onBack,
41
67
  loading,
42
68
  onConfirm,
43
- swap,
44
69
  requiredWallets,
45
70
  selectableWallets,
46
71
  onChange,
47
72
  confirmDisabled,
48
73
  isExperimentalChain,
49
74
  handleConnectChain,
50
- fromAmount,
51
- toAmount,
52
75
  } = props;
53
76
 
54
- const firstStep = swap?.result?.swaps[0];
55
- const lastStep = swap?.result?.swaps[swap.result?.swaps.length - 1];
56
-
57
77
  return (
58
78
  <SecondaryPage
59
79
  textField={false}
@@ -69,50 +89,55 @@ export function ConfirmWallets(props: PropsWithChildren<PropTypes>) {
69
89
  onClick={onConfirm}
70
90
  disabled={confirmDisabled}
71
91
  >
72
- Confirm
92
+ Confirm Swap
73
93
  </ConfirmButton>
74
94
  </Footer>
75
95
  }
76
96
  >
77
- <>
78
- <Typography variant="h6" mb={12}>
79
- Confirm swap {fromAmount} {firstStep?.from.symbol} (
80
- {firstStep?.from.blockchain}) to {toAmount} {lastStep?.to.symbol} (on
81
- {lastStep?.to.blockchain})
82
- </Typography>
83
- {requiredWallets.map((wallet, index) => {
84
- const list = selectableWallets.filter((w) => wallet === w.chain);
85
- return (
86
- <div key={index}>
87
- <Typography variant="body2" mb={12} mt={12}>
88
- {index + 1}) Your {wallet} Wallet
89
- </Typography>
90
- {list.length === 0 && (
91
- <>
92
- <AlertContainer>
93
- <Alert type="error">
94
- <Typography variant="body2">{`You should connect a ${wallet} supported wallet`}</Typography>
95
- </Alert>
96
- </AlertContainer>
97
- {isExperimentalChain?.(wallet) && (
98
- <Button
99
- variant="contained"
100
- type="primary"
101
- align="grow"
102
- onClick={() => handleConnectChain?.(wallet)}
103
- >
104
- {`Add ${wallet} chain to Cosmos wallets`}
105
- </Button>
106
- )}
107
- </>
108
- )}
109
- {list.length != 0 && (
110
- <SelectableWalletList list={list} onChange={onChange} />
111
- )}
97
+ {props.previewInputs || props.previewRoutes ? (
98
+ <Section>
99
+ {props.previewInputs}
100
+ {!!props.previewRoutes ? (
101
+ <Spacer size={16} direction="vertical" />
102
+ ) : null}
103
+ {props.previewRoutes}
104
+ </Section>
105
+ ) : null}
106
+
107
+ {requiredWallets.map((wallet, index) => {
108
+ const list = selectableWallets.filter((w) => wallet === w.chain);
109
+ return (
110
+ <Container key={index}>
111
+ <div className="title">
112
+ <div className="num">{index + 1}</div>
113
+ <Spacer size={8} />
114
+ <Typography variant="body2">Your {wallet} Wallet</Typography>
112
115
  </div>
113
- );
114
- })}
115
- </>
116
+ {list.length === 0 && (
117
+ <>
118
+ <AlertContainer>
119
+ <Alert type="error">
120
+ You need to connect a compatible wallet with {wallet}
121
+ </Alert>
122
+ </AlertContainer>
123
+ {isExperimentalChain?.(wallet) && (
124
+ <Button
125
+ variant="contained"
126
+ type="primary"
127
+ align="grow"
128
+ onClick={() => handleConnectChain?.(wallet)}
129
+ >
130
+ {`Add ${wallet} chain to Cosmos wallets`}
131
+ </Button>
132
+ )}
133
+ </>
134
+ )}
135
+ {list.length != 0 && (
136
+ <SelectableWalletList list={list} onChange={onChange} />
137
+ )}
138
+ </Container>
139
+ );
140
+ })}
116
141
  </SecondaryPage>
117
142
  );
118
143
  }
package/src/theme.ts CHANGED
@@ -44,6 +44,8 @@ const theme = {
44
44
  error300: '#FF3333',
45
45
  error500: '#FF0000',
46
46
  error700: '#E60000',
47
+ // Only use this color when you are going to use white for both dark and light theme.
48
+ white: '#fff',
47
49
  },
48
50
  space: {
49
51
  2: '2px',
@@ -98,8 +100,8 @@ const theme = {
98
100
  borderWidths: {},
99
101
  borderStyles: {},
100
102
  radii: {
101
- 5: '5px',
102
- 10: '10px',
103
+ 5: '8px',
104
+ 10: '12px',
103
105
  },
104
106
  shadows: {
105
107
  s: '0px 3px 5px 3px #f0f2f5, 0px 6px 10px 3px #f0f2f5, 0px 1px 18px 3px #f0f2f5',