@lifi/widget 1.26.4 → 1.27.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 +15 -2
- package/AppDrawer.d.ts +4 -2
- package/AppDrawer.style.d.ts +2 -2
- package/cjs/App.js +14 -1
- package/cjs/AppDrawer.d.ts +4 -2
- package/cjs/AppDrawer.style.d.ts +2 -2
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
- package/cjs/components/Card/Card.d.ts +1 -1
- package/cjs/components/Card/CardTitle.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.style.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.style.js +1 -1
- package/cjs/components/Header/Header.style.d.ts +2 -2
- package/cjs/components/Menu.js +1 -1
- package/cjs/components/PoweredBy/PoweredBy.js +5 -2
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +1 -1
- package/cjs/components/SendToWallet/SendToWallet.js +20 -6
- package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/cjs/components/SendToWallet/SendToWallet.style.js +6 -0
- package/cjs/components/SendToWallet/SendToWalletButton.js +5 -6
- package/cjs/components/SmallAvatar.d.ts +20 -0
- package/cjs/components/SmallAvatar.js +15 -1
- package/cjs/components/Step/StepProcess.style.d.ts +1 -1
- package/cjs/components/SwapButton/SwapButton.d.ts +1 -1
- package/cjs/components/SwapButton/SwapButton.js +4 -6
- package/cjs/components/SwapButton/index.d.ts +1 -0
- package/cjs/components/SwapButton/index.js +15 -0
- package/cjs/components/SwapButton/types.d.ts +1 -2
- package/cjs/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInput.style.js +1 -0
- package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInputStartAdornment.js +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +2 -2
- package/cjs/components/Token/Token.d.ts +3 -0
- package/cjs/components/Token/Token.js +16 -2
- package/cjs/components/Token/Token.style.d.ts +1 -1
- package/cjs/components/TokenAvatar/TokenAvatar.d.ts +2 -1
- package/cjs/components/TokenAvatar/TokenAvatar.js +8 -8
- package/cjs/components/TokenAvatar/TokenAvatar.style.d.ts +2 -2
- package/cjs/components/TokenAvatar/TokenAvatar.style.js +3 -3
- package/cjs/components/TokenList/VirtualizedTokenList.js +1 -1
- package/cjs/config/theme.js +2 -2
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/i18n/de.json +30 -6
- package/cjs/i18n/fr.json +30 -6
- package/cjs/i18n/it.json +30 -6
- package/cjs/i18n/uk.json +38 -20
- package/cjs/i18n/zh.json +30 -6
- package/cjs/index.d.ts +3 -1
- package/cjs/pages/MainPage/MainSwapButton.js +4 -4
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +3 -2
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/LanguageSelect.js +3 -2
- package/cjs/pages/SettingsPage/ShowDestinationWallet.js +4 -2
- package/cjs/pages/SwapPage/StartSwapButton.d.ts +3 -0
- package/cjs/pages/SwapPage/StartSwapButton.js +11 -0
- package/cjs/pages/SwapPage/SwapPage.js +2 -4
- package/cjs/stores/routes/useRouteExecutionStore.js +13 -1
- package/cjs/stores/settings/index.d.ts +1 -0
- package/cjs/stores/settings/index.js +1 -0
- package/cjs/stores/settings/types.d.ts +8 -0
- package/cjs/{components/SendToWallet/store.d.ts → stores/settings/useSendToWalletStore.d.ts} +0 -0
- package/cjs/stores/settings/useSendToWalletStore.js +16 -0
- package/cjs/types/widget.d.ts +31 -8
- package/cjs/types/widget.js +10 -3
- package/components/ActiveSwaps/ActiveSwapItem.js +1 -1
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
- package/components/Card/Card.d.ts +1 -1
- package/components/Card/CardTitle.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.style.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.style.js +1 -1
- package/components/Header/Header.style.d.ts +2 -2
- package/components/Header/WalletHeader.js +1 -1
- package/components/Menu.js +1 -1
- package/components/PoweredBy/PoweredBy.js +5 -2
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/components/SelectTokenButton/SelectTokenButton.js +2 -2
- package/components/SendToWallet/SendToWallet.js +21 -7
- package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/components/SendToWallet/SendToWallet.style.js +6 -0
- package/components/SendToWallet/SendToWalletButton.js +7 -8
- package/components/SmallAvatar.d.ts +20 -0
- package/components/SmallAvatar.js +14 -1
- package/components/Step/StepProcess.style.d.ts +1 -1
- package/components/SwapButton/SwapButton.d.ts +1 -1
- package/components/SwapButton/SwapButton.js +3 -6
- package/components/SwapButton/index.d.ts +1 -0
- package/components/SwapButton/index.js +1 -0
- package/components/SwapButton/types.d.ts +1 -2
- package/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/components/SwapInput/SwapInput.style.js +1 -0
- package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/components/SwapInput/SwapInputStartAdornment.js +2 -2
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +2 -2
- package/components/Token/Token.d.ts +3 -0
- package/components/Token/Token.js +13 -1
- package/components/Token/Token.style.d.ts +1 -1
- package/components/TokenAvatar/TokenAvatar.d.ts +2 -1
- package/components/TokenAvatar/TokenAvatar.js +9 -9
- package/components/TokenAvatar/TokenAvatar.style.d.ts +2 -2
- package/components/TokenAvatar/TokenAvatar.style.js +2 -2
- package/components/TokenList/VirtualizedTokenList.js +1 -1
- package/config/theme.js +2 -2
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useRouteExecution.js +1 -1
- package/i18n/de.json +30 -6
- package/i18n/fr.json +30 -6
- package/i18n/it.json +30 -6
- package/i18n/uk.json +38 -20
- package/i18n/zh.json +30 -6
- package/index.d.ts +3 -1
- package/package.json +14 -14
- package/pages/MainPage/MainSwapButton.js +3 -4
- package/pages/SettingsPage/ColorSchemeButtonGroup.js +3 -2
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/LanguageSelect.js +3 -2
- package/pages/SettingsPage/ShowDestinationWallet.js +6 -4
- package/pages/SwapPage/StartSwapButton.d.ts +3 -0
- package/pages/SwapPage/StartSwapButton.js +7 -0
- package/pages/SwapPage/SwapPage.js +2 -4
- package/stores/routes/useRouteExecutionStore.js +13 -1
- package/stores/settings/index.d.ts +1 -0
- package/stores/settings/index.js +1 -0
- package/stores/settings/types.d.ts +8 -0
- package/{components/SendToWallet/store.d.ts → stores/settings/useSendToWalletStore.d.ts} +0 -0
- package/stores/settings/useSendToWalletStore.js +13 -0
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +31 -8
- package/types/widget.js +9 -2
- package/cjs/components/SendToWallet/store.js +0 -12
- package/cjs/components/SendToWallet/types.d.ts +0 -6
- package/cjs/components/SendToWallet/types.js +0 -2
- package/components/SendToWallet/store.js +0 -9
- package/components/SendToWallet/types.d.ts +0 -6
- package/components/SendToWallet/types.js +0 -1
|
@@ -8,7 +8,7 @@ export declare const ChainCard: import("@emotion/styled").StyledComponent<import
|
|
|
8
8
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
9
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
10
|
variant?: ("default" | "error" | "selected") | undefined;
|
|
11
|
-
selectionColor?: "
|
|
11
|
+
selectionColor?: "secondary" | "primary" | undefined;
|
|
12
12
|
dense?: boolean | undefined;
|
|
13
13
|
indented?: boolean | undefined;
|
|
14
14
|
onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
@@ -9,7 +9,7 @@ export const ChainCard = styled(Card)({
|
|
|
9
9
|
});
|
|
10
10
|
export const ChainContainer = styled(Box)(({ theme }) => ({
|
|
11
11
|
display: 'grid',
|
|
12
|
-
gridTemplateColumns: 'repeat(
|
|
12
|
+
gridTemplateColumns: 'repeat(5, 1fr)',
|
|
13
13
|
gridAutoRows: '56px',
|
|
14
14
|
justifyContent: 'space-between',
|
|
15
15
|
gap: theme.spacing(1.5),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const HeaderAppBar: import("@emotion/styled").StyledComponent<Omit<import("@mui/material").PaperProps<"div", {}>, "classes" | "color" | "position"> & {
|
|
3
3
|
classes?: Partial<import("@mui/material").AppBarClasses> | undefined;
|
|
4
|
-
color?: "inherit" | "transparent" | "default" | "
|
|
4
|
+
color?: "inherit" | "transparent" | "default" | "secondary" | "primary" | undefined;
|
|
5
5
|
enableColorOnDark?: boolean | undefined;
|
|
6
6
|
position?: "fixed" | "absolute" | "relative" | "static" | "sticky" | undefined;
|
|
7
7
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
@@ -21,7 +21,7 @@ export declare const Container: import("@emotion/styled").StyledComponent<import
|
|
|
21
21
|
export declare const WalletButton: import("@emotion/styled").StyledComponent<{
|
|
22
22
|
children?: import("react").ReactNode;
|
|
23
23
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
24
|
-
color?: "inherit" | "success" | "warning" | "error" | "
|
|
24
|
+
color?: "inherit" | "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
|
|
25
25
|
disabled?: boolean | undefined;
|
|
26
26
|
disableElevation?: boolean | undefined;
|
|
27
27
|
disableFocusRipple?: boolean | undefined;
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
-
import { ContentCopy as ContentCopyIcon, ExpandMore as ExpandMoreIcon, PowerSettingsNewRounded as PowerSettingsIcon, WalletOutlined as WalletOutlinedIcon } from '@mui/icons-material';
|
|
11
|
+
import { ContentCopy as ContentCopyIcon, ExpandMore as ExpandMoreIcon, PowerSettingsNewRounded as PowerSettingsIcon, WalletOutlined as WalletOutlinedIcon, } from '@mui/icons-material';
|
|
12
12
|
import { Avatar, MenuItem } from '@mui/material';
|
|
13
13
|
import { useState } from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
package/components/Menu.js
CHANGED
|
@@ -5,7 +5,7 @@ import { styled } from '@mui/material/styles';
|
|
|
5
5
|
import { svgIconClasses } from '@mui/material/SvgIcon';
|
|
6
6
|
export const Menu = styled(MuiMenu)(({ theme }) => ({
|
|
7
7
|
[`& .${menuClasses.paper}`]: {
|
|
8
|
-
borderRadius: theme.shape.
|
|
8
|
+
borderRadius: theme.shape.borderRadius,
|
|
9
9
|
color: theme.palette.text.primary,
|
|
10
10
|
[`& .${menuClasses.list}`]: {
|
|
11
11
|
padding: theme.spacing(0.5, 0),
|
|
@@ -2,18 +2,21 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box, Tooltip, Typography } from '@mui/material';
|
|
3
3
|
import { useLocation } from 'react-router-dom';
|
|
4
4
|
import { version } from '../../config/version';
|
|
5
|
+
import { useWidgetConfig } from '../../providers';
|
|
6
|
+
import { HiddenUI } from '../../types';
|
|
5
7
|
import { navigationRoutes } from '../../utils';
|
|
6
8
|
import { LiFiLogo } from '../LiFiLogo';
|
|
7
9
|
import { Link } from './PoweredBy.style';
|
|
8
10
|
export const PoweredBy = () => {
|
|
11
|
+
const { hiddenUI } = useWidgetConfig();
|
|
9
12
|
const { pathname } = useLocation();
|
|
10
13
|
if (pathname.includes(navigationRoutes.fromToken) ||
|
|
11
14
|
pathname.includes(navigationRoutes.toToken)) {
|
|
12
15
|
return null;
|
|
13
16
|
}
|
|
14
|
-
return (_jsx(Box, Object.assign({ px: 3,
|
|
17
|
+
return (_jsx(Box, Object.assign({ px: 3, py: (hiddenUI === null || hiddenUI === void 0 ? void 0 : hiddenUI.includes(HiddenUI.PoweredBy)) ? 1 : 2, sx: {
|
|
15
18
|
display: 'flex',
|
|
16
19
|
alignItems: 'flex-end',
|
|
17
20
|
justifyContent: 'flex-end',
|
|
18
|
-
} }, { children: _jsx(Tooltip, Object.assign({ title: `v${version}`, placement: "top", enterDelay: 3000, arrow: true }, { children: _jsxs(Link, Object.assign({ href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary" }, { children: [_jsx(Typography, Object.assign({ color: "text.secondary", fontSize: 12, px: 0.5 }, { children: "Powered by" })), _jsx(LiFiLogo, { variant: "full", style: { height: 16, width: 42 } })] })) })) })));
|
|
21
|
+
} }, { children: !(hiddenUI === null || hiddenUI === void 0 ? void 0 : hiddenUI.includes(HiddenUI.PoweredBy)) ? (_jsx(Tooltip, Object.assign({ title: `v${version}`, placement: "top", enterDelay: 3000, arrow: true }, { children: _jsxs(Link, Object.assign({ href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary" }, { children: [_jsx(Typography, Object.assign({ color: "text.secondary", fontSize: 12, px: 0.5 }, { children: "Powered by" })), _jsx(LiFiLogo, { variant: "full", style: { height: 16, width: 42 } })] })) }))) : null })));
|
|
19
22
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const IconButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "default" | "success" | "warning" | "error" | "
|
|
5
|
+
color?: "inherit" | "default" | "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
edge?: false | "end" | "start" | undefined;
|
|
@@ -7,7 +7,7 @@ import { useChain, useToken } from '../../hooks';
|
|
|
7
7
|
import { SwapFormKeyHelper, useWidgetConfig } from '../../providers';
|
|
8
8
|
import { navigationRoutes } from '../../utils';
|
|
9
9
|
import { Card, CardTitle } from '../Card';
|
|
10
|
-
import { TokenAvatar,
|
|
10
|
+
import { TokenAvatar, TokenAvatarDefault } from '../TokenAvatar';
|
|
11
11
|
import { SelectTokenCardHeader } from './SelectTokenButton.style';
|
|
12
12
|
export const SelectTokenButton = ({ formType, compact }) => {
|
|
13
13
|
const { t } = useTranslation();
|
|
@@ -31,5 +31,5 @@ export const SelectTokenButton = ({ formType, compact }) => {
|
|
|
31
31
|
const defaultTitle = formType === 'to' && variant === 'refuel'
|
|
32
32
|
? t(`header.selectChain`)
|
|
33
33
|
: t(`swap.selectChainAndToken`);
|
|
34
|
-
return (_jsxs(Card, Object.assign({ flex: 1, onClick: onClick }, { children: [_jsx(CardTitle, { children: t(`swap.${formType}`) }), chainId && tokenAddress && (isChainLoading || isTokenLoading) ? (_jsx(SelectTokenCardHeader, { avatar: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }), title: _jsx(Skeleton, { variant: "text", width: 64, height: 24 }), subheader: _jsx(Skeleton, { variant: "text", width: 64, height: 16 }), compact: compact })) : (_jsx(SelectTokenCardHeader, { avatar: isSelected ? (_jsx(TokenAvatar, { token: token, chain: chain })) : (_jsx(
|
|
34
|
+
return (_jsxs(Card, Object.assign({ flex: 1, onClick: onClick }, { children: [_jsx(CardTitle, { children: t(`swap.${formType}`) }), chainId && tokenAddress && (isChainLoading || isTokenLoading) ? (_jsx(SelectTokenCardHeader, { avatar: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }), title: _jsx(Skeleton, { variant: "text", width: 64, height: 24 }), subheader: _jsx(Skeleton, { variant: "text", width: 64, height: 16 }), compact: compact })) : (_jsx(SelectTokenCardHeader, { avatar: isSelected ? (_jsx(TokenAvatar, { token: token, chain: chain })) : (_jsx(TokenAvatarDefault, {})), title: isSelected ? token.symbol : defaultTitle, subheader: isSelected ? t(`swap.onChain`, { chainName: chain.name }) : null, selected: isSelected, compact: compact }))] })));
|
|
35
35
|
};
|
|
@@ -14,20 +14,34 @@ import { forwardRef, useEffect } from 'react';
|
|
|
14
14
|
import { useFormContext, useFormState } from 'react-hook-form';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { SwapFormKey, useWallet, useWidgetConfig } from '../../providers';
|
|
17
|
-
import {
|
|
17
|
+
import { useSendToWalletStore, useSettings } from '../../stores';
|
|
18
|
+
import { DisabledUI, HiddenUI } from '../../types';
|
|
18
19
|
import { Card, CardTitle } from '../Card';
|
|
19
20
|
import { FormControl, Input } from './SendToWallet.style';
|
|
20
|
-
import { useSendToWalletStore } from './store';
|
|
21
21
|
export const SendToWallet = forwardRef((props, ref) => {
|
|
22
22
|
const { t } = useTranslation();
|
|
23
|
-
const { disabledUI } = useWidgetConfig();
|
|
24
|
-
const showSendToWallet = useSendToWalletStore((state) => state.showSendToWallet);
|
|
25
|
-
const { account, provider } = useWallet();
|
|
26
23
|
const { register, trigger } = useFormContext();
|
|
24
|
+
const { account, provider } = useWallet();
|
|
25
|
+
const { disabledUI, hiddenUI, toAddress } = useWidgetConfig();
|
|
26
|
+
const { showSendToWallet, showSendToWalletDirty, setSendToWallet } = useSendToWalletStore();
|
|
27
|
+
const { showDestinationWallet } = useSettings(['showDestinationWallet']);
|
|
27
28
|
useEffect(() => {
|
|
28
29
|
trigger(SwapFormKey.ToAddress);
|
|
29
30
|
}, [account.chainId, trigger]);
|
|
30
|
-
|
|
31
|
+
const hiddenToAddress = hiddenUI === null || hiddenUI === void 0 ? void 0 : hiddenUI.includes(HiddenUI.ToAddress);
|
|
32
|
+
const disabledToAddress = disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(DisabledUI.ToAddress);
|
|
33
|
+
// We want to show toAddress field if it is set via widget configuration, disabled for changes, but not hidden
|
|
34
|
+
const showInstantly = Boolean(!showSendToWalletDirty &&
|
|
35
|
+
toAddress &&
|
|
36
|
+
disabledToAddress &&
|
|
37
|
+
showDestinationWallet &&
|
|
38
|
+
!hiddenToAddress);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (showInstantly) {
|
|
41
|
+
setSendToWallet(true);
|
|
42
|
+
}
|
|
43
|
+
}, [showInstantly, setSendToWallet]);
|
|
44
|
+
if (hiddenToAddress) {
|
|
31
45
|
return null;
|
|
32
46
|
}
|
|
33
47
|
const { onChange, onBlur, name, ref: inputRef, } = register(SwapFormKey.ToAddress, {
|
|
@@ -46,7 +60,7 @@ export const SendToWallet = forwardRef((props, ref) => {
|
|
|
46
60
|
}),
|
|
47
61
|
onBlur: () => trigger(SwapFormKey.ToAddress),
|
|
48
62
|
});
|
|
49
|
-
return (_jsx(Collapse, Object.assign({ timeout: 225, in: showSendToWallet, mountOnEnter: true, unmountOnExit: true }, { children: _jsxs(Card, Object.assign({}, props, { ref: ref }, { children: [_jsx(CardTitle, { children: t('swap.sendToWallet') }), _jsxs(FormControl, Object.assign({ fullWidth: true, sx: { paddingTop: '6px', paddingBottom: '5px' } }, { children: [_jsx(Input, { ref: inputRef, size: "small", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", onChange: onChange, onBlur: onBlur, name: name, placeholder: t('swap.walletAddressOrEns') }), _jsx(SendToWalletFormHelperText, {})] }))] })) })));
|
|
63
|
+
return (_jsx(Collapse, Object.assign({ timeout: showInstantly ? 0 : 225, in: showSendToWallet || showInstantly, mountOnEnter: true, unmountOnExit: true }, { children: _jsxs(Card, Object.assign({}, props, { ref: ref }, { children: [_jsx(CardTitle, { children: t('swap.sendToWallet') }), _jsxs(FormControl, Object.assign({ fullWidth: true, sx: { paddingTop: '6px', paddingBottom: '5px' } }, { children: [_jsx(Input, { ref: inputRef, size: "small", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", onChange: onChange, onBlur: onBlur, name: name, placeholder: t('swap.walletAddressOrEns'), disabled: Boolean(toAddress && disabledToAddress) }), _jsx(SendToWalletFormHelperText, {})] }))] })) })));
|
|
50
64
|
});
|
|
51
65
|
export const SendToWalletFormHelperText = () => {
|
|
52
66
|
var _a;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const FormControl: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
|
|
5
|
-
color?: "success" | "warning" | "error" | "
|
|
5
|
+
color?: "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
error?: boolean | undefined;
|
|
8
8
|
fullWidth?: boolean | undefined;
|
|
@@ -9,4 +9,10 @@ export const Input = styled(InputBase)(({ theme }) => ({
|
|
|
9
9
|
height: 32,
|
|
10
10
|
padding: theme.spacing(0, 0, 0, 2),
|
|
11
11
|
},
|
|
12
|
+
[`&.${inputBaseClasses.disabled}`]: {
|
|
13
|
+
color: 'inherit',
|
|
14
|
+
},
|
|
15
|
+
[`.${inputBaseClasses.input}.${inputBaseClasses.disabled}`]: {
|
|
16
|
+
WebkitTextFillColor: 'unset',
|
|
17
|
+
},
|
|
12
18
|
}));
|
|
@@ -4,23 +4,22 @@ import { Button, Tooltip } from '@mui/material';
|
|
|
4
4
|
import { useFormContext } from 'react-hook-form';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { SwapFormKey, useWallet, useWidgetConfig } from '../../providers';
|
|
7
|
-
import { useSettings } from '../../stores';
|
|
8
|
-
import { DisabledUI } from '../../types';
|
|
9
|
-
import { useSendToWalletStore } from './store';
|
|
7
|
+
import { useSendToWalletStore, useSettings } from '../../stores';
|
|
8
|
+
import { DisabledUI, HiddenUI } from '../../types';
|
|
10
9
|
export const SendToWalletButton = () => {
|
|
11
10
|
const { t } = useTranslation();
|
|
12
|
-
const { disabledUI } = useWidgetConfig();
|
|
13
|
-
const { account } = useWallet();
|
|
14
11
|
const { setValue } = useFormContext();
|
|
15
|
-
const {
|
|
12
|
+
const { account } = useWallet();
|
|
13
|
+
const { disabledUI, hiddenUI } = useWidgetConfig();
|
|
16
14
|
const { showSendToWallet, toggleSendToWallet } = useSendToWalletStore();
|
|
15
|
+
const { showDestinationWallet } = useSettings(['showDestinationWallet']);
|
|
17
16
|
if (!showDestinationWallet ||
|
|
18
17
|
!account.isActive ||
|
|
19
|
-
(
|
|
18
|
+
(hiddenUI === null || hiddenUI === void 0 ? void 0 : hiddenUI.includes(HiddenUI.ToAddress))) {
|
|
20
19
|
return null;
|
|
21
20
|
}
|
|
22
21
|
const handleClick = () => {
|
|
23
|
-
if (showSendToWallet) {
|
|
22
|
+
if (showSendToWallet && !(disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(DisabledUI.ToAddress))) {
|
|
24
23
|
setValue(SwapFormKey.ToAddress, '', { shouldTouch: true });
|
|
25
24
|
}
|
|
26
25
|
toggleSendToWallet();
|
|
@@ -14,3 +14,23 @@ export declare const SmallAvatar: import("@emotion/styled").StyledComponent<{
|
|
|
14
14
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
15
15
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
16
16
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "alt" | "src" | "sizes" | "srcSet" | "imgProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
17
|
+
export declare const SmallAvatarSkeletonBase: import("@emotion/styled").StyledComponent<{
|
|
18
|
+
animation?: false | "pulse" | "wave" | undefined;
|
|
19
|
+
children?: import("react").ReactNode;
|
|
20
|
+
classes?: Partial<import("@mui/material").SkeletonClasses> | undefined;
|
|
21
|
+
height?: string | number | undefined;
|
|
22
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
23
|
+
variant?: "text" | "circular" | "rounded" | "rectangular" | undefined;
|
|
24
|
+
width?: string | number | undefined;
|
|
25
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof import("react").HTMLAttributes<HTMLSpanElement>> & {
|
|
26
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
27
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "height" | "width" | "animation" | "variant"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
28
|
+
export declare const SmallAvatarSkeletonContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
29
|
+
children?: import("react").ReactNode;
|
|
30
|
+
component?: import("react").ElementType<any> | undefined;
|
|
31
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
32
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
33
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
34
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
35
|
+
}, 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>, {}, {}>;
|
|
36
|
+
export declare const SmallAvatarSkeleton: () => JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar, Box, Skeleton } from '@mui/material';
|
|
2
3
|
import { styled } from '@mui/material/styles';
|
|
3
4
|
export const SmallAvatar = styled(Avatar)(({ theme }) => ({
|
|
4
5
|
background: theme.palette.background.paper,
|
|
@@ -6,3 +7,15 @@ export const SmallAvatar = styled(Avatar)(({ theme }) => ({
|
|
|
6
7
|
height: 16,
|
|
7
8
|
border: `2px solid ${theme.palette.background.paper}`,
|
|
8
9
|
}));
|
|
10
|
+
export const SmallAvatarSkeletonBase = styled(Skeleton)(({ theme }) => ({
|
|
11
|
+
border: `2px solid ${theme.palette.background.paper}`,
|
|
12
|
+
width: 16,
|
|
13
|
+
height: 16,
|
|
14
|
+
}));
|
|
15
|
+
export const SmallAvatarSkeletonContainer = styled(Box)(({ theme }) => ({
|
|
16
|
+
background: theme.palette.background.paper,
|
|
17
|
+
borderRadius: '50%',
|
|
18
|
+
}));
|
|
19
|
+
export const SmallAvatarSkeleton = () => {
|
|
20
|
+
return (_jsx(SmallAvatarSkeletonContainer, { children: _jsx(SmallAvatarSkeletonBase, { variant: "circular" }) }));
|
|
21
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const LinkButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "default" | "success" | "warning" | "error" | "
|
|
5
|
+
color?: "inherit" | "default" | "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
edge?: false | "end" | "start" | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { SwapButtonProps } from './types';
|
|
3
|
-
export declare const SwapButton:
|
|
3
|
+
export declare const SwapButton: React.FC<SwapButtonProps>;
|
|
@@ -9,18 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { LoadingButton } from '@mui/lab';
|
|
12
|
-
import { forwardRef } from 'react';
|
|
13
12
|
import { useTranslation } from 'react-i18next';
|
|
14
13
|
import { useNavigate } from 'react-router-dom';
|
|
15
|
-
import { useGasSufficiency } from '../../hooks';
|
|
16
14
|
import { useWallet, useWidgetConfig } from '../../providers';
|
|
17
15
|
import { navigationRoutes } from '../../utils';
|
|
18
|
-
export const SwapButton =
|
|
16
|
+
export const SwapButton = ({ onClick, currentRoute, text, disabled, loading, }) => {
|
|
19
17
|
const { t } = useTranslation();
|
|
20
18
|
const navigate = useNavigate();
|
|
21
19
|
const { variant, walletManagement } = useWidgetConfig();
|
|
22
20
|
const { account, connect } = useWallet();
|
|
23
|
-
const { insufficientFunds, insufficientGas, isLoading: isGasSufficiencyLoading, } = useGasSufficiency(currentRoute);
|
|
24
21
|
const handleSwapButtonClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
22
|
if (!account.isActive) {
|
|
26
23
|
if (walletManagement) {
|
|
@@ -48,5 +45,5 @@ export const SwapButton = forwardRef(({ onClick, currentRoute, text, disable, en
|
|
|
48
45
|
}
|
|
49
46
|
return t(`button.connectWallet`);
|
|
50
47
|
};
|
|
51
|
-
return (_jsx(LoadingButton, Object.assign({ variant: "contained", color: "primary", onClick: handleSwapButtonClick, disabled:
|
|
52
|
-
}
|
|
48
|
+
return (_jsx(LoadingButton, Object.assign({ variant: "contained", color: "primary", onClick: handleSwapButtonClick, disabled: disabled, loading: loading, loadingPosition: "center", fullWidth: true }, { children: getButtonText() })));
|
|
49
|
+
};
|
|
@@ -4,7 +4,7 @@ export declare const minInputFontSize = 14;
|
|
|
4
4
|
export declare const FormControl: import("@emotion/styled").StyledComponent<{
|
|
5
5
|
children?: import("react").ReactNode;
|
|
6
6
|
classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
|
|
7
|
-
color?: "success" | "warning" | "error" | "
|
|
7
|
+
color?: "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
9
9
|
error?: boolean | undefined;
|
|
10
10
|
fullWidth?: boolean | undefined;
|
|
@@ -9,6 +9,7 @@ export const FormControl = styled(MuiFormControl)(({ theme }) => ({
|
|
|
9
9
|
export const Input = styled(InputBase)(({ theme }) => ({
|
|
10
10
|
fontSize: 24,
|
|
11
11
|
fontWeight: 700,
|
|
12
|
+
boxShadow: 'none',
|
|
12
13
|
// padding: theme.spacing(2, 2, 2, 0),
|
|
13
14
|
[`.${inputBaseClasses.input}`]: {
|
|
14
15
|
height: 32,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const Button: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
5
|
-
color?: "inherit" | "success" | "warning" | "error" | "
|
|
5
|
+
color?: "inherit" | "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableElevation?: boolean | undefined;
|
|
8
8
|
disableFocusRipple?: boolean | undefined;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useWatch } from 'react-hook-form';
|
|
3
3
|
import { useChain, useToken } from '../../hooks';
|
|
4
4
|
import { SwapFormKeyHelper } from '../../providers';
|
|
5
|
-
import { TokenAvatar,
|
|
5
|
+
import { TokenAvatar, TokenAvatarDefault } from '../TokenAvatar';
|
|
6
6
|
export const SwapInputStartAdornment = ({ formType, }) => {
|
|
7
7
|
const [chainId, tokenAddress] = useWatch({
|
|
8
8
|
name: [
|
|
@@ -13,5 +13,5 @@ export const SwapInputStartAdornment = ({ formType, }) => {
|
|
|
13
13
|
const { chain } = useChain(chainId);
|
|
14
14
|
const { token } = useToken(chainId, tokenAddress);
|
|
15
15
|
const isSelected = !!(chain && token);
|
|
16
|
-
return isSelected ? (_jsx(TokenAvatar, { token: token, chain: chain, sx: { marginLeft: 2 } })) : (_jsx(
|
|
16
|
+
return isSelected ? (_jsx(TokenAvatar, { token: token, chain: chain, sx: { marginLeft: 2 } })) : (_jsx(TokenAvatarDefault, { sx: { marginLeft: 2 } }));
|
|
17
17
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const Label: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
|
-
align?: "
|
|
3
|
+
align?: "center" | "left" | "right" | "inherit" | "justify" | undefined;
|
|
4
4
|
children?: import("react").ReactNode;
|
|
5
5
|
classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
|
|
6
6
|
gutterBottom?: boolean | undefined;
|
|
@@ -17,7 +17,7 @@ export declare const Label: import("@emotion/styled").StyledComponent<import("@m
|
|
|
17
17
|
export declare const IconButton: import("@emotion/styled").StyledComponent<{
|
|
18
18
|
children?: import("react").ReactNode;
|
|
19
19
|
classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
|
|
20
|
-
color?: "inherit" | "default" | "success" | "warning" | "error" | "
|
|
20
|
+
color?: "inherit" | "default" | "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
|
|
21
21
|
disabled?: boolean | undefined;
|
|
22
22
|
disableFocusRipple?: boolean | undefined;
|
|
23
23
|
edge?: false | "end" | "start" | undefined;
|
|
@@ -6,6 +6,9 @@ interface TokenProps {
|
|
|
6
6
|
connected?: boolean;
|
|
7
7
|
step?: Step;
|
|
8
8
|
disableDescription?: boolean;
|
|
9
|
+
isLoading?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export declare const Token: React.FC<TokenProps & BoxProps>;
|
|
12
|
+
export declare const TokenFallback: React.FC<TokenProps & BoxProps>;
|
|
13
|
+
export declare const TokenBase: React.FC<TokenProps & BoxProps>;
|
|
11
14
|
export {};
|
|
@@ -12,14 +12,26 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { Box } from '@mui/material';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
|
-
import { useChain } from '../../hooks';
|
|
15
|
+
import { useChain, useToken } from '../../hooks';
|
|
16
16
|
import { formatTokenAmount, formatTokenPrice } from '../../utils';
|
|
17
17
|
import { SmallAvatar } from '../SmallAvatar';
|
|
18
18
|
import { TextFitter } from '../TextFitter';
|
|
19
19
|
import { TokenAvatar } from '../TokenAvatar';
|
|
20
20
|
import { TextSecondary, TextSecondaryContainer } from './Token.style';
|
|
21
21
|
export const Token = (_a) => {
|
|
22
|
+
var { token } = _a, other = __rest(_a, ["token"]);
|
|
23
|
+
if (!token.priceUSD || !token.logoURI) {
|
|
24
|
+
return _jsx(TokenFallback, Object.assign({ token: token }, other));
|
|
25
|
+
}
|
|
26
|
+
return _jsx(TokenBase, Object.assign({ token: token }, other));
|
|
27
|
+
};
|
|
28
|
+
export const TokenFallback = (_a) => {
|
|
22
29
|
var { token, connected, step, disableDescription } = _a, other = __rest(_a, ["token", "connected", "step", "disableDescription"]);
|
|
30
|
+
const { token: chainToken, isLoading } = useToken(token.chainId, token.address);
|
|
31
|
+
return (_jsx(TokenBase, Object.assign({ token: Object.assign(Object.assign({}, token), chainToken), isLoading: isLoading }, other)));
|
|
32
|
+
};
|
|
33
|
+
export const TokenBase = (_a) => {
|
|
34
|
+
var { token, connected, step, disableDescription, isLoading } = _a, other = __rest(_a, ["token", "connected", "step", "disableDescription", "isLoading"]);
|
|
23
35
|
const { t } = useTranslation();
|
|
24
36
|
const { chain } = useChain(token.chainId);
|
|
25
37
|
const formattedTokenAmount = formatTokenAmount(token.amount, token.decimals);
|
|
@@ -10,7 +10,7 @@ export declare const TextSecondaryContainer: import("@emotion/styled").StyledCom
|
|
|
10
10
|
connected?: boolean | undefined;
|
|
11
11
|
}, {}, {}>;
|
|
12
12
|
export declare const TextSecondary: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
13
|
-
align?: "
|
|
13
|
+
align?: "center" | "left" | "right" | "inherit" | "justify" | undefined;
|
|
14
14
|
children?: import("react").ReactNode;
|
|
15
15
|
classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
|
|
16
16
|
gutterBottom?: boolean | undefined;
|
|
@@ -8,6 +8,7 @@ export declare const TokenAvatarFallback: React.FC<{
|
|
|
8
8
|
export declare const TokenAvatarBase: React.FC<{
|
|
9
9
|
token: Token;
|
|
10
10
|
chain?: Chain;
|
|
11
|
+
isLoading?: boolean;
|
|
11
12
|
sx?: SxProps<Theme>;
|
|
12
13
|
}>;
|
|
13
14
|
export declare const TokenAvatar: React.FC<{
|
|
@@ -15,6 +16,6 @@ export declare const TokenAvatar: React.FC<{
|
|
|
15
16
|
chain?: Chain;
|
|
16
17
|
sx?: SxProps<Theme>;
|
|
17
18
|
}>;
|
|
18
|
-
export declare const
|
|
19
|
+
export declare const TokenAvatarDefault: React.FC<{
|
|
19
20
|
sx?: SxProps<Theme>;
|
|
20
21
|
}>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Avatar, Badge } from '@mui/material';
|
|
2
|
+
import { Avatar, Badge, Skeleton } from '@mui/material';
|
|
3
3
|
import { useChain, useToken } from '../../hooks';
|
|
4
|
-
import { SmallAvatar } from '../SmallAvatar';
|
|
5
|
-
import {
|
|
4
|
+
import { SmallAvatar, SmallAvatarSkeleton } from '../SmallAvatar';
|
|
5
|
+
import { AvatarDefault, AvatarDefaultContainer } from './TokenAvatar.style';
|
|
6
6
|
export const TokenAvatarFallback = ({ token, sx }) => {
|
|
7
7
|
const { chain } = useChain(token.chainId);
|
|
8
|
-
const { token: chainToken } = useToken(token.chainId, token.address);
|
|
9
|
-
return _jsx(TokenAvatarBase, { token: chainToken !== null && chainToken !== void 0 ? chainToken : token, chain: chain, sx: sx });
|
|
8
|
+
const { token: chainToken, isLoading } = useToken(token.chainId, token.address);
|
|
9
|
+
return (_jsx(TokenAvatarBase, { token: chainToken !== null && chainToken !== void 0 ? chainToken : token, isLoading: isLoading, chain: chain, sx: sx }));
|
|
10
10
|
};
|
|
11
|
-
export const TokenAvatarBase = ({ token, chain, sx }) => {
|
|
12
|
-
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] }))) :
|
|
11
|
+
export const TokenAvatarBase = ({ token, chain, isLoading, sx }) => {
|
|
12
|
+
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] }))) : (_jsx(SmallAvatarSkeleton, {})), sx: sx }, { children: isLoading ? (_jsx(Skeleton, { width: 32, height: 32, variant: "circular" })) : (_jsx(Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] }))) })));
|
|
13
13
|
};
|
|
14
14
|
export const TokenAvatar = ({ token, chain, sx }) => {
|
|
15
15
|
if (!chain || !token.logoURI) {
|
|
@@ -17,6 +17,6 @@ export const TokenAvatar = ({ token, chain, sx }) => {
|
|
|
17
17
|
}
|
|
18
18
|
return _jsx(TokenAvatarBase, { token: token, chain: chain, sx: sx });
|
|
19
19
|
};
|
|
20
|
-
export const
|
|
21
|
-
return (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: _jsx(
|
|
20
|
+
export const TokenAvatarDefault = ({ sx }) => {
|
|
21
|
+
return (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: _jsx(AvatarDefault, { width: 16, height: 16 }), sx: sx }, { children: _jsx(AvatarDefaultContainer, { children: _jsx(AvatarDefault, { width: 28, height: 28 }) }) })));
|
|
22
22
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const TokenAvatarGroup: import("@emotion/styled").StyledComponent<import("@mui/material").AvatarGroupProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const AvatarDefault: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
4
4
|
children?: import("react").ReactNode;
|
|
5
5
|
component?: import("react").ElementType<any> | undefined;
|
|
6
6
|
ref?: import("react").Ref<unknown> | undefined;
|
|
@@ -8,7 +8,7 @@ export declare const AvatarSkeleton: import("@emotion/styled").StyledComponent<i
|
|
|
8
8
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
9
9
|
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
10
10
|
}, 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>, {}, {}>;
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const AvatarDefaultContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
12
12
|
children?: import("react").ReactNode;
|
|
13
13
|
component?: import("react").ElementType<any> | undefined;
|
|
14
14
|
ref?: import("react").Ref<unknown> | undefined;
|
|
@@ -11,14 +11,14 @@ export const TokenAvatarGroup = styled(AvatarGroup)(({ theme }) => ({
|
|
|
11
11
|
marginLeft: theme.spacing(1),
|
|
12
12
|
},
|
|
13
13
|
}));
|
|
14
|
-
export const
|
|
14
|
+
export const AvatarDefault = styled(Box)(({ theme }) => ({
|
|
15
15
|
background: theme.palette.mode === 'light'
|
|
16
16
|
? theme.palette.grey[300]
|
|
17
17
|
: theme.palette.grey[800],
|
|
18
18
|
border: `2px solid ${theme.palette.background.paper}`,
|
|
19
19
|
borderRadius: '50%',
|
|
20
20
|
}));
|
|
21
|
-
export const
|
|
21
|
+
export const AvatarDefaultContainer = styled(Box)(({ theme }) => ({
|
|
22
22
|
border: `2px solid ${theme.palette.mode === 'light'
|
|
23
23
|
? theme.palette.grey[300]
|
|
24
24
|
: theme.palette.grey[800]}`,
|
|
@@ -36,7 +36,7 @@ export const VirtualizedTokenList = ({ tokens, featuredTokensLength, scrollEleme
|
|
|
36
36
|
getItemKey: (index) => { var _a; return (_a = tokens[index].address) !== null && _a !== void 0 ? _a : index; },
|
|
37
37
|
});
|
|
38
38
|
useEffect(() => {
|
|
39
|
-
scrollToIndex(0, { align: 'start'
|
|
39
|
+
scrollToIndex(0, { align: 'start' });
|
|
40
40
|
}, [scrollToIndex, chainId]);
|
|
41
41
|
if (isLoading) {
|
|
42
42
|
return (_jsx(List, Object.assign({ disablePadding: true }, { children: Array.from({ length: 3 }).map((_, index) => (
|
package/config/theme.js
CHANGED
|
@@ -51,7 +51,7 @@ export const createTheme = (mode, theme = {}) => {
|
|
|
51
51
|
: common.black;
|
|
52
52
|
return createMuiTheme({
|
|
53
53
|
typography: Object.assign({ fontFamily: 'Inter var, Inter, sans-serif' }, theme.typography),
|
|
54
|
-
palette: Object.assign(Object.assign(Object.assign({ mode }, palette), { primary: {
|
|
54
|
+
palette: Object.assign(Object.assign(Object.assign(Object.assign({ mode }, palette), (mode === 'light' ? paletteLight : paletteDark)), theme.palette), { primary: {
|
|
55
55
|
main: primaryMainColor,
|
|
56
56
|
light: primaryLightColor,
|
|
57
57
|
dark: primaryDarkColor,
|
|
@@ -59,7 +59,7 @@ export const createTheme = (mode, theme = {}) => {
|
|
|
59
59
|
main: (_m = (_l = (_k = theme.palette) === null || _k === void 0 ? void 0 : _k.secondary) === null || _l === void 0 ? void 0 : _l.main) !== null && _m !== void 0 ? _m : palette.secondary.main,
|
|
60
60
|
light: lighten((_q = (_p = (_o = theme.palette) === null || _o === void 0 ? void 0 : _o.secondary) === null || _p === void 0 ? void 0 : _p.main) !== null && _q !== void 0 ? _q : palette.secondary.main, 0.5),
|
|
61
61
|
dark: darken((_t = (_s = (_r = theme.palette) === null || _r === void 0 ? void 0 : _r.secondary) === null || _s === void 0 ? void 0 : _s.main) !== null && _t !== void 0 ? _t : palette.secondary.main, 0.2),
|
|
62
|
-
} }),
|
|
62
|
+
} }),
|
|
63
63
|
shape: Object.assign(Object.assign({}, shape), theme.shape),
|
|
64
64
|
breakpoints: {
|
|
65
65
|
values: {
|
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.27.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.27.0';
|
|
@@ -11,7 +11,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
|
11
11
|
import { useCallback, useEffect, useRef } from 'react';
|
|
12
12
|
import shallow from 'zustand/shallow';
|
|
13
13
|
import { useLiFi, useWallet } from '../providers';
|
|
14
|
-
import { getUpdatedProcess, isRouteActive, isRouteDone, isRouteFailed, useRouteExecutionStore } from '../stores';
|
|
14
|
+
import { getUpdatedProcess, isRouteActive, isRouteDone, isRouteFailed, useRouteExecutionStore, } from '../stores';
|
|
15
15
|
import { WidgetEvent } from '../types/events';
|
|
16
16
|
import { deepClone } from '../utils';
|
|
17
17
|
import { useWidgetEvents } from './useWidgetEvents';
|