@lifi/widget 1.10.3 → 1.11.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 (201) hide show
  1. package/App.js +59 -11
  2. package/AppDrawer.js +1 -1
  3. package/AppDrawer.style.d.ts +1 -1
  4. package/AppDrawer.style.js +0 -1
  5. package/AppProvider.d.ts +1 -0
  6. package/AppProvider.js +5 -2
  7. package/components/AppContainer.d.ts +10 -0
  8. package/components/AppContainer.js +4 -7
  9. package/components/Card/Card.d.ts +11 -5
  10. package/components/Card/Card.js +29 -5
  11. package/components/Card/index.d.ts +0 -1
  12. package/components/Card/index.js +0 -1
  13. package/components/Dialog.d.ts +3 -0
  14. package/components/Dialog.js +23 -0
  15. package/components/GasSufficiencyMessage/GasSufficiencyMessage.d.ts +6 -0
  16. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +41 -0
  17. package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.d.ts → GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts} +0 -0
  18. package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.js → GasSufficiencyMessage/GasSufficiencyMessage.style.js} +1 -0
  19. package/components/GasSufficiencyMessage/index.d.ts +1 -0
  20. package/components/GasSufficiencyMessage/index.js +1 -0
  21. package/components/Header/Header.js +5 -6
  22. package/components/Header/Header.style.js +2 -1
  23. package/components/Header/NavigationHeader.js +28 -22
  24. package/components/Header/WalletHeader.js +4 -4
  25. package/components/Header/index.d.ts +1 -0
  26. package/components/Header/index.js +1 -0
  27. package/components/Header/types.d.ts +8 -0
  28. package/components/Header/types.js +1 -0
  29. package/components/Header/useHeaderActionStore.d.ts +6 -0
  30. package/components/Header/useHeaderActionStore.js +19 -0
  31. package/components/PoweredBy/PoweredBy.js +0 -1
  32. package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +14 -2
  33. package/components/ReverseTokensButton/ReverseTokensButton.js +5 -7
  34. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  35. package/components/ReverseTokensButton/ReverseTokensButton.style.js +4 -2
  36. package/components/SelectTokenButton/SelectTokenButton.js +9 -7
  37. package/components/SelectTokenButton/SelectTokenButton.style.d.ts +3 -10
  38. package/components/SelectTokenButton/SelectTokenButton.style.js +0 -7
  39. package/components/SmallAvatar.d.ts +16 -0
  40. package/components/SmallAvatar.js +8 -0
  41. package/{pages/SwapPage → components/Step}/CircularProgress.d.ts +0 -0
  42. package/{pages/SwapPage → components/Step}/CircularProgress.js +0 -0
  43. package/{pages/SwapPage → components/Step}/CircularProgress.style.d.ts +0 -0
  44. package/{pages/SwapPage → components/Step}/CircularProgress.style.js +0 -0
  45. package/components/Step/Step.d.ts +7 -0
  46. package/{pages/SwapPage/StepItem.js → components/Step/Step.js} +6 -6
  47. package/{pages/SwapPage/ExecutionItem.d.ts → components/Step/StepProcess.d.ts} +1 -1
  48. package/{pages/SwapPage/ExecutionItem.js → components/Step/StepProcess.js} +2 -2
  49. package/{pages/SwapPage/ExecutionItem.style.d.ts → components/Step/StepProcess.style.d.ts} +1 -1
  50. package/{pages/SwapPage/ExecutionItem.style.js → components/Step/StepProcess.style.js} +0 -0
  51. package/{pages/SwapPage → components/Step}/StepTimer.d.ts +0 -0
  52. package/{pages/SwapPage → components/Step}/StepTimer.js +0 -0
  53. package/components/Step/index.d.ts +1 -0
  54. package/components/Step/index.js +1 -0
  55. package/components/Step/utils.d.ts +6 -0
  56. package/components/Step/utils.js +89 -0
  57. package/components/StepActions/StepActions.js +17 -7
  58. package/components/StepActions/StepActions.style.js +2 -2
  59. package/{pages/SwapPage → components/StepDivider}/StepDivider.d.ts +0 -0
  60. package/{pages/SwapPage → components/StepDivider}/StepDivider.js +0 -0
  61. package/{pages/SwapPage → components/StepDivider}/StepDivider.style.d.ts +0 -0
  62. package/{pages/SwapPage → components/StepDivider}/StepDivider.style.js +0 -0
  63. package/components/StepDivider/index.d.ts +1 -0
  64. package/components/StepDivider/index.js +1 -0
  65. package/components/SwapButton/SwapButton.js +9 -12
  66. package/components/SwapButton/SwapButton.style.d.ts +1 -1
  67. package/components/SwapButton/SwapButton.style.js +1 -5
  68. package/components/SwapButton/types.d.ts +2 -0
  69. package/components/SwapInProgress/SwapInProgress.js +9 -6
  70. package/components/SwapInProgress/SwapInProgress.style.d.ts +9 -21
  71. package/components/SwapInProgress/SwapInProgress.style.js +5 -6
  72. package/components/SwapInput/FormPriceHelperText.js +1 -1
  73. package/components/SwapInput/SwapInput.js +4 -5
  74. package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  75. package/components/SwapInput/SwapInputAdornment.style.js +0 -2
  76. package/components/SwapRouteCard/SwapRouteCard.js +15 -15
  77. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +0 -20
  78. package/components/SwapRouteCard/SwapRouteCard.style.js +7 -54
  79. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +6 -10
  80. package/components/SwapRouteCard/SwapRouteNotFoundCard.js +3 -3
  81. package/components/SwapRouteCard/types.d.ts +0 -3
  82. package/components/{StepToken.d.ts → Token/Token.d.ts} +2 -1
  83. package/components/Token/Token.js +31 -0
  84. package/components/Token/Token.style.d.ts +24 -0
  85. package/components/Token/Token.style.js +31 -0
  86. package/components/Token/index.d.ts +2 -0
  87. package/components/Token/index.js +2 -0
  88. package/components/TokenAvatar/TokenAvatar.d.ts +7 -0
  89. package/components/TokenAvatar/TokenAvatar.js +8 -0
  90. package/components/TokenAvatar/TokenAvatar.style.d.ts +1 -0
  91. package/components/TokenAvatar/TokenAvatar.style.js +16 -0
  92. package/components/TokenAvatar/index.d.ts +2 -0
  93. package/components/TokenAvatar/index.js +2 -0
  94. package/components/TokenList/TokenList.js +2 -2
  95. package/components/TokenList/TokenList.style.js +1 -1
  96. package/components/TokenList/TokenListItem.d.ts +1 -0
  97. package/components/TokenList/TokenListItem.js +13 -7
  98. package/components/TokenList/types.d.ts +1 -0
  99. package/config/queryClient.d.ts +1 -1
  100. package/config/queryClient.js +1 -1
  101. package/config/theme.js +14 -1
  102. package/config/version.d.ts +1 -1
  103. package/config/version.js +1 -1
  104. package/hooks/index.d.ts +1 -1
  105. package/hooks/index.js +1 -1
  106. package/hooks/useChains.d.ts +8 -8
  107. package/hooks/useChains.js +1 -1
  108. package/hooks/useContentHeight.js +1 -1
  109. package/hooks/useGasSufficiency.d.ts +15 -0
  110. package/hooks/useGasSufficiency.js +91 -0
  111. package/hooks/useRouteExecution.d.ts +3 -3
  112. package/hooks/useRouteExecution.js +23 -19
  113. package/hooks/useScrollableContainer.js +1 -1
  114. package/hooks/useSwapRoutes.d.ts +1 -1
  115. package/hooks/useSwapRoutes.js +2 -14
  116. package/hooks/useTelemetry.js +3 -1
  117. package/hooks/useTokenBalance.js +5 -5
  118. package/hooks/useTokenBalances.d.ts +2 -2
  119. package/hooks/useTokenBalances.js +8 -10
  120. package/hooks/useTokens.js +1 -1
  121. package/hooks/useTools.d.ts +10 -1
  122. package/hooks/useTools.js +13 -3
  123. package/i18n/en/translation.json +18 -9
  124. package/i18n/index.d.ts +12 -3
  125. package/icons/LiFiToolLogo.svg +6 -0
  126. package/package.json +9 -9
  127. package/pages/MainPage/MainPage.js +2 -3
  128. package/pages/MainPage/MainSwapButton.js +6 -7
  129. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.d.ts +0 -0
  130. package/pages/MainPage/SwapRoutes.js +36 -0
  131. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.d.ts +0 -0
  132. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.js +4 -0
  133. package/pages/SelectTokenPage/ChainSelect.js +2 -2
  134. package/pages/SelectTokenPage/SearchTokenInput.js +2 -2
  135. package/pages/SelectWalletPage/SelectWalletPage.js +4 -23
  136. package/pages/SelectWalletPage/SelectWalletPage.style.js +1 -1
  137. package/pages/SettingsPage/AdvancedPreferences.js +1 -1
  138. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  139. package/pages/SettingsPage/EnabledBridgesSelect.js +7 -4
  140. package/pages/SettingsPage/EnabledExchangesSelect.js +7 -4
  141. package/pages/SettingsPage/GasPriceSelect.js +2 -2
  142. package/pages/SettingsPage/RoutePrioritySelect.js +2 -2
  143. package/pages/SettingsPage/SlippageInput.js +3 -3
  144. package/pages/SwapDetailsPage/SwapDetailsPage.d.ts +2 -0
  145. package/pages/SwapDetailsPage/SwapDetailsPage.js +62 -0
  146. package/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +11 -0
  147. package/pages/SwapDetailsPage/SwapDetailsPage.style.js +5 -0
  148. package/pages/SwapDetailsPage/index.d.ts +1 -0
  149. package/pages/SwapDetailsPage/index.js +1 -0
  150. package/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +2 -0
  151. package/pages/SwapHistoryPage/SwapHistoryEmpty.js +14 -0
  152. package/pages/SwapHistoryPage/SwapHistoryItem.d.ts +5 -0
  153. package/pages/SwapHistoryPage/SwapHistoryItem.js +23 -0
  154. package/pages/SwapHistoryPage/SwapHistoryPage.d.ts +2 -0
  155. package/pages/SwapHistoryPage/SwapHistoryPage.js +14 -0
  156. package/pages/SwapHistoryPage/index.d.ts +1 -0
  157. package/pages/SwapHistoryPage/index.js +1 -0
  158. package/pages/SwapPage/StatusBottomSheet.js +4 -4
  159. package/pages/SwapPage/SwapPage.js +13 -10
  160. package/pages/SwapPage/SwapPage.style.d.ts +0 -33
  161. package/pages/SwapPage/SwapPage.style.js +2 -9
  162. package/pages/SwapPage/utils.js +1 -1
  163. package/pages/SwapRoutesPage/SwapRoutesPage.js +16 -8
  164. package/pages/SwapRoutesPage/SwapRoutesPage.style.js +1 -1
  165. package/providers/WalletProvider/WalletProvider.js +7 -26
  166. package/providers/WalletProvider/types.d.ts +0 -1
  167. package/providers/WidgetProvider/WidgetProvider.js +1 -1
  168. package/stores/route/index.d.ts +1 -1
  169. package/stores/route/index.js +1 -1
  170. package/stores/route/types.d.ts +2 -4
  171. package/stores/route/useExecutingRoutes.d.ts +2 -1
  172. package/stores/route/useExecutingRoutes.js +4 -2
  173. package/stores/route/useRouteStore.d.ts +4 -1
  174. package/stores/route/useRouteStore.js +23 -24
  175. package/stores/route/useSwapHistory.d.ts +2 -0
  176. package/stores/route/useSwapHistory.js +11 -0
  177. package/stores/settings/useSettingsStore.d.ts +13 -0
  178. package/types/widget.d.ts +3 -4
  179. package/utils/index.d.ts +6 -0
  180. package/utils/index.js +6 -0
  181. package/utils/navigationRoutes.d.ts +13 -0
  182. package/utils/navigationRoutes.js +12 -0
  183. package/components/Card/CardContainer.d.ts +0 -11
  184. package/components/Card/CardContainer.js +0 -16
  185. package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.d.ts +0 -3
  186. package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.js +0 -31
  187. package/components/InsufficientGasOrFundsMessage/index.d.ts +0 -1
  188. package/components/InsufficientGasOrFundsMessage/index.js +0 -1
  189. package/components/StepToken.js +0 -21
  190. package/components/SwapRoutes/SwapRoutes.js +0 -32
  191. package/components/SwapRoutes/SwapRoutesUpdateProgress.d.ts +0 -3
  192. package/components/SwapRoutes/SwapRoutesUpdateProgress.js +0 -24
  193. package/components/SwapRoutes/index.d.ts +0 -1
  194. package/components/SwapRoutes/index.js +0 -1
  195. package/hooks/useHasSufficientBalance.d.ts +0 -5
  196. package/hooks/useHasSufficientBalance.js +0 -72
  197. package/pages/SwapPage/StepItem.d.ts +0 -7
  198. package/stores/route/useCurrentRoute.d.ts +0 -2
  199. package/stores/route/useCurrentRoute.js +0 -5
  200. package/utils/routes.d.ts +0 -11
  201. package/utils/routes.js +0 -10
