@lifi/widget 1.18.8 → 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 (173) 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 +8 -4
  33. package/cjs/components/SwapRoutes/SwapRoutes.js +4 -4
  34. package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +14 -14
  35. package/cjs/components/SwapRoutes/SwapRoutes.style.js +13 -13
  36. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
  37. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +17 -12
  38. package/cjs/components/SwapRoutes/useSetRecommendedRoute.d.ts +2 -0
  39. package/cjs/components/SwapRoutes/useSetRecommendedRoute.js +13 -0
  40. package/cjs/components/Token/Token.js +5 -5
  41. package/cjs/components/Token/Token.style.d.ts +10 -0
  42. package/cjs/components/Token/Token.style.js +13 -7
  43. package/cjs/components/TokenList/TokenList.js +10 -7
  44. package/cjs/config/theme.js +22 -8
  45. package/cjs/config/version.d.ts +1 -1
  46. package/cjs/config/version.js +1 -1
  47. package/cjs/hooks/index.d.ts +1 -0
  48. package/cjs/hooks/index.js +1 -0
  49. package/cjs/hooks/useExpandableVariant.d.ts +1 -0
  50. package/cjs/hooks/useExpandableVariant.js +14 -0
  51. package/cjs/hooks/useGasSufficiency.d.ts +3 -2
  52. package/cjs/hooks/useGasSufficiency.js +50 -26
  53. package/cjs/hooks/useSwapRoutes.js +4 -2
  54. package/cjs/hooks/useToken.js +5 -2
  55. package/cjs/hooks/useTokenBalance.js +15 -10
  56. package/cjs/hooks/useTokenSearch.d.ts +1 -3
  57. package/cjs/hooks/useTokenSearch.js +3 -5
  58. package/cjs/i18n/en/translation.json +9 -8
  59. package/cjs/i18n/index.d.ts +6 -5
  60. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +21 -4
  61. package/cjs/pages/MainPage/MainPage.js +3 -3
  62. package/cjs/pages/SelectWalletPage/SelectWalletPage.js +1 -1
  63. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
  64. package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  65. package/cjs/pages/SwapPage/StatusBottomSheet.js +4 -4
  66. package/cjs/pages/SwapPage/SwapPage.js +4 -4
  67. package/cjs/providers/SwapFormProvider/SwapFormProvider.js +3 -2
  68. package/cjs/providers/SwapFormProvider/URLSearchParamsBuilder.d.ts +1 -0
  69. package/cjs/providers/SwapFormProvider/URLSearchParamsBuilder.js +46 -0
  70. package/cjs/providers/SwapFormProvider/types.d.ts +4 -4
  71. package/cjs/providers/SwapFormProvider/types.js +2 -2
  72. package/cjs/providers/WalletProvider/WalletFormUpdate.d.ts +5 -0
  73. package/cjs/providers/WalletProvider/WalletFormUpdate.js +64 -0
  74. package/cjs/providers/WalletProvider/WalletProvider.js +3 -58
  75. package/cjs/providers/WidgetProvider/WidgetProvider.js +12 -5
  76. package/cjs/stores/routes/index.d.ts +1 -1
  77. package/cjs/stores/routes/index.js +1 -1
  78. package/cjs/stores/routes/types.d.ts +4 -4
  79. package/cjs/stores/routes/useRecommendedRouteStore.d.ts +4 -0
  80. package/cjs/stores/routes/{useSelectedRouteStore.js → useRecommendedRouteStore.js} +4 -4
  81. package/cjs/stores/routes/useRouteExecutionStore.js +10 -2
  82. package/cjs/stores/settings/useSettingsStore.js +5 -2
  83. package/cjs/types/widget.d.ts +1 -0
  84. package/components/ActiveSwaps/ActiveSwaps.js +3 -3
  85. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +0 -14
  86. package/components/ActiveSwaps/ActiveSwaps.style.js +1 -9
  87. package/components/AppContainer.d.ts +11 -1
  88. package/components/AppContainer.js +2 -4
  89. package/components/BottomSheet/BottomSheet.js +9 -32
  90. package/components/BottomSheet/types.d.ts +2 -2
  91. package/components/Card/Card.js +1 -1
  92. package/components/Card/CardHeader.d.ts +1 -1
  93. package/components/ChainSelect/ChainSelect.js +1 -1
  94. package/components/ChainSelect/useChainSelect.js +2 -4
  95. package/components/Dialog.d.ts +22 -1
  96. package/components/Dialog.js +22 -19
  97. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +21 -24
  98. package/components/Header/NavigationHeader.js +2 -2
  99. package/components/Header/WalletHeader.js +2 -2
  100. package/components/PoweredBy/PoweredBy.js +1 -1
  101. package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +1 -1
  102. package/components/ReverseTokensButton/ReverseTokensButton.js +6 -6
  103. package/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
  104. package/components/SendToWallet/SendToWallet.d.ts +1 -0
  105. package/components/SendToWallet/SendToWallet.js +9 -5
  106. package/components/SendToWallet/SendToWalletButton.js +2 -2
  107. package/components/Step/StepProcess.js +1 -1
  108. package/components/SwapButton/SwapButton.js +4 -4
  109. package/components/SwapButton/types.d.ts +2 -0
  110. package/components/SwapInput/SwapInput.js +6 -2
  111. package/components/SwapInput/SwapInputAdornment.js +4 -2
  112. package/components/SwapInput/SwapInputAdornment.style.js +2 -14
  113. package/components/SwapRouteCard/SwapRouteCard.js +9 -5
  114. package/components/SwapRoutes/SwapRoutes.js +4 -4
  115. package/components/SwapRoutes/SwapRoutes.style.d.ts +14 -14
  116. package/components/SwapRoutes/SwapRoutes.style.js +13 -13
  117. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +1 -0
  118. package/components/SwapRoutes/SwapRoutesExpanded.js +16 -12
  119. package/components/SwapRoutes/useSetRecommendedRoute.d.ts +2 -0
  120. package/components/SwapRoutes/useSetRecommendedRoute.js +9 -0
  121. package/components/Token/Token.js +7 -7
  122. package/components/Token/Token.style.d.ts +10 -0
  123. package/components/Token/Token.style.js +12 -6
  124. package/components/TokenList/TokenList.js +10 -7
  125. package/config/theme.js +22 -8
  126. package/config/version.d.ts +1 -1
  127. package/config/version.js +1 -1
  128. package/hooks/index.d.ts +1 -0
  129. package/hooks/index.js +1 -0
  130. package/hooks/useExpandableVariant.d.ts +1 -0
  131. package/hooks/useExpandableVariant.js +10 -0
  132. package/hooks/useGasSufficiency.d.ts +3 -2
  133. package/hooks/useGasSufficiency.js +50 -26
  134. package/hooks/useSwapRoutes.js +4 -2
  135. package/hooks/useToken.js +5 -2
  136. package/hooks/useTokenBalance.js +15 -10
  137. package/hooks/useTokenSearch.d.ts +1 -3
  138. package/hooks/useTokenSearch.js +3 -5
  139. package/i18n/en/translation.json +9 -8
  140. package/i18n/index.d.ts +6 -5
  141. package/package.json +11 -11
  142. package/pages/ActiveSwapsPage/ActiveSwapsPage.js +24 -7
  143. package/pages/MainPage/MainPage.js +3 -3
  144. package/pages/SelectWalletPage/SelectWalletPage.js +1 -1
  145. package/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
  146. package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  147. package/pages/SwapPage/StatusBottomSheet.js +4 -4
  148. package/pages/SwapPage/SwapPage.js +5 -5
  149. package/providers/SwapFormProvider/SwapFormProvider.js +4 -3
  150. package/providers/SwapFormProvider/URLSearchParamsBuilder.d.ts +1 -0
  151. package/providers/SwapFormProvider/URLSearchParamsBuilder.js +42 -0
  152. package/providers/SwapFormProvider/types.d.ts +4 -4
  153. package/providers/SwapFormProvider/types.js +2 -2
  154. package/providers/WalletProvider/WalletFormUpdate.d.ts +5 -0
  155. package/providers/WalletProvider/WalletFormUpdate.js +60 -0
  156. package/providers/WalletProvider/WalletProvider.js +5 -60
  157. package/providers/WidgetProvider/WidgetProvider.js +12 -5
  158. package/stores/routes/index.d.ts +1 -1
  159. package/stores/routes/index.js +1 -1
  160. package/stores/routes/types.d.ts +4 -4
  161. package/stores/routes/useRecommendedRouteStore.d.ts +4 -0
  162. package/stores/routes/useRecommendedRouteStore.js +9 -0
  163. package/stores/routes/useRouteExecutionStore.js +10 -2
  164. package/stores/settings/useSettingsStore.js +5 -2
  165. package/tsconfig.cjs.tsbuildinfo +1 -1
  166. package/types/widget.d.ts +1 -0
  167. package/cjs/components/SwapRoutes/useSetSelectedRoute.d.ts +0 -2
  168. package/cjs/components/SwapRoutes/useSetSelectedRoute.js +0 -13
  169. package/cjs/stores/routes/useSelectedRouteStore.d.ts +0 -4
  170. package/components/SwapRoutes/useSetSelectedRoute.d.ts +0 -2
  171. package/components/SwapRoutes/useSetSelectedRoute.js +0 -9
  172. package/stores/routes/useSelectedRouteStore.d.ts +0 -4
  173. package/stores/routes/useSelectedRouteStore.js +0 -9
