@rango-dev/ui 0.1.10-next.91 → 0.1.10

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 (116) hide show
  1. package/README.md +1 -181
  2. package/dist/components/Alert/Alert.d.ts +3 -2
  3. package/dist/components/Alert/LoadingFailedAlert.d.ts +2 -0
  4. package/dist/components/Alert/NotFoundAlert.d.ts +7 -0
  5. package/dist/components/Alert/index.d.ts +1 -0
  6. package/dist/components/BlockchainSelector/BlockchainSelector.d.ts +1 -1
  7. package/dist/components/Button/Button.d.ts +3 -3
  8. package/dist/components/Divider/Divider.d.ts +6 -0
  9. package/dist/components/Divider/index.d.ts +1 -0
  10. package/dist/components/Header/Header.d.ts +9 -0
  11. package/dist/components/Header/index.d.ts +1 -0
  12. package/dist/components/Icon/ArrowRightIcon.d.ts +3 -0
  13. package/dist/components/Icon/ChevronRightIcon.d.ts +3 -0
  14. package/dist/components/Icon/DisconnectIcon.d.ts +3 -0
  15. package/dist/components/Icon/index.d.ts +3 -0
  16. package/dist/components/Icon/types.d.ts +1 -1
  17. package/dist/components/LiquiditySourceList/LiquiditySourceList.d.ts +3 -1
  18. package/dist/components/LiquiditySourcesSelector/LiquiditySourcesSelector.d.ts +2 -1
  19. package/dist/components/SelectableWalletList/mock.d.ts +1 -1
  20. package/dist/components/Settings/Settings.d.ts +2 -1
  21. package/dist/components/Spacer/Spacer.d.ts +1 -1
  22. package/dist/components/SwapContainer/SwapContainer.d.ts +1 -0
  23. package/dist/components/SwapDetail/Token.d.ts +16 -0
  24. package/dist/components/TextField/TextField.stories.d.ts +1 -1
  25. package/dist/components/TokenSelector/TokenSelector.d.ts +3 -0
  26. package/dist/components/Typography/Typography.d.ts +3 -2
  27. package/dist/components/index.d.ts +2 -0
  28. package/dist/containers/ConfirmSwap/ConfirmSwap.d.ts +10 -17
  29. package/dist/containers/ConfirmSwap/ConfirmSwap.stories.d.ts +1 -0
  30. package/dist/containers/ConfirmSwap/mock.d.ts +3 -0
  31. package/dist/containers/History/History.d.ts +6 -1
  32. package/dist/containers/History/index.d.ts +1 -1
  33. package/dist/containers/History/types.d.ts +3 -24
  34. package/dist/containers/SwapHistory/SwapHistory.d.ts +16 -3
  35. package/dist/containers/SwapHistory/SwapMessages.d.ts +17 -0
  36. package/dist/containers/index.d.ts +0 -1
  37. package/dist/helper/index.d.ts +1 -0
  38. package/dist/types/meta.d.ts +1 -0
  39. package/dist/ui.cjs.development.js +1455 -1033
  40. package/dist/ui.cjs.development.js.map +1 -1
  41. package/dist/ui.cjs.production.min.js +1 -1
  42. package/dist/ui.cjs.production.min.js.map +1 -1
  43. package/dist/ui.esm.js +1463 -1046
  44. package/dist/ui.esm.js.map +1 -1
  45. package/package.json +3 -2
  46. package/src/components/Alert/Alert.tsx +63 -39
  47. package/src/components/Alert/LoadingFailedAlert.tsx +11 -0
  48. package/src/components/Alert/NotFoundAlert.tsx +19 -0
  49. package/src/components/Alert/index.ts +1 -0
  50. package/src/components/BestRoute/BestRoute.tsx +28 -19
  51. package/src/components/BestRoute/mock.ts +10 -0
  52. package/src/components/BlockchainSelector/BlockchainSelector.tsx +13 -21
  53. package/src/components/Button/Button.stories.tsx +1 -1
  54. package/src/components/Button/Button.tsx +36 -23
  55. package/src/components/Chip/Chip.tsx +7 -4
  56. package/src/components/ConnectWalletsModal/mockData.ts +16 -0
  57. package/src/components/Divider/Divider.tsx +41 -0
  58. package/src/components/Divider/index.ts +1 -0
  59. package/src/components/Header/Header.tsx +39 -0
  60. package/src/components/Header/index.ts +1 -0
  61. package/src/components/Icon/ArrowRightIcon.tsx +31 -0
  62. package/src/components/Icon/ChevronRightIcon.tsx +29 -0
  63. package/src/components/Icon/DisconnectIcon.tsx +31 -0
  64. package/src/components/Icon/HistoryIcon.tsx +12 -18
  65. package/src/components/Icon/RetryIcon.tsx +13 -13
  66. package/src/components/Icon/SettingIcon.tsx +6 -14
  67. package/src/components/Icon/index.ts +3 -0
  68. package/src/components/Icon/types.tsx +1 -1
  69. package/src/components/LiquiditySourceList/LiquiditySourceList.tsx +104 -30
  70. package/src/components/LiquiditySourcesSelector/LiquiditySourcesSelector.tsx +16 -11
  71. package/src/components/Radio/Radio.tsx +5 -4
  72. package/src/components/SecondaryPage/SecondaryPage.tsx +26 -52
  73. package/src/components/SelectableWalletList/SelectableWalletList.tsx +5 -1
  74. package/src/components/SelectableWalletList/mock.ts +4 -3
  75. package/src/components/Settings/Settings.tsx +47 -12
  76. package/src/components/Spacer/Spacer.tsx +31 -1
  77. package/src/components/StatusDrawer/StatusDrawer.tsx +1 -0
  78. package/src/components/StepDetail/StepDetail.tsx +19 -7
  79. package/src/components/SwapContainer/SwapContainer.tsx +22 -17
  80. package/src/components/SwapDetail/SwapDetail.tsx +77 -115
  81. package/src/components/SwapDetail/Token.tsx +68 -0
  82. package/src/components/SwapDetail/mock.ts +1 -0
  83. package/src/components/Switch/Switch.tsx +7 -5
  84. package/src/components/TextField/TextField.tsx +3 -1
  85. package/src/components/TokenList/TokenItem.tsx +4 -1
  86. package/src/components/TokenList/TokenList.tsx +16 -18
  87. package/src/components/TokenSelector/TokenSelector.tsx +47 -10
  88. package/src/components/Typography/Typography.stories.tsx +4 -0
  89. package/src/components/Typography/Typography.tsx +20 -9
  90. package/src/components/Wallet/State.tsx +2 -3
  91. package/src/components/Wallet/Wallet.tsx +33 -6
  92. package/src/components/index.ts +2 -0
  93. package/src/containers/ConfirmSwap/ConfirmSwap.stories.tsx +11 -2
  94. package/src/containers/ConfirmSwap/ConfirmSwap.tsx +103 -119
  95. package/src/containers/ConfirmSwap/mock.ts +79 -2
  96. package/src/containers/History/History.tsx +57 -38
  97. package/src/containers/History/index.ts +1 -1
  98. package/src/containers/History/mock.ts +1 -0
  99. package/src/containers/History/types.tsx +2 -30
  100. package/src/containers/SwapHistory/SwapHistory.tsx +309 -165
  101. package/src/containers/SwapHistory/SwapMessages.tsx +116 -0
  102. package/src/containers/SwapHistory/mock.ts +1 -0
  103. package/src/containers/index.ts +0 -1
  104. package/src/helper/index.ts +14 -0
  105. package/src/theme.ts +4 -2
  106. package/src/types/meta.ts +2 -0
  107. package/dist/containers/ConfirmWallets/ConfirmWallets.d.ts +0 -18
  108. package/dist/containers/ConfirmWallets/ConfirmWallets.stories.d.ts +0 -6
  109. package/dist/containers/ConfirmWallets/index.d.ts +0 -1
  110. package/dist/containers/ConfirmWallets/mock.d.ts +0 -5
  111. package/dist/helper/swaps.d.ts +0 -5
  112. package/src/containers/ConfirmWallets/ConfirmWallets.stories.tsx +0 -26
  113. package/src/containers/ConfirmWallets/ConfirmWallets.tsx +0 -118
  114. package/src/containers/ConfirmWallets/index.ts +0 -1
  115. package/src/containers/ConfirmWallets/mock.ts +0 -222
  116. package/src/helper/swaps.ts +0 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/ui",
