@rango-dev/ui 0.1.13 → 0.1.14-next.2
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.
- package/dist/components/ColorPicker/ColorPicker.d.ts +5 -5
- package/dist/components/Settings/Settings.d.ts +1 -0
- package/dist/helper/index.d.ts +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/ui.cjs.development.js +199 -114
- package/dist/ui.cjs.development.js.map +1 -1
- package/dist/ui.cjs.production.min.js +1 -1
- package/dist/ui.cjs.production.min.js.map +1 -1
- package/dist/ui.esm.js +199 -115
- package/dist/ui.esm.js.map +1 -1
- package/package.json +4 -3
- package/src/components/Alert/Alert.tsx +2 -2
- package/src/components/BestRoute/BestRoute.tsx +4 -3
- package/src/components/Button/Button.tsx +42 -42
- package/src/components/Chip/Chip.tsx +1 -1
- package/src/components/ColorPicker/ColorPicker.stories.tsx +9 -2
- package/src/components/ColorPicker/ColorPicker.tsx +34 -10
- package/src/components/Icon/common.ts +2 -2
- package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +2 -2
- package/src/components/Radio/Radio.tsx +2 -2
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +5 -5
- package/src/components/Settings/Settings.tsx +20 -16
- package/src/components/Skeleton/Skeleton.tsx +1 -1
- package/src/components/Spinner/Spinner.tsx +1 -1
- package/src/components/StepDetail/StepDetail.tsx +4 -4
- package/src/components/SwapContainer/SwapContainer.tsx +3 -3
- package/src/components/SwapDetail/SwapDetail.tsx +1 -1
- package/src/components/SwapDetail/Token.tsx +2 -2
- package/src/components/Switch/Switch.tsx +2 -2
- package/src/components/TextField/TextField.tsx +3 -3
- package/src/components/TokenList/TokenItem.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +2 -2
- package/src/containers/ConfirmSwap/ConfirmSwap.tsx +4 -4
- package/src/containers/History/SwapsGroup.tsx +1 -1
- package/src/containers/SwapHistory/SwapHistory.tsx +5 -5
- package/src/helper/index.ts +75 -0
- package/src/index.ts +1 -0
- package/src/theme.ts +23 -17
|
@@ -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: '$
|
|
6
|
+
backgroundColor: '$surface',
|
|
7
7
|
padding: '1px',
|
|
8
8
|
boxSizing: 'border-box',
|
|
9
|
-
border: '1px solid $
|
|
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: '$
|
|
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="
|
|
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: '$
|
|
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: '$
|
|
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 $
|
|
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: '$
|
|
42
|
+
backgroundColor: '$neutral100',
|
|
43
43
|
display: 'inline-flex',
|
|
44
44
|
width: '24px',
|
|
45
45
|
height: '24px',
|
|
46
|
-
color: '$
|
|
46
|
+
color: '$neutral800',
|
|
47
47
|
borderRadius: '50%',
|
|
48
48
|
fontSize: '$14',
|
|
49
|
-
border: '1px solid $
|
|
49
|
+
border: '1px solid $neutral400',
|
|
50
50
|
justifyContent: 'center',
|
|
51
51
|
alignItems: 'center',
|
|
52
52
|
},
|
|
@@ -53,7 +53,7 @@ export const ErrorMsg = styled(Typography, {
|
|
|
53
53
|
|
|
54
54
|
export const FeeContainer = styled('div', {
|
|
55
55
|
paddingLeft: '$16',
|
|
56
|
-
color: '$
|
|
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 $
|
|
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: '$
|
|
140
|
+
color: '$neutral600',
|
|
141
141
|
},
|
|
142
142
|
'.value': {
|
|
143
143
|
display: 'flex',
|
|
144
144
|
alignItems: 'center',
|
|
145
|
-
color: '$
|
|
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: '$
|
|
172
|
+
color: '$neutral600',
|
|
173
173
|
fontSize: '$10',
|
|
174
174
|
});
|
|
175
175
|
|
package/src/helper/index.ts
CHANGED
|
@@ -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
package/src/theme.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { DefaultThemeMap } from '@stitches/react/types/config';
|
|
|
7
7
|
const { createStitches } = require('@stitches/react');
|
|
8
8
|
|
|
9
9
|
/* ----------------------- Values ----------------------- */
|
|
10
|
+
|
|
10
11
|
const theme = {
|
|
11
12
|
colors: {
|
|
12
13
|
primary: '#5FA425',
|
|
@@ -19,14 +20,16 @@ const theme = {
|
|
|
19
20
|
primary700: '#396216',
|
|
20
21
|
primary800: '#26420F',
|
|
21
22
|
primary900: '#132107',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
surface: '#fff',
|
|
24
|
+
neutral100: '#f3f3f3',
|
|
25
|
+
neutral200: '#FAFAFA',
|
|
26
|
+
neutral300: '#EAEAEA',
|
|
27
|
+
neutral400: '#999999',
|
|
28
|
+
neutral500: '#888888',
|
|
29
|
+
neutral600: '#666666',
|
|
30
|
+
neutral700: '#444444',
|
|
31
|
+
neutral800: '#333333',
|
|
32
|
+
neutral900: '#111111',
|
|
30
33
|
background: '#fff',
|
|
31
34
|
foreground: '#000',
|
|
32
35
|
success: '#0070F3',
|
|
@@ -104,7 +107,8 @@ const theme = {
|
|
|
104
107
|
10: '12px',
|
|
105
108
|
},
|
|
106
109
|
shadows: {
|
|
107
|
-
s:
|
|
110
|
+
s:
|
|
111
|
+
'0px 3px 5px 3px #f0f2f5, 0px 6px 10px 3px #f0f2f5, 0px 1px 18px 3px #f0f2f5',
|
|
108
112
|
},
|
|
109
113
|
zIndices: {},
|
|
110
114
|
transitions: {},
|
|
@@ -146,14 +150,16 @@ export const lightTheme = createTheme({});
|
|
|
146
150
|
|
|
147
151
|
export const darkTheme = createTheme({
|
|
148
152
|
colors: {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
surface: '#000',
|
|
154
|
+
neutral900: '#f3f3f3',
|
|
155
|
+
neutral800: '#FAFAFA',
|
|
156
|
+
neutral700: '#EAEAEA',
|
|
157
|
+
neutral600: '#999999',
|
|
158
|
+
neutral500: '#888888',
|
|
159
|
+
neutral400: '#666666',
|
|
160
|
+
neutral300: '#444444',
|
|
161
|
+
neutral200: '#333333',
|
|
162
|
+
neutral100: '#111111',
|
|
157
163
|
foreground: '#fff',
|
|
158
164
|
background: '#000',
|
|
159
165
|
},
|