package/App.js CHANGED
@@ -6,11 +6,11 @@ import { Header } from './components/Header';
6
6
  import { Initializer } from './components/Initializer';
7
7
  import { PoweredBy } from './components/PoweredBy';
8
8
  import { SwapRoutesExpanded } from './components/SwapRoutes';
9
- import { useWidgetConfig } from './providers';
9
+ import { useExpandableVariant } from './hooks';
10
10
  export const App = ({ config }) => {
11
11
  return (_jsx(AppProvider, Object.assign({ config: config }, { children: _jsx(AppDefault, {}) })));
12
12
  };
13
13
  export const AppDefault = () => {
14
- const { variant } = useWidgetConfig();
15
- return (_jsxs(AppExpandedContainer, { children: [_jsxs(AppContainer, { children: [_jsx(Header, {}), _jsx(FlexContainer, Object.assign({ disableGutters: true }, { children: _jsx(AppRoutes, {}) })), _jsx(PoweredBy, {}), _jsx(Initializer, {})] }), variant === 'expandable' ? _jsx(SwapRoutesExpanded, {}) : null] }));
14
+ const expandable = useExpandableVariant();
15
+ return (_jsxs(AppExpandedContainer, { children: [_jsxs(AppContainer, { children: [_jsx(Header, {}), _jsx(FlexContainer, Object.assign({ disableGutters: true }, { children: _jsx(AppRoutes, {}) })), _jsx(PoweredBy, {}), _jsx(Initializer, {})] }), expandable ? _jsx(SwapRoutesExpanded, {}) : null] }));
16
16
  };
package/cjs/App.js CHANGED
@@ -9,13 +9,13 @@ const Header_1 = require("./components/Header");
9
9
  const Initializer_1 = require("./components/Initializer");
10
10
  const PoweredBy_1 = require("./components/PoweredBy");