@@ -1,13 +1,16 @@
1
1
  /// <reference types="react" />
2
- export declare const Card: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
2
+ export declare const ProgressCard: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
3
3
  children?: import("react").ReactNode;
4
4
  component?: import("react").ElementType<any> | undefined;
5
5
  ref?: import("react").Ref<unknown> | undefined;
6
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
6
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
7
7
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
8
8
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
9
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
10
- isError?: boolean | undefined;
9
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
10
+ variant?: "default" | "error" | undefined;
11
+ dense?: boolean | undefined;
12
+ indented?: boolean | undefined;
13
+ onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
11
14
  }, {}, {}>;
12
15
  export declare const RouteCard: import("@emotion/styled").StyledComponent<{
13
16
  action?: import("react").ReactNode;
@@ -18,26 +21,11 @@ export declare const RouteCard: import("@emotion/styled").StyledComponent<{
18
21
  subheaderTypographyProps?: import("@mui/material").TypographyProps<"span", {
19
22
  component?: "span" | undefined;
20
23
  }> | undefined;
21
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
24
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
22
25
  title?: import("react").ReactNode;
23
26
  titleTypographyProps?: import("@mui/material").TypographyProps<"span", {
24
27
  component?: "span" | undefined;
25
28
  }> | undefined;
26
29
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
27
30
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
28
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "avatar" | "disableTypography" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
29
- export declare const RouteAvatar: import("@emotion/styled").StyledComponent<{
30
- alt?: string | undefined;
31
- children?: import("react").ReactNode;
32
- classes?: Partial<import("@mui/material").AvatarClasses> | undefined;
33
- imgProps?: (import("react").ImgHTMLAttributes<HTMLImageElement> & {
34
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
35
- }) | undefined;
36
- sizes?: string | undefined;
37
- src?: string | undefined;
38
- srcSet?: string | undefined;
39
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
40
- variant?: "square" | "circular" | "rounded" | undefined;
41
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
42
- ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
43
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "alt" | "src" | "sizes" | "srcSet" | "imgProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
31
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "avatar" | "disableTypography" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -1,15 +1,14 @@
1
- import { Avatar } from '@mui/material';
2
1
  import { alpha, styled } from '@mui/material/styles';
3
- import { CardContainer, CardHeader } from '../Card';
4
- export const Card = styled(CardContainer)(({ theme }) => ({
2
+ import { Card, CardHeader } from '../Card';
3
+ export const ProgressCard = styled(Card)(({ theme }) => ({
5
4
  borderColor: alpha(theme.palette.secondary.main, 0.48),
6
5
  background: alpha(theme.palette.secondary.main, 0.2),
6
+ '&:hover': {
7
+ background: alpha(theme.palette.secondary.main, 0.2),
8
+ },
7
9
  }));
8
10
  export const RouteCard = styled(CardHeader)(({ theme }) => ({
9
11
  cursor: 'pointer',
10
12
  paddingTop: 0,
11
13
  paddingBottom: 0,
12
14
  }));
13
- export const RouteAvatar = styled(Avatar)(({ theme }) => ({
14
- backgroundColor: theme.palette.background.paper,
15
- }));
@@ -4,7 +4,7 @@ import { useWatch } from 'react-hook-form';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { useTokenBalance } from '../../hooks';
6
6
  import { SwapFormKeyHelper, } from '../../providers/SwapFormProvider';
7
- import { formatTokenPrice } from '../../utils/format';
7
+ import { formatTokenPrice } from '../../utils';
8
8
  export const FormPriceHelperText = ({ formType, selected }) => {
9
9
  const { t } = useTranslation();
10
10
  const [amount, chainId, tokenAddress] = useWatch({
@@ -1,13 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Avatar } from '@mui/material';
3
2
  import { useLayoutEffect, useRef } from 'react';
4
3
  import { useFormContext, useWatch } from 'react-hook-form';
5
4
  import { useTranslation } from 'react-i18next';
6
5
  import { useChain, useToken } from '../../hooks';
7
6
  import { SwapFormKeyHelper, } from '../../providers/SwapFormProvider';
8
- import { formatAmount } from '../../utils/format';
9
- import { fitInputText } from '../../utils/input';
10
- import { CardContainer, CardTitle } from '../Card';
7
+ import { fitInputText, formatAmount } from '../../utils';
8
+ import { Card, CardTitle } from '../Card';
9
+ import { TokenAvatar } from '../TokenAvatar';
11
10
  import { FormPriceHelperText } from './FormPriceHelperText';
12
11
  import { FormControl, Input, maxInputFontSize, minInputFontSize, } from './SwapInput.style';
13
12
  import { SwapInputAdornment } from './SwapInputAdornment';
@@ -37,7 +36,7 @@ export const SwapInput = ({ formType }) => {
37
36
  useLayoutEffect(() => {
38
37
  fitInputText(maxInputFontSize, minInputFontSize, ref.current);
39
38
  }, [amount]);
40
- return (_jsxs(CardContainer, { children: [_jsx(CardTitle, { children: t('swap.amount') }), _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: isSelected ? (_jsx(Avatar, Object.assign({ src: token.logoURI, alt: token.symbol, sx: { marginLeft: 2 } }, { children: token.symbol[0] }))) : null, endAdornment: _jsx(SwapInputAdornment, { formType: formType }), inputProps: {
39
+ return (_jsxs(Card, { children: [_jsx(CardTitle, { children: t('swap.amount') }), _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: isSelected ? (_jsx(TokenAvatar, { token: token, sx: { marginLeft: 2 } })) : null, endAdornment: _jsx(SwapInputAdornment, { formType: formType }), inputProps: {
41
40
  inputMode: 'decimal',
42
41
  }, onChange: handleChange, onBlur: handleBlur, value: amount, name: amountKey, required: true }), _jsx(FormPriceHelperText, { selected: isSelected, formType: formType })] }))] }));
43
42
  };
@@ -9,7 +9,7 @@ export declare const Button: import("@emotion/styled").StyledComponent<{
9
9
  endIcon?: import("react").ReactNode;
10
10
  fullWidth?: boolean | undefined;
11
11
  href?: string | undefined;
12
- size?: "small" | "large" | "medium" | undefined;
12
+ size?: "small" | "medium" | "large" | undefined;
13
13
  startIcon?: import("react").ReactNode;
14
14
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
15
15
  variant?: "text" | "outlined" | "contained" | undefined;
@@ -1,8 +1,6 @@
1
1
  import { Button as MuiButton } from '@mui/material';
2
2
  import { lighten, styled } from '@mui/material/styles';
3
3
  export const Button = styled(MuiButton)(({ theme }) => ({
4
- textTransform: 'none',
5
- borderRadius: theme.shape.borderRadiusSecondary,
6
4
  borderColor: theme.palette.mode === 'light'
7
5
  ? theme.palette.grey[300]
8
6
  : theme.palette.grey[800],
@@ -10,12 +10,12 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { Check as CheckIcon } from '@mui/icons-material';
14
13
  import { Box, Typography } from '@mui/material';
15
14
  import { useTranslation } from 'react-i18next';
15
+ import { Card } from '../Card';
16
16
  import { StepActions } from '../StepActions';
17
- import { StepToken } from '../StepToken';
18
- import { Card, Check, Label } from './SwapRouteCard.style';
17
+ import { Token } from '../Token';
18
+ import { Label } from './SwapRouteCard.style';
19
19
  export const SwapRouteCard = (_a) => {
20
20
  var _b, _c;
21
21
  var { route, active, dense } = _a, other = __rest(_a, ["route", "active", "dense"]);
@@ -23,16 +23,16 @@ export const SwapRouteCard = (_a) => {
23
23
  const label = ((_b = route.tags) === null || _b === void 0 ? void 0 : _b.length)
24
24
  ? t(`swap.tags.${route.tags[0].toLowerCase()}`).toUpperCase()
25
25
  : t(`swap.tags.general`).toUpperCase();
26
- return (_jsx(Card, Object.assign({ active: active, dense: dense }, other, { children: _jsxs(Box, { children: [_jsxs(Box, Object.assign({ sx: {
27
- display: 'flex',
28
- alignItems: 'center',
29
- justifyContent: 'space-between',
30
- }, mb: 2 }, { children: [_jsx(Label, { children: label }), active ? (_jsx(Check, { children: _jsx(CheckIcon, { fontSize: "inherit" }) })) : null] })), _jsx(StepToken, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), mb: 2 }), !dense
31
- ? route.steps.map((step) => (_jsx(StepActions, { step: step, mb: 2 }, step.id)))
32
- : null, _jsxs(Box, Object.assign({ sx: {
33
- display: 'flex',
34
- justifyContent: 'space-between',
35
- } }, { children: [_jsxs(Box, { children: [_jsx(Typography, Object.assign({ fontSize: 18, fontWeight: "500" }, { children: t(`swap.currency`, { value: (_c = route.gasCostUSD) !== null && _c !== void 0 ? _c : 0 }) })), _jsx(Typography, Object.assign({ fontSize: 12, color: "text.secondary" }, { children: t(`swap.gas`) }))] }), _jsxs(Box, { children: [_jsxs(Typography, Object.assign({ fontSize: 18, fontWeight: "500", display: "flex", justifyContent: "flex-end" }, { children: ["~", (route.steps
36
- .map((step) => step.estimate.executionDuration)
37
- .reduce((cumulated, x) => cumulated + x) / 60).toFixed(0)] })), _jsx(Typography, Object.assign({ fontSize: 12, color: "text.secondary", textAlign: "end" }, { children: t(`swap.minutes`) }))] })] }))] }) })));
26
+ return (_jsxs(Card, Object.assign({ dense: dense, indented: true }, other, { children: [_jsx(Box, Object.assign({ sx: {
27
+ display: 'flex',
28
+ alignItems: 'center',
29
+ justifyContent: 'space-between',
30
+ }, mb: 2 }, { children: _jsx(Label, Object.assign({ active: active }, { children: label })) })), _jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), mb: 2 }), !dense
31
+ ? route.steps.map((step) => (_jsx(StepActions, { step: step, mb: 2 }, step.id)))
32
+ : null, _jsxs(Box, Object.assign({ sx: {
33
+ display: 'flex',
34
+ justifyContent: 'space-between',
35
+ } }, { children: [_jsxs(Box, { children: [_jsx(Typography, Object.assign({ fontSize: 18, fontWeight: "500" }, { children: t(`swap.currency`, { value: (_c = route.gasCostUSD) !== null && _c !== void 0 ? _c : 0 }) })), _jsx(Typography, Object.assign({ fontSize: 12, color: "text.secondary" }, { children: t(`swap.gas`) }))] }), _jsxs(Box, { children: [_jsxs(Typography, Object.assign({ fontSize: 18, fontWeight: "500", display: "flex", justifyContent: "flex-end" }, { children: ["~", (route.steps
36
+ .map((step) => step.estimate.executionDuration)
37
+ .reduce((cumulated, x) => cumulated + x) / 60).toFixed(0)] })), _jsx(Typography, Object.assign({ fontSize: 12, color: "text.secondary", textAlign: "end" }, { children: t(`swap.minutes`) }))] })] }))] })));
38
38
  };
@@ -1,16 +1,4 @@
1
1
  /// <reference types="react" />
2
- export declare const Card: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
3
- children?: import("react").ReactNode;
4
- component?: import("react").ElementType<any> | undefined;
5
- ref?: import("react").Ref<unknown> | undefined;
6
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
7
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
8
- ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
9
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
10
- active?: boolean | undefined;
11
- blur?: boolean | undefined;
12
- dense?: boolean | undefined;
13
- }, {}, {}>;
14
2
  export declare const Label: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
15
3
  align?: "inherit" | "left" | "right" | "center" | "justify" | undefined;
16
4
  children?: import("react").ReactNode;
@@ -26,11 +14,3 @@ export declare const Label: import("@emotion/styled").StyledComponent<import("@m
26
14
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
27
15
  active?: boolean | undefined;
28
16
  }, {}, {}>;
29
- export declare const Check: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
30
- children?: import("react").ReactNode;
31
- component?: import("react").ElementType<any> | undefined;
32
- ref?: import("react").Ref<unknown> | undefined;
33
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
34
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
35
- ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
36
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,54 +1,17 @@
1
- import { Box, Typography } from '@mui/material';
2
- import { darken, styled } from '@mui/material/styles';
3
- export const Card = styled(Box, {
4
- shouldForwardProp: (prop) => !['dense', 'active', 'blur'].includes(prop),
5
- })(({ theme, active, blur, dense }) => ({
6
- backgroundColor: theme.palette.background.paper,
7
- padding: theme.spacing(2),
8
- border: `1px solid ${active
9
- ? theme.palette.mode === 'light'
10
- ? theme.palette.common.black
11
- : theme.palette.grey[700]
12
- : theme.palette.mode === 'light'
13
- ? theme.palette.grey[300]
14
- : theme.palette.grey[800]}`,
15
- borderRadius: dense
16
- ? theme.shape.borderRadiusSecondary
17
- : theme.shape.borderRadius,
18
- boxSizing: 'border-box',
19
- userSelect: blur ? 'none' : 'auto',
20
- '&:hover': {
21
- cursor: blur || !dense ? 'pointer' : 'default',
22
- backgroundColor: blur || !dense
23
- ? darken(theme.palette.background.paper, 0.02)
24
- : theme.palette.background.paper,
25
- },
26
- '& > div': {
27
- filter: blur ? 'blur(3px)' : 'none',
28
- },
29
- transition: theme.transitions.create(['background-color'], {
30
- duration: theme.transitions.duration.enteringScreen,
31
- easing: theme.transitions.easing.easeOut,
32
- }),
33
- }));
1
+ import { Typography } from '@mui/material';
2
+ import { styled } from '@mui/material/styles';
34
3
  export const Label = styled(Typography, {
35
4
  shouldForwardProp: (prop) => prop !== 'active',
36
5
  })(({ theme, active }) => ({
37
- backgroundColor: active
38
- ? theme.palette.primary.main
39
- : theme.palette.background.paper,
6
+ backgroundColor: active ? theme.palette.primary.main : 'transparent',
40
7
  border: '1px solid',
41
8
  borderColor: active
42
9
  ? theme.palette.primary.main
43
10
  : theme.palette.mode === 'light'
44
- ? theme.palette.common.black
45
- : theme.palette.grey[300],
46
- borderRadius: theme.shape.borderRadius / 2,
47
- color: active
48
- ? theme.palette.common.white
49
- : theme.palette.mode === 'light'
50
- ? theme.palette.common.black
51
- : theme.palette.grey[300],
11
+ ? theme.palette.grey[500]
12
+ : theme.palette.grey[600],
13
+ borderRadius: theme.shape.borderRadiusSecondary,
14
+ color: active ? theme.palette.common.white : theme.palette.text.secondary,
52
15
  padding: theme.spacing(0.75),
53
16
  fontSize: 12,
54
17
  lineHeight: 1,
@@ -59,13 +22,3 @@ export const Label = styled(Typography, {
59
22
  display: 'inline-flex',
60
23
  userSelect: 'none',
61
24
  }));
62
- export const Check = styled(Box)(({ theme }) => ({
63
- backgroundColor: theme.palette.primary.main,
64
- borderRadius: '50%',
65
- color: theme.palette.common.white,
66
- width: 24,
67
- height: 24,
68
- display: 'grid',
69
- placeItems: 'center',
70
- fontSize: '1rem',
71
- }));
@@ -11,22 +11,18 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { Box, Skeleton } from '@mui/material';
14
- import { Card } from './SwapRouteCard.style';
14
+ import { Card } from '../Card';
15
15
  export const SwapRouteCardSkeleton = (_a) => {
16
- var { active, dense } = _a, other = __rest(_a, ["active", "dense"]);
17
- return (_jsxs(Card, Object.assign({ dense: dense }, other, { children: [_jsxs(Box, Object.assign({ sx: {
18
- display: 'flex',
19
- alignItems: 'center',
20
- justifyContent: 'space-between',
21
- } }, { children: [_jsx(Skeleton, { variant: "rectangular", width: 120, height: 24, sx: { borderRadius: 0.5 } }), active ? _jsx(Skeleton, { variant: "circular", width: 24, height: 24 }) : null] })), _jsxs(Box, Object.assign({ my: 2 }, { children: [_jsxs(Box, Object.assign({ sx: {
16
+ var { dense } = _a, other = __rest(_a, ["dense"]);
17
+ return (_jsxs(Card, Object.assign({ dense: dense, indented: true }, other, { children: [_jsx(Skeleton, { variant: "rectangular", width: 120, height: 24, sx: { borderRadius: 0.5 } }), _jsxs(Box, Object.assign({ my: 2 }, { children: [_jsxs(Box, Object.assign({ sx: {
22
18
  display: 'flex',
23
19
  alignItems: 'center',
24
- } }, { children: [_jsx(Box, Object.assign({ mr: 2 }, { children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }) })), _jsx(Skeleton, { variant: "text", width: 96, height: 32 })] })), _jsx(Box, Object.assign({ ml: 6 }, { children: _jsx(Skeleton, { variant: "text", width: 56, height: 22 }) }))] })), _jsxs(Box, Object.assign({ sx: {
20
+ } }, { children: [_jsx(Box, Object.assign({ mr: 2 }, { children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }) })), _jsx(Skeleton, { variant: "text", width: 96, height: 32 })] })), _jsx(Box, Object.assign({ ml: 6 }, { children: _jsx(Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }) }))] })), _jsxs(Box, Object.assign({ sx: {
25
21
  display: 'flex',
26
22
  justifyContent: 'space-between',
27
- } }, { children: [_jsxs(Box, { children: [_jsx(Skeleton, { variant: "text", width: 56, height: 22 }), _jsx(Skeleton, { variant: "text", width: 52, height: 15 })] }), _jsxs(Box, Object.assign({ sx: {
23
+ } }, { children: [_jsxs(Box, { children: [_jsx(Skeleton, { variant: "text", width: 56, height: 27 }), _jsx(Skeleton, { variant: "text", width: 52, height: 18 })] }), _jsxs(Box, Object.assign({ sx: {
28
24
  display: 'flex',
29
25
  alignItems: 'flex-end',
30
26
  flexDirection: 'column',
31
- } }, { children: [_jsx(Skeleton, { variant: "text", width: 40, height: 22 }), _jsx(Skeleton, { variant: "text", width: 48, height: 15 })] }))] }))] })));
27
+ } }, { children: [_jsx(Skeleton, { variant: "text", width: 40, height: 27 }), _jsx(Skeleton, { variant: "text", width: 48, height: 18 })] }))] }))] })));
32
28
  };
@@ -13,11 +13,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { Route as RouteIcon } from '@mui/icons-material';
14
14
  import { Box, Typography } from '@mui/material';
15
15
  import { useTranslation } from 'react-i18next';
16
- import { Card } from './SwapRouteCard.style';
16
+ import { Card } from '../Card';
17
17
  export const SwapRouteNotFoundCard = (_a) => {
18
- var { active, dense } = _a, other = __rest(_a, ["active", "dense"]);
18
+ var { dense } = _a, other = __rest(_a, ["dense"]);
19
19
  const { t } = useTranslation();
20
- return (_jsx(Card, Object.assign({ active: active, dense: dense }, other, { children: _jsxs(Box, Object.assign({ sx: {
20
+ return (_jsx(Card, Object.assign({ dense: dense, indented: true }, other, { children: _jsxs(Box, Object.assign({ sx: {
21
21
  display: 'flex',
22
22
  alignItems: 'center',
23
23
  justifyContent: 'center',
@@ -3,10 +3,7 @@ export interface SwapRouteCardProps {
3
3
  route: Route;
4
4
  dense?: boolean;
5
5
  active?: boolean;
6
- blur?: boolean;
7
6
  }
8
7
  export interface SwapRouteCardSkeletonProps {
9
8
  dense?: boolean;
10
- active?: boolean;
11
- blur?: boolean;
12
9
  }
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { TokenAmount } from '@lifi/sdk';
3
3
  import { BoxProps } from '@mui/material';
4
- export declare const StepToken: React.FC<{
4
+ export declare const Token: React.FC<{
5
5
  token: TokenAmount;
6
+ connected?: boolean;
6
7
  } & BoxProps>;
@@ -0,0 +1,31 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Box } from '@mui/material';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { useChains } from '../../hooks';
16
+ import { formatTokenAmount } from '../../utils';
17
+ import { TextFitter } from '../TextFitter';
18
+ import { TokenAvatar } from '../TokenAvatar';
19
+ import { TextSecondary } from './Token.style';
20
+ export const Token = (_a) => {
21
+ var _b;
22
+ var { token, connected } = _a, other = __rest(_a, ["token", "connected"]);
23
+ const { t } = useTranslation();
24
+ const { getChainById } = useChains();
25
+ return (_jsxs(Box, Object.assign({ flex: 1 }, other, { children: [_jsxs(Box, Object.assign({ display: "flex", flex: 1 }, { children: [_jsx(TokenAvatar, { token: token, sx: { marginRight: 2 } }), _jsx(TextFitter, Object.assign({ height: 32, textStyle: {
26
+ fontWeight: 700,
27
+ } }, { children: formatTokenAmount(token.amount, token.decimals) }))] })), _jsx(TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
28
+ tokenSymbol: token.symbol,
29
+ chainName: (_b = getChainById(token.chainId)) === null || _b === void 0 ? void 0 : _b.name,
30
+ }) }))] })));
31
+ };
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ export declare const TextSecondary: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
3
+ align?: "inherit" | "left" | "right" | "center" | "justify" | undefined;
4
+ children?: import("react").ReactNode;
5
+ classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
6
+ gutterBottom?: boolean | undefined;
7
+ noWrap?: boolean | undefined;
8
+ paragraph?: boolean | undefined;
9
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
10
+ variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)" | undefined;
11
+ variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)", string>> | undefined;
12
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof import("react").HTMLAttributes<HTMLSpanElement>> & {
13
+ ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
14
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
15
+ connected?: boolean | undefined;
16
+ }, {}, {}>;
17
+ export declare const TokenDivider: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
18
+ children?: import("react").ReactNode;
19
+ component?: import("react").ElementType<any> | undefined;
20
+ ref?: import("react").Ref<unknown> | undefined;
21
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
22
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
23
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
24
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -0,0 +1,31 @@
1
+ import { Box, Typography } from '@mui/material';
2
+ import { styled } from '@mui/material/styles';
3
+ export const TextSecondary = styled(Typography, {
4
+ shouldForwardProp: (prop) => prop !== 'connected',
5
+ })(({ theme, connected }) => ({
6
+ fontSize: 12,
7
+ lineHeight: 1,
8
+ fontWeight: 500,
9
+ color: theme.palette.text.secondary,
10
+ borderLeftWidth: connected ? 2 : 0,
11
+ borderLeftStyle: 'solid',
12
+ borderColor: theme.palette.mode === 'light'
13
+ ? theme.palette.grey[300]
14
+ : theme.palette.grey[800],
15
+ margin: connected
16
+ ? theme.spacing(0.5, 0, 0, 1.875)
17
+ : theme.spacing(0.5, 0, 0, 6),
18
+ padding: connected
19
+ ? theme.spacing(0, 0, 0, 3.875)
20
+ : theme.spacing(0, 0, 0, 0),
21
+ }));
22
+ export const TokenDivider = styled(Box)(({ theme }) => ({
23
+ height: 12,
24
+ borderLeftWidth: 2,
25
+ borderLeftStyle: 'solid',
26
+ borderColor: theme.palette.mode === 'light'
27
+ ? theme.palette.grey[300]
28
+ : theme.palette.grey[800],
29
+ margin: theme.spacing(0, 0, 0, 3.875),
30
+ padding: theme.spacing(0, 0, 0, 3.875),
31
+ }));
@@ -0,0 +1,2 @@
1
+ export * from './Token';
2
+ export * from './Token.style';
@@ -0,0 +1,2 @@
1
+ export * from './Token';
2
+ export * from './Token.style';
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { Token } from '@lifi/sdk';
3
+ import { SxProps, Theme } from '@mui/material';
4
+ export declare const TokenAvatar: React.FC<{
5
+ token: Token;
6
+ sx?: SxProps<Theme>;
7
+ }>;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Avatar, Badge } from '@mui/material';
3
+ import { useChain } from '../../hooks';
4
+ import { SmallAvatar } from '../SmallAvatar';
5
+ export const TokenAvatar = ({ token, sx }) => {
6
+ const { chain } = useChain(token.chainId);
7
+ return (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: chain ? (_jsx(SmallAvatar, Object.assign({ src: chain.logoURI, alt: chain.name }, { children: chain.name[0] }))) : null, sx: sx }, { children: _jsx(Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] })) })));
8
+ };
@@ -0,0 +1 @@
1
+ export declare const TokenAvatarGroup: import("@emotion/styled").StyledComponent<import("@mui/material").AvatarGroupProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -0,0 +1,16 @@
1
+ import { AvatarGroup } from '@mui/material';
2
+ import { avatarClasses } from '@mui/material/Avatar';
3
+ import { badgeClasses } from '@mui/material/Badge';
4
+ import { styled } from '@mui/material/styles';
5
+ export const TokenAvatarGroup = styled(AvatarGroup)(({ theme }) => ({
6
+ [`& .${avatarClasses.root}`]: {
7
+ background: theme.palette.background.paper,
8
+ },
9
+ [`& .${badgeClasses.badge}:last-child .${avatarClasses.root}`]: {
10
+ marginLeft: theme.spacing(-1),
11
+ boxSizing: 'border-box',
12
+ },
13
+ [`& .${badgeClasses.root}:last-child`]: {
14
+ marginLeft: theme.spacing(1),
15
+ },
16
+ }));
@@ -0,0 +1,2 @@
1
+ export * from './TokenAvatar';
2
+ export * from './TokenAvatar.style';
@@ -0,0 +1,2 @@
1
+ export * from './TokenAvatar';
2
+ export * from './TokenAvatar.style';
@@ -17,7 +17,7 @@ export const TokenList = ({ formType, height, onClick, }) => {
17
17
  name: [SwapFormKeyHelper.getChainKey(formType)],
18
18
  });
19
19
  const [searchTokensFilter] = useDebouncedWatch([SwapFormKey.SearchTokensFilter], 250);
20
- const { tokens, isLoading } = useTokenBalances(selectedChainId);
20
+ const { tokens, isLoading, isBalanceLoading } = useTokenBalances(selectedChainId);
21
21
  const chainTokens = useMemo(() => {
22
22
  var _a;
23
23
  let chainTokens = tokens !== null && tokens !== void 0 ? tokens : [];
@@ -63,6 +63,6 @@ export const TokenList = ({ formType, height, onClick, }) => {
63
63
  if (token.name.includes(skeletonKey)) {
64
64
  return (_jsx(TokenListItemSkeleton, { size: item.size, start: item.start }, item.key));
65
65
  }
66
- return (_jsx(TokenListItem, { onClick: handleTokenClick, size: item.size, start: item.start, token: token, showBalance: account.isActive }, item.key));
66
+ return (_jsx(TokenListItem, { onClick: handleTokenClick, size: item.size, start: item.start, token: token, isBalanceLoading: isBalanceLoading, showBalance: account.isActive }, item.key));
67
67
  }) }))] })));
68
68
  };
@@ -1,7 +1,7 @@
1
1
  import { ListItem as MuiListItem, ListItemButton as MuiListItemButton, } from '@mui/material';
2
2
  import { listItemSecondaryActionClasses } from '@mui/material/ListItemSecondaryAction';
3
3
  import { styled } from '@mui/material/styles';
4
- import { getContrastAlphaColor } from '../../utils/colors';
4
+ import { getContrastAlphaColor } from '../../utils';
5
5
  export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
6
6
  borderRadius: theme.shape.borderRadiusSecondary,
7
7
  paddingLeft: theme.spacing(2),
@@ -2,3 +2,4 @@
2
2
  import { TokenListItemBaseProps, TokenListItemProps } from './types';
3
3
  export declare const TokenListItem: React.FC<TokenListItemProps>;
4
4
  export declare const TokenListItemSkeleton: React.FC<TokenListItemBaseProps>;
5
+ export declare const TokenAmountSkeleton: React.FC;