@rango-dev/ui 0.26.0 → 0.26.1-next.1

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 (45) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/index.js +6 -6
  3. package/dist/index.js.map +3 -3
  4. package/dist/translations/en.d.ts.map +1 -1
  5. package/dist/translations/es.d.ts.map +1 -1
  6. package/dist/translations/fr.d.ts.map +1 -1
  7. package/dist/translations/ja.d.ts.map +1 -1
  8. package/dist/widget/ui/src/components/PriceImpact/PriceImpact.d.ts.map +1 -1
  9. package/dist/widget/ui/src/components/PriceImpact/PriceImpact.types.d.ts +6 -0
  10. package/dist/widget/ui/src/components/PriceImpact/PriceImpact.types.d.ts.map +1 -1
  11. package/dist/widget/ui/src/components/StepDetails/StepDetails.d.ts.map +1 -1
  12. package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts +1 -0
  13. package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts.map +1 -1
  14. package/dist/widget/ui/src/components/SwapListItem/SwapListItem.d.ts.map +1 -1
  15. package/dist/widget/ui/src/components/SwapListItem/SwapListItem.types.d.ts +2 -1
  16. package/dist/widget/ui/src/components/SwapListItem/SwapListItem.types.d.ts.map +1 -1
  17. package/dist/widget/ui/src/components/SwapListItem/SwapToken.d.ts.map +1 -1
  18. package/dist/widget/ui/src/components/SwapListItem/SwapToken.types.d.ts +1 -0
  19. package/dist/widget/ui/src/components/SwapListItem/SwapToken.types.d.ts.map +1 -1
  20. package/dist/widget/ui/src/components/SwapListItem/mock.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.types.d.ts +1 -0
  23. package/dist/widget/ui/src/components/TokenAmount/TokenAmount.types.d.ts.map +1 -1
  24. package/dist/widget/ui/src/components/Tooltip/Tooltip.d.ts.map +1 -1
  25. package/dist/widget/ui/src/components/Tooltip/Tooltip.types.d.ts +2 -0
  26. package/dist/widget/ui/src/components/Tooltip/Tooltip.types.d.ts.map +1 -1
  27. package/dist/widget/ui/src/containers/SwapInput/SwapInput.d.ts.map +1 -1
  28. package/dist/widget/ui/src/containers/SwapInput/SwapInput.types.d.ts +3 -0
  29. package/dist/widget/ui/src/containers/SwapInput/SwapInput.types.d.ts.map +1 -1
  30. package/package.json +3 -3
  31. package/src/components/PriceImpact/PriceImpact.tsx +26 -8
  32. package/src/components/PriceImpact/PriceImpact.types.ts +7 -0
  33. package/src/components/StepDetails/StepDetails.tsx +31 -15
  34. package/src/components/StepDetails/StepDetails.types.ts +1 -0
  35. package/src/components/SwapListItem/SwapListItem.tsx +6 -1
  36. package/src/components/SwapListItem/SwapListItem.types.ts +2 -1
  37. package/src/components/SwapListItem/SwapToken.tsx +14 -8
  38. package/src/components/SwapListItem/SwapToken.types.ts +1 -0
  39. package/src/components/SwapListItem/mock.ts +1 -0
  40. package/src/components/TokenAmount/TokenAmount.tsx +36 -20
  41. package/src/components/TokenAmount/TokenAmount.types.ts +1 -0
  42. package/src/components/Tooltip/Tooltip.tsx +2 -1
  43. package/src/components/Tooltip/Tooltip.types.ts +2 -0
  44. package/src/containers/SwapInput/SwapInput.tsx +53 -22
  45. package/src/containers/SwapInput/SwapInput.types.ts +3 -0
@@ -3,7 +3,13 @@ import type { SwapInputProps } from './SwapInput.types';
3
3
  import { i18n } from '@lingui/core';
4
4
  import React from 'react';
5
5
 