11
11
  const SwapRoutes_1 = require("./components/SwapRoutes");
12
- const providers_1 = require("./providers");
12
+ const hooks_1 = require("./hooks");
13
13
  const App = ({ config }) => {
14
14
  return ((0, jsx_runtime_1.jsx)(AppProvider_1.AppProvider, Object.assign({ config: config }, { children: (0, jsx_runtime_1.jsx)(exports.AppDefault, {}) })));
15
15
  };
16
16
  exports.App = App;
17
17
  const AppDefault = () => {
18
- const { variant } = (0, providers_1.useWidgetConfig)();
19
- return ((0, jsx_runtime_1.jsxs)(AppContainer_1.AppExpandedContainer, { children: [(0, jsx_runtime_1.jsxs)(AppContainer_1.AppContainer, { children: [(0, jsx_runtime_1.jsx)(Header_1.Header, {}), (0, jsx_runtime_1.jsx)(AppContainer_1.FlexContainer, Object.assign({ disableGutters: true }, { children: (0, jsx_runtime_1.jsx)(AppRoutes_1.AppRoutes, {}) })), (0, jsx_runtime_1.jsx)(PoweredBy_1.PoweredBy, {}), (0, jsx_runtime_1.jsx)(Initializer_1.Initializer, {})] }), variant === 'expandable' ? (0, jsx_runtime_1.jsx)(SwapRoutes_1.SwapRoutesExpanded, {}) : null] }));
18
+ const expandable = (0, hooks_1.useExpandableVariant)();
19
+ return ((0, jsx_runtime_1.jsxs)(AppContainer_1.AppExpandedContainer, { children: [(0, jsx_runtime_1.jsxs)(AppContainer_1.AppContainer, { children: [(0, jsx_runtime_1.jsx)(Header_1.Header, {}), (0, jsx_runtime_1.jsx)(AppContainer_1.FlexContainer, Object.assign({ disableGutters: true }, { children: (0, jsx_runtime_1.jsx)(AppRoutes_1.AppRoutes, {}) })), (0, jsx_runtime_1.jsx)(PoweredBy_1.PoweredBy, {}), (0, jsx_runtime_1.jsx)(Initializer_1.Initializer, {})] }), expandable ? (0, jsx_runtime_1.jsx)(SwapRoutes_1.SwapRoutesExpanded, {}) : null] }));
20
20
  };
21
21
  exports.AppDefault = AppDefault;
@@ -23,7 +23,7 @@ const ActiveSwaps = (props) => {
23
23
  navigate(utils_1.navigationRoutes.activeSwaps);
24
24
  };
25
25
  const hasShowAll = (executingRoutes === null || executingRoutes === void 0 ? void 0 : executingRoutes.length) > 2;
26
- return ((0, jsx_runtime_1.jsxs)(ActiveSwaps_style_1.ProgressCard, Object.assign({}, props, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('header.activeSwaps') }), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ spacing: 1.5, pt: 1.5, pb: hasShowAll ? 0 : 2 }, { children: executingRoutes.slice(0, 2).map((routeId) => ((0, jsx_runtime_1.jsx)(ActiveSwapItem_1.ActiveSwapItem, { routeId: routeId, dense: true }, routeId))) })), hasShowAll ? ((0, jsx_runtime_1.jsx)(ActiveSwaps_style_1.ShowAllButton, Object.assign({ disableRipple: true, fullWidth: true, onClick: handleShowAll, sx: (theme) => ({
26
+ return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ variant: "selected", selectionColor: "secondary" }, props, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('header.activeSwaps') }), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ spacing: 1.5, pt: 1.5, pb: hasShowAll ? 0 : 2 }, { children: executingRoutes.slice(0, 2).map((routeId) => ((0, jsx_runtime_1.jsx)(ActiveSwapItem_1.ActiveSwapItem, { routeId: routeId, dense: true }, routeId))) })), hasShowAll ? ((0, jsx_runtime_1.jsx)(ActiveSwaps_style_1.ShowAllButton, Object.assign({ disableRipple: true, fullWidth: true, onClick: handleShowAll, sx: (theme) => ({
27
27
  padding: theme.spacing(0.75, 2),
28
28
  }) }, { children: t('button.showAll') }))) : null] })));
29
29
  };
@@ -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,18 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ShowAllButton = exports.ListItem = exports.ListItemButton = exports.ProgressCard = void 0;
3
+ exports.ShowAllButton = exports.ListItem = exports.ListItemButton = void 0;
4
4
  const material_1 = require("@mui/material");
5
5
  const ListItemSecondaryAction_1 = require("@mui/material/ListItemSecondaryAction");
6
6
  const styles_1 = require("@mui/material/styles");
7
7
  const utils_1 = require("../../utils");
