@rango-dev/ui 0.1.13 → 0.1.14-next.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 (225) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/components/Alert/Alert.d.ts +7 -7
  3. package/dist/components/Alert/Alert.stories.d.ts +7 -5
  4. package/dist/components/Alert/LoadingFailedAlert.d.ts +2 -2
  5. package/dist/components/Alert/NotFoundAlert.d.ts +7 -7
  6. package/dist/components/Alert/index.d.ts +2 -2
  7. package/dist/components/BestRoute/BestRoute.d.ts +15 -12
  8. package/dist/components/BestRoute/BestRoute.stories.d.ts +9 -8
  9. package/dist/components/BestRoute/index.d.ts +1 -1
  10. package/dist/components/BestRoute/mock.d.ts +4 -4
  11. package/dist/components/BlockchainSelector/BlockchainSelector.d.ts +17 -17
  12. package/dist/components/BlockchainSelector/BlockchainSelector.stories.d.ts +6 -5
  13. package/dist/components/BlockchainSelector/index.d.ts +1 -1
  14. package/dist/components/BlockchainsList/BlockchainsList.d.ts +10 -10
  15. package/dist/components/BlockchainsList/BlockchainsList.stories.d.ts +6 -5
  16. package/dist/components/BlockchainsList/index.d.ts +1 -1
  17. package/dist/components/BlockchainsList/mockData.d.ts +2 -2
  18. package/dist/components/Button/Button.d.ts +17 -17
  19. package/dist/components/Button/Button.stories.d.ts +9 -8
  20. package/dist/components/Button/index.d.ts +1 -1
  21. package/dist/components/Checkbox/Checkbox.d.ts +11 -11
  22. package/dist/components/Checkbox/Checkbox.stories.d.ts +6 -5
  23. package/dist/components/Checkbox/index.d.ts +1 -1
  24. package/dist/components/Chip/Chip.d.ts +12 -12
  25. package/dist/components/Chip/Chip.stories.d.ts +8 -7
  26. package/dist/components/Chip/index.d.ts +1 -1
  27. package/dist/components/ColorPicker/ColorPicker.d.ts +9 -9
  28. package/dist/components/ColorPicker/ColorPicker.stories.d.ts +6 -5
  29. package/dist/components/ColorPicker/index.d.ts +1 -1
  30. package/dist/components/ConnectWalletsModal/ConnectWallets.stories.d.ts +6 -5
  31. package/dist/components/ConnectWalletsModal/ConnectWalletsModal.d.ts +11 -11
  32. package/dist/components/ConnectWalletsModal/index.d.ts +1 -1
  33. package/dist/components/ConnectWalletsModal/mockData.d.ts +2 -2
  34. package/dist/components/Divider/Divider.d.ts +6 -6
  35. package/dist/components/Divider/index.d.ts +1 -1
  36. package/dist/components/Drawer/Drawer.d.ts +13 -13
  37. package/dist/components/Drawer/Drawer.stories.d.ts +9 -8
  38. package/dist/components/Drawer/index.d.ts +1 -1
  39. package/dist/components/Header/Header.d.ts +9 -9
  40. package/dist/components/Header/index.d.ts +1 -1
  41. package/dist/components/Icon/AddCircleIcon.d.ts +3 -3
  42. package/dist/components/Icon/AddIcon.d.ts +3 -3
  43. package/dist/components/Icon/AddWalletIcon.d.ts +3 -3
  44. package/dist/components/Icon/AngleDownIcon.d.ts +3 -3
  45. package/dist/components/Icon/AngleLeftIcon.d.ts +3 -3
  46. package/dist/components/Icon/AngleRightIcon.d.ts +3 -3
  47. package/dist/components/Icon/AngleUpIcon.d.ts +3 -3
  48. package/dist/components/Icon/ArrowRightIcon.d.ts +3 -3
  49. package/dist/components/Icon/BagIcon.d.ts +3 -3
  50. package/dist/components/Icon/BanIcon.d.ts +3 -3
  51. package/dist/components/Icon/CheckCircleIcon.d.ts +3 -3
  52. package/dist/components/Icon/CheckIcon.d.ts +3 -3
  53. package/dist/components/Icon/CheckSquareIcon.d.ts +3 -3
  54. package/dist/components/Icon/CheckWalletIcon.d.ts +3 -3
  55. package/dist/components/Icon/ChevronRightIcon.d.ts +3 -3
  56. package/dist/components/Icon/CloseIcon.d.ts +112 -1
  57. package/dist/components/Icon/CopyIcon.d.ts +3 -3
  58. package/dist/components/Icon/DeleteCircleIcon.d.ts +3 -3
  59. package/dist/components/Icon/DeleteWalletIcon.d.ts +3 -3
  60. package/dist/components/Icon/DisconnectIcon.d.ts +3 -3
  61. package/dist/components/Icon/DownloadIcon.d.ts +3 -3
  62. package/dist/components/Icon/GasIcon.d.ts +3 -3
  63. package/dist/components/Icon/HistoryIcon.d.ts +3 -3
  64. package/dist/components/Icon/HorizontalSwapIcon.d.ts +3 -3
  65. package/dist/components/Icon/Icons.stories.d.ts +6 -5
  66. package/dist/components/Icon/InfoCircleIcon.d.ts +3 -3
  67. package/dist/components/Icon/MinusCircleIcon.d.ts +3 -3
  68. package/dist/components/Icon/RetryIcon.d.ts +3 -3
  69. package/dist/components/Icon/RetryLeftIcon.d.ts +3 -3
  70. package/dist/components/Icon/RetryRightIcon.d.ts +3 -3
  71. package/dist/components/Icon/SearchIcon.d.ts +3 -3
  72. package/dist/components/Icon/SearchMinusIcon.d.ts +3 -3
  73. package/dist/components/Icon/SettingIcon.d.ts +3 -3
  74. package/dist/components/Icon/SignatureIcon.d.ts +3 -3
  75. package/dist/components/Icon/SwapWalletIcon.d.ts +3 -3
  76. package/dist/components/Icon/TimeIcon.d.ts +3 -3
  77. package/dist/components/Icon/TrashIcon.d.ts +3 -3
  78. package/dist/components/Icon/TryAgainIcon.d.ts +3 -3
  79. package/dist/components/Icon/VerticalSwapIcon.d.ts +3 -3
  80. package/dist/components/Icon/WalletIconIcon.d.ts +3 -3
  81. package/dist/components/Icon/WarningIcon.d.ts +3 -3
  82. package/dist/components/Icon/common.d.ts +228 -2
  83. package/dist/components/Icon/index.d.ts +40 -40
  84. package/dist/components/Icon/types.d.ts +7 -7
  85. package/dist/components/LiquiditySourceList/LiquiditySource.stories.d.ts +6 -5
  86. package/dist/components/LiquiditySourceList/LiquiditySourceList.d.ts +11 -11
  87. package/dist/components/LiquiditySourceList/index.d.ts +1 -1
  88. package/dist/components/LiquiditySourceList/mockData.d.ts +2 -2
  89. package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.d.ts +13 -13
  90. package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.stories.d.ts +6 -5
  91. package/dist/components/LiquiditySourcesSelector/index.d.ts +1 -1
  92. package/dist/components/Modal/Modal.d.ts +11 -11
  93. package/dist/components/Modal/Modal.stories.d.ts +6 -5
  94. package/dist/components/Modal/index.d.ts +1 -1
  95. package/dist/components/Radio/Radio.d.ts +13 -13
  96. package/dist/components/Radio/Radio.stories.d.ts +6 -5
  97. package/dist/components/Radio/index.d.ts +1 -1
  98. package/dist/components/SecondaryPage/SecondaryPage.d.ts +16 -16
  99. package/dist/components/SecondaryPage/SecondaryPage.stories.d.ts +4 -2
  100. package/dist/components/SecondaryPage/index.d.ts +1 -1
  101. package/dist/components/SelectableWalletList/SelectableWalletList.d.ts +7 -7
  102. package/dist/components/SelectableWalletList/SelectableWalletList.stories.d.ts +6 -5
  103. package/dist/components/SelectableWalletList/index.d.ts +1 -1
  104. package/dist/components/SelectableWalletList/mock.d.ts +2 -2
  105. package/dist/components/Settings/Settings.d.ts +24 -23
  106. package/dist/components/Settings/Settings.stories.d.ts +6 -5
  107. package/dist/components/Settings/index.d.ts +1 -1
  108. package/dist/components/Skeleton/Skeleton.d.ts +6 -6
  109. package/dist/components/Skeleton/Skeleton.stories.d.ts +6 -5
  110. package/dist/components/Skeleton/index.d.ts +1 -1
  111. package/dist/components/Spacer/Spacer.d.ts +6 -6
  112. package/dist/components/Spacer/Spacer.stories.d.ts +6 -5
  113. package/dist/components/Spacer/index.d.ts +1 -1
  114. package/dist/components/Spinner/Spinner.d.ts +6 -6
  115. package/dist/components/Spinner/Spinner.stories.d.ts +6 -5
  116. package/dist/components/Spinner/index.d.ts +1 -1
  117. package/dist/components/StatusDrawer/StatusDrawer.d.ts +11 -11
  118. package/dist/components/StatusDrawer/StatusDrawer.stories.d.ts +6 -5
  119. package/dist/components/StatusDrawer/index.d.ts +1 -1
  120. package/dist/components/StepDetail/StepDetail.d.ts +12 -12
  121. package/dist/components/StepDetail/StepDetail.stories.d.ts +6 -5
  122. package/dist/components/StepDetail/index.d.ts +1 -1
  123. package/dist/components/SwapContainer/SwapContainer.d.ts +7 -7
  124. package/dist/components/SwapContainer/SwapContainer.stories.d.ts +6 -5
  125. package/dist/components/SwapContainer/index.d.ts +1 -1
  126. package/dist/components/SwapDetail/SwapDetail.d.ts +8 -8
  127. package/dist/components/SwapDetail/SwapDetail.stories.d.ts +6 -5
  128. package/dist/components/SwapDetail/Token.d.ts +17 -17
  129. package/dist/components/SwapDetail/index.d.ts +1 -1
  130. package/dist/components/SwapDetail/mock.d.ts +2 -2
  131. package/dist/components/Switch/Switch.d.ts +6 -6
  132. package/dist/components/Switch/Switch.stories.d.ts +6 -5
  133. package/dist/components/Switch/index.d.ts +1 -1
  134. package/dist/components/TextField/TextField.d.ts +10 -10
  135. package/dist/components/TextField/TextField.stories.d.ts +8 -7
  136. package/dist/components/TextField/index.d.ts +1 -1
  137. package/dist/components/TokenList/TokenItem.d.ts +11 -11
  138. package/dist/components/TokenList/TokenList.d.ts +17 -17
  139. package/dist/components/TokenList/TokenList.stories.d.ts +6 -5
  140. package/dist/components/TokenList/index.d.ts +1 -1
  141. package/dist/components/TokenList/mockData.d.ts +2 -2
  142. package/dist/components/TokenSelector/TokenSelector.d.ts +124 -14
  143. package/dist/components/TokenSelector/TokenSelector.stories.d.ts +6 -5
  144. package/dist/components/TokenSelector/index.d.ts +1 -1
  145. package/dist/components/Tooltip/Tooltip.d.ts +7 -7
  146. package/dist/components/Tooltip/Tooltip.stories.d.ts +6 -5
  147. package/dist/components/Tooltip/index.d.ts +1 -1
  148. package/dist/components/Typography/Typography.d.ts +18 -18
  149. package/dist/components/Typography/Typography.stories.d.ts +6 -5
  150. package/dist/components/Typography/index.d.ts +1 -1
  151. package/dist/components/VirtualizedList/VirtualizedList.d.ts +17 -17
  152. package/dist/components/Wallet/State.d.ts +7 -7
  153. package/dist/components/Wallet/Wallet.d.ts +7 -7
  154. package/dist/components/Wallet/Wallet.stories.d.ts +6 -5
  155. package/dist/components/Wallet/index.d.ts +1 -1
  156. package/dist/components/common/FilledCircle.d.ts +111 -1
  157. package/dist/components/common/Image.d.ts +6 -6
  158. package/dist/components/common/index.d.ts +2 -2
  159. package/dist/components/index.d.ts +31 -31
  160. package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +22 -22
  161. package/dist/containers/ConfirmSwap/ConfirmSwap.stories.d.ts +7 -6
  162. package/dist/containers/ConfirmSwap/index.d.ts +1 -1
  163. package/dist/containers/ConfirmSwap/mock.d.ts +5 -5
  164. package/dist/containers/History/History.d.ts +6 -6
  165. package/dist/containers/History/History.stories.d.ts +6 -5
  166. package/dist/containers/History/SwapsGroup.d.ts +13 -13
  167. package/dist/containers/History/index.d.ts +3 -2
  168. package/dist/containers/History/mock.d.ts +2 -2
  169. package/dist/containers/History/types.d.ts +39 -39
  170. package/dist/containers/SwapHistory/SwapHistory.d.ts +1128 -24
  171. package/dist/containers/SwapHistory/SwapHistory.stories.d.ts +6 -5
  172. package/dist/containers/SwapHistory/SwapMessages.d.ts +17 -17
  173. package/dist/containers/SwapHistory/index.d.ts +1 -1
  174. package/dist/containers/SwapHistory/mock.d.ts +2 -2
  175. package/dist/containers/index.d.ts +3 -3
  176. package/dist/helper/index.d.ts +6 -3
  177. package/dist/hooks/index.d.ts +1 -1
  178. package/dist/hooks/useCopyToClipboard.d.ts +1 -1
  179. package/dist/index.d.ts +6 -5
  180. package/dist/index.js +20 -8
  181. package/dist/index.js.map +7 -0
  182. package/dist/theme.d.ts +928 -8
  183. package/dist/types/index.d.ts +2 -2
  184. package/dist/types/meta.d.ts +23 -23
  185. package/dist/types/swaps.d.ts +29 -29
  186. package/dist/types/wallet.d.ts +23 -23
  187. package/package.json +10 -34
  188. package/src/components/Alert/Alert.tsx +2 -2
  189. package/src/components/BestRoute/BestRoute.tsx +4 -3
  190. package/src/components/Button/Button.tsx +42 -42
  191. package/src/components/Checkbox/Checkbox.tsx +2 -0
  192. package/src/components/Chip/Chip.tsx +1 -1
  193. package/src/components/ColorPicker/ColorPicker.stories.tsx +9 -2
  194. package/src/components/ColorPicker/ColorPicker.tsx +34 -10
  195. package/src/components/Icon/common.ts +2 -2
  196. package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +2 -2
  197. package/src/components/Modal/Modal.tsx +3 -2
  198. package/src/components/Radio/Radio.tsx +2 -2
  199. package/src/components/SelectableWalletList/SelectableWalletList.tsx +5 -5
  200. package/src/components/Settings/Settings.tsx +22 -18
  201. package/src/components/Skeleton/Skeleton.tsx +1 -1
  202. package/src/components/Spinner/Spinner.tsx +1 -1
  203. package/src/components/StepDetail/StepDetail.tsx +4 -4
  204. package/src/components/SwapContainer/SwapContainer.tsx +3 -3
  205. package/src/components/SwapDetail/SwapDetail.tsx +1 -1
  206. package/src/components/SwapDetail/Token.tsx +2 -2
  207. package/src/components/Switch/Switch.tsx +2 -2
  208. package/src/components/TextField/TextField.tsx +3 -3
  209. package/src/components/TokenList/TokenItem.tsx +1 -1
  210. package/src/components/Tooltip/Tooltip.tsx +2 -2
  211. package/src/containers/ConfirmSwap/ConfirmSwap.tsx +4 -4
  212. package/src/containers/History/SwapsGroup.tsx +1 -1
  213. package/src/containers/History/index.ts +2 -1
  214. package/src/containers/History/types.tsx +1 -1
  215. package/src/containers/SwapHistory/SwapHistory.tsx +5 -5
  216. package/src/helper/index.ts +75 -0
  217. package/src/index.ts +1 -0
  218. package/src/theme.ts +34 -36
  219. package/src/types/index.ts +1 -1
  220. package/dist/ui.cjs.development.js +0 -5094
  221. package/dist/ui.cjs.development.js.map +0 -1
  222. package/dist/ui.cjs.production.min.js +0 -2
  223. package/dist/ui.cjs.production.min.js.map +0 -1
  224. package/dist/ui.esm.js +0 -5005
  225. package/dist/ui.esm.js.map +0 -1
