@lifi/widget 3.7.0-beta.6 → 3.7.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 (327) hide show
  1. package/AppProvider.tsx +6 -4
  2. package/AppRoutes.tsx +14 -2
  3. package/CHANGELOG.md +22 -0
  4. package/_esm/AppProvider.js +3 -2
  5. package/_esm/AppProvider.js.map +1 -1
  6. package/_esm/AppRoutes.js +9 -2
  7. package/_esm/AppRoutes.js.map +1 -1
  8. package/_esm/components/ActiveTransactions/ActiveTransactions.style.js +1 -1
  9. package/_esm/components/ActiveTransactions/ActiveTransactions.style.js.map +1 -1
  10. package/_esm/components/AmountInput/AmountInputEndAdornment.js +3 -1
  11. package/_esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
  12. package/_esm/components/AppContainer.js +10 -5
  13. package/_esm/components/AppContainer.js.map +1 -1
  14. package/_esm/components/Avatar/AccountAvatar.d.ts +1 -1
  15. package/_esm/components/Avatar/AccountAvatar.js +1 -1
  16. package/_esm/components/Avatar/AccountAvatar.js.map +1 -1
  17. package/_esm/components/Avatar/Avatar.d.ts +0 -1
  18. package/_esm/components/Avatar/Avatar.js +4 -7
  19. package/_esm/components/Avatar/Avatar.js.map +1 -1
  20. package/_esm/components/Avatar/Avatar.style.d.ts +3 -6
  21. package/_esm/components/Avatar/Avatar.style.js +6 -19
  22. package/_esm/components/Avatar/Avatar.style.js.map +1 -1
  23. package/_esm/components/Avatar/TokenAvatar.js +1 -1
  24. package/_esm/components/Avatar/TokenAvatar.js.map +1 -1
  25. package/_esm/components/BaseTransactionButton/BaseTransactionButton.js +5 -3
  26. package/_esm/components/BaseTransactionButton/BaseTransactionButton.js.map +1 -1
  27. package/_esm/components/Card/InputCard.d.ts +1 -1
  28. package/_esm/components/ChainSelect/useChainSelect.js +1 -5
  29. package/_esm/components/ChainSelect/useChainSelect.js.map +1 -1
  30. package/_esm/components/FeeBreakdownTooltip.js +1 -4
  31. package/_esm/components/FeeBreakdownTooltip.js.map +1 -1
  32. package/_esm/components/FullPageContainer.d.ts +2 -0
  33. package/_esm/components/FullPageContainer.js +9 -0
  34. package/_esm/components/FullPageContainer.js.map +1 -0
  35. package/_esm/components/Header/EVMDisconnectIconButton.d.ts +4 -0
  36. package/_esm/components/Header/EVMDisconnectIconButton.js +12 -0
  37. package/_esm/components/Header/EVMDisconnectIconButton.js.map +1 -0
  38. package/_esm/components/Header/Header.js +23 -3
  39. package/_esm/components/Header/Header.js.map +1 -1
  40. package/_esm/components/Header/NavigationHeader.js +1 -1
  41. package/_esm/components/Header/NavigationHeader.js.map +1 -1
  42. package/_esm/components/Header/SVMDisconnectIconButton.d.ts +1 -0
  43. package/_esm/components/Header/SVMDisconnectIconButton.js +12 -0
  44. package/_esm/components/Header/SVMDisconnectIconButton.js.map +1 -0
  45. package/_esm/components/Header/WalletHeader.js +9 -5
  46. package/_esm/components/Header/WalletHeader.js.map +1 -1
  47. package/_esm/components/Header/WalletMenu.js +18 -10
  48. package/_esm/components/Header/WalletMenu.js.map +1 -1
  49. package/_esm/components/Header/WalletMenu.style.js +1 -5
  50. package/_esm/components/Header/WalletMenu.style.js.map +1 -1
  51. package/_esm/components/PageContainer.d.ts +2 -1
  52. package/_esm/components/PageContainer.js.map +1 -1
  53. package/_esm/components/PageEntered.d.ts +1 -0
  54. package/_esm/components/PageEntered.js +13 -0
  55. package/_esm/components/PageEntered.js.map +1 -0
  56. package/_esm/components/Routes/RoutesExpanded.js +1 -1
  57. package/_esm/components/Routes/RoutesExpanded.js.map +1 -1
  58. package/_esm/components/Search/SearchInput.d.ts +11 -0
  59. package/_esm/components/Search/SearchInput.js +21 -0
  60. package/_esm/components/Search/SearchInput.js.map +1 -0
  61. package/_esm/components/Search/SearchInput.style.d.ts +12 -0
  62. package/_esm/components/Search/SearchInput.style.js +38 -0
  63. package/_esm/components/Search/SearchInput.style.js.map +1 -0
  64. package/_esm/components/Search/SearchNotFound.d.ts +6 -0
  65. package/_esm/components/Search/SearchNotFound.js +5 -0
  66. package/_esm/components/Search/SearchNotFound.js.map +1 -0
  67. package/_esm/components/Search/SearchNotFound.style.d.ts +14 -0
  68. package/_esm/components/Search/SearchNotFound.style.js +29 -0
  69. package/_esm/components/Search/SearchNotFound.style.js.map +1 -0
  70. package/_esm/components/SendToWallet/SendToWalletButton.js +1 -1
  71. package/_esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
  72. package/_esm/components/Skeleton/WidgetSkeleton.js +3 -4
  73. package/_esm/components/Skeleton/WidgetSkeleton.js.map +1 -1
  74. package/_esm/components/Skeleton/WidgetSkeleton.style.d.ts +4 -1
  75. package/_esm/components/Skeleton/WidgetSkeleton.style.js +20 -1
  76. package/_esm/components/Skeleton/WidgetSkeleton.style.js.map +1 -1
  77. package/_esm/components/SmallAvatar.d.ts +10 -0
  78. package/_esm/components/SmallAvatar.js +19 -0
  79. package/_esm/components/SmallAvatar.js.map +1 -0
  80. package/_esm/components/StepActions/StepActions.js +1 -1
  81. package/_esm/components/StepActions/StepActions.js.map +1 -1
  82. package/_esm/components/Tabs/Tabs.style.d.ts +1 -1
  83. package/_esm/components/Token/Token.js +1 -1
  84. package/_esm/components/Token/Token.js.map +1 -1
  85. package/_esm/components/TokenList/TokenList.js +2 -5
  86. package/_esm/components/TokenList/TokenList.js.map +1 -1
  87. package/_esm/components/TokenList/TokenListItem.js +5 -11
  88. package/_esm/components/TokenList/TokenListItem.js.map +1 -1
  89. package/_esm/components/TokenList/TokenNotFound.js +5 -13
  90. package/_esm/components/TokenList/TokenNotFound.js.map +1 -1
  91. package/_esm/components/TokenList/VirtualizedTokenList.js +1 -1
  92. package/_esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
  93. package/_esm/components/TokenList/types.d.ts +3 -3
  94. package/_esm/components/TokenRate/TokenRate.js +2 -2
  95. package/_esm/components/TokenRate/TokenRate.js.map +1 -1
  96. package/_esm/config/version.d.ts +1 -1
  97. package/_esm/config/version.js +1 -1
  98. package/_esm/config/version.js.map +1 -1
  99. package/_esm/hooks/useAccount.d.ts +45 -0
  100. package/_esm/hooks/useAccount.js +56 -0
  101. package/_esm/hooks/useAccount.js.map +1 -0
  102. package/_esm/hooks/useAvailableChains.d.ts +1 -2
  103. package/_esm/hooks/useAvailableChains.js +8 -9
  104. package/_esm/hooks/useAvailableChains.js.map +1 -1
  105. package/_esm/hooks/useChains.d.ts +3 -4
  106. package/_esm/hooks/useChains.js +3 -5
  107. package/_esm/hooks/useChains.js.map +1 -1
  108. package/_esm/hooks/useFromTokenSufficiency.js +1 -1
  109. package/_esm/hooks/useFromTokenSufficiency.js.map +1 -1
  110. package/_esm/hooks/useGasSufficiency.js +3 -3
  111. package/_esm/hooks/useGasSufficiency.js.map +1 -1
  112. package/_esm/hooks/useProcessMessage.js +0 -4
  113. package/_esm/hooks/useProcessMessage.js.map +1 -1
  114. package/_esm/hooks/useRouteExecution.js +1 -1
  115. package/_esm/hooks/useRouteExecution.js.map +1 -1
  116. package/_esm/hooks/useRoutes.js +1 -1
  117. package/_esm/hooks/useRoutes.js.map +1 -1
  118. package/_esm/hooks/useScrollableContainer.d.ts +0 -1
  119. package/_esm/hooks/useScrollableContainer.js +1 -2
  120. package/_esm/hooks/useScrollableContainer.js.map +1 -1
  121. package/_esm/hooks/useSetContentHeight.js +9 -6
  122. package/_esm/hooks/useSetContentHeight.js.map +1 -1
  123. package/_esm/hooks/useTokenBalance.js +1 -1
  124. package/_esm/hooks/useTokenBalance.js.map +1 -1
  125. package/_esm/hooks/useTokenBalances.js +1 -1
  126. package/_esm/hooks/useTokenBalances.js.map +1 -1
  127. package/_esm/hooks/useTokens.js +1 -1
  128. package/_esm/hooks/useTokens.js.map +1 -1
  129. package/_esm/hooks/useTransactionDetails.js +1 -1
  130. package/_esm/hooks/useTransactionDetails.js.map +1 -1
  131. package/_esm/hooks/useTransactionHistory.js +1 -1
  132. package/_esm/hooks/useTransactionHistory.js.map +1 -1
  133. package/_esm/hooks/useWallets.d.ts +6 -0
  134. package/_esm/hooks/useWallets.js +80 -0
  135. package/_esm/hooks/useWallets.js.map +1 -0
  136. package/_esm/i18n/en.json +11 -4
  137. package/_esm/index.d.ts +2 -0
  138. package/_esm/index.js +2 -0
  139. package/_esm/index.js.map +1 -1
  140. package/_esm/pages/RoutesPage/RoutesPage.js +1 -1
  141. package/_esm/pages/RoutesPage/RoutesPage.js.map +1 -1
  142. package/_esm/pages/SelectChainPage/SelectChainPage.js +27 -8
  143. package/_esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
  144. package/_esm/pages/SelectEnabledToolsPage.js +38 -16
  145. package/_esm/pages/SelectEnabledToolsPage.js.map +1 -1
  146. package/_esm/pages/SelectTokenPage/SearchTokenInput.js +2 -12
  147. package/_esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
  148. package/_esm/pages/SelectTokenPage/SelectTokenPage.js +2 -2
  149. package/_esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
  150. package/_esm/pages/SelectTokenPage/useTokenListHeight.js +8 -14
  151. package/_esm/pages/SelectTokenPage/useTokenListHeight.js.map +1 -1
  152. package/_esm/pages/SelectWalletPage/EVMListItemButton.d.ts +9 -0
  153. package/_esm/pages/SelectWalletPage/EVMListItemButton.js +39 -0
  154. package/_esm/pages/SelectWalletPage/EVMListItemButton.js.map +1 -0
  155. package/_esm/pages/SelectWalletPage/SVMListItemButton.d.ts +6 -0
  156. package/_esm/pages/SelectWalletPage/SVMListItemButton.js +32 -0
  157. package/_esm/pages/SelectWalletPage/SVMListItemButton.js.map +1 -0
  158. package/_esm/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
  159. package/_esm/pages/SelectWalletPage/SelectWalletPage.js +41 -0
  160. package/_esm/pages/SelectWalletPage/SelectWalletPage.js.map +1 -0
  161. package/_esm/pages/SendToWallet/ConnectedWalletsPage.js +1 -1
  162. package/_esm/pages/SendToWallet/ConnectedWalletsPage.js.map +1 -1
  163. package/_esm/pages/SendToWallet/SendToWalletPage.js +1 -1
  164. package/_esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
  165. package/_esm/pages/SendToWallet/SendToWalletPage.style.d.ts +1 -1
  166. package/_esm/pages/TransactionPage/StatusBottomSheet.js +5 -5
  167. package/_esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
  168. package/_esm/providers/I18nProvider/types.d.ts +2 -2
  169. package/_esm/providers/WalletProvider/SDKProviders.js +7 -15
  170. package/_esm/providers/WalletProvider/SDKProviders.js.map +1 -1
  171. package/_esm/providers/WalletProvider/WalletProvider.d.ts +0 -1
  172. package/_esm/providers/WalletProvider/WalletProvider.js +1 -14
  173. package/_esm/providers/WalletProvider/WalletProvider.js.map +1 -1
  174. package/_esm/providers/WalletProvider/useHasExternalWalletProvider.d.ts +1 -1
  175. package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js +3 -8
  176. package/_esm/providers/WalletProvider/useHasExternalWalletProvider.js.map +1 -1
  177. package/_esm/providers/WidgetProvider/WidgetProvider.js +1 -2
  178. package/_esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
  179. package/_esm/providers/WidgetProvider/types.d.ts +2 -0
  180. package/_esm/stores/form/FormUpdater.js +1 -1
  181. package/_esm/stores/form/FormUpdater.js.map +1 -1
  182. package/_esm/stores/form/types.d.ts +4 -4
  183. package/_esm/stores/header/types.d.ts +2 -0
  184. package/_esm/stores/header/useHeaderStore.d.ts +7 -1
  185. package/_esm/stores/header/useHeaderStore.js +26 -2
  186. package/_esm/stores/header/useHeaderStore.js.map +1 -1
  187. package/_esm/stores/routes/useExecutingRoutesIds.js +1 -1
  188. package/_esm/stores/routes/useExecutingRoutesIds.js.map +1 -1
  189. package/_esm/stores/settings/types.d.ts +1 -1
  190. package/_esm/stores/settings/useSettingsStore.js +22 -9
  191. package/_esm/stores/settings/useSettingsStore.js.map +1 -1
  192. package/_esm/themes/createTheme.js +1 -2
  193. package/_esm/themes/createTheme.js.map +1 -1
  194. package/_esm/types/events.d.ts +6 -6
  195. package/_esm/types/events.js +3 -2
  196. package/_esm/types/events.js.map +1 -1
  197. package/_esm/utils/chainType.js +3 -2
  198. package/_esm/utils/chainType.js.map +1 -1
  199. package/_esm/utils/elements.d.ts +5 -2
  200. package/_esm/utils/elements.js +6 -1
  201. package/_esm/utils/elements.js.map +1 -1
  202. package/_esm/utils/fees.js +5 -9
  203. package/_esm/utils/fees.js.map +1 -1
  204. package/_esm/utils/format.js +1 -1
  205. package/_esm/utils/format.js.map +1 -1
  206. package/_esm/utils/navigationRoutes.d.ts +3 -1
  207. package/_esm/utils/navigationRoutes.js +3 -0
  208. package/_esm/utils/navigationRoutes.js.map +1 -1
  209. package/_esm/utils/svm.d.ts +1 -0
  210. package/_esm/utils/svm.js +11 -0
  211. package/_esm/utils/svm.js.map +1 -0
  212. package/_esm/utils/wallet.js +1 -1
  213. package/components/ActiveTransactions/ActiveTransactions.style.ts +1 -1
  214. package/components/AmountInput/AmountInputEndAdornment.tsx +5 -1
  215. package/components/AppContainer.tsx +15 -10
  216. package/components/Avatar/AccountAvatar.tsx +2 -2
  217. package/components/Avatar/Avatar.style.tsx +7 -20
  218. package/components/Avatar/Avatar.tsx +4 -12
  219. package/components/Avatar/TokenAvatar.tsx +1 -1
  220. package/components/BaseTransactionButton/BaseTransactionButton.tsx +5 -3
  221. package/components/ChainSelect/useChainSelect.ts +1 -10
  222. package/components/FeeBreakdownTooltip.tsx +1 -4
  223. package/components/FullPageContainer.tsx +14 -0
  224. package/components/Header/EVMDisconnectIconButton.tsx +24 -0
  225. package/components/Header/Header.tsx +28 -3
  226. package/components/Header/NavigationHeader.tsx +1 -1
  227. package/components/Header/SVMDisconnectIconButton.tsx +19 -0
  228. package/components/Header/WalletHeader.tsx +12 -11
  229. package/components/Header/WalletMenu.style.tsx +1 -5
  230. package/components/Header/WalletMenu.tsx +32 -22
  231. package/components/PageContainer.ts +2 -1
  232. package/components/PageEntered.ts +14 -0
  233. package/components/Routes/RoutesExpanded.tsx +2 -1
  234. package/components/Search/SearchInput.style.tsx +46 -0
  235. package/components/Search/SearchInput.tsx +57 -0
  236. package/components/Search/SearchNotFound.style.tsx +36 -0
  237. package/components/Search/SearchNotFound.tsx +23 -0
  238. package/components/SendToWallet/SendToWalletButton.tsx +1 -1
  239. package/components/Skeleton/WidgetSkeleton.style.tsx +21 -1
  240. package/components/Skeleton/WidgetSkeleton.tsx +10 -9
  241. package/components/SmallAvatar.tsx +25 -0
  242. package/components/StepActions/StepActions.tsx +1 -1
  243. package/components/Token/Token.tsx +1 -1
  244. package/components/TokenList/TokenList.tsx +2 -9
  245. package/components/TokenList/TokenListItem.tsx +7 -15
  246. package/components/TokenList/TokenNotFound.tsx +7 -27
  247. package/components/TokenList/VirtualizedTokenList.tsx +1 -1
  248. package/components/TokenList/types.ts +3 -3
  249. package/components/TokenRate/TokenRate.tsx +2 -2
  250. package/config/version.ts +1 -1
  251. package/hooks/useAccount.ts +109 -0
  252. package/hooks/useAvailableChains.ts +10 -9
  253. package/hooks/useChains.ts +3 -6
  254. package/hooks/useFromTokenSufficiency.ts +1 -1
  255. package/hooks/useGasSufficiency.ts +3 -5
  256. package/hooks/useProcessMessage.ts +0 -4
  257. package/hooks/useRouteExecution.ts +1 -1
  258. package/hooks/useRoutes.ts +1 -1
  259. package/hooks/useScrollableContainer.ts +1 -6
  260. package/hooks/useSetContentHeight.ts +10 -6
  261. package/hooks/useTokenBalance.ts +1 -1
  262. package/hooks/useTokenBalances.ts +1 -1
  263. package/hooks/useTokens.ts +1 -2
  264. package/hooks/useTransactionDetails.ts +1 -1
  265. package/hooks/useTransactionHistory.ts +1 -1
  266. package/hooks/useWallets.ts +147 -0
  267. package/i18n/en.json +11 -4
  268. package/index.ts +2 -0
  269. package/package.json +6 -6
  270. package/pages/RoutesPage/RoutesPage.tsx +1 -1
  271. package/pages/SelectChainPage/SelectChainPage.tsx +62 -23
  272. package/pages/SelectEnabledToolsPage.tsx +94 -37
  273. package/pages/SelectTokenPage/SearchTokenInput.tsx +8 -26
  274. package/pages/SelectTokenPage/SelectTokenPage.tsx +3 -3
  275. package/pages/SelectTokenPage/useTokenListHeight.ts +14 -21
  276. package/pages/SelectWalletPage/EVMListItemButton.tsx +74 -0
  277. package/pages/SelectWalletPage/SVMListItemButton.tsx +47 -0
  278. package/pages/SelectWalletPage/SelectWalletPage.tsx +90 -0
  279. package/pages/SendToWallet/ConnectedWalletsPage.tsx +2 -2
  280. package/pages/SendToWallet/SendToWalletPage.tsx +1 -1
  281. package/pages/TransactionPage/StatusBottomSheet.tsx +6 -8
  282. package/providers/I18nProvider/types.ts +2 -2
  283. package/providers/WalletProvider/SDKProviders.tsx +7 -25
  284. package/providers/WalletProvider/WalletProvider.tsx +3 -24
  285. package/providers/WalletProvider/useHasExternalWalletProvider.ts +5 -11
  286. package/providers/WidgetProvider/WidgetProvider.tsx +1 -2
  287. package/providers/WidgetProvider/types.ts +2 -0
  288. package/stores/form/FormUpdater.tsx +1 -1
  289. package/stores/form/types.ts +4 -4
  290. package/stores/header/types.ts +2 -0
  291. package/stores/header/useHeaderStore.tsx +40 -2
  292. package/stores/routes/useExecutingRoutesIds.ts +1 -1
  293. package/stores/settings/types.ts +1 -1
  294. package/stores/settings/useSettingsStore.ts +30 -9
  295. package/themes/createTheme.ts +1 -3
  296. package/types/events.ts +5 -5
  297. package/utils/chainType.ts +3 -2
  298. package/utils/elements.ts +21 -1
  299. package/utils/fees.ts +13 -15
  300. package/utils/format.ts +1 -1
  301. package/utils/navigationRoutes.ts +7 -1
  302. package/utils/svm.ts +10 -0
  303. package/utils/wallet.ts +1 -1
  304. package/_esm/components/Avatar/SmallAvatar.d.ts +0 -4
  305. package/_esm/components/Avatar/SmallAvatar.js +0 -12
  306. package/_esm/components/Avatar/SmallAvatar.js.map +0 -1
  307. package/_esm/components/Header/DisconnectIconButton.d.ts +0 -4
  308. package/_esm/components/Header/DisconnectIconButton.js +0 -12
  309. package/_esm/components/Header/DisconnectIconButton.js.map +0 -1
  310. package/_esm/hooks/useHeaderHeight.d.ts +0 -6
  311. package/_esm/hooks/useHeaderHeight.js +0 -23
  312. package/_esm/hooks/useHeaderHeight.js.map +0 -1
  313. package/_esm/providers/WalletProvider/UTXOBaseProvider.d.ts +0 -2
  314. package/_esm/providers/WalletProvider/UTXOBaseProvider.js +0 -17
  315. package/_esm/providers/WalletProvider/UTXOBaseProvider.js.map +0 -1
  316. package/_esm/providers/WalletProvider/UTXOExternalContext.d.ts +0 -1
  317. package/_esm/providers/WalletProvider/UTXOExternalContext.js +0 -3
  318. package/_esm/providers/WalletProvider/UTXOExternalContext.js.map +0 -1
  319. package/_esm/providers/WalletProvider/UTXOProvider.d.ts +0 -3
  320. package/_esm/providers/WalletProvider/UTXOProvider.js +0 -18
  321. package/_esm/providers/WalletProvider/UTXOProvider.js.map +0 -1
  322. package/components/Avatar/SmallAvatar.tsx +0 -16
  323. package/components/Header/DisconnectIconButton.tsx +0 -18
  324. package/hooks/useHeaderHeight.ts +0 -27
  325. package/providers/WalletProvider/UTXOBaseProvider.tsx +0 -28
  326. package/providers/WalletProvider/UTXOExternalContext.ts +0 -3
  327. package/providers/WalletProvider/UTXOProvider.tsx +0 -26
