@rango-dev/ui 0.53.1-next.3 → 0.53.1-next.4
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/ui.build.json +1 -1
- package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.TokenSection.d.ts.map +1 -1
- package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.d.ts.map +1 -1
- package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.styles.d.ts +213 -49
- package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/PriceImpact/PriceImpact.d.ts.map +1 -1
- package/dist/widget/ui/src/components/PriceImpact/PriceImpact.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/PriceImpact/PriceImpact.types.d.ts +2 -0
- package/dist/widget/ui/src/components/PriceImpact/PriceImpact.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/StepDetails/StepDetails.d.ts.map +1 -1
- package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts +324 -0
- package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.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.styles.d.ts +484 -0
- package/dist/widget/ui/src/components/SwapListItem/SwapToken.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Toast/Toast.styles.d.ts +3 -2
- package/dist/widget/ui/src/components/Toast/Toast.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/TokenAmount/TokenAmount.d.ts.map +1 -1
- package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts +1285 -1
- package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts +3 -2
- package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Typography/NotSelectableTypography.d.ts +3 -2
- package/dist/widget/ui/src/components/Typography/NotSelectableTypography.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Typography/Typography.d.ts +3 -2
- package/dist/widget/ui/src/components/Typography/Typography.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Wallet/Wallet.styles.d.ts +3 -2
- package/dist/widget/ui/src/components/Wallet/Wallet.styles.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 +3 -2
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts +169 -3
- package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/hooks/index.d.ts +1 -0
- package/dist/widget/ui/src/hooks/index.d.ts.map +1 -1
- package/dist/widget/ui/src/hooks/useIsTruncated.d.ts +3 -0
- package/dist/widget/ui/src/hooks/useIsTruncated.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/Alert/Alert.styles.ts +3 -0
- package/src/components/FullExpandedQuote/FullExpandedQuote.TokenSection.tsx +18 -5
- package/src/components/FullExpandedQuote/FullExpandedQuote.styles.ts +11 -3
- package/src/components/FullExpandedQuote/FullExpandedQuote.tsx +13 -3
- package/src/components/PriceImpact/PriceImpact.styles.ts +8 -3
- package/src/components/PriceImpact/PriceImpact.tsx +27 -17
- package/src/components/PriceImpact/PriceImpact.types.ts +2 -0
- package/src/components/StepDetails/StepDetails.styles.ts +15 -0
- package/src/components/StepDetails/StepDetails.tsx +33 -8
- package/src/components/SwapListItem/SwapToken.styles.ts +16 -1
- package/src/components/SwapListItem/SwapToken.tsx +97 -25
- package/src/components/Toast/Toast.styles.ts +2 -0
- package/src/components/TokenAmount/TokenAmount.styles.ts +60 -2
- package/src/components/TokenAmount/TokenAmount.tsx +98 -38
- package/src/components/Typography/Typography.tsx +15 -15
- package/src/containers/SwapInput/SwapInput.styles.ts +2 -1
- package/src/containers/SwapInput/SwapInput.tsx +18 -35
- package/src/containers/SwapInput/TokenSection.styles.ts +7 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useIsTruncated.tsx +27 -0
|
@@ -23,8 +23,6 @@ import {
|
|
|
23
23
|
MaxButton,
|
|
24
24
|
textStyles,
|
|
25
25
|
TokenSectionContainer,
|
|
26
|
-
UsdPrice,
|
|
27
|
-
ValueTypography,
|
|
28
26
|
} from './SwapInput.styles.js';
|
|
29
27
|
import { TokenSection } from './TokenSection.js';
|
|
30
28
|
|
|
@@ -40,13 +38,6 @@ export function SwapInput(props: SwapInputPropTypes) {
|
|
|
40
38
|
'balance' in props && (props.loading || props.loadingBalance);
|
|
41
39
|
const price = props.price;
|
|
42
40
|
|
|
43
|
-
const isUsdValueZeroOrFalsy =
|
|
44
|
-
!props.price.usdValue || props.price.usdValue === '0';
|
|
45
|
-
|
|
46
|
-
const displayUsdValue =
|
|
47
|
-
props.price.error ||
|
|
48
|
-
(isUsdValueZeroOrFalsy ? '0.00' : `~$${props.price.usdValue}`);
|
|
49
|
-
|
|
50
41
|
return (
|
|
51
42
|
<Container
|
|
52
43
|
id={
|
|
@@ -144,32 +135,24 @@ export function SwapInput(props: SwapInputPropTypes) {
|
|
|
144
135
|
})}
|
|
145
136
|
/>
|
|
146
137
|
</NumericTooltip>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
side="bottom">
|
|
166
|
-
<ValueTypography hasWarning={!!price.error}>
|
|
167
|
-
<UsdPrice variant="body" size="medium">
|
|
168
|
-
{displayUsdValue}
|
|
169
|
-
</UsdPrice>
|
|
170
|
-
</ValueTypography>
|
|
171
|
-
</NumericTooltip>
|
|
172
|
-
)}
|
|
138
|
+
<PriceImpact
|
|
139
|
+
size="medium"
|
|
140
|
+
tooltipProps={{
|
|
141
|
+
container: props.tooltipContainer,
|
|
142
|
+
side: 'bottom',
|
|
143
|
+
}}
|
|
144
|
+
outputUsdValue={price.usdValue}
|
|
145
|
+
realOutputUsdValue={price.realUsdValue}
|
|
146
|
+
percentageChange={
|
|
147
|
+
'percentageChange' in props
|
|
148
|
+
? props.percentageChange
|
|
149
|
+
: undefined
|
|
150
|
+
}
|
|
151
|
+
warningLevel={
|
|
152
|
+
'percentageChange' in props ? props.warningLevel : undefined
|
|
153
|
+
}
|
|
154
|
+
error={price.error}
|
|
155
|
+
/>
|
|
173
156
|
</>
|
|
174
157
|
)}
|
|
175
158
|
</div>
|
|
@@ -114,3 +114,10 @@ export const SymbolTooltipContent = styled(Typography, {
|
|
|
114
114
|
maxWidth: 217,
|
|
115
115
|
lineBreak: 'anywhere',
|
|
116
116
|
});
|
|
117
|
+
|
|
118
|
+
export const BlockChainTypography = styled(Typography, {
|
|
119
|
+
maxWidth: 96,
|
|
120
|
+
overflow: 'hidden',
|
|
121
|
+
textOverflow: 'ellipsis',
|
|
122
|
+
whiteSpace: 'nowrap',
|
|
123
|
+
});
|
package/src/hooks/index.ts
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type RefObject, useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* This hook checks whether the text (or content) inside a React element fits within its width.
|
|
5
|
+
* In other words, it determines if the content is truncated or fully visible.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export function useIsTruncated(
|
|
9
|
+
content: string,
|
|
10
|
+
ref: RefObject<HTMLElement>
|
|
11
|
+
): boolean {
|
|
12
|
+
const [isTruncated, setIsTruncated] = useState(false);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const element = ref.current;
|
|
16
|
+
if (!element) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (element.scrollWidth > element.clientWidth) {
|
|
20
|
+
setIsTruncated(true);
|
|
21
|
+
} else {
|
|
22
|
+
setIsTruncated(false);
|
|
23
|
+
}
|
|
24
|
+
}, [content, ref.current]);
|
|
25
|
+
|
|
26
|
+
return isTruncated;
|
|
27
|
+
}
|