@lifi/widget 1.10.4 → 1.11.2

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 (190) hide show
  1. package/App.js +58 -10
  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 +3 -6
  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 +1 -1
  22. package/components/Header/Header.style.js +2 -1
  23. package/components/Header/NavigationHeader.js +16 -10
  24. package/components/Header/WalletHeader.js +1 -1
  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 +5 -5
  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 +14 -5
  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 +7 -10
  66. package/components/SwapButton/SwapButton.style.d.ts +1 -1
  67. package/components/SwapButton/SwapButton.style.js +0 -4
  68. package/components/SwapButton/types.d.ts +2 -0
  69. package/components/SwapInProgress/SwapInProgress.js +8 -5
  70. package/components/SwapInProgress/SwapInProgress.style.d.ts +9 -21
  71. package/components/SwapInProgress/SwapInProgress.style.js +5 -6
  72. package/components/SwapInput/SwapInput.js +3 -3
  73. package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  74. package/components/SwapInput/SwapInputAdornment.style.js +0 -2
  75. package/components/SwapRouteCard/SwapRouteCard.js +15 -15
  76. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +0 -20
  77. package/components/SwapRouteCard/SwapRouteCard.style.js +7 -54
  78. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +6 -10
  79. package/components/SwapRouteCard/SwapRouteNotFoundCard.js +3 -3
  80. package/components/SwapRouteCard/types.d.ts +0 -3
  81. package/components/{StepToken.d.ts → Token/Token.d.ts} +2 -1
  82. package/components/Token/Token.js +31 -0
  83. package/components/Token/Token.style.d.ts +24 -0
  84. package/components/Token/Token.style.js +31 -0
  85. package/components/Token/index.d.ts +2 -0
  86. package/components/Token/index.js +2 -0
  87. package/components/TokenAvatar/TokenAvatar.d.ts +7 -0
  88. package/components/TokenAvatar/TokenAvatar.js +8 -0
  89. package/components/TokenAvatar/TokenAvatar.style.d.ts +1 -0
  90. package/components/TokenAvatar/TokenAvatar.style.js +16 -0
  91. package/components/TokenAvatar/index.d.ts +2 -0
  92. package/components/TokenAvatar/index.js +2 -0
  93. package/components/TokenList/TokenList.js +2 -2
  94. package/components/TokenList/TokenListItem.d.ts +1 -0
  95. package/components/TokenList/TokenListItem.js +12 -6
  96. package/components/TokenList/types.d.ts +1 -0
  97. package/config/queryClient.d.ts +1 -1
  98. package/config/queryClient.js +1 -1
  99. package/config/theme.js +30 -3
  100. package/config/version.d.ts +1 -1
  101. package/config/version.js +1 -1
  102. package/hooks/index.d.ts +1 -1
  103. package/hooks/index.js +1 -1
  104. package/hooks/useChains.d.ts +8 -8
  105. package/hooks/useChains.js +1 -1
  106. package/hooks/useGasSufficiency.d.ts +15 -0
  107. package/hooks/useGasSufficiency.js +91 -0
  108. package/hooks/useRouteExecution.d.ts +3 -3
  109. package/hooks/useRouteExecution.js +22 -18
  110. package/hooks/useSwapRoutes.d.ts +1 -1
  111. package/hooks/useSwapRoutes.js +2 -14
  112. package/hooks/useTokenBalance.js +1 -1
  113. package/hooks/useTokenBalances.d.ts +2 -2
  114. package/hooks/useTokenBalances.js +7 -9
  115. package/hooks/useTokens.js +1 -1
  116. package/hooks/useTools.d.ts +10 -1
  117. package/hooks/useTools.js +13 -3
  118. package/i18n/en/translation.json +18 -9
  119. package/i18n/index.d.ts +12 -3
  120. package/icons/LiFiToolLogo.svg +6 -0
  121. package/package.json +8 -8
  122. package/pages/MainPage/MainPage.js +2 -3
  123. package/pages/MainPage/MainSwapButton.js +5 -6
  124. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.d.ts +0 -0
  125. package/pages/MainPage/SwapRoutes.js +36 -0
  126. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.d.ts +0 -0
  127. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.js +4 -0
  128. package/pages/SelectTokenPage/ChainSelect.js +2 -2
  129. package/pages/SelectTokenPage/SearchTokenInput.js +2 -2
  130. package/pages/SelectWalletPage/SelectWalletPage.js +4 -23
  131. package/pages/SettingsPage/AdvancedPreferences.js +1 -1
  132. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  133. package/pages/SettingsPage/EnabledBridgesSelect.js +7 -4
  134. package/pages/SettingsPage/EnabledExchangesSelect.js +7 -4
  135. package/pages/SettingsPage/GasPriceSelect.js +2 -2
  136. package/pages/SettingsPage/RoutePrioritySelect.js +2 -2
  137. package/pages/SettingsPage/SlippageInput.js +2 -2
  138. package/pages/SwapDetailsPage/SwapDetailsPage.d.ts +2 -0
  139. package/pages/SwapDetailsPage/SwapDetailsPage.js +62 -0
  140. package/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +11 -0
  141. package/pages/SwapDetailsPage/SwapDetailsPage.style.js +5 -0
  142. package/pages/SwapDetailsPage/index.d.ts +1 -0
  143. package/pages/SwapDetailsPage/index.js +1 -0
  144. package/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +2 -0
  145. package/pages/SwapHistoryPage/SwapHistoryEmpty.js +14 -0
  146. package/pages/SwapHistoryPage/SwapHistoryItem.d.ts +5 -0
  147. package/pages/SwapHistoryPage/SwapHistoryItem.js +23 -0
  148. package/pages/SwapHistoryPage/SwapHistoryPage.d.ts +2 -0
  149. package/pages/SwapHistoryPage/SwapHistoryPage.js +14 -0
  150. package/pages/SwapHistoryPage/index.d.ts +1 -0
  151. package/pages/SwapHistoryPage/index.js +1 -0
  152. package/pages/SwapPage/StatusBottomSheet.js +3 -4
  153. package/pages/SwapPage/SwapPage.js +9 -9
  154. package/pages/SwapPage/SwapPage.style.d.ts +0 -33
  155. package/pages/SwapPage/SwapPage.style.js +2 -9
  156. package/pages/SwapRoutesPage/SwapRoutesPage.js +13 -8
  157. package/pages/SwapRoutesPage/SwapRoutesPage.style.js +1 -1
  158. package/providers/WalletProvider/WalletProvider.js +7 -26
  159. package/providers/WalletProvider/types.d.ts +0 -1
  160. package/providers/WidgetProvider/WidgetProvider.js +1 -1
  161. package/stores/route/index.d.ts +1 -1
  162. package/stores/route/index.js +1 -1
  163. package/stores/route/types.d.ts +2 -4
  164. package/stores/route/useExecutingRoutes.d.ts +2 -1
  165. package/stores/route/useExecutingRoutes.js +4 -2
  166. package/stores/route/useRouteStore.d.ts +4 -1
  167. package/stores/route/useRouteStore.js +23 -24
  168. package/stores/route/useSwapHistory.d.ts +2 -0
  169. package/stores/route/useSwapHistory.js +11 -0
  170. package/stores/settings/useSettingsStore.d.ts +13 -0
  171. package/types/widget.d.ts +3 -4
  172. package/utils/navigationRoutes.d.ts +3 -1
  173. package/utils/navigationRoutes.js +3 -1
  174. package/components/Card/CardContainer.d.ts +0 -11
  175. package/components/Card/CardContainer.js +0 -16
  176. package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.d.ts +0 -3
  177. package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.js +0 -31
  178. package/components/InsufficientGasOrFundsMessage/index.d.ts +0 -1
  179. package/components/InsufficientGasOrFundsMessage/index.js +0 -1
  180. package/components/StepToken.js +0 -21
  181. package/components/SwapRoutes/SwapRoutes.js +0 -32
  182. package/components/SwapRoutes/SwapRoutesUpdateProgress.d.ts +0 -3
  183. package/components/SwapRoutes/SwapRoutesUpdateProgress.js +0 -24
  184. package/components/SwapRoutes/index.d.ts +0 -1
  185. package/components/SwapRoutes/index.js +0 -1
  186. package/hooks/useHasSufficientBalance.d.ts +0 -5
  187. package/hooks/useHasSufficientBalance.js +0 -72
  188. package/pages/SwapPage/StepItem.d.ts +0 -7
  189. package/stores/route/useCurrentRoute.d.ts +0 -2
  190. package/stores/route/useCurrentRoute.js +0 -5
