@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
@@ -19,9 +19,11 @@ const groupLiquiditySources = (
19
19
  ),
20
20
  });
21
21
 
22
- const LiquiditySourceType = styled(Typography, {
22
+ const LiquiditySourceType = styled('div', {
23
23
  position: 'sticky',
24
- display: 'block',
24
+ display: 'flex',
25
+ justifyContent: 'space-between',
26
+ alignItems: 'center',
25
27
  top: '0',
26
28
  marginTop: '$8',
27
29
  marginBottom: '$8',
@@ -66,12 +68,29 @@ export function LiquiditySourceList(props: PropTypes) {
66
68
  setSelected(list.filter((item) => item.selected));
67
69
  }, [list]);
68
70
 
71
+ const sections = groupLiquiditySources(list);
72
+ const bridges = sections.bridge;
73
+ const exchanges = sections.exchange;
74
+
75
+ const totalBridges = bridges.length;
76
+ const totalExchanges = exchanges.length;
77
+ // TODO: This is not performant
78
+ const totalSelectedBridges = bridges.filter(isSelected).length;
79
+ const totalSelectedExchanges = exchanges.filter(isSelected).length;
80
+
69
81
  return (
70
82
  <div style={{ height: '450px', ...listContainerStyle }}>
71
83
  <div>
72
- <LiquiditySourceType variant="h5">Bridges</LiquiditySourceType>
73
- <Spacer size={16} direction="vertical" />
74
- {groupLiquiditySources(list).bridge.map((liquiditySource, index) => (
84
+ <LiquiditySourceType>
85
+ <Typography variant="h5">Bridges</Typography>
86
+ <Typography variant="body1" color="neutrals800">
87
+ {totalSelectedBridges === totalBridges
88
+ ? totalBridges
89
+ : `${totalSelectedBridges} / ${totalBridges}`}
90
+ </Typography>
91
+ </LiquiditySourceType>
92
+ <Spacer size={12} direction="vertical" />
93
+ {bridges.map((liquiditySource, index) => (
75
94
  <LiquiditySourceItem
76
95
  liquiditySource={liquiditySource}
77
96
  key={index}
@@ -81,10 +100,16 @@ export function LiquiditySourceList(props: PropTypes) {
81
100
  ))}
82
101
  </div>
83
102
  <div>
84
- <LiquiditySourceType variant="h5">Exchanges</LiquiditySourceType>
85
- <Spacer size={16} direction="vertical" />
86
-
87
- {groupLiquiditySources(list).exchange.map((liquiditySource, index) => (
103
+ <LiquiditySourceType>
104
+ <Typography variant="h5">Exchanges</Typography>
105
+ <Typography variant="body1" color="neutrals800">
106
+ {totalSelectedExchanges === totalExchanges
107
+ ? totalExchanges
108
+ : `${totalSelectedExchanges} / ${totalExchanges}`}
109
+ </Typography>
110
+ </LiquiditySourceType>
111
+ <Spacer size={12} direction="vertical" />
112
+ {exchanges.map((liquiditySource, index) => (
88
113
  <LiquiditySourceItem
89
114
  liquiditySource={liquiditySource}
90
115
  key={index}
@@ -113,7 +138,6 @@ const LiquiditySourceItem = ({
113
138
  prefix={<LiquidityImage src={liquiditySource.logo} />}
114
139
  suffix={<Switch checked={selected} />}
115
140
  style={{ marginBottom: '12px' }}
116
- type={selected ? 'primary' : undefined}
117
141
  onClick={onChange.bind(null, liquiditySource)}
118
142
  >
119
143
  <Typography variant="body1">{liquiditySource.title}</Typography>
@@ -38,7 +38,7 @@ export function LiquiditySourcesSelector(props: PropTypes) {
38
38
  title="Liquidity Sources"
39
39
  TopButton={
40
40
  <ActionButton variant="ghost" type="primary" onClick={toggleAll}>
41
- {list.find((item) => item.selected) ? 'Clear all' : 'Select all'}
41
+ {list.find((item) => item.selected) ? 'Deselect all' : 'Select all'}
42
42
  </ActionButton>
43
43
  }
44
44
  hasHeader={hasHeader}
@@ -27,14 +27,15 @@ const ItemContainer = styled('div', {
27
27
  });
28
28
  const StyledItem = styled(RadioGroup.Item, {
29
29
  padding: '0',
30
- backgroundColor: '$neutrals300',
31
30
  width: '20px',
32
31
  height: '20px',
33
32
  borderRadius: '100%',
34
- border: 'none',
35
33
  cursor: 'pointer',
34
+ backgroundColor: '$background',
35
+ border: '1px solid $neutrals400',
36
+
36
37
  '&:hover': {
37
- backgroundColor: '$neutrals400',
38
+ borderColor: '$neutrals600',
38
39
  },
39
40
  });
40
41
 
@@ -55,7 +56,7 @@ const StyledIndicator = styled(RadioGroup.Indicator, {
55
56
  width: '10px',
56
57
  height: '10px',
57
58
  borderRadius: '50%',
58
- backgroundColor: '$primary',
59
+ backgroundColor: '$success',
59
60
  },
60
61
  });
61
62
 
@@ -6,7 +6,6 @@ import { Typography } from '../Typography';
6
6
  const Row = styled('div', {
7
7
  display: 'flex',
8
8
  flexWrap: 'wrap',
9
- justifyContent: 'center',
10
9
  });
11
10
 
12
11
  const Circle = styled('div', {
@@ -11,7 +11,7 @@ import { Switch } from '../Switch';
11
11
 
12
12
  const BaseContainer = styled('div', {
13
13
  borderRadius: '$5',
14
- backgroundColor: '$neutrals200',
14
+ backgroundColor: '$neutrals300',
15
15
  padding: '$16',
16
16
  });
17
17
 
@@ -46,6 +46,12 @@ const LiquiditySourceNumber = styled('div', {
46
46
  const ThemesContainer = styled(BaseContainer, {
47
47
  marginTop: '$32',
48
48
  });
49
+ const Head = styled('div', {
50
+ display: 'flex',
51
+ justifyContent: 'space-between',
52
+ alignItems: 'center',
53
+ paddingBottom: '$16',
54
+ });
49
55
 
50
56
  type Theme = 'dark' | 'light' | 'auto';
51
57
 
@@ -97,7 +103,14 @@ export function Settings(props: PropTypes) {
97
103
  const PageContent = (
98
104
  <>
99
105
  <BaseContainer>
100
- <Title variant="body1">Slippage tolerance per swap</Title>
106
+ <Head>
107
+ <Typography variant="body1">Slippage tolerance per swap</Typography>
108
+ {customSlippage ? (
109
+ <Typography variant="caption" color="error">
110
+ {customSlippage}% Custom
111
+ </Typography>
112
+ ) : undefined}
113
+ </Head>
101
114
  <SlippageChipsContainer>
102
115
  {slippages.map((slippage, index) => (
103
116
  <Chip
@@ -107,7 +120,7 @@ export function Settings(props: PropTypes) {
107
120
  changeSlippage(slippage);
108
121
  }}
109
122
  selected={!customSlippage && slippage === selectedSlippage}
110
- label={`${slippage.toString()} %`}
123
+ label={`${slippage.toString()}%`}
111
124
  style={{
112
125
  marginRight: '8px',
113
126
  }}
@@ -128,11 +141,10 @@ export function Settings(props: PropTypes) {
128
141
  customSlippage && <Typography variant="body2">%</Typography>
129
142
  }
130
143
  size="small"
131
- placeholder="Custom"
144
+ placeholder="Custom %"
132
145
  style={{
133
146
  width: '128px',
134
147
  flexGrow: 'initial',
135
- borderColor: customSlippage ? '$success' : 'initial',
136
148
  }}
137
149
  />
138
150
  </SlippageChipsContainer>
@@ -158,7 +170,11 @@ export function Settings(props: PropTypes) {
158
170
  <LiquiditySourceContainer onClick={onLiquiditySourcesClick}>
159
171
  <Typography variant="body1">Liquidity Sources</Typography>
160
172
  <LiquiditySourceNumber>
161
- <Typography variant="body2">{`( ${selectedLiquiditySources.length} / ${liquiditySources.length} )`}</Typography>
173
+ <Typography variant="body2" color="neutrals800">
174
+ {liquiditySources.length !== selectedLiquiditySources.length
175
+ ? `${selectedLiquiditySources.length} / ${liquiditySources.length}`
176
+ : liquiditySources.length}
177
+ </Typography>
162
178
  <StyledAngleRight />
163
179
  </LiquiditySourceNumber>
164
180
  </LiquiditySourceContainer>
@@ -4,6 +4,8 @@ import { styled } from '../../theme';
4
4
  const SpacerContainer = styled('div', {
5
5
  variants: {
6
6
  size: {
7
+ 4: {},
8
+ 8: {},
7
9
  12: {},
8
10
  16: {},
9
11
  18: {},
@@ -16,6 +18,34 @@ const SpacerContainer = styled('div', {
16
18
  },
17
19
  },
18
20
  compoundVariants: [
21
+ {
22
+ size: 4,
23
+ direction: 'horizontal',
24
+ css: {
25
+ width: '$4',
26
+ },
27
+ },
28
+ {
29
+ size: 4,
30
+ direction: 'vertical',
31
+ css: {
32
+ height: '$4',
33
+ },
34
+ },
35
+ {
36
+ size: 8,
37
+ direction: 'horizontal',
38
+ css: {
39
+ width: '$8',
40
+ },
41
+ },
42
+ {
43
+ size: 8,
44
+ direction: 'vertical',
45
+ css: {
46
+ height: '$8',
47
+ },
48
+ },
19
49
  {
20
50
  size: 12,
21
51
  direction: 'horizontal',
@@ -89,7 +119,7 @@ const SpacerContainer = styled('div', {
89
119
  ],
90
120
  });
91
121
  export interface PropTypes {
92
- size?: 12 | 16 | 18 | 20 | 24;
122
+ size?: 4 | 8 | 12 | 16 | 18 | 20 | 24;
93
123
  direction?: 'vertical' | 'horizontal';
94
124
  }
95
125
 
@@ -21,12 +21,21 @@ const Logo = styled('img', {
21
21
  borderRadius: '50%',
22
22
  });
23
23
 
24
- const ChainLogo = styled('img', {
24
+ const ChainLogo = styled('div', {
25
25
  position: 'absolute',
26
- bottom: 0,
27
- width: '$12',
28
- height: '$12',
29
- right: 0,
26
+ right: -4,
27
+ bottom: -4,
28
+ width: '$16',
29
+ height: '$16',
30
+ padding: '$2',
31
+ borderRadius: '50%',
32
+ backgroundColor: '$background',
33
+ border: '1px solid $neutrals400',
34
+
35
+ img: {
36
+ width: '100%',
37
+ display: 'block',
38
+ },
30
39
  });
31
40
  const StepContainer = styled('div', {
32
41
  display: 'flex',
@@ -82,13 +91,15 @@ export function StepDetail({
82
91
  <StepContainer direction={direction}>
83
92
  <StepLogoContainer direction={direction}>
84
93
  <Logo src={logo} alt={symbol} />
85
- <ChainLogo src={chainLogo} alt={blockchain} />
94
+ <ChainLogo>
95
+ <img src={chainLogo} alt={blockchain} />
96
+ </ChainLogo>
86
97
  </StepLogoContainer>
87
98
  <Detail pl={direction === 'horizontal'}>
88
99
  <Typography noWrap variant={direction === 'vertical' ? 'body2' : 'h6'}>
89
100
  {amount ? parseFloat(amount).toFixed(2) : '?'} {symbol}
90
101
  </Typography>
91
- <SubTitle noWrap variant="caption">
102
+ <SubTitle noWrap variant="caption" color="neutrals800">
92
103
  on {blockchain}
93
104
  </SubTitle>
94
105
  </Detail>
@@ -13,7 +13,7 @@ const MainContainer = styled('div', {
13
13
  display: 'flex',
14
14
  flexDirection: 'column',
15
15
  alignItems: 'end',
16
- padding: '$16 $24',
16
+ padding: '$16',
17
17
  boxSizing: 'border-box',
18
18
  position: 'relative',
19
19
  });
@@ -9,14 +9,16 @@ const StyledSwitchRoot = styled(RadixSwitch.Root, {
9
9
  borderStyle: 'solid',
10
10
  width: '42px',
11
11
  height: '22px',
12
- backgroundColor: '$neutrals300',
13
- borderColor: '$neutrals400',
12
+ backgroundColor: '$neutrals600',
13
+ borderColor: '$neutrals600',
14
14
  borderRadius: '99999px',
15
15
  position: 'relative',
16
16
  padding: '0',
17
17
  cursor: 'pointer',
18
+
18
19
  '&[data-state="checked"]': {
19
- backgroundColor: '$primary100',
20
+ backgroundColor: '$success',
21
+ borderColor: '$success',
20
22
  },
21
23
  '-webkit-tap-highlight-color': 'rgba(0, 0, 0, 0)',
22
24
  });
@@ -28,13 +30,13 @@ const StyledSwitchThumb = styled(RadixSwitch.Thumb, {
28
30
  display: 'block',
29
31
  width: '18px',
30
32
  height: '18px',
31
- backgroundColor: '$neutrals500',
33
+ backgroundColor: '$white',
32
34
  transition: ' transform 300ms',
33
35
  borderRadius: '999999px',
34
36
  willChange: 'transform',
37
+
35
38
  '&[data-state="checked"]': {
36
39
  transform: 'translateX(20px)',
37
- backgroundColor: '$primary',
38
40
  },
39
41
  });
40
42
 
@@ -15,7 +15,8 @@ const InputContainer = styled('div', {
15
15
  color: '$foreground',
16
16
  transition: 'border-color ease .3s',
17
17
  '&:focus-within': {
18
- borderColor: '$primary',
18
+ borderColor: '$success',
19
+ outline: '1px solid $success',
19
20
  },
20
21
  variants: {
21
22
  size: {
@@ -13,6 +13,7 @@ export default {
13
13
  options: [
14
14
  'body1',
15
15
  'body2',
16
+ 'body3',
16
17
  'h1',
17
18
  'h2',
18
19
  'h3',
@@ -61,6 +62,9 @@ export const Main = (props: PropTypes) => (
61
62
  <Typography {...props} variant="body2">
62
63
  Body 2
63
64
  </Typography>
65
+ <Typography {...props} variant="body3">
66
+ Body 3
67
+ </Typography>
64
68
  <Typography {...props} variant="caption">
65
69
  Caption
66
70
  </Typography>
@@ -4,7 +4,6 @@ import { styled } from '../../theme';
4
4
 
5
5
  const TypographyContainer = styled('span', {
6
6
  margin: 0,
7
- color: '$foreground',
8
7
  display: 'inline-block',
9
8
  variants: {
10
9
  variant: {
@@ -51,12 +50,6 @@ const TypographyContainer = styled('span', {
51
50
  h5: {
52
51
  fontSize: '$16',
53
52
  fontWeight: '$600',
54
- '@md': {
55
- fontSize: '$18',
56
- },
57
- '@lg': {
58
- fontSize: '$20',
59
- },
60
53
  },
61
54
  h6: {
62
55
  fontSize: '$14',
@@ -85,6 +78,10 @@ const TypographyContainer = styled('span', {
85
78
  fontSize: '$16',
86
79
  },
87
80
  },
81
+ body3: {
82
+ fontSize: '$12',
83
+ fontWeight: '$400',
84
+ },
88
85
  caption: {
89
86
  fontSize: '$10',
90
87
  fontWeight: '$400',
@@ -178,6 +175,7 @@ export interface PropTypes {
178
175
  | 'h6'
179
176
  | 'body1'
180
177
  | 'body2'
178
+ | 'body3'
181
179
  | 'caption';
182
180
  align?: 'center' | 'left' | 'right';
183
181
  noWrap?: boolean;
@@ -187,16 +185,29 @@ export interface PropTypes {
187
185
  mr?: 2 | 4 | 8 | 12;
188
186
  className?: string;
189
187
  style?: CSSProperties;
190
-
188
+ color?: string;
191
189
  }
192
190
 
193
191
  export function Typography({
194
192
  children,
195
193
  className,
194
+ color,
196
195
  ...props
197
196
  }: PropsWithChildren<PropTypes>) {
197
+ const customCss = color
198
+ ? {
199
+ color: color.startsWith('$') ? color : `$${color}`,
200
+ }
201
+ : {
202
+ color: '$foreground',
203
+ };
204
+
198
205
  return (
199
- <TypographyContainer className={`_typography _text ${className}`} {...props}>
206
+ <TypographyContainer
207
+ className={`_typography _text ${className || ''}`}
208
+ css={customCss}
209
+ {...props}
210
+ >
200
211
  {children}
201
212
  </TypographyContainer>
202
213
  );
@@ -1,7 +1,6 @@
1
1
  import React, { Fragment } from 'react';
2
2
  import { styled } from '../../theme';
3
- import { FilledCircle } from '../common';
4
- import { DownloadIcon } from '../Icon';
3
+ import { DisconnectIcon, DownloadIcon } from '../Icon';
5
4
  import { Spinner } from '../Spinner';
6
5
  import { WalletState } from '../../types/wallet';
7
6
  import { InstallObjects, detectInstallLink } from '@rango-dev/wallets-shared';
@@ -28,7 +27,7 @@ export const State = ({
28
27
  </a>
29
28
  )}
30
29
  {walletState === WalletState.CONNECTING && <Spinner />}
31
- {walletState === WalletState.CONNECTED && <FilledCircle />}
30
+ {walletState === WalletState.CONNECTED && <DisconnectIcon />}
32
31
  </StateIconContainer>
33
32
  )}
34
33
  </Fragment>
@@ -12,6 +12,25 @@ const WalletImage = styled('img', {
12
12
  height: '$24',
13
13
  marginRight: '$12',
14
14
  });
15
+ const Text = styled('div', {
16
+ display: 'flex',
17
+ flexDirection: 'column',
18
+ });
19
+
20
+ const ExtendedButton = styled(Button, {
21
+ variants: {
22
+ type: {
23
+ primary: {
24
+ outline: '1px solid $primary',
25
+ borderColor: '$primary',
26
+
27
+ '&:hover': {
28
+ borderColor: '$primary',
29
+ },
30
+ },
31
+ },
32
+ },
33
+ });
15
34
 
16
35
  export type PropTypes = WalletInfo & {
17
36
  onClick: (walletType: WalletType) => void;
@@ -19,8 +38,9 @@ export type PropTypes = WalletInfo & {
19
38
 
20
39
  export function Wallet(props: PropTypes) {
21
40
  const { name, type, image, state, onClick, installLink } = props;
41
+
22
42
  return (
23
- <Button
43
+ <ExtendedButton
24
44
  type={state === WalletState.CONNECTED ? 'primary' : undefined}
25
45
  disabled={!state}
26
46
  onClick={() => {
@@ -34,9 +54,16 @@ export function Wallet(props: PropTypes) {
34
54
  prefix={<WalletImage src={image} />}
35
55
  suffix={<State walletState={state} installLink={installLink} />}
36
56
  >
37
- <Typography variant="h5" noWrap={false}>
38
- {name}
39
- </Typography>
40
- </Button>
57
+ <Text>
58
+ <Typography variant="h5" noWrap={false}>
59
+ {name}
60
+ </Typography>
61
+ {state === WalletState.CONNECTED ? (
62
+ <Typography variant="caption" noWrap={false} color="primary">
63
+ Connected
64
+ </Typography>
65
+ ) : null}
66
+ </Text>
67
+ </ExtendedButton>
41
68
  );
42
69
  }
@@ -93,7 +93,6 @@ export interface PropTypes {
93
93
  export function ConfirmSwap(props: PropsWithChildren<PropTypes>) {
94
94
  const {
95
95
  bestRoute,
96
- onRefresh,
97
96
  onBack,
98
97
  onConfirm,
99
98
  loading,
@@ -123,7 +122,6 @@ export function ConfirmSwap(props: PropsWithChildren<PropTypes>) {
123
122
  </Button>
124
123
  </Footer>
125
124
  }
126
- TopButton={<StyledUpdateIcon size={24} onClick={onRefresh} />}
127
125
  >
128
126
  <MainContainer>
129
127
  <div>