@rango-dev/ui 0.1.12 → 0.1.13

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 (31) hide show
  1. package/dist/hooks/index.d.ts +1 -0
  2. package/dist/hooks/useCopyToClipboard.d.ts +1 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/ui.cjs.development.js +98 -34
  5. package/dist/ui.cjs.development.js.map +1 -1
  6. package/dist/ui.cjs.production.min.js +1 -1
  7. package/dist/ui.cjs.production.min.js.map +1 -1
  8. package/dist/ui.esm.js +98 -35
  9. package/dist/ui.esm.js.map +1 -1
  10. package/package.json +1 -1
  11. package/src/components/BlockchainSelector/BlockchainSelector.tsx +2 -2
  12. package/src/components/Icon/ArrowRightIcon.tsx +3 -3
  13. package/src/components/Icon/ChevronRightIcon.tsx +3 -3
  14. package/src/components/Icon/DisconnectIcon.tsx +3 -3
  15. package/src/components/Icon/HistoryIcon.tsx +3 -3
  16. package/src/components/Icon/RetryIcon.tsx +3 -3
  17. package/src/components/Icon/SettingIcon.tsx +3 -3
  18. package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +1 -1
  19. package/src/components/SwapContainer/SwapContainer.tsx +16 -0
  20. package/src/components/SwapDetail/Token.tsx +3 -1
  21. package/src/components/TextField/TextField.tsx +10 -2
  22. package/src/components/TokenSelector/TokenSelector.tsx +2 -2
  23. package/src/components/Wallet/Wallet.tsx +4 -0
  24. package/src/containers/ConfirmSwap/ConfirmSwap.tsx +4 -4
  25. package/src/containers/History/History.tsx +1 -1
  26. package/src/containers/History/SwapsGroup.tsx +7 -7
  27. package/src/containers/SwapHistory/SwapMessages.tsx +3 -1
  28. package/src/hooks/index.ts +1 -0
  29. package/src/hooks/useCopyToClipboard.ts +23 -0
  30. package/src/index.ts +1 -0
  31. /package/{README.md → readme.md} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/ui",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -54,8 +54,8 @@ export function BlockchainSelector(props: PropTypes) {
54
54
  <SecondaryPage
55
55
  textField={true}
56
56
  hasHeader={hasHeader}
57
- textFieldPlaceholder="Search Blockchain By Name"
58
- title={`Select ${type} Network`}
57
+ textFieldPlaceholder="Search blockchains by name"
58
+ title={`Select ${type} Blockchain`}
59
59
  onBack={onBack}
60
60
  >
