@rango-dev/ui 0.29.1-next.3 → 0.29.1-next.5

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.
Files changed (71) hide show
  1. package/dist/index.js +6 -6
  2. package/dist/index.js.map +4 -4
  3. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.Skeletons.d.ts +6 -0
  4. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.Skeletons.d.ts.map +1 -0
  5. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.d.ts +4 -0
  6. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.d.ts.map +1 -0
  7. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.stories.d.ts +7 -0
  8. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.stories.d.ts.map +1 -0
  9. package/dist/widget/ui/src/components/{ExpandedRoute/ExpandedRoute.styles.d.ts → FullExpandedQuote/FullExpandedQuote.styles.d.ts} +652 -3
  10. package/dist/widget/ui/src/components/{ExpandedRoute/ExpandedRoute.styles.d.ts.map → FullExpandedQuote/FullExpandedQuote.styles.d.ts.map} +1 -1
  11. package/dist/widget/ui/src/components/{ExpandedRoute/ExpandedRoute.types.d.ts → FullExpandedQuote/FullExpandedQuote.types.d.ts} +17 -9
  12. package/dist/widget/ui/src/components/FullExpandedQuote/FullExpandedQuote.types.d.ts.map +1 -0
  13. package/dist/widget/ui/src/components/FullExpandedQuote/index.d.ts +2 -0
  14. package/dist/widget/ui/src/components/FullExpandedQuote/index.d.ts.map +1 -0
  15. package/dist/widget/ui/src/components/FullExpandedQuote/mock.d.ts.map +1 -0
  16. package/dist/widget/ui/src/components/List/List.d.ts.map +1 -1
  17. package/dist/widget/ui/src/components/List/List.types.d.ts +1 -0
  18. package/dist/widget/ui/src/components/List/List.types.d.ts.map +1 -1
  19. package/dist/widget/ui/src/components/List/index.d.ts +1 -0
  20. package/dist/widget/ui/src/components/List/index.d.ts.map +1 -1
  21. package/dist/widget/ui/src/components/ListItem/ListItem.styles.d.ts.map +1 -1
  22. package/dist/widget/ui/src/components/Tabs/Tabs.d.ts +4 -0
  23. package/dist/widget/ui/src/components/Tabs/Tabs.d.ts.map +1 -0
  24. package/dist/widget/ui/src/components/Tabs/Tabs.stories.d.ts +6 -0
  25. package/dist/widget/ui/src/components/Tabs/Tabs.stories.d.ts.map +1 -0
  26. package/dist/widget/ui/src/components/Tabs/Tabs.styles.d.ts +780 -0
  27. package/dist/widget/ui/src/components/Tabs/Tabs.styles.d.ts.map +1 -0
  28. package/dist/widget/ui/src/components/Tabs/Tabs.types.d.ts +30 -0
  29. package/dist/widget/ui/src/components/Tabs/Tabs.types.d.ts.map +1 -0
  30. package/dist/widget/ui/src/components/Tabs/index.d.ts +2 -0
  31. package/dist/widget/ui/src/components/Tabs/index.d.ts.map +1 -0
  32. package/dist/widget/ui/src/components/index.d.ts +3 -1
  33. package/dist/widget/ui/src/components/index.d.ts.map +1 -1
  34. package/dist/widget/ui/src/icons/Bridges.d.ts +5 -0
  35. package/dist/widget/ui/src/icons/Bridges.d.ts.map +1 -0
  36. package/dist/widget/ui/src/icons/Exchange.d.ts +5 -0
  37. package/dist/widget/ui/src/icons/Exchange.d.ts.map +1 -0
  38. package/dist/widget/ui/src/icons/index.d.ts +2 -0
  39. package/dist/widget/ui/src/icons/index.d.ts.map +1 -1
  40. package/package.json +1 -1
  41. package/src/components/FullExpandedQuote/FullExpandedQuote.Skeletons.tsx +78 -0
  42. package/src/components/{ExpandedRoute/ExpandedRoute.stories.tsx → FullExpandedQuote/FullExpandedQuote.stories.tsx} +4 -4
  43. package/src/components/{ExpandedRoute/ExpandedRoute.styles.ts → FullExpandedQuote/FullExpandedQuote.styles.ts} +26 -4
  44. package/src/components/FullExpandedQuote/FullExpandedQuote.tsx +182 -0
  45. package/src/components/{ExpandedRoute/ExpandedRoute.types.ts → FullExpandedQuote/FullExpandedQuote.types.ts} +17 -8
  46. package/src/components/FullExpandedQuote/index.ts +1 -0
  47. package/src/components/List/List.tsx +2 -3
  48. package/src/components/List/List.types.ts +1 -0
  49. package/src/components/List/index.ts +1 -0
  50. package/src/components/ListItem/ListItem.styles.ts +1 -0
  51. package/src/components/Tabs/Tabs.stories.tsx +12 -0
  52. package/src/components/Tabs/Tabs.styles.tsx +157 -0
  53. package/src/components/Tabs/Tabs.tsx +95 -0
  54. package/src/components/Tabs/Tabs.types.tsx +32 -0
  55. package/src/components/Tabs/index.ts +1 -0
  56. package/src/components/index.ts +3 -1
  57. package/src/icons/Bridges.tsx +19 -0
  58. package/src/icons/Exchange.tsx +22 -0
  59. package/src/icons/index.ts +2 -0
  60. package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.d.ts +0 -4
  61. package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.d.ts.map +0 -1
  62. package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.stories.d.ts +0 -7
  63. package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.stories.d.ts.map +0 -1
  64. package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.types.d.ts.map +0 -1
  65. package/dist/widget/ui/src/components/ExpandedRoute/index.d.ts +0 -2
  66. package/dist/widget/ui/src/components/ExpandedRoute/index.d.ts.map +0 -1
  67. package/dist/widget/ui/src/components/ExpandedRoute/mock.d.ts.map +0 -1
  68. package/src/components/ExpandedRoute/ExpandedRoute.tsx +0 -147
  69. package/src/components/ExpandedRoute/index.ts +0 -1
  70. /package/dist/widget/ui/src/components/{ExpandedRoute → FullExpandedQuote}/mock.d.ts +0 -0
  71. /package/src/components/{ExpandedRoute → FullExpandedQuote}/mock.ts +0 -0