@@ -32,10 +32,10 @@ const StyledItem = styled(RadioGroup.Item, {
32
32
  borderRadius: '100%',
33
33
  cursor: 'pointer',
34
34
  backgroundColor: '$background',
35
- border: '1px solid $neutrals400',
35
+ border: '1px solid $neutral400',
36
36
 
37
37
  '&:hover': {
38
- borderColor: '$neutrals600',
38
+ borderColor: '$neutral600',
39
39
  },
40
40
  });
41
41
 
@@ -14,7 +14,7 @@ const Circle = styled('div', {
14
14
  width: 12,
15
15
  height: 12,
16
16
  borderRadius: 6,
17
- border: '1px solid $neutrals400',
17
+ border: '1px solid $neutral400',
18
18
  position: 'absolute',
19
19
  top: 12,
20
20
  right: 12,
@@ -24,7 +24,7 @@ const Circle = styled('div', {
24
24
  borderColor: '$success',
25
25
  },
26
26
  false: {
27
- borderColor: '$neutrals400',
27
+ borderColor: '$neutral400',
28
28
  },
29
29
  },
30
30
  },
@@ -40,7 +40,7 @@ const SolidCircle = styled('div', {
40
40
  backgroundColor: '$success',
41
41
  },
42
42
  false: {
43
- backgroundColor: '$neutrals400',
43
+ backgroundColor: '$neutral400',
44
44
  },
45
45
  },
46
46
  },