61
61
  {(searchedFor) => {
@@ -15,9 +15,9 @@ export const ArrowRightIcon: React.FC<IconProps> = ({
15
15
  color={color}
16
16
  fill="none"
17
17
  stroke="currentColor"
18
- stroke-width="2"
19
- stroke-linecap="round"
20
- stroke-linejoin="round"
18
+ strokeWidth="2"
19
+ strokeLinecap="round"
20
+ strokeLinejoin="round"
21
21
  xmlns="http://www.w3.org/2000/svg"
22
22
  className="_icon"
23
23
  {...props}
@@ -13,9 +13,9 @@ export const ChevronRightIcon = React.forwardRef<SVGSVGElement, IconProps>(
13
13
  viewBox={`0 0 24 24`}
14
14
  fill="none"
15
15
  stroke="currentColor"
16
- stroke-width="2"
17
- stroke-linecap="round"
18
- stroke-linejoin="round"
16
+ strokeWidth="2"
17
+ strokeLinecap="round"
18
+ strokeLinejoin="round"
19
19
  className="_icon"
20
20
  {...props}
21
21
  ref={forwardedRef}
@@ -13,9 +13,9 @@ export const DisconnectIcon = React.forwardRef<SVGSVGElement, IconProps>(
13
13
  viewBox={`0 0 24 24`}
14
14
  fill="none"
15
15
  stroke="currentColor"
16
- stroke-width="2"
17
- stroke-linecap="round"
18
- stroke-linejoin="round"
16
+ strokeWidth="2"
17
+ strokeLinecap="round"
18
+ strokeLinejoin="round"
19
19
  className="_icon"
20
20
  {...props}
21
21
  ref={forwardedRef}
@@ -15,9 +15,9 @@ export const HistoryIcon: React.FC<IconProps> = ({
15
15
  color={color}
16
16
  fill="none"
17
17
  stroke="currentColor"
18
- stroke-width="2"
19
- stroke-linecap="round"
20
- stroke-linejoin="round"
18
+ strokeWidth="2"
19
+ strokeLinecap="round"
20
+ strokeLinejoin="round"
21
21
  xmlns="http://www.w3.org/2000/svg"
22
22
  className="_icon"
23
23
  {...props}
@@ -13,9 +13,9 @@ export const RetryIcon = React.forwardRef<SVGSVGElement, IconProps>(
13
13
  viewBox={`0 0 24 24`}
14
14
  fill="none"
15
15
  stroke="currentColor"
16
- stroke-width="2"
17
- stroke-linecap="round"
18
- stroke-linejoin="round"
16
+ strokeWidth="2"
17
+ strokeLinecap="round"
18
+ strokeLinejoin="round"
19
19
  className="_icon"
20
20
  {...props}
21
21
  ref={forwardedRef}
@@ -14,9 +14,9 @@ export const SettingsIcon: React.FC<IconProps> = ({
14
14
  viewBox="0 0 24 24"
15
15
  color={color}
16
16
  stroke="currentColor"
17
- stroke-width="2"
18
- stroke-linecap="round"
19
- stroke-linejoin="round"
17
+ strokeWidth="2"
18
+ strokeLinecap="round"
19
+ strokeLinejoin="round"
20
20
  fill="none"
21
21
  xmlns="http://www.w3.org/2000/svg"
22
22
  className="_icon"
@@ -37,7 +37,7 @@ export function LiquiditySourcesSelector(props: PropTypes) {
37
37
  return (
38
38
  <SecondaryPage
39
39
  textField={true}
40
- textFieldPlaceholder="Search By Name"
40
+ textFieldPlaceholder="Search by name"
41
41
  title="Liquidity Sources"
42
42
  TopButton={
43
43
  <Button variant="ghost" type="primary" onClick={toggleAll}>
@@ -14,6 +14,22 @@ const MainContainer = styled('div', {
14
14
  padding: '$16',
15
15
  boxSizing: 'border-box',
16
16
  backgroundColor: '$background',
17
+ overflow: 'hidden',
18
+ '& *': {
19
+ boxSizing: 'border-box',
20
+ listStyleType: 'none',
21
+ '&::-webkit-scrollbar': { width: '$8', height: '$8' },
22
+ '&::-webkit-scrollbar-thumb': {
23
+ backgroundColor: '$neutrals400',
24
+ borderRadius: '$10',
25
+ },
26
+ '&::-webkit-scrollbar-thumb:hover': {
27
+ backgroundColor: '$neutrals500',
28
+ },
29
+ '&::-webkit-scrollbar-track': {
30
+ backgroundColor: '$neutrals300',
31
+ },
32
+ },
17
33
  variants: {
18
34
  fixedHeight: {
19
35
  true: {
@@ -18,7 +18,9 @@ const TokenContainer = styled('div', {
18
18
 
19
19
  const TokenImage = styled('div', {
20
20
  position: 'relative',
21
-
21
+ 'img': {
22
+ borderRadius: '50%',
23
+ },
22
24
  '.overlay': {
23
25
  position: 'absolute',
24
26
  right: -4,
@@ -23,12 +23,21 @@ const InputContainer = styled('div', {
23
23
  variants: {
24
24
  size: {
25
25
  small: {
26
+ '& input': {
27
+ fontSize: '$14',
28
+ },
26
29
  height: '$32',
27
30
  },
28
31
  medium: {
32
+ '& input': {
33
+ fontSize: '$15',
34
+ },
29
35
  height: '$40',
30
36
  },
31
37
  large: {
38
+ '& input': {
39
+ fontSize: '$16',
40
+ },
32
41
  height: '$48',
33
42
  },
34
43
  },
@@ -70,7 +79,6 @@ const Input = styled('input', {
70
79
  border: 'none',
71
80
  borderRadius: '$5',
72
81
  outline: 'none',
73
- fontSize: '$l',
74
82
  backgroundColor: 'transparent',
75
83
  '-webkit-appearance': 'none',
76
84
  margin: 0,
@@ -83,7 +91,7 @@ const Input = styled('input', {
83
91
  },
84
92
  '&[type="number"]': {
85
93
  '-moz-appearance': 'textfield',
86
- },
94
+ }
87
95
  });
88
96
  const Label = styled('label', {
89
97
  display: 'inline-block',
@@ -42,9 +42,9 @@ export function TokenSelector(props: PropTypes) {
42
42
  <SecondaryPage
43
43
  textField={true}
44
44
  hasHeader={hasHeader}
45
- title={`Select ${type} Token`}
45
+ title={`Select ${type} token`}
46
46
  onBack={onBack}
47
- textFieldPlaceholder="Search Token By Name"
47
+ textFieldPlaceholder="Search tokens by name"
48
48
  >
49
49
  {(searchedFor) => {
50
50
  const filteredTokens = filterTokens(list, searchedFor);
@@ -10,7 +10,11 @@ import { Image } from '../common';
10
10
 
11
11
  const WalletImageContainer = styled('div', {
12
12
  paddingRight: '$12',
13
+ '& img': {
14
+ borderRadius: '50%',
15
+ },
13
16
  });
17
+
14
18
  const Text = styled('div', {
15
19
  display: 'flex',
16
20
  flexDirection: 'column',
@@ -115,18 +115,18 @@ export function ConfirmSwap(props: PropsWithChildren<PropTypes>) {
115
115
  {extraMessages || null}
116
116
  <Alerts>
117
117
  {errors?.map((error, index) => (
118
- <>
118
+ <React.Fragment key={index}>
119
119
  <Spacer direction="vertical" />
120
120
  <Alert type="error" key={index}
121
121
  {...(typeof error === 'string') ? {title: error} : {children: error} }/>
122
- </>
122
+ </React.Fragment>
123
123
  ))}
124
124
  {warnings?.map((warning, index) => (
125
- <>
125
+ <React.Fragment key={index}>
126
126
  <Spacer direction="vertical" />
127
127
  <Alert type="warning" key={index}
128
128
  {...(typeof warning === 'string') ? {title: warning} : {children: warning} }/>
129
- </>
129
+ </React.Fragment>
130
130
  ))}
131
131
  </Alerts>
132
132
  </div>
@@ -37,7 +37,7 @@ export function History(props: PropsWithChildren<PropTypes>) {
37
37
  <SecondaryPage
38
38
  onBack={onBack}
39
39
  textField={true}
40
- textFieldPlaceholder="Search by Network, Token or Request ID"
40
+ textFieldPlaceholder="Search by blockchain, token or request Id"
41
41
  title="Swaps"
42
42
  >
43
43
  {(searchedFor) => {
@@ -30,8 +30,8 @@ export function SwapsGroup(props: Omit<PropTypes, 'onBack'>) {
30
30
  {groups
31
31
  .filter((group) => group.swaps.length > 0)
32
32
  .map((group, index) => (
33
- <>
34
- <Group key={index}>
33
+ <React.Fragment key={index}>
34
+ <Group>
35
35
  <Typography
36
36
  variant="body2"
37
37
  color="neutrals600"
@@ -39,20 +39,20 @@ export function SwapsGroup(props: Omit<PropTypes, 'onBack'>) {
39
39
  >
40
40
  {group.title}
41
41
  </Typography>
42
- {group.swaps.map((swap: PendingSwap, index: number) => (
43
- <>
42
+ {group.swaps.map((swap: PendingSwap) => (
43
+ <React.Fragment
44
+ key={swap.requestId}>
44
45
  <SwapDetail
45
- key={index}
46
46
  swap={swap}
47
47
  status={swap.status}
48
48
  onClick={onSwapClick}
49
49
  />
50
50
  <Divider size={12} />
51
- </>
51
+ </React.Fragment>
52
52
  ))}
53
53
  </Group>
54
54
  <Divider size={24} />
55
- </>
55
+ </React.Fragment>
56
56
  ))}
57
57
  </>
58
58
  );
@@ -66,7 +66,9 @@ export const SwapMessages: React.FC<PropTypes> = (props) => {
66
66
  <Button
67
67
  variant={'outlined'}
68
68
  type="primary"
69
- onClick={props.switchNetwork}
69
+ onClick={() => {
70
+ props?.switchNetwork && props.switchNetwork().catch(() => {})
71
+ }}
70
72
  >
71
73
  Change network to {currentStepBlockchain}
72
74
  </Button>
@@ -0,0 +1 @@
1
+ export { useCopyToClipboard } from './useCopyToClipboard';
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import copy from 'copy-to-clipboard';
3
+
4
+ export function useCopyToClipboard(resetInterval?: number) {
5
+ const [isCopied, setCopied] = React.useState(false);
6
+
7
+ const handleCopy = React.useCallback((text: string | number) => {
8
+ copy(text.toString());
9
+ setCopied(true);
10
+ }, []);
11
+
12
+ React.useEffect(() => {
13
+ let timeout: NodeJS.Timeout;
14
+ if (isCopied && resetInterval) {
15
+ timeout = setTimeout(() => setCopied(false), resetInterval);
16
+ }
17
+ return () => {
18
+ clearTimeout(timeout);
19
+ };
20
+ }, [isCopied, resetInterval]);
21
+
22
+ return [isCopied, handleCopy] as const;
23
+ }
package/src/index.ts CHANGED
@@ -2,3 +2,4 @@ export * from './components';
2
2
  export * from './containers';
3
3
  export * from './theme';
4
4
  export * from './types';
5
+ export * from './hooks';
File without changes