@lifi/widget 1.13.2 → 1.13.5
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/App.d.ts +1 -1
- package/AppDrawer.d.ts +3 -3
- package/AppProvider.d.ts +2 -2
- package/AppProvider.js +1 -3
- package/cjs/App.d.ts +4 -0
- package/cjs/App.js +80 -0
- package/cjs/AppDrawer.d.ts +14 -0
- package/cjs/AppDrawer.js +44 -0
- package/cjs/AppDrawer.style.d.ts +53 -0
- package/cjs/AppDrawer.style.js +75 -0
- package/cjs/AppProvider.d.ts +11 -0
- package/cjs/AppProvider.js +29 -0
- package/cjs/components/AppContainer.d.ts +15 -0
- package/cjs/components/AppContainer.js +59 -0
- package/cjs/components/BottomSheet/BottomSheet.d.ts +3 -0
- package/cjs/components/BottomSheet/BottomSheet.js +45 -0
- package/cjs/components/BottomSheet/index.d.ts +2 -0
- package/cjs/components/BottomSheet/index.js +18 -0
- package/cjs/components/BottomSheet/types.d.ts +10 -0
- package/cjs/components/BottomSheet/types.js +2 -0
- package/cjs/components/Card/Card.d.ts +14 -0
- package/cjs/components/Card/Card.js +35 -0
- package/cjs/components/Card/CardHeader.d.ts +18 -0
- package/cjs/components/Card/CardHeader.js +23 -0
- package/cjs/components/Card/CardTitle.d.ts +14 -0
- package/cjs/components/Card/CardTitle.js +12 -0
- package/cjs/components/Card/index.d.ts +3 -0
- package/cjs/components/Card/index.js +19 -0
- package/cjs/components/Dialog.d.ts +3 -0
- package/cjs/components/Dialog.js +27 -0
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.d.ts +6 -0
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +45 -0
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +9 -0
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.js +14 -0
- package/cjs/components/GasSufficiencyMessage/index.d.ts +1 -0
- package/cjs/components/GasSufficiencyMessage/index.js +17 -0
- package/cjs/components/Header/Header.d.ts +2 -0
- package/cjs/components/Header/Header.js +27 -0
- package/cjs/components/Header/Header.style.d.ts +20 -0
- package/cjs/components/Header/Header.style.js +26 -0
- package/cjs/components/Header/NavigationHeader.d.ts +2 -0
- package/cjs/components/Header/NavigationHeader.js +58 -0
- package/cjs/components/Header/WalletHeader.d.ts +2 -0
- package/cjs/components/Header/WalletHeader.js +48 -0
- package/cjs/components/Header/index.d.ts +2 -0
- package/cjs/components/Header/index.js +18 -0
- package/cjs/components/Header/types.d.ts +8 -0
- package/cjs/components/Header/types.js +2 -0
- package/cjs/components/Header/useHeaderActionStore.d.ts +6 -0
- package/cjs/components/Header/useHeaderActionStore.js +26 -0
- package/cjs/components/Initializer.d.ts +2 -0
- package/cjs/components/Initializer.js +9 -0
- package/cjs/components/Input.d.ts +1 -0
- package/cjs/components/Input.js +17 -0
- package/cjs/components/LiFiLogo.d.ts +5 -0
- package/cjs/components/LiFiLogo.js +10 -0
- package/cjs/components/NotFound.d.ts +2 -0
- package/cjs/components/NotFound.js +19 -0
- package/cjs/components/PoweredBy/PoweredBy.d.ts +2 -0
- package/cjs/components/PoweredBy/PoweredBy.js +16 -0
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +12 -0
- package/cjs/components/PoweredBy/PoweredBy.style.js +12 -0
- package/cjs/components/PoweredBy/index.d.ts +1 -0
- package/cjs/components/PoweredBy/index.js +5 -0
- package/cjs/components/ProgressToNextUpdate/ProgressToNextUpdate.d.ts +7 -0
- package/cjs/components/ProgressToNextUpdate/ProgressToNextUpdate.js +63 -0
- package/cjs/components/ProgressToNextUpdate/index.d.ts +1 -0
- package/cjs/components/ProgressToNextUpdate/index.js +17 -0
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.d.ts +4 -0
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +26 -0
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +29 -0
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.js +19 -0
- package/cjs/components/ReverseTokensButton/index.d.ts +1 -0
- package/cjs/components/ReverseTokensButton/index.js +17 -0
- package/cjs/components/Select.d.ts +3 -0
- package/cjs/components/Select.js +30 -0
- package/cjs/components/SelectChainAndToken.d.ts +3 -0
- package/cjs/components/SelectChainAndToken.js +23 -0
- package/cjs/components/SelectTokenButton/SelectTokenButton.d.ts +5 -0
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +35 -0
- package/cjs/components/SelectTokenButton/SelectTokenButton.style.d.ts +21 -0
- package/cjs/components/SelectTokenButton/SelectTokenButton.style.js +27 -0
- package/cjs/components/SelectTokenButton/index.d.ts +1 -0
- package/cjs/components/SelectTokenButton/index.js +17 -0
- package/cjs/components/SmallAvatar.d.ts +16 -0
- package/cjs/components/SmallAvatar.js +11 -0
- package/cjs/components/Step/CircularProgress.d.ts +5 -0
- package/cjs/components/Step/CircularProgress.js +24 -0
- package/cjs/components/Step/CircularProgress.style.d.ts +6 -0
- package/cjs/components/Step/CircularProgress.style.js +54 -0
- package/cjs/components/Step/Step.d.ts +7 -0
- package/cjs/components/Step/Step.js +36 -0
- package/cjs/components/Step/StepProcess.d.ts +6 -0
- package/cjs/components/Step/StepProcess.js +25 -0
- package/cjs/components/Step/StepProcess.style.d.ts +39 -0
- package/cjs/components/Step/StepProcess.style.js +8 -0
- package/cjs/components/Step/StepTimer.d.ts +5 -0
- package/cjs/components/Step/StepTimer.js +64 -0
- package/cjs/components/Step/index.d.ts +1 -0
- package/cjs/components/Step/index.js +17 -0
- package/cjs/components/Step/utils.d.ts +6 -0
- package/cjs/components/Step/utils.js +93 -0
- package/cjs/components/StepActions/StepActions.d.ts +13 -0
- package/cjs/components/StepActions/StepActions.js +71 -0
- package/cjs/components/StepActions/StepActions.style.d.ts +20 -0
- package/cjs/components/StepActions/StepActions.style.js +59 -0
- package/cjs/components/StepActions/index.d.ts +1 -0
- package/cjs/components/StepActions/index.js +5 -0
- package/cjs/components/StepActions/types.d.ts +6 -0
- package/cjs/components/StepActions/types.js +2 -0
- package/cjs/components/StepDivider/StepDivider.d.ts +2 -0
- package/cjs/components/StepDivider/StepDivider.js +10 -0
- package/cjs/components/StepDivider/StepDivider.style.d.ts +11 -0
- package/cjs/components/StepDivider/StepDivider.style.js +11 -0
- package/cjs/components/StepDivider/index.d.ts +1 -0
- package/cjs/components/StepDivider/index.js +17 -0
- package/cjs/components/SwapButton/ButtonTooltip.d.ts +5 -0
- package/cjs/components/SwapButton/ButtonTooltip.js +7 -0
- package/cjs/components/SwapButton/SwapButton.d.ts +3 -0
- package/cjs/components/SwapButton/SwapButton.js +74 -0
- package/cjs/components/SwapButton/SwapButton.style.d.ts +65 -0
- package/cjs/components/SwapButton/SwapButton.style.js +15 -0
- package/cjs/components/SwapButton/index.d.ts +1 -0
- package/cjs/components/SwapButton/index.js +5 -0
- package/cjs/components/SwapButton/types.d.ts +7 -0
- package/cjs/components/SwapButton/types.js +2 -0
- package/cjs/components/SwapInProgress/SwapInProgress.d.ts +3 -0
- package/cjs/components/SwapInProgress/SwapInProgress.js +29 -0
- package/cjs/components/SwapInProgress/SwapInProgress.style.d.ts +31 -0
- package/cjs/components/SwapInProgress/SwapInProgress.style.js +17 -0
- package/cjs/components/SwapInProgress/index.d.ts +1 -0
- package/cjs/components/SwapInProgress/index.js +17 -0
- package/cjs/components/SwapInput/FormPriceHelperText.d.ts +5 -0
- package/cjs/components/SwapInput/FormPriceHelperText.js +31 -0
- package/cjs/components/SwapInput/SwapInput.d.ts +3 -0
- package/cjs/components/SwapInput/SwapInput.js +46 -0
- package/cjs/components/SwapInput/SwapInput.style.d.ts +21 -0
- package/cjs/components/SwapInput/SwapInput.style.js +33 -0
- package/cjs/components/SwapInput/SwapInputAdornment.d.ts +3 -0
- package/cjs/components/SwapInput/SwapInputAdornment.js +27 -0
- package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +34 -0
- package/cjs/components/SwapInput/SwapInputAdornment.style.js +23 -0
- package/cjs/components/SwapInput/index.d.ts +1 -0
- package/cjs/components/SwapInput/index.js +17 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +4 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +42 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +16 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +30 -0
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.d.ts +4 -0
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +32 -0
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +4 -0
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +30 -0
- package/cjs/components/SwapRouteCard/index.d.ts +3 -0
- package/cjs/components/SwapRouteCard/index.js +19 -0
- package/cjs/components/SwapRouteCard/types.d.ts +9 -0
- package/cjs/components/SwapRouteCard/types.js +2 -0
- package/cjs/components/Switch.d.ts +1 -0
- package/cjs/components/Switch.js +56 -0
- package/cjs/components/TextFitter/TextFitter.d.ts +3 -0
- package/cjs/components/TextFitter/TextFitter.js +52 -0
- package/cjs/components/TextFitter/index.d.ts +1 -0
- package/cjs/components/TextFitter/index.js +17 -0
- package/cjs/components/TextFitter/types.d.ts +12 -0
- package/cjs/components/TextFitter/types.js +2 -0
- package/cjs/components/Token/Token.d.ts +7 -0
- package/cjs/components/Token/Token.js +35 -0
- package/cjs/components/Token/Token.style.d.ts +24 -0
- package/cjs/components/Token/Token.style.js +34 -0
- package/cjs/components/Token/index.d.ts +2 -0
- package/cjs/components/Token/index.js +18 -0
- package/cjs/components/TokenAvatar/TokenAvatar.d.ts +7 -0
- package/cjs/components/TokenAvatar/TokenAvatar.js +13 -0
- package/cjs/components/TokenAvatar/TokenAvatar.style.d.ts +1 -0
- package/cjs/components/TokenAvatar/TokenAvatar.style.js +19 -0
- package/cjs/components/TokenAvatar/index.d.ts +2 -0
- package/cjs/components/TokenAvatar/index.js +18 -0
- package/cjs/components/TokenList/TokenList.d.ts +3 -0
- package/cjs/components/TokenList/TokenList.js +55 -0
- package/cjs/components/TokenList/TokenList.style.d.ts +32 -0
- package/cjs/components/TokenList/TokenList.style.js +28 -0
- package/cjs/components/TokenList/TokenListItem.d.ts +5 -0
- package/cjs/components/TokenList/TokenListItem.js +32 -0
- package/cjs/components/TokenList/TokenNotFound.d.ts +2 -0
- package/cjs/components/TokenList/TokenNotFound.js +19 -0
- package/cjs/components/TokenList/VirtualizedTokenList.d.ts +3 -0
- package/cjs/components/TokenList/VirtualizedTokenList.js +57 -0
- package/cjs/components/TokenList/index.d.ts +1 -0
- package/cjs/components/TokenList/index.js +17 -0
- package/cjs/components/TokenList/types.d.ts +32 -0
- package/cjs/components/TokenList/types.js +2 -0
- package/cjs/config/env.d.ts +3 -0
- package/cjs/config/env.js +6 -0
- package/cjs/config/lifi.d.ts +4 -0
- package/cjs/config/lifi.js +12 -0
- package/cjs/config/queryClient.d.ts +2 -0
- package/cjs/config/queryClient.js +28 -0
- package/cjs/config/sentry.d.ts +1 -0
- package/cjs/config/sentry.js +65 -0
- package/cjs/config/theme.d.ts +27 -0
- package/cjs/config/theme.js +174 -0
- package/cjs/config/version.d.ts +2 -0
- package/cjs/config/version.js +5 -0
- package/cjs/hooks/index.d.ts +17 -0
- package/cjs/hooks/index.js +33 -0
- package/cjs/hooks/useChain.d.ts +4 -0
- package/cjs/hooks/useChain.js +17 -0
- package/cjs/hooks/useChains.d.ts +101 -0
- package/cjs/hooks/useChains.js +43 -0
- package/cjs/hooks/useContentHeight.d.ts +1 -0
- package/cjs/hooks/useContentHeight.js +27 -0
- package/cjs/hooks/useDebouncedWatch.d.ts +1 -0
- package/cjs/hooks/useDebouncedWatch.js +36 -0
- package/cjs/hooks/useFeaturedTokens.d.ts +1 -0
- package/cjs/hooks/useFeaturedTokens.js +10 -0
- package/cjs/hooks/useGasSufficiency.d.ts +15 -0
- package/cjs/hooks/useGasSufficiency.js +105 -0
- package/cjs/hooks/useInitializer.d.ts +1 -0
- package/cjs/hooks/useInitializer.js +9 -0
- package/cjs/hooks/useRouteExecution.d.ts +8 -0
- package/cjs/hooks/useRouteExecution.js +163 -0
- package/cjs/hooks/useScrollableContainer.d.ts +2 -0
- package/cjs/hooks/useScrollableContainer.js +29 -0
- package/cjs/hooks/useSwapRoutes.d.ts +9 -0
- package/cjs/hooks/useSwapRoutes.js +109 -0
- package/cjs/hooks/useTelemetry.d.ts +1 -0
- package/cjs/hooks/useTelemetry.js +22 -0
- package/cjs/hooks/useToken.d.ts +5 -0
- package/cjs/hooks/useToken.js +18 -0
- package/cjs/hooks/useTokenBalance.d.ts +5 -0
- package/cjs/hooks/useTokenBalance.js +19 -0
- package/cjs/hooks/useTokenBalances.d.ts +10 -0
- package/cjs/hooks/useTokenBalances.js +80 -0
- package/cjs/hooks/useTokenSearch.d.ts +7 -0
- package/cjs/hooks/useTokenSearch.js +41 -0
- package/cjs/hooks/useTokens.d.ts +6 -0
- package/cjs/hooks/useTokens.js +36 -0
- package/cjs/hooks/useTools.d.ts +10 -0
- package/cjs/hooks/useTools.js +28 -0
- package/cjs/i18n/en/translation.json +175 -0
- package/cjs/i18n/index.d.ts +181 -0
- package/cjs/i18n/index.js +27 -0
- package/cjs/icons/LiFiFullLogo.d.ts +2 -0
- package/cjs/icons/LiFiFullLogo.js +6 -0
- package/cjs/icons/LiFiLogo.d.ts +2 -0
- package/cjs/icons/LiFiLogo.js +6 -0
- package/cjs/icons/LiFiToolLogo.d.ts +2 -0
- package/cjs/icons/LiFiToolLogo.js +6 -0
- package/cjs/icons/index.d.ts +3 -0
- package/cjs/icons/index.js +19 -0
- package/cjs/index.d.ts +5 -0
- package/cjs/index.js +28 -0
- package/cjs/pages/MainPage/MainPage.d.ts +2 -0
- package/cjs/pages/MainPage/MainPage.js +15 -0
- package/cjs/pages/MainPage/MainPage.style.d.ts +11 -0
- package/cjs/pages/MainPage/MainPage.style.js +11 -0
- package/cjs/pages/MainPage/MainSwapButton.d.ts +2 -0
- package/cjs/pages/MainPage/MainSwapButton.js +34 -0
- package/cjs/pages/MainPage/SwapRoutes.d.ts +3 -0
- package/cjs/pages/MainPage/SwapRoutes.js +40 -0
- package/cjs/pages/MainPage/SwapRoutes.style.d.ts +11 -0
- package/cjs/pages/MainPage/SwapRoutes.style.js +16 -0
- package/cjs/pages/MainPage/index.d.ts +1 -0
- package/cjs/pages/MainPage/index.js +17 -0
- package/cjs/pages/SelectTokenPage/ChainSelect.d.ts +3 -0
- package/cjs/pages/SelectTokenPage/ChainSelect.js +32 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +2 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.js +21 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.style.d.ts +1 -0
- package/cjs/pages/SelectTokenPage/SearchTokenInput.style.js +8 -0
- package/cjs/pages/SelectTokenPage/SelectTokenPage.d.ts +5 -0
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +27 -0
- package/cjs/pages/SelectTokenPage/index.d.ts +2 -0
- package/cjs/pages/SelectTokenPage/index.js +18 -0
- package/cjs/pages/SelectTokenPage/types.d.ts +4 -0
- package/cjs/pages/SelectTokenPage/types.js +8 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +2 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.js +53 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts +46 -0
- package/cjs/pages/SelectWalletPage/SelectWalletPage.style.js +30 -0
- package/cjs/pages/SelectWalletPage/index.d.ts +1 -0
- package/cjs/pages/SelectWalletPage/index.js +17 -0
- package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +2 -0
- package/cjs/pages/SettingsPage/AdvancedPreferences.js +24 -0
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.d.ts +2 -0
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +24 -0
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +33 -0
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.js +19 -0
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.d.ts +2 -0
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +30 -0
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.d.ts +2 -0
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +29 -0
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +2 -0
- package/cjs/pages/SettingsPage/GasPriceSelect.js +17 -0
- package/cjs/pages/SettingsPage/RoutePrioritySelect.d.ts +2 -0
- package/cjs/pages/SettingsPage/RoutePrioritySelect.js +18 -0
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +2 -0
- package/cjs/pages/SettingsPage/SettingsPage.js +14 -0
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +2 -0
- package/cjs/pages/SettingsPage/SlippageInput.js +29 -0
- package/cjs/pages/SettingsPage/index.d.ts +1 -0
- package/cjs/pages/SettingsPage/index.js +17 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.d.ts +2 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +69 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +11 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.style.js +8 -0
- package/cjs/pages/SwapDetailsPage/index.d.ts +1 -0
- package/cjs/pages/SwapDetailsPage/index.js +17 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +2 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +18 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryItem.d.ts +5 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryItem.js +27 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.d.ts +2 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +34 -0
- package/cjs/pages/SwapHistoryPage/index.d.ts +1 -0
- package/cjs/pages/SwapHistoryPage/index.js +17 -0
- package/cjs/pages/SwapPage/StatusBottomSheet.d.ts +3 -0
- package/cjs/pages/SwapPage/StatusBottomSheet.js +83 -0
- package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +25 -0
- package/cjs/pages/SwapPage/StatusBottomSheet.style.js +35 -0
- package/cjs/pages/SwapPage/SwapPage.d.ts +2 -0
- package/cjs/pages/SwapPage/SwapPage.js +49 -0
- package/cjs/pages/SwapPage/SwapPage.style.d.ts +11 -0
- package/cjs/pages/SwapPage/SwapPage.style.js +8 -0
- package/cjs/pages/SwapPage/index.d.ts +1 -0
- package/cjs/pages/SwapPage/index.js +17 -0
- package/cjs/pages/SwapPage/utils.d.ts +6 -0
- package/cjs/pages/SwapPage/utils.js +93 -0
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.d.ts +3 -0
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +39 -0
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +11 -0
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.style.js +9 -0
- package/cjs/pages/SwapRoutesPage/index.d.ts +1 -0
- package/cjs/pages/SwapRoutesPage/index.js +17 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.d.ts +6 -0
- package/cjs/providers/SwapFormProvider/SwapFormProvider.js +45 -0
- package/cjs/providers/SwapFormProvider/index.d.ts +2 -0
- package/cjs/providers/SwapFormProvider/index.js +18 -0
- package/cjs/providers/SwapFormProvider/types.d.ts +25 -0
- package/cjs/providers/SwapFormProvider/types.js +17 -0
- package/cjs/providers/ThemeProvider/ThemeProvider.d.ts +2 -0
- package/cjs/providers/ThemeProvider/ThemeProvider.js +37 -0
- package/cjs/providers/ThemeProvider/index.d.ts +1 -0
- package/cjs/providers/ThemeProvider/index.js +17 -0
- package/cjs/providers/WalletProvider/WalletProvider.d.ts +19 -0
- package/cjs/providers/WalletProvider/WalletProvider.js +106 -0
- package/cjs/providers/WalletProvider/index.d.ts +2 -0
- package/cjs/providers/WalletProvider/index.js +18 -0
- package/cjs/providers/WalletProvider/types.d.ts +17 -0
- package/cjs/providers/WalletProvider/types.js +2 -0
- package/cjs/providers/WidgetProvider/WidgetProvider.d.ts +4 -0
- package/cjs/providers/WidgetProvider/WidgetProvider.js +68 -0
- package/cjs/providers/WidgetProvider/index.d.ts +2 -0
- package/cjs/providers/WidgetProvider/index.js +18 -0
- package/cjs/providers/WidgetProvider/types.d.ts +8 -0
- package/cjs/providers/WidgetProvider/types.js +2 -0
- package/cjs/stores/index.d.ts +2 -0
- package/cjs/stores/index.js +18 -0
- package/cjs/stores/route/index.d.ts +5 -0
- package/cjs/stores/route/index.js +21 -0
- package/cjs/stores/route/types.d.ts +14 -0
- package/cjs/stores/route/types.js +2 -0
- package/cjs/stores/route/useExecutingRoutes.d.ts +2 -0
- package/cjs/stores/route/useExecutingRoutes.js +13 -0
- package/cjs/stores/route/useRouteStore.d.ts +18 -0
- package/cjs/stores/route/useRouteStore.js +57 -0
- package/cjs/stores/route/useSetExecutableRoute.d.ts +1 -0
- package/cjs/stores/route/useSetExecutableRoute.js +8 -0
- package/cjs/stores/route/useSwapHistory.d.ts +2 -0
- package/cjs/stores/route/useSwapHistory.js +18 -0
- package/cjs/stores/settings/index.d.ts +5 -0
- package/cjs/stores/settings/index.js +21 -0
- package/cjs/stores/settings/types.d.ts +23 -0
- package/cjs/stores/settings/types.js +4 -0
- package/cjs/stores/settings/useAppearance.d.ts +2 -0
- package/cjs/stores/settings/useAppearance.js +14 -0
- package/cjs/stores/settings/useSetSettings.d.ts +5 -0
- package/cjs/stores/settings/useSetSettings.js +12 -0
- package/cjs/stores/settings/useSettings.d.ts +2 -0
- package/cjs/stores/settings/useSettings.js +15 -0
- package/cjs/stores/settings/useSettingsStore.d.ts +38 -0
- package/cjs/stores/settings/useSettingsStore.js +90 -0
- package/cjs/types/index.d.ts +2 -0
- package/cjs/types/index.js +18 -0
- package/cjs/types/token.d.ts +4 -0
- package/cjs/types/token.js +2 -0
- package/cjs/types/widget.d.ts +47 -0
- package/cjs/types/widget.js +2 -0
- package/cjs/utils/colors.d.ts +3 -0
- package/cjs/utils/colors.js +13 -0
- package/cjs/utils/deepClone.d.ts +1 -0
- package/cjs/utils/deepClone.js +7 -0
- package/cjs/utils/elements.d.ts +4 -0
- package/cjs/utils/elements.js +8 -0
- package/cjs/utils/format.d.ts +9 -0
- package/cjs/utils/format.js +86 -0
- package/cjs/utils/index.d.ts +6 -0
- package/cjs/utils/index.js +22 -0
- package/cjs/utils/input.d.ts +1 -0
- package/cjs/utils/input.js +28 -0
- package/cjs/utils/navigationRoutes.d.ts +13 -0
- package/cjs/utils/navigationRoutes.js +15 -0
- package/components/AppContainer.d.ts +1 -1
- package/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/components/BottomSheet/types.d.ts +2 -2
- package/components/Card/Card.d.ts +1 -1
- package/components/Dialog.d.ts +2 -2
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.d.ts +2 -2
- package/components/Header/Header.d.ts +1 -1
- package/components/Header/useHeaderActionStore.d.ts +1 -1
- package/components/LiFiLogo.d.ts +1 -1
- package/components/ProgressToNextUpdate/ProgressToNextUpdate.d.ts +1 -1
- package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +1 -1
- package/components/SelectChainAndToken.d.ts +1 -1
- package/components/SelectTokenButton/SelectTokenButton.d.ts +1 -1
- package/components/SelectTokenButton/SelectTokenButton.js +1 -1
- package/components/Step/CircularProgress.d.ts +1 -1
- package/components/Step/CircularProgress.style.d.ts +2 -2
- package/components/Step/Step.d.ts +1 -1
- package/components/Step/StepProcess.d.ts +1 -1
- package/components/Step/StepTimer.d.ts +1 -1
- package/components/Step/utils.d.ts +2 -2
- package/components/Step/utils.js +1 -1
- package/components/StepActions/StepActions.d.ts +2 -2
- package/components/StepActions/StepActions.js +1 -1
- package/components/StepActions/types.d.ts +2 -2
- package/components/SwapButton/SwapButton.d.ts +1 -1
- package/components/SwapInProgress/SwapInProgress.d.ts +1 -1
- package/components/SwapInput/FormPriceHelperText.d.ts +1 -1
- package/components/SwapInput/FormPriceHelperText.js +1 -1
- package/components/SwapInput/SwapInput.d.ts +1 -1
- package/components/SwapInput/SwapInput.js +1 -1
- package/components/SwapInput/SwapInputAdornment.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.js +1 -1
- package/components/SwapRouteCard/SwapRouteCard.d.ts +2 -2
- package/components/SwapRouteCard/SwapRouteCardSkeleton.d.ts +2 -2
- package/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +2 -2
- package/components/SwapRouteCard/types.d.ts +1 -1
- package/components/TextFitter/TextFitter.d.ts +2 -2
- package/components/TextFitter/TextFitter.js +1 -1
- package/components/TextFitter/types.d.ts +1 -1
- package/components/Token/Token.d.ts +2 -2
- package/components/TokenAvatar/TokenAvatar.d.ts +2 -2
- package/components/TokenList/TokenList.d.ts +2 -2
- package/components/TokenList/TokenListItem.d.ts +1 -1
- package/components/TokenList/VirtualizedTokenList.d.ts +2 -2
- package/components/TokenList/types.d.ts +4 -4
- package/config/lifi.d.ts +2 -1
- package/config/theme.d.ts +2 -2
- package/config/theme.js +3 -4
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useGasSufficiency.d.ts +1 -1
- package/hooks/useRouteExecution.d.ts +1 -1
- package/hooks/useTokenBalances.d.ts +1 -1
- package/hooks/useTokenSearch.d.ts +1 -1
- package/hooks/useTokens.d.ts +1 -1
- package/hooks/useTools.d.ts +1 -1
- package/icons/LiFiFullLogo.d.ts +1 -1
- package/icons/LiFiLogo.d.ts +1 -1
- package/icons/LiFiToolLogo.d.ts +1 -1
- package/index.js +3 -1
- package/package.json +25 -11
- package/pages/MainPage/SwapRoutes.d.ts +1 -1
- package/pages/SelectTokenPage/ChainSelect.d.ts +1 -1
- package/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -2
- package/pages/SwapHistoryPage/SwapHistoryItem.d.ts +1 -1
- package/pages/SwapPage/StatusBottomSheet.d.ts +1 -1
- package/pages/SwapPage/StatusBottomSheet.style.d.ts +2 -2
- package/pages/SwapPage/utils.d.ts +2 -2
- package/pages/SwapPage/utils.js +1 -1
- package/pages/SwapRoutesPage/SwapRoutesPage.d.ts +1 -1
- package/providers/WalletProvider/WalletProvider.d.ts +3 -3
- package/providers/WalletProvider/types.d.ts +3 -3
- package/providers/WidgetProvider/types.d.ts +1 -1
- package/stores/route/types.d.ts +1 -1
- package/stores/route/useExecutingRoutes.d.ts +1 -1
- package/stores/route/useSwapHistory.d.ts +1 -1
- package/stores/settings/types.d.ts +2 -2
- package/stores/settings/useAppearance.d.ts +1 -1
- package/stores/settings/useSetSettings.d.ts +1 -1
- package/stores/settings/useSettings.d.ts +1 -1
- package/stores/settings/useSettingsStore.d.ts +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -0
- package/types/token.d.ts +1 -1
- package/types/widget.d.ts +5 -5
- package/utils/colors.d.ts +2 -2
- package/utils/colors.js +4 -4
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Label: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
|
+
align?: "inherit" | "left" | "right" | "center" | "justify" | undefined;
|
|
4
|
+
children?: import("react").ReactNode;
|
|
5
|
+
classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
|
|
6
|
+
gutterBottom?: boolean | undefined;
|
|
7
|
+
noWrap?: boolean | undefined;
|
|
8
|
+
paragraph?: boolean | undefined;
|
|
9
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
10
|
+
variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)" | undefined;
|
|
11
|
+
variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)", string>> | undefined;
|
|
12
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof import("react").HTMLAttributes<HTMLSpanElement>> & {
|
|
13
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
14
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("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") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
15
|
+
active?: boolean | undefined;
|
|
16
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Label = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
exports.Label = (0, styles_1.styled)(material_1.Typography, {
|
|
8
|
+
shouldForwardProp: (prop) => prop !== 'active',
|
|
9
|
+
})(({ theme, active }) => ({
|
|
10
|
+
backgroundColor: active ? theme.palette.primary.main : 'transparent',
|
|
11
|
+
border: '1px solid',
|
|
12
|
+
borderColor: active
|
|
13
|
+
? theme.palette.primary.main
|
|
14
|
+
: theme.palette.mode === 'light'
|
|
15
|
+
? theme.palette.grey[500]
|
|
16
|
+
: theme.palette.grey[600],
|
|
17
|
+
borderRadius: theme.shape.borderRadiusSecondary,
|
|
18
|
+
color: active
|
|
19
|
+
? (0, utils_1.getContrastTextColor)(theme, theme.palette.primary.main)
|
|
20
|
+
: theme.palette.text.secondary,
|
|
21
|
+
padding: theme.spacing(0.75),
|
|
22
|
+
fontSize: 12,
|
|
23
|
+
lineHeight: 1,
|
|
24
|
+
fontWeight: '600',
|
|
25
|
+
height: 24,
|
|
26
|
+
letterSpacing: '0.05rem',
|
|
27
|
+
textTransform: 'uppercase',
|
|
28
|
+
display: 'inline-flex',
|
|
29
|
+
userSelect: 'none',
|
|
30
|
+
}));
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.SwapRouteCardSkeleton = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const material_1 = require("@mui/material");
|
|
17
|
+
const Card_1 = require("../Card");
|
|
18
|
+
const SwapRouteCardSkeleton = (_a) => {
|
|
19
|
+
var { dense } = _a, other = __rest(_a, ["dense"]);
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: dense, indented: true }, other, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 120, height: 24, sx: { borderRadius: 0.5 } }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ my: 2 }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
|
|
21
|
+
display: 'flex',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
} }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mr: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", width: 32, height: 32 }) })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 96, height: 32 })] })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ ml: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
justifyContent: 'space-between',
|
|
26
|
+
} }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 56, height: 20 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 52, height: 16 })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
alignItems: 'flex-end',
|
|
29
|
+
flexDirection: 'column',
|
|
30
|
+
} }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 40, height: 20 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 16 })] }))] }))] })));
|
|
31
|
+
};
|
|
32
|
+
exports.SwapRouteCardSkeleton = SwapRouteCardSkeleton;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.SwapRouteNotFoundCard = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
17
|
+
const material_1 = require("@mui/material");
|
|
18
|
+
const react_i18next_1 = require("react-i18next");
|
|
19
|
+
const SwapRouteNotFoundCard = (_a) => {
|
|
20
|
+
var { dense } = _a, other = __rest(_a, ["dense"]);
|
|
21
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
flex: 1,
|
|
28
|
+
}, py: 2.375 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 48 }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.Route, { fontSize: "inherit" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: 700 }, { children: t('swap.info.title.routeNotFound') })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2 }, { children: t('swap.info.message.routeNotFound') }))] })));
|
|
29
|
+
};
|
|
30
|
+
exports.SwapRouteNotFoundCard = SwapRouteNotFoundCard;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./SwapRouteCard"), exports);
|
|
18
|
+
__exportStar(require("./SwapRouteCardSkeleton"), exports);
|
|
19
|
+
__exportStar(require("./SwapRouteNotFoundCard"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Switch: import("@emotion/styled").StyledComponent<import("@mui/material").SwitchProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Switch = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const Switch_1 = require("@mui/material/Switch");
|
|
7
|
+
exports.Switch = (0, styles_1.styled)(material_1.Switch)(({ theme }) => ({
|
|
8
|
+
width: 42,
|
|
9
|
+
height: 24,
|
|
10
|
+
padding: 0,
|
|
11
|
+
[`.${Switch_1.switchClasses.switchBase}`]: {
|
|
12
|
+
padding: 0,
|
|
13
|
+
margin: theme.spacing(0.25),
|
|
14
|
+
transitionDuration: theme.transitions.duration.standard,
|
|
15
|
+
[`&.${Switch_1.switchClasses.checked}`]: {
|
|
16
|
+
transform: 'translateX(18px)',
|
|
17
|
+
color: theme.palette.common.white,
|
|
18
|
+
[`& + .${Switch_1.switchClasses.track}`]: {
|
|
19
|
+
backgroundColor: theme.palette.primary.main,
|
|
20
|
+
opacity: 1,
|
|
21
|
+
border: 0,
|
|
22
|
+
},
|
|
23
|
+
[`&.${Switch_1.switchClasses.disabled} + .${Switch_1.switchClasses.track}`]: {
|
|
24
|
+
opacity: 0.5,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
[`&.Mui-focusVisible .${Switch_1.switchClasses.thumb}`]: {
|
|
28
|
+
color: theme.palette.primary.main,
|
|
29
|
+
border: '6px solid',
|
|
30
|
+
borderColor: theme.palette.common.white,
|
|
31
|
+
},
|
|
32
|
+
[`&.${Switch_1.switchClasses.disabled} .${Switch_1.switchClasses.thumb}`]: {
|
|
33
|
+
color: theme.palette.mode === 'light'
|
|
34
|
+
? theme.palette.grey[100]
|
|
35
|
+
: theme.palette.grey[600],
|
|
36
|
+
},
|
|
37
|
+
[`&.${Switch_1.switchClasses.disabled} + .${Switch_1.switchClasses.track}`]: {
|
|
38
|
+
opacity: theme.palette.mode === 'light' ? 0.7 : 0.3,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
[`.${Switch_1.switchClasses.thumb}`]: {
|
|
42
|
+
boxSizing: 'border-box',
|
|
43
|
+
width: 20,
|
|
44
|
+
height: 20,
|
|
45
|
+
},
|
|
46
|
+
[`.${Switch_1.switchClasses.track}`]: {
|
|
47
|
+
borderRadius: 24 / 2,
|
|
48
|
+
backgroundColor: theme.palette.mode === 'light'
|
|
49
|
+
? theme.palette.grey[400]
|
|
50
|
+
: theme.palette.grey[800],
|
|
51
|
+
opacity: 1,
|
|
52
|
+
transition: theme.transitions.create(['background-color'], {
|
|
53
|
+
duration: theme.transitions.duration.standard,
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
}));
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextFitter = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const initialState = {
|
|
8
|
+
x: 0,
|
|
9
|
+
y: 0,
|
|
10
|
+
width: 0,
|
|
11
|
+
height: 0,
|
|
12
|
+
};
|
|
13
|
+
const TextFitter = ({ children, width = '100%', height, maxHeight, preserveAspectRatio = 'xMinYMid meet', textStyle, svgStyle, cropTop, cropBottom, onFit, }) => {
|
|
14
|
+
const theme = (0, styles_1.useTheme)();
|
|
15
|
+
const textRef = (0, react_1.useRef)(null);
|
|
16
|
+
const [viewBox, setViewBox] = (0, react_1.useState)(initialState);
|
|
17
|
+
// const [textRect, setTextRect] = useState<Partial<DOMRect>>(initialState);
|
|
18
|
+
const calculateBox = (0, react_1.useCallback)(() => {
|
|
19
|
+
if (!textRef.current) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const box = textRef.current.getBBox();
|
|
23
|
+
if (cropTop) {
|
|
24
|
+
box.y += box.height * cropTop;
|
|
25
|
+
box.height -= box.height * cropTop;
|
|
26
|
+
}
|
|
27
|
+
if (cropBottom) {
|
|
28
|
+
box.height -= box.height * cropBottom;
|
|
29
|
+
}
|
|
30
|
+
setViewBox(box);
|
|
31
|
+
// setTextRect(textRef.current.getBoundingClientRect());
|
|
32
|
+
onFit === null || onFit === void 0 ? void 0 : onFit();
|
|
33
|
+
}, [cropBottom, cropTop, onFit]);
|
|
34
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
35
|
+
calculateBox();
|
|
36
|
+
}, [calculateBox, children]);
|
|
37
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
38
|
+
if (document.fonts) {
|
|
39
|
+
document.fonts.ready.then(() => {
|
|
40
|
+
calculateBox();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}, [calculateBox]);
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)("svg", Object.assign({ style: svgStyle, viewBox: `${viewBox.x} ${viewBox.y} ${viewBox.width} ${viewBox.height}`, width: width, height: height,
|
|
45
|
+
// height={
|
|
46
|
+
// textRect.height && maxHeight && textRect.height >= maxHeight
|
|
47
|
+
// ? maxHeight
|
|
48
|
+
// : height
|
|
49
|
+
// }
|
|
50
|
+
preserveAspectRatio: preserveAspectRatio, fill: theme.palette.text.primary }, { children: (0, jsx_runtime_1.jsx)("text", Object.assign({ x: 0, y: 0, style: textStyle, ref: textRef }, { children: children })) })));
|
|
51
|
+
};
|
|
52
|
+
exports.TextFitter = TextFitter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TextFitter';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./TextFitter"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
export interface TextFitterProps {
|
|
3
|
+
textStyle?: CSSProperties;
|
|
4
|
+
svgStyle?: CSSProperties;
|
|
5
|
+
onFit?(): void;
|
|
6
|
+
maxHeight?: string | number;
|
|
7
|
+
height?: string | number;
|
|
8
|
+
width?: string | number;
|
|
9
|
+
preserveAspectRatio?: string;
|
|
10
|
+
cropTop?: number;
|
|
11
|
+
cropBottom?: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Token = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const material_1 = require("@mui/material");
|
|
17
|
+
const react_i18next_1 = require("react-i18next");
|
|
18
|
+
const hooks_1 = require("../../hooks");
|
|
19
|
+
const utils_1 = require("../../utils");
|
|
20
|
+
const TextFitter_1 = require("../TextFitter");
|
|
21
|
+
const TokenAvatar_1 = require("../TokenAvatar");
|
|
22
|
+
const Token_style_1 = require("./Token.style");
|
|
23
|
+
const Token = (_a) => {
|
|
24
|
+
var _b;
|
|
25
|
+
var { token, connected } = _a, other = __rest(_a, ["token", "connected"]);
|
|
26
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
27
|
+
const { getChainById } = (0, hooks_1.useChains)();
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ flex: 1 }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", flex: 1 }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(TextFitter_1.TextFitter, Object.assign({ height: 32, textStyle: {
|
|
29
|
+
fontWeight: 700,
|
|
30
|
+
} }, { children: (0, utils_1.formatTokenAmount)(token.amount, token.decimals) }))] })), (0, jsx_runtime_1.jsx)(Token_style_1.TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
|
|
31
|
+
tokenSymbol: token.symbol,
|
|
32
|
+
chainName: (_b = getChainById(token.chainId)) === null || _b === void 0 ? void 0 : _b.name,
|
|
33
|
+
}) }))] })));
|
|
34
|
+
};
|
|
35
|
+
exports.Token = Token;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const TextSecondary: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
|
+
align?: "inherit" | "left" | "right" | "center" | "justify" | undefined;
|
|
4
|
+
children?: import("react").ReactNode;
|
|
5
|
+
classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
|
|
6
|
+
gutterBottom?: boolean | undefined;
|
|
7
|
+
noWrap?: boolean | undefined;
|
|
8
|
+
paragraph?: boolean | undefined;
|
|
9
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
10
|
+
variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)" | undefined;
|
|
11
|
+
variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)", string>> | undefined;
|
|
12
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof import("react").HTMLAttributes<HTMLSpanElement>> & {
|
|
13
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
14
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("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") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
15
|
+
connected?: boolean | undefined;
|
|
16
|
+
}, {}, {}>;
|
|
17
|
+
export declare const TokenDivider: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
18
|
+
children?: import("react").ReactNode;
|
|
19
|
+
component?: import("react").ElementType<any> | undefined;
|
|
20
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
21
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
22
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
23
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
24
|
+
}, 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>, {}, {}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenDivider = exports.TextSecondary = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
exports.TextSecondary = (0, styles_1.styled)(material_1.Typography, {
|
|
7
|
+
shouldForwardProp: (prop) => prop !== 'connected',
|
|
8
|
+
})(({ theme, connected }) => ({
|
|
9
|
+
fontSize: 12,
|
|
10
|
+
lineHeight: 1,
|
|
11
|
+
fontWeight: 500,
|
|
12
|
+
color: theme.palette.text.secondary,
|
|
13
|
+
borderLeftWidth: connected ? 2 : 0,
|
|
14
|
+
borderLeftStyle: 'solid',
|
|
15
|
+
borderColor: theme.palette.mode === 'light'
|
|
16
|
+
? theme.palette.grey[300]
|
|
17
|
+
: theme.palette.grey[800],
|
|
18
|
+
margin: connected
|
|
19
|
+
? theme.spacing(0.5, 0, 0, 1.875)
|
|
20
|
+
: theme.spacing(0.5, 0, 0, 6),
|
|
21
|
+
padding: connected
|
|
22
|
+
? theme.spacing(0, 0, 0, 3.875)
|
|
23
|
+
: theme.spacing(0, 0, 0, 0),
|
|
24
|
+
}));
|
|
25
|
+
exports.TokenDivider = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
|
|
26
|
+
height: 12,
|
|
27
|
+
borderLeftWidth: 2,
|
|
28
|
+
borderLeftStyle: 'solid',
|
|
29
|
+
borderColor: theme.palette.mode === 'light'
|
|
30
|
+
? theme.palette.grey[300]
|
|
31
|
+
: theme.palette.grey[800],
|
|
32
|
+
margin: theme.spacing(0, 0, 0, 3.875),
|
|
33
|
+
padding: theme.spacing(0, 0, 0, 3.875),
|
|
34
|
+
}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Token"), exports);
|
|
18
|
+
__exportStar(require("./Token.style"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenAvatar = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const hooks_1 = require("../../hooks");
|
|
7
|
+
const SmallAvatar_1 = require("../SmallAvatar");
|
|
8
|
+
const TokenAvatar = ({ token, sx }) => {
|
|
9
|
+
const { chain } = (0, hooks_1.useChain)(token.chainId);
|
|
10
|
+
const { token: chainToken } = (0, hooks_1.useToken)(token.chainId, token.address);
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: chain ? ((0, jsx_runtime_1.jsx)(SmallAvatar_1.SmallAvatar, Object.assign({ src: chain.logoURI, alt: chain.name }, { children: chain.name[0] }))) : null, sx: sx }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ src: token.logoURI || (chainToken === null || chainToken === void 0 ? void 0 : chainToken.logoURI), alt: token.symbol }, { children: token.symbol[0] })) })));
|
|
12
|
+
};
|
|
13
|
+
exports.TokenAvatar = TokenAvatar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TokenAvatarGroup: import("@emotion/styled").StyledComponent<import("@mui/material").AvatarGroupProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenAvatarGroup = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const Avatar_1 = require("@mui/material/Avatar");
|
|
6
|
+
const Badge_1 = require("@mui/material/Badge");
|
|
7
|
+
const styles_1 = require("@mui/material/styles");
|
|
8
|
+
exports.TokenAvatarGroup = (0, styles_1.styled)(material_1.AvatarGroup)(({ theme }) => ({
|
|
9
|
+
[`& .${Avatar_1.avatarClasses.root}`]: {
|
|
10
|
+
background: theme.palette.background.paper,
|
|
11
|
+
},
|
|
12
|
+
[`& .${Badge_1.badgeClasses.badge}:last-child .${Avatar_1.avatarClasses.root}`]: {
|
|
13
|
+
marginLeft: theme.spacing(-1),
|
|
14
|
+
boxSizing: 'border-box',
|
|
15
|
+
},
|
|
16
|
+
[`& .${Badge_1.badgeClasses.root}:last-child`]: {
|
|
17
|
+
marginLeft: theme.spacing(1),
|
|
18
|
+
},
|
|
19
|
+
}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./TokenAvatar"), exports);
|
|
18
|
+
__exportStar(require("./TokenAvatar.style"), exports);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenList = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const SwapFormProvider_1 = require("../../providers/SwapFormProvider");
|
|
10
|
+
const WalletProvider_1 = require("../../providers/WalletProvider");
|
|
11
|
+
const TokenNotFound_1 = require("./TokenNotFound");
|
|
12
|
+
const VirtualizedTokenList_1 = require("./VirtualizedTokenList");
|
|
13
|
+
const TokenList = ({ formType, height, onClick, }) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const parentRef = (0, react_1.useRef)(null);
|
|
16
|
+
const { account } = (0, WalletProvider_1.useWallet)();
|
|
17
|
+
const { setValue, getValues } = (0, react_hook_form_1.useFormContext)();
|
|
18
|
+
const [selectedChainId] = (0, react_hook_form_1.useWatch)({
|
|
19
|
+
name: [SwapFormProvider_1.SwapFormKeyHelper.getChainKey(formType)],
|
|
20
|
+
});
|
|
21
|
+
const [tokenSearchFilter] = (0, hooks_1.useDebouncedWatch)([SwapFormProvider_1.SwapFormKey.TokenSearchFilter], 250);
|
|
22
|
+
const { tokens: chainTokens, tokensWithBalance, isLoading: isTokensLoading, isBalanceLoading, featuredTokens, } = (0, hooks_1.useTokenBalances)(selectedChainId);
|
|
23
|
+
let filteredTokens = ((_a = tokensWithBalance !== null && tokensWithBalance !== void 0 ? tokensWithBalance : chainTokens) !== null && _a !== void 0 ? _a : []);
|
|
24
|
+
const searchFilter = (_b = tokenSearchFilter === null || tokenSearchFilter === void 0 ? void 0 : tokenSearchFilter.toUpperCase()) !== null && _b !== void 0 ? _b : '';
|
|
25
|
+
filteredTokens = tokenSearchFilter
|
|
26
|
+
? filteredTokens.filter((token) => token.name.toUpperCase().includes(searchFilter) ||
|
|
27
|
+
token.symbol.toUpperCase().includes(searchFilter) ||
|
|
28
|
+
token.address.toUpperCase().includes(searchFilter))
|
|
29
|
+
: filteredTokens;
|
|
30
|
+
const tokenSearchEnabled = !filteredTokens.length && !isTokensLoading;
|
|
31
|
+
const { token: searchedToken, isLoading: isSearchedTokenLoading } = (0, hooks_1.useTokenSearch)(tokenSearchFilter, selectedChainId, tokenSearchEnabled);
|
|
32
|
+
const isLoading = isTokensLoading || (tokenSearchEnabled && isSearchedTokenLoading);
|
|
33
|
+
const tokens = filteredTokens.length
|
|
34
|
+
? filteredTokens
|
|
35
|
+
: searchedToken
|
|
36
|
+
? [searchedToken]
|
|
37
|
+
: filteredTokens;
|
|
38
|
+
const handleTokenClick = (0, react_1.useCallback)((tokenAddress) => {
|
|
39
|
+
setValue(SwapFormProvider_1.SwapFormKeyHelper.getTokenKey(formType), tokenAddress);
|
|
40
|
+
setValue(SwapFormProvider_1.SwapFormKeyHelper.getAmountKey(formType), '');
|
|
41
|
+
const oppositeFormType = formType === 'from' ? 'to' : 'from';
|
|
42
|
+
const [selectedOppositeToken, selectedOppositeChain, selectedChain] = getValues([
|
|
43
|
+
SwapFormProvider_1.SwapFormKeyHelper.getTokenKey(oppositeFormType),
|
|
44
|
+
SwapFormProvider_1.SwapFormKeyHelper.getChainKey(oppositeFormType),
|
|
45
|
+
SwapFormProvider_1.SwapFormKeyHelper.getChainKey(formType),
|
|
46
|
+
]);
|
|
47
|
+
if (selectedOppositeToken === tokenAddress &&
|
|
48
|
+
selectedOppositeChain === selectedChain) {
|
|
49
|
+
setValue(SwapFormProvider_1.SwapFormKeyHelper.getTokenKey(oppositeFormType), '');
|
|
50
|
+
}
|
|
51
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
52
|
+
}, [formType, getValues, onClick, setValue]);
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ ref: parentRef, style: { height, overflow: 'auto' } }, { children: [!tokens.length && !isLoading ? (0, jsx_runtime_1.jsx)(TokenNotFound_1.TokenNotFound, {}) : null, (0, jsx_runtime_1.jsx)(VirtualizedTokenList_1.VirtualizedTokenList, { tokens: tokens, featuredTokensLength: featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.length, scrollElementRef: parentRef, chainId: selectedChainId, isLoading: isLoading, isBalanceLoading: isBalanceLoading, showBalance: account.isActive, showFeatured: !tokenSearchFilter, onClick: handleTokenClick })] })));
|
|
54
|
+
};
|
|
55
|
+
exports.TokenList = TokenList;
|