@rango-dev/ui 0.22.1-next.9 → 0.24.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 (125) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/index.js +6 -6
  3. package/dist/index.js.map +4 -4
  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/Alert/Alert.styles.d.ts.map +1 -1
  9. package/dist/widget/ui/src/components/BestRoute/BestRoute.d.ts +4 -0
  10. package/dist/widget/ui/src/components/BestRoute/BestRoute.d.ts.map +1 -0
  11. package/dist/widget/ui/src/components/BestRoute/BestRoute.stories.d.ts +7 -0
  12. package/dist/widget/ui/src/components/BestRoute/BestRoute.stories.d.ts.map +1 -0
  13. package/dist/widget/ui/src/components/BestRoute/BestRoute.styles.d.ts +1429 -0
  14. package/dist/widget/ui/src/components/BestRoute/BestRoute.styles.d.ts.map +1 -0
  15. package/dist/widget/ui/src/components/BestRoute/BestRoute.types.d.ts +34 -0
  16. package/dist/widget/ui/src/components/BestRoute/BestRoute.types.d.ts.map +1 -0
  17. package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.d.ts +4 -0
  18. package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.d.ts.map +1 -0
  19. package/dist/widget/ui/src/components/{QuoteCost/QuoteCost.styles.d.ts → BestRoute/BestRouteSkeleton.styles.d.ts} +7 -3
  20. package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.styles.d.ts.map +1 -0
  21. package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.types.d.ts +6 -0
  22. package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.types.d.ts.map +1 -0
  23. package/dist/widget/ui/src/components/BestRoute/RouteSummary.d.ts +12 -0
  24. package/dist/widget/ui/src/components/BestRoute/RouteSummary.d.ts.map +1 -0
  25. package/dist/widget/ui/src/components/BestRoute/RouteSummary.styles.d.ts +158 -0
  26. package/dist/widget/ui/src/components/BestRoute/RouteSummary.styles.d.ts.map +1 -0
  27. package/dist/widget/ui/src/components/BestRoute/index.d.ts +5 -0
  28. package/dist/widget/ui/src/components/BestRoute/index.d.ts.map +1 -0
  29. package/dist/widget/ui/src/components/BestRoute/mock.d.ts +3 -0
  30. package/dist/widget/ui/src/components/BestRoute/mock.d.ts.map +1 -0
  31. package/dist/widget/ui/src/components/Checkbox/Checkbox.styles.d.ts.map +1 -1
  32. package/dist/widget/ui/src/components/ListItem/ListItem.styles.d.ts.map +1 -1
  33. package/dist/widget/ui/src/components/Radio/Radio.styles.d.ts.map +1 -1
  34. package/dist/widget/ui/src/components/RouteCost/RouteCost.d.ts +4 -0
  35. package/dist/widget/ui/src/components/RouteCost/RouteCost.d.ts.map +1 -0
  36. package/dist/widget/ui/src/components/RouteCost/RouteCost.styles.d.ts +158 -0
  37. package/dist/widget/ui/src/components/RouteCost/RouteCost.styles.d.ts.map +1 -0
  38. package/dist/widget/ui/src/components/{QuoteCost/QuoteCost.types.d.ts → RouteCost/RouteCost.types.d.ts} +1 -1
  39. package/dist/widget/ui/src/components/RouteCost/RouteCost.types.d.ts.map +1 -0
  40. package/dist/widget/ui/src/components/RouteCost/index.d.ts +2 -0
  41. package/dist/widget/ui/src/components/RouteCost/index.d.ts.map +1 -0
  42. package/dist/widget/ui/src/components/RoutesOverview/RoutesOverview.d.ts.map +1 -1
  43. package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts +1 -1
  44. package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts +2 -16
  45. package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts.map +1 -1
  46. package/dist/widget/ui/src/components/StepDetails/index.d.ts +1 -1
  47. package/dist/widget/ui/src/components/StepDetails/index.d.ts.map +1 -1
  48. package/dist/widget/ui/src/components/StepDetails/mock.d.ts +1 -1
  49. package/dist/widget/ui/src/components/StepDetails/mock.d.ts.map +1 -1
  50. package/dist/widget/ui/src/components/Switch/Switch.styles.d.ts.map +1 -1
  51. package/dist/widget/ui/src/components/index.d.ts +2 -1
  52. package/dist/widget/ui/src/components/index.d.ts.map +1 -1
  53. package/dist/widget/ui/src/containers/BlockchainSelector/BlockchainSelector.d.ts +3 -3
  54. package/dist/widget/ui/src/containers/BlockchainSelector/BlockchainSelector.d.ts.map +1 -1
  55. package/dist/widget/ui/src/containers/SwapInput/SwapInput.d.ts.map +1 -1
  56. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts +0 -159
  57. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts.map +1 -1
  58. package/dist/widget/ui/src/containers/SwapInput/SwapInput.types.d.ts +0 -1
  59. package/dist/widget/ui/src/containers/SwapInput/SwapInput.types.d.ts.map +1 -1
  60. package/dist/widget/ui/src/containers/SwapInput/TokenSection.d.ts.map +1 -1
  61. package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts.map +1 -1
  62. package/dist/widget/ui/src/containers/TokenSelector/TokenSelector.d.ts +2 -2
  63. package/dist/widget/ui/src/containers/TokenSelector/TokenSelector.d.ts.map +1 -1
  64. package/dist/widget/ui/src/{utils → helper}/index.d.ts +3 -0
  65. package/dist/widget/ui/src/helper/index.d.ts.map +1 -0
  66. package/dist/widget/ui/src/icons/index.d.ts +0 -1
  67. package/dist/widget/ui/src/icons/index.d.ts.map +1 -1
  68. package/dist/widget/ui/src/index.d.ts +1 -0
  69. package/dist/widget/ui/src/index.d.ts.map +1 -1
  70. package/package.json +2 -2
  71. package/src/components/Alert/Alert.styles.ts +5 -2
  72. package/src/components/BestRoute/BestRoute.stories.tsx +17 -0
  73. package/src/components/BestRoute/BestRoute.styles.ts +213 -0
  74. package/src/components/BestRoute/BestRoute.tsx +176 -0
  75. package/src/components/BestRoute/BestRoute.types.ts +32 -0
  76. package/src/components/BestRoute/BestRouteSkeleton.styles.ts +110 -0
  77. package/src/components/BestRoute/BestRouteSkeleton.tsx +112 -0
  78. package/src/components/BestRoute/BestRouteSkeleton.types.ts +5 -0
  79. package/src/components/BestRoute/RouteSummary.styles.ts +15 -0
  80. package/src/components/BestRoute/RouteSummary.tsx +48 -0
  81. package/src/components/BestRoute/index.ts +4 -0
  82. package/src/components/BestRoute/mock.ts +142 -0
  83. package/src/components/Checkbox/Checkbox.styles.ts +1 -5
  84. package/src/components/ListItem/ListItem.styles.ts +0 -7
  85. package/src/components/ListItem/ListItem.tsx +1 -1
  86. package/src/components/PriceImpact/PriceImpact.tsx +2 -2
  87. package/src/components/Radio/Radio.styles.tsx +2 -5
  88. package/src/components/{QuoteCost/QuoteCost.styles.ts → RouteCost/RouteCost.styles.ts} +0 -7
  89. package/src/components/{QuoteCost/QuoteCost.tsx → RouteCost/RouteCost.tsx} +4 -3
  90. package/src/components/RouteCost/index.ts +1 -0
  91. package/src/components/RoutesOverview/RoutesOverview.tsx +2 -6
  92. package/src/components/SelectableWalletList/SelectableWalletList.tsx +1 -1
  93. package/src/components/StepDetails/StepDetails.stories.tsx +1 -1
  94. package/src/components/StepDetails/StepDetails.styles.ts +4 -4
  95. package/src/components/StepDetails/StepDetails.tsx +3 -3
  96. package/src/components/StepDetails/StepDetails.types.ts +2 -17
  97. package/src/components/StepDetails/index.ts +1 -1
  98. package/src/components/StepDetails/mock.ts +1 -1
  99. package/src/components/SvgIcon/SvgIcon.style.ts +1 -1
  100. package/src/components/Switch/Switch.styles.tsx +2 -6
  101. package/src/components/index.ts +2 -1
  102. package/src/containers/BlockchainSelector/BlockchainSelector.tsx +8 -9
  103. package/src/containers/SwapInput/SwapInput.styles.ts +0 -33
  104. package/src/containers/SwapInput/SwapInput.tsx +19 -16
  105. package/src/containers/SwapInput/SwapInput.types.ts +0 -1
  106. package/src/containers/SwapInput/TokenSection.styles.ts +0 -8
  107. package/src/containers/SwapInput/TokenSection.tsx +1 -4
  108. package/src/containers/TokenSelector/TokenSelector.tsx +10 -8
  109. package/src/helper/index.ts +99 -0
  110. package/src/icons/index.ts +0 -1
  111. package/src/index.ts +1 -0
  112. package/src/theme.ts +4 -4
  113. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.d.ts +0 -4
  114. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.d.ts.map +0 -1
  115. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts.map +0 -1
  116. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.types.d.ts.map +0 -1
  117. package/dist/widget/ui/src/components/QuoteCost/index.d.ts +0 -2
  118. package/dist/widget/ui/src/components/QuoteCost/index.d.ts.map +0 -1
  119. package/dist/widget/ui/src/icons/Language.d.ts +0 -5
  120. package/dist/widget/ui/src/icons/Language.d.ts.map +0 -1
  121. package/dist/widget/ui/src/utils/index.d.ts.map +0 -1
  122. package/src/components/QuoteCost/index.ts +0 -1
  123. package/src/icons/Language.tsx +0 -55
  124. package/src/utils/index.ts +0 -23
  125. /package/src/components/{QuoteCost/QuoteCost.types.ts → RouteCost/RouteCost.types.ts} +0 -0