8
- const Card_1 = require("../Card");
9
- exports.ProgressCard = (0, styles_1.styled)(Card_1.Card)(({ theme }) => ({
10
- borderColor: (0, styles_1.alpha)(theme.palette.secondary.main, 0.48),
11
- background: (0, styles_1.alpha)(theme.palette.secondary.main, 0.08),
12
- '&:hover': {
13
- background: (0, styles_1.alpha)(theme.palette.secondary.main, 0.08),
14
- },
15
- }));
16
8
  exports.ListItemButton = (0, styles_1.styled)(material_1.ListItemButton)(({ theme }) => ({
17
9
  borderRadius: theme.shape.borderRadiusSecondary,
18
10
  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<{}>>;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppExpandedContainer = exports.AppContainer = exports.FlexContainer = exports.maxHeight = void 0;
3
+ exports.AppContainer = exports.FlexContainer = exports.AppExpandedContainer = exports.maxHeight = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
6
  const styles_1 = require("@mui/material/styles");
7
7
  const providers_1 = require("../providers");
8
8
  const utils_1 = require("../utils");
9
9
  exports.maxHeight = 680;
10
- const ExpandedContainer = (0, styles_1.styled)(material_1.Box, {
10
+ exports.AppExpandedContainer = (0, styles_1.styled)(material_1.Box, {
11
11
  shouldForwardProp: (prop) => prop !== 'variant',
12
12
  })(({ variant }) => ({
13
13
  display: 'flex',
@@ -33,6 +33,7 @@ const RelativeContainer = (0, styles_1.styled)(material_1.Box, {
33
33
  const CssBaselineContainer = (0, styles_1.styled)(material_1.ScopedCssBaseline, {
34
34
  shouldForwardProp: (prop) => prop !== 'variant',
35
35
  })(({ variant }) => ({
36
+ position: 'relative',
36
37
  display: 'flex',
37
38
  flex: 1,
38
39
  flexDirection: 'column',
@@ -54,7 +55,3 @@ const AppContainer = ({ children }) => {
54
55
  return ((0, jsx_runtime_1.jsx)(RelativeContainer, Object.assign({ sx: containerStyle, variant: variant }, { children: (0, jsx_runtime_1.jsx)(CssBaselineContainer, Object.assign({ id: utils_1.ElementId.ScrollableContainer, variant: variant, enableColorScheme: true }, { children: (0, jsx_runtime_1.jsx)(exports.FlexContainer, Object.assign({ disableGutters: true }, { children: children })) })) })));
55
56
  };
56
57
  exports.AppContainer = AppContainer;
57
- const AppExpandedContainer = ({ children, }) => {
58
- return (0, jsx_runtime_1.jsx)(ExpandedContainer, { children: children });
59
- };
60
- exports.AppExpandedContainer = AppExpandedContainer;
@@ -4,44 +4,21 @@ exports.BottomSheet = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
6
  const react_1 = require("react");
7
- const hooks_1 = require("../../hooks");
7
+ const Dialog_1 = require("../Dialog");
8
8
  exports.BottomSheet = (0, react_1.forwardRef)(({ elementRef, children, open }, ref) => {
9
9
  const openRef = (0, react_1.useRef)(open);
10
10
  const [drawerOpen, setDrawerOpen] = (0, react_1.useState)(open);
11
- const containerElement = (0, hooks_1.useScrollableContainer)();
12
- const openDrawer = (0, react_1.useCallback)(() => {
13
- setDrawerOpen(true);
14
- openRef.current = true;
15
- }, []);
16
- const closeDrawer = (0, react_1.useCallback)(() => {
11
+ const close = (0, react_1.useCallback)(() => {
17
12
  setDrawerOpen(false);
18
13
  openRef.current = false;
19
14
  }, []);
20
15
  (0, react_1.useImperativeHandle)(ref, () => ({
21
16
  isOpen: () => openRef.current,
22
- openDrawer,
23
- closeDrawer,
24
- }), [closeDrawer, openDrawer]);
25
- return ((0, jsx_runtime_1.jsx)(material_1.Drawer, Object.assign({ container: containerElement, ref: elementRef, anchor: "bottom", open: drawerOpen, onClose: closeDrawer, ModalProps: {
26
- sx: {
27
- position: 'absolute',
28
- overflow: 'hidden',
29
- },
30
- keepMounted: true,
31
- }, PaperProps: {
32
- sx: (theme) => ({
33
- position: 'absolute',
34
- backgroundImage: 'none',
35
- borderTopLeftRadius: theme.shape.borderRadius,
36
- borderTopRightRadius: theme.shape.borderRadius,
37
- }),
38
- }, BackdropProps: {
39
- sx: {
40
- position: 'absolute',
41
- backgroundColor: 'rgb(0 0 0 / 48%)',
42
- backdropFilter: 'blur(3px)',
43
- },
44
- }, SlideProps: {
45
- container: containerElement,
46
- } }, { children: children })));
17
+ open: () => {
18
+ setDrawerOpen(true);
19
+ openRef.current = true;
20
+ },
21
+ close,
22
+ }), [close]);
23
+ return ((0, jsx_runtime_1.jsx)(material_1.Drawer, Object.assign({ ref: elementRef, anchor: "bottom", open: drawerOpen, onClose: close, ModalProps: Dialog_1.modalProps, PaperProps: Dialog_1.paperProps, BackdropProps: Dialog_1.backdropProps, disableAutoFocus: true, disableEnforceFocus: true, disableScrollLock: true, disablePortal: true }, { children: children })));
47
24
  });
@@ -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
  }
@@ -8,7 +8,7 @@ const getBackgroundColor = (theme, variant, selectionColor) => variant === 'sele
8
8
  ? theme.palette.mode === 'light'
9
9
  ? (0, styles_1.alpha)(theme.palette.primary.main, 0.04)
10
10
  : (0, styles_1.alpha)(theme.palette.primary.main, 0.42)
11
- : (0, styles_1.alpha)(theme.palette.secondary.main, 0.08)
11
+ : (0, styles_1.alpha)(theme.palette.secondary.main, theme.palette.mode === 'light' ? 0.08 : 0.12)
12
12
  : theme.palette.background.paper;
13
13
  exports.Card = (0, styles_1.styled)(material_1.Box, {
14
14
  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>, {}, {}>;
@@ -25,7 +25,7 @@ const ChainSelect = ({ formType }) => {
25
25
  const chainsToHide = ((_a = chains === null || chains === void 0 ? void 0 : chains.length) !== null && _a !== void 0 ? _a : 0) - stores_1.maxChainToOrder;
26
26
  return ((0, jsx_runtime_1.jsxs)(ChainSelect_style_1.ChainContainer, { children: [isLoading
27
27
  ? Array.from({ length: stores_1.maxChainToOrder + 1 }).map((_, index) => ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 56, height: 56, sx: { borderRadius: 1 } }, index)))
28
- : getChains().map((chain) => ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: chain.name, placement: "top", enterDelay: 500, enterNextDelay: 500, arrow: true }, { children: (0, jsx_runtime_1.jsx)(ChainSelect_style_1.ChainCard, Object.assign({ onClick: () => setCurrentChain(chain.id), variant: chainId === chain.id ? 'selected' : 'default' }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ src: chain.logoURI, alt: chain.key, sx: { width: 40, height: 40 } }, { children: chain.name[0] })) })) }), chain.id))), chainsToHide > 0 ? ((0, jsx_runtime_1.jsx)(ChainSelect_style_1.ChainCard, Object.assign({ onClick: showAllChains }, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: {
28
+ : getChains().map((chain) => ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: chain.name, placement: "top", enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsx)(ChainSelect_style_1.ChainCard, Object.assign({ onClick: () => setCurrentChain(chain.id), variant: chainId === chain.id ? 'selected' : 'default' }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ src: chain.logoURI, alt: chain.key, sx: { width: 40, height: 40 } }, { children: chain.name[0] })) })) }), chain.id))), chainsToHide > 0 ? ((0, jsx_runtime_1.jsx)(ChainSelect_style_1.ChainCard, Object.assign({ onClick: showAllChains }, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: {
29
29
  width: 40,
30
30
  height: 40,
31
31
  display: 'grid',
@@ -20,10 +20,8 @@ const useChainSelect = (formType) => {
20
20
  return selectedChains;
21
21
  };
22
22
  const setCurrentChain = (chainId) => {
23
- setValue(chainKey, chainId, { shouldDirty: true });
24
- setValue(providers_1.SwapFormKeyHelper.getTokenKey(formType), '', {
25
- shouldDirty: false,
26
- });
23
+ setValue(chainKey, chainId, { shouldTouch: true });
24
+ setValue(providers_1.SwapFormKeyHelper.getTokenKey(formType), '');
27
25
  setValue(providers_1.SwapFormKeyHelper.getAmountKey(formType), '');
28
26
  setValue(providers_1.SwapFormKey.TokenSearchFilter, '');
29
27
  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,27 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Dialog = void 0;
3
+ exports.Dialog = exports.backdropProps = exports.paperProps = exports.modalProps = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
- const hooks_1 = require("../hooks");
6
+ exports.modalProps = {
7
+ sx: {
8
+ position: 'absolute',
9
+ overflow: 'hidden',
10
+ },
11
+ };
12
+ exports.paperProps = {
13
+ sx: (theme) => ({
14
+ position: 'absolute',
15
+ backgroundImage: 'none',
16
+ borderTopLeftRadius: theme.shape.borderRadius,
17
+ borderTopRightRadius: theme.shape.borderRadius,
18
+ }),
19
+ };
20
+ exports.backdropProps = {
21
+ sx: {
22
+ position: 'absolute',
23
+ backgroundColor: 'rgb(0 0 0 / 32%)',
24
+ backdropFilter: 'blur(3px)',
25
+ },
26
+ };
7
27
  const Dialog = ({ children, open, onClose, }) => {
8
- const containerElement = (0, hooks_1.useScrollableContainer)();
9
- return ((0, jsx_runtime_1.jsx)(material_1.Dialog, Object.assign({ open: open, onClose: onClose, container: containerElement, sx: {
10
- position: 'absolute',
11
- overflow: 'hidden',
12
- }, PaperProps: {
13
- sx: (theme) => ({
14
- position: 'absolute',
15
- backgroundImage: 'none',
16
- borderTopLeftRadius: theme.shape.borderRadius,
17
- borderTopRightRadius: theme.shape.borderRadius,
18
- }),
19
- }, BackdropProps: {
20
- sx: {
21
- position: 'absolute',
22
- backgroundColor: 'rgb(0 0 0 / 32%)',
23
- backdropFilter: 'blur(3px)',
24
- },
25
- } }, { children: children })));
28
+ return ((0, jsx_runtime_1.jsx)(material_1.Dialog, Object.assign({ open: open, onClose: onClose, sx: exports.modalProps.sx, PaperProps: exports.paperProps, BackdropProps: exports.backdropProps, disableAutoFocus: true, disableEnforceFocus: true, disableScrollLock: true, disablePortal: true }, { children: children })));
26
29
  };
27
30
  exports.Dialog = Dialog;
@@ -23,27 +23,24 @@ const GasSufficiencyMessage_style_1 = require("./GasSufficiencyMessage.style");
23
23
  const GasSufficiencyMessage = (_a) => {
24
24
  var { route } = _a, props = __rest(_a, ["route"]);
25
25
  const { t } = (0, react_i18next_1.useTranslation)();
26
- const selectedRoute = (0, stores_1.useSelectedRouteStore)((state) => state.selectedRoute);
27
- const { insufficientFunds, insufficientGas } = (0, hooks_1.useGasSufficiency)(route !== null && route !== void 0 ? route : selectedRoute);
28
- if (!insufficientFunds && !(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length)) {
29
- return null;
30
- }
31
- return ((0, jsx_runtime_1.jsxs)(GasSufficiencyMessage_style_1.MessageCard, Object.assign({}, props, { children: [(0, jsx_runtime_1.jsx)(icons_material_1.WarningAmber, { sx: {
32
- marginTop: 2,
33
- marginLeft: 2,
34
- } }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? ((0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`swap.warning.title.insufficientGas`) })) : null, insufficientFunds ? ((0, jsx_runtime_1.jsx)(material_1.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
35
- ? t(`swap.warning.message.insufficientFunds`)
36
- : null }))) : null, (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? ((0, jsx_runtime_1.jsx)(material_1.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)
37
- ? insufficientGas.map((item, index) => {
38
- var _a, _b;
39
- return ((0, jsx_runtime_1.jsx)(material_1.Typography
40
- // eslint-disable-next-line react/no-array-index-key
41
- , Object.assign({ variant: "body2", px: 2, pb: insufficientGas.length - 1 === index ? 2 : 0, pt: 0.5 }, { children: t(`swap.tokenOnChainAmount`, {
42
- amount: (_a = item.insufficientAmount) === null || _a === void 0 ? void 0 : _a.toString(),
43
- tokenSymbol: item.token.symbol,
44
- chainName: (_b = item.chain) === null || _b === void 0 ? void 0 : _b.name,
45
- }) }), index));
46
- })
47
- : null] })] })));
26
+ const recommendedRoute = (0, stores_1.useRecommendedRouteStore)((state) => state.recommendedRoute);
27
+ const { insufficientFunds, insufficientGas } = (0, hooks_1.useGasSufficiency)(route !== null && route !== void 0 ? route : recommendedRoute);
28
+ return ((0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ timeout: 225, in: Boolean(insufficientFunds || (insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length)), unmountOnExit: true, mountOnEnter: true, appear: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({}, props, { children: (0, jsx_runtime_1.jsxs)(GasSufficiencyMessage_style_1.MessageCard, { children: [(0, jsx_runtime_1.jsx)(icons_material_1.WarningAmber, { sx: {
29
+ marginTop: 2,
30
+ marginLeft: 2,
31
+ } }), (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length) ? ((0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`swap.warning.title.insufficientGas`) })) : null, insufficientFunds ? ((0, jsx_runtime_1.jsx)(material_1.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) ? ((0, jsx_runtime_1.jsx)(material_1.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 ((0, jsx_runtime_1.jsx)(material_1.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] })] }) })) })));
48
45
  };