@@ -0,0 +1,157 @@
1
+ import { darkTheme, styled } from '../../theme';
2
+ import { Button } from '../Button';
3
+
4
+ export const Tabs = styled('div', {
5
+ display: 'flex',
6
+ flexDirection: 'row',
7
+ position: 'relative',
8
+ justifyContent: 'space-between',
9
+ height: '100%',
10
+ variants: {
11
+ type: {
12
+ secondary: {
13
+ border: '3px solid $neutral100',
14
+ backgroundColor: '$neutral100',
15
+ },
16
+ primary: {
17
+ $$color: '$colors$neutral200',
18
+ [`.${darkTheme} &`]: {
19
+ $$color: '$colors$neutral500',
20
+ },
21
+ borderColor: '$$color',
22
+ borderWidth: '5px',
23
+ borderStyle: 'solid',
24
+ backgroundColor: '$$color',
25
+ },
26
+ },
27
+ borderRadius: {
28
+ small: {
29
+ borderRadius: '$xs',
30
+ },
31
+ medium: {
32
+ borderRadius: '$sm',
33
+ },
34
+ full: {
35
+ borderRadius: '$xm',
36
+ },
37
+ },
38
+ },
39
+ });
40
+
41
+ export const Tab = styled(Button, {
42
+ color: '$neutral700',
43
+ backgroundColor: 'transparent',
44
+ height: '100%',
45
+ zIndex: 10,
46
+ '& ._text': {
47
+ display: 'flex',
48
+ flexDirection: 'row',
49
+ alignItems: 'center',
50
+ justifyContent: 'center',
51
+ },
52
+ variants: {
53
+ borderRadius: {
54
+ small: {
55
+ borderRadius: '$xs',
56
+ },
57
+ medium: {
58
+ borderRadius: '$sm',
59
+ },
60
+ full: {
61
+ borderRadius: '$xm',
62
+ },
63
+ },
64
+ type: {
65
+ primary: {
66
+ padding: '$5 $10',
67
+ height: '100%',
68
+ },
69
+ secondary: {},
70
+ },
71
+ isActive: {
72
+ true: {
73
+ transition: 'color 0.8s linear',
74
+ },
75
+ false: {},
76
+ },
77
+ },
78
+
79
+ compoundVariants: [
80
+ {
81
+ type: 'secondary',
82
+ isActive: true,
83
+ css: {
84
+ $$color: '$colors$background',
85
+ [`.${darkTheme} &`]: {
86
+ $$color: '$colors$foreground',
87
+ },
88
+ color: '$$color',
89
+ },
90
+ },
91
+ {
92
+ type: 'secondary',
93
+ isActive: false,
94
+ css: {
95
+ '&:hover': {
96
+ backgroundColor: '$info100',
97
+ color: '$secondary500',
98
+ [`.${darkTheme} &`]: {
99
+ backgroundColor: 'transparent',
100
+ color: '$neutral700',
101
+ },
102
+ },
103
+ },
104
+ },
105
+
106
+ {
107
+ type: 'primary',
108
+ isActive: true,
109
+ css: {
110
+ color: '$secondary',
111
+ '& svg': {
112
+ color: '$secondary',
113
+ },
114
+ },
115
+ },
116
+ {
117
+ type: 'primary',
118
+ isActive: false,
119
+ css: {
120
+ '&:hover': {
121
+ backgroundColor: 'transparent',
122
+ },
123
+ },
124
+ },
125
+ ],
126
+ });
127
+
128
+ export const BackdropTab = styled('div', {
129
+ padding: '$4',
130
+ position: 'absolute',
131
+ inset: 0,
132
+ transition: 'transform 0.2s cubic-bezier(0, 0, 0.86, 1.2)',
133
+ '&.no-transition': {
134
+ transition: 'none',
135
+ },
136
+ variants: {
137
+ type: {
138
+ secondary: {
139
+ backgroundColor: '$secondary500',
140
+ },
141
+ primary: {
142
+ backgroundColor: '$background',
143
+ },
144
+ },
145
+ borderRadius: {
146
+ small: {
147
+ borderRadius: '$xs',
148
+ },
149
+ medium: {
150
+ borderRadius: '$sm',
151
+ },
152
+ full: {
153
+ borderRadius: '$xm',
154
+ },
155
+ },
156
+ },
157
+ });
@@ -0,0 +1,95 @@
1
+ import type { PropTypes } from './Tabs.types';
2
+
3
+ import React, { useEffect, useRef, useState } from 'react';
4
+
5
+ import { Divider } from '../Divider';
6
+ import { Tooltip } from '../Tooltip';
7
+
8
+ import { BackdropTab, Tab, Tabs } from './Tabs.styles';
9
+
10
+ const INITIAL_RENDER_DELAY = 100;
11
+ export function TabsComponent(props: PropTypes) {
12
+ const {
13
+ items: tabItems,
14
+ onChange,
15
+ container = document.body,
16
+ value,
17
+ type,
18
+ borderRadius = 'medium',
19
+ className,
20
+ } = props;
21
+ const [tabWidth, setTabWidth] = useState(0);
22
+ const tabRef: React.Ref<HTMLButtonElement> = useRef(null);
23
+ const currentIndex = tabItems.findIndex((item) => item.id === value);
24
+
25
+ // State variable to track the initial render
26
+ const [initialRender, setInitialRender] = useState(true);
27
+ const transformPosition = currentIndex * tabWidth;
28
+
29
+ useEffect(() => {
30
+ const updateTabWidth = () => {
31
+ if (tabRef.current) {
32
+ const tabRect = tabRef.current.getBoundingClientRect();
33
+ setTabWidth(tabRect.width);
34
+ }
35
+ };
36
+ updateTabWidth();
37
+ window.addEventListener('resize', updateTabWidth);
38
+ return () => {
39
+ window.removeEventListener('resize', updateTabWidth);
40
+ };
41
+ }, []);
42
+
43
+ useEffect(() => {
44
+ // Set initialRender to false after a short delay
45
+ const timeout = setTimeout(() => {
46
+ setInitialRender(false);
47
+ clearTimeout(timeout);
48
+ }, INITIAL_RENDER_DELAY);
49
+ }, []);
50
+
51
+ return (
52
+ <Tabs
53
+ className={`_tabs ${className || ''}`}
54
+ type={type}
55
+ borderRadius={borderRadius}>
56
+ {tabItems.map((item, index) => (
57
+ <Tooltip
58
+ key={item.id}
59
+ style={{ width: '100%' }}
60
+ container={container}
61
+ side="bottom"
62
+ sideOffset={2}
63
+ content={item.tooltip}
64
+ open={!item.tooltip ? false : undefined}>
65
+ <Tab
66
+ className="_tab"
67
+ ref={index === 0 ? tabRef : null} // Set ref on the first tab
68
+ type={type}
69
+ fullWidth
70
+ disableRipple={true}
71
+ borderRadius={borderRadius}
72
+ onClick={() => onChange(item)}
73
+ size="small"
74
+ isActive={item.id === value}
75
+ variant="default">
76
+ {item.icon}
77
+ {!!item.icon && !!item.title && (
78
+ <Divider direction="horizontal" size="2" />
79
+ )}
80
+ {item.title}
81
+ </Tab>
82
+ </Tooltip>
83
+ ))}
84
+ <BackdropTab
85
+ type={type}
86
+ borderRadius={borderRadius}
87
+ className={`_backdrop-tab ${initialRender ? 'no-transition' : ''}`}
88
+ css={{
89
+ width: tabWidth,
90
+ transform: `translateX(${transformPosition}px)`,
91
+ }}
92
+ />
93
+ </Tabs>
94
+ );
95
+ }
@@ -0,0 +1,32 @@
1
+ import type { Tabs } from './Tabs.styles';
2
+ import type * as Stitches from '@stitches/react';
3
+
4
+ type BaseItem = {
5
+ id: string | number;
6
+ tooltip?: React.ReactNode;
7
+ };
8
+
9
+ type ItemWithTitle = BaseItem & {
10
+ title: string;
11
+ icon?: React.ReactNode;
12
+ };
13
+
14
+ type ItemWithIcon = BaseItem & {
15
+ icon: React.ReactNode;
16
+ title?: string;
17
+ };
18
+
19
+ type Item = ItemWithTitle | ItemWithIcon;
20
+ type BaseProps = Stitches.VariantProps<typeof Tabs>;
21
+ type BaseType = Exclude<BaseProps['type'], object>;
22
+ type BaseBorderRadius = Exclude<BaseProps['borderRadius'], object>;
23
+
24
+ export interface PropTypes {
25
+ items: Item[];
26
+ container?: HTMLElement;
27
+ onChange: (item: Item) => void;
28
+ value: string;
29
+ type: BaseType;
30
+ borderRadius?: BaseBorderRadius;
31
+ className?: string;
32
+ }
@@ -0,0 +1 @@
1
+ export { TabsComponent as Tabs } from './Tabs';
@@ -11,7 +11,7 @@ export * from './Chip';
11
11
  export * from './common';
