@rango-dev/ui 0.35.1-next.8 → 0.36.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 (63) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/index.js.map +4 -4
  3. package/dist/translations/de.d.ts.map +1 -1
  4. package/dist/translations/el.d.ts.map +1 -1
  5. package/dist/translations/en.d.ts.map +1 -1
  6. package/dist/translations/es.d.ts.map +1 -1
  7. package/dist/translations/fi.d.ts.map +1 -1
  8. package/dist/translations/fr.d.ts.map +1 -1
  9. package/dist/translations/it.d.ts.map +1 -1
  10. package/dist/translations/ja.d.ts.map +1 -1
  11. package/dist/translations/nl.d.ts.map +1 -1
  12. package/dist/translations/pl.d.ts.map +1 -1
  13. package/dist/translations/pt.d.ts.map +1 -1
  14. package/dist/translations/ru.d.ts.map +1 -1
  15. package/dist/translations/sv.d.ts.map +1 -1
  16. package/dist/translations/uk.d.ts.map +1 -1
  17. package/dist/translations/zh.d.ts.map +1 -1
  18. package/dist/ui.build.json +1 -1
  19. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.d.ts.map +1 -1
  20. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.helpers.d.ts +3 -0
  21. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.helpers.d.ts.map +1 -1
  22. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.types.d.ts +2 -2
  23. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.types.d.ts.map +1 -1
  24. package/dist/widget/ui/src/components/Select/Select.d.ts.map +1 -1
  25. package/dist/widget/ui/src/components/Select/Select.types.d.ts +4 -0
  26. package/dist/widget/ui/src/components/Select/Select.types.d.ts.map +1 -1
  27. package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts +1 -1
  28. package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts.map +1 -1
  29. package/dist/widget/ui/src/components/SwapListItem/SwapToken.d.ts.map +1 -1
  30. package/dist/widget/ui/src/components/TextField/TextField.d.ts +6 -0
  31. package/dist/widget/ui/src/components/TextField/TextField.d.ts.map +1 -1
  32. package/dist/widget/ui/src/components/TextField/TextField.types.d.ts +1 -0
  33. package/dist/widget/ui/src/components/TextField/TextField.types.d.ts.map +1 -1
  34. package/dist/widget/ui/src/components/Tooltip/NumericTooltip.d.ts +5 -0
  35. package/dist/widget/ui/src/components/Tooltip/NumericTooltip.d.ts.map +1 -0
  36. package/dist/widget/ui/src/components/Tooltip/NumericTooltip.types.d.ts +6 -0
  37. package/dist/widget/ui/src/components/Tooltip/NumericTooltip.types.d.ts.map +1 -0
  38. package/dist/widget/ui/src/components/Tooltip/index.d.ts +2 -0
  39. package/dist/widget/ui/src/components/Tooltip/index.d.ts.map +1 -1
  40. package/dist/widget/ui/src/containers/SwapInput/SwapInput.d.ts.map +1 -1
  41. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts +6 -0
  42. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts.map +1 -1
  43. package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts.map +1 -1
  44. package/package.json +3 -3
  45. package/src/components/FullExpandedQuote/FullExpandedQuote.TokenSection.tsx +3 -3
  46. package/src/components/FullExpandedQuote/FullExpandedQuote.helpers.ts +15 -0
  47. package/src/components/FullExpandedQuote/FullExpandedQuote.tsx +11 -4
  48. package/src/components/FullExpandedQuote/FullExpandedQuote.types.ts +2 -2
  49. package/src/components/PriceImpact/PriceImpact.tsx +3 -3
  50. package/src/components/Select/Select.tsx +13 -4
  51. package/src/components/Select/Select.types.ts +5 -0
  52. package/src/components/StepDetails/StepDetails.tsx +5 -5
  53. package/src/components/StepDetails/StepDetails.types.ts +1 -1
  54. package/src/components/SwapListItem/SwapToken.tsx +7 -5
  55. package/src/components/TextField/TextField.tsx +12 -1
  56. package/src/components/TextField/TextField.types.tsx +1 -0
  57. package/src/components/TokenAmount/TokenAmount.tsx +5 -5
  58. package/src/components/Tooltip/NumericTooltip.tsx +16 -0
  59. package/src/components/Tooltip/NumericTooltip.types.tsx +6 -0
  60. package/src/components/Tooltip/index.ts +2 -0
  61. package/src/components/Wallet/Wallet.helpers.ts +1 -1
  62. package/src/containers/SwapInput/SwapInput.tsx +7 -5
  63. package/src/containers/SwapInput/TokenSection.styles.ts +1 -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
+ }
@@ -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, {