@rango-dev/ui 0.1.10-next.69
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 +6 -0
- package/dist/components/Alert/Alert.stories.d.ts +4 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/BestRoute/BestRoute.d.ts +8 -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 +14 -0
- package/dist/components/BlockchainSelector/BlockchainSelector.stories.d.ts +4 -0
- package/dist/components/BlockchainSelector/index.d.ts +1 -0
- package/dist/components/BlockchainsList/BlockchainsList.d.ts +7 -0
- package/dist/components/BlockchainsList/BlockchainsList.stories.d.ts +4 -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 +6 -0
- package/dist/components/Chip/index.d.ts +1 -0
- package/dist/components/ConnectWalletsModal/ConnectWallets.stories.d.ts +4 -0
- package/dist/components/ConnectWalletsModal/ConnectWalletsModal.d.ts +10 -0
- package/dist/components/ConnectWalletsModal/index.d.ts +1 -0
- package/dist/components/ConnectWalletsModal/mockData.d.ts +2 -0
- package/dist/components/Drawer/Drawer.d.ts +12 -0
- package/dist/components/Drawer/Drawer.stories.d.ts +7 -0
- package/dist/components/Drawer/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/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/CloseIcon.d.ts +1 -0
- package/dist/components/Icon/DeleteCircleIcon.d.ts +3 -0
- package/dist/components/Icon/DeleteWalletIcon.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 +36 -0
- package/dist/components/Icon/types.d.ts +6 -0
- package/dist/components/LiquiditySourceList/LiquiditySource.stories.d.ts +4 -0
- package/dist/components/LiquiditySourceList/LiquiditySourceList.d.ts +8 -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 +11 -0
- package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.stories.d.ts +4 -0
- package/dist/components/LiquiditySourcesSelector/index.d.ts +1 -0
- package/dist/components/Modal/Modal.d.ts +11 -0
- package/dist/components/Modal/Modal.stories.d.ts +4 -0
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/Radio/Radio.d.ts +12 -0
- package/dist/components/Radio/Radio.stories.d.ts +4 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/SecondaryPage/SecondaryPage.d.ts +18 -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 +19 -0
- package/dist/components/Settings/Settings.stories.d.ts +4 -0
- package/dist/components/Settings/index.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +5 -0
- package/dist/components/Skeleton/Skeleton.stories.d.ts +4 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Spacer/Spacer.d.ts +5 -0
- package/dist/components/Spacer/Spacer.stories.d.ts +4 -0
- package/dist/components/Spacer/index.d.ts +1 -0
- package/dist/components/Spinner/Spinner.d.ts +5 -0
- package/dist/components/Spinner/Spinner.stories.d.ts +4 -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 +4 -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 +6 -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/index.d.ts +1 -0
- package/dist/components/SwapDetail/mock.d.ts +2 -0
- package/dist/components/Switch/Switch.d.ts +5 -0
- package/dist/components/Switch/Switch.stories.d.ts +4 -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/TokenList.d.ts +14 -0
- package/dist/components/TokenList/TokenList.stories.d.ts +4 -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 +10 -0
- package/dist/components/TokenSelector/TokenSelector.stories.d.ts +4 -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 +14 -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 +18 -0
- package/dist/components/Wallet/State.d.ts +6 -0
- package/dist/components/Wallet/Wallet.d.ts +6 -0
- package/dist/components/Wallet/Wallet.stories.d.ts +4 -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 +24 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +23 -0
- package/dist/containers/ConfirmSwap/ConfirmSwap.stories.d.ts +5 -0
- package/dist/containers/ConfirmSwap/index.d.ts +1 -0
- package/dist/containers/ConfirmSwap/mock.d.ts +2 -0
- package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +14 -0
- package/dist/containers/ConfirmWallets/ConfirmWallets.stories.d.ts +6 -0
- package/dist/containers/ConfirmWallets/index.d.ts +1 -0
- package/dist/containers/ConfirmWallets/mock.d.ts +5 -0
- package/dist/containers/ConfirmWallets/types.d.ts +8 -0
- package/dist/containers/History/History.d.ts +8 -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 +59 -0
- package/dist/containers/SwapHistory/SwapHistory.d.ts +7 -0
- package/dist/containers/SwapHistory/SwapHistory.stories.d.ts +4 -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 +4 -0
- package/dist/helper/index.d.ts +6 -0
- package/dist/helper/swaps.d.ts +5 -0
- package/dist/helpers.d.ts +1 -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 +1 -0
- package/dist/types/meta.d.ts +22 -0
- package/dist/types/swaps.d.ts +22 -0
- package/dist/types/wallet.d.ts +14 -0
- package/dist/ui.cjs.development.js +4103 -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 +4028 -0
- package/dist/ui.esm.js.map +1 -0
- package/package.json +89 -0
- package/src/components/Alert/Alert.stories.tsx +22 -0
- package/src/components/Alert/Alert.tsx +78 -0
- package/src/components/Alert/index.ts +1 -0
- package/src/components/BestRoute/BestRoute.stories.tsx +31 -0
- package/src/components/BestRoute/BestRoute.tsx +189 -0
- package/src/components/BestRoute/index.ts +1 -0
- package/src/components/BestRoute/mock.ts +544 -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 +60 -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 +407 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +22 -0
- package/src/components/Checkbox/Checkbox.tsx +54 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Chip/Chip.stories.tsx +37 -0
- package/src/components/Chip/Chip.tsx +45 -0
- package/src/components/Chip/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 +118 -0
- package/src/components/Drawer/Drawer.stories.tsx +86 -0
- package/src/components/Drawer/Drawer.tsx +128 -0
- package/src/components/Drawer/index.ts +1 -0
- package/src/components/Icon/AddCircleIcon.tsx +29 -0
- package/src/components/Icon/AddIcon.tsx +28 -0
- package/src/components/Icon/AddWalletIcon.tsx +48 -0
- package/src/components/Icon/AngleDownIcon.tsx +30 -0
- package/src/components/Icon/AngleLeftIcon.tsx +31 -0
- package/src/components/Icon/AngleRightIcon.tsx +30 -0
- package/src/components/Icon/AngleUpIcon.tsx +30 -0
- package/src/components/Icon/BagIcon.tsx +37 -0
- package/src/components/Icon/BanIcon.tsx +30 -0
- package/src/components/Icon/CheckCircleIcon.tsx +37 -0
- package/src/components/Icon/CheckIcon.tsx +28 -0
- package/src/components/Icon/CheckSquareIcon.tsx +35 -0
- package/src/components/Icon/CheckWalletIcon.tsx +43 -0
- package/src/components/Icon/CloseIcon.tsx +9 -0
- package/src/components/Icon/DeleteCircleIcon.tsx +29 -0
- package/src/components/Icon/DeleteWalletIcon.tsx +48 -0
- package/src/components/Icon/DownloadIcon.tsx +35 -0
- package/src/components/Icon/GasIcon.tsx +35 -0
- package/src/components/Icon/HistoryIcon.tsx +38 -0
- package/src/components/Icon/HorizontalSwapIcon.tsx +36 -0
- package/src/components/Icon/Icons.stories.tsx +44 -0
- package/src/components/Icon/InfoCircleIcon.tsx +37 -0
- package/src/components/Icon/MinusCircleIcon.tsx +29 -0
- package/src/components/Icon/RetryIcon.tsx +30 -0
- package/src/components/Icon/RetryLeftIcon.tsx +29 -0
- package/src/components/Icon/RetryRightIcon.tsx +29 -0
- package/src/components/Icon/SearchIcon.tsx +29 -0
- package/src/components/Icon/SearchMinusIcon.tsx +29 -0
- package/src/components/Icon/SettingIcon.tsx +37 -0
- package/src/components/Icon/SignatureIcon.tsx +30 -0
- package/src/components/Icon/SwapWalletIcon.tsx +48 -0
- package/src/components/Icon/TimeIcon.tsx +29 -0
- package/src/components/Icon/TrashIcon.tsx +29 -0
- package/src/components/Icon/TryAgainIcon.tsx +29 -0
- package/src/components/Icon/VerticalSwapIcon.tsx +36 -0
- package/src/components/Icon/WalletIconIcon.tsx +38 -0
- package/src/components/Icon/WarningIcon.tsx +35 -0
- package/src/components/Icon/common.ts +69 -0
- package/src/components/Icon/index.ts +44 -0
- package/src/components/Icon/types.tsx +44 -0
- package/src/components/LiquiditySourceList/LiquiditySource.stories.tsx +13 -0
- package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +114 -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 +55 -0
- package/src/components/LiquiditySourcesSelector/index.ts +1 -0
- package/src/components/Modal/Modal.stories.tsx +22 -0
- package/src/components/Modal/Modal.tsx +76 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/Radio/Radio.stories.tsx +23 -0
- package/src/components/Radio/Radio.tsx +95 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/SecondaryPage/SecondaryPage.stories.tsx +7 -0
- package/src/components/SecondaryPage/SecondaryPage.tsx +95 -0
- package/src/components/SecondaryPage/index.ts +1 -0
- package/src/components/SelectableWalletList/SelectableWalletList.stories.tsx +14 -0
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +113 -0
- package/src/components/SelectableWalletList/index.ts +1 -0
- package/src/components/SelectableWalletList/mock.ts +12 -0
- package/src/components/Settings/Settings.stories.tsx +34 -0
- package/src/components/Settings/Settings.tsx +160 -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 +18 -0
- package/src/components/Spacer/Spacer.tsx +98 -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 +81 -0
- package/src/components/StatusDrawer/index.ts +1 -0
- package/src/components/StepDetail/StepDetail.stories.tsx +37 -0
- package/src/components/StepDetail/StepDetail.tsx +97 -0
- package/src/components/StepDetail/index.ts +1 -0
- package/src/components/SwapContainer/SwapContainer.stories.tsx +13 -0
- package/src/components/SwapContainer/SwapContainer.tsx +35 -0
- package/src/components/SwapContainer/index.ts +1 -0
- package/src/components/SwapDetail/SwapDetail.stories.tsx +19 -0
- package/src/components/SwapDetail/SwapDetail.tsx +150 -0
- package/src/components/SwapDetail/index.ts +1 -0
- package/src/components/SwapDetail/mock.ts +275 -0
- package/src/components/Switch/Switch.stories.tsx +9 -0
- package/src/components/Switch/Switch.tsx +52 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/TextField/TextField.stories.tsx +31 -0
- package/src/components/TextField/TextField.tsx +129 -0
- package/src/components/TextField/index.ts +1 -0
- package/src/components/TokenList/TokenList.stories.tsx +18 -0
- package/src/components/TokenList/TokenList.tsx +180 -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 +35 -0
- package/src/components/TokenSelector/index.ts +1 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +52 -0
- package/src/components/Tooltip/Tooltip.tsx +110 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/Typography/Typography.stories.tsx +68 -0
- package/src/components/Typography/Typography.tsx +199 -0
- package/src/components/Typography/index.ts +1 -0
- package/src/components/VirtualizedList/VirtualizedList.tsx +78 -0
- package/src/components/Wallet/State.tsx +36 -0
- package/src/components/Wallet/Wallet.stories.tsx +36 -0
- package/src/components/Wallet/Wallet.tsx +42 -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 +24 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +13 -0
- package/src/containers/ConfirmSwap/ConfirmSwap.tsx +154 -0
- package/src/containers/ConfirmSwap/index.ts +1 -0
- package/src/containers/ConfirmSwap/mock.ts +146 -0
- package/src/containers/ConfirmWallets/ConfirmWallets.stories.tsx +26 -0
- package/src/containers/ConfirmWallets/ConfirmWallets.tsx +98 -0
- package/src/containers/ConfirmWallets/index.ts +1 -0
- package/src/containers/ConfirmWallets/mock.ts +222 -0
- package/src/containers/ConfirmWallets/types.ts +9 -0
- package/src/containers/History/History.stories.tsx +14 -0
- package/src/containers/History/History.tsx +93 -0
- package/src/containers/History/index.ts +1 -0
- package/src/containers/History/mock.ts +825 -0
- package/src/containers/History/types.tsx +66 -0
- package/src/containers/SwapHistory/SwapHistory.stories.tsx +13 -0
- package/src/containers/SwapHistory/SwapHistory.tsx +165 -0
- package/src/containers/SwapHistory/index.ts +1 -0
- package/src/containers/SwapHistory/mock.ts +275 -0
- package/src/containers/index.ts +4 -0
- package/src/helper/index.ts +23 -0
- package/src/helper/swaps.ts +23 -0
- package/src/helpers.ts +2 -0
- package/src/index.ts +4 -0
- package/src/theme.ts +161 -0
- package/src/types/index.ts +1 -0
- package/src/types/meta.ts +20 -0
- package/src/types/swaps.tsx +36 -0
- package/src/types/wallet.ts +20 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { LiquiditySource } from '../../types/meta';
|
|
2
|
+
|
|
3
|
+
export const liquiditySources: LiquiditySource[] = [
|
|
4
|
+
{
|
|
5
|
+
title: 'Pancake',
|
|
6
|
+
logo: 'https://api.rango.exchange/swappers/pancake-swap.png',
|
|
7
|
+
type: 'DEX',
|
|
8
|
+
selected: true,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
title: 'ThorChain',
|
|
12
|
+
logo: 'https://api.rango.exchange/swappers/Thorchain.svg',
|
|
13
|
+
type: 'BRIDGE',
|
|
14
|
+
selected: true,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
title: 'Horizon Bridge',
|
|
18
|
+
logo: 'https://api.rango.exchange/swappers/harmony-horizon.svg',
|
|
19
|
+
type: 'BRIDGE',
|
|
20
|
+
selected: true,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
title: '1Inch',
|
|
24
|
+
logo: 'https://api.rango.exchange/swappers/1inch.svg',
|
|
25
|
+
type: 'DEX',
|
|
26
|
+
selected: true,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
title: 'OpenOcean',
|
|
30
|
+
logo: 'https://api.rango.exchange/swappers/openocean.svg',
|
|
31
|
+
type: 'DEX',
|
|
32
|
+
selected: true,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: 'SushiSwap',
|
|
36
|
+
logo: 'https://api.rango.exchange/swappers/sushi.png',
|
|
37
|
+
type: 'DEX',
|
|
38
|
+
selected: true,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
title: 'OkcSwap',
|
|
42
|
+
logo: 'https://api.rango.exchange/swappers/okcswap.png',
|
|
43
|
+
type: 'DEX',
|
|
44
|
+
selected: true,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: 'CherrySwap',
|
|
48
|
+
logo: 'https://api.rango.exchange/swappers/cherry-swap.png',
|
|
49
|
+
type: 'DEX',
|
|
50
|
+
selected: true,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
title: 'Osmosis',
|
|
54
|
+
logo: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
55
|
+
type: 'DEX',
|
|
56
|
+
selected: true,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
title: 'Osmosis',
|
|
60
|
+
logo: 'https://api.rango.exchange/swappers/osmosis.png',
|
|
61
|
+
type: 'BRIDGE',
|
|
62
|
+
selected: true,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
title: 'SolanaWrapper',
|
|
66
|
+
logo: 'https://api.rango.exchange/tokens/SOLANA/SOL.png',
|
|
67
|
+
type: 'DEX',
|
|
68
|
+
selected: true,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
title: 'Jupiter',
|
|
72
|
+
logo: 'https://api.rango.exchange/swappers/jupiter.svg',
|
|
73
|
+
type: 'DEX',
|
|
74
|
+
selected: true,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
title: 'stargate',
|
|
78
|
+
logo: 'https://api.rango.exchange/swappers/stargate.svg',
|
|
79
|
+
type: 'BRIDGE',
|
|
80
|
+
selected: true,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
title: 'Multichain',
|
|
84
|
+
logo: 'https://api.rango.exchange/swappers/multichain.png',
|
|
85
|
+
type: 'BRIDGE',
|
|
86
|
+
selected: true,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
title: 'Satellite',
|
|
90
|
+
logo: 'https://api.rango.exchange/swappers/satellite.png',
|
|
91
|
+
type: 'BRIDGE',
|
|
92
|
+
selected: true,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
title: 'Diffusion',
|
|
96
|
+
logo: 'https://api.rango.exchange/swappers/diffusion.png',
|
|
97
|
+
type: 'DEX',
|
|
98
|
+
selected: true,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
title: 'JunoSwap',
|
|
102
|
+
logo: 'https://api.rango.exchange/swappers/junoswap.svg',
|
|
103
|
+
type: 'BRIDGE',
|
|
104
|
+
selected: true,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
title: 'JunoSwap',
|
|
108
|
+
logo: 'https://api.rango.exchange/swappers/junoswap.svg',
|
|
109
|
+
type: 'DEX',
|
|
110
|
+
selected: true,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
title: 'PangolinSwap',
|
|
114
|
+
logo: 'https://api.rango.exchange/swappers/pangolin.png',
|
|
115
|
+
type: 'DEX',
|
|
116
|
+
selected: true,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
title: 'MMFinance',
|
|
120
|
+
logo: 'https://api.rango.exchange/swappers/mm-finance.png',
|
|
121
|
+
type: 'DEX',
|
|
122
|
+
selected: true,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
title: 'CronaSwap',
|
|
126
|
+
logo: 'https://api.rango.exchange/swappers/crona.png',
|
|
127
|
+
type: 'DEX',
|
|
128
|
+
selected: true,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
title: 'VVSFinance',
|
|
132
|
+
logo: 'https://api.rango.exchange/swappers/vvs-finance.svg',
|
|
133
|
+
type: 'DEX',
|
|
134
|
+
selected: true,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
title: 'MDexHeco',
|
|
138
|
+
logo: 'https://api.rango.exchange/swappers/mdex.png',
|
|
139
|
+
type: 'DEX',
|
|
140
|
+
selected: true,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
title: 'ParaSwap',
|
|
144
|
+
logo: 'https://api.rango.exchange/swappers/para-swap.png',
|
|
145
|
+
type: 'DEX',
|
|
146
|
+
selected: true,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
title: 'AuroraSwap',
|
|
150
|
+
logo: 'https://api.rango.exchange/swappers/aurora-swap.png',
|
|
151
|
+
type: 'DEX',
|
|
152
|
+
selected: true,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
title: 'Across',
|
|
156
|
+
logo: 'https://api.rango.exchange/swappers/across.png',
|
|
157
|
+
type: 'BRIDGE',
|
|
158
|
+
selected: true,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
title: 'Arbitrum Bridge',
|
|
162
|
+
logo: 'https://api.rango.exchange/swappers/arbitrum-bridge.svg',
|
|
163
|
+
type: 'BRIDGE',
|
|
164
|
+
selected: true,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
title: 'TrisolarisSwap',
|
|
168
|
+
logo: 'https://api.rango.exchange/swappers/trisolaris.svg',
|
|
169
|
+
type: 'DEX',
|
|
170
|
+
selected: true,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
title: 'Polygon Bridge',
|
|
174
|
+
logo: 'https://api.rango.exchange/swappers/polygon-bridge.png',
|
|
175
|
+
type: 'BRIDGE',
|
|
176
|
+
selected: true,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
title: 'SpookySwap',
|
|
180
|
+
logo: 'https://api.rango.exchange/swappers/spooky-swap.png',
|
|
181
|
+
type: 'DEX',
|
|
182
|
+
selected: true,
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
title: 'Voyager',
|
|
186
|
+
logo: 'https://api.rango.exchange/swappers/voyager.svg',
|
|
187
|
+
type: 'BRIDGE',
|
|
188
|
+
selected: true,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
title: 'Rainbow Bridge',
|
|
192
|
+
logo: 'https://api.rango.exchange/swappers/rainbow-bridge.svg',
|
|
193
|
+
type: 'BRIDGE',
|
|
194
|
+
selected: true,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
title: 'Lido',
|
|
198
|
+
logo: 'https://api.rango.exchange/swappers/lido.png',
|
|
199
|
+
type: 'BRIDGE',
|
|
200
|
+
selected: true,
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
title: 'Symbiosis',
|
|
204
|
+
logo: 'https://api.rango.exchange/swappers/symbiosis.png',
|
|
205
|
+
type: 'BRIDGE',
|
|
206
|
+
selected: true,
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
title: 'Avalanche Bridge',
|
|
210
|
+
logo: 'https://api.rango.exchange/swappers/avalanche-bridge.png',
|
|
211
|
+
type: 'BRIDGE',
|
|
212
|
+
selected: true,
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
title: 'VoltageSwap',
|
|
216
|
+
logo: 'https://api.rango.exchange/swappers/voltage.png',
|
|
217
|
+
type: 'DEX',
|
|
218
|
+
selected: true,
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
title: 'XYFinance',
|
|
222
|
+
logo: 'https://api.rango.exchange/swappers/xy.png',
|
|
223
|
+
type: 'BRIDGE',
|
|
224
|
+
selected: true,
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
title: 'cBridge v2.0',
|
|
228
|
+
logo: 'https://api.rango.exchange/swappers/cbridge.png',
|
|
229
|
+
type: 'AGGREGATOR',
|
|
230
|
+
selected: true,
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
title: 'Hyphen',
|
|
234
|
+
logo: 'https://api.rango.exchange/swappers/hyphen.svg',
|
|
235
|
+
type: 'AGGREGATOR',
|
|
236
|
+
selected: true,
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
title: 'Optimism Bridge',
|
|
240
|
+
logo: 'https://api.rango.exchange/swappers/optimism.svg',
|
|
241
|
+
type: 'BRIDGE',
|
|
242
|
+
selected: true,
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
title: 'OolongSwap',
|
|
246
|
+
logo: 'https://api.rango.exchange/swappers/oolong.png',
|
|
247
|
+
type: 'DEX',
|
|
248
|
+
selected: true,
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
title: 'QuickSwap',
|
|
252
|
+
logo: 'https://api.rango.exchange/swappers/quick-swap.png',
|
|
253
|
+
type: 'DEX',
|
|
254
|
+
selected: true,
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
title: 'StellaSwap',
|
|
258
|
+
logo: 'https://api.rango.exchange/swappers/stella.png',
|
|
259
|
+
type: 'DEX',
|
|
260
|
+
selected: true,
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
title: 'ViperSwap',
|
|
264
|
+
logo: 'https://api.rango.exchange/swappers/viper.png',
|
|
265
|
+
type: 'DEX',
|
|
266
|
+
selected: true,
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
title: 'FinKujira',
|
|
270
|
+
logo: 'https://api.rango.exchange/swappers/finkujira.png',
|
|
271
|
+
type: 'DEX',
|
|
272
|
+
selected: true,
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
title: 'Hop',
|
|
276
|
+
logo: 'https://api.rango.exchange/swappers/hop.svg',
|
|
277
|
+
type: 'BRIDGE',
|
|
278
|
+
selected: true,
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
title: 'BeamSwap',
|
|
282
|
+
logo: 'https://api.rango.exchange/swappers/beam-swap.png',
|
|
283
|
+
type: 'DEX',
|
|
284
|
+
selected: true,
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
title: 'SolarbeamSwap',
|
|
288
|
+
logo: 'https://api.rango.exchange/swappers/solarbeamlogo.png',
|
|
289
|
+
type: 'DEX',
|
|
290
|
+
selected: true,
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
title: 'Sifchain',
|
|
294
|
+
logo: 'https://api.rango.exchange/swappers/sifchain.png',
|
|
295
|
+
type: 'BRIDGE',
|
|
296
|
+
selected: true,
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
title: 'Sifchain',
|
|
300
|
+
logo: 'https://api.rango.exchange/swappers/sifchain.png',
|
|
301
|
+
type: 'DEX',
|
|
302
|
+
selected: true,
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
title: 'Wormhole',
|
|
306
|
+
logo: 'https://api.rango.exchange/swappers/wormhole.png',
|
|
307
|
+
type: 'BRIDGE',
|
|
308
|
+
selected: true,
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
title: 'UniSwapV2',
|
|
312
|
+
logo: 'https://api.rango.exchange/swappers/uniswap.png',
|
|
313
|
+
type: 'DEX',
|
|
314
|
+
selected: true,
|
|
315
|
+
},
|
|
316
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
import {
|
|
4
|
+
LiquiditySourcesSelector,
|
|
5
|
+
PropTypes,
|
|
6
|
+
} from './LiquiditySourcesSelector';
|
|
7
|
+
import { liquiditySources } from '../LiquiditySourceList/mockData';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'Liquidity Sources Selector',
|
|
11
|
+
component: LiquiditySourcesSelector,
|
|
12
|
+
} as ComponentMeta<typeof LiquiditySourcesSelector>;
|
|
13
|
+
|
|
14
|
+
export const Main = (args: PropTypes) => (
|
|
15
|
+
<LiquiditySourcesSelector {...args} list={liquiditySources} />
|
|
16
|
+
);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { CSSProperties } from '@stitches/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { containsText } from '../../helpers';
|
|
4
|
+
import { styled } from '../../theme';
|
|
5
|
+
import { LiquiditySource } from '../../types/meta';
|
|
6
|
+
import { Button } from '../Button';
|
|
7
|
+
import { LiquiditySourceList } from '../LiquiditySourceList';
|
|
8
|
+
import { SecondaryPage } from '../SecondaryPage/SecondaryPage';
|
|
9
|
+
|
|
10
|
+
const filterLiquiditySources = (
|
|
11
|
+
liquiditySources: LiquiditySource[],
|
|
12
|
+
searchedFor: string
|
|
13
|
+
) =>
|
|
14
|
+
liquiditySources.filter((liquiditySource) =>
|
|
15
|
+
containsText(liquiditySource.title, searchedFor || '')
|
|
16
|
+
);
|
|
17
|
+
export interface PropTypes {
|
|
18
|
+
list: LiquiditySource[];
|
|
19
|
+
onChange: (liquiditySource: LiquiditySource) => void;
|
|
20
|
+
toggleAll?: () => void;
|
|
21
|
+
onBack?: () => void;
|
|
22
|
+
hasHeader?: boolean;
|
|
23
|
+
listContainerStyle?: CSSProperties;
|
|
24
|
+
}
|
|
25
|
+
const ActionButton = styled(Button, {
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
right: 0,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export function LiquiditySourcesSelector(props: PropTypes) {
|
|
31
|
+
const { list, onChange, onBack, hasHeader, listContainerStyle, toggleAll } =
|
|
32
|
+
props;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<SecondaryPage
|
|
36
|
+
textField={true}
|
|
37
|
+
textFieldPlaceholder="Search By Name"
|
|
38
|
+
title="Liquidity Sources"
|
|
39
|
+
TopButton={
|
|
40
|
+
<ActionButton variant="ghost" type="primary" onClick={toggleAll}>
|
|
41
|
+
{list.find((item) => item.selected) ? 'Clear all' : 'Select all'}
|
|
42
|
+
</ActionButton>
|
|
43
|
+
}
|
|
44
|
+
hasHeader={hasHeader}
|
|
45
|
+
onBack={onBack}
|
|
46
|
+
Content={({ searchedFor }) => (
|
|
47
|
+
<LiquiditySourceList
|
|
48
|
+
listContainerStyle={listContainerStyle}
|
|
49
|
+
list={filterLiquiditySources(list, searchedFor)}
|
|
50
|
+
onChange={onChange}
|
|
51
|
+
/>
|
|
52
|
+
)}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LiquiditySourcesSelector } from './LiquiditySourcesSelector';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
import { Modal, PropTypes } from './Modal';
|
|
4
|
+
|
|
5
|
+
export default { name: 'Modal', component: Modal } as ComponentMeta<
|
|
6
|
+
typeof Modal
|
|
7
|
+
>;
|
|
8
|
+
|
|
9
|
+
export const Main = (args: PropTypes) => {
|
|
10
|
+
const [open, setOpen] = useState<boolean>(false);
|
|
11
|
+
return (
|
|
12
|
+
<div>
|
|
13
|
+
<button onClick={() => setOpen(true)}>Open Modal</button>
|
|
14
|
+
<Modal
|
|
15
|
+
{...args}
|
|
16
|
+
open={open}
|
|
17
|
+
title="I'm modal"
|
|
18
|
+
onClose={() => setOpen(false)}
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { CSSProperties } from '@stitches/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { styled } from '../../theme';
|
|
5
|
+
import { CloseIcon } from '../Icon/CloseIcon';
|
|
6
|
+
import { Typography } from '../Typography';
|
|
7
|
+
|
|
8
|
+
export interface PropTypes {
|
|
9
|
+
title: string;
|
|
10
|
+
open: boolean;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
content: React.ReactNode;
|
|
13
|
+
containerStyle?: CSSProperties;
|
|
14
|
+
contentStyle?: CSSProperties;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const BackDrop = styled('div', {
|
|
18
|
+
position: 'fixed',
|
|
19
|
+
display: 'flex',
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
top: '0',
|
|
23
|
+
left: '0',
|
|
24
|
+
width: '100vw',
|
|
25
|
+
height: '100vh',
|
|
26
|
+
backgroundColor: 'rgba(0,0,0,.1)',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const ModalContainer = styled('div', {
|
|
30
|
+
backgroundColor: '$background',
|
|
31
|
+
borderRadius: '$10',
|
|
32
|
+
padding: '$16 $16',
|
|
33
|
+
display: 'flex',
|
|
34
|
+
flexDirection: 'column',
|
|
35
|
+
boxShadow: '$s',
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const ModalHeader = styled('div', {
|
|
39
|
+
display: 'flex',
|
|
40
|
+
justifyContent: 'space-between',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
position: 'relative',
|
|
43
|
+
marginBottom: '$16',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const ContentContainer = styled('div', {
|
|
47
|
+
overflowY: 'scroll',
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export function Modal(props: PropTypes) {
|
|
51
|
+
const { title, content, open, onClose, containerStyle, contentStyle } = props;
|
|
52
|
+
|
|
53
|
+
const handleBackDropClick = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
54
|
+
if (event.target === event.currentTarget) onClose();
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<>
|
|
59
|
+
{open &&
|
|
60
|
+
createPortal(
|
|
61
|
+
<BackDrop onClick={handleBackDropClick}>
|
|
62
|
+
<ModalContainer style={containerStyle}>
|
|
63
|
+
<ModalHeader>
|
|
64
|
+
<Typography variant="h4">{title}</Typography>
|
|
65
|
+
<CloseIcon size={24} onClick={onClose} />
|
|
66
|
+
</ModalHeader>
|
|
67
|
+
<ContentContainer style={contentStyle}>
|
|
68
|
+
{content}
|
|
69
|
+
</ContentContainer>
|
|
70
|
+
</ModalContainer>
|
|
71
|
+
</BackDrop>,
|
|
72
|
+
document.body
|
|
73
|
+
)}
|
|
74
|
+
</>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Modal } from './Modal';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
import { PropTypes, Radio } from './Radio';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Radio',
|
|
7
|
+
component: Radio,
|
|
8
|
+
argTypes: {
|
|
9
|
+
options: {
|
|
10
|
+
defaultValue: [
|
|
11
|
+
{ value: 'one', label: 'One' },
|
|
12
|
+
{ value: 'two', label: 'Two' },
|
|
13
|
+
{ value: 'three', label: 'Three' },
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
defaultValue: { defaultValue: 'one' },
|
|
17
|
+
direction: {
|
|
18
|
+
defaultValue: 'horizontal',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
} as ComponentMeta<typeof Radio>;
|
|
22
|
+
|
|
23
|
+
export const Main = (args: PropTypes) => <Radio {...args} />;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as RadioGroup from '@radix-ui/react-radio-group';
|
|
3
|
+
import { styled } from '../../theme';
|
|
4
|
+
import { Typography } from '../Typography';
|
|
5
|
+
import { CSSProperties } from '@stitches/react';
|
|
6
|
+
|
|
7
|
+
const StyledRoot = styled(RadioGroup.Root, {
|
|
8
|
+
variants: {
|
|
9
|
+
direction: {
|
|
10
|
+
horizontal: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'row',
|
|
13
|
+
flexWrap: 'wrap',
|
|
14
|
+
},
|
|
15
|
+
vertical: {
|
|
16
|
+
display: 'grid',
|
|
17
|
+
gridGap: '$24',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const ItemContainer = styled('div', {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
marginRight: '$24',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const StyledItem = styled(RadioGroup.Item, {
|
|
30
|
+
backgroundColor: '$neutrals300',
|
|
31
|
+
width: '20px',
|
|
32
|
+
height: '20px',
|
|
33
|
+
borderRadius: '100%',
|
|
34
|
+
border: 'none',
|
|
35
|
+
cursor: 'pointer',
|
|
36
|
+
'&:hover': {
|
|
37
|
+
backgroundColor: '$neutrals400',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const StyledIndicator = styled(RadioGroup.Indicator, {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
width: '100%',
|
|
46
|
+
height: '100%',
|
|
47
|
+
position: 'relative',
|
|
48
|
+
'&::after': {
|
|
49
|
+
content: '',
|
|
50
|
+
display: 'block',
|
|
51
|
+
width: '10px',
|
|
52
|
+
height: '10px',
|
|
53
|
+
borderRadius: '50%',
|
|
54
|
+
backgroundColor: '$primary',
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const Label = styled('label', {
|
|
59
|
+
paddingLeft: '$16',
|
|
60
|
+
cursor: 'pointer',
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export interface PropTypes {
|
|
64
|
+
options: { label: string; value: string }[];
|
|
65
|
+
defaultValue: string;
|
|
66
|
+
onChange: (value: string) => void;
|
|
67
|
+
direction?: 'vertical' | 'horizontal';
|
|
68
|
+
style?: CSSProperties;
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function Radio(props: PropTypes) {
|
|
73
|
+
const { defaultValue, onChange, direction = 'vertical', style } = props;
|
|
74
|
+
return (
|
|
75
|
+
<form>
|
|
76
|
+
<StyledRoot
|
|
77
|
+
onValueChange={onChange}
|
|
78
|
+
defaultValue={defaultValue}
|
|
79
|
+
direction={direction}
|
|
80
|
+
style={style}
|
|
81
|
+
>
|
|
82
|
+
{props.options.map((option) => (
|
|
83
|
+
<ItemContainer>
|
|
84
|
+
<StyledItem value={option.value} id={option.value}>
|
|
85
|
+
<StyledIndicator />
|
|
86
|
+
</StyledItem>
|
|
87
|
+
<Label htmlFor={option.value}>
|
|
88
|
+
<Typography variant="body2">{option.label}</Typography>
|
|
89
|
+
</Label>
|
|
90
|
+
</ItemContainer>
|
|
91
|
+
))}
|
|
92
|
+
</StyledRoot>
|
|
93
|
+
</form>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Radio } from './Radio';
|