@lifi/widget 4.0.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/App.d.ts +4 -2
- package/dist/esm/App.d.ts.map +1 -1
- package/dist/esm/App.js +4 -4
- package/dist/esm/App.js.map +1 -1
- package/dist/esm/AppDefault.js +14 -0
- package/dist/esm/AppDefault.js.map +1 -1
- package/dist/esm/AppDrawer.d.ts +1 -1
- package/dist/esm/AppDrawer.d.ts.map +1 -1
- package/dist/esm/AppDrawer.js +5 -6
- package/dist/esm/AppDrawer.js.map +1 -1
- package/dist/esm/AppDrawerContext.js +2 -2
- package/dist/esm/AppDrawerContext.js.map +1 -1
- package/dist/esm/components/ActionRow/ActionRow.style.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.js +2 -1
- package/dist/esm/components/AmountInput/AmountInput.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.style.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js +4 -2
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.style.js +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.style.js.map +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.js +4 -2
- package/dist/esm/components/AmountInput/PriceFormHelperText.js.map +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.style.js.map +1 -1
- package/dist/esm/components/AmountInputCard/AmountInputCard.style.js +98 -0
- package/dist/esm/components/AmountInputCard/AmountInputCard.style.js.map +1 -0
- package/dist/esm/components/AmountInputCard/AmountInputCardPair.js +25 -0
- package/dist/esm/components/AmountInputCard/AmountInputCardPair.js.map +1 -0
- package/dist/esm/components/AmountInputCard/BalanceDisplay.js +35 -0
- package/dist/esm/components/AmountInputCard/BalanceDisplay.js.map +1 -0
- package/dist/esm/components/AmountInputCard/BalanceDisplay.style.js +11 -0
- package/dist/esm/components/AmountInputCard/BalanceDisplay.style.js.map +1 -0
- package/dist/esm/components/AmountInputCard/FiatValueToggle.js +41 -0
- package/dist/esm/components/AmountInputCard/FiatValueToggle.js.map +1 -0
- package/dist/esm/components/AmountInputCard/PercentageChips.js +80 -0
- package/dist/esm/components/AmountInputCard/PercentageChips.js.map +1 -0
- package/dist/esm/components/AmountInputCard/PercentageChips.style.js +43 -0
- package/dist/esm/components/AmountInputCard/PercentageChips.style.js.map +1 -0
- package/dist/esm/components/AmountInputCard/ReceiveAmountCard.js +137 -0
- package/dist/esm/components/AmountInputCard/ReceiveAmountCard.js.map +1 -0
- package/dist/esm/components/AmountInputCard/SendAmountCard.js +102 -0
- package/dist/esm/components/AmountInputCard/SendAmountCard.js.map +1 -0
- package/dist/esm/components/AppContainer.js.map +1 -1
- package/dist/esm/components/Avatar/AccountAvatar.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.js +12 -3
- package/dist/esm/components/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.style.js.map +1 -1
- package/dist/esm/components/Avatar/SmallAvatar.js.map +1 -1
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.js +1 -0
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.js.map +1 -1
- package/dist/esm/components/BottomSheet/BottomSheet.js +3 -3
- package/dist/esm/components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/esm/components/ButtonTertiary.js.map +1 -1
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/Card/CardButton.style.js.map +1 -1
- package/dist/esm/components/Card/CardHeader.js.map +1 -1
- package/dist/esm/components/Card/CardIconButton.js.map +1 -1
- package/dist/esm/components/Card/CardLabel.js.map +1 -1
- package/dist/esm/components/Card/CardTitle.js.map +1 -1
- package/dist/esm/components/Card/InputCard.js.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.js.map +1 -1
- package/dist/esm/components/ChainSelect/ChainSelect.style.js.map +1 -1
- package/dist/esm/components/ChainSelect/useChainSelect.js.map +1 -1
- package/dist/esm/components/Chains/AllChainsAvatar.js.map +1 -1
- package/dist/esm/components/Chains/ChainList.js.map +1 -1
- package/dist/esm/components/Chains/ChainList.style.js.map +1 -1
- package/dist/esm/components/Chains/ChainsExpanded.style.js.map +1 -1
- package/dist/esm/components/Chains/VirtualizedChainList.js +2 -1
- package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -1
- package/dist/esm/components/ContextMenu.style.js.map +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.style.js.map +1 -1
- package/dist/esm/components/Dialog/Dialog.style.js.map +1 -1
- package/dist/esm/components/EmptyListIndicator/EmptyListIndicator.style.js.map +1 -1
- package/dist/esm/components/ExecutionStatusCard/StatusIcon.js.map +1 -1
- package/dist/esm/components/ExecutionStatusCard/StatusIcon.style.js.map +1 -1
- package/dist/esm/components/ExecutionStatusCard/iconKey.js.map +1 -1
- package/dist/esm/components/Expansion/Expansion.style.js.map +1 -1
- package/dist/esm/components/Header/ActivitiesButton.style.js.map +1 -1
- package/dist/esm/components/Header/CloseDrawerButton.js +1 -0
- package/dist/esm/components/Header/CloseDrawerButton.js.map +1 -1
- package/dist/esm/components/Header/Header.js +7 -10
- package/dist/esm/components/Header/Header.js.map +1 -1
- package/dist/esm/components/Header/Header.style.js.map +1 -1
- package/dist/esm/components/Header/HeaderNavigationTabs.js +39 -0
- package/dist/esm/components/Header/HeaderNavigationTabs.js.map +1 -0
- package/dist/esm/components/Header/HeaderTabs.js +33 -0
- package/dist/esm/components/Header/HeaderTabs.js.map +1 -0
- package/dist/esm/components/Header/NavigationHeader.js +7 -5
- package/dist/esm/components/Header/NavigationHeader.js.map +1 -1
- package/dist/esm/components/Header/SettingsButton.style.js.map +1 -1
- package/dist/esm/components/Header/WalletMenu.style.js.map +1 -1
- package/dist/esm/components/IconCircle/IconCircle.style.js +1 -1
- package/dist/esm/components/IconCircle/IconCircle.style.js.map +1 -1
- package/dist/esm/components/IconTypography.js.map +1 -1
- package/dist/esm/components/Input.js.map +1 -1
- package/dist/esm/components/LimitOrderSettings/LimitOrderSettings.js +99 -0
- package/dist/esm/components/LimitOrderSettings/LimitOrderSettings.js.map +1 -0
- package/dist/esm/components/LimitOrderSettings/LimitOrderSettings.style.js +52 -0
- package/dist/esm/components/LimitOrderSettings/LimitOrderSettings.style.js.map +1 -0
- package/dist/esm/components/LimitPriceCard/LimitPriceCard.js +115 -0
- package/dist/esm/components/LimitPriceCard/LimitPriceCard.js.map +1 -0
- package/dist/esm/components/LimitPriceCard/LimitPriceCard.style.js +89 -0
- package/dist/esm/components/LimitPriceCard/LimitPriceCard.style.js.map +1 -0
- package/dist/esm/components/LimitPriceCard/LimitPricePresets.js +91 -0
- package/dist/esm/components/LimitPriceCard/LimitPricePresets.js.map +1 -0
- package/dist/esm/components/ListItem/ListItem.js.map +1 -1
- package/dist/esm/components/ListItem/ListItemButton.js.map +1 -1
- package/dist/esm/components/ListItemButton.js.map +1 -1
- package/dist/esm/components/ListItemText.js.map +1 -1
- package/dist/esm/components/Menu.js.map +1 -1
- package/dist/esm/components/Messages/AlertMessage.style.js.map +1 -1
- package/dist/esm/components/Messages/GasRefuelMessage.style.js.map +1 -1
- package/dist/esm/components/Messages/WarningMessages.js.map +1 -1
- package/dist/esm/components/PageContainer.js.map +1 -1
- package/dist/esm/components/PoweredBy/PoweredBy.js.map +1 -1
- package/dist/esm/components/PoweredBy/PoweredBy.style.js.map +1 -1
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.js +1 -0
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.js.map +1 -1
- package/dist/esm/components/ReverseTokensButton/ReverseTokensButton.style.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteDetails.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteDetails.style.js +2 -2
- package/dist/esm/components/RouteCard/RouteDetails.style.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteProviderCard.js +118 -0
- package/dist/esm/components/RouteCard/RouteProviderCard.js.map +1 -0
- package/dist/esm/components/RouteCard/RouteToken.style.js.map +1 -1
- package/dist/esm/components/RouteCard/RouteTokens.js.map +1 -1
- package/dist/esm/components/RouteCard/getMatchingLabels.js.map +1 -1
- package/dist/esm/components/Routes/LimitOrderRoutes.js +34 -0
- package/dist/esm/components/Routes/LimitOrderRoutes.js.map +1 -0
- package/dist/esm/components/Routes/Routes.js +2 -2
- package/dist/esm/components/Routes/Routes.js.map +1 -1
- package/dist/esm/components/Routes/RoutesContent.js.map +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.style.js.map +1 -1
- package/dist/esm/components/Search/SearchInput.style.js.map +1 -1
- package/dist/esm/components/Search/SearchNotFound.style.js.map +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.js.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.style.js.map +1 -1
- package/dist/esm/components/SettingsListItemButton.js.map +1 -1
- package/dist/esm/components/SettingsPanel/SettingsPanel.js +51 -0
- package/dist/esm/components/SettingsPanel/SettingsPanel.js.map +1 -0
- package/dist/esm/components/SettingsPanel/SettingsPanel.style.js +33 -0
- package/dist/esm/components/SettingsPanel/SettingsPanel.style.js.map +1 -0
- package/dist/esm/components/SettingsPanel/utils.js +14 -0
- package/dist/esm/components/SettingsPanel/utils.js.map +1 -0
- package/dist/esm/components/Skeleton/WidgetSkeleton.js +50 -47
- package/dist/esm/components/Skeleton/WidgetSkeleton.js.map +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.js.map +1 -1
- package/dist/esm/components/Step/StepActions.js.map +1 -1
- package/dist/esm/components/Step/StepActions.style.js.map +1 -1
- package/dist/esm/components/StepActions/SentToWalletRow.style.js.map +1 -1
- package/dist/esm/components/StepActions/StepActionRow.style.js.map +1 -1
- package/dist/esm/components/SwapButton/SwapButton.js +50 -0
- package/dist/esm/components/SwapButton/SwapButton.js.map +1 -0
- package/dist/esm/components/SwapButton/SwapButton.style.js +24 -0
- package/dist/esm/components/SwapButton/SwapButton.style.js.map +1 -0
- package/dist/esm/components/Switch.js.map +1 -1
- package/dist/esm/components/Tabs/NavigationTabs.js +3 -0
- package/dist/esm/components/Tabs/NavigationTabs.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.style.js.map +1 -1
- package/dist/esm/components/Timer/StepStatusTimer.style.js.map +1 -1
- package/dist/esm/components/Token/Token.style.js.map +1 -1
- package/dist/esm/components/TokenList/PinTokenButton.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheet.js +4 -4
- package/dist/esm/components/TokenList/TokenDetailsSheet.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js +4 -4
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.style.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.style.js.map +1 -1
- package/dist/esm/components/TokenList/TokenListItem.js +2 -2
- package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/dist/esm/components/TokenList/useTokenSelect.js +3 -3
- package/dist/esm/components/TokenList/useTokenSelect.js.map +1 -1
- package/dist/esm/components/TokenPillButton/TokenPillButton.js +52 -0
- package/dist/esm/components/TokenPillButton/TokenPillButton.js.map +1 -0
- package/dist/esm/components/TokenPillButton/TokenPillButton.style.js +39 -0
- package/dist/esm/components/TokenPillButton/TokenPillButton.style.js.map +1 -0
- package/dist/esm/components/TokenRate/TokenRate.style.js.map +1 -1
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.js.map +1 -1
- package/dist/esm/components/TransactionCard/ActiveTransactionCard.style.js.map +1 -1
- package/dist/esm/components/TransactionCard/TransactionCard.style.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/validate.js.map +1 -1
- package/dist/esm/hooks/useAccountsBalancesData.js.map +1 -1
- package/dist/esm/hooks/useAvailableChains.js +1 -1
- package/dist/esm/hooks/useChainSearch.js +2 -1
- package/dist/esm/hooks/useChainSearch.js.map +1 -1
- package/dist/esm/hooks/useChains.js +1 -1
- package/dist/esm/hooks/useExplorer.js.map +1 -1
- package/dist/esm/hooks/useFilteredByTokenBalances.js +1 -1
- package/dist/esm/hooks/useFilteredByTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useFromTokenSufficiency.js.map +1 -1
- package/dist/esm/hooks/useGasSufficiency.js.map +1 -1
- package/dist/esm/hooks/useLanguages.js +2 -2
- package/dist/esm/hooks/useLanguages.js.map +1 -1
- package/dist/esm/hooks/useLimitMarketRate.js +24 -0
- package/dist/esm/hooks/useLimitMarketRate.js.map +1 -0
- package/dist/esm/hooks/useLinkedLimitFields.js +49 -0
- package/dist/esm/hooks/useLinkedLimitFields.js.map +1 -0
- package/dist/esm/hooks/useRouteExecution.js.map +1 -1
- package/dist/esm/hooks/useRouteExecutionMessage.js.map +1 -1
- package/dist/esm/hooks/useRouteRequiredAccountConnection.js.map +1 -1
- package/dist/esm/hooks/useRoutes.js +23 -6
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useSwapOnly.js +2 -4
- package/dist/esm/hooks/useSwapOnly.js.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.js +2 -2
- package/dist/esm/hooks/useToAddressRequirements.js.map +1 -1
- package/dist/esm/hooks/useToken.js.map +1 -1
- package/dist/esm/hooks/useTokenBalance.js.map +1 -1
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenBalancesQueries.js.map +1 -1
- package/dist/esm/hooks/useTokenSearch.js +1 -1
- package/dist/esm/hooks/useTokenSearch.js.map +1 -1
- package/dist/esm/hooks/useTokens.js +17 -15
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/hooks/useTools.js +1 -1
- package/dist/esm/hooks/useTransactionDetails.js.map +1 -1
- package/dist/esm/hooks/useTransactionHistory.js.map +1 -1
- package/dist/esm/hooks/useTransactionList.js.map +1 -1
- package/dist/esm/hooks/useWideVariant.js +5 -2
- package/dist/esm/hooks/useWideVariant.js.map +1 -1
- package/dist/esm/i18n/en.json +25 -0
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/pages/ActivitiesPage/ActivitiesPage.js.map +1 -1
- package/dist/esm/pages/MainPage/LimitPageContent.js +23 -0
- package/dist/esm/pages/MainPage/LimitPageContent.js.map +1 -0
- package/dist/esm/pages/MainPage/MainPage.js +19 -22
- package/dist/esm/pages/MainPage/MainPage.js.map +1 -1
- package/dist/esm/pages/MainPage/MainPageActions.js +28 -0
- package/dist/esm/pages/MainPage/MainPageActions.js.map +1 -0
- package/dist/esm/pages/MainPage/ReviewButton.js +11 -4
- package/dist/esm/pages/MainPage/ReviewButton.js.map +1 -1
- package/dist/esm/pages/RoutePriorityPage.js +48 -0
- package/dist/esm/pages/RoutePriorityPage.js.map +1 -0
- package/dist/esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/dist/esm/pages/RoutesPage/RoutesPage.style.js.map +1 -1
- package/dist/esm/pages/SelectEnabledToolsPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/BookmarkAddressSheet.js +3 -3
- package/dist/esm/pages/SendToWallet/BookmarkAddressSheet.js.map +1 -1
- package/dist/esm/pages/SendToWallet/ConfirmAddressSheet.js +3 -3
- package/dist/esm/pages/SendToWallet/ConfirmAddressSheet.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js +2 -2
- package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/GasPriceSettings.js +1 -1
- package/dist/esm/pages/SettingsPage/ResetSettingsButton.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/RoutePrioritySettings.js +12 -27
- package/dist/esm/pages/SettingsPage/RoutePrioritySettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCard.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js +3 -3
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingsAccordian.js +3 -3
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingsAccordian.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippagePage.js +133 -0
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippagePage.js.map +1 -0
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js +14 -72
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js +26 -14
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.style.js.map +1 -1
- package/dist/esm/pages/SettingsPage/ThemeSettings.js +4 -0
- package/dist/esm/pages/SettingsPage/ThemeSettings.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/ContactSupportButton.style.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsSkeleton.js.map +1 -1
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.js +3 -3
- package/dist/esm/pages/TransactionPage/ConfirmToAddressSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.js +16 -15
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/ExchangeRateBottomSheet.style.js.map +1 -1
- package/dist/esm/pages/TransactionPage/RouteTracker.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js +3 -3
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TokenValueBottomSheet.style.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionExecutionContent.js +27 -31
- package/dist/esm/pages/TransactionPage/TransactionExecutionContent.js.map +1 -1
- package/dist/esm/pages/TransactionPage/TransactionReview.js +4 -1
- package/dist/esm/pages/TransactionPage/TransactionReview.js.map +1 -1
- package/dist/esm/pages/TransactionPage/utils.js.map +1 -1
- package/dist/esm/providers/I18nProvider/I18nProvider.js +1 -1
- package/dist/esm/providers/I18nProvider/I18nProvider.js.map +1 -1
- package/dist/esm/providers/I18nProvider/enResource.d.ts +1 -1
- package/dist/esm/providers/I18nProvider/enResource.js +1 -1
- package/dist/esm/providers/I18nProvider/i18n.js.map +1 -1
- package/dist/esm/providers/I18nProvider/types.d.ts +2 -2
- package/dist/esm/providers/QueryClientProvider.js +2 -2
- package/dist/esm/providers/QueryClientProvider.js.map +1 -1
- package/dist/esm/providers/SDKClientProvider.js +3 -3
- package/dist/esm/providers/SDKClientProvider.js.map +1 -1
- package/dist/esm/providers/WidgetProvider/WidgetProvider.js +4 -5
- package/dist/esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
- package/dist/esm/stores/StoreProvider.js +3 -4
- package/dist/esm/stores/StoreProvider.js.map +1 -1
- package/dist/esm/stores/bookmarks/BookmarkStore.js +3 -3
- package/dist/esm/stores/bookmarks/BookmarkStore.js.map +1 -1
- package/dist/esm/stores/bookmarks/createBookmarkStore.js.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.js +4 -4
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/createChainOrderStore.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/URLSearchParamsBuilder.js +14 -3
- package/dist/esm/stores/form/URLSearchParamsBuilder.js.map +1 -1
- package/dist/esm/stores/form/createFormStore.js +6 -2
- package/dist/esm/stores/form/createFormStore.js.map +1 -1
- package/dist/esm/stores/form/getDefaultValuesFromQueryString.js +3 -0
- package/dist/esm/stores/form/getDefaultValuesFromQueryString.js.map +1 -1
- package/dist/esm/stores/form/types.d.ts +9 -1
- package/dist/esm/stores/form/types.d.ts.map +1 -1
- package/dist/esm/stores/form/types.js.map +1 -1
- package/dist/esm/stores/form/useClearAmountFields.js +1 -0
- package/dist/esm/stores/form/useClearAmountFields.js.map +1 -1
- package/dist/esm/stores/form/useFieldActions.js.map +1 -1
- package/dist/esm/stores/form/useFieldValues.js.map +1 -1
- package/dist/esm/stores/form/useFormRef.js.map +1 -1
- package/dist/esm/stores/form/useFormStore.js +2 -2
- package/dist/esm/stores/form/useFormStore.js.map +1 -1
- package/dist/esm/stores/header/useHeaderStore.js +3 -3
- package/dist/esm/stores/header/useHeaderStore.js.map +1 -1
- package/dist/esm/stores/inputMode/useInputModeStore.js.map +1 -1
- package/dist/esm/stores/navigationTabs/useNavigationTabLabel.js +22 -0
- package/dist/esm/stores/navigationTabs/useNavigationTabLabel.js.map +1 -0
- package/dist/esm/stores/navigationTabs/useNavigationTabsStore.js +64 -0
- package/dist/esm/stores/navigationTabs/useNavigationTabsStore.js.map +1 -0
- package/dist/esm/stores/navigationTabs/utils.js +122 -0
- package/dist/esm/stores/navigationTabs/utils.js.map +1 -0
- package/dist/esm/stores/pinnedTokens/PinnedTokensStore.js +3 -3
- package/dist/esm/stores/pinnedTokens/PinnedTokensStore.js.map +1 -1
- package/dist/esm/stores/pinnedTokens/createPinnedTokensStore.js.map +1 -1
- package/dist/esm/stores/routes/RouteExecutionStore.js +3 -3
- package/dist/esm/stores/routes/RouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/createRouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/routes/useIntermediateRoutesStore.js.map +1 -1
- package/dist/esm/stores/routes/useRouteExecutionIndicator.js.map +1 -1
- package/dist/esm/stores/routes/utils.js.map +1 -1
- package/dist/esm/stores/settings/SettingsStore.js +3 -3
- package/dist/esm/stores/settings/SettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/createSettingsStore.js +122 -96
- package/dist/esm/stores/settings/createSettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/types.d.ts +0 -2
- package/dist/esm/stores/settings/types.d.ts.map +1 -1
- package/dist/esm/stores/settings/types.js.map +1 -1
- package/dist/esm/stores/settings/useSettingsActions.js.map +1 -1
- package/dist/esm/themes/createTheme.js.map +1 -1
- package/dist/esm/themes/utils.js.map +1 -1
- package/dist/esm/types/events.d.ts +10 -1
- package/dist/esm/types/events.d.ts.map +1 -1
- package/dist/esm/types/events.js +2 -0
- package/dist/esm/types/events.js.map +1 -1
- package/dist/esm/types/widget.d.ts +28 -2
- package/dist/esm/types/widget.d.ts.map +1 -1
- package/dist/esm/types/widget.js.map +1 -1
- package/dist/esm/utils/compactNumberFormatter.js.map +1 -1
- package/dist/esm/utils/converters.js.map +1 -1
- package/dist/esm/utils/deepEqual.js.map +1 -1
- package/dist/esm/utils/fees.js.map +1 -1
- package/dist/esm/utils/format.d.ts +1 -1
- package/dist/esm/utils/format.d.ts.map +1 -1
- package/dist/esm/utils/format.js +2 -2
- package/dist/esm/utils/format.js.map +1 -1
- package/dist/esm/utils/getActionMessage.js.map +1 -1
- package/dist/esm/utils/getErrorMessage.js.map +1 -1
- package/dist/esm/utils/item.js.map +1 -1
- package/dist/esm/utils/limitOrder.js +61 -0
- package/dist/esm/utils/limitOrder.js.map +1 -0
- package/dist/esm/utils/{variant.js → mode.js} +2 -2
- package/dist/esm/utils/mode.js.map +1 -0
- package/dist/esm/utils/navigationRoutes.d.ts +2 -0
- package/dist/esm/utils/navigationRoutes.d.ts.map +1 -1
- package/dist/esm/utils/navigationRoutes.js +6 -0
- package/dist/esm/utils/navigationRoutes.js.map +1 -1
- package/dist/esm/utils/prepareActions.js +1 -1
- package/dist/esm/utils/prepareActions.js.map +1 -1
- package/dist/esm/utils/timer.js.map +1 -1
- package/dist/esm/utils/token.js +1 -1
- package/dist/esm/utils/token.js.map +1 -1
- package/dist/esm/utils/tokenList.js.map +1 -1
- package/package.json +13 -13
- package/src/App.tsx +7 -7
- package/src/AppDefault.tsx +16 -0
- package/src/AppDrawer.tsx +77 -78
- package/src/AppDrawerContext.ts +2 -2
- package/src/components/AmountInput/AmountInputEndAdornment.style.ts +1 -1
- package/src/components/AmountInput/AmountInputEndAdornment.tsx +5 -2
- package/src/components/AmountInputCard/AmountInputCard.style.tsx +157 -0
- package/src/components/AmountInputCard/AmountInputCardPair.tsx +25 -0
- package/src/components/AmountInputCard/BalanceDisplay.style.tsx +9 -0
- package/src/components/AmountInputCard/BalanceDisplay.tsx +46 -0
- package/src/components/AmountInputCard/FiatValueToggle.tsx +55 -0
- package/src/components/AmountInputCard/PercentageChips.style.tsx +60 -0
- package/src/components/AmountInputCard/PercentageChips.tsx +100 -0
- package/src/components/AmountInputCard/ReceiveAmountCard.tsx +219 -0
- package/src/components/AmountInputCard/SendAmountCard.tsx +179 -0
- package/src/components/Avatar/Avatar.tsx +8 -3
- package/src/components/BaseTransactionButton/BaseTransactionButton.tsx +1 -0
- package/src/components/BottomSheet/BottomSheet.tsx +56 -52
- package/src/components/Header/CloseDrawerButton.tsx +5 -1
- package/src/components/Header/Header.tsx +20 -18
- package/src/components/Header/HeaderNavigationTabs.tsx +42 -0
- package/src/components/Header/HeaderTabs.tsx +48 -0
- package/src/components/Header/NavigationHeader.tsx +11 -8
- package/src/components/LimitOrderSettings/LimitOrderSettings.style.tsx +69 -0
- package/src/components/LimitOrderSettings/LimitOrderSettings.tsx +124 -0
- package/src/components/LimitPriceCard/LimitPriceCard.style.tsx +103 -0
- package/src/components/LimitPriceCard/LimitPriceCard.tsx +153 -0
- package/src/components/LimitPriceCard/LimitPricePresets.tsx +139 -0
- package/src/components/ReverseTokensButton/ReverseTokensButton.tsx +4 -1
- package/src/components/RouteCard/RouteProviderCard.tsx +113 -0
- package/src/components/Routes/LimitOrderRoutes.tsx +64 -0
- package/src/components/Routes/Routes.tsx +3 -2
- package/src/components/SettingsPanel/SettingsPanel.style.tsx +41 -0
- package/src/components/SettingsPanel/SettingsPanel.tsx +73 -0
- package/src/components/SettingsPanel/utils.ts +27 -0
- package/src/components/Skeleton/WidgetSkeleton.tsx +1 -1
- package/src/components/SwapButton/SwapButton.style.tsx +28 -0
- package/src/components/SwapButton/SwapButton.tsx +71 -0
- package/src/components/Tabs/NavigationTabs.tsx +3 -0
- package/src/components/TokenList/TokenDetailsSheet.tsx +9 -7
- package/src/components/TokenList/TokenDetailsSheetContent.tsx +176 -177
- package/src/components/TokenList/useTokenSelect.ts +2 -2
- package/src/components/TokenPillButton/TokenPillButton.style.tsx +50 -0
- package/src/components/TokenPillButton/TokenPillButton.tsx +81 -0
- package/src/config/version.ts +1 -1
- package/src/hooks/useLimitMarketRate.ts +39 -0
- package/src/hooks/useLinkedLimitFields.ts +74 -0
- package/src/hooks/useRoutes.ts +45 -4
- package/src/hooks/useSwapOnly.ts +2 -5
- package/src/hooks/useToAddressRequirements.ts +2 -2
- package/src/hooks/useWideVariant.ts +8 -2
- package/src/pages/MainPage/LimitPageContent.tsx +18 -0
- package/src/pages/MainPage/MainPage.tsx +43 -30
- package/src/pages/MainPage/MainPageActions.tsx +35 -0
- package/src/pages/MainPage/ReviewButton.tsx +15 -3
- package/src/pages/RoutePriorityPage.tsx +55 -0
- package/src/pages/SendToWallet/BookmarkAddressSheet.tsx +176 -185
- package/src/pages/SendToWallet/ConfirmAddressSheet.tsx +9 -6
- package/src/pages/SettingsPage/RoutePrioritySettings.tsx +14 -38
- package/src/pages/SettingsPage/SettingsCard/SettingCardExpandable.tsx +58 -65
- package/src/pages/SettingsPage/SettingsCard/SettingsAccordian.tsx +4 -4
- package/src/pages/SettingsPage/SlippageSettings/SlippagePage.tsx +176 -0
- package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.style.tsx +32 -25
- package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.tsx +14 -128
- package/src/pages/SettingsPage/ThemeSettings.tsx +4 -0
- package/src/pages/TransactionPage/ConfirmToAddressSheet.tsx +9 -6
- package/src/pages/TransactionPage/ExchangeRateBottomSheet.tsx +53 -58
- package/src/pages/TransactionPage/TokenValueBottomSheet.tsx +24 -21
- package/src/pages/TransactionPage/TransactionExecutionContent.tsx +8 -6
- package/src/providers/QueryClientProvider.tsx +2 -2
- package/src/providers/SDKClientProvider.tsx +3 -7
- package/src/providers/WidgetProvider/WidgetProvider.tsx +6 -7
- package/src/stores/StoreProvider.tsx +3 -10
- package/src/stores/bookmarks/BookmarkStore.tsx +4 -4
- package/src/stores/chains/ChainOrderStore.tsx +4 -4
- package/src/stores/form/FormStore.tsx +2 -2
- package/src/stores/form/URLSearchParamsBuilder.tsx +25 -3
- package/src/stores/form/createFormStore.ts +7 -3
- package/src/stores/form/getDefaultValuesFromQueryString.ts +11 -0
- package/src/stores/form/types.ts +14 -1
- package/src/stores/form/useClearAmountFields.ts +1 -0
- package/src/stores/form/useFormStore.ts +2 -2
- package/src/stores/header/useHeaderStore.tsx +3 -5
- package/src/stores/navigationTabs/types.ts +33 -0
- package/src/stores/navigationTabs/useNavigationTabLabel.ts +28 -0
- package/src/stores/navigationTabs/useNavigationTabsStore.tsx +113 -0
- package/src/stores/navigationTabs/utils.ts +196 -0
- package/src/stores/pinnedTokens/PinnedTokensStore.tsx +4 -4
- package/src/stores/routes/RouteExecutionStore.tsx +4 -4
- package/src/stores/settings/SettingsStore.tsx +4 -4
- package/src/stores/settings/createSettingsStore.ts +48 -12
- package/src/stores/settings/types.ts +1 -16
- package/src/types/events.ts +12 -0
- package/src/types/widget.ts +40 -1
- package/src/utils/format.ts +6 -2
- package/src/utils/limitOrder.ts +88 -0
- package/src/utils/navigationRoutes.ts +6 -0
- package/dist/esm/components/Header/SplitNavigationTabs.js +0 -33
- package/dist/esm/components/Header/SplitNavigationTabs.js.map +0 -1
- package/dist/esm/stores/settings/useSplitModeStore.js +0 -36
- package/dist/esm/stores/settings/useSplitModeStore.js.map +0 -1
- package/dist/esm/utils/variant.js.map +0 -1
- package/src/components/Header/SplitNavigationTabs.tsx +0 -32
- package/src/stores/settings/useSplitModeStore.tsx +0 -58
- /package/src/utils/{variant.ts → mode.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLocation } from '@tanstack/react-router'
|
|
2
2
|
import type { FC, PropsWithChildren } from 'react'
|
|
3
|
-
import {
|
|
3
|
+
import { useCallback } from 'react'
|
|
4
4
|
import { useDefaultElementId } from '../../hooks/useDefaultElementId.js'
|
|
5
5
|
import { useSetHeaderHeight } from '../../stores/header/useHeaderStore.js'
|
|
6
6
|
import { createElementId, ElementId } from '../../utils/elements.js'
|
|
@@ -12,31 +12,33 @@ import { WalletHeader } from './WalletHeader.js'
|
|
|
12
12
|
const HeaderContainer: FC<PropsWithChildren> = ({ children }) => {
|
|
13
13
|
const { pathname } = useLocation()
|
|
14
14
|
const elementId = useDefaultElementId()
|
|
15
|
-
const headerRef = useRef<HTMLDivElement>(null)
|
|
16
15
|
const { setHeaderHeight } = useSetHeaderHeight()
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
|
|
17
|
+
// React 19 ref cleanup callback: set up the ResizeObserver when the node
|
|
18
|
+
// mounts and tear it down when it unmounts.
|
|
19
|
+
const headerRef = useCallback(
|
|
20
|
+
(node: HTMLDivElement | null) => {
|
|
21
|
+
if (!node) {
|
|
22
|
+
return
|
|
24
23
|
}
|
|
25
|
-
}
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
const handleHeaderResize = () => {
|
|
26
|
+
const height = node.getBoundingClientRect().height
|
|
27
|
+
|
|
28
|
+
if (height) {
|
|
29
|
+
setHeaderHeight(height)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
resizeObserver
|
|
31
|
-
resizeObserver.observe(headerRef.current)
|
|
32
|
-
}
|
|
33
|
+
const resizeObserver = new ResizeObserver(handleHeaderResize)
|
|
34
|
+
resizeObserver.observe(node)
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
if (resizeObserver) {
|
|
36
|
+
return () => {
|
|
36
37
|
resizeObserver.disconnect()
|
|
37
38
|
}
|
|
38
|
-
}
|
|
39
|
-
|
|
39
|
+
},
|
|
40
|
+
[setHeaderHeight]
|
|
41
|
+
)
|
|
40
42
|
|
|
41
43
|
return (
|
|
42
44
|
<Container
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type JSX, useEffect, useRef } from 'react'
|
|
2
|
+
import { useWidgetEvents } from '../../hooks/useWidgetEvents.js'
|
|
3
|
+
import { useNavigationTabLabel } from '../../stores/navigationTabs/useNavigationTabLabel.js'
|
|
4
|
+
import { useNavigationTabsStore } from '../../stores/navigationTabs/useNavigationTabsStore.js'
|
|
5
|
+
import { WidgetEvent } from '../../types/events.js'
|
|
6
|
+
import type { NavigationTabKey } from '../../types/widget.js'
|
|
7
|
+
import { HeaderTabs } from './HeaderTabs.js'
|
|
8
|
+
|
|
9
|
+
export const HeaderNavigationTabs = (): JSX.Element | null => {
|
|
10
|
+
const [tabs, activeTab, setActiveTab] = useNavigationTabsStore((store) => [
|
|
11
|
+
store.tabs,
|
|
12
|
+
store.activeTab,
|
|
13
|
+
store.setActiveTab,
|
|
14
|
+
])
|
|
15
|
+
const getLabel = useNavigationTabLabel()
|
|
16
|
+
const emitter = useWidgetEvents()
|
|
17
|
+
const previousTabRef = useRef<NavigationTabKey | undefined>(undefined)
|
|
18
|
+
|
|
19
|
+
// Emit on the first resolved tab and on every subsequent switch.
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!activeTab || previousTabRef.current === activeTab) {
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
emitter.emit(WidgetEvent.NavigationTabChanged, {
|
|
25
|
+
tab: activeTab,
|
|
26
|
+
previousTab: previousTabRef.current,
|
|
27
|
+
})
|
|
28
|
+
previousTabRef.current = activeTab
|
|
29
|
+
}, [emitter, activeTab])
|
|
30
|
+
|
|
31
|
+
if (!tabs.length || !activeTab) {
|
|
32
|
+
return null
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<HeaderTabs
|
|
37
|
+
tabs={tabs.map((key) => ({ key, label: getLabel(key) }))}
|
|
38
|
+
value={activeTab}
|
|
39
|
+
onChange={setActiveTab}
|
|
40
|
+
/>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { JSX } from 'react'
|
|
2
|
+
import { useFieldActions } from '../../stores/form/useFieldActions.js'
|
|
3
|
+
import { NavigationTab, NavigationTabs } from '../Tabs/NavigationTabs.js'
|
|
4
|
+
|
|
5
|
+
interface HeaderTab<K extends string> {
|
|
6
|
+
key: K
|
|
7
|
+
label: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface HeaderTabsProps<K extends string> {
|
|
11
|
+
tabs: HeaderTab<K>[]
|
|
12
|
+
value: K
|
|
13
|
+
onChange: (key: K) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Presentational header tabs bar shared by split mode and configured
|
|
18
|
+
* navigation tabs.
|
|
19
|
+
* Clears the form fields on switch; the caller supplies the labelled tabs, the
|
|
20
|
+
* active key, and what selecting a key means for its store.
|
|
21
|
+
*/
|
|
22
|
+
export const HeaderTabs = <K extends string>({
|
|
23
|
+
tabs,
|
|
24
|
+
value,
|
|
25
|
+
onChange,
|
|
26
|
+
}: HeaderTabsProps<K>): JSX.Element => {
|
|
27
|
+
const { setFieldValue } = useFieldActions()
|
|
28
|
+
|
|
29
|
+
const handleChange = (_: React.SyntheticEvent, key: K) => {
|
|
30
|
+
setFieldValue('fromAmount', '')
|
|
31
|
+
setFieldValue('fromToken', '')
|
|
32
|
+
setFieldValue('toToken', '')
|
|
33
|
+
onChange(key)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<NavigationTabs value={value} onChange={handleChange} aria-label="tabs">
|
|
38
|
+
{tabs.map((tab) => (
|
|
39
|
+
<NavigationTab
|
|
40
|
+
key={tab.key}
|
|
41
|
+
value={tab.key}
|
|
42
|
+
label={tab.label}
|
|
43
|
+
disableRipple
|
|
44
|
+
/>
|
|
45
|
+
))}
|
|
46
|
+
</NavigationTabs>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
@@ -3,6 +3,7 @@ import { Box, Typography } from '@mui/material'
|
|
|
3
3
|
import { useLocation } from '@tanstack/react-router'
|
|
4
4
|
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
|
|
5
5
|
import { useHeaderStore } from '../../stores/header/useHeaderStore.js'
|
|
6
|
+
import { useNavigationTabsStore } from '../../stores/navigationTabs/useNavigationTabsStore.js'
|
|
6
7
|
import {
|
|
7
8
|
backButtonRoutes,
|
|
8
9
|
navigationRoutes,
|
|
@@ -12,11 +13,14 @@ import { ActivitiesButton } from './ActivitiesButton.js'
|
|
|
12
13
|
import { BackButton } from './BackButton.js'
|
|
13
14
|
import { CloseDrawerButton } from './CloseDrawerButton.js'
|
|
14
15
|
import { HeaderAppBar, HeaderControlsContainer } from './Header.style.js'
|
|
16
|
+
import { HeaderNavigationTabs } from './HeaderNavigationTabs.js'
|
|
15
17
|
import { SettingsButton } from './SettingsButton.js'
|
|
16
|
-
import { SplitNavigationTabs } from './SplitNavigationTabs.js'
|
|
17
18
|
|
|
18
19
|
export const NavigationHeader: React.FC = () => {
|
|
19
|
-
const {
|
|
20
|
+
const { hiddenUI, variant, defaultUI } = useWidgetConfig()
|
|
21
|
+
const navigationTabsCount = useNavigationTabsStore(
|
|
22
|
+
(state) => state.tabs.length
|
|
23
|
+
)
|
|
20
24
|
const { account } = useAccount()
|
|
21
25
|
const [element, title] = useHeaderStore((state) => [
|
|
22
26
|
state.element,
|
|
@@ -29,17 +33,16 @@ export const NavigationHeader: React.FC = () => {
|
|
|
29
33
|
const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1)
|
|
30
34
|
const hasPath = navigationRoutesValues.includes(path)
|
|
31
35
|
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
const
|
|
35
|
-
mode === 'split' && !hasPath && typeof modeOptions?.split !== 'string'
|
|
36
|
+
// The store resolves which tabs to show (split Swap/Bridge or configured
|
|
37
|
+
// navigation tabs); the header just reflects whether there are any.
|
|
38
|
+
const showHeaderTabs = !hasPath && navigationTabsCount > 0
|
|
36
39
|
|
|
37
40
|
return (
|
|
38
41
|
<HeaderAppBar elevation={0} sx={{ paddingTop: 1, paddingBottom: 0.5 }}>
|
|
39
42
|
{backButtonRoutes.includes(path) ? <BackButton /> : null}
|
|
40
|
-
{
|
|
43
|
+
{showHeaderTabs ? (
|
|
41
44
|
<Box sx={{ flex: 1, marginRight: 1 }}>
|
|
42
|
-
<
|
|
45
|
+
<HeaderNavigationTabs />
|
|
43
46
|
</Box>
|
|
44
47
|
) : (
|
|
45
48
|
<Typography
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Box, ButtonBase, styled, Typography } from '@mui/material'
|
|
2
|
+
import type React from 'react'
|
|
3
|
+
|
|
4
|
+
export const Container: React.FC<React.ComponentProps<typeof Box>> = styled(
|
|
5
|
+
Box
|
|
6
|
+
)(({ theme }) => ({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexDirection: 'column',
|
|
9
|
+
gap: theme.spacing(1),
|
|
10
|
+
}))
|
|
11
|
+
|
|
12
|
+
export const SettingsRow: React.FC<React.ComponentProps<typeof Box>> = styled(
|
|
13
|
+
Box
|
|
14
|
+
)(({ theme }) => ({
|
|
15
|
+
display: 'flex',
|
|
16
|
+
justifyContent: 'space-between',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
gap: theme.spacing(2),
|
|
19
|
+
padding: theme.spacing(1.5, 2),
|
|
20
|
+
}))
|
|
21
|
+
|
|
22
|
+
export const ToggleLabel: React.FC<React.ComponentProps<typeof Box>> = styled(
|
|
23
|
+
Box
|
|
24
|
+
)(({ theme }) => ({
|
|
25
|
+
fontSize: 14,
|
|
26
|
+
fontWeight: 700,
|
|
27
|
+
lineHeight: 1,
|
|
28
|
+
color: theme.vars.palette.text.primary,
|
|
29
|
+
flex: '1 0 0',
|
|
30
|
+
minWidth: 0,
|
|
31
|
+
}))
|
|
32
|
+
|
|
33
|
+
export const ExpiryValue: React.FC<React.ComponentProps<typeof Box>> = styled(
|
|
34
|
+
Box
|
|
35
|
+
)(({ theme }) => ({
|
|
36
|
+
display: 'flex',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
gap: theme.spacing(0.5),
|
|
39
|
+
color: theme.vars.palette.text.secondary,
|
|
40
|
+
height: 14,
|
|
41
|
+
}))
|
|
42
|
+
|
|
43
|
+
export const SettingItemButton: React.FC<
|
|
44
|
+
React.ComponentProps<typeof ButtonBase>
|
|
45
|
+
> = styled(ButtonBase)(({ theme }) => ({
|
|
46
|
+
display: 'flex',
|
|
47
|
+
justifyContent: 'space-between',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
width: '100%',
|
|
50
|
+
padding: theme.spacing(2),
|
|
51
|
+
borderRadius: theme.vars.shape.borderRadius,
|
|
52
|
+
}))
|
|
53
|
+
|
|
54
|
+
export const SettingItemTitle: React.FC<
|
|
55
|
+
React.ComponentProps<typeof Typography>
|
|
56
|
+
> = styled(Typography)(({ theme }) => ({
|
|
57
|
+
fontSize: 14,
|
|
58
|
+
fontWeight: 700,
|
|
59
|
+
color: theme.vars.palette.text.primary,
|
|
60
|
+
lineHeight: 1,
|
|
61
|
+
}))
|
|
62
|
+
|
|
63
|
+
export const SettingItemValue: React.FC<
|
|
64
|
+
React.ComponentProps<typeof Typography>
|
|
65
|
+
> = styled(Typography)(({ theme }) => ({
|
|
66
|
+
fontSize: 14,
|
|
67
|
+
fontWeight: 700,
|
|
68
|
+
color: theme.vars.palette.text.primary,
|
|
69
|
+
}))
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import Check from '@mui/icons-material/Check'
|
|
2
|
+
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'
|
|
3
|
+
import type { BoxProps } from '@mui/material'
|
|
4
|
+
import { Menu, MenuItem } from '@mui/material'
|
|
5
|
+
import { type ChangeEvent, type JSX, type MouseEvent, useState } from 'react'
|
|
6
|
+
import { useTranslation } from 'react-i18next'
|
|
7
|
+
import { useFieldActions } from '../../stores/form/useFieldActions.js'
|
|
8
|
+
import { useFieldValues } from '../../stores/form/useFieldValues.js'
|
|
9
|
+
import { formatDuration } from '../../utils/format.js'
|
|
10
|
+
import { Card } from '../Card/Card.js'
|
|
11
|
+
import { Switch } from '../Switch.js'
|
|
12
|
+
import {
|
|
13
|
+
Container,
|
|
14
|
+
ExpiryValue,
|
|
15
|
+
SettingItemButton,
|
|
16
|
+
SettingItemTitle,
|
|
17
|
+
SettingItemValue,
|
|
18
|
+
SettingsRow,
|
|
19
|
+
ToggleLabel,
|
|
20
|
+
} from './LimitOrderSettings.style.js'
|
|
21
|
+
|
|
22
|
+
/** Selectable order-validity durations, in seconds. */
|
|
23
|
+
const DURATIONS = [3600, 86400, 604800, 2592000, 31536000]
|
|
24
|
+
|
|
25
|
+
export const LimitOrderSettings: React.FC<BoxProps> = (props): JSX.Element => {
|
|
26
|
+
const { t, i18n } = useTranslation()
|
|
27
|
+
const [validUntil, partiallyFillable] = useFieldValues(
|
|
28
|
+
'validUntil',
|
|
29
|
+
'partiallyFillable'
|
|
30
|
+
)
|
|
31
|
+
const { setFieldValue } = useFieldActions()
|
|
32
|
+
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null)
|
|
33
|
+
const open = Boolean(anchorEl)
|
|
34
|
+
|
|
35
|
+
const handleOpen = (event: MouseEvent<HTMLElement>): void => {
|
|
36
|
+
setAnchorEl(event.currentTarget)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const handleClose = (): void => {
|
|
40
|
+
setAnchorEl(null)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const handleSelect = (duration: number): void => {
|
|
44
|
+
setFieldValue('validUntil', duration)
|
|
45
|
+
setAnchorEl(null)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const handlePartiallyFillableChange = (
|
|
49
|
+
event: ChangeEvent<HTMLInputElement>
|
|
50
|
+
): void => {
|
|
51
|
+
setFieldValue('partiallyFillable', event.target.checked)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<Container {...props}>
|
|
56
|
+
<Card>
|
|
57
|
+
<SettingItemButton
|
|
58
|
+
onClick={handleOpen}
|
|
59
|
+
disableRipple
|
|
60
|
+
aria-haspopup="menu"
|
|
61
|
+
aria-expanded={open}
|
|
62
|
+
>
|
|
63
|
+
<SettingItemTitle>{t('limitOrder.expiresIn')}</SettingItemTitle>
|
|
64
|
+
<ExpiryValue>
|
|
65
|
+
<SettingItemValue>
|
|
66
|
+
{formatDuration(validUntil, i18n.language, 'long')}
|
|
67
|
+
</SettingItemValue>
|
|
68
|
+
<KeyboardArrowDownIcon
|
|
69
|
+
sx={{ fontSize: 20, height: '18px', marginTop: '2px' }}
|
|
70
|
+
/>
|
|
71
|
+
</ExpiryValue>
|
|
72
|
+
</SettingItemButton>
|
|
73
|
+
</Card>
|
|
74
|
+
<Menu
|
|
75
|
+
anchorEl={anchorEl}
|
|
76
|
+
open={open}
|
|
77
|
+
onClose={handleClose}
|
|
78
|
+
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
|
|
79
|
+
transformOrigin={{ vertical: 'top', horizontal: 'right' }}
|
|
80
|
+
slotProps={{
|
|
81
|
+
paper: {
|
|
82
|
+
sx: (theme) => ({
|
|
83
|
+
border: `1px solid ${theme.vars.palette.grey[300]}`,
|
|
84
|
+
boxShadow: 'none',
|
|
85
|
+
...theme.applyStyles('dark', {
|
|
86
|
+
borderColor: theme.vars.palette.grey[800],
|
|
87
|
+
}),
|
|
88
|
+
}),
|
|
89
|
+
},
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
{DURATIONS.map((duration) => (
|
|
93
|
+
<MenuItem
|
|
94
|
+
key={duration}
|
|
95
|
+
onClick={() => handleSelect(duration)}
|
|
96
|
+
sx={(theme) => ({
|
|
97
|
+
justifyContent: 'space-between',
|
|
98
|
+
gap: 4,
|
|
99
|
+
fontSize: 14,
|
|
100
|
+
fontWeight: 700,
|
|
101
|
+
lineHeight: '18px',
|
|
102
|
+
color: theme.vars.palette.text.primary,
|
|
103
|
+
})}
|
|
104
|
+
>
|
|
105
|
+
{formatDuration(duration, i18n.language, 'long')}
|
|
106
|
+
{duration === validUntil ? (
|
|
107
|
+
<Check color="primary" fontSize="small" />
|
|
108
|
+
) : null}
|
|
109
|
+
</MenuItem>
|
|
110
|
+
))}
|
|
111
|
+
</Menu>
|
|
112
|
+
<Card>
|
|
113
|
+
<SettingsRow>
|
|
114
|
+
<ToggleLabel>{t('limitOrder.partiallyFillable')}</ToggleLabel>
|
|
115
|
+
<Switch
|
|
116
|
+
checked={partiallyFillable}
|
|
117
|
+
onChange={handlePartiallyFillableChange}
|
|
118
|
+
aria-label={t('limitOrder.partiallyFillable')}
|
|
119
|
+
/>
|
|
120
|
+
</SettingsRow>
|
|
121
|
+
</Card>
|
|
122
|
+
</Container>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Box, Button, ButtonBase, styled, Typography } from '@mui/material'
|
|
2
|
+
import type React from 'react'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Quick-set preset pill. Mirrors the percentage chips' pill look but is always
|
|
6
|
+
* visible (no reveal-on-hover), since presets are the card's primary control.
|
|
7
|
+
*/
|
|
8
|
+
export const PriceChip: React.FC<React.ComponentProps<typeof Button>> = styled(
|
|
9
|
+
Button
|
|
10
|
+
)(({ theme }) => ({
|
|
11
|
+
minWidth: 0,
|
|
12
|
+
padding: theme.spacing(0.5, 1.5),
|
|
13
|
+
fontSize: 12,
|
|
14
|
+
fontWeight: 700,
|
|
15
|
+
lineHeight: 1.3334,
|
|
16
|
+
backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 4%, transparent)`,
|
|
17
|
+
color: theme.vars.palette.text.primary,
|
|
18
|
+
transition: 'background-color 200ms ease',
|
|
19
|
+
'&:hover': {
|
|
20
|
+
backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 8%, transparent)`,
|
|
21
|
+
},
|
|
22
|
+
}))
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Editable variant of the preset pill: looks identical to {@link PriceChip} but
|
|
26
|
+
* wraps an inline input so the user can type an arbitrary percentage premium
|
|
27
|
+
* (`+__%`) instead of picking a fixed preset.
|
|
28
|
+
*/
|
|
29
|
+
export const EditablePriceChip: React.FC<React.ComponentProps<typeof Box>> =
|
|
30
|
+
styled(Box)(({ theme }) => ({
|
|
31
|
+
display: 'inline-flex',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
minWidth: 0,
|
|
34
|
+
padding: theme.spacing(0.5, 1.5),
|
|
35
|
+
borderRadius: theme.vars.shape.borderRadius,
|
|
36
|
+
fontSize: 12,
|
|
37
|
+
fontWeight: 700,
|
|
38
|
+
lineHeight: 1.3334,
|
|
39
|
+
color: theme.vars.palette.text.primary,
|
|
40
|
+
backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 4%, transparent)`,
|
|
41
|
+
transition: 'background-color 200ms ease',
|
|
42
|
+
cursor: 'text',
|
|
43
|
+
'&:hover, &:focus-within': {
|
|
44
|
+
backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 8%, transparent)`,
|
|
45
|
+
},
|
|
46
|
+
'&[aria-disabled="true"]': {
|
|
47
|
+
opacity: 0.5,
|
|
48
|
+
pointerEvents: 'none',
|
|
49
|
+
},
|
|
50
|
+
}))
|
|
51
|
+
|
|
52
|
+
/** Bare input inside {@link EditablePriceChip}; inherits the pill's typography. */
|
|
53
|
+
export const PriceChipInput: React.FC<React.ComponentProps<'input'>> = styled(
|
|
54
|
+
'input'
|
|
55
|
+
)(({ theme }) => ({
|
|
56
|
+
appearance: 'none',
|
|
57
|
+
border: 'none',
|
|
58
|
+
outline: 'none',
|
|
59
|
+
background: 'transparent',
|
|
60
|
+
padding: 0,
|
|
61
|
+
margin: 0,
|
|
62
|
+
font: 'inherit',
|
|
63
|
+
color: 'inherit',
|
|
64
|
+
textAlign: 'right',
|
|
65
|
+
minWidth: '1ch',
|
|
66
|
+
'&::placeholder': {
|
|
67
|
+
color: theme.vars.palette.text.secondary,
|
|
68
|
+
opacity: 1,
|
|
69
|
+
},
|
|
70
|
+
}))
|
|
71
|
+
|
|
72
|
+
export const UnitSymbol: React.FC<React.ComponentProps<typeof Typography>> =
|
|
73
|
+
styled(Typography)(({ theme }) => ({
|
|
74
|
+
fontSize: 18,
|
|
75
|
+
fontWeight: 600,
|
|
76
|
+
lineHeight: 1.4,
|
|
77
|
+
whiteSpace: 'nowrap',
|
|
78
|
+
color: theme.vars.palette.text.primary,
|
|
79
|
+
}))
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Invert affordance anchored to the far right of the lead row. Styled as a
|
|
83
|
+
* pill to mirror the percentage chips, but always visible (no reveal-on-hover).
|
|
84
|
+
*/
|
|
85
|
+
export const InvertChip: React.FC<React.ComponentProps<typeof ButtonBase>> =
|
|
86
|
+
styled(ButtonBase)(({ theme }) => ({
|
|
87
|
+
display: 'flex',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
justifyContent: 'center',
|
|
90
|
+
gap: theme.spacing(0.5),
|
|
91
|
+
minWidth: 0,
|
|
92
|
+
padding: theme.spacing(0.5, 1.5),
|
|
93
|
+
borderRadius: '9999px',
|
|
94
|
+
fontSize: 12,
|
|
95
|
+
fontWeight: 700,
|
|
96
|
+
lineHeight: 1.3334,
|
|
97
|
+
color: theme.vars.palette.text.primary,
|
|
98
|
+
backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 4%, transparent)`,
|
|
99
|
+
transition: 'background-color 200ms ease',
|
|
100
|
+
'&:hover': {
|
|
101
|
+
backgroundColor: `color-mix(in srgb, ${theme.vars.palette.common.onBackground} 8%, transparent)`,
|
|
102
|
+
},
|
|
103
|
+
}))
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import SwapHorizIcon from '@mui/icons-material/SwapHoriz'
|
|
2
|
+
import type { CardProps } from '@mui/material'
|
|
3
|
+
import { Skeleton } from '@mui/material'
|
|
4
|
+
import { type ChangeEvent, type JSX, useEffect, useRef, useState } from 'react'
|
|
5
|
+
import { useTranslation } from 'react-i18next'
|
|
6
|
+
import { useLimitMarketRate } from '../../hooks/useLimitMarketRate.js'
|
|
7
|
+
import { useLinkedLimitFields } from '../../hooks/useLinkedLimitFields.js'
|
|
8
|
+
import { useRoutes } from '../../hooks/useRoutes.js'
|
|
9
|
+
import { useToken } from '../../hooks/useToken.js'
|
|
10
|
+
import { FormKeyHelper } from '../../stores/form/types.js'
|
|
11
|
+
import { useFieldActions } from '../../stores/form/useFieldActions.js'
|
|
12
|
+
import { useFieldValues } from '../../stores/form/useFieldValues.js'
|
|
13
|
+
import { formatInputAmount } from '../../utils/format.js'
|
|
14
|
+
import { applyPriceOffset, invertPrice } from '../../utils/limitOrder.js'
|
|
15
|
+
import {
|
|
16
|
+
AmountCard,
|
|
17
|
+
amountHeight,
|
|
18
|
+
CardBodyRow,
|
|
19
|
+
CardHeaderRow,
|
|
20
|
+
LargeInput,
|
|
21
|
+
} from '../AmountInputCard/AmountInputCard.style.js'
|
|
22
|
+
import { CardTitle } from '../Card/CardTitle.js'
|
|
23
|
+
import { InvertChip } from './LimitPriceCard.style.js'
|
|
24
|
+
import { LimitPricePresets } from './LimitPricePresets.js'
|
|
25
|
+
|
|
26
|
+
const cleanDisplay = (value: string): string =>
|
|
27
|
+
value ? formatInputAmount(value, 8) : ''
|
|
28
|
+
|
|
29
|
+
export const LimitPriceCard: React.FC<CardProps> = (props): JSX.Element => {
|
|
30
|
+
const { t } = useTranslation()
|
|
31
|
+
const isEditingRef = useRef(false)
|
|
32
|
+
const [inputValue, setInputValue] = useState('')
|
|
33
|
+
|
|
34
|
+
const [
|
|
35
|
+
fromChainId,
|
|
36
|
+
fromTokenAddress,
|
|
37
|
+
toChainId,
|
|
38
|
+
toTokenAddress,
|
|
39
|
+
priceInverted,
|
|
40
|
+
] = useFieldValues(
|
|
41
|
+
FormKeyHelper.getChainKey('from'),
|
|
42
|
+
FormKeyHelper.getTokenKey('from'),
|
|
43
|
+
FormKeyHelper.getChainKey('to'),
|
|
44
|
+
FormKeyHelper.getTokenKey('to'),
|
|
45
|
+
'priceInverted'
|
|
46
|
+
)
|
|
47
|
+
const { token: fromToken } = useToken(fromChainId, fromTokenAddress)
|
|
48
|
+
const { token: toToken } = useToken(toChainId, toTokenAddress)
|
|
49
|
+
|
|
50
|
+
const { isFetching } = useRoutes()
|
|
51
|
+
|
|
52
|
+
// limitPrice is derived from the from/to amount fields, not stored.
|
|
53
|
+
const { limitPrice, setLimitPrice } = useLinkedLimitFields()
|
|
54
|
+
const { setFieldValue } = useFieldActions()
|
|
55
|
+
|
|
56
|
+
const hasTokens = Boolean(fromToken && toToken)
|
|
57
|
+
const showSkeleton = isFetching && !limitPrice
|
|
58
|
+
const leadToken = priceInverted ? toToken : fromToken
|
|
59
|
+
const unitToken = priceInverted ? fromToken : toToken
|
|
60
|
+
|
|
61
|
+
const marketCanonical = useLimitMarketRate()
|
|
62
|
+
|
|
63
|
+
// Canonical price is orientation-independent; flip only for display.
|
|
64
|
+
const displayPrice = priceInverted ? invertPrice(limitPrice) : limitPrice
|
|
65
|
+
|
|
66
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: pair fields are intentional re-run triggers, not read in the body
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
setFieldValue('toAmount', '', { isDirty: false, isTouched: false })
|
|
69
|
+
setFieldValue('selectedRouteId', undefined)
|
|
70
|
+
}, [fromChainId, fromTokenAddress, toChainId, toTokenAddress])
|
|
71
|
+
|
|
72
|
+
// Keep the input in sync with derived/preset/invert updates, but never yank
|
|
73
|
+
// the value out from under an actively-typing user.
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (!isEditingRef.current) {
|
|
76
|
+
setInputValue(cleanDisplay(displayPrice))
|
|
77
|
+
}
|
|
78
|
+
}, [displayPrice])
|
|
79
|
+
|
|
80
|
+
const handleChange = (
|
|
81
|
+
event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
|
|
82
|
+
): void => {
|
|
83
|
+
isEditingRef.current = true
|
|
84
|
+
const formatted = formatInputAmount(event.target.value, 18, true)
|
|
85
|
+
setInputValue(formatted)
|
|
86
|
+
const numeric = Number(formatted)
|
|
87
|
+
if (!formatted || Number.isNaN(numeric) || numeric <= 0) {
|
|
88
|
+
setLimitPrice('')
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
// Canonical price is orientation-independent; un-flip the displayed value.
|
|
92
|
+
const canonical = priceInverted ? 1 / numeric : numeric
|
|
93
|
+
setLimitPrice(String(canonical))
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const handleBlur = (): void => {
|
|
97
|
+
isEditingRef.current = false
|
|
98
|
+
setInputValue(cleanDisplay(displayPrice))
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const handleInvert = (): void => {
|
|
102
|
+
isEditingRef.current = false
|
|
103
|
+
setFieldValue('priceInverted', !priceInverted)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Apply a percentage offset to the canonical market rate (0 = at market).
|
|
107
|
+
const handlePreset = (pct: number): void => {
|
|
108
|
+
if (marketCanonical === undefined) {
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
isEditingRef.current = false
|
|
112
|
+
setLimitPrice(applyPriceOffset(String(marketCanonical), pct))
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const label = hasTokens
|
|
116
|
+
? t('limitOrder.priceLabel', { symbol: leadToken?.symbol })
|
|
117
|
+
: t('limitOrder.price')
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<AmountCard {...props} mask={false}>
|
|
121
|
+
<CardHeaderRow>
|
|
122
|
+
<CardTitle sx={{ padding: 0 }}>{label}</CardTitle>
|
|
123
|
+
{hasTokens ? (
|
|
124
|
+
<InvertChip onClick={handleInvert} aria-label="invert price">
|
|
125
|
+
{unitToken?.symbol}
|
|
126
|
+
<SwapHorizIcon sx={{ fontSize: 16 }} />
|
|
127
|
+
</InvertChip>
|
|
128
|
+
) : null}
|
|
129
|
+
</CardHeaderRow>
|
|
130
|
+
<CardBodyRow>
|
|
131
|
+
{showSkeleton ? (
|
|
132
|
+
<Skeleton variant="rounded" height={amountHeight} sx={{ flex: 1 }} />
|
|
133
|
+
) : (
|
|
134
|
+
<LargeInput
|
|
135
|
+
size="small"
|
|
136
|
+
autoComplete="off"
|
|
137
|
+
placeholder="0"
|
|
138
|
+
inputProps={{ inputMode: 'decimal' }}
|
|
139
|
+
onChange={handleChange}
|
|
140
|
+
onBlur={handleBlur}
|
|
141
|
+
value={inputValue}
|
|
142
|
+
name="limitPrice"
|
|
143
|
+
disabled={!hasTokens}
|
|
144
|
+
/>
|
|
145
|
+
)}
|
|
146
|
+
</CardBodyRow>
|
|
147
|
+
<LimitPricePresets
|
|
148
|
+
onSelect={handlePreset}
|
|
149
|
+
disabled={!hasTokens || marketCanonical === undefined}
|
|
150
|
+
/>
|
|
151
|
+
</AmountCard>
|
|
152
|
+
)
|
|
153
|
+
}
|