@rango-dev/ui 0.35.1-next.9 → 0.36.1-next.0

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 (70) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +4 -4
  4. package/dist/translations/de.d.ts.map +1 -1
  5. package/dist/translations/el.d.ts.map +1 -1
  6. package/dist/translations/en.d.ts.map +1 -1
  7. package/dist/translations/es.d.ts.map +1 -1
  8. package/dist/translations/fi.d.ts.map +1 -1
  9. package/dist/translations/fr.d.ts.map +1 -1
  10. package/dist/translations/it.d.ts.map +1 -1
  11. package/dist/translations/ja.d.ts.map +1 -1
  12. package/dist/translations/nl.d.ts.map +1 -1
  13. package/dist/translations/pl.d.ts.map +1 -1
  14. package/dist/translations/pt.d.ts.map +1 -1
  15. package/dist/translations/ru.d.ts.map +1 -1
  16. package/dist/translations/sv.d.ts.map +1 -1
  17. package/dist/translations/uk.d.ts.map +1 -1
  18. package/dist/translations/zh.d.ts.map +1 -1
  19. package/dist/ui.build.json +1 -1
  20. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.d.ts.map +1 -1
  21. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.helpers.d.ts +3 -0
  22. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.helpers.d.ts.map +1 -1
  23. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.types.d.ts +2 -2
  24. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.types.d.ts.map +1 -1
  25. package/dist/widget/ui/src/components/Select/Select.d.ts.map +1 -1
  26. package/dist/widget/ui/src/components/Select/Select.types.d.ts +4 -0
  27. package/dist/widget/ui/src/components/Select/Select.types.d.ts.map +1 -1
  28. package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts +1 -1
  29. package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts.map +1 -1
  30. package/dist/widget/ui/src/components/SwapListItem/SwapToken.d.ts.map +1 -1
  31. package/dist/widget/ui/src/components/TextField/TextField.d.ts +6 -0
  32. package/dist/widget/ui/src/components/TextField/TextField.d.ts.map +1 -1
  33. package/dist/widget/ui/src/components/TextField/TextField.types.d.ts +1 -0
  34. package/dist/widget/ui/src/components/TextField/TextField.types.d.ts.map +1 -1
  35. package/dist/widget/ui/src/components/Tooltip/NumericTooltip.d.ts +5 -0
  36. package/dist/widget/ui/src/components/Tooltip/NumericTooltip.d.ts.map +1 -0
  37. package/dist/widget/ui/src/components/Tooltip/NumericTooltip.types.d.ts +6 -0
  38. package/dist/widget/ui/src/components/Tooltip/NumericTooltip.types.d.ts.map +1 -0
  39. package/dist/widget/ui/src/components/Tooltip/Tooltip.d.ts.map +1 -1
  40. package/dist/widget/ui/src/components/Tooltip/Tooltip.types.d.ts +1 -0
  41. package/dist/widget/ui/src/components/Tooltip/Tooltip.types.d.ts.map +1 -1
  42. package/dist/widget/ui/src/components/Tooltip/index.d.ts +2 -0
  43. package/dist/widget/ui/src/components/Tooltip/index.d.ts.map +1 -1
  44. package/dist/widget/ui/src/containers/SwapInput/SwapInput.d.ts.map +1 -1
  45. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts +6 -0
  46. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts.map +1 -1
  47. package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts.map +1 -1
  48. package/package.json +3 -3
  49. package/src/components/FullExpandedQuote/FullExpandedQuote.TokenSection.tsx +3 -3
  50. package/src/components/FullExpandedQuote/FullExpandedQuote.helpers.ts +15 -0
  51. package/src/components/FullExpandedQuote/FullExpandedQuote.tsx +11 -4
  52. package/src/components/FullExpandedQuote/FullExpandedQuote.types.ts +2 -2
  53. package/src/components/PriceImpact/PriceImpact.tsx +3 -3
  54. package/src/components/Select/Select.tsx +13 -4
  55. package/src/components/Select/Select.types.ts +5 -0
  56. package/src/components/StepDetails/StepDetails.tsx +5 -5
  57. package/src/components/StepDetails/StepDetails.types.ts +1 -1
  58. package/src/components/SwapListItem/SwapToken.tsx +7 -5
  59. package/src/components/TextField/TextField.tsx +12 -1
  60. package/src/components/TextField/TextField.types.tsx +1 -0
  61. package/src/components/TokenAmount/TokenAmount.tsx +5 -5
  62. package/src/components/Tooltip/NumericTooltip.tsx +16 -0
  63. package/src/components/Tooltip/NumericTooltip.types.tsx +6 -0
  64. package/src/components/Tooltip/Tooltip.tsx +2 -0
  65. package/src/components/Tooltip/Tooltip.types.ts +1 -0
  66. package/src/components/Tooltip/index.ts +2 -0
  67. package/src/components/Wallet/Wallet.helpers.ts +1 -1
  68. package/src/containers/SwapInput/SwapInput.tsx +7 -5
  69. package/src/containers/SwapInput/TokenSection.styles.ts +1 -2
  70. package/src/icons/RangoExplorer.tsx +2 -2