6
- import { Divider, PriceImpact, Skeleton, Typography } from '../../components';
6
+ import {
7
+ Divider,
8
+ PriceImpact,
9
+ Skeleton,
10
+ Tooltip,
11
+ Typography,
12
+ } from '../../components';
7
13
 
8
14
  import {
9
15
  amountStyles,
@@ -77,36 +83,61 @@ export function SwapInput(props: SwapInputProps) {
77
83
  </>
78
84
  ) : (
79
85
  <>
80
- <InputAmount
81
- disabled={props.disabled || props.mode === 'To'}
82
- style={{ padding: 0 }}
83
- value={props.price.value}
84
- type={'onInputChange' in props ? 'number' : 'text'}
85
- size="large"
86
- placeholder="0"
87
- variant="ghost"
88
- min={0}
89
- {...('onInputChange' in props && {
90
- onChange: (event: React.ChangeEvent<HTMLInputElement>) =>
91
- props.onInputChange(event.target.value),
92
- })}
93
- />
86
+ <Tooltip
87
+ content={props.price.realValue}
88
+ container={props.tooltipContainer}
89
+ open={
90
+ !props.price.realValue || props.price.realValue === '0'
91
+ ? false
92
+ : undefined
93
+ }>
94
+ <InputAmount
95
+ disabled={props.disabled || props.mode === 'To'}
96
+ style={{ padding: 0 }}
97
+ value={props.price.value}
98
+ type={'onInputChange' in props ? 'number' : 'text'}
99
+ size="large"
100
+ placeholder="0"
101
+ variant="ghost"
102
+ min={0}
103
+ {...('onInputChange' in props && {
104
+ onChange: (event: React.ChangeEvent<HTMLInputElement>) =>
105
+ props.onInputChange(event.target.value),
106
+ })}
107
+ />
108
+ </Tooltip>
94
109
  {'percentageChange' in props ? (
95
110
  <PriceImpact
96
111
  size="large"
112
+ tooltipProps={{
113
+ container: props.tooltipContainer,
114
+ side: 'bottom',
115
+ }}
97
116
  outputUsdValue={props.price.usdValue}
117
+ realOutputUsdValue={props.price.realUsdValue}
98
118
  error={props.price.error}
99
119
  percentageChange={props.percentageChange}
100
120
  warningLevel={props.warningLevel}
101
121
  />
102
122
  ) : (
103
- <ValueTypography hasWarning={!!props.price.error}>
104
- <UsdPrice variant="body" size="medium">
105
- {props.price.usdValue
106
- ? `~$${props.price.usdValue}`
107
- : props.price.error}
108
- </UsdPrice>
109
- </ValueTypography>
123
+ <Tooltip
124
+ content={props.price.realUsdValue}
125
+ container={props.tooltipContainer}
126
+ open={
127
+ !props.price.realUsdValue ||
128
+ props.price.realUsdValue === '0'
129
+ ? false
130
+ : undefined
131
+ }
132
+ side="bottom">
133
+ <ValueTypography hasWarning={!!props.price.error}>
134
+ <UsdPrice variant="body" size="medium">
135
+ {props.price.usdValue
136
+ ? `~$${props.price.usdValue}`
137
+ : props.price.error}
138
+ </UsdPrice>
139
+ </ValueTypography>
140
+ </Tooltip>
110
141
  )}
111
142
  </>
112
143
  )}
@@ -12,6 +12,8 @@ export type BaseProps = {
12
12
  price: {
13
13
  value: string;
14
14
  usdValue?: string;
15
+ realValue?: string;
16
+ realUsdValue?: string;
15
17
  error?: string;
16
18
  };
17
19
  loading?: boolean;
@@ -20,6 +22,7 @@ export type BaseProps = {
20
22
  label: string;
21
23
  sharpBottomStyle?: boolean;
22
24
  onClickToken: () => void;
25
+ tooltipContainer?: HTMLElement;
23
26
  };
24
27
 
25
28
  type FromProps = {