@@ -65,8 +65,8 @@ const Container = styled('div', {
65
65
  color: '$success',
66
66
  },
67
67
  false: {
68
- borderColor: '$neutrals400',
69
- color: '$neutrals400',
68
+ borderColor: '$neutral400',
69
+ color: '$neutral400',
70
70
  },
71
71
  },
72
72
  },
@@ -12,7 +12,7 @@ import { Button } from '../Button';
12
12
 
13
13
  const BaseContainer = styled('div', {
14
14
  borderRadius: '$5',
15
- backgroundColor: '$neutrals300',
15
+ backgroundColor: '$neutral100',
16
16
  padding: '$16',
17
17
  });
18
18
 
@@ -60,7 +60,7 @@ type Theme = 'dark' | 'light' | 'auto';
60
60
  export interface PropTypes {
61
61
  slippages: number[];
62
62
  selectedSlippage: number;
63
- customSlippage: number;
63
+ customSlippage: number | null;
64
64
  maxSlippage: number;
65
65
  minSlippage: number;
66
66
  liquiditySources: LiquiditySource[];
@@ -74,6 +74,7 @@ export interface PropTypes {
74
74
  infiniteApprove: boolean;
75
75
  toggleInfiniteApprove: (infinite: boolean) => void;
76
76
  loadingStatus: LoadingStatus;
77
+ singleTheme?: boolean;
77
78
  }
78
79
 
79
80
  export function Settings(props: PropTypes) {
@@ -93,6 +94,7 @@ export function Settings(props: PropTypes) {
93
94
  toggleInfiniteApprove,
94
95
  infiniteApprove,
95
96
  loadingStatus,
97
+ singleTheme,
96
98
  } = props;
97
99
 
98
100
  const [selectedSlippage, setSelectedSlippage] = useState(
@@ -132,7 +134,7 @@ export function Settings(props: PropTypes) {
132
134
  ))}
133
135
  <TextField
134
136
  type="number"
135
- value={customSlippage}
137
+ value={customSlippage || ''}
136
138
  onChange={(event) => {
137
139
  const parsedValue = parseFloat(event.target.value);
138
140
  if (
@@ -153,20 +155,22 @@ export function Settings(props: PropTypes) {
153
155
  />
154
156
  </SlippageChipsContainer>
155
157
  </BaseContainer>
156
- <ThemesContainer>
157
- <Title variant="body2">Theme</Title>
158
- <Radio
159
- value={selectedTheme}
160
- options={[
161
- { value: 'dark', label: 'Dark' },
162
- { value: 'light', label: 'Light' },
163
- { value: 'auto', label: 'Auto' },
164
- ]}
165
- onChange={(value) => onThemeChange(value as Theme)}
166
- direction="horizontal"
167
- style={{ marginTop: '$24' }}
168
- />
169
- </ThemesContainer>
158
+ {!singleTheme && (
159
+ <ThemesContainer>
160
+ <Title variant="body2">Theme</Title>
161
+ <Radio
162
+ value={selectedTheme}
163
+ options={[
164
+ { value: 'dark', label: 'Dark' },
165
+ { value: 'light', label: 'Light' },
166
+ { value: 'auto', label: 'Auto' },
167
+ ]}
168
+ onChange={(value) => onThemeChange(value as Theme)}
169
+ direction="horizontal"
170
+ style={{ marginTop: '$24' }}
171
+ />
172
+ </ThemesContainer>
173
+ )}
170
174
  <InfiniteContainer>
171
175
  <Typography variant="body2">Infinite Approval</Typography>
172
176
  <Switch checked={infiniteApprove} onChange={toggleInfiniteApprove} />
@@ -180,7 +184,7 @@ export function Settings(props: PropTypes) {
180
184
  suffix={
181
185
  <LiquiditySourceNumber>
182
186
  {loadingStatus === 'success' && (
183
- <Typography variant="body2" color="neutrals800">
187
+ <Typography variant="body2" color="neutral800">
184
188
  {liquiditySources.length !== selectedLiquiditySources.length
185
189
  ? `${selectedLiquiditySources.length} / ${liquiditySources.length}`
186
190
  : liquiditySources.length}
@@ -12,7 +12,7 @@ const waveSquares = keyframes({
12
12
 
13
13
  const SkeletonContainer = styled('div', {
14
14
  borderRadius: '$5',
15
- backgroundColor: '$neutrals300',
15
+ backgroundColor: '$neutral100',
16
16
  background: `linear-gradient(to right, rgba(130, 130, 130, 0.2) 8%, rgba(130, 130, 130, 0.3) 18%, rgba(130, 130, 130, 0.2) 33%)`,
17
17
  backgroundSize: '800px 100px',
18
18
  animation: `${waveSquares} 2s infinite ease-out`,
@@ -10,7 +10,7 @@ const spin = keyframes({
10
10
  const SpinnerContainer = styled('div', {
11
11
  borderRadius: '50%',
12
12
  position: 'relative',
13
- border: `2px solid $neutrals300`,
13
+ border: `2px solid $neutral100`,
14
14
  borderRight: `2px solid`,
15
15
  animation: `${spin} 1.5s linear infinite`,
16
16
  margin: `0px $8`,
@@ -30,7 +30,7 @@ const ChainLogo = styled('div', {
30
30
  padding: '$2',
31
31
  borderRadius: '50%',
32
32
  backgroundColor: '$background',
33
- border: '1px solid $neutrals400',
33
+ border: '1px solid $neutral400',
34
34
 
35
35
  img: {
36
36
  width: '100%',
@@ -74,7 +74,7 @@ const Detail = styled('div', {
74
74
  },
75
75
  });
76
76
  const SubTitle = styled(Typography, {
77
- color: '$neutrals600',
77
+ color: '$neutral600',
78
78
  display: 'block',
79
79
  paddingLeft: '$8',
80
80
  });
@@ -121,7 +121,7 @@ export function StepDetail(props: PropsWithChildren<PropTypes>) {
121
121
  <Typography
122
122
  noWrap
123
123
  variant={direction === 'vertical' ? 'body2' : 'title'}
124
- color={'$neutrals600'}
124
+ color={'$neutral600'}
125
125
  >
126
126
  {estimatedAmount}
127
127
  </Typography>
@@ -133,7 +133,7 @@ export function StepDetail(props: PropsWithChildren<PropTypes>) {
133
133
  >
134
134
  {symbol}
135
135
  </Typography>
136
- <SubTitle noWrap variant="caption" color="$neutrals800">
136
+ <SubTitle noWrap variant="caption" color="$neutral800">
137
137
  on {blockchain}
138
138
  </SubTitle>
139
139
  </Detail>
@@ -20,14 +20,14 @@ const MainContainer = styled('div', {
20
20
  listStyleType: 'none',
21
21
  '&::-webkit-scrollbar': { width: '$8', height: '$8' },
22
22
  '&::-webkit-scrollbar-thumb': {
23
- backgroundColor: '$neutrals400',
23
+ backgroundColor: '$neutral400',
24
24
  borderRadius: '$10',
25
25
  },
26
26
  '&::-webkit-scrollbar-thumb:hover': {
27
- backgroundColor: '$neutrals500',
27
+ backgroundColor: '$neutral500',
28
28
  },
29
29
  '&::-webkit-scrollbar-track': {
30
- backgroundColor: '$neutrals300',
30
+ backgroundColor: '$neutral100',
31
31
  },
32
32
  },
33
33
  variants: {
@@ -14,7 +14,7 @@ const Container = styled('div', {
14
14
  justifyContent: 'space-between',
15
15
  alignItems: 'center',
16
16
  padding: '$16 0',
17
- borderBottom: '1px solid $neutrals300',
17
+ borderBottom: '1px solid $neutral100',
18
18
 
19
19
  '& > .info': {
20
20
  display: 'flex',
@@ -12,7 +12,7 @@ const TokenContainer = styled('div', {
12
12
  fontWeight: 'bold',
13
13
  },
14
14
  '& .estimated': {
15
- color: '$neutrals600',
15
+ color: '$neutral600',
16
16
  },
17
17
  });
18
18
 
@@ -33,7 +33,7 @@ const TokenImage = styled('div', {
33
33
  justifyContent: 'center',
34
34
  alignItems: 'center',
35
35
  backgroundColor: '$background',
36
- border: '1px solid $neutrals400',
36
+ border: '1px solid $neutral400',
37
37
  },
38
38
  });
39
39
 
@@ -9,8 +9,8 @@ const StyledSwitchRoot = styled(RadixSwitch.Root, {
9
9
  borderStyle: 'solid',
10
10
  width: '42px',
11
11
  height: '22px',
12
- backgroundColor: '$neutrals600',
13
- borderColor: '$neutrals600',
12
+ backgroundColor: '$neutral600',
13
+ borderColor: '$neutral600',
14
14
  borderRadius: '99999px',
15
15
  position: 'relative',
16
16
  padding: '0',
@@ -3,10 +3,10 @@ import React, { PropsWithChildren, RefObject } from 'react';
3
3
  import { styled } from '../../theme';
4
4
 
5
5
  const InputContainer = styled('div', {
6
- backgroundColor: '$background',
6
+ backgroundColor: '$surface',
7
7
  padding: '1px',
8
8
  boxSizing: 'border-box',
9
- border: '1px solid $neutrals400',
9
+ border: '1px solid $neutral400',
10
10
  borderRadius: '$5',
11
11
  height: '$48',
12
12
  display: 'flex',
@@ -43,7 +43,7 @@ const InputContainer = styled('div', {
43
43
  },
44
44
  disabled: {
45
45
  true: {
46
- backgroundColor: '$neutrals300',
46
+ backgroundColor: '$neutral100',
47
47
  cursor: 'not-allowed',
48
48
  filter: 'grayscale(100%)',
49
49
  },
@@ -66,7 +66,7 @@ export function TokenItem(props: PropTypes) {
66
66
  >
67
67
  <TokenNameContainer>
68
68
  <Typography variant="body1">{token.symbol}</Typography>
69
- <Typography variant="caption" color="neutrals600">
69
+ <Typography variant="caption" color="neutral600">
70
70
  {token.name}
71
71
  </Typography>
72
72
  </TokenNameContainer>
@@ -46,7 +46,7 @@ const TooltipContent = styled(RadixTooltip.Content, {
46
46
  color: '$white',
47
47
  },
48
48
  gray: {
49
- backgroundColor: '$neutrals300',
49
+ backgroundColor: '$neutral100',
50
50
  color: '$black',
51
51
  },
52
52
  black: {
@@ -76,7 +76,7 @@ const TooltipArrow = styled(RadixTooltip.Arrow, {
76
76
  fill: '$success',
77
77
  },
78
78
  gray: {
79
- fill: '$neutrals300',
79
+ fill: '$neutral100',
80
80
  },
81
81
  black: {
82
82
  fill: '$black',
@@ -14,7 +14,7 @@ const MainContainer = styled('div', {
14
14
  const Section = styled('div', {
15
15
  paddingBottom: '$32',
16
16
  marginBottom: '$32',
17
- borderBottom: '1px solid $neutrals400',
17
+ borderBottom: '1px solid $neutral400',
18
18
  });
19
19
 
20
20
  const Footer = styled('div', {
@@ -39,14 +39,14 @@ const Container = styled('div', {
39
39
  alignItems: 'center',
40
40
  },
41
41
  '.num': {
42
- backgroundColor: '$neutrals300',
42
+ backgroundColor: '$neutral100',
43
43
  display: 'inline-flex',
44
44
  width: '24px',
45
45
  height: '24px',
46
- color: '$neutrals800',
46
+ color: '$neutral800',
47
47
  borderRadius: '50%',
48
48
  fontSize: '$14',
49
- border: '1px solid $neutrals400',
49
+ border: '1px solid $neutral400',
50
50
  justifyContent: 'center',
51
51
  alignItems: 'center',
52
52
  },
@@ -34,7 +34,7 @@ export function SwapsGroup(props: Omit<PropTypes, 'onBack'>) {
34
34
  <Group>
35
35
  <Typography
36
36
  variant="body2"
37
- color="neutrals600"
37
+ color="neutral600"
38
38
  className="group-title"
39
39
  >
40
40
  {group.title}
@@ -1,2 +1,3 @@
1
1
  export { History } from './History';
2
- export { SwapsGroup, GroupBy } from './SwapsGroup';
2
+ export { SwapsGroup } from './SwapsGroup';
3
+ export type { GroupBy } from './SwapsGroup';
@@ -7,7 +7,7 @@ import {
7
7
  Transfer,
8
8
  } from 'rango-sdk';
9
9
  import { PendingSwapNetworkStatus, StepStatus } from '../../types/swaps';
10
- export { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
10
+ export type { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
11
11
 
12
12
  export type PendingSwapStep = {
13
13
  id: number;
@@ -53,7 +53,7 @@ export const ErrorMsg = styled(Typography, {
53
53
 
54
54
  export const FeeContainer = styled('div', {
55
55
  paddingLeft: '$16',
56
- color: '$neutrals800'
56
+ color: '$neutral800'
57
57
  });
58
58
 
59
59
  export const Fee = styled('div', {
@@ -96,7 +96,7 @@ const SwapInfoContainer = styled('div', {
96
96
  display: 'flex',
97
97
  flexDirection: 'column',
98
98
  paddingBottom: '$16',
99
- borderBottom: '1px solid $neutrals300',
99
+ borderBottom: '1px solid $neutral100',
100
100
  });
101
101
 
102
102
  const InternalDetailsContainer = styled('div', {
@@ -137,12 +137,12 @@ const Row = styled('div', {
137
137
  padding: '$8 0',
138
138
 
139
139
  '.name': {
140
- color: '$neutrals600',
140
+ color: '$neutral600',
141
141
  },
142
142
  '.value': {
143
143
  display: 'flex',
144
144
  alignItems: 'center',
145
- color: '$neutrals800',
145
+ color: '$neutral800',
146
146
  justifyContent: 'flex-end',
147
147
  },
148
148
  '.status': {
@@ -169,7 +169,7 @@ const RequestId = styled('div', {
169
169
 
170
170
  const ExtraDetails = styled('div', {
171
171
  padding: '0',
172
- color: '$neutrals600',
172
+ color: '$neutral600',
173
173
  fontSize: '$10',
174
174
  });
175
175
 
@@ -29,3 +29,78 @@ export function limitDecimalPlaces(
29
29
  return roundedNumber.toString();
30
30
  }
31
31
  }
32
+
33
+ const hexToRgb = (hex: string) =>
34
+ ((value) =>
35
+ value.length === 3
36
+ ? value.split('').map((c) => parseInt(c.repeat(2), 16))
37
+ : (value.match(/.{1,2}/g) || []).map((v) => parseInt(v, 16)))(
38
+ hex.replace('#', '')
39
+ );
40
+
41
+ const isHexTooDark = (hexColor: string) =>
42
+ (([r, g, b]) => 0.2126 * r + 0.7152 * g + 0.0722 * b < 40)(
43
+ hexToRgb(hexColor)
44
+ );
45
+
46
+ const isHexTooLight = (hexColor: string) =>
47
+ (([r, g, b]) => (r * 299 + g * 587 + b * 114) / 1000 > 155)(
48
+ hexToRgb(hexColor)
49
+ );
50
+
51
+ const colorShade = (col: string, amt: number) => {
52
+ col = col.replace(/^#/, '');
53
+ if (col.length === 3)
54
+ col = col[0] + col[0] + col[1] + col[1] + col[2] + col[2];
55
+ let [r, g, b]: any = col.match(/.{2}/g);
56
+ [r, g, b] = [
57
+ parseInt(r, 16) + amt,
58
+ parseInt(g, 16) + amt,
59
+ parseInt(b, 16) + amt,
60
+ ];
61
+
62
+ r = Math.max(Math.min(255, r), 0).toString(16);
63
+ g = Math.max(Math.min(255, g), 0).toString(16);
64
+ b = Math.max(Math.min(255, b), 0).toString(16);
65
+
66
+ const rr = (r.length < 2 ? '0' : '') + r;
67
+ const gg = (g.length < 2 ? '0' : '') + g;
68
+ const bb = (b.length < 2 ? '0' : '') + b;
69
+
70
+ return `#${rr}${gg}${bb}`;
71
+ };
72
+
73
+ export const generateRangeColors = (
74
+ name: string,
75
+ mode: 'light' | 'dark',
76
+ color?: string,
77
+ ) => {
78
+ let colors = { [name]: color };
79
+ if (color) {
80
+ let c = color;
81
+ if (isHexTooDark(color) || mode === 'dark') {
82
+ for (let i = 1; i < 10; i++) {
83
+ colors = {
84
+ ...colors,
85
+ [name + i * 100]:
86
+ name === 'neutral'
87
+ ? colorShade(c, i * 15)
88
+ : colorShade(color, i * 5),
89
+ };
90
+ }
91
+ }
92
+ if (isHexTooLight(color) || mode === 'light') {
93
+ for (let i = 1; i < 10; i++) {
94
+ c = colorShade(c, -(i * 5));
95
+ colors = {
96
+ ...colors,
97
+ [name + i * 100]:
98
+ name === 'neutral'
99
+ ? colorShade(c, -(i * 5))
100
+ : colorShade(color, -(i * 5)),
101
+ };
102
+ }
103
+ }
104
+ }
105
+ return colors;
106
+ };
package/src/index.ts CHANGED
@@ -3,3 +3,4 @@ export * from './containers';
3
3
  export * from './theme';
4
4
  export * from './types';
5
5
  export * from './hooks';
6
+ export { generateRangeColors } from './helper';
package/src/theme.ts CHANGED
@@ -2,11 +2,10 @@
2
2
 
3
3
  import { PropertyValue, CreateStitches } from '@stitches/react';
4
4
  import { DefaultThemeMap } from '@stitches/react/types/config';
5
-
6
- // Solution: (https://github.com/stitchesjs/stitches/issues/833#issuecomment-950707025)
7
- const { createStitches } = require('@stitches/react');
5
+ import { createStitches } from '@stitches/react';
8
6
 
9
7
  /* ----------------------- Values ----------------------- */
8
+
10
9
  const theme = {
11
10
  colors: {
12
11
  primary: '#5FA425',
@@ -19,14 +18,16 @@ const theme = {
19
18
  primary700: '#396216',
20
19
  primary800: '#26420F',
21
20
  primary900: '#132107',
22
- neutrals200: '#FAFAFA',
23
- neutrals300: '#EAEAEA',
24
- neutrals400: '#999999',
25
- neutrals500: '#888888',
26
- neutrals600: '#666666',
27
- neutrals700: '#444444',
28
- neutrals800: '#333333',
29
- neutrals900: '#111111',
21
+ surface: '#fff',
22
+ neutral100: '#f3f3f3',
23
+ neutral200: '#FAFAFA',
24
+ neutral300: '#EAEAEA',
25
+ neutral400: '#999999',
26
+ neutral500: '#888888',
27
+ neutral600: '#666666',
28
+ neutral700: '#444444',
29
+ neutral800: '#333333',
30
+ neutral900: '#111111',
30
31
  background: '#fff',
31
32
  foreground: '#000',
32
33
  success: '#0070F3',
@@ -124,36 +125,33 @@ const utils = {
124
125
 
125
126
  const typedCreateStiches = createStitches as CreateStitches;
126
127
 
127
- // Note: it seems there is a bug on tsdx and when it compiles the code, it goes through an error
128
- // We can directly check it with `tsc` to see if the error is correct or not.
129
- // We `ignore` it for now, to get safety check on VSCode.
130
- // @ts-ignore
131
- export const { styled, css, createTheme, keyframes, globalCss } =
132
- typedCreateStiches<
133
- '',
134
- typeof media,
135
- typeof theme,
136
- DefaultThemeMap,
137
- // TODO: Make `utils` typesafe as well.
138
- {}
139
- >({
140
- media,
141
- theme,
142
- utils,
143
- });
128
+ export const { styled, css, createTheme, keyframes, globalCss } = typedCreateStiches<
129
+ '',
130
+ typeof media,
131
+ typeof theme,
132
+ DefaultThemeMap,
133
+ // TODO: Make `utils` typesafe as well.
134
+ {}
135
+ >({
136
+ media,
137
+ theme,
138
+ utils,
139
+ });
144
140
 
145
141
  export const lightTheme = createTheme({});
146
142
 
147
143
  export const darkTheme = createTheme({
148
144
  colors: {
149
- neutrals200: '#111111',
150
- neutrals300: '#333333',
151
- neutrals400: '#444444',
152
- neutrals500: '#666666',
153
- neutrals600: '#888888',
154
- neutrals700: '#999999',
155
- neutrals800: '#EAEAEA',
156
- neutrals900: '#FAFAFA',
145
+ surface: '#000',
146
+ neutral900: '#f3f3f3',
147
+ neutral800: '#FAFAFA',
148
+ neutral700: '#EAEAEA',
149
+ neutral600: '#999999',
150
+ neutral500: '#888888',
151
+ neutral400: '#666666',
152
+ neutral300: '#444444',
153
+ neutral200: '#333333',
154
+ neutral100: '#111111',
157
155
  foreground: '#fff',
158
156
  background: '#000',
159
157
  },
@@ -1,3 +1,3 @@
1
1
  export * from './wallet';
2
2
 
3
- export { BestRouteWithFee } from './swaps';
3
+ export type { BestRouteWithFee } from './swaps';