@lifi/widget 1.18.9 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/App.js +3 -3
  2. package/cjs/App.js +3 -3
  3. package/cjs/components/ActiveSwaps/ActiveSwaps.js +1 -1
  4. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +0 -14
  5. package/cjs/components/ActiveSwaps/ActiveSwaps.style.js +1 -9
  6. package/cjs/components/AppContainer.d.ts +11 -1
  7. package/cjs/components/AppContainer.js +3 -6
  8. package/cjs/components/BottomSheet/BottomSheet.js +9 -32
  9. package/cjs/components/BottomSheet/types.d.ts +2 -2
  10. package/cjs/components/Card/Card.js +1 -1
  11. package/cjs/components/Card/CardHeader.d.ts +1 -1
  12. package/cjs/components/ChainSelect/ChainSelect.js +1 -1
  13. package/cjs/components/ChainSelect/useChainSelect.js +2 -4
  14. package/cjs/components/Dialog.d.ts +22 -1
  15. package/cjs/components/Dialog.js +23 -20
  16. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +19 -22
  17. package/cjs/components/Header/NavigationHeader.js +1 -1
  18. package/cjs/components/Header/WalletHeader.js +2 -2
  19. package/cjs/components/PoweredBy/PoweredBy.js +1 -1
  20. package/cjs/components/ProgressToNextUpdate/ProgressToNextUpdate.js +1 -1
  21. package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +6 -6
  22. package/cjs/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
  23. package/cjs/components/SendToWallet/SendToWallet.d.ts +1 -0
  24. package/cjs/components/SendToWallet/SendToWallet.js +10 -5
  25. package/cjs/components/SendToWallet/SendToWalletButton.js +2 -2
  26. package/cjs/components/Step/StepProcess.js +1 -1
  27. package/cjs/components/SwapButton/SwapButton.js +4 -4
  28. package/cjs/components/SwapButton/types.d.ts +2 -0
  29. package/cjs/components/SwapInput/SwapInput.js +6 -2
  30. package/cjs/components/SwapInput/SwapInputAdornment.js +4 -2
  31. package/cjs/components/SwapInput/SwapInputAdornment.style.js +1 -13
  32. package/cjs/components/SwapRouteCard/SwapRouteCard.js +7 -6
  33. package/cjs/components/SwapRoutes/SwapRoutes.js +4 -4
  34. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
  35. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +17 -12
  36. package/cjs/components/SwapRoutes/useSetRecommendedRoute.d.ts +2 -0
  37. package/cjs/components/SwapRoutes/useSetRecommendedRoute.js +13 -0
  38. package/cjs/components/TokenList/TokenList.js +9 -6
  39. package/cjs/config/theme.js +22 -8
  40. package/cjs/config/version.d.ts +1 -1
  41. package/cjs/config/version.js +1 -1
  42. package/cjs/hooks/index.d.ts +1 -0
  43. package/cjs/hooks/index.js +1 -0
  44. package/cjs/hooks/useExpandableVariant.d.ts +1 -0
  45. package/cjs/hooks/useExpandableVariant.js +14 -0
  46. package/cjs/hooks/useGasSufficiency.d.ts +3 -2
  47. package/cjs/hooks/useGasSufficiency.js +50 -26
  48. package/cjs/hooks/useSwapRoutes.js +4 -2
  49. package/cjs/hooks/useTokenBalance.js +2 -2
  50. package/cjs/i18n/en/translation.json +8 -7
  51. package/cjs/i18n/index.d.ts +6 -5
  52. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +21 -4
  53. package/cjs/pages/MainPage/MainPage.js +3 -3
  54. package/cjs/pages/SelectWalletPage/SelectWalletPage.js +1 -1
  55. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
  56. package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  57. package/cjs/pages/SwapPage/StatusBottomSheet.js +4 -4
  58. package/cjs/pages/SwapPage/SwapPage.js +4 -4
  59. package/cjs/providers/SwapFormProvider/SwapFormProvider.js +3 -2
  60. package/cjs/providers/SwapFormProvider/URLSearchParamsBuilder.d.ts +1 -0
  61. package/cjs/providers/SwapFormProvider/URLSearchParamsBuilder.js +46 -0
  62. package/cjs/providers/SwapFormProvider/types.d.ts +4 -4
  63. package/cjs/providers/SwapFormProvider/types.js +2 -2
  64. package/cjs/providers/WalletProvider/WalletFormUpdate.d.ts +5 -0
  65. package/cjs/providers/WalletProvider/WalletFormUpdate.js +64 -0
  66. package/cjs/providers/WalletProvider/WalletProvider.js +3 -58
  67. package/cjs/providers/WidgetProvider/WidgetProvider.js +12 -5
  68. package/cjs/stores/routes/index.d.ts +1 -1
  69. package/cjs/stores/routes/index.js +1 -1
  70. package/cjs/stores/routes/types.d.ts +4 -4
  71. package/cjs/stores/routes/useRecommendedRouteStore.d.ts +4 -0
  72. package/cjs/stores/routes/{useSelectedRouteStore.js → useRecommendedRouteStore.js} +4 -4
  73. package/cjs/stores/routes/useRouteExecutionStore.js +9 -2
  74. package/cjs/types/widget.d.ts +1 -0
  75. package/components/ActiveSwaps/ActiveSwaps.js +3 -3
  76. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +0 -14
  77. package/components/ActiveSwaps/ActiveSwaps.style.js +1 -9
  78. package/components/AppContainer.d.ts +11 -1
  79. package/components/AppContainer.js +2 -4
  80. package/components/BottomSheet/BottomSheet.js +9 -32
  81. package/components/BottomSheet/types.d.ts +2 -2
  82. package/components/Card/Card.js +1 -1
  83. package/components/Card/CardHeader.d.ts +1 -1
  84. package/components/ChainSelect/ChainSelect.js +1 -1
  85. package/components/ChainSelect/useChainSelect.js +2 -4
  86. package/components/Dialog.d.ts +22 -1
  87. package/components/Dialog.js +22 -19
  88. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +21 -24
  89. package/components/Header/NavigationHeader.js +2 -2
  90. package/components/Header/WalletHeader.js +2 -2
  91. package/components/PoweredBy/PoweredBy.js +1 -1
  92. package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +1 -1
  93. package/components/ReverseTokensButton/ReverseTokensButton.js +6 -6
  94. package/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
  95. package/components/SendToWallet/SendToWallet.d.ts +1 -0
  96. package/components/SendToWallet/SendToWallet.js +9 -5
  97. package/components/SendToWallet/SendToWalletButton.js +2 -2
  98. package/components/Step/StepProcess.js +1 -1
  99. package/components/SwapButton/SwapButton.js +4 -4
  100. package/components/SwapButton/types.d.ts +2 -0
  101. package/components/SwapInput/SwapInput.js +6 -2
  102. package/components/SwapInput/SwapInputAdornment.js +4 -2
  103. package/components/SwapInput/SwapInputAdornment.style.js +2 -14
  104. package/components/SwapRouteCard/SwapRouteCard.js +8 -7
  105. package/components/SwapRoutes/SwapRoutes.js +4 -4
  106. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
  107. package/components/SwapRoutes/SwapRoutesExpanded.js +16 -12
  108. package/components/SwapRoutes/useSetRecommendedRoute.d.ts +2 -0
  109. package/components/SwapRoutes/useSetRecommendedRoute.js +9 -0
  110. package/components/TokenList/TokenList.js +9 -6
  111. package/config/theme.js +22 -8
  112. package/config/version.d.ts +1 -1
  113. package/config/version.js +1 -1
  114. package/hooks/index.d.ts +1 -0
  115. package/hooks/index.js +1 -0
  116. package/hooks/useExpandableVariant.d.ts +1 -0
  117. package/hooks/useExpandableVariant.js +10 -0
  118. package/hooks/useGasSufficiency.d.ts +3 -2
  119. package/hooks/useGasSufficiency.js +50 -26
  120. package/hooks/useSwapRoutes.js +4 -2
  121. package/hooks/useTokenBalance.js +2 -2
  122. package/i18n/en/translation.json +8 -7
  123. package/i18n/index.d.ts +6 -5
  124. package/package.json +11 -11
  125. package/pages/ActiveSwapsPage/ActiveSwapsPage.js +24 -7
  126. package/pages/MainPage/MainPage.js +3 -3
  127. package/pages/SelectWalletPage/SelectWalletPage.js +1 -1
  128. package/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
  129. package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  130. package/pages/SwapPage/StatusBottomSheet.js +4 -4
  131. package/pages/SwapPage/SwapPage.js +5 -5
  132. package/providers/SwapFormProvider/SwapFormProvider.js +4 -3
  133. package/providers/SwapFormProvider/URLSearchParamsBuilder.d.ts +1 -0
  134. package/providers/SwapFormProvider/URLSearchParamsBuilder.js +42 -0
  135. package/providers/SwapFormProvider/types.d.ts +4 -4
  136. package/providers/SwapFormProvider/types.js +2 -2
  137. package/providers/WalletProvider/WalletFormUpdate.d.ts +5 -0
  138. package/providers/WalletProvider/WalletFormUpdate.js +60 -0
  139. package/providers/WalletProvider/WalletProvider.js +5 -60
  140. package/providers/WidgetProvider/WidgetProvider.js +12 -5
  141. package/stores/routes/index.d.ts +1 -1
  142. package/stores/routes/index.js +1 -1
  143. package/stores/routes/types.d.ts +4 -4
  144. package/stores/routes/useRecommendedRouteStore.d.ts +4 -0
  145. package/stores/routes/useRecommendedRouteStore.js +9 -0
  146. package/stores/routes/useRouteExecutionStore.js +9 -2
  147. package/tsconfig.cjs.tsbuildinfo +1 -1
  148. package/types/widget.d.ts +1 -0
  149. package/cjs/components/SwapRoutes/useSetSelectedRoute.d.ts +0 -2
  150. package/cjs/components/SwapRoutes/useSetSelectedRoute.js +0 -13
  151. package/cjs/stores/routes/useSelectedRouteStore.d.ts +0 -4
  152. package/components/SwapRoutes/useSetSelectedRoute.d.ts +0 -2
  153. package/components/SwapRoutes/useSetSelectedRoute.js +0 -9
  154. package/stores/routes/useSelectedRouteStore.d.ts +0 -4
  155. package/stores/routes/useSelectedRouteStore.js +0 -9
