@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
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import type { WalletAccount } from './types';
3
+ export declare const WalletFormUpdate: React.FC<{
4
+ account: WalletAccount;
5
+ }>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WalletFormUpdate = void 0;
4
+ /* eslint-disable @typescript-eslint/no-unused-vars */
5
+ const react_1 = require("react");
6
+ const react_hook_form_1 = require("react-hook-form");
7
+ const stores_1 = require("../../stores");
8
+ const SwapFormProvider_1 = require("../SwapFormProvider");
9
+ const WidgetProvider_1 = require("../WidgetProvider");
10
+ const WalletFormUpdate = ({ account, }) => {
11
+ const { fromChain, toChain, chains, disabledChains } = (0, WidgetProvider_1.useWidgetConfig)();
12
+ const { setValue, getValues, getFieldState,
13
+ // Subscription to touchedFields is required by getFieldState to work
14
+ formState: { touchedFields }, } = (0, react_hook_form_1.useFormContext)();
15
+ // Set wallet chain as default if no chains are provided by config and if they were not changed during widget usage
16
+ (0, react_1.useEffect)(() => {
17
+ const chainAllowed = account.chainId && (0, WidgetProvider_1.isItemAllowed)(account.chainId, chains, disabledChains);
18
+ if (!account.isActive || !account.chainId || !chainAllowed) {
19
+ return;
20
+ }
21
+ const [fromChainValue, toChainValue] = getValues([
22
+ SwapFormProvider_1.SwapFormKey.FromChain,
23
+ SwapFormProvider_1.SwapFormKey.ToChain,
24
+ ]);
25
+ const { isTouched: isFromChainTouched } = getFieldState(SwapFormProvider_1.SwapFormKey.FromChain);
26
+ const { isTouched: isToChainTouched } = getFieldState(SwapFormProvider_1.SwapFormKey.ToChain);
27
+ const { isTouched: isFromTokenTouched } = getFieldState(SwapFormProvider_1.SwapFormKey.FromToken);
28
+ const { isTouched: isToTokenTouched } = getFieldState(SwapFormProvider_1.SwapFormKey.ToToken);
29
+ const { isTouched: isFromAmountTouched } = getFieldState(SwapFormProvider_1.SwapFormKey.FromAmount);
30
+ const { chainOrder, setChain } = stores_1.useChainOrderStore.getState();
31
+ // Users can switch chains in the wallet.
32
+ // If we don't have a chain in the ordered chain list we should add it.
33
+ setChain(account.chainId);
34
+ // If we ran out of slots for the ordered chain list and the current chain isn't there
35
+ // we should make a recently switched chain as current.
36
+ const hasFromChainInOrderedList = chainOrder.includes(fromChainValue);
37
+ const hasToChainInOrderedList = chainOrder.includes(toChainValue);
38
+ if ((!fromChain && !isFromChainTouched && !isFromTokenTouched) ||
39
+ !hasFromChainInOrderedList) {
40
+ setValue(SwapFormProvider_1.SwapFormKey.FromChain, account.chainId);
41
+ setValue(SwapFormProvider_1.SwapFormKey.FromToken, '');
42
+ if (isFromAmountTouched) {
43
+ setValue(SwapFormProvider_1.SwapFormKey.FromAmount, '');
44
+ }
45
+ }
46
+ if ((!toChain && !isToChainTouched && !isToTokenTouched) ||
47
+ !hasToChainInOrderedList) {
48
+ setValue(SwapFormProvider_1.SwapFormKey.ToChain, account.chainId);
49
+ setValue(SwapFormProvider_1.SwapFormKey.ToToken, '');
50
+ }
51
+ }, [
52
+ account.chainId,
53
+ account.isActive,
54
+ chains,
55
+ disabledChains,
56
+ fromChain,
57
+ getFieldState,
58
+ getValues,
59
+ setValue,
60
+ toChain,
61
+ ]);
62
+ return null;
63
+ };
64
+ exports.WalletFormUpdate = WalletFormUpdate;
@@ -13,10 +13,8 @@ exports.extractAccountFromSigner = exports.WalletProvider = exports.useWallet =
13
13
  const jsx_runtime_1 = require("react/jsx-runtime");