49
46
  exports.GasSufficiencyMessage = GasSufficiencyMessage;
@@ -49,6 +49,6 @@ const NavigationHeader = () => {
49
49
  return t(`header.swap`);
50
50
  }
51
51
  };
52
- return ((0, jsx_runtime_1.jsxs)(Header_style_1.HeaderAppBar, Object.assign({ elevation: 0 }, { children: [utils_1.backButtonRoutes.includes(path) ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "start", onClick: navigateBack }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.ArrowBack, {}) }))) : null, (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true }, { children: handleHeaderTitle() })), (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [(0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: utils_1.navigationRoutes.home, element: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [account.isActive ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "swap-history", edge: "start", onClick: () => navigate(utils_1.navigationRoutes.swapHistory) }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.History, {}) }))) : null, (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: () => navigate(utils_1.navigationRoutes.settings) }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.SettingsOutlined, {}) }))] }) }), (0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "*", element: element || (0, jsx_runtime_1.jsx)(material_1.Box, { width: 28, height: 40 }) })] })] })));
52
+ return ((0, jsx_runtime_1.jsxs)(Header_style_1.HeaderAppBar, Object.assign({ elevation: 0 }, { children: [utils_1.backButtonRoutes.includes(path) ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", edge: "start", onClick: navigateBack }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.ArrowBack, {}) }))) : null, (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true }, { children: handleHeaderTitle() })), (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [(0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: utils_1.navigationRoutes.home, element: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [account.isActive ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: t(`header.swapHistory`), enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", edge: "start", onClick: () => navigate(utils_1.navigationRoutes.swapHistory) }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.History, {}) })) }))) : null, (0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: t(`header.settings`), enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", edge: "end", onClick: () => navigate(utils_1.navigationRoutes.settings) }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.SettingsOutlined, {}) })) }))] }) }), (0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "*", element: element || (0, jsx_runtime_1.jsx)(material_1.Box, { width: 28, height: 40 }) })] })] })));
53
53
  };
