@lifi/widget 3.24.3 → 3.25.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/AppDefault.js +3 -3
- package/dist/esm/AppDefault.js.map +1 -1
- package/dist/esm/AppDrawer.style.d.ts +1 -1
- package/dist/esm/AppProvider.js +2 -2
- package/dist/esm/AppProvider.js.map +1 -1
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.style.js +1 -1
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.style.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.style.js +1 -1
- package/dist/esm/components/AmountInput/AmountInput.style.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.d.ts +1 -1
- package/dist/esm/components/AppContainer.js +6 -13
- package/dist/esm/components/AppContainer.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.style.js +1 -1
- package/dist/esm/components/Avatar/Avatar.style.js.map +1 -1
- package/dist/esm/components/ButtonTertiary.d.ts +1 -1
- package/dist/esm/components/Card/CardButton.style.js +1 -1
- package/dist/esm/components/Card/CardButton.style.js.map +1 -1
- package/dist/esm/components/Card/CardHeader.js +1 -1
- package/dist/esm/components/Card/CardHeader.js.map +1 -1
- package/dist/esm/components/Card/CardIconButton.d.ts +1 -1
- package/dist/esm/components/Card/CardLabel.js +1 -1
- package/dist/esm/components/Card/CardLabel.js.map +1 -1
- package/dist/esm/components/Card/CardTitle.js +1 -1
- package/dist/esm/components/Card/CardTitle.js.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.js +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.js.map +1 -1
- package/dist/esm/components/ChainSelect/useChainSelect.js +13 -2
- package/dist/esm/components/ChainSelect/useChainSelect.js.map +1 -1
- package/dist/esm/components/Chains/ChainList.d.ts +13 -0
- package/dist/esm/components/Chains/ChainList.js +17 -0
- package/dist/esm/components/Chains/ChainList.js.map +1 -0
- package/dist/esm/components/Chains/ChainList.style.d.ts +14 -0
- package/dist/esm/components/Chains/ChainList.style.js +38 -0
- package/dist/esm/components/Chains/ChainList.style.js.map +1 -0
- package/dist/esm/components/Chains/ChainListItem.d.ts +11 -0
- package/dist/esm/components/Chains/ChainListItem.js +11 -0
- package/dist/esm/components/Chains/ChainListItem.js.map +1 -0
- package/dist/esm/components/Chains/ChainSearchInput.d.ts +10 -0
- package/dist/esm/components/Chains/ChainSearchInput.js +19 -0
- package/dist/esm/components/Chains/ChainSearchInput.js.map +1 -0
- package/dist/esm/components/Chains/ChainsExpanded.d.ts +7 -0
- package/dist/esm/components/Chains/ChainsExpanded.js +11 -0
- package/dist/esm/components/Chains/ChainsExpanded.js.map +1 -0
- package/dist/esm/components/Chains/ChainsExpanded.style.d.ts +6 -0
- package/dist/esm/components/Chains/ChainsExpanded.style.js +16 -0
- package/dist/esm/components/Chains/ChainsExpanded.style.js.map +1 -0
- package/dist/esm/components/Chains/SelectChainContent.d.ts +9 -0
- package/dist/esm/components/Chains/SelectChainContent.js +60 -0
- package/dist/esm/components/Chains/SelectChainContent.js.map +1 -0
- package/dist/esm/components/Chains/VirtualizedChainList.d.ts +11 -0
- package/dist/esm/components/Chains/VirtualizedChainList.js +40 -0
- package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -0
- package/dist/esm/components/Expansion/Expansion.d.ts +1 -0
- package/dist/esm/components/Expansion/Expansion.js +41 -0
- package/dist/esm/components/Expansion/Expansion.js.map +1 -0
- package/dist/esm/components/Expansion/ExpansionTransition.d.ts +9 -0
- package/dist/esm/components/Expansion/ExpansionTransition.js +45 -0
- package/dist/esm/components/Expansion/ExpansionTransition.js.map +1 -0
- package/dist/esm/components/Header/Header.js +1 -1
- package/dist/esm/components/Header/Header.js.map +1 -1
- package/dist/esm/components/Header/Header.style.d.ts +1 -1
- package/dist/esm/components/Header/Header.style.js +0 -1
- package/dist/esm/components/Header/Header.style.js.map +1 -1
- package/dist/esm/components/Header/NavigationHeader.js +2 -2
- package/dist/esm/components/Header/NavigationHeader.js.map +1 -1
- package/dist/esm/components/Header/SettingsButton.style.d.ts +1 -1
- package/dist/esm/components/Header/SettingsButton.style.js +1 -1
- package/dist/esm/components/Header/SettingsButton.style.js.map +1 -1
- package/dist/esm/components/ListItem/ListItem.js +1 -1
- package/dist/esm/components/ListItem/ListItem.js.map +1 -1
- package/dist/esm/components/ListItemButton.js +13 -1
- package/dist/esm/components/ListItemButton.js.map +1 -1
- package/dist/esm/components/ListItemText.js +1 -1
- package/dist/esm/components/ListItemText.js.map +1 -1
- package/dist/esm/components/ProgressToNextUpdate.js +1 -1
- package/dist/esm/components/ProgressToNextUpdate.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteCard.js +4 -4
- package/dist/esm/components/RouteCard/RouteCard.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteCardEssentials.js +5 -5
- package/dist/esm/components/RouteCard/RouteCardEssentials.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteNotFoundCard.js +1 -0
- package/dist/esm/components/RouteCard/RouteNotFoundCard.js.map +1 -1
- package/dist/esm/components/RouteCard/getMatchingLabels.js +5 -3
- package/dist/esm/components/RouteCard/getMatchingLabels.js.map +1 -1
- package/dist/esm/components/Routes/Routes.js +1 -1
- package/dist/esm/components/Routes/Routes.js.map +1 -1
- package/dist/esm/components/Routes/RoutesContent.d.ts +14 -0
- package/dist/esm/components/Routes/RoutesContent.js +55 -0
- package/dist/esm/components/Routes/RoutesContent.js.map +1 -0
- package/dist/esm/components/Routes/RoutesExpanded.d.ts +7 -2
- package/dist/esm/components/Routes/RoutesExpanded.js +12 -70
- package/dist/esm/components/Routes/RoutesExpanded.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.style.d.ts +1 -3
- package/dist/esm/components/Routes/RoutesExpanded.style.js +4 -16
- package/dist/esm/components/Routes/RoutesExpanded.style.js.map +1 -1
- package/dist/esm/components/Search/SearchInput.d.ts +5 -2
- package/dist/esm/components/Search/SearchInput.js +7 -3
- package/dist/esm/components/Search/SearchInput.js.map +1 -1
- package/dist/esm/components/Search/SearchInput.style.d.ts +4 -1
- package/dist/esm/components/Search/SearchInput.style.js +25 -3
- package/dist/esm/components/Search/SearchInput.style.js.map +1 -1
- package/dist/esm/components/Search/SearchNotFound.style.js +2 -1
- package/dist/esm/components/Search/SearchNotFound.style.js.map +1 -1
- package/dist/esm/components/Select.js +1 -1
- package/dist/esm/components/Select.js.map +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.js +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.js.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.js +2 -7
- package/dist/esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.d.ts +2 -2
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.js +0 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.js.map +1 -1
- package/dist/esm/components/Step/CircularProgress.style.js +1 -1
- package/dist/esm/components/Step/CircularProgress.style.js.map +1 -1
- package/dist/esm/components/StepActions/StepActions.js +3 -3
- package/dist/esm/components/StepActions/StepActions.style.js +1 -1
- package/dist/esm/components/StepActions/StepActions.style.js.map +1 -1
- package/dist/esm/components/TextFitter/TextFitter.js +1 -1
- package/dist/esm/components/TextFitter/TextFitter.js.map +1 -1
- package/dist/esm/components/Token/Token.js +2 -2
- package/dist/esm/components/Token/Token.js.map +1 -1
- package/dist/esm/components/Token/Token.style.js +1 -1
- package/dist/esm/components/Token/Token.style.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheet.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.style.js +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.style.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.js +3 -3
- package/dist/esm/components/TokenList/TokenList.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.style.d.ts +2 -1
- package/dist/esm/components/TokenList/TokenList.style.js +6 -1
- package/dist/esm/components/TokenList/TokenList.style.js.map +1 -1
- package/dist/esm/components/TokenList/TokenListItem.js +16 -7
- package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.js +13 -7
- package/dist/esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/dist/esm/components/TokenList/types.d.ts +3 -0
- package/dist/esm/components/TokenRate/TokenRate.js +1 -1
- package/dist/esm/components/TokenRate/TokenRate.js.map +1 -1
- package/dist/esm/components/TokenRate/TokenRate.style.js +1 -1
- package/dist/esm/components/TokenRate/TokenRate.style.js.map +1 -1
- package/dist/esm/components/TransactionDetails.js +7 -9
- package/dist/esm/components/TransactionDetails.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/config/version.js.map +1 -1
- package/dist/esm/hooks/timer/time.js +1 -1
- package/dist/esm/hooks/timer/time.js.map +1 -1
- package/dist/esm/hooks/timer/useTimer.js.map +1 -1
- package/dist/esm/hooks/useAvailableChains.js +3 -2
- package/dist/esm/hooks/useAvailableChains.js.map +1 -1
- package/dist/esm/hooks/useChains.js +4 -4
- package/dist/esm/hooks/useChains.js.map +1 -1
- package/dist/esm/hooks/useExpansionRoutes.d.ts +2 -0
- package/dist/esm/hooks/useExpansionRoutes.js +26 -0
- package/dist/esm/hooks/useExpansionRoutes.js.map +1 -0
- package/dist/esm/hooks/useHasChainExpansion.d.ts +2 -0
- package/dist/esm/hooks/useHasChainExpansion.js +16 -0
- package/dist/esm/hooks/useHasChainExpansion.js.map +1 -0
- package/dist/esm/hooks/useIsBatchingSupported.js +4 -1
- package/dist/esm/hooks/useIsBatchingSupported.js.map +1 -1
- package/dist/esm/hooks/useListHeight.js +1 -1
- package/dist/esm/hooks/useListHeight.js.map +1 -1
- package/dist/esm/hooks/useRouteExecution.js +3 -3
- package/dist/esm/hooks/useRouteExecution.js.map +1 -1
- package/dist/esm/hooks/useRoutes.js +6 -3
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useToAddressReset.js +10 -2
- package/dist/esm/hooks/useToAddressReset.js.map +1 -1
- package/dist/esm/hooks/useTokenBalance.js.map +1 -1
- package/dist/esm/hooks/useTokenBalances.js +1 -0
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenSearch.js +6 -4
- package/dist/esm/hooks/useTokenSearch.js.map +1 -1
- package/dist/esm/hooks/useTokens.js +5 -3
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/hooks/useTools.js +5 -3
- package/dist/esm/hooks/useTools.js.map +1 -1
- package/dist/esm/hooks/useTransactionDetails.js.map +1 -1
- package/dist/esm/hooks/useWidgetEvents.js.map +1 -1
- package/dist/esm/i18n/bn.json +2 -1
- package/dist/esm/i18n/de.json +2 -1
- package/dist/esm/i18n/en.json +2 -1
- package/dist/esm/i18n/es.json +2 -1
- package/dist/esm/i18n/fr.json +2 -1
- package/dist/esm/i18n/hi.json +1 -0
- package/dist/esm/i18n/id.json +2 -1
- package/dist/esm/i18n/it.json +2 -1
- package/dist/esm/i18n/ja.json +2 -1
- package/dist/esm/i18n/ko.json +2 -1
- package/dist/esm/i18n/pl.json +350 -0
- package/dist/esm/i18n/pt.json +2 -1
- package/dist/esm/i18n/th.json +2 -1
- package/dist/esm/i18n/tr.json +2 -1
- package/dist/esm/i18n/uk.json +14 -13
- package/dist/esm/i18n/vi.json +2 -1
- package/dist/esm/i18n/zh.json +2 -1
- package/dist/esm/index.d.ts +8 -8
- package/dist/esm/index.js +8 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pages/RoutesPage/RoutesPage.js +1 -1
- package/dist/esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/dist/esm/pages/SelectChainPage/SelectChainPage.js +7 -33
- package/dist/esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
- package/dist/esm/pages/SelectEnabledToolsPage.js +1 -1
- package/dist/esm/pages/SelectEnabledToolsPage.js.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js +1 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js +20 -11
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/BookmarksPage.js +1 -1
- package/dist/esm/pages/SendToWallet/BookmarksPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.d.ts +2 -2
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.js +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCard.style.js +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCard.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js +1 -3
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js.map +1 -1
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryPage.js +8 -5
- package/dist/esm/pages/TransactionHistoryPage/TransactionHistoryPage.js.map +1 -1
- package/dist/esm/pages/TransactionPage/RouteTracker.js +2 -2
- package/dist/esm/pages/TransactionPage/RouteTracker.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js +4 -4
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js.map +1 -1
- package/dist/esm/providers/I18nProvider/I18nProvider.js +8 -4
- package/dist/esm/providers/I18nProvider/I18nProvider.js.map +1 -1
- package/dist/esm/providers/QueryClientProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/SDKProviders.js +1 -1
- package/dist/esm/providers/WalletProvider/SDKProviders.js.map +1 -1
- package/dist/esm/providers/WalletProvider/SuiBaseProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/SuiBaseProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/WalletProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/useExternalWalletProvider.js +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.js +5 -3
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/form/FormStore.js +1 -1
- package/dist/esm/stores/form/FormStore.js.map +1 -1
- package/dist/esm/stores/form/FormUpdater.js +21 -5
- package/dist/esm/stores/form/FormUpdater.js.map +1 -1
- package/dist/esm/stores/form/URLSearchParamsBuilder.js +1 -1
- package/dist/esm/stores/form/URLSearchParamsBuilder.js.map +1 -1
- package/dist/esm/stores/form/useFormRef.js.map +1 -1
- package/dist/esm/stores/routes/createRouteExecutionStore.js +1 -1
- package/dist/esm/stores/routes/createRouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/settings/useSettingsStore.js.map +1 -1
- package/dist/esm/types/widget.d.ts +25 -6
- package/dist/esm/types/widget.js +6 -0
- package/dist/esm/types/widget.js.map +1 -1
- package/dist/esm/utils/deepEqual.js +2 -2
- package/dist/esm/utils/deepEqual.js.map +1 -1
- package/dist/esm/utils/item.d.ts +5 -15
- package/dist/esm/utils/item.js +23 -19
- package/dist/esm/utils/item.js.map +1 -1
- package/dist/esm/utils/widgetSize.d.ts +3 -0
- package/dist/esm/utils/widgetSize.js +11 -0
- package/dist/esm/utils/widgetSize.js.map +1 -0
- package/package.json +7 -6
- package/package.json.tmp +12 -6
- package/src/AppDefault.tsx +3 -3
- package/src/AppProvider.tsx +2 -2
- package/src/components/ActiveTransactions/ActiveTransactions.style.ts +1 -1
- package/src/components/AmountInput/AmountInput.style.tsx +1 -1
- package/src/components/AppContainer.tsx +6 -14
- package/src/components/Avatar/Avatar.style.tsx +2 -2
- package/src/components/Card/CardButton.style.tsx +1 -1
- package/src/components/Card/CardHeader.tsx +1 -1
- package/src/components/Card/CardLabel.tsx +1 -1
- package/src/components/Card/CardTitle.tsx +1 -1
- package/src/components/ChainSelect/ChainSelect.tsx +1 -1
- package/src/components/ChainSelect/useChainSelect.ts +37 -23
- package/src/components/Chains/ChainList.style.tsx +59 -0
- package/src/components/Chains/ChainList.tsx +86 -0
- package/src/components/Chains/ChainListItem.tsx +52 -0
- package/src/components/Chains/ChainSearchInput.tsx +52 -0
- package/src/components/Chains/ChainsExpanded.style.tsx +21 -0
- package/src/components/Chains/ChainsExpanded.tsx +28 -0
- package/src/components/Chains/SelectChainContent.tsx +116 -0
- package/src/components/Chains/VirtualizedChainList.tsx +84 -0
- package/src/components/Expansion/Expansion.tsx +62 -0
- package/src/components/Expansion/ExpansionTransition.tsx +76 -0
- package/src/components/Header/Header.style.ts +0 -1
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Header/NavigationHeader.tsx +2 -2
- package/src/components/Header/SettingsButton.style.tsx +1 -1
- package/src/components/ListItem/ListItem.tsx +1 -1
- package/src/components/ListItemButton.tsx +17 -1
- package/src/components/ListItemText.tsx +1 -1
- package/src/components/ProgressToNextUpdate.tsx +1 -1
- package/src/components/RouteCard/RouteCard.tsx +4 -4
- package/src/components/RouteCard/RouteCardEssentials.tsx +5 -5
- package/src/components/RouteCard/RouteNotFoundCard.tsx +1 -0
- package/src/components/RouteCard/getMatchingLabels.ts +11 -3
- package/src/components/Routes/Routes.tsx +1 -1
- package/src/components/Routes/RoutesContent.tsx +137 -0
- package/src/components/Routes/RoutesExpanded.style.ts +4 -18
- package/src/components/Routes/RoutesExpanded.tsx +33 -158
- package/src/components/Search/SearchInput.style.tsx +36 -3
- package/src/components/Search/SearchInput.tsx +31 -5
- package/src/components/Search/SearchNotFound.style.tsx +2 -1
- package/src/components/Select.tsx +1 -1
- package/src/components/SelectTokenButton/SelectTokenButton.style.tsx +1 -1
- package/src/components/SendToWallet/SendToWalletButton.tsx +2 -3
- package/src/components/Skeleton/WidgetSkeleton.style.tsx +0 -1
- package/src/components/Step/CircularProgress.style.tsx +1 -1
- package/src/components/StepActions/StepActions.style.tsx +1 -1
- package/src/components/StepActions/StepActions.tsx +3 -3
- package/src/components/TextFitter/TextFitter.tsx +1 -1
- package/src/components/Token/Token.style.tsx +1 -1
- package/src/components/Token/Token.tsx +2 -2
- package/src/components/TokenList/TokenDetailsSheet.tsx +1 -0
- package/src/components/TokenList/TokenDetailsSheetContent.style.tsx +1 -1
- package/src/components/TokenList/TokenDetailsSheetContent.tsx +1 -1
- package/src/components/TokenList/TokenList.style.tsx +11 -1
- package/src/components/TokenList/TokenList.tsx +6 -2
- package/src/components/TokenList/TokenListItem.tsx +53 -37
- package/src/components/TokenList/VirtualizedTokenList.tsx +17 -5
- package/src/components/TokenList/types.ts +3 -0
- package/src/components/TokenRate/TokenRate.style.ts +1 -1
- package/src/components/TokenRate/TokenRate.tsx +1 -1
- package/src/components/TransactionDetails.tsx +9 -9
- package/src/config/version.ts +1 -1
- package/src/hooks/timer/time.ts +1 -1
- package/src/hooks/timer/useTimer.ts +1 -1
- package/src/hooks/useAvailableChains.ts +8 -2
- package/src/hooks/useChains.ts +10 -4
- package/src/hooks/useExpansionRoutes.ts +29 -0
- package/src/hooks/useHasChainExpansion.ts +19 -0
- package/src/hooks/useIsBatchingSupported.ts +5 -2
- package/src/hooks/useListHeight.ts +1 -1
- package/src/hooks/useRouteExecution.ts +3 -3
- package/src/hooks/useRoutes.ts +8 -2
- package/src/hooks/useToAddressReset.ts +32 -21
- package/src/hooks/useTokenBalance.ts +1 -1
- package/src/hooks/useTokenBalances.ts +1 -0
- package/src/hooks/useTokenSearch.ts +23 -6
- package/src/hooks/useTokens.ts +16 -6
- package/src/hooks/useTools.ts +12 -4
- package/src/hooks/useTransactionDetails.ts +1 -1
- package/src/hooks/useWidgetEvents.ts +1 -0
- package/src/i18n/bn.json +2 -1
- package/src/i18n/de.json +2 -1
- package/src/i18n/en.json +2 -1
- package/src/i18n/es.json +2 -1
- package/src/i18n/fr.json +2 -1
- package/src/i18n/hi.json +1 -0
- package/src/i18n/id.json +2 -1
- package/src/i18n/it.json +2 -1
- package/src/i18n/ja.json +2 -1
- package/src/i18n/ko.json +2 -1
- package/src/i18n/pl.json +350 -0
- package/src/i18n/pt.json +2 -1
- package/src/i18n/th.json +2 -1
- package/src/i18n/tr.json +2 -1
- package/src/i18n/uk.json +14 -13
- package/src/i18n/vi.json +2 -1
- package/src/i18n/zh.json +2 -1
- package/src/index.ts +8 -8
- package/src/pages/RoutesPage/RoutesPage.tsx +1 -1
- package/src/pages/SelectChainPage/SelectChainPage.tsx +18 -71
- package/src/pages/SelectEnabledToolsPage.tsx +1 -1
- package/src/pages/SelectTokenPage/SearchTokenInput.tsx +2 -0
- package/src/pages/SelectTokenPage/SelectTokenPage.tsx +44 -22
- package/src/pages/SendToWallet/BookmarksPage.tsx +1 -1
- package/src/pages/SendToWallet/SendToWalletPage.style.tsx +3 -3
- package/src/pages/SettingsPage/SettingsCard/SettingCard.style.tsx +1 -1
- package/src/pages/SettingsPage/SettingsCard/SettingCardExpandable.tsx +1 -1
- package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.tsx +1 -1
- package/src/pages/TransactionHistoryPage/TransactionHistoryPage.tsx +12 -7
- package/src/pages/TransactionPage/RouteTracker.tsx +2 -2
- package/src/pages/TransactionPage/TokenValueBottomSheet.tsx +4 -4
- package/src/providers/I18nProvider/I18nProvider.tsx +10 -4
- package/src/providers/QueryClientProvider.tsx +1 -1
- package/src/providers/WalletProvider/SDKProviders.tsx +1 -1
- package/src/providers/WalletProvider/SuiBaseProvider.tsx +1 -1
- package/src/providers/WalletProvider/WalletProvider.tsx +1 -1
- package/src/providers/WalletProvider/useExternalWalletProvider.ts +1 -1
- package/src/stores/chains/ChainOrderStore.tsx +8 -3
- package/src/stores/form/FormStore.tsx +1 -1
- package/src/stores/form/FormUpdater.tsx +40 -6
- package/src/stores/form/URLSearchParamsBuilder.tsx +1 -1
- package/src/stores/form/useFormRef.ts +50 -54
- package/src/stores/routes/createRouteExecutionStore.ts +1 -1
- package/src/stores/settings/useSettingsStore.ts +1 -0
- package/src/types/widget.ts +29 -6
- package/src/utils/deepEqual.ts +2 -2
- package/src/utils/item.ts +46 -40
- package/src/utils/widgetSize.ts +17 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { ExtendedChain } from '@lifi/sdk'
|
|
2
|
+
import { Skeleton } from '@mui/material'
|
|
3
|
+
import type { RefObject } from 'react'
|
|
4
|
+
import { useTranslation } from 'react-i18next'
|
|
5
|
+
import { SearchNotFound } from '../Search/SearchNotFound'
|
|
6
|
+
import {
|
|
7
|
+
List,
|
|
8
|
+
ListItemAvatar,
|
|
9
|
+
ListItemButton,
|
|
10
|
+
ListItemText,
|
|
11
|
+
} from './ChainList.style'
|
|
12
|
+
import { VirtualizedChainList } from './VirtualizedChainList'
|
|
13
|
+
|
|
14
|
+
interface ChainListProps {
|
|
15
|
+
parentRef: RefObject<HTMLDivElement | null>
|
|
16
|
+
chains: ExtendedChain[]
|
|
17
|
+
onSelect: (chain: ExtendedChain) => void
|
|
18
|
+
selectedChainId?: number
|
|
19
|
+
isLoading: boolean
|
|
20
|
+
itemsSize: 'small' | 'medium'
|
|
21
|
+
adjustForStickySearchInput?: boolean
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const ChainList = ({
|
|
25
|
+
parentRef,
|
|
26
|
+
chains,
|
|
27
|
+
onSelect,
|
|
28
|
+
selectedChainId,
|
|
29
|
+
isLoading,
|
|
30
|
+
itemsSize,
|
|
31
|
+
adjustForStickySearchInput,
|
|
32
|
+
}: ChainListProps) => {
|
|
33
|
+
const { t } = useTranslation()
|
|
34
|
+
|
|
35
|
+
if (isLoading) {
|
|
36
|
+
return (
|
|
37
|
+
<List disablePadding sx={{ cursor: 'default' }}>
|
|
38
|
+
{Array.from({ length: 3 }).map((_, index) => (
|
|
39
|
+
<ListItemButton
|
|
40
|
+
key={index}
|
|
41
|
+
size={itemsSize}
|
|
42
|
+
sx={{ pointerEvents: 'none' }}
|
|
43
|
+
>
|
|
44
|
+
<ListItemAvatar size={itemsSize}>
|
|
45
|
+
<Skeleton
|
|
46
|
+
variant="circular"
|
|
47
|
+
width={itemsSize === 'small' ? 32 : 40}
|
|
48
|
+
height={itemsSize === 'small' ? 32 : 40}
|
|
49
|
+
sx={{ marginRight: 2 }}
|
|
50
|
+
/>
|
|
51
|
+
</ListItemAvatar>
|
|
52
|
+
<ListItemText
|
|
53
|
+
primary={
|
|
54
|
+
<Skeleton
|
|
55
|
+
variant="text"
|
|
56
|
+
width={'100%'}
|
|
57
|
+
height={itemsSize === 'small' ? 18 : 24}
|
|
58
|
+
/>
|
|
59
|
+
}
|
|
60
|
+
size={itemsSize}
|
|
61
|
+
/>
|
|
62
|
+
</ListItemButton>
|
|
63
|
+
))}
|
|
64
|
+
</List>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!chains.length) {
|
|
69
|
+
return (
|
|
70
|
+
<SearchNotFound
|
|
71
|
+
message={t('info.message.emptyChainList')}
|
|
72
|
+
adjustForStickySearchInput={adjustForStickySearchInput}
|
|
73
|
+
/>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<VirtualizedChainList
|
|
79
|
+
scrollElementRef={parentRef}
|
|
80
|
+
chains={chains}
|
|
81
|
+
onSelect={onSelect}
|
|
82
|
+
selectedChainId={selectedChainId}
|
|
83
|
+
itemsSize={itemsSize}
|
|
84
|
+
/>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ExtendedChain } from '@lifi/sdk'
|
|
2
|
+
import { memo } from 'react'
|
|
3
|
+
import {
|
|
4
|
+
Avatar,
|
|
5
|
+
ListItem,
|
|
6
|
+
ListItemAvatar,
|
|
7
|
+
ListItemButton,
|
|
8
|
+
ListItemText,
|
|
9
|
+
} from './ChainList.style'
|
|
10
|
+
|
|
11
|
+
interface ChainListItemProps {
|
|
12
|
+
chain: ExtendedChain
|
|
13
|
+
onSelect: (chain: ExtendedChain) => void
|
|
14
|
+
selected?: boolean
|
|
15
|
+
itemsSize: 'small' | 'medium'
|
|
16
|
+
size: number
|
|
17
|
+
start: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const ChainListItem = memo(
|
|
21
|
+
({
|
|
22
|
+
chain,
|
|
23
|
+
onSelect,
|
|
24
|
+
selected,
|
|
25
|
+
itemsSize,
|
|
26
|
+
size,
|
|
27
|
+
start,
|
|
28
|
+
}: ChainListItemProps) => {
|
|
29
|
+
return (
|
|
30
|
+
<ListItem
|
|
31
|
+
style={{
|
|
32
|
+
height: `${size}px`,
|
|
33
|
+
transform: `translateY(${start}px)`,
|
|
34
|
+
padding: 0,
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<ListItemButton
|
|
38
|
+
onClick={() => onSelect(chain)}
|
|
39
|
+
selected={selected}
|
|
40
|
+
size={itemsSize}
|
|
41
|
+
>
|
|
42
|
+
<ListItemAvatar size={itemsSize}>
|
|
43
|
+
<Avatar src={chain.logoURI} alt={chain.name} size={itemsSize}>
|
|
44
|
+
{chain.name[0]}
|
|
45
|
+
</Avatar>
|
|
46
|
+
</ListItemAvatar>
|
|
47
|
+
<ListItemText primary={chain.name} size={itemsSize} />
|
|
48
|
+
</ListItemButton>
|
|
49
|
+
</ListItem>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Box } from '@mui/material'
|
|
2
|
+
import { type RefObject, useCallback } from 'react'
|
|
3
|
+
import { useTranslation } from 'react-i18next'
|
|
4
|
+
import { SearchInput, StickySearchInput } from '../Search/SearchInput'
|
|
5
|
+
|
|
6
|
+
interface ChainSearchInputProps {
|
|
7
|
+
inputRef: RefObject<HTMLInputElement | null>
|
|
8
|
+
inExpansion: boolean
|
|
9
|
+
onChange: () => void
|
|
10
|
+
onClear: () => void
|
|
11
|
+
searchHeaderHeight: string | number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ChainSearchInput = ({
|
|
15
|
+
inputRef,
|
|
16
|
+
inExpansion,
|
|
17
|
+
onChange,
|
|
18
|
+
onClear,
|
|
19
|
+
searchHeaderHeight,
|
|
20
|
+
}: ChainSearchInputProps) => {
|
|
21
|
+
const { t } = useTranslation()
|
|
22
|
+
|
|
23
|
+
const handleClear = useCallback(() => {
|
|
24
|
+
if (inputRef.current) {
|
|
25
|
+
inputRef.current.value = ''
|
|
26
|
+
}
|
|
27
|
+
onClear()
|
|
28
|
+
}, [onClear, inputRef.current])
|
|
29
|
+
|
|
30
|
+
if (inExpansion) {
|
|
31
|
+
return (
|
|
32
|
+
<Box sx={{ pt: 3, pb: 2, px: 2.5, height: searchHeaderHeight }}>
|
|
33
|
+
<SearchInput
|
|
34
|
+
inputRef={inputRef}
|
|
35
|
+
onChange={onChange}
|
|
36
|
+
placeholder={t('main.searchChain')}
|
|
37
|
+
size="small"
|
|
38
|
+
onClear={handleClear}
|
|
39
|
+
/>
|
|
40
|
+
</Box>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<StickySearchInput
|
|
46
|
+
inputRef={inputRef}
|
|
47
|
+
onChange={onChange}
|
|
48
|
+
placeholder={t('main.searchChain')}
|
|
49
|
+
onClear={handleClear}
|
|
50
|
+
/>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Box, styled } from '@mui/material'
|
|
2
|
+
|
|
3
|
+
export const chainExpansionWidth = '256px'
|
|
4
|
+
|
|
5
|
+
interface SelectChainExpansionContainerProps {
|
|
6
|
+
expansionHeight: string | number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const SelectChainExpansionContainer = styled(Box, {
|
|
10
|
+
shouldForwardProp: (prop) => prop !== 'expansionHeight',
|
|
11
|
+
})<SelectChainExpansionContainerProps>(({ theme, expansionHeight }) => ({
|
|
12
|
+
position: 'relative',
|
|
13
|
+
boxSizing: 'content-box',
|
|
14
|
+
width: chainExpansionWidth,
|
|
15
|
+
background: theme.vars.palette.background.default,
|
|
16
|
+
overflow: 'hidden',
|
|
17
|
+
flex: 1,
|
|
18
|
+
...theme.container,
|
|
19
|
+
zIndex: 0,
|
|
20
|
+
height: expansionHeight,
|
|
21
|
+
}))
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider'
|
|
2
|
+
import type { FormType } from '../../stores/form/types'
|
|
3
|
+
import { getWidgetMaxHeight } from '../../utils/widgetSize'
|
|
4
|
+
import { ExpansionTransition } from '../Expansion/ExpansionTransition'
|
|
5
|
+
import {
|
|
6
|
+
chainExpansionWidth,
|
|
7
|
+
SelectChainExpansionContainer,
|
|
8
|
+
} from './ChainsExpanded.style'
|
|
9
|
+
import { SelectChainContent } from './SelectChainContent'
|
|
10
|
+
|
|
11
|
+
interface ChainsExpandedProps {
|
|
12
|
+
formType: FormType
|
|
13
|
+
open: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const ChainsExpanded = ({ formType, open }: ChainsExpandedProps) => {
|
|
17
|
+
const { theme } = useWidgetConfig()
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<ExpansionTransition in={open} width={chainExpansionWidth}>
|
|
21
|
+
<SelectChainExpansionContainer
|
|
22
|
+
expansionHeight={getWidgetMaxHeight(theme)}
|
|
23
|
+
>
|
|
24
|
+
<SelectChainContent inExpansion formType={formType} />
|
|
25
|
+
</SelectChainExpansionContainer>
|
|
26
|
+
</ExpansionTransition>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { ExtendedChain } from '@lifi/sdk'
|
|
2
|
+
import { Box, debounce, useTheme } from '@mui/material'
|
|
3
|
+
import { memo, useCallback, useMemo, useRef, useState } from 'react'
|
|
4
|
+
import { useDefaultElementId } from '../../hooks/useDefaultElementId'
|
|
5
|
+
import { useScrollableContainer } from '../../hooks/useScrollableContainer'
|
|
6
|
+
import { FormKeyHelper, type FormType } from '../../stores/form/types'
|
|
7
|
+
import { useFieldValues } from '../../stores/form/useFieldValues'
|
|
8
|
+
import { getWidgetMaxHeight } from '../../utils/widgetSize'
|
|
9
|
+
import { useChainSelect } from '../ChainSelect/useChainSelect'
|
|
10
|
+
import { FullPageContainer } from '../FullPageContainer'
|
|
11
|
+
import { ChainList } from './ChainList'
|
|
12
|
+
import { ChainSearchInput } from './ChainSearchInput'
|
|
13
|
+
|
|
14
|
+
interface SelectChainContentProps {
|
|
15
|
+
formType: FormType
|
|
16
|
+
onSelect?: (chain: ExtendedChain) => void
|
|
17
|
+
inExpansion: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const searchHeaderHeight = '80px'
|
|
21
|
+
|
|
22
|
+
export const SelectChainContent: React.FC<SelectChainContentProps> = memo(
|
|
23
|
+
({ formType, onSelect, inExpansion }) => {
|
|
24
|
+
const theme = useTheme()
|
|
25
|
+
const { chains, isLoading, setCurrentChain } = useChainSelect(formType)
|
|
26
|
+
const elementId = useDefaultElementId()
|
|
27
|
+
const scrollableContainer = useScrollableContainer(elementId)
|
|
28
|
+
const [selectedChainId] = useFieldValues(
|
|
29
|
+
FormKeyHelper.getChainKey(formType)
|
|
30
|
+
)
|
|
31
|
+
const inputRef = useRef<HTMLInputElement>(null)
|
|
32
|
+
const listRef = useRef<HTMLDivElement>(null)
|
|
33
|
+
const [filteredChains, setFilteredChains] = useState<ExtendedChain[]>(
|
|
34
|
+
chains ?? []
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
const scrollToTop = useCallback(() => {
|
|
38
|
+
// Scroll widget container to top
|
|
39
|
+
if (!inExpansion && scrollableContainer) {
|
|
40
|
+
scrollableContainer.scrollTop = 0
|
|
41
|
+
}
|
|
42
|
+
// Scroll chain list to top
|
|
43
|
+
if (inExpansion && listRef.current) {
|
|
44
|
+
listRef.current.scrollTop = 0
|
|
45
|
+
}
|
|
46
|
+
}, [inExpansion, scrollableContainer])
|
|
47
|
+
|
|
48
|
+
const debouncedFilterChains = useMemo(
|
|
49
|
+
() =>
|
|
50
|
+
debounce((chains: ExtendedChain[]) => {
|
|
51
|
+
const value = inputRef.current?.value?.toLowerCase() || ''
|
|
52
|
+
const filtered = value
|
|
53
|
+
? chains?.filter((chain) =>
|
|
54
|
+
chain.name.toLowerCase().includes(value)
|
|
55
|
+
)
|
|
56
|
+
: chains
|
|
57
|
+
setFilteredChains(filtered ?? [])
|
|
58
|
+
scrollToTop()
|
|
59
|
+
}, 250),
|
|
60
|
+
[scrollToTop]
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
const onSelectChainFallback = useCallback(
|
|
64
|
+
(chain: ExtendedChain) => {
|
|
65
|
+
setCurrentChain(chain.id)
|
|
66
|
+
},
|
|
67
|
+
[setCurrentChain]
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
const onChange = useCallback(() => {
|
|
71
|
+
debouncedFilterChains(chains ?? [])
|
|
72
|
+
}, [chains, debouncedFilterChains])
|
|
73
|
+
|
|
74
|
+
const onClear = useCallback(() => {
|
|
75
|
+
setFilteredChains(chains ?? [])
|
|
76
|
+
scrollToTop()
|
|
77
|
+
}, [chains, scrollToTop])
|
|
78
|
+
|
|
79
|
+
const listContainerHeight = useMemo(() => {
|
|
80
|
+
const fullContainerHeight = getWidgetMaxHeight(theme)
|
|
81
|
+
const heightValue =
|
|
82
|
+
typeof fullContainerHeight === 'number'
|
|
83
|
+
? `${fullContainerHeight}px`
|
|
84
|
+
: fullContainerHeight
|
|
85
|
+
return `calc(${heightValue} - ${searchHeaderHeight})`
|
|
86
|
+
}, [theme])
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<FullPageContainer disableGutters>
|
|
90
|
+
<ChainSearchInput
|
|
91
|
+
inputRef={inputRef}
|
|
92
|
+
inExpansion={inExpansion}
|
|
93
|
+
onChange={onChange}
|
|
94
|
+
onClear={onClear}
|
|
95
|
+
searchHeaderHeight={searchHeaderHeight}
|
|
96
|
+
/>
|
|
97
|
+
<Box
|
|
98
|
+
ref={listRef}
|
|
99
|
+
sx={
|
|
100
|
+
inExpansion ? { height: listContainerHeight, overflow: 'auto' } : {}
|
|
101
|
+
}
|
|
102
|
+
>
|
|
103
|
+
<ChainList
|
|
104
|
+
parentRef={listRef}
|
|
105
|
+
chains={filteredChains}
|
|
106
|
+
isLoading={isLoading}
|
|
107
|
+
onSelect={onSelect ?? onSelectChainFallback}
|
|
108
|
+
selectedChainId={selectedChainId}
|
|
109
|
+
itemsSize={inExpansion ? 'small' : 'medium'}
|
|
110
|
+
adjustForStickySearchInput={!inExpansion}
|
|
111
|
+
/>
|
|
112
|
+
</Box>
|
|
113
|
+
</FullPageContainer>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { ExtendedChain } from '@lifi/sdk'
|
|
2
|
+
import { useVirtualizer } from '@tanstack/react-virtual'
|
|
3
|
+
import type { RefObject } from 'react'
|
|
4
|
+
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
5
|
+
import { List } from './ChainList.style'
|
|
6
|
+
import { ChainListItem } from './ChainListItem'
|
|
7
|
+
|
|
8
|
+
interface VirtualizedChainListProps {
|
|
9
|
+
scrollElementRef: RefObject<HTMLDivElement | null>
|
|
10
|
+
chains: ExtendedChain[]
|
|
11
|
+
onSelect: (chain: ExtendedChain) => void
|
|
12
|
+
selectedChainId?: number
|
|
13
|
+
itemsSize: 'small' | 'medium'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const VirtualizedChainList = ({
|
|
17
|
+
chains,
|
|
18
|
+
onSelect,
|
|
19
|
+
selectedChainId,
|
|
20
|
+
itemsSize,
|
|
21
|
+
scrollElementRef,
|
|
22
|
+
}: VirtualizedChainListProps) => {
|
|
23
|
+
const initialSelectedChainIdRef = useRef(selectedChainId)
|
|
24
|
+
const sortedChains = useMemo(() => {
|
|
25
|
+
const selectedChain = chains.find(
|
|
26
|
+
(chain) => chain.id === initialSelectedChainIdRef.current
|
|
27
|
+
)
|
|
28
|
+
const otherChains = chains.filter(
|
|
29
|
+
(chain) => chain.id !== initialSelectedChainIdRef.current
|
|
30
|
+
)
|
|
31
|
+
return selectedChain ? [selectedChain, ...otherChains] : chains
|
|
32
|
+
}, [chains])
|
|
33
|
+
|
|
34
|
+
const getItemKey = useCallback(
|
|
35
|
+
(index: number) => {
|
|
36
|
+
return `${sortedChains[index].id}-${index}`
|
|
37
|
+
},
|
|
38
|
+
[sortedChains]
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
const { getVirtualItems, getTotalSize, measure } = useVirtualizer({
|
|
42
|
+
count: sortedChains.length,
|
|
43
|
+
overscan: 3,
|
|
44
|
+
paddingEnd: 0,
|
|
45
|
+
getScrollElement: () => scrollElementRef.current,
|
|
46
|
+
estimateSize: () => {
|
|
47
|
+
return itemsSize === 'small' ? 48 : 60
|
|
48
|
+
},
|
|
49
|
+
getItemKey,
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
// Using mountOnEnter of the ExpansionTransition component
|
|
53
|
+
// leads to a short delay for setting up scrollElementRef,
|
|
54
|
+
// which in turn leads to getVirtualItems() returning an empty array.
|
|
55
|
+
// Workaround: Re-measure when scroll element becomes available
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (scrollElementRef.current) {
|
|
58
|
+
measure()
|
|
59
|
+
}
|
|
60
|
+
}, [measure, scrollElementRef.current])
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<List
|
|
64
|
+
className="long-list"
|
|
65
|
+
style={{ height: getTotalSize() }}
|
|
66
|
+
disablePadding
|
|
67
|
+
>
|
|
68
|
+
{getVirtualItems().map((item) => {
|
|
69
|
+
const chain = sortedChains[item.index]
|
|
70
|
+
return (
|
|
71
|
+
<ChainListItem
|
|
72
|
+
key={item.key}
|
|
73
|
+
chain={chain}
|
|
74
|
+
onSelect={onSelect}
|
|
75
|
+
selected={chain.id === selectedChainId}
|
|
76
|
+
itemsSize={itemsSize}
|
|
77
|
+
size={item.size}
|
|
78
|
+
start={item.start}
|
|
79
|
+
/>
|
|
80
|
+
)
|
|
81
|
+
})}
|
|
82
|
+
</List>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Box } from '@mui/material'
|
|
2
|
+
import { useCallback, useMemo, useRef, useState } from 'react'
|
|
3
|
+
import { useHasChainExpansion } from '../../hooks/useHasChainExpansion'
|
|
4
|
+
import { ExpansionType } from '../../types/widget'
|
|
5
|
+
import { ChainsExpanded } from '../Chains/ChainsExpanded'
|
|
6
|
+
import { chainExpansionWidth } from '../Chains/ChainsExpanded.style'
|
|
7
|
+
import { RoutesExpanded } from '../Routes/RoutesExpanded'
|
|
8
|
+
import { routesExpansionWidth } from '../Routes/RoutesExpanded.style'
|
|
9
|
+
import { animationDuration } from './ExpansionTransition'
|
|
10
|
+
|
|
11
|
+
export function Expansion() {
|
|
12
|
+
const [withChainExpansion, expansionType] = useHasChainExpansion()
|
|
13
|
+
const chainExpansionTypeRef = useRef<ExpansionType>(expansionType)
|
|
14
|
+
|
|
15
|
+
const [routesOpen, setRoutesOpen] = useState(false)
|
|
16
|
+
|
|
17
|
+
const handleSetRoutesOpen = useCallback((open: boolean) => {
|
|
18
|
+
setRoutesOpen(open)
|
|
19
|
+
}, [])
|
|
20
|
+
|
|
21
|
+
// Track the previous chain expansion type to avoid re-renders when transitioning to Routes
|
|
22
|
+
if (
|
|
23
|
+
expansionType === ExpansionType.FromChain ||
|
|
24
|
+
expansionType === ExpansionType.ToChain
|
|
25
|
+
) {
|
|
26
|
+
chainExpansionTypeRef.current = expansionType
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const boxWidth = useMemo(() => {
|
|
30
|
+
return routesOpen
|
|
31
|
+
? routesExpansionWidth
|
|
32
|
+
: withChainExpansion
|
|
33
|
+
? chainExpansionWidth
|
|
34
|
+
: '0px'
|
|
35
|
+
}, [routesOpen, withChainExpansion])
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Box
|
|
39
|
+
sx={{
|
|
40
|
+
position: 'relative',
|
|
41
|
+
display: 'flex',
|
|
42
|
+
transition: `width ${animationDuration}ms cubic-bezier(0.4, 0, 0.2, 1)`,
|
|
43
|
+
width: boxWidth,
|
|
44
|
+
willChange: 'width',
|
|
45
|
+
marginLeft: boxWidth !== '0px' ? '24px' : '0px',
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
<RoutesExpanded
|
|
49
|
+
expansionType={expansionType}
|
|
50
|
+
setOpenExpansion={handleSetRoutesOpen}
|
|
51
|
+
/>
|
|
52
|
+
<ChainsExpanded
|
|
53
|
+
formType={
|
|
54
|
+
chainExpansionTypeRef.current === ExpansionType.FromChain
|
|
55
|
+
? 'from'
|
|
56
|
+
: 'to'
|
|
57
|
+
}
|
|
58
|
+
open={withChainExpansion}
|
|
59
|
+
/>
|
|
60
|
+
</Box>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Box } from '@mui/material'
|
|
2
|
+
import { type PropsWithChildren, useRef } from 'react'
|
|
3
|
+
import { Transition } from 'react-transition-group'
|
|
4
|
+
|
|
5
|
+
export const animationDuration = 225
|
|
6
|
+
|
|
7
|
+
const defaultStyle = {
|
|
8
|
+
opacity: 0,
|
|
9
|
+
whiteSpace: 'nowrap',
|
|
10
|
+
transform: 'translateX(-100%)',
|
|
11
|
+
display: 'inline-block',
|
|
12
|
+
position: 'absolute' as const,
|
|
13
|
+
top: 0,
|
|
14
|
+
left: 0,
|
|
15
|
+
willChange: 'opacity, transform',
|
|
16
|
+
transition: `opacity ${animationDuration}ms cubic-bezier(0.4, 0, 0.2, 1), transform ${animationDuration}ms cubic-bezier(0.4, 0, 0.2, 1)`,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const transitionStyles = {
|
|
20
|
+
entering: {
|
|
21
|
+
opacity: 1,
|
|
22
|
+
transform: 'translateX(0)',
|
|
23
|
+
},
|
|
24
|
+
entered: {
|
|
25
|
+
opacity: 1,
|
|
26
|
+
transform: 'translateX(0)',
|
|
27
|
+
},
|
|
28
|
+
exiting: {
|
|
29
|
+
opacity: 0,
|
|
30
|
+
transform: 'translateX(-100%)',
|
|
31
|
+
},
|
|
32
|
+
exited: {
|
|
33
|
+
opacity: 0,
|
|
34
|
+
transform: 'translateX(-100%)',
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface ExpansionTransitionProps {
|
|
39
|
+
in: boolean
|
|
40
|
+
width: string
|
|
41
|
+
onExited?: () => void
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function ExpansionTransition({
|
|
45
|
+
in: inProp,
|
|
46
|
+
children,
|
|
47
|
+
width,
|
|
48
|
+
onExited,
|
|
49
|
+
}: PropsWithChildren<ExpansionTransitionProps>) {
|
|
50
|
+
const nodeRef = useRef(null)
|
|
51
|
+
return (
|
|
52
|
+
<Transition
|
|
53
|
+
nodeRef={nodeRef}
|
|
54
|
+
in={inProp}
|
|
55
|
+
timeout={animationDuration}
|
|
56
|
+
onExited={onExited}
|
|
57
|
+
mountOnEnter
|
|
58
|
+
unmountOnExit
|
|
59
|
+
>
|
|
60
|
+
{(state) => {
|
|
61
|
+
return (
|
|
62
|
+
<Box
|
|
63
|
+
ref={nodeRef}
|
|
64
|
+
style={{
|
|
65
|
+
...defaultStyle,
|
|
66
|
+
...transitionStyles[state as keyof typeof transitionStyles],
|
|
67
|
+
width,
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
{children}
|
|
71
|
+
</Box>
|
|
72
|
+
)
|
|
73
|
+
}}
|
|
74
|
+
</Transition>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
@@ -3,7 +3,7 @@ import { useLayoutEffect, useRef } from 'react'
|
|
|
3
3
|
import { useLocation } from 'react-router-dom'
|
|
4
4
|
import { useDefaultElementId } from '../../hooks/useDefaultElementId.js'
|
|
5
5
|
import { useSetHeaderHeight } from '../../stores/header/useHeaderStore.js'
|
|
6
|
-
import {
|
|
6
|
+
import { createElementId, ElementId } from '../../utils/elements.js'
|
|
7
7
|
import { stickyHeaderRoutes } from '../../utils/navigationRoutes.js'
|
|
8
8
|
import { Container } from './Header.style.js'
|
|
9
9
|
import { NavigationHeader } from './NavigationHeader.js'
|
|
@@ -19,7 +19,7 @@ import { TransactionHistoryButton } from './TransactionHistoryButton.js'
|
|
|
19
19
|
import { SplitWalletMenuButton } from './WalletHeader.js'
|
|
20
20
|
|
|
21
21
|
export const NavigationHeader: React.FC = () => {
|
|
22
|
-
const { subvariant, hiddenUI, variant } = useWidgetConfig()
|
|
22
|
+
const { subvariant, hiddenUI, variant, defaultUI } = useWidgetConfig()
|
|
23
23
|
const { navigateBack } = useNavigateBack()
|
|
24
24
|
const { account } = useAccount()
|
|
25
25
|
const { element, title } = useHeaderStore((state) => state)
|
|
@@ -50,7 +50,7 @@ export const NavigationHeader: React.FC = () => {
|
|
|
50
50
|
) : (
|
|
51
51
|
<Typography
|
|
52
52
|
align={hasPath ? 'center' : 'left'}
|
|
53
|
-
noWrap
|
|
53
|
+
noWrap={defaultUI?.navigationHeaderTitleNoWrap ?? true}
|
|
54
54
|
sx={{
|
|
55
55
|
fontSize: hasPath ? 18 : 24,
|
|
56
56
|
fontWeight: '700',
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
listItemButtonClasses,
|
|
3
|
+
ListItemButton as MuiListItemButton,
|
|
4
|
+
styled,
|
|
5
|
+
} from '@mui/material'
|
|
2
6
|
|
|
3
7
|
export const ListItemButton = styled(MuiListItemButton)(({ theme }) => {
|
|
4
8
|
return {
|
|
@@ -8,6 +12,18 @@ export const ListItemButton = styled(MuiListItemButton)(({ theme }) => {
|
|
|
8
12
|
'&:hover': {
|
|
9
13
|
backgroundColor: `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.04)`,
|
|
10
14
|
},
|
|
15
|
+
[`&.${listItemButtonClasses.selected}`]: {
|
|
16
|
+
backgroundColor: `color-mix(in srgb, ${theme.vars.palette.secondary.main} 20%, white)`,
|
|
17
|
+
'&:hover': {
|
|
18
|
+
backgroundColor: `color-mix(in srgb, ${theme.vars.palette.secondary.main} 24%, white)`,
|
|
19
|
+
},
|
|
20
|
+
...theme.applyStyles('dark', {
|
|
21
|
+
backgroundColor: `color-mix(in srgb, ${theme.vars.palette.secondary.main} 24%, black)`,
|
|
22
|
+
'&:hover': {
|
|
23
|
+
backgroundColor: `color-mix(in srgb, ${theme.vars.palette.secondary.main} 28%, black)`,
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
11
27
|
variants: [
|
|
12
28
|
{
|
|
13
29
|
props: ({ disabled }) => disabled,
|
|
@@ -47,7 +47,7 @@ export const ProgressToNextUpdate: React.FC<
|
|
|
47
47
|
values={{
|
|
48
48
|
value: getSecondsToUpdate(updatedAt, timeToUpdate),
|
|
49
49
|
}}
|
|
50
|
-
// biome-ignore lint/correctness/useJsxKeyInIterable:
|
|
50
|
+
// biome-ignore lint/correctness/useJsxKeyInIterable: allowed in react-i18next
|
|
51
51
|
components={[<br />]}
|
|
52
52
|
/>
|
|
53
53
|
}
|