@lifi/widget 1.10.4 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.js +5 -9
- package/AppDrawer.js +1 -1
- package/AppDrawer.style.d.ts +1 -1
- package/AppDrawer.style.js +0 -1
- package/AppProvider.d.ts +1 -0
- package/AppProvider.js +5 -2
- package/components/AppContainer.d.ts +10 -0
- package/components/AppContainer.js +3 -6
- package/components/Card/Card.d.ts +11 -5
- package/components/Card/Card.js +29 -5
- package/components/Card/index.d.ts +0 -1
- package/components/Card/index.js +0 -1
- package/components/Dialog.d.ts +3 -0
- package/components/Dialog.js +23 -0
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.d.ts +6 -0
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +48 -0
- package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.d.ts → GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts} +0 -0
- package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.js → GasSufficiencyMessage/GasSufficiencyMessage.style.js} +1 -0
- package/components/GasSufficiencyMessage/index.d.ts +1 -0
- package/components/GasSufficiencyMessage/index.js +1 -0
- package/components/Header/Header.js +1 -1
- package/components/Header/Header.style.js +2 -1
- package/components/Header/NavigationHeader.js +15 -11
- package/components/Header/WalletHeader.js +1 -1
- package/components/Header/index.d.ts +1 -0
- package/components/Header/index.js +1 -0
- package/components/Header/types.d.ts +9 -0
- package/components/Header/types.js +1 -0
- package/components/Header/useHeaderActionStore.d.ts +6 -0
- package/components/Header/useHeaderActionStore.js +21 -0
- package/components/PoweredBy/PoweredBy.js +0 -1
- package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +14 -2
- package/components/ReverseTokensButton/ReverseTokensButton.js +5 -7
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/components/ReverseTokensButton/ReverseTokensButton.style.js +4 -2
- package/components/SelectTokenButton/SelectTokenButton.js +5 -5
- package/components/SelectTokenButton/SelectTokenButton.style.d.ts +3 -10
- package/components/SelectTokenButton/SelectTokenButton.style.js +0 -7
- package/components/SmallAvatar.d.ts +16 -0
- package/components/SmallAvatar.js +8 -0
- package/{pages/SwapPage → components/Step}/CircularProgress.d.ts +0 -0
- package/{pages/SwapPage → components/Step}/CircularProgress.js +0 -0
- package/{pages/SwapPage → components/Step}/CircularProgress.style.d.ts +0 -0
- package/{pages/SwapPage → components/Step}/CircularProgress.style.js +0 -0
- package/components/Step/Step.d.ts +7 -0
- package/{pages/SwapPage/StepItem.js → components/Step/Step.js} +6 -6
- package/{pages/SwapPage/ExecutionItem.d.ts → components/Step/StepProcess.d.ts} +1 -1
- package/{pages/SwapPage/ExecutionItem.js → components/Step/StepProcess.js} +2 -2
- package/{pages/SwapPage/ExecutionItem.style.d.ts → components/Step/StepProcess.style.d.ts} +1 -1
- package/{pages/SwapPage/ExecutionItem.style.js → components/Step/StepProcess.style.js} +0 -0
- package/{pages/SwapPage → components/Step}/StepTimer.d.ts +0 -0
- package/{pages/SwapPage → components/Step}/StepTimer.js +0 -0
- package/components/Step/index.d.ts +1 -0
- package/components/Step/index.js +1 -0
- package/components/Step/utils.d.ts +6 -0
- package/components/Step/utils.js +89 -0
- package/components/StepActions/StepActions.js +14 -5
- package/components/StepActions/StepActions.style.js +2 -2
- package/{pages/SwapPage → components/StepDivider}/StepDivider.d.ts +0 -0
- package/{pages/SwapPage → components/StepDivider}/StepDivider.js +0 -0
- package/{pages/SwapPage → components/StepDivider}/StepDivider.style.d.ts +0 -0
- package/{pages/SwapPage → components/StepDivider}/StepDivider.style.js +0 -0
- package/components/StepDivider/index.d.ts +1 -0
- package/components/StepDivider/index.js +1 -0
- package/components/SwapButton/SwapButton.js +7 -10
- package/components/SwapButton/SwapButton.style.d.ts +1 -1
- package/components/SwapButton/SwapButton.style.js +0 -4
- package/components/SwapButton/types.d.ts +2 -0
- package/components/SwapInProgress/SwapInProgress.js +7 -4
- package/components/SwapInProgress/SwapInProgress.style.d.ts +9 -21
- package/components/SwapInProgress/SwapInProgress.style.js +5 -6
- package/components/SwapInput/SwapInput.js +3 -3
- package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.style.js +0 -2
- package/components/SwapRouteCard/SwapRouteCard.js +15 -15
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +0 -20
- package/components/SwapRouteCard/SwapRouteCard.style.js +7 -54
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +6 -10
- package/components/SwapRouteCard/SwapRouteNotFoundCard.js +3 -3
- package/components/SwapRouteCard/types.d.ts +0 -3
- package/components/{StepToken.d.ts → Token/Token.d.ts} +2 -1
- package/components/Token/Token.js +31 -0
- package/components/Token/Token.style.d.ts +24 -0
- package/components/Token/Token.style.js +31 -0
- package/components/Token/index.d.ts +2 -0
- package/components/Token/index.js +2 -0
- package/components/TokenAvatar/TokenAvatar.d.ts +7 -0
- package/components/TokenAvatar/TokenAvatar.js +8 -0
- package/components/TokenAvatar/TokenAvatar.style.d.ts +1 -0
- package/components/TokenAvatar/TokenAvatar.style.js +16 -0
- package/components/TokenAvatar/index.d.ts +2 -0
- package/components/TokenAvatar/index.js +2 -0
- package/components/TokenList/TokenList.js +2 -2
- package/components/TokenList/TokenListItem.d.ts +1 -0
- package/components/TokenList/TokenListItem.js +12 -6
- package/components/TokenList/types.d.ts +1 -0
- package/config/queryClient.d.ts +1 -1
- package/config/queryClient.js +1 -1
- package/config/theme.js +14 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +1 -1
- package/hooks/index.js +1 -1
- package/hooks/useChains.d.ts +8 -8
- package/hooks/useChains.js +1 -1
- package/hooks/useGasSufficiency.d.ts +15 -0
- package/hooks/useGasSufficiency.js +91 -0
- package/hooks/useRouteExecution.d.ts +3 -3
- package/hooks/useRouteExecution.js +22 -18
- package/hooks/useSwapRoutes.d.ts +1 -1
- package/hooks/useSwapRoutes.js +2 -14
- package/hooks/useTokenBalance.js +1 -1
- package/hooks/useTokenBalances.d.ts +2 -2
- package/hooks/useTokenBalances.js +7 -9
- package/hooks/useTokens.js +1 -1
- package/hooks/useTools.d.ts +10 -1
- package/hooks/useTools.js +13 -3
- package/i18n/en/translation.json +18 -9
- package/i18n/index.d.ts +12 -3
- package/icons/LiFiToolLogo.svg +6 -0
- package/package.json +8 -8
- package/pages/MainPage/MainPage.js +2 -3
- package/pages/MainPage/MainSwapButton.js +4 -5
- package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.d.ts +0 -0
- package/pages/MainPage/SwapRoutes.js +36 -0
- package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.d.ts +0 -0
- package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.js +4 -0
- package/pages/SelectTokenPage/ChainSelect.js +2 -2
- package/pages/SelectTokenPage/SearchTokenInput.js +2 -2
- package/pages/SelectWalletPage/SelectWalletPage.js +4 -23
- package/pages/SettingsPage/AdvancedPreferences.js +1 -1
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/EnabledBridgesSelect.js +7 -4
- package/pages/SettingsPage/EnabledExchangesSelect.js +7 -4
- package/pages/SettingsPage/GasPriceSelect.js +2 -2
- package/pages/SettingsPage/RoutePrioritySelect.js +2 -2
- package/pages/SettingsPage/SlippageInput.js +2 -2
- package/pages/SwapDetailsPage/SwapDetailsPage.d.ts +2 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.js +63 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +11 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.style.js +5 -0
- package/pages/SwapDetailsPage/index.d.ts +1 -0
- package/pages/SwapDetailsPage/index.js +1 -0
- package/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +2 -0
- package/pages/SwapHistoryPage/SwapHistoryEmpty.js +14 -0
- package/pages/SwapHistoryPage/SwapHistoryItem.d.ts +5 -0
- package/pages/SwapHistoryPage/SwapHistoryItem.js +23 -0
- package/pages/SwapHistoryPage/SwapHistoryPage.d.ts +2 -0
- package/pages/SwapHistoryPage/SwapHistoryPage.js +14 -0
- package/pages/SwapHistoryPage/index.d.ts +1 -0
- package/pages/SwapHistoryPage/index.js +1 -0
- package/pages/SwapPage/StatusBottomSheet.js +3 -4
- package/pages/SwapPage/SwapPage.js +9 -9
- package/pages/SwapPage/SwapPage.style.d.ts +0 -33
- package/pages/SwapPage/SwapPage.style.js +2 -9
- package/pages/SwapRoutesPage/SwapRoutesPage.js +9 -5
- package/pages/SwapRoutesPage/SwapRoutesPage.style.js +1 -1
- package/providers/WalletProvider/WalletProvider.js +7 -26
- package/providers/WalletProvider/types.d.ts +0 -1
- package/providers/WidgetProvider/WidgetProvider.js +1 -1
- package/stores/route/index.d.ts +1 -1
- package/stores/route/index.js +1 -1
- package/stores/route/types.d.ts +2 -4
- package/stores/route/useExecutingRoutes.d.ts +2 -1
- package/stores/route/useExecutingRoutes.js +4 -2
- package/stores/route/useRouteStore.d.ts +4 -1
- package/stores/route/useRouteStore.js +23 -24
- package/stores/route/useSwapHistory.d.ts +2 -0
- package/stores/route/useSwapHistory.js +11 -0
- package/stores/settings/useSettingsStore.d.ts +13 -0
- package/types/widget.d.ts +3 -4
- package/utils/navigationRoutes.d.ts +2 -0
- package/utils/navigationRoutes.js +8 -6
- package/components/Card/CardContainer.d.ts +0 -11
- package/components/Card/CardContainer.js +0 -16
- package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.d.ts +0 -3
- package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.js +0 -31
- package/components/InsufficientGasOrFundsMessage/index.d.ts +0 -1
- package/components/InsufficientGasOrFundsMessage/index.js +0 -1
- package/components/StepToken.js +0 -21
- package/components/SwapRoutes/SwapRoutes.js +0 -32
- package/components/SwapRoutes/SwapRoutesUpdateProgress.d.ts +0 -3
- package/components/SwapRoutes/SwapRoutesUpdateProgress.js +0 -24
- package/components/SwapRoutes/index.d.ts +0 -1
- package/components/SwapRoutes/index.js +0 -1
- package/hooks/useHasSufficientBalance.d.ts +0 -5
- package/hooks/useHasSufficientBalance.js +0 -72
- package/pages/SwapPage/StepItem.d.ts +0 -7
- package/stores/route/useCurrentRoute.d.ts +0 -2
- package/stores/route/useCurrentRoute.js +0 -5
|
@@ -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" | "
|
|
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 {
|
|
18
|
-
import {
|
|
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 (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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 {
|
|
2
|
-
import {
|
|
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.
|
|
45
|
-
: theme.palette.grey[
|
|
46
|
-
borderRadius: theme.shape.
|
|
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 '
|
|
14
|
+
import { Card } from '../Card';
|
|
15
15
|
export const SwapRouteCardSkeleton = (_a) => {
|
|
16
|
-
var {
|
|
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:
|
|
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:
|
|
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:
|
|
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 '
|
|
16
|
+
import { Card } from '../Card';
|
|
17
17
|
export const SwapRouteNotFoundCard = (_a) => {
|
|
18
|
-
var {
|
|
18
|
+
var { dense } = _a, other = __rest(_a, ["dense"]);
|
|
19
19
|
const { t } = useTranslation();
|
|
20
|
-
return (_jsx(Card, Object.assign({
|
|
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',
|
|
@@ -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
|
|
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,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
|
+
}));
|
|
@@ -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
|
};
|
|
@@ -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:
|
|
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(
|
|
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:
|
|
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
|
};
|
package/config/queryClient.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryClient } from 'react-query';
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
2
2
|
export declare const queryClient: QueryClient;
|
package/config/queryClient.js
CHANGED
package/config/theme.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { dialogActionsClasses } from '@mui/material/DialogActions';
|
|
1
2
|
import { alpha, createTheme as createMuiTheme, darken, lighten, } from '@mui/material/styles';
|
|
2
3
|
const palette = {
|
|
3
4
|
primary: {
|
|
@@ -24,7 +25,7 @@ const palette = {
|
|
|
24
25
|
},
|
|
25
26
|
};
|
|
26
27
|
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;
|
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
28
29
|
return createMuiTheme({
|
|
29
30
|
typography: Object.assign({ fontFamily: 'Inter var, Inter, sans-serif' }, theme.typography),
|
|
30
31
|
palette: Object.assign(Object.assign(Object.assign({ mode }, palette), { primary: {
|
|
@@ -73,6 +74,9 @@ export const createTheme = (mode, theme = {}) => {
|
|
|
73
74
|
},
|
|
74
75
|
},
|
|
75
76
|
MuiButton: {
|
|
77
|
+
defaultProps: {
|
|
78
|
+
disableElevation: true,
|
|
79
|
+
},
|
|
76
80
|
styleOverrides: Object.assign(Object.assign({}, (mode === 'dark'
|
|
77
81
|
? {
|
|
78
82
|
outlined: {
|
|
@@ -92,10 +96,19 @@ export const createTheme = (mode, theme = {}) => {
|
|
|
92
96
|
},
|
|
93
97
|
}
|
|
94
98
|
: {})), { root: {
|
|
99
|
+
borderRadius: (_u = theme.shape) === null || _u === void 0 ? void 0 : _u.borderRadiusSecondary,
|
|
100
|
+
textTransform: 'none',
|
|
101
|
+
fontSize: '1rem',
|
|
102
|
+
padding: '10px 16px',
|
|
103
|
+
[`.${dialogActionsClasses.root} &`]: {
|
|
104
|
+
padding: '6px 12px',
|
|
105
|
+
},
|
|
95
106
|
'&.Mui-disabled': {
|
|
96
107
|
color: mode === 'light'
|
|
97
108
|
? 'rgb(0 0 0 / 70%)'
|
|
98
109
|
: 'rgb(255 255 255 / 70%)',
|
|
110
|
+
cursor: 'not-allowed',
|
|
111
|
+
pointerEvents: 'auto',
|
|
99
112
|
},
|
|
100
113
|
} }),
|
|
101
114
|
},
|
package/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "1.
|
|
2
|
+
export declare const version = "1.11.0";
|
package/config/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '1.
|
|
2
|
+
export const version = '1.11.0';
|
package/hooks/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export * from './useChain';
|
|
|
2
2
|
export * from './useChains';
|
|
3
3
|
export * from './useContentHeight';
|
|
4
4
|
export * from './useDebouncedWatch';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './useGasSufficiency';
|
|
6
6
|
export * from './useRouteExecution';
|
|
7
7
|
export * from './useScrollableContainer';
|
|
8
8
|
export * from './useSwapRoutes';
|
package/hooks/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export * from './useChain';
|
|
|
2
2
|
export * from './useChains';
|
|
3
3
|
export * from './useContentHeight';
|
|
4
4
|
export * from './useDebouncedWatch';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './useGasSufficiency';
|
|
6
6
|
export * from './useRouteExecution';
|
|
7
7
|
export * from './useScrollableContainer';
|
|
8
8
|
export * from './useSwapRoutes';
|