54
54
  exports.NavigationHeader = NavigationHeader;
@@ -26,7 +26,7 @@ const WalletHeader = () => {
26
26
  display: 'flex',
27
27
  flex: 1,
28
28
  flexDirection: 'column',
29
- }, mr: 0.5 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "caption", align: "right" }, { children: t(`header.walletConnected`) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", align: "right", fontWeight: "600" }, { children: walletAddress }))] })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "disconnect", edge: "end", onClick: disconnect }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.Logout, {}) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", align: "right", fontWeight: "600", flex: 1, mr: 0.5 }, { children: t(`header.connectWallet`) })), (0, jsx_runtime_1.jsx)(ConnectButton, {})] })) })));
29
+ }, mr: 0.5 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "caption", align: "right" }, { children: t(`header.walletConnected`) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", align: "right", fontWeight: "600" }, { children: walletAddress }))] })), (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", edge: "end", onClick: disconnect }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.Logout, {}) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body2", align: "right", fontWeight: "600", flex: 1, mr: 0.5 }, { children: t(`header.connectWallet`) })), (0, jsx_runtime_1.jsx)(ConnectButton, {})] })) })));
30
30
  };
31
31
  exports.WalletHeader = WalletHeader;
32
32
  const ConnectButton = () => {
@@ -41,5 +41,5 @@ const ConnectButton = () => {
41
41
  }
42
42
  navigate(utils_1.navigationRoutes.selectWallet);
43
43
  });
44
- return ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "disconnect", edge: "end", onClick: !pathname.includes(utils_1.navigationRoutes.selectWallet) ? connect : undefined }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.WalletOutlined, {}) })));
44
+ return ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", edge: "end", onClick: !pathname.includes(utils_1.navigationRoutes.selectWallet) ? connect : undefined }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.WalletOutlined, {}) })));
45
45
  };