12
12
  export * from './Divider';
13
13
  export * from './Drawer';
14
- export * from './ExpandedRoute';
14
+ export * from './FullExpandedQuote';
15
15
  export * from './Header';
16
16
  export * from './Modal';
17
17
  export * from './MessageBox';
@@ -53,3 +53,5 @@ export * from './Popover';
53
53
  export * from './Flags';
54
54
  export * from './Select';
55
55
  export * from './QuoteTag';
56
+ export * from './Tabs';
57
+ export type { SvgIconProps } from './SvgIcon';
@@ -0,0 +1,19 @@
1
+ import type { SvgIconPropsWithChildren } from '../components/SvgIcon';
2
+
3
+ import React, { createElement } from 'react';
4
+
5
+ import { SvgIcon } from '../components/SvgIcon';
6
+
7
+ function SvgBridges(props: SvgIconPropsWithChildren) {
8
+ return createElement(
9
+ SvgIcon,
10
+ props,
11
+ <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
12
+ <path
13
+ d="M18.21 9.21C15.93 10.78 13.45 13.3 13 17H15V19H9V17H11C10.5 12.5 6.63 9 2 9V7C6.39 7 10.22 9.55 12 13.3C13.13 10.87 14.99 9.05 16.78 7.78L14 5H21V12L18.21 9.21Z"
14
+ fill="currentColor"
15
+ />
16
+ </svg>
17
+ );
18
+ }
19
+ export default SvgBridges;
@@ -0,0 +1,22 @@
1
+ import type { SvgIconPropsWithChildren } from '../components/SvgIcon';
2
+
3
+ import React, { createElement } from 'react';
4
+
5
+ import { SvgIcon } from '../components/SvgIcon';
6
+
7
+ function SvgExchange(props: SvgIconPropsWithChildren) {
8
+ return createElement(
9
+ SvgIcon,
10
+ props,
11
+ <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
12
+ <g id="Icons">
13
+ <path
14
+ id="Vector"
15
+ d="M6.99 11L3 15L6.99 19V16H14V14H6.99V11ZM21 9L17.01 5V8H10V10H17.01V13L21 9Z"
16
+ fill="currentColor"
17
+ />
18
+ </g>
19
+ </svg>
20
+ );
21
+ }
22
+ export default SvgExchange;
@@ -2,6 +2,7 @@ export { default as AddIcon } from './Add';
2
2
  export { default as AutoThemeIcon } from './AutoTheme';
