@rango-dev/ui 0.1.10-next.102
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/README.md +181 -0
- package/dist/components/Alert/Alert.d.ts +7 -0
- package/dist/components/Alert/Alert.stories.d.ts +5 -0
- package/dist/components/Alert/LoadingFailedAlert.d.ts +2 -0
- package/dist/components/Alert/NotFoundAlert.d.ts +7 -0
- package/dist/components/Alert/index.d.ts +2 -0
- package/dist/components/BestRoute/BestRoute.d.ts +12 -0
- package/dist/components/BestRoute/BestRoute.stories.d.ts +8 -0
- package/dist/components/BestRoute/index.d.ts +1 -0
- package/dist/components/BestRoute/mock.d.ts +4 -0
- package/dist/components/BlockchainSelector/BlockchainSelector.d.ts +17 -0
- package/dist/components/BlockchainSelector/BlockchainSelector.stories.d.ts +5 -0
- package/dist/components/BlockchainSelector/index.d.ts +1 -0
- package/dist/components/BlockchainsList/BlockchainsList.d.ts +10 -0
- package/dist/components/BlockchainsList/BlockchainsList.stories.d.ts +5 -0
- package/dist/components/BlockchainsList/index.d.ts +1 -0
- package/dist/components/BlockchainsList/mockData.d.ts +2 -0
- package/dist/components/Button/Button.d.ts +17 -0
- package/dist/components/Button/Button.stories.d.ts +8 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +11 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +5 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Chip/Chip.d.ts +12 -0
- package/dist/components/Chip/Chip.stories.d.ts +7 -0
- package/dist/components/Chip/index.d.ts +1 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +9 -0
- package/dist/components/ColorPicker/ColorPicker.stories.d.ts +5 -0
- package/dist/components/ColorPicker/index.d.ts +1 -0
- package/dist/components/ConnectWalletsModal/ConnectWallets.stories.d.ts +5 -0
- package/dist/components/ConnectWalletsModal/ConnectWalletsModal.d.ts +11 -0
- package/dist/components/ConnectWalletsModal/index.d.ts +1 -0
- package/dist/components/ConnectWalletsModal/mockData.d.ts +2 -0
- package/dist/components/Divider/Divider.d.ts +6 -0
- package/dist/components/Divider/index.d.ts +1 -0
- package/dist/components/Drawer/Drawer.d.ts +13 -0
- package/dist/components/Drawer/Drawer.stories.d.ts +8 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Header/Header.d.ts +9 -0
- package/dist/components/Header/index.d.ts +1 -0
- package/dist/components/Icon/AddCircleIcon.d.ts +3 -0
- package/dist/components/Icon/AddIcon.d.ts +3 -0
- package/dist/components/Icon/AddWalletIcon.d.ts +3 -0
- package/dist/components/Icon/AngleDownIcon.d.ts +3 -0
- package/dist/components/Icon/AngleLeftIcon.d.ts +3 -0
- package/dist/components/Icon/AngleRightIcon.d.ts +3 -0
- package/dist/components/Icon/AngleUpIcon.d.ts +3 -0
- package/dist/components/Icon/ArrowRightIcon.d.ts +3 -0
- package/dist/components/Icon/BagIcon.d.ts +3 -0
- package/dist/components/Icon/BanIcon.d.ts +3 -0
- package/dist/components/Icon/CheckCircleIcon.d.ts +3 -0
- package/dist/components/Icon/CheckIcon.d.ts +3 -0
- package/dist/components/Icon/CheckSquareIcon.d.ts +3 -0
- package/dist/components/Icon/CheckWalletIcon.d.ts +3 -0
- package/dist/components/Icon/ChevronRightIcon.d.ts +3 -0
- package/dist/components/Icon/CloseIcon.d.ts +1 -0
- package/dist/components/Icon/CopyIcon.d.ts +3 -0
- package/dist/components/Icon/DeleteCircleIcon.d.ts +3 -0
- package/dist/components/Icon/DeleteWalletIcon.d.ts +3 -0
- package/dist/components/Icon/DisconnectIcon.d.ts +3 -0
- package/dist/components/Icon/DownloadIcon.d.ts +3 -0
- package/dist/components/Icon/GasIcon.d.ts +3 -0
- package/dist/components/Icon/HistoryIcon.d.ts +3 -0
- package/dist/components/Icon/HorizontalSwapIcon.d.ts +3 -0
- package/dist/components/Icon/Icons.stories.d.ts +5 -0
- package/dist/components/Icon/InfoCircleIcon.d.ts +3 -0
- package/dist/components/Icon/MinusCircleIcon.d.ts +3 -0
- package/dist/components/Icon/RetryIcon.d.ts +3 -0
- package/dist/components/Icon/RetryLeftIcon.d.ts +3 -0
- package/dist/components/Icon/RetryRightIcon.d.ts +3 -0
- package/dist/components/Icon/SearchIcon.d.ts +3 -0
- package/dist/components/Icon/SearchMinusIcon.d.ts +3 -0
- package/dist/components/Icon/SettingIcon.d.ts +3 -0
- package/dist/components/Icon/SignatureIcon.d.ts +3 -0
- package/dist/components/Icon/SwapWalletIcon.d.ts +3 -0
- package/dist/components/Icon/TimeIcon.d.ts +3 -0
- package/dist/components/Icon/TrashIcon.d.ts +3 -0
- package/dist/components/Icon/TryAgainIcon.d.ts +3 -0
- package/dist/components/Icon/VerticalSwapIcon.d.ts +3 -0
- package/dist/components/Icon/WalletIconIcon.d.ts +3 -0
- package/dist/components/Icon/WarningIcon.d.ts +3 -0
- package/dist/components/Icon/common.d.ts +2 -0
- package/dist/components/Icon/index.d.ts +40 -0
- package/dist/components/Icon/types.d.ts +6 -0
- package/dist/components/LiquiditySourceList/LiquiditySource.stories.d.ts +5 -0
- package/dist/components/LiquiditySourceList/LiquiditySourceList.d.ts +11 -0
- package/dist/components/LiquiditySourceList/index.d.ts +1 -0
- package/dist/components/LiquiditySourceList/mockData.d.ts +2 -0
- package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.d.ts +13 -0
- package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.stories.d.ts +5 -0
- package/dist/components/LiquiditySourcesSelector/index.d.ts +1 -0
- package/dist/components/Modal/Modal.d.ts +12 -0
- package/dist/components/Modal/Modal.stories.d.ts +5 -0
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +13 -0
- package/dist/components/Radio/Radio.stories.d.ts +5 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/SecondaryPage/SecondaryPage.d.ts +16 -0
- package/dist/components/SecondaryPage/SecondaryPage.stories.d.ts +2 -0
- package/dist/components/SecondaryPage/index.d.ts +1 -0
- package/dist/components/SelectableWalletList/SelectableWalletList.d.ts +7 -0
- package/dist/components/SelectableWalletList/SelectableWalletList.stories.d.ts +5 -0
- package/dist/components/SelectableWalletList/index.d.ts +1 -0
- package/dist/components/SelectableWalletList/mock.d.ts +2 -0
- package/dist/components/Settings/Settings.d.ts +23 -0
- package/dist/components/Settings/Settings.stories.d.ts +5 -0
- package/dist/components/Settings/index.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +6 -0
- package/dist/components/Skeleton/Skeleton.stories.d.ts +5 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Spacer/Spacer.d.ts +6 -0
- package/dist/components/Spacer/Spacer.stories.d.ts +5 -0
- package/dist/components/Spacer/index.d.ts +1 -0
- package/dist/components/Spinner/Spinner.d.ts +6 -0
- package/dist/components/Spinner/Spinner.stories.d.ts +5 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/StatusDrawer/StatusDrawer.d.ts +11 -0
- package/dist/components/StatusDrawer/StatusDrawer.stories.d.ts +5 -0
- package/dist/components/StatusDrawer/index.d.ts +1 -0
- package/dist/components/StepDetail/StepDetail.d.ts +10 -0
- package/dist/components/StepDetail/StepDetail.stories.d.ts +5 -0
- package/dist/components/StepDetail/index.d.ts +1 -0
- package/dist/components/SwapContainer/SwapContainer.d.ts +7 -0
- package/dist/components/SwapContainer/SwapContainer.stories.d.ts +5 -0
- package/dist/components/SwapContainer/index.d.ts +1 -0
- package/dist/components/SwapDetail/SwapDetail.d.ts +8 -0
- package/dist/components/SwapDetail/SwapDetail.stories.d.ts +5 -0
- package/dist/components/SwapDetail/Token.d.ts +16 -0
- package/dist/components/SwapDetail/index.d.ts +1 -0
- package/dist/components/SwapDetail/mock.d.ts +2 -0
- package/dist/components/Switch/Switch.d.ts +6 -0
- package/dist/components/Switch/Switch.stories.d.ts +5 -0
- package/dist/components/Switch/index.d.ts +1 -0
- package/dist/components/TextField/TextField.d.ts +10 -0
- package/dist/components/TextField/TextField.stories.d.ts +7 -0
- package/dist/components/TextField/index.d.ts +1 -0
- package/dist/components/TokenList/TokenItem.d.ts +11 -0
- package/dist/components/TokenList/TokenList.d.ts +17 -0
- package/dist/components/TokenList/TokenList.stories.d.ts +5 -0
- package/dist/components/TokenList/index.d.ts +1 -0
- package/dist/components/TokenList/mockData.d.ts +2 -0
- package/dist/components/TokenSelector/TokenSelector.d.ts +16 -0
- package/dist/components/TokenSelector/TokenSelector.stories.d.ts +5 -0
- package/dist/components/TokenSelector/index.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +7 -0
- package/dist/components/Tooltip/Tooltip.stories.d.ts +5 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Typography/Typography.d.ts +18 -0
- package/dist/components/Typography/Typography.stories.d.ts +5 -0
- package/dist/components/Typography/index.d.ts +1 -0
- package/dist/components/VirtualizedList/VirtualizedList.d.ts +17 -0
- package/dist/components/Wallet/State.d.ts +7 -0
- package/dist/components/Wallet/Wallet.d.ts +7 -0
- package/dist/components/Wallet/Wallet.stories.d.ts +5 -0
- package/dist/components/Wallet/index.d.ts +1 -0
- package/dist/components/common/FilledCircle.d.ts +1 -0
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/index.d.ts +31 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +20 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.stories.d.ts +6 -0
- package/dist/containers/ConfirmSwap/index.d.ts +1 -0
- package/dist/containers/ConfirmSwap/mock.d.ts +5 -0
- package/dist/containers/History/History.d.ts +13 -0
- package/dist/containers/History/History.stories.d.ts +5 -0
- package/dist/containers/History/index.d.ts +1 -0
- package/dist/containers/History/mock.d.ts +2 -0
- package/dist/containers/History/types.d.ts +39 -0
- package/dist/containers/SwapHistory/SwapHistory.d.ts +24 -0
- package/dist/containers/SwapHistory/SwapHistory.stories.d.ts +5 -0
- package/dist/containers/SwapHistory/SwapMessages.d.ts +17 -0
- package/dist/containers/SwapHistory/index.d.ts +1 -0
- package/dist/containers/SwapHistory/mock.d.ts +2 -0
- package/dist/containers/index.d.ts +3 -0
- package/dist/helper/index.d.ts +2 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -0
- package/dist/theme.d.ts +8 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/meta.d.ts +23 -0
- package/dist/types/swaps.d.ts +29 -0
- package/dist/types/wallet.d.ts +23 -0
- package/dist/ui.cjs.development.js +4956 -0
- package/dist/ui.cjs.development.js.map +1 -0
- package/dist/ui.cjs.production.min.js +2 -0
- package/dist/ui.cjs.production.min.js.map +1 -0
- package/dist/ui.esm.js +4870 -0
- package/dist/ui.esm.js.map +1 -0
- package/package.json +88 -0
- package/src/components/Alert/Alert.stories.tsx +22 -0
- package/src/components/Alert/Alert.tsx +102 -0
- package/src/components/Alert/LoadingFailedAlert.tsx +11 -0
- package/src/components/Alert/NotFoundAlert.tsx +19 -0
- package/src/components/Alert/index.ts +2 -0
- package/src/components/BestRoute/BestRoute.stories.tsx +31 -0
- package/src/components/BestRoute/BestRoute.tsx +232 -0
- package/src/components/BestRoute/index.ts +1 -0
- package/src/components/BestRoute/mock.ts +554 -0
- package/src/components/BlockchainSelector/BlockchainSelector.stories.tsx +25 -0
- package/src/components/BlockchainSelector/BlockchainSelector.tsx +93 -0
- package/src/components/BlockchainSelector/index.ts +1 -0
- package/src/components/BlockchainsList/BlockchainsList.stories.tsx +25 -0
- package/src/components/BlockchainsList/BlockchainsList.tsx +70 -0
- package/src/components/BlockchainsList/index.ts +1 -0
- package/src/components/BlockchainsList/mockData.ts +2972 -0
- package/src/components/Button/Button.stories.tsx +59 -0
- package/src/components/Button/Button.tsx +421 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +22 -0
- package/src/components/Checkbox/Checkbox.tsx +56 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Chip/Chip.stories.tsx +37 -0
- package/src/components/Chip/Chip.tsx +48 -0
- package/src/components/Chip/index.ts +1 -0
- package/src/components/ColorPicker/ColorPicker.stories.tsx +36 -0
- package/src/components/ColorPicker/ColorPicker.tsx +85 -0
- package/src/components/ColorPicker/index.ts +1 -0
- package/src/components/ConnectWalletsModal/ConnectWallets.stories.tsx +13 -0
- package/src/components/ConnectWalletsModal/ConnectWalletsModal.tsx +42 -0
- package/src/components/ConnectWalletsModal/index.ts +1 -0
- package/src/components/ConnectWalletsModal/mockData.ts +134 -0
- package/src/components/Divider/Divider.tsx +41 -0
- package/src/components/Divider/index.ts +1 -0
- package/src/components/Drawer/Drawer.stories.tsx +86 -0
- package/src/components/Drawer/Drawer.tsx +124 -0
- package/src/components/Drawer/index.ts +1 -0
- package/src/components/Header/Header.tsx +39 -0
- package/src/components/Header/index.ts +1 -0
- package/src/components/Icon/AddCircleIcon.tsx +31 -0
- package/src/components/Icon/AddIcon.tsx +31 -0
- package/src/components/Icon/AddWalletIcon.tsx +50 -0
- package/src/components/Icon/AngleDownIcon.tsx +30 -0
- package/src/components/Icon/AngleLeftIcon.tsx +33 -0
- package/src/components/Icon/AngleRightIcon.tsx +32 -0
- package/src/components/Icon/AngleUpIcon.tsx +32 -0
- package/src/components/Icon/ArrowRightIcon.tsx +31 -0
- package/src/components/Icon/BagIcon.tsx +39 -0
- package/src/components/Icon/BanIcon.tsx +32 -0
- package/src/components/Icon/CheckCircleIcon.tsx +39 -0
- package/src/components/Icon/CheckIcon.tsx +30 -0
- package/src/components/Icon/CheckSquareIcon.tsx +37 -0
- package/src/components/Icon/CheckWalletIcon.tsx +45 -0
- package/src/components/Icon/ChevronRightIcon.tsx +29 -0
- package/src/components/Icon/CloseIcon.tsx +9 -0
- package/src/components/Icon/CopyIcon.tsx +59 -0
- package/src/components/Icon/DeleteCircleIcon.tsx +31 -0
- package/src/components/Icon/DeleteWalletIcon.tsx +50 -0
- package/src/components/Icon/DisconnectIcon.tsx +31 -0
- package/src/components/Icon/DownloadIcon.tsx +37 -0
- package/src/components/Icon/GasIcon.tsx +37 -0
- package/src/components/Icon/HistoryIcon.tsx +34 -0
- package/src/components/Icon/HorizontalSwapIcon.tsx +38 -0
- package/src/components/Icon/Icons.stories.tsx +44 -0
- package/src/components/Icon/InfoCircleIcon.tsx +39 -0
- package/src/components/Icon/MinusCircleIcon.tsx +31 -0
- package/src/components/Icon/RetryIcon.tsx +30 -0
- package/src/components/Icon/RetryLeftIcon.tsx +31 -0
- package/src/components/Icon/RetryRightIcon.tsx +31 -0
- package/src/components/Icon/SearchIcon.tsx +31 -0
- package/src/components/Icon/SearchMinusIcon.tsx +31 -0
- package/src/components/Icon/SettingIcon.tsx +31 -0
- package/src/components/Icon/SignatureIcon.tsx +32 -0
- package/src/components/Icon/SwapWalletIcon.tsx +50 -0
- package/src/components/Icon/TimeIcon.tsx +29 -0
- package/src/components/Icon/TrashIcon.tsx +31 -0
- package/src/components/Icon/TryAgainIcon.tsx +31 -0
- package/src/components/Icon/VerticalSwapIcon.tsx +38 -0
- package/src/components/Icon/WalletIconIcon.tsx +40 -0
- package/src/components/Icon/WarningIcon.tsx +37 -0
- package/src/components/Icon/common.ts +69 -0
- package/src/components/Icon/index.ts +48 -0
- package/src/components/Icon/types.tsx +45 -0
- package/src/components/LiquiditySourceList/LiquiditySource.stories.tsx +13 -0
- package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +195 -0
- package/src/components/LiquiditySourceList/index.ts +1 -0
- package/src/components/LiquiditySourceList/mockData.ts +316 -0
- package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.stories.tsx +16 -0
- package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +61 -0
- package/src/components/LiquiditySourcesSelector/index.ts +1 -0
- package/src/components/Modal/Modal.stories.tsx +22 -0
- package/src/components/Modal/Modal.tsx +93 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/Radio/Radio.stories.tsx +23 -0
- package/src/components/Radio/Radio.tsx +100 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/SecondaryPage/SecondaryPage.stories.tsx +7 -0
- package/src/components/SecondaryPage/SecondaryPage.tsx +68 -0
- package/src/components/SecondaryPage/index.ts +1 -0
- package/src/components/SelectableWalletList/SelectableWalletList.stories.tsx +14 -0
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +118 -0
- package/src/components/SelectableWalletList/index.ts +1 -0
- package/src/components/SelectableWalletList/mock.ts +13 -0
- package/src/components/Settings/Settings.stories.tsx +34 -0
- package/src/components/Settings/Settings.tsx +208 -0
- package/src/components/Settings/index.ts +1 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +24 -0
- package/src/components/Skeleton/Skeleton.tsx +66 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Spacer/Spacer.stories.tsx +31 -0
- package/src/components/Spacer/Spacer.tsx +128 -0
- package/src/components/Spacer/index.ts +1 -0
- package/src/components/Spinner/Spinner.stories.tsx +25 -0
- package/src/components/Spinner/Spinner.tsx +61 -0
- package/src/components/Spinner/index.ts +1 -0
- package/src/components/StatusDrawer/StatusDrawer.stories.tsx +38 -0
- package/src/components/StatusDrawer/StatusDrawer.tsx +82 -0
- package/src/components/StatusDrawer/index.ts +1 -0
- package/src/components/StepDetail/StepDetail.stories.tsx +37 -0
- package/src/components/StepDetail/StepDetail.tsx +109 -0
- package/src/components/StepDetail/index.ts +1 -0
- package/src/components/SwapContainer/SwapContainer.stories.tsx +13 -0
- package/src/components/SwapContainer/SwapContainer.tsx +43 -0
- package/src/components/SwapContainer/index.ts +1 -0
- package/src/components/SwapDetail/SwapDetail.stories.tsx +19 -0
- package/src/components/SwapDetail/SwapDetail.tsx +112 -0
- package/src/components/SwapDetail/Token.tsx +68 -0
- package/src/components/SwapDetail/index.ts +1 -0
- package/src/components/SwapDetail/mock.ts +276 -0
- package/src/components/Switch/Switch.stories.tsx +9 -0
- package/src/components/Switch/Switch.tsx +55 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/TextField/TextField.stories.tsx +31 -0
- package/src/components/TextField/TextField.tsx +141 -0
- package/src/components/TextField/index.ts +1 -0
- package/src/components/TokenList/TokenItem.tsx +73 -0
- package/src/components/TokenList/TokenList.stories.tsx +18 -0
- package/src/components/TokenList/TokenList.tsx +95 -0
- package/src/components/TokenList/index.ts +1 -0
- package/src/components/TokenList/mockData.ts +1721 -0
- package/src/components/TokenSelector/TokenSelector.stories.tsx +18 -0
- package/src/components/TokenSelector/TokenSelector.tsx +95 -0
- package/src/components/TokenSelector/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +52 -0
- package/src/components/Tooltip/Tooltip.tsx +116 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Typography/Typography.stories.tsx +72 -0
- package/src/components/Typography/Typography.tsx +216 -0
- package/src/components/Typography/index.ts +1 -0
- package/src/components/VirtualizedList/VirtualizedList.tsx +62 -0
- package/src/components/Wallet/State.tsx +34 -0
- package/src/components/Wallet/Wallet.stories.tsx +36 -0
- package/src/components/Wallet/Wallet.tsx +69 -0
- package/src/components/Wallet/index.ts +1 -0
- package/src/components/common/FilledCircle.tsx +8 -0
- package/src/components/common/index.ts +1 -0
- package/src/components/index.ts +31 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +22 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.tsx +180 -0
- package/src/containers/ConfirmSwap/index.ts +1 -0
- package/src/containers/ConfirmSwap/mock.ts +223 -0
- package/src/containers/History/History.stories.tsx +14 -0
- package/src/containers/History/History.tsx +115 -0
- package/src/containers/History/index.ts +1 -0
- package/src/containers/History/mock.ts +826 -0
- package/src/containers/History/types.tsx +47 -0
- package/src/containers/SwapHistory/SwapHistory.stories.tsx +13 -0
- package/src/containers/SwapHistory/SwapHistory.tsx +442 -0
- package/src/containers/SwapHistory/SwapMessages.tsx +116 -0
- package/src/containers/SwapHistory/index.ts +1 -0
- package/src/containers/SwapHistory/mock.ts +276 -0
- package/src/containers/index.ts +3 -0
- package/src/helper/index.ts +16 -0
- package/src/index.ts +4 -0
- package/src/theme.ts +163 -0
- package/src/types/index.ts +3 -0
- package/src/types/meta.ts +22 -0
- package/src/types/swaps.ts +44 -0
- package/src/types/wallet.ts +30 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styled } from '../../theme';
|
|
3
|
+
import { Spacer } from '../Spacer';
|
|
4
|
+
|
|
5
|
+
const TokenContainer = styled('div', {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
|
|
9
|
+
'& .amount': {
|
|
10
|
+
fontWeight: 'bold',
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const TokenImage = styled('div', {
|
|
15
|
+
position: 'relative',
|
|
16
|
+
width: '$24',
|
|
17
|
+
height: '$24',
|
|
18
|
+
|
|
19
|
+
img: {
|
|
20
|
+
width: '100%',
|
|
21
|
+
display: 'block',
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
'.overlay': {
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
right: -4,
|
|
27
|
+
bottom: -4,
|
|
28
|
+
width: '$16',
|
|
29
|
+
height: '$16',
|
|
30
|
+
padding: '$2',
|
|
31
|
+
borderRadius: '50%',
|
|
32
|
+
backgroundColor: '$background',
|
|
33
|
+
border: '1px solid $neutrals400',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
interface PropTypes {
|
|
38
|
+
data: {
|
|
39
|
+
token: {
|
|
40
|
+
logo: string;
|
|
41
|
+
symbol: string;
|
|
42
|
+
};
|
|
43
|
+
blockchain: {
|
|
44
|
+
logo: string;
|
|
45
|
+
name: string;
|
|
46
|
+
};
|
|
47
|
+
amount: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function Token(props: PropTypes) {
|
|
51
|
+
return (
|
|
52
|
+
<TokenContainer>
|
|
53
|
+
<TokenImage>
|
|
54
|
+
<img src={props.data.token.logo} alt="" />
|
|
55
|
+
<div className="overlay">
|
|
56
|
+
<img
|
|
57
|
+
src={props.data.blockchain.logo}
|
|
58
|
+
alt={props.data.blockchain.name}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
</TokenImage>
|
|
62
|
+
<Spacer size={8} />
|
|
63
|
+
<span className="amount">{props.data.amount}</span>
|
|
64
|
+
<Spacer size={4} />
|
|
65
|
+
{props.data.token.symbol}
|
|
66
|
+
</TokenContainer>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SwapDetail } from './SwapDetail';
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { RoutingResultType, TransactionType } from 'rango-sdk';
|
|
3
|
+
import { PendingSwap } from '../../containers/History/types';
|
|
4
|
+
|
|
5
|
+
export const swap: PendingSwap = {
|
|
6
|
+
creationTime: '1673164511955',
|
|
7
|
+
finishTime: '1673164550137',
|
|
8
|
+
requestId: '51e211d9-d61c-45d2-a4d4-1f9f7f90ee85',
|
|
9
|
+
inputAmount: '1',
|
|
10
|
+
wallets: {
|
|
11
|
+
OSMOSIS: {
|
|
12
|
+
walletType: 'keplr',
|
|
13
|
+
address: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
status: 'running',
|
|
17
|
+
isPaused: false,
|
|
18
|
+
extraMessage: null,
|
|
19
|
+
extraMessageSeverity: 'info',
|
|
20
|
+
extraMessageDetail: '',
|
|
21
|
+
extraMessageErrorCode: null,
|
|
22
|
+
networkStatusExtraMessage: null,
|
|
23
|
+
networkStatusExtraMessageDetail: null,
|
|
24
|
+
lastNotificationTime: null,
|
|
25
|
+
settings: {
|
|
26
|
+
slippage: '1.0',
|
|
27
|
+
disabledSwappersIds: [],
|
|
28
|
+
disabledSwappersGroups: [],
|
|
29
|
+
},
|
|
30
|
+
simulationResult: {
|
|
31
|
+
resultType: RoutingResultType.OK,
|
|
32
|
+
outputAmount: '1.540670',
|
|
33
|
+
swaps: [
|
|
34
|
+
{
|
|
35
|
+
swapperId: 'Osmosis',
|
|
36
|
+
swapperType: 'DEX',
|
|
37
|
+
swapperLogo: '',
|
|
38
|
+
from: {
|
|
39
|
+
symbol: 'JUNO',
|
|
40
|
+
logo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
|
|
41
|
+
address:
|
|
42
|
+
'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
|
|
43
|
+
blockchain: 'OSMOSIS',
|
|
44
|
+
blockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
45
|
+
decimals: 6,
|
|
46
|
+
usdPrice: 1.1091996179668873,
|
|
47
|
+
},
|
|
48
|
+
to: {
|
|
49
|
+
symbol: 'OSMO',
|
|
50
|
+
logo: 'https://api.rango.exchange/i/mJQPS2',
|
|
51
|
+
address: null,
|
|
52
|
+
blockchain: 'OSMOSIS',
|
|
53
|
+
decimals: 6,
|
|
54
|
+
blockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
55
|
+
usdPrice: 0.7192435454440882,
|
|
56
|
+
},
|
|
57
|
+
fromAmount: '1.000000',
|
|
58
|
+
fromAmountPrecision: null,
|
|
59
|
+
fromAmountMinValue: null,
|
|
60
|
+
fromAmountMaxValue: null,
|
|
61
|
+
fromAmountRestrictionType: 'EXCLUSIVE',
|
|
62
|
+
toAmount: '1.540670',
|
|
63
|
+
fee: [
|
|
64
|
+
{
|
|
65
|
+
asset: {
|
|
66
|
+
blockchain: 'OSMOSIS',
|
|
67
|
+
symbol: 'OSMO',
|
|
68
|
+
address: null,
|
|
69
|
+
},
|
|
70
|
+
expenseType: 'FROM_SOURCE_WALLET',
|
|
71
|
+
name: 'Network Fee',
|
|
72
|
+
amount: '0',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
estimatedTimeInSeconds: 45,
|
|
76
|
+
swapChainType: 'INTRA_CHAIN',
|
|
77
|
+
routes: [
|
|
78
|
+
{
|
|
79
|
+
nodes: [
|
|
80
|
+
{
|
|
81
|
+
nodes: [
|
|
82
|
+
{
|
|
83
|
+
marketName: 'pool#498',
|
|
84
|
+
marketId: null,
|
|
85
|
+
percent: 1,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
from: 'JUNO',
|
|
89
|
+
fromLogo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
|
|
90
|
+
fromAddress:
|
|
91
|
+
'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
|
|
92
|
+
fromBlockchain: 'OSMOSIS',
|
|
93
|
+
to: 'ATOM',
|
|
94
|
+
toLogo: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
|
|
95
|
+
toAddress:
|
|
96
|
+
'ibc/27394fb092d2eccd56123c74f36e4c1f926001ceada9ca97ea622b25f41e5eb2',
|
|
97
|
+
toBlockchain: 'OSMOSIS',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
nodes: [
|
|
101
|
+
{
|
|
102
|
+
marketName: 'pool#8',
|
|
103
|
+
marketId: null,
|
|
104
|
+
percent: 1,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
from: 'ATOM',
|
|
108
|
+
fromLogo: 'https://api.rango.exchange/tokens/COSMOS/ATOM.png',
|
|
109
|
+
fromAddress:
|
|
110
|
+
'ibc/27394fb092d2eccd56123c74f36e4c1f926001ceada9ca97ea622b25f41e5eb2',
|
|
111
|
+
fromBlockchain: 'OSMOSIS',
|
|
112
|
+
to: 'IRIS',
|
|
113
|
+
toLogo: 'https://api.rango.exchange/tokens/COSMOS/IRIS.png',
|
|
114
|
+
toAddress:
|
|
115
|
+
'ibc/7c4d60aa95e5a7558b0a364860979ca34b7ff8aaf255b87af9e879374470cec0',
|
|
116
|
+
toBlockchain: 'OSMOSIS',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
nodes: [
|
|
120
|
+
{
|
|
121
|
+
marketName: 'pool#7',
|
|
122
|
+
marketId: null,
|
|
123
|
+
percent: 1,
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
from: 'IRIS',
|
|
127
|
+
fromLogo: 'https://api.rango.exchange/tokens/COSMOS/IRIS.png',
|
|
128
|
+
fromAddress:
|
|
129
|
+
'ibc/7c4d60aa95e5a7558b0a364860979ca34b7ff8aaf255b87af9e879374470cec0',
|
|
130
|
+
fromBlockchain: 'OSMOSIS',
|
|
131
|
+
to: 'OSMO',
|
|
132
|
+
toLogo: 'https://api.rango.exchange/tokens/COSMOS/OSMO.png',
|
|
133
|
+
toAddress: null,
|
|
134
|
+
toBlockchain: 'OSMOSIS',
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
recommendedSlippage: null,
|
|
140
|
+
timeStat: {
|
|
141
|
+
min: 6,
|
|
142
|
+
avg: 40,
|
|
143
|
+
max: 241,
|
|
144
|
+
},
|
|
145
|
+
includesDestinationTx: false,
|
|
146
|
+
maxRequiredSign: 1,
|
|
147
|
+
warnings: [],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
validateBalanceOrFee: true,
|
|
152
|
+
steps: [
|
|
153
|
+
{
|
|
154
|
+
id: 1,
|
|
155
|
+
fromBlockchain: 'OSMOSIS',
|
|
156
|
+
fromSymbol: 'JUNO',
|
|
157
|
+
swapperType: 'test',
|
|
158
|
+
fromSymbolAddress:
|
|
159
|
+
'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
|
|
160
|
+
fromDecimals: 6,
|
|
161
|
+
fromAmountPrecision: null,
|
|
162
|
+
fromAmountMinValue: null,
|
|
163
|
+
fromAmountMaxValue: null,
|
|
164
|
+
toBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
165
|
+
fromBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
166
|
+
toBlockchain: 'OSMOSIS',
|
|
167
|
+
fromLogo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
|
|
168
|
+
toSymbol: 'OSMO',
|
|
169
|
+
toSymbolAddress: null,
|
|
170
|
+
toDecimals: 6,
|
|
171
|
+
toLogo: 'https://api.rango.exchange/i/mJQPS2',
|
|
172
|
+
startTransactionTime: 1673164519916,
|
|
173
|
+
swapperId: 'Osmosis',
|
|
174
|
+
swapperLogo: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
175
|
+
expectedOutputAmountHumanReadable: '1.540670',
|
|
176
|
+
outputAmount: '1.540658',
|
|
177
|
+
status: 'running',
|
|
178
|
+
networkStatus: null,
|
|
179
|
+
executedTransactionId:
|
|
180
|
+
'0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
|
|
181
|
+
explorerUrl: [
|
|
182
|
+
{
|
|
183
|
+
url: 'https://www.mintscan.io/osmosis/txs/0f8f17eecc863c2d6be65ef52cfe3128ff3cd7baeddf133160bea8ccdfbf876b',
|
|
184
|
+
description: null,
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
cosmosTransaction: {
|
|
188
|
+
type: TransactionType.COSMOS,
|
|
189
|
+
fromWalletAddress: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
|
|
190
|
+
blockChain: 'OSMOSIS',
|
|
191
|
+
data: {
|
|
192
|
+
chainId: 'osmosis-1',
|
|
193
|
+
account_number: 102721,
|
|
194
|
+
sequence: '308',
|
|
195
|
+
msgs: [
|
|
196
|
+
{
|
|
197
|
+
__type: 'OsmosisSwapMessage',
|
|
198
|
+
type: 'osmosis/gamm/swap-exact-amount-in',
|
|
199
|
+
value: {
|
|
200
|
+
sender: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
|
|
201
|
+
routes: [
|
|
202
|
+
{
|
|
203
|
+
pool_id: '498',
|
|
204
|
+
token_out_denom:
|
|
205
|
+
'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2',
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
pool_id: '8',
|
|
209
|
+
token_out_denom:
|
|
210
|
+
'ibc/7C4D60AA95E5A7558B0A364860979CA34B7FF8AAF255B87AF9E879374470CEC0',
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
pool_id: '7',
|
|
214
|
+
token_out_denom: 'uosmo',
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
token_in: {
|
|
218
|
+
denom:
|
|
219
|
+
'ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED',
|
|
220
|
+
amount: '1000000',
|
|
221
|
+
},
|
|
222
|
+
token_out_min_amount: '1525264',
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
protoMsgs: [
|
|
227
|
+
{
|
|
228
|
+
type_url: '/osmosis.gamm.v1beta1.MsgSwapExactAmountIn',
|
|
229
|
+
value: [
|
|
230
|
+
10, 43, 111, 115, 109, 111, 49, 117, 110, 102, 50, 114, 99, 121,
|
|
231
|
+
116, 106, 120, 102, 112, 122, 56, 120, 56, 97, 114, 54, 51, 104,
|
|
232
|
+
52, 113, 101, 102, 116, 97, 100, 112, 116, 103, 53, 116, 48,
|
|
233
|
+
110, 113, 99, 108, 18, 73, 8, -14, 3, 18, 68, 105, 98, 99, 47,
|
|
234
|
+
50, 55, 51, 57, 52, 70, 66, 48, 57, 50, 68, 50, 69, 67, 67, 68,
|
|
235
|
+
53, 54, 49, 50, 51, 67, 55, 52, 70, 51, 54, 69, 52, 67, 49, 70,
|
|
236
|
+
57, 50, 54, 48, 48, 49, 67, 69, 65, 68, 65, 57, 67, 65, 57, 55,
|
|
237
|
+
69, 65, 54, 50, 50, 66, 50, 53, 70, 52, 49, 69, 53, 69, 66, 50,
|
|
238
|
+
18, 72, 8, 8, 18, 68, 105, 98, 99, 47, 55, 67, 52, 68, 54, 48,
|
|
239
|
+
65, 65, 57, 53, 69, 53, 65, 55, 53, 53, 56, 66, 48, 65, 51, 54,
|
|
240
|
+
52, 56, 54, 48, 57, 55, 57, 67, 65, 51, 52, 66, 55, 70, 70, 56,
|
|
241
|
+
65, 65, 70, 50, 53, 53, 66, 56, 55, 65, 70, 57, 69, 56, 55, 57,
|
|
242
|
+
51, 55, 52, 52, 55, 48, 67, 69, 67, 48, 18, 9, 8, 7, 18, 5, 117,
|
|
243
|
+
111, 115, 109, 111, 26, 79, 10, 68, 105, 98, 99, 47, 52, 54, 66,
|
|
244
|
+
52, 52, 56, 57, 57, 51, 50, 50, 70, 51, 67, 68, 56, 53, 52, 68,
|
|
245
|
+
50, 68, 52, 54, 68, 69, 69, 70, 56, 56, 49, 57, 53, 56, 52, 54,
|
|
246
|
+
55, 67, 68, 68, 52, 66, 51, 66, 49, 48, 48, 56, 54, 68, 65, 52,
|
|
247
|
+
57, 50, 57, 54, 66, 66, 69, 68, 57, 52, 66, 69, 68, 18, 7, 49,
|
|
248
|
+
48, 48, 48, 48, 48, 48, 34, 7, 49, 53, 50, 53, 50, 54, 52,
|
|
249
|
+
],
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
memo: '',
|
|
253
|
+
source: null,
|
|
254
|
+
fee: {
|
|
255
|
+
gas: '900000',
|
|
256
|
+
amount: [
|
|
257
|
+
{
|
|
258
|
+
denom: 'uosmo',
|
|
259
|
+
amount: '0',
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
},
|
|
263
|
+
signType: 'AMINO',
|
|
264
|
+
rpcUrl: 'sample_rpc',
|
|
265
|
+
},
|
|
266
|
+
rawTransfer: null,
|
|
267
|
+
},
|
|
268
|
+
solanaTransaction: null,
|
|
269
|
+
evmTransaction: null,
|
|
270
|
+
evmApprovalTransaction: null,
|
|
271
|
+
transferTransaction: null,
|
|
272
|
+
diagnosisUrl: null,
|
|
273
|
+
internalSteps: null,
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentMeta } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Switch, PropTypes } from './Switch';
|
|
4
|
+
|
|
5
|
+
export default { title: 'Switch', component: Switch } as ComponentMeta<
|
|
6
|
+
typeof Switch
|
|
7
|
+
>;
|
|
8
|
+
|
|
9
|
+
export const Main = (args: PropTypes) => <Switch {...args} />;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as RadixSwitch from '@radix-ui/react-switch';
|
|
3
|
+
|
|
4
|
+
import { styled } from '../../theme';
|
|
5
|
+
|
|
6
|
+
const StyledSwitchRoot = styled(RadixSwitch.Root, {
|
|
7
|
+
boxSizing: 'border-box',
|
|
8
|
+
boxShadow: 'none',
|
|
9
|
+
borderStyle: 'solid',
|
|
10
|
+
width: '42px',
|
|
11
|
+
height: '22px',
|
|
12
|
+
backgroundColor: '$neutrals600',
|
|
13
|
+
borderColor: '$neutrals600',
|
|
14
|
+
borderRadius: '99999px',
|
|
15
|
+
position: 'relative',
|
|
16
|
+
padding: '0',
|
|
17
|
+
cursor: 'pointer',
|
|
18
|
+
|
|
19
|
+
'&[data-state="checked"]': {
|
|
20
|
+
backgroundColor: '$success',
|
|
21
|
+
borderColor: '$success',
|
|
22
|
+
},
|
|
23
|
+
'-webkit-tap-highlight-color': 'rgba(0, 0, 0, 0)',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const StyledSwitchThumb = styled(RadixSwitch.Thumb, {
|
|
27
|
+
position: 'absolute',
|
|
28
|
+
top: '0',
|
|
29
|
+
boxSizing: 'border-box',
|
|
30
|
+
display: 'block',
|
|
31
|
+
width: '18px',
|
|
32
|
+
height: '18px',
|
|
33
|
+
backgroundColor: '$white',
|
|
34
|
+
transition: ' transform 300ms',
|
|
35
|
+
borderRadius: '999999px',
|
|
36
|
+
willChange: 'transform',
|
|
37
|
+
|
|
38
|
+
'&[data-state="checked"]': {
|
|
39
|
+
transform: 'translateX(20px)',
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export interface PropTypes {
|
|
44
|
+
checked: boolean;
|
|
45
|
+
onChange?: (checked: boolean) => void;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function Switch(props: PropTypes) {
|
|
49
|
+
const { checked, onChange } = props;
|
|
50
|
+
return (
|
|
51
|
+
<StyledSwitchRoot checked={checked} onCheckedChange={onChange}>
|
|
52
|
+
<StyledSwitchThumb />
|
|
53
|
+
</StyledSwitchRoot>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Switch } from './Switch';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { TextField, PropTypes } from './TextField';
|
|
5
|
+
import { SearchIcon } from '../Icon';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Components/Text Field',
|
|
9
|
+
|
|
10
|
+
component: TextField,
|
|
11
|
+
argTypes: {
|
|
12
|
+
disabled: {
|
|
13
|
+
name: 'disabled',
|
|
14
|
+
type: 'boolean',
|
|
15
|
+
},
|
|
16
|
+
placeholder: {
|
|
17
|
+
name: 'placeholder',
|
|
18
|
+
type: 'string',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
} as ComponentMeta<typeof TextField>;
|
|
22
|
+
|
|
23
|
+
export const Main = (args: PropTypes) => <TextField {...args} />;
|
|
24
|
+
|
|
25
|
+
export const WithPrefix = (args: PropTypes) => (
|
|
26
|
+
<TextField {...args} prefix={<SearchIcon size={20} />} />
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export const WithSuffix = (args: PropTypes) => (
|
|
30
|
+
<TextField {...args} suffix={<SearchIcon size={20} />} />
|
|
31
|
+
);
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import React, { PropsWithChildren, RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
import { styled } from '../../theme';
|
|
4
|
+
|
|
5
|
+
const InputContainer = styled('div', {
|
|
6
|
+
backgroundColor: '$background',
|
|
7
|
+
padding: '1px',
|
|
8
|
+
boxSizing: 'border-box',
|
|
9
|
+
border: '1px solid $neutrals400',
|
|
10
|
+
borderRadius: '$5',
|
|
11
|
+
height: '$48',
|
|
12
|
+
display: 'flex',
|
|
13
|
+
flexGrow: 1,
|
|
14
|
+
position: 'relative',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
color: '$foreground',
|
|
17
|
+
transition: 'border-color ease .3s',
|
|
18
|
+
'&:focus-within': {
|
|
19
|
+
borderColor: '$success',
|
|
20
|
+
outline: '1px solid $success',
|
|
21
|
+
},
|
|
22
|
+
variants: {
|
|
23
|
+
size: {
|
|
24
|
+
small: {
|
|
25
|
+
height: '$32',
|
|
26
|
+
},
|
|
27
|
+
medium: {
|
|
28
|
+
height: '$40',
|
|
29
|
+
},
|
|
30
|
+
large: {
|
|
31
|
+
height: '$48',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
disabled: {
|
|
35
|
+
true: {
|
|
36
|
+
backgroundColor: '$neutrals300',
|
|
37
|
+
cursor: 'not-allowed',
|
|
38
|
+
filter: 'grayscale(100%)',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
prefix: {
|
|
42
|
+
true: {
|
|
43
|
+
paddingLeft: '$16',
|
|
44
|
+
},
|
|
45
|
+
false: {
|
|
46
|
+
paddingLeft: '$0',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
suffix: {
|
|
50
|
+
true: {
|
|
51
|
+
paddingRight: '$16',
|
|
52
|
+
},
|
|
53
|
+
false: {
|
|
54
|
+
paddingRight: '$0',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
defaultVariants: {
|
|
59
|
+
size: 'medium',
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const Input = styled('input', {
|
|
64
|
+
color: '$foreground',
|
|
65
|
+
paddingLeft: '$16',
|
|
66
|
+
paddingRight: '$16',
|
|
67
|
+
flexGrow: 1,
|
|
68
|
+
width: '100%',
|
|
69
|
+
border: 'none',
|
|
70
|
+
borderRadius: '$5',
|
|
71
|
+
outline: 'none',
|
|
72
|
+
fontSize: '$l',
|
|
73
|
+
backgroundColor: 'transparent',
|
|
74
|
+
'-webkit-appearance': 'none',
|
|
75
|
+
margin: 0,
|
|
76
|
+
'&:disabled': {
|
|
77
|
+
cursor: 'not-allowed',
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
const Label = styled('label', {
|
|
81
|
+
display: 'inline-block',
|
|
82
|
+
fontSize: '$14',
|
|
83
|
+
color: '$foreground',
|
|
84
|
+
marginBottom: '$4',
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export type PropTypes = {
|
|
88
|
+
label?: string;
|
|
89
|
+
prefix?: React.ReactNode;
|
|
90
|
+
suffix?: React.ReactNode;
|
|
91
|
+
size?: 'small' | 'medium' | 'large';
|
|
92
|
+
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'prefix' | 'size'> & {
|
|
93
|
+
ref?:
|
|
94
|
+
| ((instance: HTMLInputElement | null) => void)
|
|
95
|
+
| React.RefObject<HTMLInputElement>
|
|
96
|
+
| null
|
|
97
|
+
| undefined;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const TextField = React.forwardRef(
|
|
101
|
+
(
|
|
102
|
+
props: PropsWithChildren<PropTypes>,
|
|
103
|
+
ref:
|
|
104
|
+
| RefObject<HTMLInputElement>
|
|
105
|
+
| ((instance: HTMLInputElement | null) => void)
|
|
106
|
+
| null
|
|
107
|
+
| undefined
|
|
108
|
+
) => {
|
|
109
|
+
const { label, prefix, suffix, children, size, style, ...inputAttributes } =
|
|
110
|
+
props;
|
|
111
|
+
return (
|
|
112
|
+
<>
|
|
113
|
+
{label && (
|
|
114
|
+
<Label
|
|
115
|
+
className="_text"
|
|
116
|
+
{...(inputAttributes.id && { htmlFor: inputAttributes.id })}
|
|
117
|
+
>
|
|
118
|
+
{label}
|
|
119
|
+
</Label>
|
|
120
|
+
)}
|
|
121
|
+
<InputContainer
|
|
122
|
+
disabled={inputAttributes.disabled}
|
|
123
|
+
prefix={!!prefix}
|
|
124
|
+
suffix={!!suffix}
|
|
125
|
+
size={size}
|
|
126
|
+
style={style}
|
|
127
|
+
className="_text"
|
|
128
|
+
>
|
|
129
|
+
{prefix || null}
|
|
130
|
+
<Input
|
|
131
|
+
className="_text"
|
|
132
|
+
{...inputAttributes}
|
|
133
|
+
spellCheck={false}
|
|
134
|
+
ref={ref}
|
|
135
|
+
/>
|
|
136
|
+
{suffix || null}
|
|
137
|
+
</InputContainer>
|
|
138
|
+
</>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextField } from './TextField';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Token } from 'rango-sdk';
|
|
2
|
+
import React, { CSSProperties } from 'react';
|
|
3
|
+
import { styled } from '../../theme';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { Typography } from '../Typography';
|
|
6
|
+
import { TokenWithAmount } from './TokenList';
|
|
7
|
+
|
|
8
|
+
const TokenImage = styled('img', {
|
|
9
|
+
width: '$32',
|
|
10
|
+
maxHeight: '$32',
|
|
11
|
+
marginRight: '$16',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const TokenNameContainer = styled('div', {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flexDirection: 'column',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const TokenAmountContainer = styled('div', {
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
alignItems: 'flex-end',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
interface PropTypes {
|
|
26
|
+
token: TokenWithAmount;
|
|
27
|
+
selected: boolean;
|
|
28
|
+
onClick: (token: Token) => void;
|
|
29
|
+
style?: CSSProperties;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function TokenItem(props: PropTypes) {
|
|
33
|
+
const { token, style, onClick, selected } = props;
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
style={{
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
width: '100%',
|
|
40
|
+
...style,
|
|
41
|
+
height: '48px',
|
|
42
|
+
top: `${parseFloat(style?.top as string) + 0}px`,
|
|
43
|
+
padding: '0 4px',
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<Button
|
|
47
|
+
variant="outlined"
|
|
48
|
+
size="large"
|
|
49
|
+
align="start"
|
|
50
|
+
onClick={onClick.bind(null, token)}
|
|
51
|
+
type={selected ? 'primary' : undefined}
|
|
52
|
+
prefix={<TokenImage src={token.image} />}
|
|
53
|
+
suffix={
|
|
54
|
+
token.balance?.amount && (
|
|
55
|
+
<TokenAmountContainer>
|
|
56
|
+
<Typography variant="body2">{token.balance.amount}</Typography>
|
|
57
|
+
<Typography variant="caption">
|
|
58
|
+
{`${token.balance.usdValue}$`}
|
|
59
|
+
</Typography>
|
|
60
|
+
</TokenAmountContainer>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
>
|
|
64
|
+
<TokenNameContainer>
|
|
65
|
+
<Typography variant="body1">{token.symbol}</Typography>
|
|
66
|
+
<Typography variant="caption" color="neutrals600">
|
|
67
|
+
{token.name}
|
|
68
|
+
</Typography>
|
|
69
|
+
</TokenNameContainer>
|
|
70
|
+
</Button>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
import { TokenList, PropTypes } from './TokenList';
|
|
4
|
+
import { tokensMeta } from './mockData';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Token List',
|
|
8
|
+
component: TokenList,
|
|
9
|
+
argTypes: {
|
|
10
|
+
searchedText: {
|
|
11
|
+
defaultValue: '',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
} as ComponentMeta<typeof TokenList>;
|
|
15
|
+
|
|
16
|
+
export const Main = (args: PropTypes) => (
|
|
17
|
+
<TokenList {...args} list={tokensMeta} selected={tokensMeta[0]} />
|
|
18
|
+
);
|