@@ -18,6 +18,6 @@ const PoweredBy = () => {
18
18
  display: 'flex',
19
19
  alignItems: 'flex-end',
20
20
  justifyContent: 'flex-end',
21
- } }, { children: (0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: `v${version_1.version}`, placement: "top", enterDelay: 5000, arrow: true }, { children: (0, jsx_runtime_1.jsxs)(PoweredBy_style_1.Link, Object.assign({ href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "text.secondary", fontSize: 12, px: 0.5 }, { children: "Powered by" })), (0, jsx_runtime_1.jsx)(LiFiLogo_1.LiFiLogo, { variant: "full", style: { height: 16, width: 42 } })] })) })) })));
21
+ } }, { children: (0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: `v${version_1.version}`, placement: "top", enterDelay: 3000, arrow: true }, { children: (0, jsx_runtime_1.jsxs)(PoweredBy_style_1.Link, Object.assign({ href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: "text.secondary", fontSize: 12, px: 0.5 }, { children: "Powered by" })), (0, jsx_runtime_1.jsx)(LiFiLogo_1.LiFiLogo, { variant: "full", style: { height: 16, width: 42 } })] })) })) })));
22
22
  };
23
23
  exports.PoweredBy = PoweredBy;
@@ -42,7 +42,7 @@ const ProgressToNextUpdate = (_a) => {
42
42
  }, [isLoading]);
43
43
  return ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: onClick, disabled: isLoading }, other, { children: (0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: t('tooltip.progressToNextUpdate', {
44
44
  value: getSecondsToUpdate(updatedAt, timeToUpdate),
45
- }), placement: "top", enterDelay: 250, arrow: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
45
+ }), placement: "top", enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
46
46
  display: 'grid',
47
47
  position: 'relative',
48
48
  placeItems: 'center',
@@ -15,12 +15,12 @@ const ReverseTokensButton = ({ vertical, }) => {
15
15
  providers_1.SwapFormKey.ToChain,
16
16
  providers_1.SwapFormKey.ToToken,
17
17
  ]);
18
- setValue(providers_1.SwapFormKey.FromAmount, '');
19
- setValue(providers_1.SwapFormKey.FromChain, toChain);
20
- setValue(providers_1.SwapFormKey.FromToken, toToken);
21
- setValue(providers_1.SwapFormKey.ToChain, fromChain);
22
- setValue(providers_1.SwapFormKey.ToToken, fromToken);
18
+ setValue(providers_1.SwapFormKey.FromAmount, '', { shouldTouch: true });
19
+ setValue(providers_1.SwapFormKey.FromChain, toChain, { shouldTouch: true });
20
+ setValue(providers_1.SwapFormKey.FromToken, toToken, { shouldTouch: true });
21
+ setValue(providers_1.SwapFormKey.ToChain, fromChain, { shouldTouch: true });
22
+ setValue(providers_1.SwapFormKey.ToToken, fromToken, { shouldTouch: true });
23
23
  };
24
- return ((0, jsx_runtime_1.jsx)(ReverseTokensButton_style_1.IconButton, Object.assign({ onClick: handleClick, size: "small", "aria-label": "swap-destinations" }, { children: vertical ? (0, jsx_runtime_1.jsx)(icons_material_1.SwapVert, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.SwapHoriz, {}) })));
24
+ return ((0, jsx_runtime_1.jsx)(ReverseTokensButton_style_1.IconButton, Object.assign({ onClick: handleClick, size: "small" }, { children: vertical ? (0, jsx_runtime_1.jsx)(icons_material_1.SwapVert, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.SwapHoriz, {}) })));
25
25
  };
26
26
  exports.ReverseTokensButton = ReverseTokensButton;
@@ -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;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SendToWallet = void 0;
12
+ exports.SendToWalletFormHelperText = exports.SendToWallet = void 0;
13
13
  const jsx_runtime_1 = require("react/jsx-runtime");
14
14
  const address_1 = require("@ethersproject/address");
15
15
  const material_1 = require("@mui/material");
@@ -21,11 +21,10 @@ const Card_1 = require("../Card");
21
21
  const SendToWallet_style_1 = require("./SendToWallet.style");
22
22
  const store_1 = require("./store");
23
23
  exports.SendToWallet = (0, react_1.forwardRef)((props, ref) => {
24
- var _a;
25
24
  const { t } = (0, react_i18next_1.useTranslation)();
26
25
  const showSendToWallet = (0, store_1.useSendToWalletStore)((state) => state.showSendToWallet);
27
26
  const { account, provider } = (0, providers_1.useWallet)();
28
- const { register, trigger, formState: { errors }, } = (0, react_hook_form_1.useFormContext)();
27
+ const { register, trigger } = (0, react_hook_form_1.useFormContext)();
29
28
  (0, react_1.useEffect)(() => {
30
29
  trigger(providers_1.SwapFormKey.ToAddress);
31
30
  }, [account.chainId, trigger]);
@@ -39,11 +38,17 @@ exports.SendToWallet = (0, react_1.forwardRef)((props, ref) => {
39
38
  return ((0, address_1.isAddress)(address || value) ||
40
39
  t('swap.error.title.walletAddressInvalid'));
41
40
  }
42
- catch (_b) {
41
+ catch (_a) {
43
42
  return t('swap.error.title.walletEnsAddressInvalid');
44
43
  }
45
44
  }),
46
45
  onBlur: () => trigger(providers_1.SwapFormKey.ToAddress),
47
46
  });