3
- "version": "0.1.10-next.91",
3
+ "version": "0.1.10",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -20,6 +20,7 @@
20
20
  "build-storybook": "build-storybook"
21
21
  },
22
22
  "peerDependencies": {
23
+ "@rango-dev/queue-manager-rango-preset": "*",
23
24
  "react": ">=16"
24
25
  },
25
26
  "husky": {
@@ -75,7 +76,7 @@
75
76
  "@rango-dev/wallets-shared": "^0.1.11-next.78",
76
77
  "@stitches/react": "^1.2.8",
77
78
  "@types/react-color": "^3.0.6",
78
- "rango-sdk": "^0.1.19",
79
+ "rango-sdk": "^0.1.20",
79
80
  "react-color": "^2.19.3",
80
81
  "react-virtualized-auto-sizer": "^1.0.7",
81
82
  "react-window": "^1.8.8",
@@ -1,52 +1,52 @@
1
- import React, { PropsWithChildren } from 'react';
1
+ import React, { PropsWithChildren, ReactNode } from 'react';
2
2
  import { CheckCircleIcon, InfoCircleIcon, WarningIcon } from '../Icon';
3
3
  import { Typography } from '../Typography';
4
- import { darkTheme, styled } from '../../theme';
4
+ import { styled } from '../../theme';
5
+ import { Spacer } from '../Spacer';
5
6
 
6
7
  const MainContainer = styled('div', {
7
- display: 'flex',
8
8
  width: '100%',
9
- alignItems: 'center',
10
9
  padding: '$16',
11
10
  borderRadius: '$5',
11
+ backgroundColor: '$neutrals300',
12
+ color: '$neutrals800',
13
+
14
+ '.main': {
15
+ display: 'flex',
16
+ alignItems: 'center',
17
+ },
18
+
19
+ '.footer': {
20
+ paddingTop: '$8',
21
+ },
22
+ '&.hasIcon .footer': {
23
+ paddingLeft: '$32',
24
+ },
12
25
  variants: {
13
26
  type: {
14
27
  primary: {
15
- backgroundColor: '$primary200',
28
+ color: '$primary200',
16
29
  },
17
30
  secondary: {
18
- backgroundColor: '$neutrals400',
31
+ color: '$foreground',
19
32
  },
20
33
  success: {
21
- backgroundColor: '$success300',
34
+ color: '$success300',
22
35
  },
23
36
  warning: {
24
- backgroundColor: '$warning500',
37
+ color: '$warning500',
25
38
  },
26
39
  error: {
27
- backgroundColor: '$error300',
40
+ color: '$error300',
28
41
  },
29
42
  },
30
43
  },
31
44
  });
32
45
 
33
- const ContentContainer = styled('div', {});
34
-
35
- const TitleContainer = styled('div', {
36
- marginBottom: '$8',
37
- });
38
-
39
- const IconContainer = styled('div', {
40
- marginRight: '$24',
41
- });
42
-
43
- const StyledTypography = styled(Typography, {
44
- color: darkTheme.colors.foreground.value,
45
- });
46
-
47
46
  export interface PropTypes {
48
- type: 'primary' | 'secondary' | 'success' | 'warning' | 'error';
47
+ type?: 'primary' | 'secondary' | 'success' | 'warning' | 'error';
49
48
  title?: string;
49
+ footer?: ReactNode;
50
50
  }
51
51
 
52
52
  export function Alert(props: PropsWithChildren<PropTypes>) {
@@ -57,22 +57,46 @@ export function Alert(props: PropsWithChildren<PropTypes>) {
57
57
  ).includes(type);
58
58
 
59
59
  return (
60
- <MainContainer type={type}>
61
- {showIcon && (
62
- <IconContainer>
63
- {type === 'success' && <CheckCircleIcon color="success" size={28} />}
64
- {type === 'warning' && <WarningIcon color="white" size={28} />}
65
- {type === 'error' && <InfoCircleIcon color="error" size={28} />}
66
- </IconContainer>
67
- )}
68
- <ContentContainer>
69
- {title && (
70
- <TitleContainer>
71
- <StyledTypography variant="h6">{title}</StyledTypography>
72
- </TitleContainer>
60
+ <MainContainer type={type} className={showIcon ? 'hasIcon' : ''}>
61
+ <div className="main">
62
+ {showIcon && (
63
+ <>
64
+ <div
65
+ style={{
66
+ width: '32px',
67
+ display: 'flex',
68
+ justifyContent: 'center',
69
+ alignItems: 'center',
70
+ }}
71
+ >
72
+ {type === 'success' && <CheckCircleIcon color={type} size={24} />}
73
+ {type === 'warning' && <WarningIcon color={type} size={24} />}
74
+ {type === 'error' && <InfoCircleIcon color={type} size={24} />}
75
+ <Spacer size={8} />
76
+ </div>
77
+ </>
73
78
  )}
74
- {children}
75
- </ContentContainer>
79
+ <div
80
+ style={{
81
+ display: 'flex',
82
+ justifyContent: 'center',
83
+ alignItems: 'start',
84
+ flexDirection: 'column',
85
+ width: '100%',
86
+ }}
87
+ >
88
+ {title && (
89
+ <>
90
+ <Typography className="title" variant="h6" color={type}>
91
+ {title}
92
+ </Typography>
93
+ {!!children && <Spacer size={8} direction="vertical" />}
94
+ </>
95
+ )}
96
+ {children}
97
+ </div>
98
+ </div>
99
+ {props.footer ? <div className="footer">{props.footer}</div> : null}
76
100
  </MainContainer>
77
101
  );
78
102
  }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Alert } from './Alert';
3
+
4
+ export function LoadingFailedAlert() {
5
+ return (
6
+ <Alert
7
+ type="error"
8
+ title=" Error connecting server, please reload the app and try again."
9
+ />
10
+ );
11
+ }
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { Alert } from './Alert';
3
+
4
+ interface PropTypes {
5
+ catergory: string;
6
+ searchedFor?: string;
7
+ }
8
+
9
+ export function NotFoundAlert(props: PropTypes) {
10
+ const { catergory, searchedFor } = props;
11
+ return (
12
+ <Alert
13
+ type="secondary"
14
+ title={`${catergory} ${
15
+ searchedFor ? "'" + searchedFor + "'" : ''
16
+ } not found.`}
17
+ />
18
+ );
19
+ }
@@ -1 +1,2 @@
1
1
  export { Alert } from './Alert';
2
+ export { LoadingFailedAlert } from './LoadingFailedAlert';
@@ -6,6 +6,7 @@ import { keyframes, styled } from '../../theme';
6
6
  import { Skeleton } from '../Skeleton';
7
7
  import { Spinner } from '../Spinner';
8
8
  import { BestRouteResponse } from 'rango-sdk';
9
+ import { Tooltip } from '../Tooltip';
9
10
 
10
11
  const Container = styled('div', {
11
12
  borderRadius: '$5',
@@ -40,11 +41,13 @@ const Line = styled('div', {
40
41
  width: '$32',
41
42
  },
42
43
  });
44
+
43
45
  const HR = styled('hr', {
44
46
  width: '100%',
45
- background: '$neutrals200',
47
+ border: '1px solid $neutrals400',
46
48
  margin: '$8 0',
47
49
  });
50
+
48
51
  const SwapperLogo = styled('img', {
49
52
  width: '$16',
50
53
  height: '$16',
@@ -103,7 +106,7 @@ const GasContainer = styled('div', {
103
106
  },
104
107
  });
105
108
 
106
- const FeeContainer = styled('div', {
109
+ const CostContainer = styled('div', {
107
110
  display: 'flex',
108
111
  flexDirection: 'column',
109
112
  alignItems: 'center',
@@ -156,24 +159,30 @@ export function BestRoute(props: PropsWithChildren<PropTypes>) {
156
159
  </SkeletonContainer>
157
160
  ) : (
158
161
  <GasContainer>
159
- <FeeContainer warning={feeWarning}>
160
- <GasIcon size={20} color={feeWarning ? 'warning' : undefined} />
161
- <TotalFee
162
- mt={4}
163
- align="center"
164
- variant="caption"
165
- warning={feeWarning}
166
- >
167
- {error && '-'}
168
- {!!data && `$${totalFee}`}
169
- </TotalFee>
170
- </FeeContainer>
162
+ <Tooltip content="Transaction cost (fee)">
163
+ <CostContainer warning={feeWarning}>
164
+ <GasIcon size={20} color={feeWarning ? 'warning' : undefined} />
165
+ <TotalFee
166
+ mt={4}
167
+ align="center"
168
+ variant="caption"
169
+ warning={feeWarning}
170
+ >
171
+ {error && '-'}
172
+ {!!data && `$${totalFee}`}
173
+ </TotalFee>
174
+ </CostContainer>
175
+ </Tooltip>
171
176
  <HR />
172
- <TimeIcon size={20} />
173
- <Typography mt={4} align="center" variant="caption">
174
- {error && '-'}
175
- {!!data && `~${totalTime}m`}
176
- </Typography>
177
+ <Tooltip content="Time estimate">
178
+ <CostContainer warning={feeWarning}>
179
+ <TimeIcon size={20} />
180
+ <Typography mt={4} align="center" variant="caption">
181
+ {error && '-'}
182
+ {!!data && `~${totalTime}m`}
183
+ </Typography>
184
+ </CostContainer>
185
+ </Tooltip>
177
186
  </GasContainer>
178
187
  )}
179
188
  <BestRouteContainer>
@@ -1,6 +1,8 @@
1
1
  import { RoutingResultType } from 'rango-sdk';
2
2
  import { BestRouteType } from '../../types/swaps';
3
3
 
4
+ // TODO: I used `internalSwaps: []` to fix ts error. fix it by using real data.
5
+
4
6
  export const bestRoute: BestRouteType = {
5
7
  from: { blockchain: 'BSC', symbol: 'BNB', address: null },
6
8
  to: { blockchain: 'AVAX_CCHAIN', symbol: 'AVAX', address: null },
@@ -11,6 +13,8 @@ export const bestRoute: BestRouteType = {
11
13
  outputAmount: '5.685715974132648891',
12
14
  swaps: [
13
15
  {
16
+ // TODO: fix this and use real data
17
+ internalSwaps: [],
14
18
  swapperId: 'AnySwap Aggregator',
15
19
  swapperType: 'AGGREGATOR',
16
20
  swapperLogo: 'https://api.rango.exchange/swappers/multichain.png',
@@ -63,6 +67,7 @@ export const bestRoute: BestRouteType = {
63
67
  includesDestinationTx: false,
64
68
  },
65
69
  {
70
+ internalSwaps: [],
66
71
  swapperId: 'PangolinSwap',
67
72
  swapperLogo: 'https://api.rango.exchange/swappers/pangolin.png',
68
73
  swapperType: 'DEX',
@@ -164,6 +169,7 @@ export const bestRouteExample2: BestRouteType = {
164
169
  outputAmount: '30.983906',
165
170
  swaps: [
166
171
  {
172
+ internalSwaps: [],
167
173
  maxRequiredSign: 1,
168
174
  warnings: [],
169
175
  swapperId: 'ParaSwap Bsc',
@@ -263,6 +269,7 @@ export const bestRouteExample2: BestRouteType = {
263
269
  includesDestinationTx: false,
264
270
  },
265
271
  {
272
+ internalSwaps: [],
266
273
  maxRequiredSign: 1,
267
274
  warnings: [],
268
275
  swapperId: 'Satellite',
@@ -310,6 +317,7 @@ export const bestRouteExample2: BestRouteType = {
310
317
  includesDestinationTx: false,
311
318
  },
312
319
  {
320
+ internalSwaps: [],
313
321
  maxRequiredSign: 1,
314
322
  warnings: [],
315
323
  swapperId: 'Osmosis',
@@ -403,6 +411,7 @@ export const bestRouteExample2: BestRouteType = {
403
411
  includesDestinationTx: false,
404
412
  },
405
413
  {
414
+ internalSwaps: [],
406
415
  maxRequiredSign: 1,
407
416
  warnings: [],
408
417
  swapperId: 'Osmosis',
@@ -486,6 +495,7 @@ export const bestRouteExample3: BestRouteType = {
486
495
  outputAmount: '5.685715974132648891',
487
496
  swaps: [
488
497
  {
498
+ internalSwaps: [],
489
499
  maxRequiredSign: 1,
490
500
  warnings: [],
491
501
  swapperId: 'AnySwap Aggregator',
@@ -2,18 +2,17 @@ import React from 'react';
2
2
  import { BlockchainMeta } from 'rango-sdk';
3
3
  import { BlockchainsList } from '../BlockchainsList';
4
4
  import { SecondaryPage } from '../SecondaryPage/SecondaryPage';
5
- import { Alert } from '../Alert';
6
5
  import { Spinner } from '../Spinner';
7
6
  import { styled } from '../../theme';
8
7
  import { CSSProperties } from '@stitches/react';
9
8
  import { containsText } from '../../helper';
10
- import { Typography } from '../Typography';
9
+ import { LoadingStatus } from '../../types/meta';
10
+ import { LoadingFailedAlert } from '../Alert/LoadingFailedAlert';
11
+ import { NotFoundAlert } from '../Alert/NotFoundAlert';
12
+ import { LoaderContainer } from '../TokenSelector/TokenSelector';
11
13
 
12
14
  const ListContainer = styled('div', {
13
- height: '450px',
14
- display: 'flex',
15
- justifyContent: 'center',
16
- alignItems: 'center',
15
+ overflowY: 'auto',
17
16
  });
18
17
 
19
18
  const filterBlockchains = (list: BlockchainMeta[], searchedFor: string) =>
@@ -23,8 +22,6 @@ const filterBlockchains = (list: BlockchainMeta[], searchedFor: string) =>
23
22
  containsText(blockchain.displayName, searchedFor)
24
23
  );
25
24
 
26
- export type LoadingStatus = 'loading' | 'success' | 'failed';
27
-
28
25
  export interface PropTypes {
29
26
  type?: 'Source' | 'Destination';
30
27
  list: BlockchainMeta[];
@@ -65,20 +62,14 @@ export function BlockchainSelector(props: PropTypes) {
65
62
  return (
66
63
  <ListContainer style={listContainerStyle} key="1">
67
64
  {loadingStatus === 'loading' && (
68
- <div>
65
+ <LoaderContainer>
69
66
  <Spinner size={24} />
70
- </div>
71
- )}
72
- {loadingStatus === 'failed' && (
73
- <Alert type="error">
74
- <Typography variant="body2">
75
- Error connecting server, please reload the app and try again
76
- </Typography>
77
- </Alert>
67
+ </LoaderContainer>
78
68
  )}
69
+ {loadingStatus === 'failed' && <LoadingFailedAlert />}
79
70
  {loadingStatus === 'success' && (
80
71
  <>
81
- {filteredBlockchains.length > 0 ? (
72
+ {filteredBlockchains.length ? (
82
73
  <BlockchainsList
83
74
  list={filteredBlockchains}
84
75
  selected={selected}
@@ -87,9 +78,10 @@ export function BlockchainSelector(props: PropTypes) {
87
78
  onChange={onChange}
88
79
  />
89
80
  ) : (
90
- <Alert type="secondary">
91
- <Typography variant="body2">{`${searchedFor} not found`}</Typography>
92
- </Alert>
81
+ <NotFoundAlert
82
+ catergory="Blockchain"
83
+ searchedFor={searchedFor}
84
+ />
93
85
  )}
94
86
  </>
95
87
  )}
@@ -27,7 +27,7 @@ export default {
27
27
  size: {
28
28
  name: 'size',
29
29
  control: { type: 'radio' },
30
- options: ['small', 'medium', 'large'],
30
+ options: ['small', 'medium', 'large', 'compact'],
31
31
  defaultValue: 'medium',
32
32
  },
33
33
  disabled: {
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties } from '@stitches/react';
2
- import React, { PropsWithChildren } from 'react';
2
+ import React, { PropsWithChildren, HTMLAttributes } from 'react';
3
3
  import { darkTheme, styled } from '../../theme';
4
4
  import { Spinner } from '../Spinner';
5
5
  import { Typography } from '../Typography';
@@ -13,6 +13,12 @@ const ButtonContainer = styled('button', {
13
13
  display: 'flex',
14
14
  alignItems: 'center',
15
15
  justifyContent: 'center',
16
+ transition: 'all 0.35s',
17
+ border: '0',
18
+
19
+ '&:active': {
20
+ transform: 'scale(0.95)',
21
+ },
16
22
 
17
23
  variants: {
18
24
  align: {
@@ -26,6 +32,8 @@ const ButtonContainer = styled('button', {
26
32
  },
27
33
  },
28
34
  size: {
35
+ compact: {},
36
+ free: {},
29
37
  small: {
30
38
  height: '$32',
31
39
  },
@@ -43,27 +51,28 @@ const ButtonContainer = styled('button', {
43
51
  border: 0,
44
52
  '&:hover': {
45
53
  backgroundColor: '$neutrals200',
46
- color: '$foreground',
47
54
  },
48
55
  '&:disabled': {
49
- background: '$neutrals400 !important',
56
+ background: '$neutrals400',
57
+ },
58
+ '&:disabled:hover': {
59
+ background: '$neutrals400',
60
+ transform: 'unset',
50
61
  },
51
62
  },
52
63
  outlined: {
53
- backgroundColor: '$background !important',
54
- borderColor: '$neutrals400 !important',
64
+ backgroundColor: '$background',
65
+ border: 1,
66
+ borderStyle: 'solid',
67
+ borderColor: '$neutrals400',
55
68
  color: '$foreground',
56
69
  '&:hover': {
57
- borderColor: '$neutrals600 !important',
58
- color: '$neutrals500 !important',
70
+ borderColor: '$neutrals600',
59
71
  },
60
72
  '&:disabled': {
61
- borderColor: '$neutrals300 !important',
62
- color: '$neutrals400 !important',
73
+ borderColor: '$neutrals300',
74
+ color: '$neutrals400',
63
75
  },
64
- background: 'transparent',
65
- border: 1,
66
- borderStyle: 'solid',
67
76
  },
68
77
  ghost: {
69
78
  color: '$foreground',
@@ -103,11 +112,7 @@ const ButtonContainer = styled('button', {
103
112
  variant: 'contained',
104
113
  css: {
105
114
  background: '$primary',
106
- $$color: '$colors$background',
107
- [`.${darkTheme} &`]: {
108
- $$color: '$colors$foreground',
109
- },
110
- color: '$$color !important',
115
+ color: '$white',
111
116
  '&:hover': {
112
117
  background: '$primary700',
113
118
  },
@@ -124,7 +129,7 @@ const ButtonContainer = styled('button', {
124
129
  variant: 'outlined',
125
130
  css: {
126
131
  color: '$primary !important',
127
- borderColor: '$primary !important',
132
+ borderColor: '$primary',
128
133
  '&:hover': {
129
134
  color: '$primary700 !important',
130
135
  borderColor: '$primary700 !important',
@@ -179,7 +184,7 @@ const ButtonContainer = styled('button', {
179
184
  variant: 'outlined',
180
185
  css: {
181
186
  color: '$error !important',
182
- borderColor: '$error !important',
187
+ borderColor: '$error',
183
188
  '&:hover': {
184
189
  color: '$error300 !important',
185
190
  borderColor: '$error300 !important',
@@ -236,7 +241,7 @@ const ButtonContainer = styled('button', {
236
241
  variant: 'outlined',
237
242
  css: {
238
243
  color: '$warning !important',
239
- borderColor: '$warning !important',
244
+ borderColor: '$warning',
240
245
  '&:hover': {
241
246
  color: '$warning300 !important',
242
247
  borderColor: '$warning300 !important',
@@ -293,7 +298,7 @@ const ButtonContainer = styled('button', {
293
298
  variant: 'outlined',
294
299
  css: {
295
300
  color: '$success !important',
296
- borderColor: '$success !important',
301
+ borderColor: '$success',
297
302
  '&:hover': {
298
303
  color: '$success300 !important',
299
304
  borderColor: '$success300 !important',
@@ -324,6 +329,13 @@ const ButtonContainer = styled('button', {
324
329
  },
325
330
  },
326
331
  },
332
+ {
333
+ size: 'compact',
334
+ css: {
335
+ padding: '$2 $4',
336
+ fontSize: '$12',
337
+ },
338
+ },
327
339
  ],
328
340
  defaultVariants: {
329
341
  size: 'medium',
@@ -361,9 +373,10 @@ const Content = styled('div', {
361
373
  },
362
374
  });
363
375
 
364
- export interface PropTypes {
376
+ export interface PropTypes
377
+ extends Omit<HTMLAttributes<HTMLButtonElement>, 'prefix'> {
365
378
  onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
366
- size?: 'small' | 'medium' | 'large';
379
+ size?: 'small' | 'medium' | 'large' | 'compact' | 'free';
367
380
  variant?: 'contained' | 'outlined' | 'ghost';
368
381
  type?: 'primary' | 'error' | 'warning' | 'success';
369
382
  prefix?: React.ReactNode;
@@ -1,7 +1,6 @@
1
1
  import { CSSProperties } from '@stitches/react';
2
2
  import React from 'react';
3
3
  import { styled } from '../../theme';
4
- import { Typography } from '../Typography';
5
4
 
6
5
  const ChipCointainer = styled('div', {
7
6
  display: 'inline-flex',
@@ -12,12 +11,16 @@ const ChipCointainer = styled('div', {
12
11
  height: '32',
13
12
  fontSize: '$14',
14
13
  cursor: 'pointer',
14
+ transition: 'all 0.35s',
15
+ color: '$foreground',
16
+
15
17
  '&:hover': {
16
- backgroundColor: '$neutrals300',
18
+ backgroundColor: '$success700',
19
+ color: '$background',
17
20
  },
18
21
  variants: {
19
22
  selected: {
20
- true: { backgroundColor: '$neutrals400' },
23
+ true: { backgroundColor: '$success', color: '$background' },
21
24
  false: { backgroundColor: '$background' },
22
25
  },
23
26
  },
@@ -38,7 +41,7 @@ export function Chip(props: PropTypes) {
38
41
  return (
39
42
  <ChipCointainer selected={selected} onClick={onClick} style={style}>
40
43
  {prefix || null}
41
- <Typography variant="body2">{label}</Typography>
44
+ {label}
42
45
  {suffix || null}
43
46
  </ChipCointainer>
44
47
  );