@@ -5,9 +5,9 @@ import { useNavigate } from 'react-router-dom';
5
5
  import { useWallet } from '../../providers';
6
6
  import { useExecutingRoutesIds } from '../../stores';
7
7
  import { navigationRoutes } from '../../utils';
8
- import { CardTitle } from '../Card';
8
+ import { Card, CardTitle } from '../Card';
9
9
  import { ActiveSwapItem } from './ActiveSwapItem';
10
- import { ProgressCard, ShowAllButton } from './ActiveSwaps.style';
10
+ import { ShowAllButton } from './ActiveSwaps.style';
11
11
  export const ActiveSwaps = (props) => {
12
12
  const { t } = useTranslation();
13
13
  const navigate = useNavigate();
@@ -20,7 +20,7 @@ export const ActiveSwaps = (props) => {
20
20
  navigate(navigationRoutes.activeSwaps);
21
21
  };
22
22
  const hasShowAll = (executingRoutes === null || executingRoutes === void 0 ? void 0 : executingRoutes.length) > 2;
23
- return (_jsxs(ProgressCard, Object.assign({}, props, { children: [_jsx(CardTitle, { children: t('header.activeSwaps') }), _jsx(Stack, Object.assign({ spacing: 1.5, pt: 1.5, pb: hasShowAll ? 0 : 2 }, { children: executingRoutes.slice(0, 2).map((routeId) => (_jsx(ActiveSwapItem, { routeId: routeId, dense: true }, routeId))) })), hasShowAll ? (_jsx(ShowAllButton, Object.assign({ disableRipple: true, fullWidth: true, onClick: handleShowAll, sx: (theme) => ({
23
+ return (_jsxs(Card, Object.assign({ variant: "selected", selectionColor: "secondary" }, props, { children: [_jsx(CardTitle, { children: t('header.activeSwaps') }), _jsx(Stack, Object.assign({ spacing: 1.5, pt: 1.5, pb: hasShowAll ? 0 : 2 }, { children: executingRoutes.slice(0, 2).map((routeId) => (_jsx(ActiveSwapItem, { routeId: routeId, dense: true }, routeId))) })), hasShowAll ? (_jsx(ShowAllButton, Object.assign({ disableRipple: true, fullWidth: true, onClick: handleShowAll, sx: (theme) => ({
24
24
  padding: theme.spacing(0.75, 2),
25
25
  }) }, { children: t('button.showAll') }))) : null] })));
26
26
  };
@@ -1,18 +1,4 @@
1
1
  /// <reference types="react" />
2
- export declare const ProgressCard: 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
- variant?: ("default" | "error" | "selected") | undefined;
11
- selectionColor?: "primary" | "secondary" | undefined;
12
- dense?: boolean | undefined;
13
- indented?: boolean | undefined;
14
- onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
15
- }, {}, {}>;
16
2
  export declare const ListItemButton: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemButtonBaseProps & Omit<{
17
3
  action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
18
4
  centerRipple?: boolean | undefined;
@@ -1,15 +1,7 @@
1
1
  import { Button, ListItem as MuiListItem, ListItemButton as MuiListItemButton, } from '@mui/material';
2
2
  import { listItemSecondaryActionClasses } from '@mui/material/ListItemSecondaryAction';
3
- import { alpha, styled } from '@mui/material/styles';
3
+ import { styled } from '@mui/material/styles';
4
4
  import { getContrastAlphaColor } from '../../utils';
5
- import { Card } from '../Card';
6
- export const ProgressCard = styled(Card)(({ theme }) => ({
7
- borderColor: alpha(theme.palette.secondary.main, 0.48),
8
- background: alpha(theme.palette.secondary.main, 0.08),
9
- '&:hover': {
10
- background: alpha(theme.palette.secondary.main, 0.08),
11
- },
12
- }));
13
5
  export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
14
6
  borderRadius: theme.shape.borderRadiusSecondary,
15
7
  paddingLeft: theme.spacing(1.5),
@@ -1,5 +1,16 @@
1
1
  import type { PropsWithChildren } from 'react';
2
+ import type { WidgetVariant } from '../types';
2
3
  export declare const maxHeight = 680;
4
+ export declare const AppExpandedContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
5
+ children?: import("react").ReactNode;
6
+ component?: import("react").ElementType<any> | undefined;
7
+ ref?: import("react").Ref<unknown> | undefined;
8
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
9
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
10
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
11
+ }, 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> & {
12
+ variant?: WidgetVariant | undefined;
13
+ }, {}, {}>;
3
14
  export declare const FlexContainer: import("@emotion/styled").StyledComponent<{
4
15
  children?: import("react").ReactNode;
5
16
  classes?: Partial<import("@mui/material").ContainerClasses> | undefined;
@@ -11,4 +22,3 @@ export declare const FlexContainer: import("@emotion/styled").StyledComponent<{
11
22
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
12
23
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "maxWidth" | "fixed" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
13
24
  export declare const AppContainer: React.FC<PropsWithChildren<{}>>;
14
- export declare const AppExpandedContainer: React.FC<PropsWithChildren<{}>>;
@@ -4,7 +4,7 @@ import { styled } from '@mui/material/styles';
4
4
  import { useWidgetConfig } from '../providers';
5
5
  import { ElementId } from '../utils';
6
6
  export const maxHeight = 680;
7
- const ExpandedContainer = styled(Box, {
7
+ export const AppExpandedContainer = styled(Box, {
8
8
  shouldForwardProp: (prop) => prop !== 'variant',
9
9
  })(({ variant }) => ({
10
10
  display: 'flex',
@@ -30,6 +30,7 @@ const RelativeContainer = styled(Box, {
30
30
  const CssBaselineContainer = styled(ScopedCssBaseline, {
31
31
  shouldForwardProp: (prop) => prop !== 'variant',
32
32
  })(({ variant }) => ({
33
+ position: 'relative',
33
34
  display: 'flex',
34
35
  flex: 1,
35
36
  flexDirection: 'column',
@@ -50,6 +51,3 @@ export const AppContainer = ({ children }) => {
50
51
  const { containerStyle, variant } = useWidgetConfig();
51
52
  return (_jsx(RelativeContainer, Object.assign({ sx: containerStyle, variant: variant }, { children: _jsx(CssBaselineContainer, Object.assign({ id: ElementId.ScrollableContainer, variant: variant, enableColorScheme: true }, { children: _jsx(FlexContainer, Object.assign({ disableGutters: true }, { children: children })) })) })));
52
53
  };
53
- export const AppExpandedContainer = ({ children, }) => {
54
- return _jsx(ExpandedContainer, { children: children });
55
- };
@@ -1,44 +1,21 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Drawer } from '@mui/material';
3
3
  import { forwardRef, useCallback, useImperativeHandle, useRef, useState, } from 'react';
4
- import { useScrollableContainer } from '../../hooks';
4
+ import { backdropProps, modalProps, paperProps } from '../Dialog';
5
5
  export const BottomSheet = forwardRef(({ elementRef, children, open }, ref) => {
6
6
  const openRef = useRef(open);
7
7
  const [drawerOpen, setDrawerOpen] = useState(open);
8
- const containerElement = useScrollableContainer();
9
- const openDrawer = useCallback(() => {
10
- setDrawerOpen(true);
11
- openRef.current = true;
12
- }, []);
13
- const closeDrawer = useCallback(() => {
8
+ const close = useCallback(() => {
14
9
  setDrawerOpen(false);
15
10
  openRef.current = false;
16
11
  }, []);
17
12
  useImperativeHandle(ref, () => ({
18
13
  isOpen: () => openRef.current,
19
- openDrawer,
20
- closeDrawer,
21
- }), [closeDrawer, openDrawer]);
22
- return (_jsx(Drawer, Object.assign({ container: containerElement, ref: elementRef, anchor: "bottom", open: drawerOpen, onClose: closeDrawer, ModalProps: {
23
- sx: {
24
- position: 'absolute',
25
- overflow: 'hidden',
26
- },
27
- keepMounted: true,
28
- }, PaperProps: {
29
- sx: (theme) => ({
30
- position: 'absolute',
31
- backgroundImage: 'none',
32
- borderTopLeftRadius: theme.shape.borderRadius,
33
- borderTopRightRadius: theme.shape.borderRadius,
34
- }),
35
- }, BackdropProps: {
36
- sx: {
37
- position: 'absolute',
38
- backgroundColor: 'rgb(0 0 0 / 48%)',
39
- backdropFilter: 'blur(3px)',
40
- },
41
- }, SlideProps: {
42
- container: containerElement,
43
- } }, { children: children })));
14
+ open: () => {
15
+ setDrawerOpen(true);
16
+ openRef.current = true;
17
+ },
18
+ close,
19
+ }), [close]);
20
+ return (_jsx(Drawer, Object.assign({ ref: elementRef, anchor: "bottom", open: drawerOpen, onClose: close, ModalProps: modalProps, PaperProps: paperProps, BackdropProps: backdropProps, disableAutoFocus: true, disableEnforceFocus: true, disableScrollLock: true, disablePortal: true }, { children: children })));
44
21
  });
@@ -5,6 +5,6 @@ export declare type BottomSheetProps = DrawerProps & {
5
5
  };
6
6
  export interface BottomSheetBase {
7
7
  isOpen(): void;
8
- openDrawer(): void;
9
- closeDrawer(): void;
8
+ open(): void;
9
+ close(): void;
10
10
  }
@@ -5,7 +5,7 @@ const getBackgroundColor = (theme, variant, selectionColor) => variant === 'sele
5
5
  ? theme.palette.mode === 'light'
6
6
  ? alpha(theme.palette.primary.main, 0.04)
7
7
  : alpha(theme.palette.primary.main, 0.42)
8
- : alpha(theme.palette.secondary.main, 0.08)
8
+ : alpha(theme.palette.secondary.main, theme.palette.mode === 'light' ? 0.08 : 0.12)
9
9
  : theme.palette.background.paper;
10
10
  export const Card = styled(Box, {
11
11
  shouldForwardProp: (prop) => !['dense', 'variant', 'indented', 'selectionColor'].includes(prop),
@@ -15,4 +15,4 @@ export declare const CardHeader: import("@emotion/styled").StyledComponent<{
15
15
  }> | undefined;
16
16
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
17
17
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
18
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "avatar" | "disableTypography" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
18
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "disableTypography" | "avatar" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -22,7 +22,7 @@ export const ChainSelect = ({ formType }) => {
22
22
  const chainsToHide = ((_a = chains === null || chains === void 0 ? void 0 : chains.length) !== null && _a !== void 0 ? _a : 0) - maxChainToOrder;
23
23
  return (_jsxs(ChainContainer, { children: [isLoading
24
24
  ? Array.from({ length: maxChainToOrder + 1 }).map((_, index) => (_jsx(Skeleton, { variant: "rectangular", width: 56, height: 56, sx: { borderRadius: 1 } }, index)))
25
- : getChains().map((chain) => (_jsx(Tooltip, Object.assign({ title: chain.name, placement: "top", enterDelay: 500, enterNextDelay: 500, arrow: true }, { children: _jsx(ChainCard, Object.assign({ onClick: () => setCurrentChain(chain.id), variant: chainId === chain.id ? 'selected' : 'default' }, { children: _jsx(Avatar, Object.assign({ src: chain.logoURI, alt: chain.key, sx: { width: 40, height: 40 } }, { children: chain.name[0] })) })) }), chain.id))), chainsToHide > 0 ? (_jsx(ChainCard, Object.assign({ onClick: showAllChains }, { children: _jsx(Box, Object.assign({ sx: {
25
+ : getChains().map((chain) => (_jsx(Tooltip, Object.assign({ title: chain.name, placement: "top", enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: _jsx(ChainCard, Object.assign({ onClick: () => setCurrentChain(chain.id), variant: chainId === chain.id ? 'selected' : 'default' }, { children: _jsx(Avatar, Object.assign({ src: chain.logoURI, alt: chain.key, sx: { width: 40, height: 40 } }, { children: chain.name[0] })) })) }), chain.id))), chainsToHide > 0 ? (_jsx(ChainCard, Object.assign({ onClick: showAllChains }, { children: _jsx(Box, Object.assign({ sx: {
26
26
  width: 40,
27
27
  height: 40,
28
28
  display: 'grid',
@@ -17,10 +17,8 @@ export const useChainSelect = (formType) => {
17
17
  return selectedChains;
18
18
  };
19
19
  const setCurrentChain = (chainId) => {
20
- setValue(chainKey, chainId, { shouldDirty: true });
21
- setValue(SwapFormKeyHelper.getTokenKey(formType), '', {
22
- shouldDirty: false,
23
- });
20
+ setValue(chainKey, chainId, { shouldTouch: true });
21
+ setValue(SwapFormKeyHelper.getTokenKey(formType), '');
24
22
  setValue(SwapFormKeyHelper.getAmountKey(formType), '');
25
23
  setValue(SwapFormKey.TokenSearchFilter, '');
26
24
  setChainOrder(chainId);
@@ -1,3 +1,24 @@
1
- import type { DialogProps } from '@mui/material';
1
+ import type { DialogProps, Theme } from '@mui/material';
2
2
  import type { PropsWithChildren } from 'react';
3
+ export declare const modalProps: {
4
+ sx: {
5
+ position: string;
6
+ overflow: string;
7
+ };
8
+ };
9
+ export declare const paperProps: {
10
+ sx: (theme: Theme) => {
11
+ position: string;
12
+ backgroundImage: string;
13
+ borderTopLeftRadius: number;
14
+ borderTopRightRadius: number;
15
+ };
16
+ };
17
+ export declare const backdropProps: {
18
+ sx: {
19
+ position: string;
20
+ backgroundColor: string;
21
+ backdropFilter: string;
22
+ };
23
+ };
3
24
  export declare const Dialog: React.FC<PropsWithChildren<DialogProps>>;
@@ -1,23 +1,26 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Dialog as MuiDialog } from '@mui/material';
3
- import { useScrollableContainer } from '../hooks';
3
+ export const modalProps = {
4
+ sx: {
5
+ position: 'absolute',
6
+ overflow: 'hidden',
7
+ },
8
+ };
9
+ export const paperProps = {
10
+ sx: (theme) => ({
11
+ position: 'absolute',
12
+ backgroundImage: 'none',
13
+ borderTopLeftRadius: theme.shape.borderRadius,
14
+ borderTopRightRadius: theme.shape.borderRadius,
15
+ }),
16
+ };
17
+ export const backdropProps = {
18
+ sx: {
19
+ position: 'absolute',
20
+ backgroundColor: 'rgb(0 0 0 / 32%)',
21
+ backdropFilter: 'blur(3px)',
22
+ },
23
+ };
4
24
  export const Dialog = ({ children, open, onClose, }) => {
5
- const containerElement = useScrollableContainer();
6
- return (_jsx(MuiDialog, Object.assign({ open: open, onClose: onClose, container: containerElement, sx: {
7
- position: 'absolute',
8
- overflow: 'hidden',
9
- }, PaperProps: {
10
- sx: (theme) => ({
11
- position: 'absolute',
12
- backgroundImage: 'none',
13
- borderTopLeftRadius: theme.shape.borderRadius,
14
- borderTopRightRadius: theme.shape.borderRadius,
15
- }),
16
- }, BackdropProps: {
17
- sx: {
18
- position: 'absolute',
19
- backgroundColor: 'rgb(0 0 0 / 32%)',
20
- backdropFilter: 'blur(3px)',
21
- },
22
- } }, { children: children })));
25
+ return (_jsx(MuiDialog, Object.assign({ open: open, onClose: onClose, sx: modalProps.sx, PaperProps: paperProps, BackdropProps: backdropProps, disableAutoFocus: true, disableEnforceFocus: true, disableScrollLock: true, disablePortal: true }, { children: children })));
23
26
  };
@@ -11,35 +11,32 @@ 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 { WarningAmber as WarningIcon } from '@mui/icons-material';
14
- import { Box, Typography } from '@mui/material';
14
+ import { Box, Collapse, Typography } from '@mui/material';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { useGasSufficiency } from '../../hooks';
17
- import { useSelectedRouteStore } from '../../stores';
17
+ import { useRecommendedRouteStore } from '../../stores';
18
18
  import { CardTitle } from '../Card';
19
19
  import { MessageCard } from './GasSufficiencyMessage.style';
20
20
  export const GasSufficiencyMessage = (_a) => {
21
21
  var { route } = _a, props = __rest(_a, ["route"]);
22
22
  const { t } = useTranslation();
23
- const selectedRoute = useSelectedRouteStore((state) => state.selectedRoute);
24
- const { insufficientFunds, insufficientGas } = useGasSufficiency(route !== null && route !== void 0 ? route : selectedRoute);
25
- if (!insufficientFunds && !(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length)) {
26
- return null;
27
- }
28
- return (_jsxs(MessageCard, Object.assign({}, props, { children: [_jsx(WarningIcon, { sx: {
29
- marginTop: 2,
30
- marginLeft: 2,
31
- } }), _jsxs(Box, { children: [(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? (_jsx(CardTitle, { children: t(`swap.warning.title.insufficientGas`) })) : null, insufficientFunds ? (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pb: (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? 0 : 2, pt: (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? 1 : 2 }, { children: insufficientFunds
32
- ? t(`swap.warning.message.insufficientFunds`)
33
- : null }))) : null, (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pt: 1 }, { children: t(`swap.warning.message.insufficientGas`) }))) : null, (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length)
34
- ? insufficientGas.map((item, index) => {
35
- var _a, _b;
36
- return (_jsx(Typography
37
- // eslint-disable-next-line react/no-array-index-key
38
- , Object.assign({ variant: "body2", px: 2, pb: insufficientGas.length - 1 === index ? 2 : 0, pt: 0.5 }, { children: t(`swap.tokenOnChainAmount`, {
39
- amount: (_a = item.insufficientAmount) === null || _a === void 0 ? void 0 : _a.toString(),
40
- tokenSymbol: item.token.symbol,
41
- chainName: (_b = item.chain) === null || _b === void 0 ? void 0 : _b.name,
42
- }) }), index));
43
- })
44
- : null] })] })));
23
+ const recommendedRoute = useRecommendedRouteStore((state) => state.recommendedRoute);
24
+ const { insufficientFunds, insufficientGas } = useGasSufficiency(route !== null && route !== void 0 ? route : recommendedRoute);
25
+ return (_jsx(Collapse, Object.assign({ timeout: 225, in: Boolean(insufficientFunds || (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length)), unmountOnExit: true, mountOnEnter: true, appear: true }, { children: _jsx(Box, Object.assign({}, props, { children: _jsxs(MessageCard, { children: [_jsx(WarningIcon, { sx: {
26
+ marginTop: 2,
27
+ marginLeft: 2,
28
+ } }), _jsxs(Box, { children: [(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? (_jsx(CardTitle, { children: t(`swap.warning.title.insufficientGas`) })) : null, insufficientFunds ? (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pb: (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? 0 : 2, pt: (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? 1 : 2 }, { children: insufficientFunds
29
+ ? t(`swap.warning.message.insufficientFunds`)
30
+ : null }))) : null, (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pt: 1 }, { children: t(`swap.warning.message.insufficientGas`) }))) : null, (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length)
31
+ ? insufficientGas.map((item, index) => {
32
+ var _a, _b;
33
+ return (_jsx(Typography
34
+ // eslint-disable-next-line react/no-array-index-key
35
+ , Object.assign({ variant: "body2", px: 2, pb: insufficientGas.length - 1 === index ? 2 : 0, pt: 0.5 }, { children: t(`swap.tokenOnChainAmount`, {
36
+ amount: (_a = item.insufficientAmount) === null || _a === void 0 ? void 0 : _a.toString(),
37
+ tokenSymbol: item.token.symbol,
38
+ chainName: (_b = item.chain) === null || _b === void 0 ? void 0 : _b.name,
39
+ }) }), index));
40
+ })
41
+ : null] })] }) })) })));
45
42
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ArrowBack as ArrowBackIcon, History as HistoryIcon, SettingsOutlined as SettingsIcon, } from '@mui/icons-material';
3
- import { Box, IconButton, Typography } from '@mui/material';
3
+ import { Box, IconButton, Tooltip, Typography } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { Route, Routes, useLocation } from 'react-router-dom';
6
6
  import { useNavigateBack } from '../../hooks';
@@ -46,5 +46,5 @@ export const NavigationHeader = () => {
46
46
  return t(`header.swap`);
47
47
  }
48
48
  };
49
- return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "start", onClick: navigateBack }, { children: _jsx(ArrowBackIcon, {}) }))) : null, _jsx(Typography, Object.assign({ fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true }, { children: handleHeaderTitle() })), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive ? (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "swap-history", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory) }, { children: _jsx(HistoryIcon, {}) }))) : null, _jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: () => navigate(navigationRoutes.settings) }, { children: _jsx(SettingsIcon, {}) }))] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] })));
49
+ return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, Object.assign({ size: "medium", edge: "start", onClick: navigateBack }, { children: _jsx(ArrowBackIcon, {}) }))) : null, _jsx(Typography, Object.assign({ fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true }, { children: handleHeaderTitle() })), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive ? (_jsx(Tooltip, Object.assign({ title: t(`header.swapHistory`), enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: _jsx(IconButton, Object.assign({ size: "medium", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory) }, { children: _jsx(HistoryIcon, {}) })) }))) : null, _jsx(Tooltip, Object.assign({ title: t(`header.settings`), enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: _jsx(IconButton, Object.assign({ size: "medium", edge: "end", onClick: () => navigate(navigationRoutes.settings) }, { children: _jsx(SettingsIcon, {}) })) }))] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] })));
50
50
  };
@@ -23,7 +23,7 @@ export const WalletHeader = () => {
23
23
  display: 'flex',
24
24
  flex: 1,
25
25
  flexDirection: 'column',
26
- }, mr: 0.5 }, { children: [_jsx(Typography, Object.assign({ variant: "caption", align: "right" }, { children: t(`header.walletConnected`) })), _jsx(Typography, Object.assign({ variant: "body2", align: "right", fontWeight: "600" }, { children: walletAddress }))] })), _jsx(IconButton, Object.assign({ size: "medium", "aria-label": "disconnect", edge: "end", onClick: disconnect }, { children: _jsx(LogoutIcon, {}) }))] })) : (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "body2", align: "right", fontWeight: "600", flex: 1, mr: 0.5 }, { children: t(`header.connectWallet`) })), _jsx(ConnectButton, {})] })) })));
26
+ }, mr: 0.5 }, { children: [_jsx(Typography, Object.assign({ variant: "caption", align: "right" }, { children: t(`header.walletConnected`) })), _jsx(Typography, Object.assign({ variant: "body2", align: "right", fontWeight: "600" }, { children: walletAddress }))] })), _jsx(IconButton, Object.assign({ size: "medium", edge: "end", onClick: disconnect }, { children: _jsx(LogoutIcon, {}) }))] })) : (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ variant: "body2", align: "right", fontWeight: "600", flex: 1, mr: 0.5 }, { children: t(`header.connectWallet`) })), _jsx(ConnectButton, {})] })) })));
27
27
  };