@@ -1,12 +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
7
  import { fitInputText, formatAmount } from '../../utils';
9
- import { CardContainer, CardTitle } from '../Card';
8
+ import { Card, CardTitle } from '../Card';
9
+ import { TokenAvatar } from '../TokenAvatar';
10
10
  import { FormPriceHelperText } from './FormPriceHelperText';
11
11
  import { FormControl, Input, maxInputFontSize, minInputFontSize, } from './SwapInput.style';
12
12
  import { SwapInputAdornment } from './SwapInputAdornment';
@@ -36,7 +36,7 @@ export const SwapInput = ({ formType }) => {
36
36
  useLayoutEffect(() => {
37
37
  fitInputText(maxInputFontSize, minInputFontSize, ref.current);
38
38
  }, [amount]);
39
- 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: {
40
40
  inputMode: 'decimal',
41
41
  }, onChange: handleChange, onBlur: handleBlur, value: amount, name: amountKey, required: true }), _jsx(FormPriceHelperText, { selected: isSelected, formType: formType })] }))] }));
42
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
  };
@@ -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;
@@ -4,21 +4,27 @@ import { memo } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { formatTokenPrice } from '../../utils';
6
6
  import { ListItem, ListItemButton } from './TokenList.style';
7
- export const TokenListItem = memo(({ onClick, size, start, token, showBalance }) => {
8
- var _a;
7
+ export const TokenListItem = memo(({ onClick, size, start, token, showBalance, isBalanceLoading }) => {
9
8
  const { t } = useTranslation();
10
9
  const handleClick = () => onClick === null || onClick === void 0 ? void 0 : onClick(token.address);
11
10
  const tokenPrice = formatTokenPrice(token.amount, token.priceUSD);
12
11
  return (_jsx(ListItem, Object.assign({ disablePadding: true, style: {
13
12
  height: `${size}px`,
14
13
  transform: `translateY(${start}px)`,
15
- } }, { children: _jsxs(ListItemButton, Object.assign({ onClick: handleClick, dense: true, disableRipple: true }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] })) }), _jsx(ListItemText, { primary: token.symbol, secondary: token.name }), showBalance ? (_jsxs(Box, Object.assign({ sx: { textAlign: 'right' } }, { children: [_jsx(Typography, Object.assign({ variant: "body1", noWrap: true }, { children: (_a = token.amount) !== null && _a !== void 0 ? _a : '0' })), tokenPrice ? (_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", "data-price": token.priceUSD }, { children: t(`swap.currency`, {
14
+ } }, { children: _jsxs(ListItemButton, Object.assign({ onClick: handleClick, dense: true, disableRipple: true }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] })) }), _jsx(ListItemText, { primary: token.symbol, secondary: token.name }), showBalance ? (isBalanceLoading ? (_jsx(TokenAmountSkeleton, {})) : (_jsxs(Box, Object.assign({ sx: { textAlign: 'right' } }, { children: [Number(token.amount) ? (_jsx(Typography, Object.assign({ variant: "body1", noWrap: true }, { children: token.amount }))) : null, tokenPrice ? (_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", "data-price": token.priceUSD }, { children: t(`swap.currency`, {
16
15
  value: tokenPrice,
17
- }) }))) : null] }))) : null] })) })));
16
+ }) }))) : null] })))) : null] })) })));
18
17
  });