@@ -1,11 +1,19 @@
1
1
  import { Box, Container, ScopedCssBaseline, styled } from '@mui/material';
2
2
  import type { PropsWithChildren } from 'react';
3
3
  import { defaultMaxHeight } from '../config/constants.js';
4
- import { useHeaderHeight } from '../hooks/useHeaderHeight.js';
5
4
  import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js';
5
+ import { useHeaderHeight } from '../stores/header/useHeaderStore.js';
6
6
  import type { WidgetVariant } from '../types/widget.js';
7
7
  import { ElementId, createElementId } from '../utils/elements.js';
8
8
 
9
+ // NOTE: the setting of the height in AppExpandedContainer, RelativeContainer and CssBaselineContainer can
10
+ // be done dynamically by values in the config - namely the config.theme.container values display, maxHeight and height
11
+ // A Number of other components and hooks work with height values that are often set on or derived from these elements
12
+ // if there are changes to how the height works here you should also check the functionality of these hooks and their point of use
13
+ // - useTokenListHeight
14
+ // - useSetContentHeight
15
+ // Also check any code that is using the methods from elements.ts utils file
16
+
9
17
  export const AppExpandedContainer = styled(Box, {
10
18
  shouldForwardProp: (prop) => prop !== 'variant',
11
19
  })<{ variant?: WidgetVariant }>(({ theme, variant }) => ({
@@ -80,15 +88,12 @@ const CssBaselineContainer = styled(ScopedCssBaseline, {
80
88
  overflowY: 'auto',
81
89
  height: theme.container?.display === 'flex' ? 'auto' : '100%',
82
90
  paddingTop: paddingTopAdjustment,
83
- // The following allows for the token list to always fill the available height
84
- // use of CSS.escape here is to deal with characters such as ':' returned by reacts useId hook
85
- // related issue - https://github.com/facebook/react/issues/26839
86
- [`&:has(#${CSS.escape(createElementId(ElementId.TokenList, elementId))})`]:
87
- {
88
- height: theme.container?.maxHeight
89
- ? theme.container?.maxHeight
90
- : theme.container?.height || defaultMaxHeight,
91
- },
91
+ // This allows FullPageContainer.tsx to expand and fill the available vertical space in max height and default layout modes
92
+ [`&:has(.full-page-container)`]: {
93
+ height: theme.container?.maxHeight
94
+ ? theme.container?.maxHeight
95
+ : theme.container?.height || defaultMaxHeight,
96
+ },
92
97
  }),
93
98
  );
94
99
 
@@ -1,15 +1,15 @@
1
- import type { Account } from '@lifi/wallet-management';
2
1
  import { getConnectorIcon } from '@lifi/wallet-management';
3
2
  import { Wallet } from '@mui/icons-material';
4
3
  import { Badge } from '@mui/material';
4
+ import type { Account } from '../../hooks/useAccount.js';
5
5
  import { useChain } from '../../hooks/useChain.js';
6
6
  import type { ToAddress } from '../../types/widget.js';
7
+ import { SmallAvatar } from '../SmallAvatar.js';
7
8
  import {
8
9
  AvatarDefault,
9
10
  AvatarDefaultBadge,
10
11
  AvatarMasked,
11
12
  } from './Avatar.style.js';
12
- import { SmallAvatar } from './SmallAvatar.js';
13
13
 
14
14
  interface AccountAvatarProps {
15
15
  chainId?: number;
@@ -3,6 +3,7 @@ import {
3
3
  AvatarGroup,
4
4
  Box,
5
5
  Avatar as MuiAvatar,
6
+ Skeleton,
6
7
  avatarClasses,
7
8
  badgeClasses,
8
9
  styled,
@@ -13,20 +14,17 @@ export const AvatarMasked = styled(MuiAvatar)(({ theme }) => ({
13
14
  mask: avatarMask16,
14
15
  }));
15
16
 
17
+ export const AvatarSkeleton = styled(Skeleton)(({ theme }) => ({
18
+ mask: avatarMask16,
19
+ }));
20
+
16
21
  export const TokenAvatarGroup = styled(AvatarGroup)(({ theme }) => ({
17
22
  [`& .${badgeClasses.badge}:last-child .${avatarClasses.root}`]: {
18
- boxSizing: 'border-box',
19
- },
20
- [`& .${avatarClasses.root}`]: {
21
- border: 'none',
22
- marginLeft: 0,
23
- },
24
- [`& .${badgeClasses.root}:first-child`]: {
25
23
  marginLeft: theme.spacing(-1),
26
- border: 'none',
24
+ boxSizing: 'border-box',
27
25
  },
28
26
  [`& .${badgeClasses.root}:last-child`]: {
29
- border: 'none',
27
+ marginLeft: theme.spacing(1),
30
28
  },
31
29
  }));
32
30
 
@@ -59,14 +57,3 @@ export const AvatarDefaultBadge = styled(Box)(({ theme }) => {
59
57
  width: 16,
60
58
  };
61
59
  });
62
-
63
- export const AvatarSkeletonContainer = styled(Box)(({ theme }) => ({
64
- background: theme.palette.background.paper,
65
- borderRadius: '50%',
66
- }));
67
-
68
- export const AvatarSkeletonMaskedContainer = styled(Box)(({ theme }) => ({
69
- background: theme.palette.background.paper,
70
- borderRadius: '50%',
71
- mask: avatarMask16,
72
- }));
@@ -1,11 +1,11 @@
1
1
  import type { SxProps, Theme } from '@mui/material';
2
- import { Badge, Skeleton } from '@mui/material';
2
+ import { Badge } from '@mui/material';
3
+ import { SmallAvatarSkeleton } from '../SmallAvatar.js';
3
4
  import {
4
5
  AvatarDefault,
5
6
  AvatarDefaultBadge,
6
- AvatarSkeletonMaskedContainer,
7
+ AvatarSkeleton,
7
8
  } from './Avatar.style.js';
8
- import { SmallAvatarSkeleton } from './SmallAvatar.js';
9
9
 
10
10
  export const AvatarBadgedDefault: React.FC<{
11
11
  sx?: SxProps<Theme>;
@@ -32,15 +32,7 @@ export const AvatarBadgedSkeleton: React.FC<{
32
32
  badgeContent={<SmallAvatarSkeleton />}
33
33
  sx={sx}
34
34
  >
35
- <AvatarSkeleton />
35
+ <AvatarSkeleton width={40} height={40} variant="circular" />
36
36
  </Badge>
37
37
  );
38
38
  };
39
-
40
- export const AvatarSkeleton = () => {
41
- return (
42
- <AvatarSkeletonMaskedContainer>
43
- <Skeleton width={40} height={40} variant="circular" />
44
- </AvatarSkeletonMaskedContainer>
45
- );
46
- };
@@ -3,9 +3,9 @@ import type { SxProps, Theme } from '@mui/material';
3
3
  import { Badge } from '@mui/material';
4
4
  import { useChain } from '../../hooks/useChain.js';
5
5
  import { useToken } from '../../hooks/useToken.js';
6
+ import { SmallAvatar } from '../SmallAvatar.js';
6
7
  import { AvatarBadgedSkeleton } from './Avatar.js';
7
8
  import { AvatarDefaultBadge, AvatarMasked } from './Avatar.style.js';
8
- import { SmallAvatar } from './SmallAvatar.js';
9
9
 
10
10
  export const TokenAvatar: React.FC<{
11
11
  token?: StaticToken;
@@ -1,9 +1,11 @@
1
- import { useAccount, useWalletMenu } from '@lifi/wallet-management';
2
1
  import { LoadingButton } from '@mui/lab';
3
2
  import { useTranslation } from 'react-i18next';
3
+ import { useNavigate } from 'react-router-dom';
4
+ import { useAccount } from '../../hooks/useAccount.js';
4
5
  import { useChain } from '../../hooks/useChain.js';
5
6
  import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
6
7
  import { useFieldValues } from '../../stores/form/useFieldValues.js';
8
+ import { navigationRoutes } from '../../utils/navigationRoutes.js';
7
9
  import type { BaseTransactionButtonProps } from './types.js';
8
10
 
9
11
  export const BaseTransactionButton: React.FC<BaseTransactionButtonProps> = ({
@@ -13,8 +15,8 @@ export const BaseTransactionButton: React.FC<BaseTransactionButtonProps> = ({
13
15
  loading,
14
16
  }) => {
15
17
  const { t } = useTranslation();
18
+ const navigate = useNavigate();
16
19
  const { walletConfig } = useWidgetConfig();
17
- const { openWalletMenu } = useWalletMenu();
18
20
  const [fromChainId] = useFieldValues('fromChain');
19
21
  const { chain } = useChain(fromChainId);
20
22
  const { account } = useAccount({ chainType: chain?.chainType });
@@ -25,7 +27,7 @@ export const BaseTransactionButton: React.FC<BaseTransactionButtonProps> = ({
25
27
  } else if (walletConfig?.onConnect) {
26
28
  walletConfig.onConnect();
27
29
  } else {
28
- openWalletMenu();
30
+ navigate(navigationRoutes.selectWallet);
29
31
  }
30
32
  };
31
33
 
@@ -2,7 +2,6 @@ import type { EVMChain } from '@lifi/sdk';
2
2
  import { useChains } from '../../hooks/useChains.js';
3
3
  import { useSwapOnly } from '../../hooks/useSwapOnly.js';
4
4
  import { useToAddressReset } from '../../hooks/useToAddressReset.js';
5
- import { useHasExternalWalletProvider } from '../../providers/WalletProvider/useHasExternalWalletProvider.js';
6
5
  import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
7
6
  import { useChainOrder } from '../../stores/chains/useChainOrder.js';
8
7
  import type { FormType } from '../../stores/form/types.js';
@@ -16,15 +15,7 @@ export const useChainSelect = (formType: FormType) => {
16
15
  const chainKey = FormKeyHelper.getChainKey(formType);
17
16
  const { onChange } = useFieldController({ name: chainKey });
18
17
  const { setFieldValue, getFieldValues } = useFieldActions();
19
- const { hasExternalProvider, availableChainTypes } =
20
- useHasExternalWalletProvider();
21
- const { chains, isLoading, getChainById } = useChains(
22
- formType,
23
- formType === 'from' && hasExternalProvider
24
- ? availableChainTypes
25
- : undefined,
26
- );
27
-
18
+ const { chains, isLoading, getChainById } = useChains(formType);
28
19
  const [chainOrder, setChainOrder] = useChainOrder(formType);
29
20
  const swapOnly = useSwapOnly();
30
21
  const { tryResetToAddress } = useToAddressReset();
@@ -54,10 +54,7 @@ export const getFeeBreakdownTypography = (
54
54
  key={`${fee.token.address}${index}`}
55
55
  >
56
56
  {t(`format.currency`, { value: fee.amountUSD })} (
57
- {t(`format.number`, {
58
- value: parseFloat(formatUnits(fee.amount, fee.token.decimals)),
59
- maximumFractionDigits: Math.min(fee.token.decimals, 9),
60
- })}{' '}
57
+ {parseFloat(formatUnits(fee.amount, fee.token.decimals))?.toFixed(9)}{' '}
61
58
  {fee.token.symbol})
62
59
  </Typography>
63
60
  ));
@@ -0,0 +1,14 @@
1
+ import { styled } from '@mui/material';
2
+ import type { PageContainerProps } from './PageContainer.js';
3
+ import { PageContainer } from './PageContainer.js';
4
+
5
+ // In max height and default layout
6
+ // the PageContainer collapses to use the minimum space need to display its child components whereas
7
+ // the FullPageContainer expands and fills the available vertical space provide by the max-height
8
+ // See the CssBaselineContainer component styles in AppContainer.tsx for usage of full-page-container
9
+ export const FullPageContainer = styled((props: PageContainerProps) => (
10
+ <PageContainer
11
+ {...props}
12
+ className={`${props.className} full-page-container`}
13
+ />
14
+ ))``;
@@ -0,0 +1,24 @@
1
+ import { PowerSettingsNewRounded } from '@mui/icons-material';
2
+ import { IconButton } from '@mui/material';
3
+ import type { Connector } from 'wagmi';
4
+ import { useDisconnect } from 'wagmi';
5
+
6
+ export const EVMDisconnectIconButton = ({
7
+ connector,
8
+ }: {
9
+ connector?: Connector;
10
+ }) => {
11
+ const { disconnect } = useDisconnect();
12
+
13
+ return (
14
+ <IconButton
15
+ size="medium"
16
+ onClick={(e) => {
17
+ e.stopPropagation();
18
+ disconnect({ connector });
19
+ }}
20
+ >
21
+ <PowerSettingsNewRounded />
22
+ </IconButton>
23
+ );
24
+ };
@@ -1,7 +1,8 @@
1
1
  import type { FC, PropsWithChildren } from 'react';
2
+ import { useLayoutEffect, useRef } from 'react';
2
3
  import { useLocation } from 'react-router-dom';
3
4
  import { useDefaultElementId } from '../../hooks/useDefaultElementId.js';
4
- import { useHeaderHeight } from '../../hooks/useHeaderHeight.js';
5
+ import { useSetHeaderHeight } from '../../stores/header/useHeaderStore.js';
5
6
  import { ElementId, createElementId } from '../../utils/elements.js';
6
7
  import { stickyHeaderRoutes } from '../../utils/navigationRoutes.js';
7
8
  import { Container } from './Header.style.js';
@@ -11,13 +12,37 @@ import { WalletHeader } from './WalletHeader.js';
11
12
  export const HeaderContainer: FC<PropsWithChildren<{}>> = ({ children }) => {
12
13
  const { pathname } = useLocation();
13
14
  const elementId = useDefaultElementId();
14
- const { headerHeight } = useHeaderHeight();
15
+ const headerRef = useRef<HTMLDivElement>(null);
16
+ const { setHeaderHeight } = useSetHeaderHeight();
17
+
18
+ useLayoutEffect(() => {
19
+ const handleHeaderResize = () => {
20
+ const height = headerRef.current?.getBoundingClientRect().height;
21
+
22
+ if (height) {
23
+ setHeaderHeight(height);
24
+ }
25
+ };
26
+
27
+ let resizeObserver: ResizeObserver;
28
+
29
+ if (headerRef.current) {
30
+ resizeObserver = new ResizeObserver(handleHeaderResize);
31
+ resizeObserver.observe(headerRef.current);
32
+ }
33
+
34
+ return () => {
35
+ if (resizeObserver) {
36
+ resizeObserver.disconnect();
37
+ }
38
+ };
39
+ }, [headerRef, setHeaderHeight]);
15
40
 
16
41
  return (
17
42
  <Container
18
43
  id={createElementId(ElementId.Header, elementId)}
19
44
  sticky={stickyHeaderRoutes.some((route) => pathname.includes(route))}
20
- maxHeight={headerHeight}
45
+ ref={headerRef}
21
46
  >
22
47
  {children}
23
48
  </Container>
@@ -1,6 +1,6 @@
1
- import { useAccount } from '@lifi/wallet-management';
2
1
  import { Box, Typography } from '@mui/material';
3
2
  import { Route, Routes, useLocation } from 'react-router-dom';
3
+ import { useAccount } from '../../hooks/useAccount.js';
4
4
  import { useNavigateBack } from '../../hooks/useNavigateBack.js';
5
5
  import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
6
6
  import { useHeaderStore } from '../../stores/header/useHeaderStore.js';
@@ -0,0 +1,19 @@
1
+ import { PowerSettingsNewRounded } from '@mui/icons-material';
2
+ import { IconButton } from '@mui/material';
3
+ import { useWallet } from '@solana/wallet-adapter-react';
4
+
5
+ export const SVMDisconnectIconButton = () => {
6
+ const { disconnect } = useWallet();
7
+
8
+ return (
9
+ <IconButton
10
+ size="medium"
11
+ onClick={(e) => {
12
+ e.stopPropagation();
13
+ disconnect();
14
+ }}
15
+ >
16
+ <PowerSettingsNewRounded />
17
+ </IconButton>
18
+ );
19
+ };
@@ -1,19 +1,18 @@
1
- import type { Account } from '@lifi/wallet-management';
2
- import {
3
- getConnectorIcon,
4
- useAccount,
5
- useWalletMenu,
6
- } from '@lifi/wallet-management';
1
+ import { getConnectorIcon } from '@lifi/wallet-management';
7
2
  import { ExpandMore, Wallet } from '@mui/icons-material';
8
3
  import { Avatar, Badge } from '@mui/material';
9
4
  import { useState } from 'react';
10
5
  import { useTranslation } from 'react-i18next';
6
+ import { useLocation, useNavigate } from 'react-router-dom';
7
+ import type { Account } from '../../hooks/useAccount.js';
8
+ import { useAccount } from '../../hooks/useAccount.js';
11
9
  import { useChain } from '../../hooks/useChain.js';
12
10
  import { useHasExternalWalletProvider } from '../../providers/WalletProvider/useHasExternalWalletProvider.js';
13
11
  import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
14
12
  import { HiddenUI } from '../../types/widget.js';
13
+ import { navigationRoutes } from '../../utils/navigationRoutes.js';
15
14
  import { shortenAddress } from '../../utils/wallet.js';
16
- import { SmallAvatar } from '../Avatar/SmallAvatar.js';
15
+ import { SmallAvatar } from '../SmallAvatar.js';
17
16
  import { CloseDrawerButton } from './CloseDrawerButton.js';
18
17
  import {
19
18
  DrawerWalletContainer,
@@ -71,16 +70,16 @@ export const WalletMenuButton: React.FC = () => {
71
70
 
72
71
  const ConnectButton = () => {
73
72
  const { t } = useTranslation();
73
+ const { pathname } = useLocation();
74
74
  const { walletConfig, subvariant, variant } = useWidgetConfig();
75
- const { openWalletMenu } = useWalletMenu();
75
+ const navigate = useNavigate();
76
76
  const connect = async () => {
77
77
  if (walletConfig?.onConnect) {
78
78
  walletConfig.onConnect();
79
79
  return;
80
80
  }
81
- openWalletMenu();
81
+ navigate(navigationRoutes.selectWallet);
82
82
  };
83
-
84
83
  return (
85
84
  <WalletButton
86
85
  subvariant={subvariant}
@@ -92,7 +91,9 @@ const ConnectButton = () => {
92
91
  <Wallet sx={{ marginLeft: -0.25 }} />
93
92
  ) : undefined
94
93
  }
95
- onClick={connect}
94
+ onClick={
95
+ !pathname.includes(navigationRoutes.selectWallet) ? connect : undefined
96
+ }
96
97
  >
97
98
  {t(`button.connectWallet`)}
98
99
  </WalletButton>
@@ -17,15 +17,11 @@ export const WalletMenuContainer = styled(MuiMenu)(({ theme }) => ({
17
17
  },
18
18
  [`& .${menuItemClasses.root}`]: {
19
19
  borderRadius: theme.shape.borderRadiusSecondary,
20
- padding: theme.spacing(1, 0, 1, 1),
20
+ padding: theme.spacing(1, 2, 1, 1),
21
21
  [`& .${svgIconClasses.root}`]: {
22
22
  fontSize: 20,
23
23
  color: theme.palette.text.primary,
24
24
  },
25
- ':hover': {
26
- background: 'none',
27
- cursor: 'default',
28
- },
29
25
  },
30
26
  },
31
27
  }));
@@ -1,8 +1,5 @@
1
- import {
2
- getConnectorIcon,
3
- useAccount,
4
- useWalletMenu,
5
- } from '@lifi/wallet-management';
1
+ import { ChainType } from '@lifi/sdk';
2
+ import { getConnectorIcon } from '@lifi/wallet-management';
6
3
  import {
7
4
  ContentCopyRounded,
8
5
  OpenInNewRounded,
@@ -17,20 +14,25 @@ import {
17
14
  MenuItem,
18
15
  } from '@mui/material';
19
16
  import { useTranslation } from 'react-i18next';
17
+ import { useLocation, useNavigate } from 'react-router-dom';
18
+ import { useAccount } from '../../hooks/useAccount.js';
20
19
  import { useAvailableChains } from '../../hooks/useAvailableChains.js';
21
20
  import { useExplorer } from '../../hooks/useExplorer.js';
21
+ import { navigationRoutes } from '../../utils/navigationRoutes.js';
22
22
  import { shortenAddress } from '../../utils/wallet.js';
23
23
  import { AvatarMasked } from '../Avatar/Avatar.style.js';
24
- import { SmallAvatar } from '../Avatar/SmallAvatar.js';
25
- import { DisconnectIconButton } from './DisconnectIconButton.js';
24
+ import { SmallAvatar } from '../SmallAvatar.js';
25
+ import { EVMDisconnectIconButton } from './EVMDisconnectIconButton.js';
26
+ import { SVMDisconnectIconButton } from './SVMDisconnectIconButton.js';
26
27
 
27
28
  export const WalletMenu = ({ onClose }: { onClose: () => void }) => {
28
29
  const { t } = useTranslation();
30
+ const navigate = useNavigate();
31
+ const { pathname } = useLocation();
29
32
  const { accounts } = useAccount();
30
33
  const { getChainById } = useAvailableChains();
31
- const { openWalletMenu } = useWalletMenu();
32
34
  const connect = async () => {
33
- openWalletMenu();
35
+ navigate(navigationRoutes.selectWallet);
34
36
  onClose();
35
37
  };
36
38
  const { getAddressLink } = useExplorer();
@@ -47,7 +49,7 @@ export const WalletMenu = ({ onClose }: { onClose: () => void }) => {
47
49
  };
48
50
 
49
51
  return (
50
- <MenuItem key={account.address} disableTouchRipple>
52
+ <MenuItem key={account.address}>
51
53
  <Box flex={1} display="flex" alignItems="center">
52
54
  {chain?.logoURI ? (
53
55
  <Badge
@@ -80,7 +82,7 @@ export const WalletMenu = ({ onClose }: { onClose: () => void }) => {
80
82
  )}
81
83
  {walletAddress}
82
84
  </Box>
83
- <Box ml={2}>
85
+ <Box ml={1}>
84
86
  <IconButton size="medium" onClick={handleCopyAddress}>
85
87
  <ContentCopyRounded />
86
88
  </IconButton>
@@ -97,22 +99,30 @@ export const WalletMenu = ({ onClose }: { onClose: () => void }) => {
97
99
  >
98
100
  <OpenInNewRounded />
99
101
  </IconButton>
100
- <DisconnectIconButton account={account} />
102
+ {account.chainType === ChainType.EVM ? (
103
+ <EVMDisconnectIconButton connector={account.connector} />
104
+ ) : account.chainType === ChainType.SVM ? (
105
+ <SVMDisconnectIconButton />
106
+ ) : null}
101
107
  </Box>
102
108
  </MenuItem>
103
109
  );
104
110
  })}
105
111
  </Box>
106
- <Button
107
- onClick={connect}
108
- fullWidth
109
- startIcon={<PowerSettingsNewRounded />}
110
- sx={{
111
- marginTop: 1,
112
- }}
113
- >
114
- {t(`button.connectAnotherWallet`)}
115
- </Button>
112
+ {!pathname.includes(navigationRoutes.selectWallet) ? (
113
+ <Button
114
+ onClick={connect}
115
+ fullWidth
116
+ startIcon={<PowerSettingsNewRounded />}
117
+ sx={{
118
+ marginTop: 1,
119
+ }}
120
+ >
121
+ {accounts.length > 1
122
+ ? t(`button.changeWallet`)
123
+ : t(`button.connectWallet`)}
124
+ </Button>
125
+ ) : null}
116
126
  </>
117
127
  );
118
128
  };
@@ -1,6 +1,7 @@
1
+ import type { ContainerProps } from '@mui/material';
1
2
  import { Container, styled } from '@mui/material';
2
3
 
3
- export interface PageContainerProps {
4
+ export interface PageContainerProps extends ContainerProps {
4
5
  halfGutters?: boolean;
5
6
  topGutters?: boolean;
6
7
  bottomGutters?: boolean;
@@ -0,0 +1,14 @@
1
+ import { useEffect } from 'react';
2
+ import { useLocation } from 'react-router-dom';
3
+ import { useWidgetEvents } from '../hooks/useWidgetEvents.js';
4
+ import { WidgetEvent } from '../types/events.js';
5
+
6
+ export function PageEntered() {
7
+ const location = useLocation();
8
+ const emitter = useWidgetEvents();
9
+
10
+ useEffect(() => {
11
+ emitter.emit(WidgetEvent.PageEntered, location.pathname);
12
+ }, [emitter, location.pathname]);
13
+ return null;
14
+ }
@@ -1,10 +1,11 @@
1
+ /* eslint-disable react/no-array-index-key */
1
2
  import type { Route } from '@lifi/sdk';
2
- import { useAccount } from '@lifi/wallet-management';
3
3
  import { Collapse, Grow, Stack, Typography } from '@mui/material';
4
4
  import { useEffect, useRef } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import type { RouteObject } from 'react-router-dom';
7
7
  import { useRoutes as useDOMRoutes, useNavigate } from 'react-router-dom';
8
+ import { useAccount } from '../../hooks/useAccount.js';
8
9
  import { useRoutes } from '../../hooks/useRoutes.js';
9
10
  import { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js';
10
11
  import { useWidgetEvents } from '../../hooks/useWidgetEvents.js';
@@ -0,0 +1,46 @@
1
+ import { Box, List, styled } from '@mui/material';
2
+ import { Input as InputBase } from '../../components/Input.js';
3
+
4
+ export const Input = styled(InputBase)(({ theme }) => ({
5
+ paddingRight: theme.spacing(1.5),
6
+ }));
7
+
8
+ interface SearchStickyContainerProps {
9
+ headerHeight: number;
10
+ }
11
+
12
+ export const searchContainerHeight = 64;
13
+
14
+ // When the widget is in Full Height layout mode in order to appear "sticky the StickySearchInputContainer needs to use
15
+ // position fixed in the same way as the header (see Header.tsx). The headerHeight value here is used as the top value
16
+ // to ensure that this container positioned correctly beneath the header
17
+ export const StickySearchInputContainer = styled(Box, {
18
+ shouldForwardProp: (prop) => prop !== 'headerHeight',
19
+ })<SearchStickyContainerProps>(({ theme, headerHeight }) => ({
20
+ position: 'sticky',
21
+ top: headerHeight,
22
+ zIndex: 1,
23
+ height: searchContainerHeight,
24
+ paddingBottom: theme.spacing(2),
25
+ paddingLeft: theme.spacing(3),
26
+ paddingRight: theme.spacing(3),
27
+ backgroundColor: theme.palette.background.default,
28
+ ...(theme.header?.position === 'fixed'
29
+ ? {
30
+ position: 'fixed',
31
+ minWidth: theme.breakpoints.values.xs,
32
+ maxWidth: theme.breakpoints.values.sm,
33
+ width: '100%',
34
+ }
35
+ : {}),
36
+ }));
37
+
38
+ // When in Full Height layout mode, as the StickySearchInputContainer (see above) uses fixed position, the list element needs to provide
39
+ // additional paddingTop in order to be positioned correctly.
40
+ export const SearchList = styled(List)(({ theme }) => ({
41
+ paddingTop:
42
+ theme.header?.position === 'fixed' ? `${searchContainerHeight}px` : 0,
43
+ paddingLeft: theme.spacing(1.5),
44
+ paddingRight: theme.spacing(1.5),
45
+ paddingBottom: theme.spacing(1.5),
46
+ }));
@@ -0,0 +1,57 @@
1
+ import { Search } from '@mui/icons-material';
2
+ import { FormControl, InputAdornment } from '@mui/material';
3
+ import type { FocusEventHandler, FormEventHandler } from 'react';
4
+ import { InputCard } from '../../components/Card/InputCard.js';
5
+ import { useHeaderHeight } from '../../stores/header/useHeaderStore.js';
6
+ import { Input, StickySearchInputContainer } from './SearchInput.style.js';
7
+
8
+ interface SearchInputProps {
9
+ name?: string;
10
+ value?: string;
11
+ placeholder?: string;
12
+ onChange?: FormEventHandler<HTMLInputElement>;
13
+ onBlur?: FocusEventHandler<HTMLInputElement>;
14
+ }
15
+
16
+ export const SearchInput = ({
17
+ name,
18
+ placeholder,
19
+ onChange,
20
+ onBlur,
21
+ value,
22
+ }: SearchInputProps) => {
23
+ return (
24
+ <InputCard>
25
+ <FormControl fullWidth>
26
+ <Input
27
+ size="small"
28
+ placeholder={placeholder}
29
+ endAdornment={
30
+ <InputAdornment position="end">
31
+ <Search />
32
+ </InputAdornment>
33
+ }
34
+ inputProps={{
35
+ inputMode: 'search',
36
+ onChange,
37
+ onBlur,
38
+ name,
39
+ value,
40
+ maxLength: 128,
41
+ }}
42
+ autoComplete="off"
43
+ />
44
+ </FormControl>
45
+ </InputCard>
46
+ );
47
+ };
48
+
49
+ export const StickySearchInput = ({ ...rest }: SearchInputProps) => {
50
+ const { headerHeight } = useHeaderHeight();
51
+
52
+ return (
53
+ <StickySearchInputContainer headerHeight={headerHeight}>
54
+ <SearchInput {...rest} />
55
+ </StickySearchInputContainer>
56
+ );
57
+ };