@@ -6,7 +6,7 @@ import { ChainToken } from '../ChainToken';
6
6
  import { Divider } from '../Divider';
7
7
  import { PriceImpact } from '../PriceImpact';
8
8
  import { ValueTypography } from '../PriceImpact/PriceImpact.styles';
9
- import { Tooltip } from '../Tooltip';
9
+ import { NumericTooltip } from '../Tooltip';
10
10
  import { Typography } from '../Typography';
11
11
 
12
12
  import {
@@ -33,7 +33,7 @@ export function TokenAmount(props: PropTypes) {
33
33
  </Typography>
34
34
  )}
35
35
  <div>
36
- <Tooltip
36
+ <NumericTooltip
37
37
  content={props.price.realValue}
38
38
  open={!props.price.realValue ? false : undefined}
39
39
  container={props.tooltipContainer}>
@@ -50,13 +50,13 @@ export function TokenAmount(props: PropTypes) {
50
50
  style={{ fontWeight: 400 }}>
51
51
  {props.token.displayName}
52
52
  </Typography>
53
- </Tooltip>
53
+ </NumericTooltip>
54
54
  </div>
55
55
  </div>
56
56
  </div>
57
57
  {props.price.usdValue && props.price.usdValue !== '0' && (
58
58
  <div className={usdValueStyles()}>
59
- <Tooltip
59
+ <NumericTooltip
60
60
  content={props.price.realUsdValue}
61
61
  container={props.tooltipContainer}>
62
62
  {props.type === 'input' && (
@@ -67,7 +67,7 @@ export function TokenAmount(props: PropTypes) {
67
67
  <Divider direction="horizontal" size={4} />
68
68
  </ValueTypography>
69
69
  )}
70
- </Tooltip>
70
+ </NumericTooltip>
71
71
  {props.type === 'output' && (
72
72
  <PriceImpact
73
73
  size="small"
@@ -0,0 +1,16 @@
1
+ import type { NumericTooltipPropTypes } from './NumericTooltip.types';
2
+ import type { PropsWithChildren } from 'react';
3
+
4
+ import React from 'react';
5
+
6
+ import { Tooltip } from './Tooltip';
7
+
8
+ export function NumericTooltip(
9
+ props: PropsWithChildren<NumericTooltipPropTypes>
10
+ ) {
11
+ const MAX_DECIMALS = 12;
12
+ const formattedNumber = Number(props.content)
13
+ .toFixed(props.maxDecimals || MAX_DECIMALS)
14
+ .replace(/(?:\.0*|(\.\d+?)0*)$/, '$1');
15
+ return <Tooltip {...props} content={formattedNumber} />;
16
+ }
@@ -0,0 +1,6 @@
1
+ import type { TooltipPropTypes } from './Tooltip.types';
2
+
3
+ export interface NumericTooltipPropTypes extends TooltipPropTypes {
4
+ content: string | number | null | undefined;
5
+ maxDecimals?: number;
6
+ }
@@ -21,6 +21,7 @@ export function Tooltip(props: PropsWithChildren<TooltipPropTypes>) {
21
21
  side = 'top',
22
22
  styles,
23
23
  align,
24
+ alignOffset,
24
25
  } = props;
25
26
 
26
27
  return (
@@ -31,6 +32,7 @@ export function Tooltip(props: PropsWithChildren<TooltipPropTypes>) {
31
32
  </RadixTooltip.Trigger>
32
33
  <RadixTooltip.Portal container={container}>
33
34
  <TooltipContent
35
+ alignOffset={alignOffset}
34
36
  align={align}
35
37
  side={side}
36
38
  sideOffset={sideOffset}
@@ -17,4 +17,5 @@ export interface TooltipPropTypes {
17
17
  content?: CSS;
18
18
  };
19
19
  align?: RadixTooltipContentProps['align'];
20
+ alignOffset?: RadixTooltipContentProps['alignOffset'];
20
21
  }
@@ -1,2 +1,4 @@
1
1
  export { Tooltip } from './Tooltip';
2
2
  export type { TooltipPropTypes } from './Tooltip.types';
3
+ export { NumericTooltip } from './NumericTooltip';
4
+ export type { NumericTooltipPropTypes } from './NumericTooltip.types';
@@ -21,7 +21,7 @@ export function makeInfo(state: WalletState): Info {
21
21
  case WalletState.CONNECTING:
22
22
  return {
23
23
  color: 'neutral600',
24
- description: i18n.t('Connecting...'),
24
+ description: i18n.t('Connecting ...'),
25
25
  tooltipText: i18n.t('Connecting'),
26
26
  };
27
27
  case WalletState.DISCONNECTED:
@@ -5,9 +5,9 @@ import React from 'react';
5
5
 
6
6
  import {
7
7
  Divider,
8
+ NumericTooltip,
8
9
  PriceImpact,
9
10
  Skeleton,
10
- Tooltip,
11
11
  Typography,
12
12
  } from '../../components';
13
13
  import { UI_ID } from '../../constants';
@@ -96,7 +96,8 @@ export function SwapInput(props: SwapInputPropTypes) {
96
96
  </>
97
97
  ) : (
98
98
  <>
99
- <Tooltip
99
+ <NumericTooltip
100
+ align="end"
100
101
  content={props.price.realValue}
101
102
  container={props.tooltipContainer}
102
103
  open={
@@ -109,6 +110,7 @@ export function SwapInput(props: SwapInputPropTypes) {
109
110
  style={{ padding: 0 }}
110
111
  value={props.price.value}
111
112
  type={'onInputChange' in props ? 'number' : 'text'}
113
+ step="any"
112
114
  size="large"
113
115
  placeholder="0"
114
116
  variant="ghost"
@@ -119,7 +121,7 @@ export function SwapInput(props: SwapInputPropTypes) {
119
121
  props.onInputChange(event.target.value),
120
122
  })}
121
123
  />
122
- </Tooltip>
124
+ </NumericTooltip>
123
125
  {'percentageChange' in props ? (
124
126
  <PriceImpact
125
127
  size="medium"
@@ -134,7 +136,7 @@ export function SwapInput(props: SwapInputPropTypes) {
134
136
  warningLevel={props.warningLevel}
135
137
  />
136
138
  ) : (
137
- <Tooltip
139
+ <NumericTooltip
138
140
  content={props.price.realUsdValue}
139
141
  container={props.tooltipContainer}
140
142
  open={
@@ -153,7 +155,7 @@ export function SwapInput(props: SwapInputPropTypes) {
153
155
  : props.price.error}
154
156
  </UsdPrice>
155
157
  </ValueTypography>
156
- </Tooltip>
158
+ </NumericTooltip>
157
159
  )}
158
160
  </>
159
161
  )}
@@ -1,6 +1,5 @@
1
- import { ChainImageContainer } from 'src/components/ChainToken/ChainToken.styles';
2
-
3
1
  import { Button } from '../../components';
2
+ import { ChainImageContainer } from '../../components/ChainToken/ChainToken.styles';
4
3
  import { css, darkTheme, styled } from '../../theme';
5
4
 
6
5
  export const Container = styled(Button, {
@@ -17,9 +17,9 @@ function SvgRangoExplorer(props: SvgIconPropsWithChildren) {
17
17
  />
18
18
  <path
19
19
  d="M20.2351 15.5998C20.2351 18.1601 18.1596 20.2355 15.5994 20.2355C13.0392 20.2355 10.9637 18.1601 10.9637 15.5998C10.9637 13.0396 13.0392 10.9641 15.5994 10.9641C18.1596 10.9641 20.2351 13.0396 20.2351 15.5998ZM20.6394 20.7498C20.6096 20.7498 20.5817 20.7377 20.5642 20.7202L19.6076 19.7636C19.5686 19.7246 19.5637 19.6554 19.6091 19.6065C19.6486 19.5688 19.7169 19.5647 19.7652 19.61L20.7198 20.5646C20.7579 20.6028 20.7634 20.6698 20.7212 20.7184C20.6955 20.74 20.6657 20.7498 20.6394 20.7498Z"
20
- stroke="#727272"
20
+ stroke="currentColor"
21
21
  strokeWidth={0.5}
22
- fill="white"
22
+ fill="transparent"
23
23
  />
24
24
  <defs>
25
25
  <linearGradient