19
18
  export const TokenListItemSkeleton = ({ size, start, }) => {
20
- return (_jsxs(ListItem, Object.assign({ secondaryAction: _jsx(Skeleton, { variant: "text", width: 60, height: 24 }), disablePadding: true, style: {
19
+ return (_jsxs(ListItem, Object.assign({ secondaryAction: _jsx(TokenAmountSkeleton, {}), disablePadding: true, style: {
21
20
  height: `${size}px`,
22
21
  transform: `translateY(${start}px)`,
23
- } }, { children: [_jsx(ListItemAvatar, { children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32, sx: { marginLeft: 2, marginRight: 2 } }) }), _jsx(ListItemText, { primary: _jsx(Skeleton, { variant: "text", width: 48, height: 20 }), secondary: _jsx(Skeleton, { variant: "text", width: 128, height: 20 }) })] })));
22
+ } }, { children: [_jsx(ListItemAvatar, { children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32, sx: { marginLeft: 2, marginRight: 2 } }) }), _jsx(ListItemText, { primary: _jsx(Skeleton, { variant: "text", width: 48, height: 20 }), secondary: _jsx(Skeleton, { variant: "text", width: 96, height: 20 }) })] })));
23
+ };
24
+ export const TokenAmountSkeleton = () => {
25
+ return (_jsxs(Box, Object.assign({ sx: {
26
+ display: 'flex',
27
+ flexDirection: 'column',
28
+ alignItems: 'flex-end',
29
+ } }, { children: [_jsx(Skeleton, { variant: "text", width: 56, height: 24 }), _jsx(Skeleton, { variant: "text", width: 48, height: 18 })] })));
24
30
  };