@@ -9,7 +9,7 @@ import { Container } from './PriceImpact.styles';
9
9
  export function PriceImpact(props: PriceImpactProps) {
10
10
  const { size, outputUsdValue, percentageChange, warningLevel, error } = props;
11
11
 
12
- let percentageChangeColor = '$neutral600';
12
+ let percentageChangeColor = '$neutral700';
13
13
  if (!outputUsdValue || warningLevel === 'low') {
14
14
  percentageChangeColor = '$warning500';
15
15
  } else if (warningLevel === 'high') {
@@ -22,7 +22,7 @@ export function PriceImpact(props: PriceImpactProps) {
22
22
  <Typography
23
23
  size={size === 'small' ? 'small' : 'medium'}
24
24
  variant="body"
25
- color="$neutral600">
25
+ color={size !== 'small' ? '$neutral600' : '$neutral700'}>
26
26
  {`~$${outputUsdValue}`}
27
27
  </Typography>
28
28
  )}
@@ -9,11 +9,8 @@ export const StyledItem = styled(Radio.Item, {
9
9
  borderRadius: '100%',
10
10
  cursor: 'pointer',
11
11
  backgroundColor: 'transparent',
12
- $$borderColor: '$colors$neutral600',
13
- [`.${darkTheme} &`]: {
14
- $$borderColor: '$colors$neutral700',
15
- },
16
- border: '1px solid $$borderColor',
12
+ border: '1px solid $neutral600',
13
+
17
14
  '&[data-state="checked"]': {
18
15
  $$color: '$colors$secondary500',
19
16
  [`.${darkTheme} &`]: {
@@ -18,10 +18,3 @@ export const Container = styled('div', {
18
18
  alignItems: 'center',
19
19
  },
20
20
  });
21
-
22
- export const Separator = styled('div', {
23
- height: '$12',
24
- marginLeft: '$10',
25
- marginRight: '$10',
26
- borderLeft: '1px solid $foreground',
27
- });
@@ -1,13 +1,14 @@
1
- import type { PropTypes } from './QuoteCost.types';
1
+ import type { PropTypes } from './RouteCost.types';
2
2
 
3
3
  import React from 'react';
4
4
 
5
5
  import { GasIcon, NumberIcon, TimeIcon } from '../../icons';
6
+ import { Separator } from '../BestRoute/BestRoute.styles';
6
7
  import { Typography } from '../Typography';
7
8
 
8
- import { Container, Separator } from './QuoteCost.styles';
9
+ import { Container } from './RouteCost.styles';
9
10
 
10
- export function QuoteCost(props: PropTypes) {
11
+ export function RouteCost(props: PropTypes) {
11
12
  const { fee, time, steps } = props;
12
13
  return (
13
14
  <Container>
@@ -0,0 +1 @@
1
+ export { RouteCost } from './RouteCost';
@@ -2,7 +2,7 @@ import type { BestRouteResponse } from 'rango-sdk';
2
2
 
3
3
  import React from 'react';
4
4
 
5
- import { darkTheme, styled } from '../../theme';
5
+ import { styled } from '../../theme';
6
6
  import { Divider } from '../Divider';
7
7
  import { AngleRightIcon, GasIcon } from '../Icon';
8
8
 
@@ -13,11 +13,7 @@ export const Container = styled('div', {
13
13
  padding: '$8',
14
14
  borderRadius: '$xs',
15
15
  backgroundColor: '$background',
16
- $$color: '$colors$neutral600',
17
- [`.${darkTheme} &`]: {
18
- $$color: '$colors$neutral700',
19
- },
20
- color: '$$color',
16
+ color: '$neutral600',
21
17
  fontSize: '$12',
22
18
 
23
19
  '.routes': {
@@ -2,8 +2,8 @@ import type { PropsWithChildren } from 'react';
2
2
 
3
3
  import React, { useEffect, useState } from 'react';
4
4
 
5
+ import { getConciseAddress } from '../../helper';
5
6
  import { styled } from '../../theme';
6
- import { getConciseAddress } from '../../utils';
7
7
  import { Image } from '../common';
8
8
  import { Typography } from '../Typography';
9
9
 
@@ -17,7 +17,7 @@ type Story = StoryObj<typeof StepDetails>;
17
17
  export const Main: Story = {
18
18
  args: {
19
19
  step: { ...step1, alerts: <Alert title="test alert" type="warning" /> },
20
- type: 'swap-progress',
20
+ type: 'route-progress',
21
21
  state: 'completed',
22
22
  },
23
23
  };
@@ -8,8 +8,8 @@ export const Container = styled('div', {
8
8
  border: '1px solid transparent',
9
9
  variants: {
10
10
  type: {
11
- 'quote-details': { border: 'none' },
12
- 'swap-progress': {
11
+ 'route-details': { border: 'none' },
12
+ 'route-progress': {
13
13
  $$color: '$colors$neutral100',
14
14
  [`.${darkTheme} &`]: {
15
15
  $$color: '$colors$neutral300',
@@ -63,8 +63,8 @@ export const Container = styled('div', {
63
63
 
64
64
  export const SwapperImage = styled('div', {
65
65
  borderRadius: '100%',
66
- width: '24px',
67
- height: '24px',
66
+ width: 'max-content',
67
+ height: 'max-content',
68
68
  overflow: 'hidden',
69
69
  border: '1.5px solid transparent',
70
70
  variants: {
@@ -40,7 +40,7 @@ const StepDetailsComponent = forwardRef<HTMLDivElement, StepDetailsProps>(
40
40
  ref={containerRef}
41
41
  tabIndex={tabIndex}>
42
42
  <div className="swapper">
43
- {type === 'swap-progress' && hasSeparator && (
43
+ {type === 'route-progress' && hasSeparator && (
44
44
  <StepSeparator state={state} />
45
45
  )}
46
46
  <SwapperImage state={state}>
@@ -61,7 +61,7 @@ const StepDetailsComponent = forwardRef<HTMLDivElement, StepDetailsProps>(
61
61
  </Typography>
62
62
  </div>
63
63
  <div className="step-info">
64
- <DashedLine invisible={!hasSeparator || type === 'swap-progress'} />
64
+ <DashedLine invisible={!hasSeparator || type === 'route-progress'} />
65
65
  <div className="tokens-container">
66
66
  <div className="tokens">
67
67
  <ChainToken
@@ -90,7 +90,7 @@ const StepDetailsComponent = forwardRef<HTMLDivElement, StepDetailsProps>(
90
90
  step.to.price.value
91
91
  } ${step.to.token.displayName}`}</Typography>
92
92
  </div>
93
- <Alerts pb={hasSeparator && type === 'quote-details'}>
93
+ <Alerts pb={hasSeparator && type === 'route-details'}>
94
94
  {step.alerts}
95
95
  </Alerts>
96
96
  </div>
@@ -1,24 +1,9 @@
1
- import type { ReactNode } from 'react';
2
- import type { SwapInputProps } from 'src/containers/SwapInput/SwapInput.types';
3
-
4
- type BaseStep = Pick<SwapInputProps, 'chain' | 'token' | 'price'>;
5
-
6
- export type Step = {
7
- swapper: SwapInputProps['chain'];
8
- from: BaseStep;
9
- to: BaseStep;
10
- error?: {
11
- title?: string;
12
- description?: string;
13
- };
14
- alerts?: ReactNode;
15
- state?: 'error' | 'warning';
16
- };
1
+ import type { Step } from '../BestRoute/BestRoute.types';
17
2
 
18
3
  export type StepDetailsProps = {
19
4
  step: Step;
20
5
  hasSeparator: boolean;
21
- type: 'quote-details' | 'swap-progress';
6
+ type: 'route-details' | 'route-progress';
22
7
  state?: 'default' | 'in-progress' | 'completed' | 'warning' | 'error';
23
8
  isFocused?: boolean;
24
9
  tabIndex?: number;
@@ -1,2 +1,2 @@
1
1
  export { StepDetails } from './StepDetails';
2
- export type { StepDetailsProps, Step } from './StepDetails.types';
2
+ export type { StepDetailsProps } from './StepDetails.types';
@@ -1,4 +1,4 @@
1
- import type { Step } from './StepDetails.types';
1
+ import type { Step } from '../BestRoute/BestRoute.types';
2
2
 
3
3
  export const step1: Step = {
4
4
  swapper: {
@@ -28,7 +28,7 @@ export const SvgWithColor = styled('svg', {
28
28
  color: '$info500',
29
29
  },
30
30
  gray: {
31
- color: '$neutral700',
31
+ color: '$neutral600',
32
32
  },
33
33
  },
34
34
  },
@@ -8,12 +8,8 @@ export const StyledSwitchRoot = styled(RadixSwitch.Root, {
8
8
  borderStyle: 'solid',
9
9
  width: '24px',
10
10
  height: '16px',
11
- $$color: '$colors$neutral600',
12
- [`.${darkTheme} &`]: {
13
- $$color: '$colors$neutral700',
14
- },
15
- backgroundColor: '$$color',
16
- borderColor: '$$color',
11
+ backgroundColor: '$neutral600',
12
+ borderColor: '$neutral600',
17
13
  borderRadius: '99999px',
18
14
  position: 'relative',
19
15
  padding: '0',
@@ -1,5 +1,6 @@
1
1
  export * from './I18nManager';
2
2
  export * from './Alert';
3
+ export * from './BestRoute';
3
4
  export * from './BlockchainsChip';
4
5
  export * from './BottomLogo';
5
6
  export * from './Button';
@@ -44,7 +45,7 @@ export * from './ListItem';
44
45
  export * from './NotFound';
45
46
  export * from './MessageBox';
46
47
  export * from './IconButton';
47
- export * from './QuoteCost';
48
+ export * from './RouteCost';
48
49
  export * from './TokenAmount';
49
50
  export * from './StepDetails';
50
51
  export * from './Popover';
@@ -1,16 +1,14 @@
1
- import type { LoadingStatus } from '../../types/meta';
2
- import type { CSSProperties } from '@stitches/react';
3
- import type { BlockchainMeta } from 'rango-sdk';
4
-
5
1
  import React from 'react';
6
-
7
- import { LoadingFailedAlert } from '../../components/Alert/LoadingFailedAlert';
8
- import { NotFoundAlert } from '../../components/Alert/NotFoundAlert';
2
+ import { BlockchainMeta } from 'rango-sdk';
9
3
  import { BlockchainsList } from '../../components/BlockchainsList';
10
4
  import { SecondaryPage } from '../../components/SecondaryPage/SecondaryPage';
11
5
  import { Spinner } from '../../components/Spinner';
12
6
  import { styled } from '../../theme';
13
- import { containsText } from '../../utils';
7
+ import { CSSProperties } from '@stitches/react';
8
+ import { containsText } from '../../helper';
9
+ import { LoadingStatus } from '../../types/meta';
10
+ import { LoadingFailedAlert } from '../../components/Alert/LoadingFailedAlert';
11
+ import { NotFoundAlert } from '../../components/Alert/NotFoundAlert';
14
12
  import { LoaderContainer } from '../TokenSelector/TokenSelector';
15
13
 
16
14
  const ListContainer = styled('div', {
@@ -58,7 +56,8 @@ export function BlockchainSelector(props: PropTypes) {
58
56
  hasHeader={hasHeader}
59
57
  textFieldPlaceholder="Search blockchains by name"
60
58
  title={`Select ${type} Blockchain`}
61
- onBack={onBack}>
59
+ onBack={onBack}
60
+ >
62
61
  {(searchedFor) => {
63
62
  const filteredBlockchains = filterBlockchains(list, searchedFor);
64
63
  return (
@@ -17,13 +17,6 @@ export const Container = styled('div', {
17
17
  },
18
18
  },
19
19
  },
20
- '& .gray-text': {
21
- $$color: '$colors$neutral600',
22
- [`.${darkTheme} &`]: {
23
- $$color: '$colors$neutral700',
24
- },
25
- color: '$$color',
26
- },
27
20
  '& .label__container': {
28
21
  paddingBottom: '$5',
29
22
  },
@@ -69,29 +62,3 @@ export const MaxButton = styled(Button, {
69
62
  },
70
63
  backgroundColor: '$$color',
71
64
  });
72
-
73
- export const ValueTypography = styled('div', {
74
- width: 140,
75
- textAlign: 'right',
76
- whiteSpace: 'nowrap',
77
- overflow: 'hidden',
78
- textOverflow: 'ellipsis',
79
- variants: {
80
- hasWarning: {
81
- true: {
82
- '& ._typography': {
83
- color: '$warning500',
84
- },
85
- },
86
- false: {
87
- '& ._typography': {
88
- $$color: '$colors$neutral600',
89
- [`.${darkTheme} &`]: {
90
- $$color: '$colors$neutral700',
91
- },
92
- color: '$$color',
93
- },
94
- },
95
- },
96
- },
97
- });
@@ -5,12 +5,7 @@ import React from 'react';
5
5
 
6
6
  import { Divider, PriceImpact, Skeleton, Typography } from '../../components';
7
7
 
8
- import {
9
- Container,
10
- InputAmount,
11
- MaxButton,
12
- ValueTypography,
13
- } from './SwapInput.styles';
8
+ import { Container, InputAmount, MaxButton } from './SwapInput.styles';
14
9
  import { TokenSection } from './TokenSection';
15
10
 
16
11
  export function SwapInput(props: SwapInputProps) {
@@ -18,13 +13,13 @@ export function SwapInput(props: SwapInputProps) {
18
13
  <Container sharpBottomStyle={props.sharpBottomStyle}>
19
14
  <div className="label__container">
20
15
  <div className="label">
21
- <Typography variant="body" size="small" className="gray-text">
16
+ <Typography variant="body" size="small" color="$neutral600">
22
17
  {props.label}
23
18
  </Typography>
24
19
  {'balance' in props && !props.loading && (
25
20
  <div className="balance">
26
21
  <Typography
27
- className="gray-text"
22
+ color="$neutral600"
28
23
  mr={4}
29
24
  variant="body"
30
25
  size="xsmall">
@@ -58,7 +53,7 @@ export function SwapInput(props: SwapInputProps) {
58
53
  loading={props.loading}
59
54
  />
60
55
  <div className="amount">
61
- {props.loading || (props.mode === 'To' && props.fetchingQuote) ? (
56
+ {props.loading ? (
62
57
  <>
63
58
  <Skeleton variant="text" size="large" width={92} />
64
59
  <Divider size={8} />
@@ -89,13 +84,21 @@ export function SwapInput(props: SwapInputProps) {
89
84
  warningLevel={props.warningLevel}
90
85
  />
91
86
  ) : (
92
- <ValueTypography hasWarning={!!props.price.error}>
93
- <Typography variant="body" size="medium">
94
- {props.price.usdValue
95
- ? `~$${props.price.usdValue}`
96
- : props.price.error}
97
- </Typography>
98
- </ValueTypography>
87
+ <Typography
88
+ variant="body"
89
+ size="medium"
90
+ color={!props.price.error ? '$neutral600' : '$warning500'}
91
+ style={{
92
+ width: 140,
93
+ textAlign: 'right',
94
+ whiteSpace: 'nowrap',
95
+ overflow: 'hidden',
96
+ textOverflow: 'ellipsis',
97
+ }}>
98
+ {props.price.usdValue
99
+ ? `~$${props.price.usdValue}`
100
+ : props.price.error}
101
+ </Typography>
99
102
  )}
100
103
  </>
101
104
  )}
@@ -31,7 +31,6 @@ type FromProps = {
31
31
 
32
32
  type ToProps = {
33
33
  mode: 'To';
34
- fetchingQuote?: boolean;
35
34
  percentageChange: string | null;
36
35
  warningLevel: PriceImpactWarningLevel;
37
36
  };
@@ -2,7 +2,6 @@ import { Button } from '../../components';
2
2
  import { darkTheme, styled } from '../../theme';
3
3
 
4
4
  export const Container = styled(Button, {
5
- maxWidth: '180px',
6
5
  backgroundColor: 'transparent',
7
6
  color: '$neutral700',
8
7
  '&:disabled': {
@@ -37,13 +36,6 @@ export const TokenSectionContainer = styled('div', {
37
36
  boxSizing: 'border-box',
38
37
  alignItems: 'center',
39
38
 
40
- '& .blockchain-name': {
41
- $$color: '$colors$neutral600',
42
- [`.${darkTheme} &`]: {
43
- $$color: '$colors$neutral700',
44
- },
45
- color: '$$color',
46
- },
47
39
  '& .token-chain-name': {
48
40
  display: 'flex',
49
41
  flexDirection: 'column',
@@ -41,10 +41,7 @@ export function TokenSection(props: TokenSectionProps) {
41
41
  ? i18n.t('Token')
42
42
  : tokenSymbol}
43
43
  </Typography>
44
- <Typography
45
- variant="body"
46
- size="medium"
47
- className="blockchain-name">
44
+ <Typography variant="body" size="medium" color="$neutral600">
48
45
  {error || (!loading && !chain) ? i18n.t('Chain') : chain}
49
46
  </Typography>
50
47
  </>
@@ -1,13 +1,14 @@
1
- import type { TokenWithAmount } from '../../components/TokenList/TokenList';
2
- import type { LoadingStatus } from '../../types/meta';
3
-
4
1
  import React from 'react';
2
+ import { containsText } from '../../helper';
5
3
 
6
- import { LoadingFailedAlert, SecondaryPage, Spinner } from '../../components';
7
- import { NotFoundAlert } from '../../components/Alert/NotFoundAlert';
8
- import { TokenList } from '../../components/TokenList/TokenList';
4
+ import { LoadingStatus } from '../../types/meta';
9
5
  import { styled } from '../../theme';
10
- import { containsText } from '../../utils';
6
+ import { NotFoundAlert } from '../../components/Alert/NotFoundAlert';
7
+ import { LoadingFailedAlert, SecondaryPage, Spinner } from '../../components';
8
+ import {
9
+ TokenList,
10
+ TokenWithAmount,
11
+ } from '../../components/TokenList/TokenList';
11
12
 
12
13
  export const LoaderContainer = styled('div', {
13
14
  display: 'flex',
@@ -44,7 +45,8 @@ export function TokenSelector(props: PropTypes) {
44
45
  hasHeader={hasHeader}
45
46
  title={`Select ${type} token`}
46
47
  onBack={onBack}
47
- textFieldPlaceholder="Search tokens by name">
48
+ textFieldPlaceholder="Search tokens by name"
49
+ >
48
50
  {(searchedFor) => {
49
51
  const filteredTokens = filterTokens(list, searchedFor);
50
52
 
@@ -0,0 +1,99 @@
1
+ /* eslint-disable @typescript-eslint/no-magic-numbers */
2
+
3
+ export function containsText(text: string, searchText: string): boolean {
4
+ return text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
5
+ }
6
+
7
+ export function getConciseAddress(
8
+ address: string | null,
9
+ maxChars = 8,
10
+ ellipsisLength = 3
11
+ ): string | null {
12
+ if (!address) {
13
+ return null;
14
+ }
15
+ if (address.length < 2 * maxChars + ellipsisLength) {
16
+ return address;
17
+ }
18
+ const start = Math.ceil((address.length - maxChars) / 2);
19
+ const end = address.length - maxChars;
20
+ return `${address.substr(start, maxChars)}${'.'.repeat(
21
+ ellipsisLength
22
+ )}${address.substr(end)}`;
23
+ }
24
+
25
+ const hexToRgb = (hex: string) =>
26
+ ((value) =>
27
+ value.length === 3
28
+ ? value.split('').map((c) => parseInt(c.repeat(2), 16))
29
+ : (value.match(/.{1,2}/g) || []).map((v) => parseInt(v, 16)))(
30
+ hex.replace('#', '')
31
+ );
32
+
33
+ const isHexTooDark = (hexColor: string) =>
34
+ (([r, g, b]) => 0.2126 * r + 0.7152 * g + 0.0722 * b < 40)(
35
+ hexToRgb(hexColor)
36
+ );
37
+
38
+ const isHexTooLight = (hexColor: string) =>
39
+ (([r, g, b]) => (r * 299 + g * 587 + b * 114) / 1000 > 155)(
40
+ hexToRgb(hexColor)
41
+ );
42
+
43
+ const colorShade = (col: string, amt: number) => {
44
+ col = col.replace(/^#/, '');
45
+ if (col.length === 3) {
46
+ col = col[0] + col[0] + col[1] + col[1] + col[2] + col[2];
47
+ }
48
+ let [r, g, b]: any = col.match(/.{2}/g);
49
+ [r, g, b] = [
50
+ parseInt(r, 16) + amt,
51
+ parseInt(g, 16) + amt,
52
+ parseInt(b, 16) + amt,
53
+ ];
54
+
55
+ r = Math.max(Math.min(255, r), 0).toString(16);
56
+ g = Math.max(Math.min(255, g), 0).toString(16);
57
+ b = Math.max(Math.min(255, b), 0).toString(16);
58
+
59
+ const rr = (r.length < 2 ? '0' : '') + r;
60
+ const gg = (g.length < 2 ? '0' : '') + g;
61
+ const bb = (b.length < 2 ? '0' : '') + b;
62
+
63
+ return `#${rr}${gg}${bb}`;
64
+ };
65
+
66
+ export const generateRangeColors = (
67
+ name: string,
68
+ mode: 'light' | 'dark',
69
+ color?: string
70
+ ) => {
71
+ let colors = { [name]: color };
72
+ if (color) {
73
+ let c = color;
74
+ if (isHexTooDark(color) || mode === 'dark') {
75
+ for (let i = 1; i < 10; i++) {
76
+ colors = {
77
+ ...colors,
78
+ [name + i * 100]:
79
+ name === 'neutral'
80
+ ? colorShade(c, i * 15)
81
+ : colorShade(color, i * 5),
82
+ };
83
+ }
84
+ }
85
+ if (isHexTooLight(color) || mode === 'light') {
86
+ for (let i = 1; i < 10; i++) {
87
+ c = colorShade(c, -(i * 5));
88
+ colors = {
89
+ ...colors,
90
+ [name + i * 100]:
91
+ name === 'neutral'
92
+ ? colorShade(c, -(i * 5))
93
+ : colorShade(color, -(i * 5)),
94
+ };
95
+ }
96
+ }
97
+ }
98
+ return colors;
99
+ };
@@ -19,7 +19,6 @@ export { default as GasIcon } from './Gas';
19
19
  export { default as InProgressIcon } from './InProgress';
20
20
  export { default as InfoErrorIcon } from './InfoError';
21
21
  export { default as InfoIcon } from './Info';
22
- export { default as LanguageIcon } from './Language';
23
22
  export { default as LightModeIcon } from './LightMode';
24
23
  export { default as LinkIcon } from './Link';
25
24
  export { default as LoadingIcon } from './Loading';
package/src/index.ts CHANGED
@@ -4,3 +4,4 @@ export * from './theme';
4
4
  export * from './types';
5
5
  export * from './hooks';
6
6
  export * from './icons';
7
+ export { generateRangeColors } from './helper';
package/src/theme.ts CHANGED
@@ -185,10 +185,10 @@ export const darkColors = {
185
185
  secondary600: '#2B3462',
186
186
 
187
187
  neutral: '#222222',
188
- neutral900: '#E9E9E9',
189
- neutral800: '#E6E6E6',
190
- neutral700: '#B8B8B8',
191
- neutral600: '#A2A2A2',
188
+ neutral900: '#F2F2F2',
189
+ neutral800: '#EEEEEE',
190
+ neutral700: '#E9E9E9',
191
+ neutral600: '#B8B8B8',
192
192
  neutral500: '#222222',
193
193
  neutral400: '#1B1B1B',
194
194
  neutral300: '#121212',
@@ -1,4 +0,0 @@
1
- import type { PropTypes } from './QuoteCost.types';
2
- import React from 'react';
3
- export declare function QuoteCost(props: PropTypes): React.JSX.Element;
4
- //# sourceMappingURL=QuoteCost.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"QuoteCost.d.ts","sourceRoot":"","sources":["../../../../../../src/components/QuoteCost/QuoteCost.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,qBAgCzC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"QuoteCost.styles.d.ts","sourceRoot":"","sources":["../../../../../../src/components/QuoteCost/QuoteCost.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAiBpB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAKpB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"QuoteCost.types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/QuoteCost/QuoteCost.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -1,2 +0,0 @@
1
- export { QuoteCost } from './QuoteCost';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/QuoteCost/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -1,5 +0,0 @@
1
- import type { SvgIconPropsWithChildren } from '../components/SvgIcon';
2
- import React from 'react';
3
- declare function SvgLanguage(props: SvgIconPropsWithChildren): React.FunctionComponentElement<SvgIconPropsWithChildren>;
4
- export default SvgLanguage;
5
- //# sourceMappingURL=Language.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Language.d.ts","sourceRoot":"","sources":["../../../../../src/icons/Language.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAwB,MAAM,OAAO,CAAC;AAI7C,iBAAS,WAAW,CAAC,KAAK,EAAE,wBAAwB,4DA+CnD;AACD,eAAe,WAAW,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/utils/index.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,QAAQ,SAAI,EACZ,cAAc,SAAI,GACjB,MAAM,GAAG,IAAI,CAYf"}
@@ -1 +0,0 @@
1
- export { QuoteCost } from './QuoteCost';