14
14
  const wallet_management_1 = require("@lifi/wallet-management");
15
15
  const react_1 = require("react");
16
- const react_hook_form_1 = require("react-hook-form");
17
- const stores_1 = require("../../stores");
18
- const SwapFormProvider_1 = require("../SwapFormProvider");
19
16
  const WidgetProvider_1 = require("../WidgetProvider");
17
+ const WalletFormUpdate_1 = require("./WalletFormUpdate");
20
18
  const stub = () => {
21
19
  throw new Error('You forgot to wrap your component in <WalletProvider>.');
22
20
  };
@@ -32,8 +30,7 @@ const WalletContext = (0, react_1.createContext)(initialContext);
32
30
  const useWallet = () => (0, react_1.useContext)(WalletContext);
33
31
  exports.useWallet = useWallet;
34
32
  const WalletProvider = ({ children }) => {
35
- const { walletManagement, fromChain, toChain, chains, disabledChains } = (0, WidgetProvider_1.useWidgetConfig)();
36
- const methods = (0, react_hook_form_1.useFormContext)();
33
+ const { walletManagement } = (0, WidgetProvider_1.useWidgetConfig)();
37
34
  const { connect: walletManagementConnect, disconnect: walletManagementDisconnect, signer, provider, } = (0, wallet_management_1.useLiFiWalletManagement)();
38
35
  const [account, setAccount] = (0, react_1.useState)({});
39
36
  const connect = (0, react_1.useCallback)((wallet) => __awaiter(void 0, void 0, void 0, function* () {
@@ -98,59 +95,7 @@ const WalletProvider = ({ children }) => {
98
95
  account,
99
96
  provider,
100
97
  }), [account, addChain, addToken, connect, disconnect, provider, switchChain]);
101
- // Set wallet chain as default if no chains are provided by config and if they were not changed during widget usage
102
- (0, react_1.useEffect)(() => {
103
- const chainAllowed = account.chainId && (0, WidgetProvider_1.isItemAllowed)(account.chainId, chains, disabledChains);
104
- if (!account.isActive || !account.chainId || !chainAllowed) {
105
- return;
106
- }
107
- const [fromChainValue, toChainValue] = methods.getValues([
108
- SwapFormProvider_1.SwapFormKey.FromChain,
109
- SwapFormProvider_1.SwapFormKey.ToChain,
110
- ]);
111
- const { isDirty: isFromChainDirty } = methods.getFieldState(SwapFormProvider_1.SwapFormKey.FromChain, methods.formState);
112
- const { isDirty: isToChainDirty } = methods.getFieldState(SwapFormProvider_1.SwapFormKey.ToChain, methods.formState);
113
- const { isDirty: isFromTokenDirty } = methods.getFieldState(SwapFormProvider_1.SwapFormKey.FromToken, methods.formState);
114
- const { isDirty: isToTokenDirty } = methods.getFieldState(SwapFormProvider_1.SwapFormKey.ToToken, methods.formState);
115
- const { chainOrder, setChain } = stores_1.useChainOrderStore.getState();
116
- // Users can switch chains in the wallet.
117
- // If we don't have a chain in the ordered chain list we should add it.
118
- setChain(account.chainId);
119
- // If we ran out of slots for the ordered chain list and the current chain isn't there
120
- // we should make a recently switched chain as current.
121
- const hasFromChainInOrderedList = chainOrder.includes(fromChainValue);
122
- const hasToChainInOrderedList = chainOrder.includes(toChainValue);
123
- if ((!fromChain && !isFromChainDirty && !isFromTokenDirty) ||
124
- !hasFromChainInOrderedList) {
125
- methods.setValue(SwapFormProvider_1.SwapFormKey.FromChain, account.chainId, {
126
- shouldDirty: false,
127
- });
128
- methods.setValue(SwapFormProvider_1.SwapFormKey.FromToken, '', {
129
- shouldDirty: false,
130
- });
131
- methods.setValue(SwapFormProvider_1.SwapFormKey.FromAmount, '', {
132
- shouldDirty: false,
133
- });
134
- }
135
- if ((!toChain && !isToChainDirty && !isToTokenDirty) ||
136
- !hasToChainInOrderedList) {
137
- methods.setValue(SwapFormProvider_1.SwapFormKey.ToChain, account.chainId, {
138
- shouldDirty: false,
139
- });
140
- methods.setValue(SwapFormProvider_1.SwapFormKey.ToToken, '', {
141
- shouldDirty: false,
142
- });
143
- }
144
- }, [
145
- account.chainId,
146
- account.isActive,
147
- chains,
148
- disabledChains,
149
- fromChain,
150
- methods,
151
- toChain,
152
- ]);
153
- return ((0, jsx_runtime_1.jsx)(WalletContext.Provider, Object.assign({ value: value }, { children: children })));
98
+ return ((0, jsx_runtime_1.jsxs)(WalletContext.Provider, Object.assign({ value: value }, { children: [(0, jsx_runtime_1.jsx)(WalletFormUpdate_1.WalletFormUpdate, { account: account }), children] })));
154
99
  };
155
100
  exports.WalletProvider = WalletProvider;
156
101
  const extractAccountFromSigner = (signer) => __awaiter(void 0, void 0, void 0, function* () {
@@ -15,6 +15,7 @@ exports.WidgetProvider = exports.useWidgetConfig = void 0;
15
15
  const jsx_runtime_1 = require("react/jsx-runtime");
16
16
  const sdk_1 = require("@lifi/sdk");
17
17
  const react_1 = require("react");
18
+ const utils_1 = require("../../utils");
18
19
  const initialContext = {
19
20
  disabledChains: [],
20
21
  };
@@ -24,27 +25,33 @@ exports.useWidgetConfig = useWidgetConfig;
24
25
  const WidgetProvider = (_a) => {
25
26
  var { children } = _a, _b = _a.config, _c = _b === void 0 ? {} : _b, { fromChain, fromToken, toChain, toToken, fromAmount } = _c, config = __rest(_c, ["fromChain", "fromToken", "toChain", "toToken", "fromAmount"]);
26
27
  const value = (0, react_1.useMemo)(() => {
27
- var _a, _b, _c, _d;
28
+ var _a, _b, _c, _d, _e, _f;
28
29
  try {
29
30
  const searchParams = Object.fromEntries(new URLSearchParams(window === null || window === void 0 ? void 0 : window.location.search));
31
+ // Prevent using fromToken/toToken params if chain is not selected
32
+ ['from', 'to'].forEach((key) => {
33
+ if (searchParams[`${key}Token`] && !searchParams[`${key}Chain`]) {
34
+ delete searchParams[`${key}Token`];
35
+ }
36
+ });
30
37
  return Object.assign(Object.assign({}, config), { fromChain: (searchParams.fromChain &&
31
38
  isNaN(parseInt(searchParams.fromChain, 10))) ||
32
39
  typeof fromChain === 'string'
33
- ? (0, sdk_1.getChainByKey)((_a = (searchParams.fromChain || fromChain)) === null || _a === void 0 ? void 0 : _a.toLowerCase()).id
40
+ ? (_b = (0, sdk_1.getChainByKey)((_a = (searchParams.fromChain || fromChain)) === null || _a === void 0 ? void 0 : _a.toLowerCase())) === null || _b === void 0 ? void 0 : _b.id
34
41
  : (searchParams.fromChain &&
35
42
  !isNaN(parseInt(searchParams.fromChain, 10))) ||
36
43
  typeof fromChain === 'number'
37
44
  ? parseInt(searchParams.fromChain, 10) || fromChain
38
45
  : undefined, toChain: (searchParams.toChain && isNaN(parseInt(searchParams.toChain, 10))) ||
39
46
  typeof toChain === 'string'
40
- ? (0, sdk_1.getChainByKey)((_b = (searchParams.toChain || toChain)) === null || _b === void 0 ? void 0 : _b.toLowerCase()).id
47
+ ? (_d = (0, sdk_1.getChainByKey)((_c = (searchParams.toChain || toChain)) === null || _c === void 0 ? void 0 : _c.toLowerCase())) === null || _d === void 0 ? void 0 : _d.id
41
48
  : (searchParams.toChain &&
42
49
  !isNaN(parseInt(searchParams.toChain, 10))) ||
43
50
  typeof toChain === 'number'
44
51
  ? parseInt(searchParams.toChain, 10) || toChain
45
- : undefined, fromToken: ((_c = searchParams.fromToken) === null || _c === void 0 ? void 0 : _c.toLowerCase()) || (fromToken === null || fromToken === void 0 ? void 0 : fromToken.toLowerCase()), toToken: ((_d = searchParams.toToken) === null || _d === void 0 ? void 0 : _d.toLowerCase()) || (toToken === null || toToken === void 0 ? void 0 : toToken.toLowerCase()), fromAmount: typeof searchParams.fromAmount === 'string' &&
52
+ : undefined, fromToken: ((_e = searchParams.fromToken) === null || _e === void 0 ? void 0 : _e.toLowerCase()) || (fromToken === null || fromToken === void 0 ? void 0 : fromToken.toLowerCase()), toToken: ((_f = searchParams.toToken) === null || _f === void 0 ? void 0 : _f.toLowerCase()) || (toToken === null || toToken === void 0 ? void 0 : toToken.toLowerCase()), fromAmount: typeof searchParams.fromAmount === 'string' &&
46
53
  !isNaN(parseFloat(searchParams.fromAmount))
47
- ? searchParams.fromAmount
54
+ ? (0, utils_1.formatAmount)(searchParams.fromAmount)
48
55
  : fromAmount });
49
56
  }
50
57
  catch (e) {
@@ -1,7 +1,7 @@
1
1
  export * from './types';
2
2
  export * from './useExecutingRoutesIds';
3
+ export * from './useRecommendedRouteStore';
3
4
  export * from './useRouteExecutionStore';
4
- export * from './useSelectedRouteStore';
5
5
  export * from './useSetExecutableRoute';
6
6
  export * from './useSwapHistory';
7
7
  export * from './utils';
@@ -16,8 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./types"), exports);
18
18
  __exportStar(require("./useExecutingRoutesIds"), exports);
19
+ __exportStar(require("./useRecommendedRouteStore"), exports);
19
20
  __exportStar(require("./useRouteExecutionStore"), exports);
20
- __exportStar(require("./useSelectedRouteStore"), exports);
21
21
  __exportStar(require("./useSetExecutableRoute"), exports);
22
22
  __exportStar(require("./useSwapHistory"), exports);
23
23
  __exportStar(require("./utils"), exports);
@@ -5,14 +5,14 @@ export interface RouteExecutionStore {
5
5
  updateRoute: (route: Route) => void;
6
6
  restartRoute: (routeId: string) => void;
7
7
  deleteRoute: (routeId: string) => void;
8
- deleteRoutes: () => void;
8
+ deleteRoutes: (type: 'completed' | 'active') => void;
9
9
  }
10
10
  export declare type RouteExecutionStatus = 'error' | 'idle' | 'loading' | 'success';
11
11
  export interface RouteExecution {
12
12
  route: Route;
13
13
  status: RouteExecutionStatus;
14
14
  }
15
- export interface SelectedRouteStore {
16
- selectedRoute?: Route;
17
- setSelectedRoute: (route?: Route) => void;
15
+ export interface RecommendedRouteStore {
16
+ recommendedRoute?: Route;
17
+ setRecommendedRoute: (route?: Route) => void;
18
18
  }
@@ -0,0 +1,4 @@
1
+ import type { RecommendedRouteStore } from './types';
2
+ export declare const useRecommendedRouteStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<RecommendedRouteStore>, "setState"> & {
3
+ setState(nextStateOrUpdater: RecommendedRouteStore | Partial<RecommendedRouteStore> | ((state: import("immer/dist/internal").WritableDraft<RecommendedRouteStore>) => void), shouldReplace?: boolean | undefined): void;
4
+ }>;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useSelectedRouteStore = void 0;
3
+ exports.useRecommendedRouteStore = void 0;
4
4
  const zustand_1 = require("zustand");
5
5
  const immer_1 = require("zustand/middleware/immer");
6
- exports.useSelectedRouteStore = (0, zustand_1.default)()((0, immer_1.immer)((set) => ({
7
- setSelectedRoute: (route) => {
6
+ exports.useRecommendedRouteStore = (0, zustand_1.default)()((0, immer_1.immer)((set) => ({
7
+ setRecommendedRoute: (route) => {
8
8
  set((state) => {
9
- state.selectedRoute = route;
9
+ state.recommendedRoute = route;
10
10
  });
11
11
  },
12
12
  })));
@@ -46,8 +46,15 @@ exports.useRouteExecutionStore = (0, zustand_1.default)()((0, middleware_1.persi
46
46
  delete state.routes[routeId];
47
47
  }
48
48
  }),
49
- deleteRoutes: () => set((state) => {
50
- state.routes = {};
49
+ deleteRoutes: (type) => set((state) => {
50
+ Object.keys(state.routes)
51
+ .filter((routeId) => {
52
+ var _a, _b;
53
+ return type === 'completed'
54
+ ? ((_a = state.routes[routeId]) === null || _a === void 0 ? void 0 : _a.status) === 'success'
55
+ : ((_b = state.routes[routeId]) === null || _b === void 0 ? void 0 : _b.status) !== 'success';
56
+ })
57
+ .forEach((routeId) => delete state.routes[routeId]);
51
58
  }),
52
59
  })), {
53
60
  name: 'li.fi-widget-routes',
@@ -82,6 +89,7 @@ exports.useRouteExecutionStore = (0, zustand_1.default)()((0, middleware_1.persi
82
89
  }
83
90
  });
84
91
  }
92
+ localStorage.removeItem('routes');
85
93
  }
86
94
  catch (error) {
87
95
  console.log(error);
@@ -23,7 +23,7 @@ exports.useSettingsStore = (0, zustand_1.default)()((0, middleware_1.persist)((0
23
23
  appearance: 'auto',
24
24
  gasPrice: 'normal',
25
25
  routePriority: 'RECOMMENDED',
26
- slippage: '3',
26
+ slippage: '0.5',
27
27
  setValue: (key, value) => set((state) => {
28
28
  state[key] = value;
29
29
  }),
@@ -68,7 +68,7 @@ exports.useSettingsStore = (0, zustand_1.default)()((0, middleware_1.persist)((0
68
68
  }),
69
69
  })), {
70
70
  name: 'li.fi-widget-settings',
71
- version: 1,
71
+ version: 2,
72
72
  partialize: (state) => {
73
73
  const { enabledBridges, enabledExchanges } = state, partializedState = __rest(state, ["enabledBridges", "enabledExchanges"]);
74
74
  return partializedState;
@@ -86,6 +86,9 @@ exports.useSettingsStore = (0, zustand_1.default)()((0, middleware_1.persist)((0
86
86
  if (version === 0 && persistedState.appearance === 'system') {
87
87
  persistedState.appearance = 'auto';
88
88
  }
89
+ if (version === 1) {
90
+ persistedState.slippage = '0.5';
91
+ }
89
92
  return persistedState;
90
93
  },
91
94
  }));
@@ -38,6 +38,7 @@ export interface WidgetConfig {
38
38
  variant?: WidgetVariant;
39
39
  walletManagement?: WidgetWalletManagement;
40
40
  sdkConfig?: ConfigUpdate;
41
+ buildSwapUrl?: boolean;
41
42
  bridges?: {
42
43
  allow?: string[];
43
44
  deny?: string[];
@@ -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
  };