@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,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Button, PropTypes } from './Button';
|
|
5
|
+
import { AddWalletIcon } from '../Icon';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Components/Button',
|
|
9
|
+
component: Button,
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: {
|
|
12
|
+
name: 'variant',
|
|
13
|
+
control: { type: 'select' },
|
|
14
|
+
options: ['contained', 'outlined', 'ghost'],
|
|
15
|
+
defaultValue: 'contained',
|
|
16
|
+
},
|
|
17
|
+
type: {
|
|
18
|
+
name: 'type',
|
|
19
|
+
control: { type: 'select' },
|
|
20
|
+
options: ['primary', 'error', 'warning', 'success'],
|
|
21
|
+
},
|
|
22
|
+
align: {
|
|
23
|
+
name: 'align',
|
|
24
|
+
control: { type: 'select' },
|
|
25
|
+
options: ['start', 'grow'],
|
|
26
|
+
},
|
|
27
|
+
size: {
|
|
28
|
+
name: 'size',
|
|
29
|
+
control: { type: 'radio' },
|
|
30
|
+
options: ['small', 'medium', 'large', 'compact'],
|
|
31
|
+
defaultValue: 'medium',
|
|
32
|
+
},
|
|
33
|
+
disabled: {
|
|
34
|
+
name: 'disabled',
|
|
35
|
+
control: { type: 'boolean' },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
} as ComponentMeta<typeof Button>;
|
|
39
|
+
|
|
40
|
+
export const Main = (props: PropTypes) => (
|
|
41
|
+
<Button {...props}>I'm a button</Button>
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
export const WithPrefix = (args: PropTypes) => (
|
|
45
|
+
<Button prefix={<AddWalletIcon size={24} color="white" />} {...args}>
|
|
46
|
+
I'm a button
|
|
47
|
+
</Button>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export const WithSuffix = (args: PropTypes) => (
|
|
51
|
+
<Button suffix={<AddWalletIcon size={24} color="white" />} {...args}>
|
|
52
|
+
I'm a button
|
|
53
|
+
</Button>
|
|
54
|
+
);
|
|
55
|
+
export const IconButton = (args: PropTypes) => (
|
|
56
|
+
<div>
|
|
57
|
+
<Button suffix={<AddWalletIcon size={24} color="white" />} {...args} />
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import { CSSProperties } from '@stitches/react';
|
|
2
|
+
import React, { PropsWithChildren, HTMLAttributes } from 'react';
|
|
3
|
+
import { darkTheme, styled } from '../../theme';
|
|
4
|
+
import { Spinner } from '../Spinner';
|
|
5
|
+
import { Typography } from '../Typography';
|
|
6
|
+
|
|
7
|
+
const ButtonContainer = styled('button', {
|
|
8
|
+
borderRadius: '$5',
|
|
9
|
+
fontSize: '$16',
|
|
10
|
+
fontWeight: '$400',
|
|
11
|
+
cursor: 'pointer',
|
|
12
|
+
padding: '0 $12',
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
justifyContent: 'center',
|
|
16
|
+
transition: 'all 0.35s',
|
|
17
|
+
border: '0',
|
|
18
|
+
|
|
19
|
+
'&:active': {
|
|
20
|
+
transform: 'scale(0.95)',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
variants: {
|
|
24
|
+
align: {
|
|
25
|
+
start: {
|
|
26
|
+
display: 'flex',
|
|
27
|
+
width: '100%',
|
|
28
|
+
},
|
|
29
|
+
grow: {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
width: '100%',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
size: {
|
|
35
|
+
compact: {},
|
|
36
|
+
free: {},
|
|
37
|
+
small: {
|
|
38
|
+
height: '$32',
|
|
39
|
+
},
|
|
40
|
+
medium: {
|
|
41
|
+
height: '$40',
|
|
42
|
+
},
|
|
43
|
+
large: {
|
|
44
|
+
height: '$48',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
variant: {
|
|
48
|
+
contained: {
|
|
49
|
+
backgroundColor: '$neutrals300',
|
|
50
|
+
color: '$foreground',
|
|
51
|
+
border: 0,
|
|
52
|
+
'&:hover': {
|
|
53
|
+
backgroundColor: '$neutrals200',
|
|
54
|
+
},
|
|
55
|
+
'&:disabled': {
|
|
56
|
+
background: '$neutrals400',
|
|
57
|
+
},
|
|
58
|
+
'&:disabled:hover': {
|
|
59
|
+
background: '$neutrals400',
|
|
60
|
+
transform: 'unset',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
outlined: {
|
|
64
|
+
backgroundColor: '$background',
|
|
65
|
+
border: 1,
|
|
66
|
+
borderStyle: 'solid',
|
|
67
|
+
borderColor: '$neutrals400',
|
|
68
|
+
color: '$foreground',
|
|
69
|
+
'&:hover': {
|
|
70
|
+
borderColor: '$neutrals600',
|
|
71
|
+
},
|
|
72
|
+
'&:disabled': {
|
|
73
|
+
borderColor: '$neutrals300',
|
|
74
|
+
color: '$neutrals400',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
ghost: {
|
|
78
|
+
color: '$foreground',
|
|
79
|
+
'&:hover': {
|
|
80
|
+
backgroundColor: '$neutrals200',
|
|
81
|
+
},
|
|
82
|
+
'&:disabled': {
|
|
83
|
+
color: '$neutrals400 !important',
|
|
84
|
+
},
|
|
85
|
+
background: 'transparent',
|
|
86
|
+
border: 0,
|
|
87
|
+
|
|
88
|
+
[`& ${Typography}`]: {
|
|
89
|
+
color: 'inherit',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
fullWidth: {
|
|
94
|
+
true: {
|
|
95
|
+
width: '100%',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
loading: {
|
|
99
|
+
true: {},
|
|
100
|
+
},
|
|
101
|
+
type: {
|
|
102
|
+
primary: {},
|
|
103
|
+
error: {},
|
|
104
|
+
warning: {},
|
|
105
|
+
success: {},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
compoundVariants: [
|
|
110
|
+
{
|
|
111
|
+
type: 'primary',
|
|
112
|
+
variant: 'contained',
|
|
113
|
+
css: {
|
|
114
|
+
background: '$primary',
|
|
115
|
+
color: '$white',
|
|
116
|
+
'&:hover': {
|
|
117
|
+
background: '$primary700',
|
|
118
|
+
},
|
|
119
|
+
'&:visited': {
|
|
120
|
+
background: '$primary900',
|
|
121
|
+
},
|
|
122
|
+
'&:focus': {
|
|
123
|
+
background: '$primary600',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'primary',
|
|
129
|
+
variant: 'outlined',
|
|
130
|
+
css: {
|
|
131
|
+
color: '$primary !important',
|
|
132
|
+
borderColor: '$primary',
|
|
133
|
+
'&:hover': {
|
|
134
|
+
color: '$primary700 !important',
|
|
135
|
+
borderColor: '$primary700 !important',
|
|
136
|
+
},
|
|
137
|
+
'&:visited': {
|
|
138
|
+
color: '$primary900 !important',
|
|
139
|
+
borderColor: '$primary900 !important',
|
|
140
|
+
},
|
|
141
|
+
'&:focus': {
|
|
142
|
+
color: '$primary600 !important',
|
|
143
|
+
borderColor: '$primary600 !important',
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
type: 'primary',
|
|
149
|
+
variant: 'ghost',
|
|
150
|
+
css: {
|
|
151
|
+
color: '$primary',
|
|
152
|
+
'&:hover': {
|
|
153
|
+
color: '$primary700',
|
|
154
|
+
},
|
|
155
|
+
'&:visited': { color: '$primary900' },
|
|
156
|
+
'&:focus': {
|
|
157
|
+
color: '$primary600',
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
type: 'error',
|
|
163
|
+
variant: 'contained',
|
|
164
|
+
css: {
|
|
165
|
+
background: '$error',
|
|
166
|
+
$$color: '$colors$background',
|
|
167
|
+
[`.${darkTheme} &`]: {
|
|
168
|
+
$$color: '$colors$foreground',
|
|
169
|
+
},
|
|
170
|
+
color: '$$color !important',
|
|
171
|
+
'&:hover': {
|
|
172
|
+
background: '$error300',
|
|
173
|
+
},
|
|
174
|
+
'&:visited': {
|
|
175
|
+
background: '$error700',
|
|
176
|
+
},
|
|
177
|
+
'&:focus': {
|
|
178
|
+
background: '$error700',
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
type: 'error',
|
|
184
|
+
variant: 'outlined',
|
|
185
|
+
css: {
|
|
186
|
+
color: '$error !important',
|
|
187
|
+
borderColor: '$error',
|
|
188
|
+
'&:hover': {
|
|
189
|
+
color: '$error300 !important',
|
|
190
|
+
borderColor: '$error300 !important',
|
|
191
|
+
},
|
|
192
|
+
'&:visited': {
|
|
193
|
+
color: '$error700 !important',
|
|
194
|
+
borderColor: '$error700 !important',
|
|
195
|
+
},
|
|
196
|
+
'&:focus': {
|
|
197
|
+
color: '$error700 !important',
|
|
198
|
+
borderColor: '$error700 !important',
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
type: 'error',
|
|
204
|
+
variant: 'ghost',
|
|
205
|
+
css: {
|
|
206
|
+
color: '$error',
|
|
207
|
+
'&:hover': {
|
|
208
|
+
color: '$error300',
|
|
209
|
+
},
|
|
210
|
+
'&:visited': {
|
|
211
|
+
color: '$error700',
|
|
212
|
+
},
|
|
213
|
+
'&:focus': {
|
|
214
|
+
color: '$error700',
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
type: 'warning',
|
|
220
|
+
variant: 'contained',
|
|
221
|
+
css: {
|
|
222
|
+
background: '$warning',
|
|
223
|
+
$$color: '$colors$background',
|
|
224
|
+
[`.${darkTheme} &`]: {
|
|
225
|
+
$$color: '$colors$foreground',
|
|
226
|
+
},
|
|
227
|
+
color: '$$color !important',
|
|
228
|
+
'&:hover': {
|
|
229
|
+
background: '$warning300',
|
|
230
|
+
},
|
|
231
|
+
'&:visited': {
|
|
232
|
+
background: '$warning700',
|
|
233
|
+
},
|
|
234
|
+
'&:focus': {
|
|
235
|
+
background: '$warning700',
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
type: 'warning',
|
|
241
|
+
variant: 'outlined',
|
|
242
|
+
css: {
|
|
243
|
+
color: '$warning !important',
|
|
244
|
+
borderColor: '$warning',
|
|
245
|
+
'&:hover': {
|
|
246
|
+
color: '$warning300 !important',
|
|
247
|
+
borderColor: '$warning300 !important',
|
|
248
|
+
},
|
|
249
|
+
'&:visited': {
|
|
250
|
+
color: '$warning700 !important',
|
|
251
|
+
borderColor: '$warning700 !important',
|
|
252
|
+
},
|
|
253
|
+
'&:focus': {
|
|
254
|
+
color: '$warning700 !important',
|
|
255
|
+
borderColor: '$warning700 !important',
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
type: 'warning',
|
|
261
|
+
variant: 'ghost',
|
|
262
|
+
css: {
|
|
263
|
+
color: '$warning',
|
|
264
|
+
'&:hover': {
|
|
265
|
+
color: '$warning300',
|
|
266
|
+
},
|
|
267
|
+
'&:visited': {
|
|
268
|
+
color: '$warning700',
|
|
269
|
+
},
|
|
270
|
+
'&:focus': {
|
|
271
|
+
color: '$warning700',
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
type: 'success',
|
|
277
|
+
variant: 'contained',
|
|
278
|
+
css: {
|
|
279
|
+
background: '$success',
|
|
280
|
+
$$color: '$colors$background',
|
|
281
|
+
[`.${darkTheme} &`]: {
|
|
282
|
+
$$color: '$colors$foreground',
|
|
283
|
+
},
|
|
284
|
+
color: '$$color !important',
|
|
285
|
+
'&:hover': {
|
|
286
|
+
background: '$success300',
|
|
287
|
+
},
|
|
288
|
+
'&:visited': {
|
|
289
|
+
background: '$success700',
|
|
290
|
+
},
|
|
291
|
+
'&:focus': {
|
|
292
|
+
background: '$success700',
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
type: 'success',
|
|
298
|
+
variant: 'outlined',
|
|
299
|
+
css: {
|
|
300
|
+
color: '$success !important',
|
|
301
|
+
borderColor: '$success',
|
|
302
|
+
'&:hover': {
|
|
303
|
+
color: '$success300 !important',
|
|
304
|
+
borderColor: '$success300 !important',
|
|
305
|
+
},
|
|
306
|
+
'&:visited': {
|
|
307
|
+
color: '$success700 !important',
|
|
308
|
+
borderColor: '$success700 !important',
|
|
309
|
+
},
|
|
310
|
+
'&:focus': {
|
|
311
|
+
color: '$success700 !important',
|
|
312
|
+
borderColor: '$success700 !important',
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
type: 'success',
|
|
318
|
+
variant: 'ghost',
|
|
319
|
+
css: {
|
|
320
|
+
color: '$success',
|
|
321
|
+
'&:hover': {
|
|
322
|
+
color: '$success300',
|
|
323
|
+
},
|
|
324
|
+
'&:visited': {
|
|
325
|
+
color: '$success700',
|
|
326
|
+
},
|
|
327
|
+
'&:focus': {
|
|
328
|
+
color: '$success700',
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
size: 'compact',
|
|
334
|
+
css: {
|
|
335
|
+
padding: '$2 $4',
|
|
336
|
+
fontSize: '$12',
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
],
|
|
340
|
+
defaultVariants: {
|
|
341
|
+
size: 'medium',
|
|
342
|
+
variant: 'contained',
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
const Content = styled('div', {
|
|
347
|
+
flex: 1,
|
|
348
|
+
variants: {
|
|
349
|
+
align: {
|
|
350
|
+
start: {
|
|
351
|
+
textAlign: 'left',
|
|
352
|
+
},
|
|
353
|
+
grow: {
|
|
354
|
+
textAlign: 'center',
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
ml: {
|
|
358
|
+
true: {
|
|
359
|
+
marginLeft: '$8',
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
mr: {
|
|
363
|
+
true: {
|
|
364
|
+
marginRight: '$8',
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
flexContent: {
|
|
368
|
+
true: {
|
|
369
|
+
display: 'flex',
|
|
370
|
+
alignItems: 'center',
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
export interface PropTypes
|
|
377
|
+
extends Omit<HTMLAttributes<HTMLButtonElement>, 'prefix'> {
|
|
378
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
379
|
+
size?: 'small' | 'medium' | 'large' | 'compact' | 'free';
|
|
380
|
+
variant?: 'contained' | 'outlined' | 'ghost';
|
|
381
|
+
type?: 'primary' | 'error' | 'warning' | 'success';
|
|
382
|
+
prefix?: React.ReactNode;
|
|
383
|
+
suffix?: React.ReactNode;
|
|
384
|
+
align?: 'start' | 'grow';
|
|
385
|
+
loading?: boolean;
|
|
386
|
+
fullWidth?: boolean;
|
|
387
|
+
disabled?: boolean;
|
|
388
|
+
style?: CSSProperties;
|
|
389
|
+
flexContent?: boolean;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export function Button({
|
|
393
|
+
children,
|
|
394
|
+
loading,
|
|
395
|
+
disabled,
|
|
396
|
+
prefix,
|
|
397
|
+
suffix,
|
|
398
|
+
align,
|
|
399
|
+
flexContent,
|
|
400
|
+
...props
|
|
401
|
+
}: PropsWithChildren<PropTypes>) {
|
|
402
|
+
const isDisabled = loading || disabled;
|
|
403
|
+
return (
|
|
404
|
+
<ButtonContainer disabled={isDisabled} {...props} align={align}>
|
|
405
|
+
{prefix}
|
|
406
|
+
{children && (
|
|
407
|
+
<Content
|
|
408
|
+
align={align}
|
|
409
|
+
ml={!!prefix}
|
|
410
|
+
mr={!!suffix && !loading}
|
|
411
|
+
flexContent={flexContent}
|
|
412
|
+
className="_text"
|
|
413
|
+
>
|
|
414
|
+
{children}
|
|
415
|
+
</Content>
|
|
416
|
+
)}
|
|
417
|
+
{loading && <Spinner size={16} color={props.type} />}
|
|
418
|
+
{suffix}
|
|
419
|
+
</ButtonContainer>
|
|
420
|
+
);
|
|
421
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button } from './Button';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
import { Checkbox, PropTypes } from './Checkbox';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Checkbox',
|
|
7
|
+
component: Checkbox,
|
|
8
|
+
argTypes: {
|
|
9
|
+
label: {
|
|
10
|
+
name: 'label',
|
|
11
|
+
control: { type: 'text' },
|
|
12
|
+
defaultValue: 'I am a checkbox',
|
|
13
|
+
},
|
|
14
|
+
defaultChecked: {
|
|
15
|
+
name: 'defaultChecked',
|
|
16
|
+
control: { type: 'boolean' },
|
|
17
|
+
defaultValue: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
} as ComponentMeta<typeof Checkbox>;
|
|
21
|
+
|
|
22
|
+
export const Main = (props: PropTypes) => <Checkbox {...props} id="test" />;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { styled } from '../../theme';
|
|
3
|
+
import * as RadixCheckbox from '@radix-ui/react-checkbox';
|
|
4
|
+
import { CheckIcon } from '../Icon';
|
|
5
|
+
|
|
6
|
+
const CheckboxContainer = styled('div', {
|
|
7
|
+
display: 'flex',
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const CheckboxRoot = styled(RadixCheckbox.Root, {
|
|
12
|
+
borderRadius: '5px',
|
|
13
|
+
width: 20,
|
|
14
|
+
padding: 0,
|
|
15
|
+
height: 20,
|
|
16
|
+
border: '1px solid $foreground',
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
marginRight: '$2',
|
|
21
|
+
backgroundColor: '$neutral-100',
|
|
22
|
+
});
|
|
23
|
+
const Label = styled('label', {
|
|
24
|
+
color: '$foreground',
|
|
25
|
+
fontSize: '$m',
|
|
26
|
+
marginLeft: '$8',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export interface PropTypes {
|
|
30
|
+
id: string;
|
|
31
|
+
defaultChecked?: boolean;
|
|
32
|
+
label: string;
|
|
33
|
+
checked?: boolean;
|
|
34
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
name?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function Checkbox({
|
|
40
|
+
label,
|
|
41
|
+
id,
|
|
42
|
+
...props
|
|
43
|
+
}: PropsWithChildren<PropTypes>) {
|
|
44
|
+
return (
|
|
45
|
+
<CheckboxContainer>
|
|
46
|
+
<CheckboxRoot id={id} {...props}>
|
|
47
|
+
<RadixCheckbox.Indicator>
|
|
48
|
+
<CheckIcon size={20} />
|
|
49
|
+
</RadixCheckbox.Indicator>
|
|
50
|
+
</CheckboxRoot>
|
|
51
|
+
<Label className="_text" htmlFor={id}>
|
|
52
|
+
{label}
|
|
53
|
+
</Label>
|
|
54
|
+
</CheckboxContainer>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Checkbox } from './Checkbox';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Chip, PropTypes } from './Chip';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Chip',
|
|
8
|
+
component: Chip,
|
|
9
|
+
} as ComponentMeta<typeof Chip>;
|
|
10
|
+
|
|
11
|
+
export const Main = (args: PropTypes) => <Chip {...args} label="chip" />;
|
|
12
|
+
|
|
13
|
+
export const ChipWithPrefix = (args: PropTypes) => (
|
|
14
|
+
<Chip
|
|
15
|
+
{...args}
|
|
16
|
+
label="chip"
|
|
17
|
+
prefix={
|
|
18
|
+
<img
|
|
19
|
+
src=" https://api.rango.exchange/blockchains/binance.svg"
|
|
20
|
+
style={{ width: '20px' }}
|
|
21
|
+
/>
|
|
22
|
+
}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const ChipWithSuffix = (args: PropTypes) => (
|
|
27
|
+
<Chip
|
|
28
|
+
{...args}
|
|
29
|
+
label="chip"
|
|
30
|
+
suffix={
|
|
31
|
+
<img
|
|
32
|
+
src=" https://api.rango.exchange/blockchains/binance.svg"
|
|
33
|
+
style={{ width: '20px' }}
|
|
34
|
+
/>
|
|
35
|
+
}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { CSSProperties } from '@stitches/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { styled } from '../../theme';
|
|
4
|
+
|
|
5
|
+
const ChipCointainer = styled('div', {
|
|
6
|
+
display: 'inline-flex',
|
|
7
|
+
justifyContent: 'center',
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
borderRadius: '$5',
|
|
10
|
+
padding: '$4 $8',
|
|
11
|
+
height: '32',
|
|
12
|
+
fontSize: '$14',
|
|
13
|
+
cursor: 'pointer',
|
|
14
|
+
transition: 'all 0.35s',
|
|
15
|
+
color: '$foreground',
|
|
16
|
+
|
|
17
|
+
'&:hover': {
|
|
18
|
+
backgroundColor: '$success700',
|
|
19
|
+
color: '$background',
|
|
20
|
+
},
|
|
21
|
+
variants: {
|
|
22
|
+
selected: {
|
|
23
|
+
true: { backgroundColor: '$success', color: '$background' },
|
|
24
|
+
false: { backgroundColor: '$background' },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export interface PropTypes {
|
|
30
|
+
label: string;
|
|
31
|
+
selected?: boolean;
|
|
32
|
+
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
33
|
+
className?: string;
|
|
34
|
+
style?: CSSProperties;
|
|
35
|
+
prefix?: React.ReactNode;
|
|
36
|
+
suffix?: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function Chip(props: PropTypes) {
|
|
40
|
+
const { label, selected, prefix, suffix, onClick, style } = props;
|
|
41
|
+
return (
|
|
42
|
+
<ChipCointainer selected={selected} onClick={onClick} style={style}>
|
|
43
|
+
{prefix || null}
|
|
44
|
+
{label}
|
|
45
|
+
{suffix || null}
|
|
46
|
+
</ChipCointainer>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Chip } from './Chip';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { ComponentMeta } from '@storybook/react';
|
|
3
|
+
import { ColorPicker, PropTypes } from './ColorPicker';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/ColorPicker',
|
|
7
|
+
component: ColorPicker,
|
|
8
|
+
argTypes: {
|
|
9
|
+
place: {
|
|
10
|
+
name: 'place',
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: ['top', 'bottom', 'left', 'right'],
|
|
13
|
+
defaultValue: 'top',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
} as ComponentMeta<typeof ColorPicker>;
|
|
17
|
+
|
|
18
|
+
export const Main = (args: PropTypes) => {
|
|
19
|
+
const [color, setColor] = useState<string>('#5FA425');
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
style={{
|
|
23
|
+
height: 600,
|
|
24
|
+
display: 'flex',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<ColorPicker
|
|
30
|
+
{...args}
|
|
31
|
+
color={color}
|
|
32
|
+
onChangeColor={(color) => setColor(color.hex)}
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
};
|