@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.
Files changed (61) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/index.js.map +4 -4
  3. package/dist/ui.build.json +1 -1
  4. package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts.map +1 -1
  5. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.TokenSection.d.ts.map +1 -1
  6. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.d.ts.map +1 -1
  7. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.styles.d.ts +213 -49
  8. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.styles.d.ts.map +1 -1
  9. package/dist/widget/ui/src/components/PriceImpact/PriceImpact.d.ts.map +1 -1
  10. package/dist/widget/ui/src/components/PriceImpact/PriceImpact.styles.d.ts.map +1 -1
  11. package/dist/widget/ui/src/components/PriceImpact/PriceImpact.types.d.ts +2 -0
  12. package/dist/widget/ui/src/components/PriceImpact/PriceImpact.types.d.ts.map +1 -1
  13. package/dist/widget/ui/src/components/StepDetails/StepDetails.d.ts.map +1 -1
  14. package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts +324 -0
  15. package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts.map +1 -1
  16. package/dist/widget/ui/src/components/SwapListItem/SwapToken.d.ts.map +1 -1
  17. package/dist/widget/ui/src/components/SwapListItem/SwapToken.styles.d.ts +484 -0
  18. package/dist/widget/ui/src/components/SwapListItem/SwapToken.styles.d.ts.map +1 -1
  19. package/dist/widget/ui/src/components/Toast/Toast.styles.d.ts +3 -2
  20. package/dist/widget/ui/src/components/Toast/Toast.styles.d.ts.map +1 -1
  21. package/dist/widget/ui/src/components/TokenAmount/TokenAmount.d.ts.map +1 -1
  22. package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts +1285 -1
  23. package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts.map +1 -1
  24. package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts +3 -2
  25. package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts.map +1 -1
  26. package/dist/widget/ui/src/components/Typography/NotSelectableTypography.d.ts +3 -2
  27. package/dist/widget/ui/src/components/Typography/NotSelectableTypography.d.ts.map +1 -1
  28. package/dist/widget/ui/src/components/Typography/Typography.d.ts +3 -2
  29. package/dist/widget/ui/src/components/Typography/Typography.d.ts.map +1 -1
  30. package/dist/widget/ui/src/components/Wallet/Wallet.styles.d.ts +3 -2
  31. package/dist/widget/ui/src/components/Wallet/Wallet.styles.d.ts.map +1 -1
  32. package/dist/widget/ui/src/containers/SwapInput/SwapInput.d.ts.map +1 -1
  33. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts +3 -2
  34. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts.map +1 -1
  35. package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts +169 -3
  36. package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts.map +1 -1
  37. package/dist/widget/ui/src/hooks/index.d.ts +1 -0
  38. package/dist/widget/ui/src/hooks/index.d.ts.map +1 -1
  39. package/dist/widget/ui/src/hooks/useIsTruncated.d.ts +3 -0
  40. package/dist/widget/ui/src/hooks/useIsTruncated.d.ts.map +1 -0
  41. package/package.json +1 -1
  42. package/src/components/Alert/Alert.styles.ts +3 -0
  43. package/src/components/FullExpandedQuote/FullExpandedQuote.TokenSection.tsx +18 -5
  44. package/src/components/FullExpandedQuote/FullExpandedQuote.styles.ts +11 -3
  45. package/src/components/FullExpandedQuote/FullExpandedQuote.tsx +13 -3
  46. package/src/components/PriceImpact/PriceImpact.styles.ts +8 -3
  47. package/src/components/PriceImpact/PriceImpact.tsx +27 -17
  48. package/src/components/PriceImpact/PriceImpact.types.ts +2 -0
  49. package/src/components/StepDetails/StepDetails.styles.ts +15 -0
  50. package/src/components/StepDetails/StepDetails.tsx +33 -8
  51. package/src/components/SwapListItem/SwapToken.styles.ts +16 -1
  52. package/src/components/SwapListItem/SwapToken.tsx +97 -25
  53. package/src/components/Toast/Toast.styles.ts +2 -0
  54. package/src/components/TokenAmount/TokenAmount.styles.ts +60 -2
  55. package/src/components/TokenAmount/TokenAmount.tsx +98 -38
  56. package/src/components/Typography/Typography.tsx +15 -15
  57. package/src/containers/SwapInput/SwapInput.styles.ts +2 -1
  58. package/src/containers/SwapInput/SwapInput.tsx +18 -35
  59. package/src/containers/SwapInput/TokenSection.styles.ts +7 -0
  60. package/src/hooks/index.ts +1 -0
  61. 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
- {'percentageChange' in props ? (
148
- <PriceImpact
149
- size="medium"
150
- tooltipProps={{
151
- container: props.tooltipContainer,
152
- side: 'bottom',
153
- }}
154
- outputUsdValue={price.usdValue}
155
- realOutputUsdValue={price.realUsdValue}
156
- error={price.error}
157
- percentageChange={props.percentageChange}
158
- warningLevel={props.warningLevel}
159
- />
160
- ) : (
161
- <NumericTooltip
162
- content={price.realUsdValue}
163
- container={props.tooltipContainer}
164
- open={isUsdValueZeroOrFalsy ? false : undefined}
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
+ });
@@ -1 +1,2 @@
1
1
  export { useCopyToClipboard } from './useCopyToClipboard.js';
2
+ export { useIsTruncated } from './useIsTruncated.js';
@@ -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
+ }