48
- return ((0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ timeout: 225, unmountOnExit: true, mountOnEnter: true, in: showSendToWallet }, { children: (0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({}, props, { ref: ref }, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.sendToWallet') }), (0, jsx_runtime_1.jsxs)(SendToWallet_style_1.FormControl, Object.assign({ fullWidth: true, sx: { paddingTop: '6px', paddingBottom: '5px' } }, { children: [(0, jsx_runtime_1.jsx)(SendToWallet_style_1.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 }), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, Object.assign({ error: !!errors.toAddress }, { children: (_a = errors.toAddress) === null || _a === void 0 ? void 0 : _a.message }))] }))] })) })));
47
+ return ((0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ timeout: 225, in: showSendToWallet, mountOnEnter: true, unmountOnExit: true }, { children: (0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({}, props, { ref: ref }, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.sendToWallet') }), (0, jsx_runtime_1.jsxs)(SendToWallet_style_1.FormControl, Object.assign({ fullWidth: true, sx: { paddingTop: '6px', paddingBottom: '5px' } }, { children: [(0, jsx_runtime_1.jsx)(SendToWallet_style_1.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 }), (0, jsx_runtime_1.jsx)(exports.SendToWalletFormHelperText, {})] }))] })) })));
49
48
  });
49
+ const SendToWalletFormHelperText = () => {
50
+ var _a;
51
+ const { errors } = (0, react_hook_form_1.useFormState)();
52
+ return ((0, jsx_runtime_1.jsx)(material_1.FormHelperText, Object.assign({ error: !!errors.toAddress }, { children: (_a = errors.toAddress) === null || _a === void 0 ? void 0 : _a.message })));
53
+ };
54
+ exports.SendToWalletFormHelperText = SendToWalletFormHelperText;
@@ -20,11 +20,11 @@ const SendToWalletButton = () => {
20
20
  }
21
21
  const handleClick = () => {
22
22
  if (showSendToWallet) {
23
- setValue(providers_1.SwapFormKey.ToAddress, '');
23
+ setValue(providers_1.SwapFormKey.ToAddress, '', { shouldTouch: true });
24
24
  }
25
25
  toggleSendToWallet();
26
26
  };
27
- return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: t('swap.sendToWallet'), placement: "bottom-end", enterDelay: 500, enterNextDelay: 500, arrow: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: showSendToWallet ? 'contained' : 'text', onClick: handleClick, sx: {
27
+ return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: t('swap.sendToWallet'), placement: "bottom-end", enterDelay: 400, enterNextDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: showSendToWallet ? 'contained' : 'text', onClick: handleClick, sx: {
28
28
  minWidth: 48,
29
29
  marginLeft: 1,
30
30
  } }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.WalletOutlined, {}) })) })));
@@ -16,6 +16,6 @@ const StepProcess = ({ step, process }) => {
16
16
  display: 'flex',
17
17
  flex: 1,
18
18
  justifyContent: 'flex-end',
19
- } }, { children: (0, jsx_runtime_1.jsx)(StepProcess_style_1.LinkButton, Object.assign({ size: "small", "aria-label": "settings", edge: "end", LinkComponent: material_1.Link, href: process.txLink, target: "_blank", rel: "nofollow noreferrer" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.Link, {}) })) }))) : null] })), message ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ ml: 6, fontSize: 14, fontWeight: 500, color: "text.secondary" }, { children: message }))) : null] })));
19
+ } }, { children: (0, jsx_runtime_1.jsx)(StepProcess_style_1.LinkButton, Object.assign({ size: "small", edge: "end", LinkComponent: material_1.Link, href: process.txLink, target: "_blank", rel: "nofollow noreferrer" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.Link, {}) })) }))) : null] })), message ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ ml: 6, fontSize: 14, fontWeight: 500, color: "text.secondary" }, { children: message }))) : null] })));
20
20
  };
21
21
  exports.StepProcess = StepProcess;
@@ -11,19 +11,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SwapButton = void 0;
13
13
  const jsx_runtime_1 = require("react/jsx-runtime");
14
- const material_1 = require("@mui/material");
14
+ const lab_1 = require("@mui/lab");
15
15
  const react_1 = require("react");
16
16
  const react_i18next_1 = require("react-i18next");
17
17
  const react_router_dom_1 = require("react-router-dom");
18
18
  const hooks_1 = require("../../hooks");
19
19
  const providers_1 = require("../../providers");
20
20
  const utils_1 = require("../../utils");
21
- exports.SwapButton = (0, react_1.forwardRef)(({ onClick, currentRoute, text, disable }, ref) => {
21
+ exports.SwapButton = (0, react_1.forwardRef)(({ onClick, currentRoute, text, disable, enableLoading, loading }, ref) => {
22
22
  const { t } = (0, react_i18next_1.useTranslation)();
23
23
  const navigate = (0, react_router_dom_1.useNavigate)();
24
24
  const config = (0, providers_1.useWidgetConfig)();
25
25
  const { account, connect } = (0, providers_1.useWallet)();
26
- const { insufficientFunds, insufficientGas } = (0, hooks_1.useGasSufficiency)(currentRoute);
26
+ const { insufficientFunds, insufficientGas, isLoading: isGasSufficiencyLoading, } = (0, hooks_1.useGasSufficiency)(currentRoute);
27
27
  const handleSwapButtonClick = () => __awaiter(void 0, void 0, void 0, function* () {
28
28
  if (!account.isActive) {
29
29
  if (config.walletManagement) {
@@ -46,5 +46,5 @@ exports.SwapButton = (0, react_1.forwardRef)(({ onClick, currentRoute, text, dis
46
46
  }
47
47
  return t(`button.connectWallet`);
48
48
  };
49
- return ((0, jsx_runtime_1.jsx)(material_1.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() })));
49
+ return ((0, jsx_runtime_1.jsx)(lab_1.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() })));
50
50
  });
@@ -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
  }