@rango-dev/ui 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -86
- package/dist/index.js +6 -6
- package/dist/index.js.map +4 -4
- package/dist/translations/en.d.ts.map +1 -1
- package/dist/translations/es.d.ts.map +1 -1
- package/dist/translations/fr.d.ts.map +1 -1
- package/dist/translations/ja.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts +0 -157
- package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/BestRoute/BestRoute.d.ts +4 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.stories.d.ts +7 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.stories.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.styles.d.ts +1429 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.styles.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.types.d.ts +34 -0
- package/dist/widget/ui/src/components/BestRoute/BestRoute.types.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.d.ts +4 -0
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.styles.d.ts +319 -0
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.styles.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.types.d.ts +6 -0
- package/dist/widget/ui/src/components/BestRoute/BestRouteSkeleton.types.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/RouteSummary.d.ts +12 -0
- package/dist/widget/ui/src/components/BestRoute/RouteSummary.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/RouteSummary.styles.d.ts +158 -0
- package/dist/widget/ui/src/components/BestRoute/RouteSummary.styles.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/index.d.ts +5 -0
- package/dist/widget/ui/src/components/BestRoute/index.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BestRoute/mock.d.ts +3 -0
- package/dist/widget/ui/src/components/BestRoute/mock.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Button/Button.d.ts +54 -54
- package/dist/widget/ui/src/components/Button/Button.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Checkbox/Checkbox.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/ListItem/ListItem.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/ListItemButton/ListItemButton.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/PriceImpact/PriceImpact.styles.d.ts +0 -158
- package/dist/widget/ui/src/components/PriceImpact/PriceImpact.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Radio/Radio.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/RouteCost/RouteCost.d.ts +4 -0
- package/dist/widget/ui/src/components/RouteCost/RouteCost.d.ts.map +1 -0
- package/dist/widget/ui/src/components/RouteCost/RouteCost.styles.d.ts +158 -0
- package/dist/widget/ui/src/components/RouteCost/RouteCost.styles.d.ts.map +1 -0
- package/dist/widget/ui/src/components/{QuoteCost/QuoteCost.types.d.ts → RouteCost/RouteCost.types.d.ts} +1 -1
- package/dist/widget/ui/src/components/RouteCost/RouteCost.types.d.ts.map +1 -0
- package/dist/widget/ui/src/components/RouteCost/index.d.ts +2 -0
- package/dist/widget/ui/src/components/RouteCost/index.d.ts.map +1 -0
- package/dist/widget/ui/src/components/RoutesOverview/RoutesOverview.d.ts.map +1 -1
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +1 -1
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +2 -16
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +1 -1
- package/dist/widget/ui/src/components/SelectableCategoryList/index.d.ts +0 -1
- package/dist/widget/ui/src/components/SelectableCategoryList/index.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Skeleton/Skeleton.types.d.ts +1 -1
- package/dist/widget/ui/src/components/Skeleton/Skeleton.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/StepDetails/StepDetails.d.ts.map +1 -1
- package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts +1 -7
- package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts +2 -16
- package/dist/widget/ui/src/components/StepDetails/StepDetails.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/StepDetails/index.d.ts +1 -1
- package/dist/widget/ui/src/components/StepDetails/index.d.ts.map +1 -1
- package/dist/widget/ui/src/components/StepDetails/mock.d.ts +1 -1
- package/dist/widget/ui/src/components/StepDetails/mock.d.ts.map +1 -1
- package/dist/widget/ui/src/components/SwapListItem/mock.d.ts +1 -1
- package/dist/widget/ui/src/components/SwapListItem/mock.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Switch/Switch.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/TextField/TextField.d.ts.map +1 -1
- package/dist/widget/ui/src/components/TokenAmount/TokenAmount.d.ts.map +1 -1
- package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts +1 -471
- package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts +2 -2
- package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Wallet/Wallet.types.d.ts +17 -3
- package/dist/widget/ui/src/components/Wallet/Wallet.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/common/Image.d.ts +0 -157
- package/dist/widget/ui/src/components/common/Image.d.ts.map +1 -1
- package/dist/widget/ui/src/components/common/index.d.ts +1 -1
- package/dist/widget/ui/src/components/common/index.d.ts.map +1 -1
- package/dist/widget/ui/src/components/index.d.ts +2 -1
- package/dist/widget/ui/src/components/index.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/BlockchainSelector/BlockchainSelector.d.ts +3 -3
- package/dist/widget/ui/src/containers/BlockchainSelector/BlockchainSelector.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/History/types.d.ts +2 -0
- package/dist/widget/ui/src/containers/History/types.d.ts.map +1 -0
- package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.d.ts +1 -1
- package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.stories.d.ts +2 -2
- package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.stories.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapHistory/mock.d.ts +1 -1
- package/dist/widget/ui/src/containers/SwapHistory/mock.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts +54 -1313
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.types.d.ts +0 -2
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.types.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/TokenSection.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts +54 -525
- package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/TokenSelector/TokenSelector.d.ts +2 -2
- package/dist/widget/ui/src/containers/TokenSelector/TokenSelector.d.ts.map +1 -1
- package/dist/widget/ui/src/{utils → helper}/index.d.ts +3 -0
- package/dist/widget/ui/src/helper/index.d.ts.map +1 -0
- package/dist/widget/ui/src/icons/Icons.stories.d.ts +1 -1
- package/dist/widget/ui/src/icons/index.d.ts +0 -5
- package/dist/widget/ui/src/icons/index.d.ts.map +1 -1
- package/dist/widget/ui/src/index.d.ts +1 -0
- package/dist/widget/ui/src/index.d.ts.map +1 -1
- package/dist/widget/ui/src/types/index.d.ts +1 -0
- package/dist/widget/ui/src/types/index.d.ts.map +1 -1
- package/dist/widget/ui/src/types/swaps.d.ts +27 -1
- package/dist/widget/ui/src/types/swaps.d.ts.map +1 -1
- package/package.json +5 -6
- package/src/components/Alert/Alert.styles.ts +12 -9
- package/src/components/Alert/Alert.tsx +2 -2
- package/src/components/BestRoute/BestRoute.stories.tsx +17 -0
- package/src/components/BestRoute/BestRoute.styles.ts +213 -0
- package/src/components/BestRoute/BestRoute.tsx +176 -0
- package/src/components/BestRoute/BestRoute.types.ts +32 -0
- package/src/components/BestRoute/BestRouteSkeleton.styles.ts +110 -0
- package/src/components/BestRoute/BestRouteSkeleton.tsx +112 -0
- package/src/components/BestRoute/BestRouteSkeleton.types.ts +5 -0
- package/src/components/BestRoute/RouteSummary.styles.ts +15 -0
- package/src/components/BestRoute/RouteSummary.tsx +48 -0
- package/src/components/BestRoute/index.ts +4 -0
- package/src/components/BestRoute/mock.ts +142 -0
- package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +1 -2
- package/src/components/Button/Button.styles.tsx +0 -1
- package/src/components/Checkbox/Checkbox.styles.ts +1 -5
- package/src/components/ListItem/ListItem.styles.ts +0 -9
- package/src/components/ListItem/ListItem.tsx +1 -1
- package/src/components/ListItemButton/ListItemButton.styles.ts +0 -1
- package/src/components/PriceImpact/PriceImpact.styles.ts +1 -9
- package/src/components/PriceImpact/PriceImpact.tsx +5 -5
- package/src/components/Radio/Radio.styles.tsx +2 -5
- package/src/components/RouteCost/RouteCost.styles.ts +20 -0
- package/src/components/{QuoteCost/QuoteCost.tsx → RouteCost/RouteCost.tsx} +10 -14
- package/src/components/RouteCost/index.ts +1 -0
- package/src/components/RoutesOverview/RoutesOverview.tsx +2 -6
- package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +13 -40
- package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +46 -47
- package/src/components/SelectableCategoryList/index.ts +0 -1
- package/src/components/SelectableWalletList/SelectableWalletList.tsx +1 -1
- package/src/components/Skeleton/Skeleton.tsx +2 -3
- package/src/components/Skeleton/Skeleton.types.ts +1 -1
- package/src/components/StepDetails/StepDetails.stories.tsx +1 -1
- package/src/components/StepDetails/StepDetails.styles.ts +28 -36
- package/src/components/StepDetails/StepDetails.tsx +7 -11
- package/src/components/StepDetails/StepDetails.types.ts +2 -17
- package/src/components/StepDetails/index.ts +1 -1
- package/src/components/StepDetails/mock.ts +1 -1
- package/src/components/SvgIcon/SvgIcon.style.ts +1 -1
- package/src/components/SwapListItem/mock.ts +6 -21
- package/src/components/Switch/Switch.styles.tsx +6 -8
- package/src/components/TextField/TextField.tsx +5 -3
- package/src/components/TokenAmount/TokenAmount.styles.ts +10 -12
- package/src/components/TokenAmount/TokenAmount.tsx +17 -23
- package/src/components/Tooltip/Tooltip.styles.ts +5 -8
- package/src/components/Tooltip/Tooltip.tsx +3 -2
- package/src/components/Wallet/Wallet.styles.ts +1 -1
- package/src/components/Wallet/Wallet.types.ts +23 -3
- package/src/components/common/Image.tsx +2 -1
- package/src/components/common/index.ts +1 -1
- package/src/components/index.ts +2 -1
- package/src/containers/BlockchainSelector/BlockchainSelector.tsx +8 -9
- package/src/containers/History/types.tsx +1 -0
- package/src/containers/SwapHistory/SwapHistory.stories.tsx +2 -5
- package/src/containers/SwapHistory/SwapHistory.tsx +1 -1
- package/src/containers/SwapHistory/mock.ts +8 -24
- package/src/containers/SwapInput/SwapInput.styles.ts +27 -78
- package/src/containers/SwapInput/SwapInput.tsx +29 -37
- package/src/containers/SwapInput/SwapInput.types.ts +0 -2
- package/src/containers/SwapInput/TokenSection.styles.ts +12 -27
- package/src/containers/SwapInput/TokenSection.tsx +6 -15
- package/src/containers/TokenSelector/TokenSelector.tsx +10 -8
- package/src/helper/index.ts +99 -0
- package/src/icons/index.ts +0 -5
- package/src/index.ts +1 -0
- package/src/theme.ts +4 -4
- package/src/types/index.ts +1 -0
- package/src/types/swaps.ts +38 -0
- package/dist/widget/ui/src/components/QuoteCost/QuoteCost.d.ts +0 -4
- package/dist/widget/ui/src/components/QuoteCost/QuoteCost.d.ts.map +0 -1
- package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts +0 -629
- package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts.map +0 -1
- package/dist/widget/ui/src/components/QuoteCost/QuoteCost.types.d.ts.map +0 -1
- package/dist/widget/ui/src/components/QuoteCost/index.d.ts +0 -2
- package/dist/widget/ui/src/components/QuoteCost/index.d.ts.map +0 -1
- package/dist/widget/ui/src/icons/CosmosCategory.d.ts +0 -5
- package/dist/widget/ui/src/icons/CosmosCategory.d.ts.map +0 -1
- package/dist/widget/ui/src/icons/EvmCategory.d.ts +0 -5
- package/dist/widget/ui/src/icons/EvmCategory.d.ts.map +0 -1
- package/dist/widget/ui/src/icons/Language.d.ts +0 -5
- package/dist/widget/ui/src/icons/Language.d.ts.map +0 -1
- package/dist/widget/ui/src/icons/OtherCategory.d.ts +0 -5
- package/dist/widget/ui/src/icons/OtherCategory.d.ts.map +0 -1
- package/dist/widget/ui/src/icons/UtxoCategory.d.ts +0 -5
- package/dist/widget/ui/src/icons/UtxoCategory.d.ts.map +0 -1
- package/dist/widget/ui/src/utils/index.d.ts.map +0 -1
- package/src/components/QuoteCost/QuoteCost.styles.ts +0 -29
- package/src/components/QuoteCost/index.ts +0 -1
- package/src/icons/CosmosCategory.tsx +0 -137
- package/src/icons/EvmCategory.tsx +0 -74
- package/src/icons/Language.tsx +0 -55
- package/src/icons/OtherCategory.tsx +0 -72
- package/src/icons/UtxoCategory.tsx +0 -44
- package/src/utils/index.ts +0 -23
- /package/src/components/{QuoteCost/QuoteCost.types.ts → RouteCost/RouteCost.types.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SvgIconProps } from '../components/SvgIcon';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
|
3
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, any> | import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const Main: (props: SvgIconProps) => React.JSX.Element;
|
|
6
6
|
//# sourceMappingURL=Icons.stories.d.ts.map
|
|
@@ -7,13 +7,11 @@ export { default as ChevronUpIcon } from './ChevronUp';
|
|
|
7
7
|
export { default as CloseIcon } from './Close';
|
|
8
8
|
export { default as CompleteIcon } from './Complete';
|
|
9
9
|
export { default as CopyIcon } from './Copy';
|
|
10
|
-
export { default as CosmosCategoryIcon } from './CosmosCategory';
|
|
11
10
|
export { default as CustomColorsIcon } from './CustomColors';
|
|
12
11
|
export { default as DarkModeIcon } from './DarkMode';
|
|
13
12
|
export { default as DeleteIcon } from './Delete';
|
|
14
13
|
export { default as DesktopIcon } from './Desktop';
|
|
15
14
|
export { default as DoneIcon } from './Done';
|
|
16
|
-
export { default as EvmCategoryIcon } from './EvmCategory';
|
|
17
15
|
export { default as ErrorIcon } from './Error';
|
|
18
16
|
export { default as ExternalLinkIcon } from './ExternalLink';
|
|
19
17
|
export { default as FontIcon } from './Font';
|
|
@@ -21,7 +19,6 @@ export { default as GasIcon } from './Gas';
|
|
|
21
19
|
export { default as InProgressIcon } from './InProgress';
|
|
22
20
|
export { default as InfoErrorIcon } from './InfoError';
|
|
23
21
|
export { default as InfoIcon } from './Info';
|
|
24
|
-
export { default as LanguageIcon } from './Language';
|
|
25
22
|
export { default as LightModeIcon } from './LightMode';
|
|
26
23
|
export { default as LinkIcon } from './Link';
|
|
27
24
|
export { default as LoadingIcon } from './Loading';
|
|
@@ -32,7 +29,6 @@ export { default as NoNotificationIcon } from './NoNotification';
|
|
|
32
29
|
export { default as NotificationNumberIcon } from './NotificationNumber';
|
|
33
30
|
export { default as NotificationsIcon } from './Notifications';
|
|
34
31
|
export { default as NumberIcon } from './Number';
|
|
35
|
-
export { default as OtherCategoryIcon } from './OtherCategory';
|
|
36
32
|
export { default as PinIcon } from './Pin';
|
|
37
33
|
export { default as RefreshIcon } from './Refresh';
|
|
38
34
|
export { default as ReverseIcon } from './Reverse';
|
|
@@ -40,7 +36,6 @@ export { default as RouteIcon } from './Route';
|
|
|
40
36
|
export { default as SearchIcon } from './Search';
|
|
41
37
|
export { default as TimeIcon } from './Time';
|
|
42
38
|
export { default as TransactionIcon } from './Transaction';
|
|
43
|
-
export { default as UtxoCategoryIcon } from './UtxoCategory';
|
|
44
39
|
export { default as WalletIcon } from './Wallet';
|
|
45
40
|
export { default as WarningIcon } from './Warning';
|
|
46
41
|
export { default as ChainsIcon } from './Chains';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/icons/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/icons/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
import type { BlockchainValidationStatus, WalletRequiredAssets } from 'rango-sdk';
|
|
1
|
+
import type { BestRouteResponse, BlockchainValidationStatus, SimulationResult, SwapResult, WalletRequiredAssets } from 'rango-sdk';
|
|
2
|
+
export type SwapStatus = 'running' | 'failed' | 'success';
|
|
3
|
+
export type MessageSeverity = 'error' | 'warning' | 'info' | 'success';
|
|
4
|
+
export type StepStatus = 'created' | 'running' | 'failed' | 'success' | 'waitingForApproval' | 'approved';
|
|
5
|
+
export declare enum PendingSwapNetworkStatus {
|
|
6
|
+
WaitingForConnectingWallet = "waitingForConnectingWallet",
|
|
7
|
+
WaitingForQueue = "waitingForQueue",
|
|
8
|
+
WaitingForNetworkChange = "waitingForNetworkChange",
|
|
9
|
+
NetworkChanged = "networkChanged"
|
|
10
|
+
}
|
|
11
|
+
export type WalletTypeAndAddress = {
|
|
12
|
+
walletType: string;
|
|
13
|
+
address: string;
|
|
14
|
+
};
|
|
15
|
+
export type SwapSavedSettings = {
|
|
16
|
+
slippage: string;
|
|
17
|
+
disabledSwappersIds: string[];
|
|
18
|
+
disabledSwappersGroups: string[];
|
|
19
|
+
};
|
|
2
20
|
export type SimulationAssetAndAmount = WalletRequiredAssets;
|
|
3
21
|
export type SimulationValidationStatus = BlockchainValidationStatus;
|
|
22
|
+
export type BestRouteType = BestRouteResponse;
|
|
23
|
+
export type BestRouteWithFee = Omit<BestRouteResponse, 'result'> & {
|
|
24
|
+
result: Omit<SimulationResult, 'swaps'> & {
|
|
25
|
+
swaps: (SwapResult & {
|
|
26
|
+
feeInUsd?: string;
|
|
27
|
+
})[];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
4
30
|
//# sourceMappingURL=swaps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swaps.d.ts","sourceRoot":"","sources":["../../../../../src/types/swaps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,oBAAoB,EACrB,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAC5D,MAAM,MAAM,0BAA0B,GAAG,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"swaps.d.ts","sourceRoot":"","sources":["../../../../../src/types/swaps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,0BAA0B,EAC1B,gBAAgB,EAChB,UAAU,EACV,oBAAoB,EACrB,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC1D,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvE,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,SAAS,GACT,QAAQ,GACR,SAAS,GACT,oBAAoB,GACpB,UAAU,CAAC;AAEf,oBAAY,wBAAwB;IAClC,0BAA0B,+BAA+B;IACzD,eAAe,oBAAoB;IACnC,uBAAuB,4BAA4B;IACnD,cAAc,mBAAmB;CAClC;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,sBAAsB,EAAE,MAAM,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAC5D,MAAM,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AACpE,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAE9C,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,GAAG;IACjE,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,GAAG;QACxC,KAAK,EAAE,CAAC,UAAU,GAAG;YAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,EAAE,CAAC;KAC/C,CAAC;CACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"exports": "./dist/index.js",
|
|
9
9
|
"typings": "dist/widget/ui/src/index.d.ts",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"dev": "yarn bundle --watch",
|
|
16
16
|
"build": "node ../../scripts/build/command.mjs --path widget/ui",
|
|
17
|
-
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
|
|
18
17
|
"build:icons": "svgr svgs/resources/fill --config-file svgs/configs/.svgrrc.default.cjs",
|
|
19
18
|
"type-checking": "tsc --declaration --emitDeclarationOnly",
|
|
20
19
|
"storybook": "storybook dev -p 3000",
|
|
@@ -26,6 +25,7 @@
|
|
|
26
25
|
"peerDependencies": {
|
|
27
26
|
"@lingui/core": "4.2.1",
|
|
28
27
|
"@lingui/react": "4.2.1",
|
|
28
|
+
"@rango-dev/queue-manager-rango-preset": "*",
|
|
29
29
|
"react": ">=16"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -65,10 +65,9 @@
|
|
|
65
65
|
"@radix-ui/react-radio-group": "^1.1.1",
|
|
66
66
|
"@radix-ui/react-switch": "^1.0.1",
|
|
67
67
|
"@radix-ui/react-tooltip": "^1.0.2",
|
|
68
|
-
"@rango-dev/wallets-shared": "^0.
|
|
68
|
+
"@rango-dev/wallets-shared": "^0.23.0",
|
|
69
69
|
"@stitches/react": "^1.2.8",
|
|
70
|
-
"rango-sdk": "^0.1.
|
|
71
|
-
"rango-types": "^0.1.57",
|
|
70
|
+
"rango-sdk": "^0.1.35",
|
|
72
71
|
"react-virtualized-auto-sizer": "^1.0.7",
|
|
73
72
|
"react-window": "^1.8.8",
|
|
74
73
|
"react-window-infinite-loader": "^1.0.8",
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { darkTheme, styled } from '../../theme';
|
|
2
2
|
|
|
3
3
|
export const Container = styled('div', {
|
|
4
4
|
display: 'flex',
|
|
5
5
|
flexDirection: 'column',
|
|
6
6
|
borderRadius: '$xs',
|
|
7
7
|
|
|
8
|
+
'.title': {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
flex: '1 0 0',
|
|
12
|
+
},
|
|
13
|
+
|
|
8
14
|
'.title_typography:first-letter': {
|
|
9
15
|
textTransform: 'uppercase',
|
|
10
16
|
},
|
|
@@ -14,7 +20,11 @@ export const Container = styled('div', {
|
|
|
14
20
|
paddingLeft: '$24',
|
|
15
21
|
},
|
|
16
22
|
'.description': {
|
|
17
|
-
color: '$neutral700',
|
|
23
|
+
$$color: '$colors$neutral700',
|
|
24
|
+
[`.${darkTheme} &`]: {
|
|
25
|
+
$$color: '$colors$neutral600',
|
|
26
|
+
},
|
|
27
|
+
color: '$$color',
|
|
18
28
|
fontSize: '$10',
|
|
19
29
|
lineHeight: '$12',
|
|
20
30
|
},
|
|
@@ -114,7 +124,6 @@ export const IconHighlight = styled('div', {
|
|
|
114
124
|
justifyContent: 'center',
|
|
115
125
|
alignItems: 'center',
|
|
116
126
|
alignSelf: 'flex-start',
|
|
117
|
-
flexShrink: 0,
|
|
118
127
|
variants: {
|
|
119
128
|
type: {
|
|
120
129
|
success: {
|
|
@@ -155,9 +164,3 @@ export const IconHighlight = styled('div', {
|
|
|
155
164
|
},
|
|
156
165
|
},
|
|
157
166
|
});
|
|
158
|
-
|
|
159
|
-
export const titleStyles = css({
|
|
160
|
-
display: 'flex',
|
|
161
|
-
alignItems: 'center',
|
|
162
|
-
flex: '1 0 0',
|
|
163
|
-
});
|
|
@@ -7,7 +7,7 @@ import { Divider } from '../Divider';
|
|
|
7
7
|
import { Typography } from '../Typography';
|
|
8
8
|
|
|
9
9
|
import { getColor } from './Alert.helpers';
|
|
10
|
-
import { Container, IconHighlight, Main
|
|
10
|
+
import { Container, IconHighlight, Main } from './Alert.styles';
|
|
11
11
|
import AlertIcon from './AlertIcon';
|
|
12
12
|
|
|
13
13
|
export function Alert(props: PropsWithChildren<PropTypes>) {
|
|
@@ -28,7 +28,7 @@ export function Alert(props: PropsWithChildren<PropTypes>) {
|
|
|
28
28
|
type={type}
|
|
29
29
|
variant={variant}>
|
|
30
30
|
<Main variant={variant}>
|
|
31
|
-
<div className=
|
|
31
|
+
<div className="title">
|
|
32
32
|
<IconHighlight type={type}>
|
|
33
33
|
<AlertIcon type={type} />
|
|
34
34
|
</IconHighlight>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { BestRoute } from './BestRoute';
|
|
4
|
+
import { route1 } from './mock';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof BestRoute> = {
|
|
7
|
+
component: BestRoute,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof BestRoute>;
|
|
12
|
+
|
|
13
|
+
export const Main: Story = {
|
|
14
|
+
args: {
|
|
15
|
+
...route1,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import * as Collapsible from '@radix-ui/react-collapsible';
|
|
2
|
+
|
|
3
|
+
import { darkTheme, styled } from '../../theme';
|
|
4
|
+
import { Image } from '../common';
|
|
5
|
+
import { CollapsibleContent } from '../common/styles';
|
|
6
|
+
|
|
7
|
+
export const EXPANDABLE_ROUTES_TRANSITION_DURATION = 300;
|
|
8
|
+
|
|
9
|
+
export const RouteContainer = styled(Collapsible.Root, {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
alignItems: 'start',
|
|
13
|
+
overflowX: 'auto',
|
|
14
|
+
overflowY: 'hidden',
|
|
15
|
+
width: '100%',
|
|
16
|
+
borderRadius: '$xm',
|
|
17
|
+
variants: {
|
|
18
|
+
recommended: {
|
|
19
|
+
true: {
|
|
20
|
+
$$color: '$colors$info300',
|
|
21
|
+
[`.${darkTheme} &`]: {
|
|
22
|
+
$$color: '$colors$secondary800',
|
|
23
|
+
},
|
|
24
|
+
backgroundColor: '$$color',
|
|
25
|
+
},
|
|
26
|
+
false: {
|
|
27
|
+
$$color: '$colors$neutral400',
|
|
28
|
+
[`.${darkTheme} &`]: {
|
|
29
|
+
$$color: '$colors$neutral200',
|
|
30
|
+
},
|
|
31
|
+
backgroundColor: '$$color',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
'& .steps-details': {
|
|
36
|
+
padding: '$10 $15',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const SummaryContainer = styled('div', {
|
|
41
|
+
borderRadius: '$xm',
|
|
42
|
+
display: 'flex',
|
|
43
|
+
flexDirection: 'column',
|
|
44
|
+
alignItems: 'start',
|
|
45
|
+
justifyContent: 'space-between',
|
|
46
|
+
color: '$foreground',
|
|
47
|
+
cursor: 'pointer',
|
|
48
|
+
boxSizing: 'border-box',
|
|
49
|
+
position: 'relative',
|
|
50
|
+
variants: {
|
|
51
|
+
recommended: {
|
|
52
|
+
true: {
|
|
53
|
+
$$color: '$colors$info100',
|
|
54
|
+
[`.${darkTheme} &`]: {
|
|
55
|
+
$$color: '$colors$secondary600',
|
|
56
|
+
},
|
|
57
|
+
backgroundColor: '$$color',
|
|
58
|
+
'&:hover': {
|
|
59
|
+
backgroundColor: '$$color',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
false: {
|
|
63
|
+
$$color: '$colors$neutral200',
|
|
64
|
+
[`.${darkTheme} &`]: {
|
|
65
|
+
$$color: '$colors$neutral500',
|
|
66
|
+
},
|
|
67
|
+
backgroundColor: '$$color',
|
|
68
|
+
'&:hover': {
|
|
69
|
+
backgroundColor: '$$color',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
basic: { true: { borderTopRightRadius: '0', borderTopLeftRadius: '0' } },
|
|
74
|
+
listItem: {
|
|
75
|
+
true: {},
|
|
76
|
+
false: {},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
compoundVariants: [
|
|
81
|
+
{
|
|
82
|
+
listItem: true,
|
|
83
|
+
recommended: true,
|
|
84
|
+
css: {
|
|
85
|
+
'&:hover': {
|
|
86
|
+
$$color: '$colors$secondary200',
|
|
87
|
+
[`.${darkTheme} &`]: {
|
|
88
|
+
$$color: '$colors$secondary700',
|
|
89
|
+
},
|
|
90
|
+
backgroundColor: '$$color',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
listItem: true,
|
|
96
|
+
recommended: false,
|
|
97
|
+
css: {
|
|
98
|
+
'&:hover': {
|
|
99
|
+
$$color: '$colors$neutral300',
|
|
100
|
+
[`.${darkTheme} &`]: {
|
|
101
|
+
$$color: '$colors$neutral400',
|
|
102
|
+
},
|
|
103
|
+
backgroundColor: '$$color',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
'& .summary': {
|
|
109
|
+
width: '100%',
|
|
110
|
+
padding: '$15 $15 $10 $15',
|
|
111
|
+
},
|
|
112
|
+
'& .basic-info': {
|
|
113
|
+
paddingTop: '$10',
|
|
114
|
+
display: 'flex',
|
|
115
|
+
alignItems: 'center',
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
export const Chains = styled(Collapsible.Trigger, {
|
|
120
|
+
display: 'flex',
|
|
121
|
+
width: '100%',
|
|
122
|
+
justifyContent: 'space-between',
|
|
123
|
+
alignItems: 'center',
|
|
124
|
+
height: '$36',
|
|
125
|
+
padding: '$10 $15',
|
|
126
|
+
boxSizing: 'border-box',
|
|
127
|
+
cursor: 'pointer',
|
|
128
|
+
border: 'none',
|
|
129
|
+
outline: 'none',
|
|
130
|
+
backgroundColor: 'transparent',
|
|
131
|
+
variants: {
|
|
132
|
+
error: {
|
|
133
|
+
true: {
|
|
134
|
+
[`& ${Image}`]: {
|
|
135
|
+
border: '1px $warning500 solid',
|
|
136
|
+
borderRadius: '100%',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
false: {
|
|
140
|
+
[`& ${Image}`]: {
|
|
141
|
+
border: '1px transparent solid',
|
|
142
|
+
borderRadius: '100%',
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
recommended: {
|
|
147
|
+
true: {
|
|
148
|
+
$$color: '$colors$info300',
|
|
149
|
+
[`.${darkTheme} &`]: {
|
|
150
|
+
$$color: '$colors$secondary800',
|
|
151
|
+
},
|
|
152
|
+
backgroundColor: '$$color',
|
|
153
|
+
},
|
|
154
|
+
false: {
|
|
155
|
+
$$color: '$colors$neutral400',
|
|
156
|
+
[`.${darkTheme} &`]: {
|
|
157
|
+
$$color: '$colors$neutral200',
|
|
158
|
+
},
|
|
159
|
+
backgroundColor: '$$color',
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
'& div:nth-child(1)': { display: 'flex' },
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
export const Content = styled(CollapsibleContent, {
|
|
167
|
+
width: '100%',
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
export const IconContainer = styled('div', {
|
|
171
|
+
display: 'flex',
|
|
172
|
+
justifyContent: 'center',
|
|
173
|
+
alignItems: 'center',
|
|
174
|
+
padding: '$2',
|
|
175
|
+
transition: `all ${EXPANDABLE_ROUTES_TRANSITION_DURATION}ms ease`,
|
|
176
|
+
variants: {
|
|
177
|
+
orientation: {
|
|
178
|
+
down: {
|
|
179
|
+
transform: 'rotate(0)',
|
|
180
|
+
},
|
|
181
|
+
up: {
|
|
182
|
+
transform: 'rotate(180deg)',
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
export const Separator = styled('div', {
|
|
189
|
+
height: '$12',
|
|
190
|
+
marginLeft: '$10',
|
|
191
|
+
marginRight: '$10',
|
|
192
|
+
borderLeft: '1px solid $foreground',
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
export const HorizontalSeparator = styled('div', {
|
|
196
|
+
display: 'flex',
|
|
197
|
+
justifyContent: 'center',
|
|
198
|
+
margin: '0 $15',
|
|
199
|
+
borderTop: '1px solid',
|
|
200
|
+
$$color: '$colors$neutral300',
|
|
201
|
+
[`.${darkTheme} &`]: {
|
|
202
|
+
$$color: '$colors$neutral400',
|
|
203
|
+
},
|
|
204
|
+
borderColor: '$$color',
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
export const FrameIcon = styled('div', {
|
|
208
|
+
width: '$16',
|
|
209
|
+
height: '$16',
|
|
210
|
+
justifyContent: 'center',
|
|
211
|
+
alignItems: 'center',
|
|
212
|
+
display: 'flex',
|
|
213
|
+
});
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import type { BestRouteProps } from './BestRoute.types';
|
|
2
|
+
|
|
3
|
+
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { Typography } from '../../components/Typography';
|
|
6
|
+
import { ChevronDownIcon, ChevronRightIcon, InfoIcon } from '../../icons';
|
|
7
|
+
import { Image } from '../common';
|
|
8
|
+
import { Divider } from '../Divider';
|
|
9
|
+
import { RouteCost } from '../RouteCost';
|
|
10
|
+
import { StepDetails } from '../StepDetails';
|
|
11
|
+
import { TokenAmount } from '../TokenAmount/TokenAmount';
|
|
12
|
+
import { Tooltip } from '../Tooltip';
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
Chains,
|
|
16
|
+
Content,
|
|
17
|
+
EXPANDABLE_ROUTES_TRANSITION_DURATION,
|
|
18
|
+
FrameIcon,
|
|
19
|
+
HorizontalSeparator,
|
|
20
|
+
IconContainer,
|
|
21
|
+
RouteContainer,
|
|
22
|
+
SummaryContainer,
|
|
23
|
+
} from './BestRoute.styles';
|
|
24
|
+
import { RouteSummary } from './RouteSummary';
|
|
25
|
+
|
|
26
|
+
export function BestRoute(props: BestRouteProps) {
|
|
27
|
+
const {
|
|
28
|
+
steps,
|
|
29
|
+
totalFee,
|
|
30
|
+
totalTime,
|
|
31
|
+
input,
|
|
32
|
+
output,
|
|
33
|
+
percentageChange,
|
|
34
|
+
warningLevel,
|
|
35
|
+
type,
|
|
36
|
+
recommended = true,
|
|
37
|
+
} = props;
|
|
38
|
+
|
|
39
|
+
const numberOfSteps = steps.length;
|
|
40
|
+
|
|
41
|
+
const [expanded, setExpanded] = useState(props.expanded);
|
|
42
|
+
const routeRef = useRef<HTMLButtonElement | null>(null);
|
|
43
|
+
|
|
44
|
+
useLayoutEffect(() => {
|
|
45
|
+
if (expanded && routeRef.current) {
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
routeRef?.current?.scrollIntoView({ behavior: 'smooth' });
|
|
48
|
+
}, EXPANDABLE_ROUTES_TRANSITION_DURATION);
|
|
49
|
+
}
|
|
50
|
+
}, [expanded]);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<>
|
|
54
|
+
<SummaryContainer
|
|
55
|
+
recommended={recommended}
|
|
56
|
+
listItem={type === 'list-item'}
|
|
57
|
+
basic={type === 'basic'}>
|
|
58
|
+
<div className="summary">
|
|
59
|
+
<RouteCost fee={totalFee} time={totalTime} steps={numberOfSteps} />
|
|
60
|
+
{type === 'basic' && (
|
|
61
|
+
<div className="basic-info">
|
|
62
|
+
<FrameIcon>
|
|
63
|
+
<InfoIcon size={12} color="gray" />
|
|
64
|
+
</FrameIcon>
|
|
65
|
+
<Typography
|
|
66
|
+
size="small"
|
|
67
|
+
variant="body"
|
|
68
|
+
style={{ letterSpacing: 0.4 }}>
|
|
69
|
+
{`${input.value} ${steps[0].from.token.displayName} = ${
|
|
70
|
+
output.value
|
|
71
|
+
} ${steps[steps.length - 1].to.token.displayName}`}
|
|
72
|
+
</Typography>
|
|
73
|
+
<Typography
|
|
74
|
+
color="$neutral600"
|
|
75
|
+
ml={2}
|
|
76
|
+
size="xsmall"
|
|
77
|
+
variant="body">
|
|
78
|
+
{`($${output.usdValue})`}
|
|
79
|
+
</Typography>
|
|
80
|
+
</div>
|
|
81
|
+
)}
|
|
82
|
+
{type === 'list-item' && (
|
|
83
|
+
<TokenAmount
|
|
84
|
+
type="output"
|
|
85
|
+
direction="vertical"
|
|
86
|
+
price={{ value: output.value, usdValue: output.usdValue }}
|
|
87
|
+
token={{
|
|
88
|
+
displayName: steps[numberOfSteps - 1].to.token.displayName,
|
|
89
|
+
image: steps[numberOfSteps - 1].to.token.image,
|
|
90
|
+
}}
|
|
91
|
+
chain={{ image: steps[numberOfSteps - 1].to.chain.image }}
|
|
92
|
+
percentageChange={percentageChange}
|
|
93
|
+
warningLevel={warningLevel}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
96
|
+
{type === 'swap-preview' && (
|
|
97
|
+
<>
|
|
98
|
+
<RouteSummary
|
|
99
|
+
from={steps[0].from}
|
|
100
|
+
to={steps[numberOfSteps - 1].to}
|
|
101
|
+
percentageChange={percentageChange}
|
|
102
|
+
warningLevel={warningLevel}
|
|
103
|
+
/>
|
|
104
|
+
<Divider size={4} />
|
|
105
|
+
</>
|
|
106
|
+
)}
|
|
107
|
+
</div>
|
|
108
|
+
<RouteContainer
|
|
109
|
+
recommended={recommended}
|
|
110
|
+
open={expanded}
|
|
111
|
+
onOpenChange={setExpanded}>
|
|
112
|
+
<Chains
|
|
113
|
+
ref={(ref) => (routeRef.current = ref)}
|
|
114
|
+
recommended={recommended}
|
|
115
|
+
onClick={setExpanded.bind(null, (prevState) => !prevState)}>
|
|
116
|
+
<div>
|
|
117
|
+
{steps.map((step, index) => {
|
|
118
|
+
const key = `item-${index}`;
|
|
119
|
+
return (
|
|
120
|
+
<React.Fragment key={key}>
|
|
121
|
+
<Tooltip
|
|
122
|
+
container={props.tooltipContainer}
|
|
123
|
+
side="bottom"
|
|
124
|
+
sideOffset={4}
|
|
125
|
+
content={step.from.chain.displayName}>
|
|
126
|
+
<Image src={step.from.chain.image} size={16} />
|
|
127
|
+
</Tooltip>
|
|
128
|
+
{index === numberOfSteps - 1 && (
|
|
129
|
+
<>
|
|
130
|
+
<IconContainer>
|
|
131
|
+
<ChevronRightIcon size={12} color="black" />
|
|
132
|
+
</IconContainer>
|
|
133
|
+
<Tooltip
|
|
134
|
+
container={props.tooltipContainer}
|
|
135
|
+
side="bottom"
|
|
136
|
+
sideOffset={4}
|
|
137
|
+
content={step.to.chain.displayName}>
|
|
138
|
+
<Image src={step.to.chain.image} size={16} />
|
|
139
|
+
</Tooltip>
|
|
140
|
+
</>
|
|
141
|
+
)}
|
|
142
|
+
{index !== numberOfSteps - 1 && (
|
|
143
|
+
<IconContainer>
|
|
144
|
+
<ChevronRightIcon size={12} color="black" />
|
|
145
|
+
</IconContainer>
|
|
146
|
+
)}
|
|
147
|
+
</React.Fragment>
|
|
148
|
+
);
|
|
149
|
+
})}
|
|
150
|
+
</div>
|
|
151
|
+
<IconContainer orientation={expanded ? 'up' : 'down'}>
|
|
152
|
+
<ChevronDownIcon size={12} color="black" />
|
|
153
|
+
</IconContainer>
|
|
154
|
+
</Chains>
|
|
155
|
+
<Content open={expanded}>
|
|
156
|
+
<HorizontalSeparator />
|
|
157
|
+
<div className="steps-details">
|
|
158
|
+
{steps.map((step, index) => {
|
|
159
|
+
const key = `item-${index}`;
|
|
160
|
+
return (
|
|
161
|
+
<StepDetails
|
|
162
|
+
type="route-details"
|
|
163
|
+
key={key}
|
|
164
|
+
step={step}
|
|
165
|
+
hasSeparator={index !== steps.length - 1}
|
|
166
|
+
state={step.alerts ? 'error' : undefined}
|
|
167
|
+
/>
|
|
168
|
+
);
|
|
169
|
+
})}
|
|
170
|
+
</div>
|
|
171
|
+
</Content>
|
|
172
|
+
</RouteContainer>
|
|
173
|
+
</SummaryContainer>
|
|
174
|
+
</>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SwapInputProps } from '../../containers/SwapInput/SwapInput.types';
|
|
2
|
+
import type { PriceImpactProps } from '../PriceImpact/PriceImpact.types';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
type BaseStep = Pick<SwapInputProps, 'chain' | 'token' | 'price'>;
|
|
6
|
+
|
|
7
|
+
export type Step = {
|
|
8
|
+
swapper: SwapInputProps['chain'];
|
|
9
|
+
from: BaseStep;
|
|
10
|
+
to: BaseStep;
|
|
11
|
+
error?: {
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
};
|
|
15
|
+
alerts?: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type BestRouteProps = Pick<
|
|
19
|
+
PriceImpactProps,
|
|
20
|
+
'percentageChange' | 'warningLevel'
|
|
21
|
+
> & {
|
|
22
|
+
type: 'basic' | 'list-item' | 'swap-preview';
|
|
23
|
+
recommended: boolean;
|
|
24
|
+
tag?: ReactNode;
|
|
25
|
+
input: { value: string; usdValue: string };
|
|
26
|
+
output: { value: string; usdValue?: string };
|
|
27
|
+
steps: Step[];
|
|
28
|
+
totalFee: string;
|
|
29
|
+
totalTime: string;
|
|
30
|
+
expanded?: boolean;
|
|
31
|
+
tooltipContainer?: HTMLElement;
|
|
32
|
+
};
|