3
3
  export { default as AutorenewIcon } from './Autorenew';
4
4
  export { default as BorderRadiusIcon } from './BorderRadius';
5
+ export { default as BridgeIcon } from './Bridges';
5
6
  export { default as ChevronDownIcon } from './ChevronDown';
6
7
  export { default as ChevronLeftIcon } from './ChevronLeft';
7
8
  export { default as ChevronRightIcon } from './ChevronRight';
@@ -18,6 +19,7 @@ export { default as DoneIcon } from './Done';
18
19
  export { default as EvmCategoryIcon } from './EvmCategory';
19
20
  export { default as ErrorIcon } from './Error';
20
21
  export { default as ExitIcon } from './Exit';
22
+ export { default as ExchangeIcon } from './Exchange';
21
23
  export { default as ExternalLinkIcon } from './ExternalLink';
22
24
  export { default as FontIcon } from './Font';
23
25
  export { default as GasIcon } from './Gas';
@@ -1,4 +0,0 @@
1
- import type { PropTypes } from './ExpandedRoute.types';
2
- import React from 'react';
3
- export declare function ExpandedRoute(props: PropTypes): React.JSX.Element;
4
- //# sourceMappingURL=ExpandedRoute.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExpandedRoute.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ExpandedRoute/ExpandedRoute.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,KAAK,MAAM,OAAO,CAAC;AA8B1B,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,qBAkH7C"}
@@ -1,7 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { ExpandedRoute } from './ExpandedRoute';
3
- declare const meta: Meta<typeof ExpandedRoute>;
4
- export default meta;
5
- type Story = StoryObj<typeof ExpandedRoute>;
6
- export declare const Main: Story;
7
- //# sourceMappingURL=ExpandedRoute.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExpandedRoute.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ExpandedRoute/ExpandedRoute.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,aAAa,CAEpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5C,eAAO,MAAM,IAAI,EAAE,KAgBlB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExpandedRoute.types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ExpandedRoute/ExpandedRoute.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE/E,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAC3B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IACxD,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAChD,WAAW,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACrC,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -1,2 +0,0 @@
1
- export { ExpandedRoute } from './ExpandedRoute';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ExpandedRoute/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ExpandedRoute/mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAE7D,eAAO,MAAM,KAAK,EAAE,IAAI,EAkNvB,CAAC;AAEF,eAAO,MAAM,IAAI;;;GAqBhB,CAAC"}
@@ -1,147 +0,0 @@
1
- import type { PropTypes } from './ExpandedRoute.types';
2
-
3
- import React from 'react';
4
-
5
- import { ErrorIcon, WarningIcon } from '../../icons';
6
- import { ChainToken } from '../ChainToken';
7
- import { Image } from '../common';
8
- import { Divider } from '../Divider';
9
- import { QuoteCost } from '../QuoteCost';
10
- import { QuoteTag } from '../QuoteTag';
11
- import { Tooltip } from '../Tooltip';
12
- import { Typography } from '../Typography';
13
-
14
- import {
15
- FromToken,
16
- IconHighlight,
17
- lastStepStyle,
18
- LeftSection,
19
- OutputSection,
20
- RightSection,
21
- RouteContainer,
22
- RouteHeader,
23
- Step,
24
- Steps,
25
- StyledPriceImpact,
26
- SwapperContainer,
27
- SwapperImage,
28
- TagsContainer,
29
- tokenLabelStyles,
30
- VerticalLine,
31
- } from './ExpandedRoute.styles';
32
-
33
- export function ExpandedRoute(props: PropTypes) {
34
- const {
35
- steps,
36
- tags,
37
- time,
38
- fee,
39
- percentageChange,
40
- warningLevel,
41
- outputPrice,
42
- tooltipContainer,
43
- selected = false,
44
- onClick,
45
- } = props;
46
- const numberOfSteps = steps.length;
47
- return (
48
- <RouteContainer selected={selected} onClick={onClick}>
49
- <RouteHeader>
50
- <QuoteCost fee={fee} time={time} steps={numberOfSteps} />
51
- <TagsContainer>
52
- {tags.map((tag) => (
53
- <QuoteTag key={tag.label} label={tag.label} value={tag.value} />
54
- ))}
55
- </TagsContainer>
56
- </RouteHeader>
57
- <Steps>
58
- {steps.map((step, index) => {
59
- const key = `item-${index}`;
60
- return (
61
- <Step
62
- key={key}
63
- className={index === numberOfSteps - 1 ? lastStepStyle() : ''}>
64
- <LeftSection>
65
- <ChainToken
66
- size="small"
67
- chainImage={step.from.chain.image}
68
- tokenImage={step.from.token.image}
69
- />
70
- <FromToken>
71
- <Tooltip
72
- content={step.from.price.realValue}
73
- container={tooltipContainer}
74
- side="bottom"
75
- open={!step.from.price.realValue ? false : undefined}>
76
- <Typography size="xsmall" variant="body">
77
- {step.from.price.value}
78
- </Typography>
79
- </Tooltip>
80
- <Typography
81
- size="xsmall"
82
- variant="body"
83
- className={tokenLabelStyles()}>
84
- {step.from.token.displayName}
85
- </Typography>
86
- </FromToken>
87
- </LeftSection>
88
- <RightSection>
89
- <SwapperContainer>
90
- <SwapperImage state={step.state}>
91
- <Image size={15} type="circular" src={step.swapper.image} />
92
- {step.state && (
93
- <IconHighlight type={step.state}>
94
- {step.state === 'error' ? (
95
- <ErrorIcon size={6} color="error" />
96
- ) : (
97
- <WarningIcon size={6} color="warning" />
98
- )}
99
- </IconHighlight>
100
- )}
101
- </SwapperImage>
102
- <Typography size="xsmall" variant="body" align="center">
103
- {step.swapper.displayName}
104
- </Typography>
105
- </SwapperContainer>
106
- <VerticalLine />
107
- </RightSection>
108
- </Step>
109
- );
110
- })}
111
- <OutputSection>
112
- <ChainToken
113
- chainImage={steps[numberOfSteps - 1].to.chain.image}
114
- tokenImage={steps[numberOfSteps - 1].to.token.image}
115
- size="medium"
116
- />
117
- <div>
118
- <div>
119
- <Tooltip
120
- content={outputPrice.realValue}
121
- container={tooltipContainer}
122
- open={!outputPrice.realValue ? false : undefined}>
123
- <Typography size="xmedium" variant="title">
124
- {outputPrice.value}
125
- </Typography>
126
- <Divider size={4} direction="horizontal" />
127
- <Typography size="large" variant="body">
128
- {steps[numberOfSteps - 1].to.token.displayName}
129
- </Typography>
130
- </Tooltip>
131
- </div>
132
- </div>
133
- <StyledPriceImpact
134
- size="xsmall"
135
- warningLevel={warningLevel}
136
- outputUsdValue={outputPrice.usdValue}
137
- realOutputUsdValue={outputPrice.realUsdValue}
138
- percentageChange={percentageChange}
139
- tooltipProps={{
140
- container: tooltipContainer,
141
- }}
142
- />
143
- </OutputSection>
144
- </Steps>
145
- </RouteContainer>
146
- );
147
- }
@@ -1 +0,0 @@
1
- export { ExpandedRoute } from './ExpandedRoute';