28
28
  const ConnectButton = () => {
29
29
  const { pathname } = useLocation();
@@ -37,5 +37,5 @@ const ConnectButton = () => {
37
37
  }
38
38
  navigate(navigationRoutes.selectWallet);
39
39
  });
40
- return (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "disconnect", edge: "end", onClick: !pathname.includes(navigationRoutes.selectWallet) ? connect : undefined }, { children: _jsx(WalletOutlinedIcon, {}) })));
40
+ return (_jsx(IconButton, Object.assign({ size: "medium", edge: "end", onClick: !pathname.includes(navigationRoutes.selectWallet) ? connect : undefined }, { children: _jsx(WalletOutlinedIcon, {}) })));
41
41
  };
@@ -15,5 +15,5 @@ export const PoweredBy = () => {
15
15
  display: 'flex',
16
16
  alignItems: 'flex-end',
17
17
  justifyContent: 'flex-end',
18
- } }, { children: _jsx(Tooltip, Object.assign({ title: `v${version}`, placement: "top", enterDelay: 5000, 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 } })] })) })) })));
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 } })] })) })) })));
19
19
  };
@@ -39,7 +39,7 @@ export const ProgressToNextUpdate = (_a) => {
39
39
  }, [isLoading]);
40
40
  return (_jsx(IconButton, Object.assign({ onClick: onClick, disabled: isLoading }, other, { children: _jsx(Tooltip, Object.assign({ title: t('tooltip.progressToNextUpdate', {
41
41
  value: getSecondsToUpdate(updatedAt, timeToUpdate),
42
- }), placement: "top", enterDelay: 250, arrow: true }, { children: _jsxs(Box, Object.assign({ sx: {
42
+ }), placement: "top", enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: _jsxs(Box, Object.assign({ sx: {
43
43
  display: 'grid',
44
44
  position: 'relative',
45
45
  placeItems: 'center',
@@ -12,11 +12,11 @@ export const ReverseTokensButton = ({ vertical, }) => {
12
12
  SwapFormKey.ToChain,
13
13
  SwapFormKey.ToToken,
14
14
  ]);
15
- setValue(SwapFormKey.FromAmount, '');
16
- setValue(SwapFormKey.FromChain, toChain);
17
- setValue(SwapFormKey.FromToken, toToken);
18
- setValue(SwapFormKey.ToChain, fromChain);
19
- setValue(SwapFormKey.ToToken, fromToken);
15
+ setValue(SwapFormKey.FromAmount, '', { shouldTouch: true });
16
+ setValue(SwapFormKey.FromChain, toChain, { shouldTouch: true });
17
+ setValue(SwapFormKey.FromToken, toToken, { shouldTouch: true });
18
+ setValue(SwapFormKey.ToChain, fromChain, { shouldTouch: true });
19
+ setValue(SwapFormKey.ToToken, fromToken, { shouldTouch: true });
20
20
  };
21
- return (_jsx(IconButton, Object.assign({ onClick: handleClick, size: "small", "aria-label": "swap-destinations" }, { children: vertical ? _jsx(SwapVertIcon, {}) : _jsx(SwapHorizIcon, {}) })));
21
+ return (_jsx(IconButton, Object.assign({ onClick: handleClick, size: "small" }, { children: vertical ? _jsx(SwapVertIcon, {}) : _jsx(SwapHorizIcon, {}) })));
22
22
  };
@@ -15,7 +15,7 @@ export declare const SelectTokenCardHeader: import("@emotion/styled").StyledComp
15
15
  }> | undefined;
16
16
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
17
17
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
18
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "avatar" | "disableTypography" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
18
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "disableTypography" | "avatar" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
19
19
  selected?: boolean | undefined;
20
20
  compact?: boolean | undefined;
21
21
  }, {}, {}>;
@@ -1,3 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { BoxProps } from '@mui/material';
3
3
  export declare const SendToWallet: React.FC<BoxProps>;
4
+ export declare const SendToWalletFormHelperText: React.FC;
@@ -11,18 +11,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  import { isAddress } from '@ethersproject/address';
12
12
  import { Collapse, FormHelperText } from '@mui/material';
13
13
  import { forwardRef, useEffect } from 'react';
14
- import { useFormContext } from 'react-hook-form';
14
+ import { useFormContext, useFormState } from 'react-hook-form';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { SwapFormKey, useWallet } from '../../providers';
17
17
  import { Card, CardTitle } from '../Card';
18
18
  import { FormControl, Input } from './SendToWallet.style';
19
19
  import { useSendToWalletStore } from './store';
20
20
  export const SendToWallet = forwardRef((props, ref) => {
21
- var _a;
22
21
  const { t } = useTranslation();
23
22
  const showSendToWallet = useSendToWalletStore((state) => state.showSendToWallet);
24
23
  const { account, provider } = useWallet();
25
- const { register, trigger, formState: { errors }, } = useFormContext();
24
+ const { register, trigger } = useFormContext();
26
25
  useEffect(() => {
27
26
  trigger(SwapFormKey.ToAddress);
28
27
  }, [account.chainId, trigger]);
@@ -36,11 +35,16 @@ export const SendToWallet = forwardRef((props, ref) => {
36
35
  return (isAddress(address || value) ||
37
36
  t('swap.error.title.walletAddressInvalid'));
38
37
  }
39
- catch (_b) {
38
+ catch (_a) {
40
39
  return t('swap.error.title.walletEnsAddressInvalid');
41
40
  }
42
41
  }),
43
42
  onBlur: () => trigger(SwapFormKey.ToAddress),
44
43
  });
45
- return (_jsx(Collapse, Object.assign({ timeout: 225, unmountOnExit: true, mountOnEnter: true, in: showSendToWallet }, { 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'), autoFocus: true }), _jsx(FormHelperText, Object.assign({ error: !!errors.toAddress }, { children: (_a = errors.toAddress) === null || _a === void 0 ? void 0 : _a.message }))] }))] })) })));
44
+ 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'), autoFocus: true }), _jsx(SendToWalletFormHelperText, {})] }))] })) })));
46
45
  });
46
+ export const SendToWalletFormHelperText = () => {
47
+ var _a;
48
+ const { errors } = useFormState();
49
+ return (_jsx(FormHelperText, Object.assign({ error: !!errors.toAddress }, { children: (_a = errors.toAddress) === null || _a === void 0 ? void 0 : _a.message })));
50
+ };
@@ -17,11 +17,11 @@ export const SendToWalletButton = () => {
17
17
  }
18
18
  const handleClick = () => {
19
19
  if (showSendToWallet) {
20
- setValue(SwapFormKey.ToAddress, '');
20
+ setValue(SwapFormKey.ToAddress, '', { shouldTouch: true });
21
21
  }
22
22
  toggleSendToWallet();
23
23
  };
24
- return (_jsx(Tooltip, Object.assign({ title: t('swap.sendToWallet'), placement: "bottom-end", enterDelay: 500, enterNextDelay: 500, arrow: true }, { children: _jsx(Button, Object.assign({ variant: showSendToWallet ? 'contained' : 'text', onClick: handleClick, sx: {
24
+ return (_jsx(Tooltip, Object.assign({ title: t('swap.sendToWallet'), placement: "bottom-end", enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: _jsx(Button, Object.assign({ variant: showSendToWallet ? 'contained' : 'text', onClick: handleClick, sx: {
25
25
  minWidth: 48,
26
26
  marginLeft: 1,
27
27
  } }, { children: _jsx(WalletOutlinedIcon, {}) })) })));
@@ -13,5 +13,5 @@ export const StepProcess = ({ step, process }) => {
13
13
  display: 'flex',
14
14
  flex: 1,
15
15
  justifyContent: 'flex-end',
16
- } }, { children: _jsx(LinkButton, Object.assign({ size: "small", "aria-label": "settings", edge: "end", LinkComponent: Link, href: process.txLink, target: "_blank", rel: "nofollow noreferrer" }, { children: _jsx(LinkIcon, {}) })) }))) : null] })), message ? (_jsx(Typography, Object.assign({ ml: 6, fontSize: 14, fontWeight: 500, color: "text.secondary" }, { children: message }))) : null] })));
16
+ } }, { children: _jsx(LinkButton, Object.assign({ size: "small", edge: "end", LinkComponent: Link, href: process.txLink, target: "_blank", rel: "nofollow noreferrer" }, { children: _jsx(LinkIcon, {}) })) }))) : null] })), message ? (_jsx(Typography, Object.assign({ ml: 6, fontSize: 14, fontWeight: 500, color: "text.secondary" }, { children: message }))) : null] })));
17
17
  };
