@rango-dev/ui 0.15.1-next.17 → 0.15.1-next.18
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/dist/index.js +6 -6
- package/dist/index.js.map +4 -4
- package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.d.ts +5 -0
- package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.styles.d.ts +156 -0
- package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.types.d.ts +6 -0
- package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.types.d.ts.map +1 -0
- package/dist/widget/ui/src/components/BlockchainsChip/index.d.ts +2 -0
- package/dist/widget/ui/src/components/BlockchainsChip/index.d.ts.map +1 -0
- package/dist/widget/ui/src/components/Button/Button.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Checkbox/Checkbox.types.d.ts +2 -1
- package/dist/widget/ui/src/components/Checkbox/Checkbox.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.d.ts +4 -0
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +1 -0
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +4 -0
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +1 -0
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts +460 -0
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts.map +1 -0
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.types.d.ts +15 -0
- package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.types.d.ts.map +1 -0
- package/dist/widget/ui/src/components/SelectableCategoryList/index.d.ts +3 -0
- package/dist/widget/ui/src/components/SelectableCategoryList/index.d.ts.map +1 -0
- package/dist/widget/ui/src/components/index.d.ts +2 -0
- package/dist/widget/ui/src/components/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +42 -0
- package/src/components/BlockchainsChip/BlockchainsChip.tsx +15 -0
- package/src/components/BlockchainsChip/BlockchainsChip.types.ts +4 -0
- package/src/components/BlockchainsChip/index.ts +1 -0
- package/src/components/Button/Button.styles.tsx +1 -0
- package/src/components/Checkbox/Checkbox.types.ts +1 -1
- package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +35 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.styles.ts +21 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +76 -0
- package/src/components/SelectableCategoryList/SelectableCategoryList.types.ts +16 -0
- package/src/components/SelectableCategoryList/index.ts +2 -0
- package/src/components/index.ts +2 -0
package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.types.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BlockchainMeta } from 'rango-sdk';
|
|
2
|
+
export interface PropTypes {
|
|
3
|
+
setCategory: (type: string) => void;
|
|
4
|
+
category: string;
|
|
5
|
+
blockchains: BlockchainMeta[];
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare enum BlockchainCategories {
|
|
9
|
+
ALL = "ALL",
|
|
10
|
+
EVM = "EVM",
|
|
11
|
+
COSMOS = "COSMOS",
|
|
12
|
+
UTXO = "UTXO",
|
|
13
|
+
OTHER = "OTHER"
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=SelectableCategoryList.types.d.ts.map
|
package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.types.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectableCategoryList.types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/SelectableCategoryList/SelectableCategoryList.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,oBAAY,oBAAoB;IAC9B,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/SelectableCategoryList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './I18nManager';
|
|
2
2
|
export * from './Alert';
|
|
3
3
|
export * from './BestRoute';
|
|
4
|
+
export * from './BlockchainsChip';
|
|
4
5
|
export * from './BottomLogo';
|
|
5
6
|
export * from './Button';
|
|
6
7
|
export * from './IconButton';
|
|
@@ -21,6 +22,7 @@ export * from './RoutesOverview';
|
|
|
21
22
|
export * from './SecondaryPage';
|
|
22
23
|
export * from './SelectableWalletList';
|
|
23
24
|
export * from './Wallet';
|
|
25
|
+
export * from './SelectableCategoryList';
|
|
24
26
|
export * from './Spinner';
|
|
25
27
|
export * from './StepDetail';
|
|
26
28
|
export * from './SwapContainer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAA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AC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { darkTheme, styled } from '../../theme';
|
|
2
|
+
|
|
3
|
+
export const Chip = styled('button', {
|
|
4
|
+
padding: '$10',
|
|
5
|
+
borderRadius: '$sm',
|
|
6
|
+
$$color: '$colors$neutral100',
|
|
7
|
+
[`.${darkTheme} &`]: {
|
|
8
|
+
$$color: '$colors$neutral300',
|
|
9
|
+
},
|
|
10
|
+
backgroundColor: '$$color',
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
cursor: 'pointer',
|
|
16
|
+
border: 0,
|
|
17
|
+
'.image-container': {
|
|
18
|
+
borderRadius: '$xm',
|
|
19
|
+
overflow: 'hidden',
|
|
20
|
+
},
|
|
21
|
+
'&:hover': {
|
|
22
|
+
$$color: '$colors$info100',
|
|
23
|
+
[`.${darkTheme} &`]: {
|
|
24
|
+
$$color: '$colors$neutral100',
|
|
25
|
+
},
|
|
26
|
+
backgroundColor: '$$color',
|
|
27
|
+
},
|
|
28
|
+
'&:focus-visible': {
|
|
29
|
+
outline: 0,
|
|
30
|
+
$$color: '$colors$info100',
|
|
31
|
+
[`.${darkTheme} &`]: {
|
|
32
|
+
$$color: '$colors$info700',
|
|
33
|
+
},
|
|
34
|
+
backgroundColor: '$$color',
|
|
35
|
+
},
|
|
36
|
+
variants: {
|
|
37
|
+
selected: {
|
|
38
|
+
true: { outline: '1px solid $secondary500' },
|
|
39
|
+
false: { outline: 0 },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PropTypes } from './BlockchainsChip.types';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import { Chip } from './BlockchainsChip.styles';
|
|
7
|
+
|
|
8
|
+
export function BlockchainsChip(props: PropsWithChildren<PropTypes>) {
|
|
9
|
+
const { children, selected, onClick } = props;
|
|
10
|
+
return (
|
|
11
|
+
<Chip selected={selected} onClick={onClick}>
|
|
12
|
+
{children}
|
|
13
|
+
</Chip>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BlockchainsChip } from './BlockchainsChip';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type BlockchainMeta, TransactionType } from 'rango-sdk';
|
|
2
|
+
|
|
3
|
+
import { BlockchainCategories } from './SelectableCategoryList.types';
|
|
4
|
+
|
|
5
|
+
const filterByType = (blockchain: BlockchainMeta, type: string): boolean => {
|
|
6
|
+
switch (type) {
|
|
7
|
+
case BlockchainCategories.ALL:
|
|
8
|
+
return true;
|
|
9
|
+
case BlockchainCategories.UTXO:
|
|
10
|
+
return blockchain.type === TransactionType.TRANSFER;
|
|
11
|
+
case BlockchainCategories.OTHER:
|
|
12
|
+
return (
|
|
13
|
+
blockchain.type !== TransactionType.TRANSFER &&
|
|
14
|
+
blockchain.type !== TransactionType.COSMOS &&
|
|
15
|
+
blockchain.type !== TransactionType.EVM
|
|
16
|
+
);
|
|
17
|
+
default:
|
|
18
|
+
return blockchain.type === type;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const blockchainslogo = {
|
|
23
|
+
[BlockchainCategories.EVM]: ['ETH', 'BSC', 'POLYGON'],
|
|
24
|
+
[BlockchainCategories.COSMOS]: ['COSMOS', 'OSMOSIS', 'JUNO'],
|
|
25
|
+
[BlockchainCategories.UTXO]: ['BTC', 'LTC', 'BCH'],
|
|
26
|
+
[BlockchainCategories.OTHER]: ['STARKNET', 'TRON', 'SOLANA'],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const generateBlockchainsLogo = (
|
|
30
|
+
list: BlockchainMeta[],
|
|
31
|
+
type: Exclude<BlockchainCategories, 'ALL'>
|
|
32
|
+
) =>
|
|
33
|
+
list
|
|
34
|
+
.filter((item) => filterByType(item, type))
|
|
35
|
+
.filter((item) => blockchainslogo[type].includes(item.name));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { styled } from '../../theme';
|
|
2
|
+
|
|
3
|
+
export const Container = styled('div', {
|
|
4
|
+
display: 'grid',
|
|
5
|
+
gap: '$10',
|
|
6
|
+
gridTemplateColumns: 'auto 1fr 1fr 1fr 1fr',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const ImageContent = styled('div', {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
position: 'relative',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
paddingTop: '$10',
|
|
15
|
+
});
|
|
16
|
+
export const FirstImage = styled('img', {
|
|
17
|
+
position: 'absolute',
|
|
18
|
+
top: -2,
|
|
19
|
+
width: 15,
|
|
20
|
+
height: 15,
|
|
21
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
|
+
import type { PropTypes } from './SelectableCategoryList.types';
|
|
3
|
+
|
|
4
|
+
import { i18n } from '@lingui/core';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Divider, Image, Skeleton, Typography } from '..';
|
|
8
|
+
import { BlockchainsChip } from '../BlockchainsChip';
|
|
9
|
+
|
|
10
|
+
import { generateBlockchainsLogo } from './SelectableCategoryList.helpers';
|
|
11
|
+
import {
|
|
12
|
+
Container,
|
|
13
|
+
FirstImage,
|
|
14
|
+
ImageContent,
|
|
15
|
+
} from './SelectableCategoryList.styles';
|
|
16
|
+
import { BlockchainCategories } from './SelectableCategoryList.types';
|
|
17
|
+
|
|
18
|
+
export function SelectableCategoryList(props: PropTypes) {
|
|
19
|
+
const { setCategory, category, blockchains, isLoading } = props;
|
|
20
|
+
const categories = Object.keys(
|
|
21
|
+
BlockchainCategories
|
|
22
|
+
) as BlockchainCategories[];
|
|
23
|
+
return (
|
|
24
|
+
<Container>
|
|
25
|
+
{isLoading &&
|
|
26
|
+
Array.from(Array(5), (_, index) => (
|
|
27
|
+
<Skeleton
|
|
28
|
+
key={index}
|
|
29
|
+
variant="rounded"
|
|
30
|
+
height={70}
|
|
31
|
+
width={index === 0 ? 45 : 65}
|
|
32
|
+
/>
|
|
33
|
+
))}
|
|
34
|
+
{!isLoading &&
|
|
35
|
+
categories.map((blockchainCategory) => (
|
|
36
|
+
<BlockchainsChip
|
|
37
|
+
selected={category === blockchainCategory}
|
|
38
|
+
key={blockchainCategory}
|
|
39
|
+
onClick={() => setCategory(blockchainCategory)}>
|
|
40
|
+
{blockchainCategory !== BlockchainCategories.ALL && (
|
|
41
|
+
<>
|
|
42
|
+
<ImageContent>
|
|
43
|
+
{generateBlockchainsLogo(blockchains, blockchainCategory).map(
|
|
44
|
+
(blockchain, index) =>
|
|
45
|
+
index === 0 ? (
|
|
46
|
+
<FirstImage
|
|
47
|
+
key={`image-${blockchain.name}-${blockchain.chainId}`}
|
|
48
|
+
src={blockchain.logo}
|
|
49
|
+
/>
|
|
50
|
+
) : (
|
|
51
|
+
<Image
|
|
52
|
+
key={`image-${blockchain.name}-${blockchain.chainId}`}
|
|
53
|
+
src={blockchain.logo}
|
|
54
|
+
size={15}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
57
|
+
)}
|
|
58
|
+
</ImageContent>
|
|
59
|
+
<Divider size={12} />
|
|
60
|
+
</>
|
|
61
|
+
)}
|
|
62
|
+
<Typography
|
|
63
|
+
size="xsmall"
|
|
64
|
+
variant="body"
|
|
65
|
+
color={
|
|
66
|
+
blockchainCategory === BlockchainCategories.ALL
|
|
67
|
+
? 'secondary500'
|
|
68
|
+
: undefined
|
|
69
|
+
}>
|
|
70
|
+
{i18n.t(BlockchainCategories[blockchainCategory])}
|
|
71
|
+
</Typography>
|
|
72
|
+
</BlockchainsChip>
|
|
73
|
+
))}
|
|
74
|
+
</Container>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BlockchainMeta } from 'rango-sdk';
|
|
2
|
+
|
|
3
|
+
export interface PropTypes {
|
|
4
|
+
setCategory: (type: string) => void;
|
|
5
|
+
category: string;
|
|
6
|
+
blockchains: BlockchainMeta[];
|
|
7
|
+
isLoading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export enum BlockchainCategories {
|
|
11
|
+
ALL = 'ALL',
|
|
12
|
+
EVM = 'EVM',
|
|
13
|
+
COSMOS = 'COSMOS',
|
|
14
|
+
UTXO = 'UTXO',
|
|
15
|
+
OTHER = 'OTHER',
|
|
16
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './I18nManager';
|
|
2
2
|
export * from './Alert';
|
|
3
3
|
export * from './BestRoute';
|
|
4
|
+
export * from './BlockchainsChip';
|
|
4
5
|
export * from './BottomLogo';
|
|
5
6
|
export * from './Button';
|
|
6
7
|
export * from './IconButton';
|
|
@@ -21,6 +22,7 @@ export * from './RoutesOverview';
|
|
|
21
22
|
export * from './SecondaryPage';
|
|
22
23
|
export * from './SelectableWalletList';
|
|
23
24
|
export * from './Wallet';
|
|
25
|
+
export * from './SelectableCategoryList';
|
|
24
26
|
export * from './Spinner';
|
|
25
27
|
export * from './StepDetail';
|
|
26
28
|
export * from './SwapContainer';
|