@@ -13,4 +13,5 @@ export interface TokenListItemBaseProps {
13
13
  export interface TokenListItemProps extends TokenListItemBaseProps {
14
14
  showBalance?: boolean;
15
15
  token: TokenAmount;
16
+ isBalanceLoading?: boolean;
16
17
  }
@@ -1,2 +1,2 @@
1
- import { QueryClient } from 'react-query';
1
+ import { QueryClient } from '@tanstack/react-query';
2
2
  export declare const queryClient: QueryClient;
@@ -1,4 +1,4 @@
1
- import { QueryClient } from 'react-query';
1
+ import { QueryClient } from '@tanstack/react-query';
2
2
  export const queryClient = new QueryClient({
3
3
  defaultOptions: {
4
4
  queries: {
package/config/theme.js CHANGED
@@ -1,4 +1,6 @@
1
- import { alpha, createTheme as createMuiTheme, darken, lighten, } from '@mui/material/styles';
1
+ import { dialogActionsClasses } from '@mui/material/DialogActions';
2
+ import { alpha, createTheme as createMuiTheme, darken, getContrastRatio, lighten, } from '@mui/material/styles';
3
+ import { dark, light } from '@mui/material/styles/createPalette';
2
4
  const palette = {
3
5
  primary: {
4
6
  main: '#3F49E1',
@@ -23,8 +25,12 @@ const palette = {
23
25
  main: '#297EFF',
24
26
  },
25
27
  };
28
+ const shape = {
29
+ borderRadius: 12,
30
+ borderRadiusSecondary: 6,
31
+ };
26
32
  export const createTheme = (mode, theme = {}) => {
27
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
33
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
28
34
  return createMuiTheme({
29
35
  typography: Object.assign({ fontFamily: 'Inter var, Inter, sans-serif' }, theme.typography),
30
36
  palette: Object.assign(Object.assign(Object.assign({ mode }, palette), { primary: {
@@ -56,7 +62,7 @@ export const createTheme = (mode, theme = {}) => {
56
62
  paper: '#212121',
57
63
  },
58
64
  })),
59
- shape: Object.assign({ borderRadius: 12, borderRadiusSecondary: 6 }, theme.shape),
65
+ shape: Object.assign(Object.assign({}, shape), theme.shape),
60
66
  breakpoints: {
61
67
  values: {
62
68
  xs: 0,
@@ -73,6 +79,9 @@ export const createTheme = (mode, theme = {}) => {
73
79
  },
74
80
  },
75
81
  MuiButton: {
82
+ defaultProps: {
83
+ disableElevation: true,
84
+ },
76
85
  styleOverrides: Object.assign(Object.assign({}, (mode === 'dark'
77
86
  ? {
78
87
  outlined: {
@@ -92,10 +101,25 @@ export const createTheme = (mode, theme = {}) => {
92
101
  },
93
102
  }
94
103
  : {})), { root: {
104
+ borderRadius: (_v = (_u = theme.shape) === null || _u === void 0 ? void 0 : _u.borderRadiusSecondary) !== null && _v !== void 0 ? _v : shape.borderRadiusSecondary,
105
+ textTransform: 'none',
106
+ fontSize: '1rem',
107
+ padding: '10px 16px',
108
+ [`.${dialogActionsClasses.root} &`]: {
109
+ padding: '6px 12px',
110
+ },
95
111
  '&.Mui-disabled': {
96
112
  color: mode === 'light'
97
113
  ? 'rgb(0 0 0 / 70%)'
98
114
  : 'rgb(255 255 255 / 70%)',
115
+ cursor: 'not-allowed',
116
+ pointerEvents: 'auto',
117
+ },
118
+ }, contained: {
119
+ '&:hover': {
120
+ color: getContrastRatio(palette.primary.main, dark.text.primary) >= 3
121
+ ? dark.text.primary
122
+ : light.text.primary,
99
123
  },
100
124
  } }),
101
125
  },
@@ -103,6 +127,9 @@ export const createTheme = (mode, theme = {}) => {
103
127
  styleOverrides: {
104
128
  root: {
105
129
  color: 'inherit',
130
+ '&:hover': {
131
+ color: 'inherit',
132
+ },
106
133
  },
107
134
  },
108
135
  },
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "1.10.4";
2
+ export declare const version = "1.11.2";
package/config/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/widget';
2
- export const version = '1.10.4';
2
+ export const version = '1.11.2';