@@ -8,19 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
- import { Button } from '@mui/material';
11
+ import { LoadingButton } from '@mui/lab';
12
12
  import { forwardRef } from 'react';
13
13
  import { useTranslation } from 'react-i18next';
14
14
  import { useNavigate } from 'react-router-dom';
15
15
  import { useGasSufficiency } from '../../hooks';
16
16
  import { useWallet, useWidgetConfig } from '../../providers';
17
17
  import { navigationRoutes } from '../../utils';
18
- export const SwapButton = forwardRef(({ onClick, currentRoute, text, disable }, ref) => {
18
+ export const SwapButton = forwardRef(({ onClick, currentRoute, text, disable, enableLoading, loading }, ref) => {
19
19
  const { t } = useTranslation();
20
20
  const navigate = useNavigate();
21
21
  const config = useWidgetConfig();
22
22
  const { account, connect } = useWallet();
23
- const { insufficientFunds, insufficientGas } = useGasSufficiency(currentRoute);
23
+ const { insufficientFunds, insufficientGas, isLoading: isGasSufficiencyLoading, } = useGasSufficiency(currentRoute);
24
24
  const handleSwapButtonClick = () => __awaiter(void 0, void 0, void 0, function* () {
25
25
  if (!account.isActive) {
26
26
  if (config.walletManagement) {
@@ -43,5 +43,5 @@ export const SwapButton = forwardRef(({ onClick, currentRoute, text, disable },
43
43
  }
44
44
  return t(`button.connectWallet`);
45
45
  };
46
- return (_jsx(Button, Object.assign({ variant: "contained", color: account.isActive ? 'primary' : 'success', onClick: handleSwapButtonClick, disabled: insufficientFunds || !!(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) || disable, fullWidth: true, ref: ref }, { children: getButtonText() })));
46
+ return (_jsx(LoadingButton, Object.assign({ variant: "contained", color: account.isActive ? 'primary' : 'success', onClick: handleSwapButtonClick, disabled: insufficientFunds || !!(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) || disable, loading: enableLoading && (loading || isGasSufficiencyLoading), loadingPosition: "center", fullWidth: true, ref: ref }, { children: getButtonText() })));
47
47
  });
@@ -4,4 +4,6 @@ export interface SwapButtonProps {
4
4
  currentRoute?: Route;
5
5
  text?: string;
6
6
  disable?: boolean;
7
+ loading?: boolean;
8
+ enableLoading?: boolean;
7
9
  }
@@ -27,11 +27,15 @@ export const SwapInput = ({ formType }) => {
27
27
  const isSelected = !!(chain && token);
28
28
  const handleChange = (event) => {
29
29
  const { value } = event.target;
30
- setValue(amountKey, formatAmount(value, true));
30
+ const formattedAmount = formatAmount(value, true);
31
+ setValue(amountKey, formattedAmount, {
32
+ shouldTouch: true,
33
+ });
31
34
  };
32
35
  const handleBlur = (event) => {
33
36
  const { value } = event.target;
34
- setValue(amountKey, formatAmount(value));
37
+ const formattedAmount = formatAmount(value);
38
+ setValue(amountKey, formattedAmount);
35
39
  };
36
40
  useLayoutEffect(() => {
37
41
  fitInputText(maxInputFontSize, minInputFontSize, ref.current);
@@ -17,7 +17,9 @@ export const SwapInputAdornment = ({ formType }) => {
17
17
  const { token, isLoading } = useTokenAddressBalance(chainId, tokenAddress);
18
18
  const handleMax = () => {
19
19
  var _a;
20
- setValue(SwapFormKeyHelper.getAmountKey(formType), (_a = token === null || token === void 0 ? void 0 : token.amount) !== null && _a !== void 0 ? _a : '');
20
+ setValue(SwapFormKeyHelper.getAmountKey(formType), (_a = token === null || token === void 0 ? void 0 : token.amount) !== null && _a !== void 0 ? _a : '', {
21
+ shouldTouch: true,
22
+ });
21
23
  };
22
- return (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: isLoading && tokenAddress ? (_jsx(Skeleton, { variant: "rectangular", width: 46, height: 20, sx: { borderRadius: 0.5 } })) : formType === 'from' && (token === null || token === void 0 ? void 0 : token.amount) ? (_jsx(Button, Object.assign({ onClick: handleMax, variant: "outlined" }, { children: t('button.max') }))) : null })));
24
+ return (_jsx(InputAdornment, Object.assign({ position: "end" }, { children: isLoading && tokenAddress ? (_jsx(Skeleton, { variant: "rectangular", width: 46, height: 20, sx: { borderRadius: 0.5 } })) : formType === 'from' && (token === null || token === void 0 ? void 0 : token.amount) ? (_jsx(Button, Object.assign({ onClick: handleMax }, { children: t('button.max') }))) : null })));
23
25
  };