@rango-dev/ui 0.45.1-next.1 → 0.45.1-next.11
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/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/translations/af.d.ts.map +1 -1
- package/dist/translations/ar.d.ts.map +1 -1
- package/dist/translations/bn.d.ts.map +1 -1
- package/dist/translations/ca.d.ts.map +1 -1
- package/dist/translations/da.d.ts.map +1 -1
- package/dist/translations/de.d.ts.map +1 -1
- package/dist/translations/el.d.ts.map +1 -1
- package/dist/translations/en.d.ts.map +1 -1
- package/dist/translations/es.d.ts.map +1 -1
- package/dist/translations/fi.d.ts.map +1 -1
- package/dist/translations/fil.d.ts.map +1 -1
- package/dist/translations/fr.d.ts.map +1 -1
- package/dist/translations/hi.d.ts.map +1 -1
- package/dist/translations/hu.d.ts.map +1 -1
- package/dist/translations/id.d.ts.map +1 -1
- package/dist/translations/it.d.ts.map +1 -1
- package/dist/translations/ja.d.ts.map +1 -1
- package/dist/translations/ko.d.ts.map +1 -1
- package/dist/translations/lt.d.ts.map +1 -1
- package/dist/translations/ms.d.ts.map +1 -1
- package/dist/translations/nl.d.ts.map +1 -1
- package/dist/translations/pl.d.ts.map +1 -1
- package/dist/translations/pt.d.ts.map +1 -1
- package/dist/translations/ru.d.ts.map +1 -1
- package/dist/translations/sk.d.ts.map +1 -1
- package/dist/translations/sr.d.ts.map +1 -1
- package/dist/translations/sv.d.ts.map +1 -1
- package/dist/translations/sw.d.ts.map +1 -1
- package/dist/translations/th.d.ts.map +1 -1
- package/dist/translations/tr.d.ts.map +1 -1
- package/dist/translations/uk.d.ts.map +1 -1
- package/dist/translations/ur.d.ts.map +1 -1
- package/dist/translations/vi.d.ts.map +1 -1
- package/dist/translations/zh-CN.d.ts.map +1 -1
- package/dist/translations/zh-TW.d.ts.map +1 -1
- package/dist/ui.build.json +1 -1
- package/dist/widget/ui/src/components/MessageBox/DefaultMessageBox.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Modal/Modal.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/StepDetails/StepDetails.d.ts.map +1 -1
- package/dist/widget/ui/src/components/SwapListItem/SwapListItem.d.ts.map +1 -1
- package/dist/widget/ui/src/components/SwapListItem/SwapListItem.types.d.ts +2 -0
- package/dist/widget/ui/src/components/SwapListItem/SwapListItem.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/SwapListItem/SwapToken.d.ts.map +1 -1
- package/dist/widget/ui/src/components/SwapListItem/SwapToken.types.d.ts +2 -0
- package/dist/widget/ui/src/components/SwapListItem/SwapToken.types.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts +160 -0
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/TokenSection.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts +322 -0
- package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/icons/Login.d.ts +5 -0
- package/dist/widget/ui/src/icons/Login.d.ts.map +1 -0
- package/dist/widget/ui/src/icons/index.d.ts +1 -0
- package/dist/widget/ui/src/icons/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/MessageBox/DefaultMessageBox.tsx +7 -2
- package/src/components/Modal/Modal.styles.ts +1 -0
- package/src/components/StepDetails/StepDetails.tsx +5 -3
- package/src/components/SwapListItem/SwapListItem.tsx +2 -0
- package/src/components/SwapListItem/SwapListItem.types.ts +3 -0
- package/src/components/SwapListItem/SwapToken.tsx +4 -1
- package/src/components/SwapListItem/SwapToken.types.ts +2 -0
- package/src/containers/SwapInput/SwapInput.styles.ts +4 -0
- package/src/containers/SwapInput/SwapInput.tsx +19 -16
- package/src/containers/SwapInput/TokenSection.styles.ts +37 -4
- package/src/containers/SwapInput/TokenSection.tsx +29 -5
- package/src/icons/Login.tsx +23 -0
- package/src/icons/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/ui",
|
|
3
|
-
"version": "0.45.1-next.
|
|
3
|
+
"version": "0.45.1-next.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
"@radix-ui/react-select": "^2.0.0",
|
|
54
54
|
"@radix-ui/react-switch": "^1.0.1",
|
|
55
55
|
"@radix-ui/react-tooltip": "^1.0.2",
|
|
56
|
-
"@rango-dev/wallets-shared": "^0.43.1-next.
|
|
56
|
+
"@rango-dev/wallets-shared": "^0.43.1-next.6",
|
|
57
57
|
"@stitches/react": "^1.2.8",
|
|
58
58
|
"copy-to-clipboard": "^3.3.3",
|
|
59
|
-
"rango-types": "^0.1.
|
|
59
|
+
"rango-types": "^0.1.83",
|
|
60
60
|
"react-virtuoso": "^4.6.2"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|
|
@@ -21,13 +21,18 @@ export function MessageBox(props: PropsWithChildren<PropTypes>) {
|
|
|
21
21
|
<Typography
|
|
22
22
|
color={type === 'loading' ? 'info500' : `${type}500`}
|
|
23
23
|
variant="title"
|
|
24
|
-
size="medium"
|
|
24
|
+
size="medium"
|
|
25
|
+
className="_message_box_title">
|
|
25
26
|
{title}
|
|
26
27
|
</Typography>
|
|
27
28
|
<Divider size={4} />
|
|
28
29
|
<Description>
|
|
29
30
|
{typeof description === 'string' ? (
|
|
30
|
-
<Typography
|
|
31
|
+
<Typography
|
|
32
|
+
color="neutral700"
|
|
33
|
+
variant="body"
|
|
34
|
+
size="medium"
|
|
35
|
+
className="_message_box_description">
|
|
31
36
|
{description}
|
|
32
37
|
</Typography>
|
|
33
38
|
) : (
|
|
@@ -24,6 +24,8 @@ import {
|
|
|
24
24
|
tokensStyles,
|
|
25
25
|
} from './StepDetails.styles.js';
|
|
26
26
|
|
|
27
|
+
const HIGHT_OF_STICKY_HEADER = 45;
|
|
28
|
+
|
|
27
29
|
const StepDetailsComponent = forwardRef<HTMLDivElement, StepDetailsProps>(
|
|
28
30
|
(props, parentRef) => {
|
|
29
31
|
const {
|
|
@@ -38,6 +40,7 @@ const StepDetailsComponent = forwardRef<HTMLDivElement, StepDetailsProps>(
|
|
|
38
40
|
|
|
39
41
|
const { from, to, swapper } = step;
|
|
40
42
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
43
|
+
const childElement = containerRef.current;
|
|
41
44
|
const isCompleted = state === 'completed' || state === 'error';
|
|
42
45
|
const swappers: InternalSwap[] = step.internalSwaps?.length
|
|
43
46
|
? step.internalSwaps
|
|
@@ -52,12 +55,11 @@ const StepDetailsComponent = forwardRef<HTMLDivElement, StepDetailsProps>(
|
|
|
52
55
|
useEffect(() => {
|
|
53
56
|
const parentElement = (parentRef as React.RefObject<HTMLDivElement>)
|
|
54
57
|
?.current;
|
|
55
|
-
const childElement = containerRef.current;
|
|
56
58
|
if (isFocused && childElement && parentElement) {
|
|
57
59
|
parentElement.scrollTop =
|
|
58
|
-
childElement.offsetTop -
|
|
60
|
+
childElement.offsetTop - HIGHT_OF_STICKY_HEADER;
|
|
59
61
|
}
|
|
60
|
-
}, [isFocused]);
|
|
62
|
+
}, [isFocused, childElement]);
|
|
61
63
|
|
|
62
64
|
return (
|
|
63
65
|
<Container
|
|
@@ -41,6 +41,7 @@ export function SwapListItem(props: PropsWithChildren<SwapListItemPropTypes>) {
|
|
|
41
41
|
status,
|
|
42
42
|
swapTokenData,
|
|
43
43
|
tooltipContainer,
|
|
44
|
+
currentStep,
|
|
44
45
|
} = props;
|
|
45
46
|
return (
|
|
46
47
|
<Main onClick={onClick.bind(null, requestId)}>
|
|
@@ -62,6 +63,7 @@ export function SwapListItem(props: PropsWithChildren<SwapListItemPropTypes>) {
|
|
|
62
63
|
data={swapTokenData}
|
|
63
64
|
status={status}
|
|
64
65
|
tooltipContainer={tooltipContainer}
|
|
66
|
+
currentStep={currentStep}
|
|
65
67
|
/>
|
|
66
68
|
</Container>
|
|
67
69
|
</Main>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { PendingSwapStep } from 'rango-types';
|
|
2
|
+
|
|
1
3
|
export type Status = 'running' | 'failed' | 'success';
|
|
2
4
|
|
|
3
5
|
export interface SwapListItemProps {
|
|
@@ -8,6 +10,7 @@ export interface SwapListItemProps {
|
|
|
8
10
|
swapTokenData: SwapTokenData;
|
|
9
11
|
onlyShowTime?: boolean;
|
|
10
12
|
tooltipContainer?: HTMLElement;
|
|
13
|
+
currentStep: PendingSwapStep | null;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
export interface LoadingProps {
|
|
@@ -72,6 +72,7 @@ export function SwapToken(props: PropTypes) {
|
|
|
72
72
|
},
|
|
73
73
|
status,
|
|
74
74
|
tooltipContainer,
|
|
75
|
+
currentStep,
|
|
75
76
|
} = props;
|
|
76
77
|
|
|
77
78
|
return (
|
|
@@ -109,7 +110,9 @@ export function SwapToken(props: PropTypes) {
|
|
|
109
110
|
</Typography>
|
|
110
111
|
</TopSection>
|
|
111
112
|
<Typography size="small" variant="body" color="neutral700">
|
|
112
|
-
{
|
|
113
|
+
{currentStep?.fromBlockchain === currentStep?.toBlockchain
|
|
114
|
+
? i18n.t('Waiting for the swap transaction')
|
|
115
|
+
: i18n.t('Waiting for the bridge transaction')}
|
|
113
116
|
</Typography>
|
|
114
117
|
</Layout>
|
|
115
118
|
) : (
|
|
@@ -3,11 +3,13 @@ import type {
|
|
|
3
3
|
Status,
|
|
4
4
|
SwapTokenData,
|
|
5
5
|
} from './SwapListItem.types.js';
|
|
6
|
+
import type { PendingSwapStep } from 'rango-types';
|
|
6
7
|
|
|
7
8
|
export interface SwapTokenProps {
|
|
8
9
|
data: SwapTokenData;
|
|
9
10
|
status: Status;
|
|
10
11
|
tooltipContainer?: HTMLElement;
|
|
12
|
+
currentStep: PendingSwapStep | null;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export type PropTypes = SwapTokenProps | LoadingProps;
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
labelStyles,
|
|
23
23
|
MaxButton,
|
|
24
24
|
textStyles,
|
|
25
|
+
TokenSectionContainer,
|
|
25
26
|
UsdPrice,
|
|
26
27
|
ValueTypography,
|
|
27
28
|
} from './SwapInput.styles.js';
|
|
@@ -83,22 +84,24 @@ export function SwapInput(props: SwapInputPropTypes) {
|
|
|
83
84
|
</div>
|
|
84
85
|
</div>
|
|
85
86
|
<div className={formStyles()}>
|
|
86
|
-
<
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
87
|
+
<TokenSectionContainer>
|
|
88
|
+
<TokenSection
|
|
89
|
+
chain={props.chain.displayName}
|
|
90
|
+
chianImageId={
|
|
91
|
+
props.mode === 'To'
|
|
92
|
+
? UI_ID.SWAP_TO_CHAIN_IMAGE_ID
|
|
93
|
+
: UI_ID.SWAP_FROM_CHAIN_IMAGE_ID
|
|
94
|
+
}
|
|
95
|
+
tokenSymbol={props.token.displayName}
|
|
96
|
+
error={props.error}
|
|
97
|
+
chainImage={props.chain.image}
|
|
98
|
+
tokenImage={props.token.image}
|
|
99
|
+
onClick={props.onClickToken}
|
|
100
|
+
loading={props.loading}
|
|
101
|
+
warning={props.token.securityWarning}
|
|
102
|
+
tooltipContainer={props.tooltipContainer}
|
|
103
|
+
/>
|
|
104
|
+
</TokenSectionContainer>
|
|
102
105
|
<div className={amountStyles()}>
|
|
103
106
|
{props.loading || (props.mode === 'To' && props.fetchingQuote) ? (
|
|
104
107
|
<>
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { ChainImageContainer } from '../../components/ChainToken/ChainToken.styles.js';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
type TooltipPropTypes,
|
|
5
|
+
Typography,
|
|
6
|
+
} from '../../components/index.js';
|
|
3
7
|
import { css, darkTheme, styled } from '../../theme.js';
|
|
4
8
|
|
|
5
9
|
export const Container = styled(Button, {
|
|
10
|
+
width: '100%',
|
|
6
11
|
maxWidth: '180px',
|
|
7
12
|
minWidth: '130px',
|
|
8
|
-
flexGrow: 1,
|
|
9
13
|
backgroundColor: 'transparent',
|
|
10
14
|
borderRadius: '$xs',
|
|
11
15
|
|
|
@@ -39,11 +43,16 @@ export const Container = styled(Button, {
|
|
|
39
43
|
backgroundColor: '$$color !important',
|
|
40
44
|
},
|
|
41
45
|
},
|
|
46
|
+
|
|
47
|
+
'& > span': {
|
|
48
|
+
width: '100%',
|
|
49
|
+
},
|
|
42
50
|
});
|
|
43
51
|
|
|
44
52
|
export const chainNameStyles = css();
|
|
45
53
|
|
|
46
54
|
export const TokenSectionContainer = styled('div', {
|
|
55
|
+
width: '100%',
|
|
47
56
|
maxWidth: '170px',
|
|
48
57
|
padding: '$2 $5',
|
|
49
58
|
display: 'flex',
|
|
@@ -68,6 +77,8 @@ export const tokenChainStyles = css({
|
|
|
68
77
|
paddingLeft: '$10',
|
|
69
78
|
flexGrow: 1,
|
|
70
79
|
textAlign: 'left',
|
|
80
|
+
width: '100%',
|
|
81
|
+
overflow: 'hidden',
|
|
71
82
|
});
|
|
72
83
|
|
|
73
84
|
export const skeletonStyles = css({
|
|
@@ -76,8 +87,30 @@ export const skeletonStyles = css({
|
|
|
76
87
|
});
|
|
77
88
|
|
|
78
89
|
export const TitleContainer = styled('div', {
|
|
90
|
+
width: '100%',
|
|
79
91
|
display: 'flex',
|
|
80
|
-
justifyContent: 'center',
|
|
81
92
|
alignItems: 'center',
|
|
82
|
-
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
export const Title = styled(Typography, {
|
|
96
|
+
overflow: 'hidden',
|
|
97
|
+
textOverflow: 'ellipsis',
|
|
98
|
+
whiteSpace: 'nowrap',
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
export const SymbolTooltipStyles: TooltipPropTypes['styles'] = {
|
|
102
|
+
content: {
|
|
103
|
+
padding: '$10',
|
|
104
|
+
},
|
|
105
|
+
root: {
|
|
106
|
+
zIndex: 10,
|
|
107
|
+
maxWidth: 'calc(100% - 18px)',
|
|
108
|
+
display: 'flex',
|
|
109
|
+
justifyContent: 'start',
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const SymbolTooltipContent = styled(Typography, {
|
|
114
|
+
maxWidth: 217,
|
|
115
|
+
lineBreak: 'anywhere',
|
|
83
116
|
});
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
ChainToken,
|
|
9
9
|
Divider,
|
|
10
10
|
Skeleton,
|
|
11
|
+
Tooltip,
|
|
11
12
|
Typography,
|
|
12
13
|
} from '../../components/index.js';
|
|
13
14
|
|
|
@@ -15,6 +16,9 @@ import {
|
|
|
15
16
|
chainNameStyles,
|
|
16
17
|
Container,
|
|
17
18
|
skeletonStyles,
|
|
19
|
+
SymbolTooltipContent,
|
|
20
|
+
SymbolTooltipStyles,
|
|
21
|
+
Title,
|
|
18
22
|
TitleContainer,
|
|
19
23
|
tokenChainStyles,
|
|
20
24
|
TokenSectionContainer,
|
|
@@ -33,6 +37,9 @@ export function TokenSection(props: TokenSectionProps) {
|
|
|
33
37
|
warning,
|
|
34
38
|
tooltipContainer,
|
|
35
39
|
} = props;
|
|
40
|
+
|
|
41
|
+
const tokenSelected = !error && !loading && !!tokenSymbol;
|
|
42
|
+
|
|
36
43
|
return (
|
|
37
44
|
<Container variant="default" disabled={error || loading} onClick={onClick}>
|
|
38
45
|
<TokenSectionContainer>
|
|
@@ -54,11 +61,28 @@ export function TokenSection(props: TokenSectionProps) {
|
|
|
54
61
|
) : (
|
|
55
62
|
<>
|
|
56
63
|
<TitleContainer>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
{tokenSelected ? (
|
|
65
|
+
<Tooltip
|
|
66
|
+
styles={SymbolTooltipStyles}
|
|
67
|
+
align="start"
|
|
68
|
+
side="bottom"
|
|
69
|
+
alignOffset={-15}
|
|
70
|
+
sideOffset={15}
|
|
71
|
+
container={tooltipContainer}
|
|
72
|
+
content={
|
|
73
|
+
<SymbolTooltipContent variant="body" size="xsmall">
|
|
74
|
+
{tokenSymbol}
|
|
75
|
+
</SymbolTooltipContent>
|
|
76
|
+
}>
|
|
77
|
+
<Title variant="title" size="medium">
|
|
78
|
+
{tokenSymbol}
|
|
79
|
+
</Title>
|
|
80
|
+
</Tooltip>
|
|
81
|
+
) : (
|
|
82
|
+
<Typography variant="title" size="medium">
|
|
83
|
+
{i18n.t('Select Token')}
|
|
84
|
+
</Typography>
|
|
85
|
+
)}
|
|
62
86
|
{warning && (
|
|
63
87
|
<>
|
|
64
88
|
<Divider size={4} direction="horizontal" />
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SvgIconPropsWithChildren } from '../components/SvgIcon/index.js';
|
|
2
|
+
|
|
3
|
+
import React, { createElement } from 'react';
|
|
4
|
+
|
|
5
|
+
import { SvgIcon } from '../components/SvgIcon/index.js';
|
|
6
|
+
|
|
7
|
+
function SvgLogin(props: SvgIconPropsWithChildren) {
|
|
8
|
+
return createElement(
|
|
9
|
+
SvgIcon,
|
|
10
|
+
props,
|
|
11
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
12
|
+
<path
|
|
13
|
+
d="M14.6529 3.02412C14.39 2.93962 14.1084 3.08424 14.0239 3.34714C13.9394 3.61004 14.084 3.89166 14.3469 3.97615C17.6085 5.02444 19.9999 8.21088 19.9999 12.0001C19.9999 15.7894 17.6085 18.9758 14.3469 20.0241C14.084 20.1086 13.9394 20.3902 14.0239 20.6531C14.1084 20.916 14.39 21.0606 14.6529 20.9762C18.3399 19.7911 20.9999 16.2112 20.9999 12.0001C20.9999 7.78902 18.3399 4.20913 14.6529 3.02412Z"
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
/>
|
|
16
|
+
<path
|
|
17
|
+
d="M12.3536 8.14645C12.1583 7.95119 11.8417 7.95119 11.6464 8.14645C11.4512 8.34171 11.4512 8.65829 11.6464 8.85356L14.2929 11.5H3.5C3.22386 11.5 3 11.7239 3 12C3 12.2762 3.22386 12.5 3.5 12.5H14.2929L11.6464 15.1464C11.4512 15.3417 11.4512 15.6583 11.6464 15.8536C11.8417 16.0488 12.1583 16.0488 12.3536 15.8536L15.8536 12.3536C15.9473 12.2598 16 12.1326 16 12C16 11.8674 15.9473 11.7402 15.8536 11.6465L12.3536 8.14645Z"
|
|
18
|
+
fill="currentColor"
|
|
19
|
+
/>
|
|
20
|
+
</svg>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
export default SvgLogin;
|
package/src/icons/index.ts
CHANGED
|
@@ -49,6 +49,7 @@ export { default as LightModeIcon } from './LightMode.js';
|
|
|
49
49
|
export { default as LinkIcon } from './Link.js';
|
|
50
50
|
export { default as LoadingIcon } from './Loading.js';
|
|
51
51
|
export { default as LogoWithTextIcon } from './LogoWithText.js';
|
|
52
|
+
export { default as LoginIcon } from './Login.js';
|
|
52
53
|
export { default as LogoutIcon } from './Logout.js';
|
|
53
54
|
export { default as MenuIcon } from './Menu.js';
|
|
54
55
|
export { default as MoneyBagIcon } from './MoneyBag.js';
|