@rango-dev/ui 0.15.1-next.17 → 0.15.1-next.19

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 (60) hide show
  1. package/dist/index.js +6 -6
  2. package/dist/index.js.map +4 -4
  3. package/dist/translations/en.d.ts.map +1 -1
  4. package/dist/translations/es.d.ts.map +1 -1
  5. package/dist/translations/fr.d.ts.map +1 -1
  6. package/dist/translations/jp.d.ts.map +1 -1
  7. package/dist/widget/ui/src/components/BestRoute/BestRoute.d.ts.map +1 -1
  8. package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.d.ts +5 -0
  9. package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.d.ts.map +1 -0
  10. package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.styles.d.ts +156 -0
  11. package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +1 -0
  12. package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.types.d.ts +6 -0
  13. package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.types.d.ts.map +1 -0
  14. package/dist/widget/ui/src/components/BlockchainsChip/index.d.ts +2 -0
  15. package/dist/widget/ui/src/components/BlockchainsChip/index.d.ts.map +1 -0
  16. package/dist/widget/ui/src/components/Button/Button.styles.d.ts.map +1 -1
  17. package/dist/widget/ui/src/components/Checkbox/Checkbox.types.d.ts +2 -1
  18. package/dist/widget/ui/src/components/Checkbox/Checkbox.types.d.ts.map +1 -1
  19. package/dist/widget/ui/src/components/IconButton/IconButton.d.ts +3 -5
  20. package/dist/widget/ui/src/components/IconButton/IconButton.d.ts.map +1 -1
  21. package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.d.ts +4 -0
  22. package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +1 -0
  23. package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +4 -0
  24. package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +1 -0
  25. package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts +460 -0
  26. package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts.map +1 -0
  27. package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.types.d.ts +15 -0
  28. package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.types.d.ts.map +1 -0
  29. package/dist/widget/ui/src/components/SelectableCategoryList/index.d.ts +3 -0
  30. package/dist/widget/ui/src/components/SelectableCategoryList/index.d.ts.map +1 -0
  31. package/dist/widget/ui/src/components/TextField/TextField.styles.d.ts.map +1 -1
  32. package/dist/widget/ui/src/components/Tooltip/Tooltip.d.ts.map +1 -1
  33. package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts +308 -0
  34. package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts.map +1 -1
  35. package/dist/widget/ui/src/components/index.d.ts +2 -0
  36. package/dist/widget/ui/src/components/index.d.ts.map +1 -1
  37. package/dist/widget/ui/src/containers/SwapInput/SwapInput.d.ts.map +1 -1
  38. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/src/components/BestRoute/BestRoute.tsx +4 -2
  41. package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +42 -0
  42. package/src/components/BlockchainsChip/BlockchainsChip.tsx +15 -0
  43. package/src/components/BlockchainsChip/BlockchainsChip.types.ts +4 -0
  44. package/src/components/BlockchainsChip/index.ts +1 -0
  45. package/src/components/Button/Button.styles.tsx +4 -13
  46. package/src/components/Checkbox/Checkbox.types.ts +1 -1
  47. package/src/components/IconButton/IconButton.tsx +8 -2
  48. package/src/components/Modal/Modal.tsx +1 -1
  49. package/src/components/RouteCost/RouteCost.tsx +2 -2
  50. package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +35 -0
  51. package/src/components/SelectableCategoryList/SelectableCategoryList.styles.ts +21 -0
  52. package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +76 -0
  53. package/src/components/SelectableCategoryList/SelectableCategoryList.types.ts +16 -0
  54. package/src/components/SelectableCategoryList/index.ts +2 -0
  55. package/src/components/TextField/TextField.styles.ts +3 -1
  56. package/src/components/Tooltip/Tooltip.styles.ts +10 -0
  57. package/src/components/Tooltip/Tooltip.tsx +9 -4
  58. package/src/components/index.ts +2 -0
  59. package/src/containers/SwapInput/SwapInput.styles.ts +0 -7
  60. package/src/containers/SwapInput/SwapInput.tsx +3 -1
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ export { SelectableCategoryList } from './SelectableCategoryList';
2
+ export { BlockchainCategories } from './SelectableCategoryList.types';
@@ -90,7 +90,6 @@ export const Input = styled('input', {
90
90
  fontWeight: 400,
91
91
  border: 'none',
92
92
  outline: 'none',
93
- width: '100%',
94
93
  variants: {
95
94
  suffix: {
96
95
  true: { marginRight: '$10' },
@@ -113,6 +112,9 @@ export const Input = styled('input', {
113
112
  '&::placeholder, &::-webkit-input-placeholder': {
114
113
  color: '$neutral900',
115
114
  },
115
+ '&:focus-within': {
116
+ outline: 'none',
117
+ },
116
118
  });
117
119
 
118
120
  export const Label = styled('label', {
@@ -1,6 +1,16 @@
1
+ import * as RadixTooltip from '@radix-ui/react-tooltip';
2
+
1
3
  import { styled } from '../../theme';
2
4
  import { Typography } from '../Typography';
3
5
 
6
+ export const TooltipContent = styled(RadixTooltip.Content, {
7
+ zIndex: '999999',
8
+ });
9
+
10
+ export const TooltipArrow = styled(RadixTooltip.Arrow, {
11
+ fill: '$neutral100',
12
+ });
13
+
4
14
  export const TooltipTypography = styled(Typography, {
5
15
  borderRadius: '$md',
6
16
  padding: '$5 $10',
@@ -4,7 +4,11 @@ import type { PropsWithChildren } from 'react';
4
4
  import * as RadixTooltip from '@radix-ui/react-tooltip';
5
5
  import React from 'react';
6
6
 
7
- import { TooltipTypography } from './Tooltip.styles';
7
+ import {
8
+ TooltipArrow,
9
+ TooltipContent,
10
+ TooltipTypography,
11
+ } from './Tooltip.styles';
8
12
 
9
13
  export function Tooltip(props: PropsWithChildren<PropTypes>) {
10
14
  const {
@@ -16,17 +20,18 @@ export function Tooltip(props: PropsWithChildren<PropTypes>) {
16
20
  side = 'top',
17
21
  } = props;
18
22
  return (
19
- <RadixTooltip.Provider>
23
+ <RadixTooltip.Provider delayDuration={0}>
20
24
  <RadixTooltip.Root>
21
25
  <RadixTooltip.Trigger asChild>
22
26
  <div>{children}</div>
23
27
  </RadixTooltip.Trigger>
24
28
  <RadixTooltip.Portal container={container}>
25
- <RadixTooltip.Content side={side} sideOffset={sideOffset}>
29
+ <TooltipContent side={side} sideOffset={sideOffset}>
26
30
  <TooltipTypography variant="label" size="medium" color={color}>
27
31
  {content}
28
32
  </TooltipTypography>
29
- </RadixTooltip.Content>
33
+ <TooltipArrow />
34
+ </TooltipContent>
30
35
  </RadixTooltip.Portal>
31
36
  </RadixTooltip.Root>
32
37
  </RadixTooltip.Provider>
@@ -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';
@@ -61,11 +61,4 @@ export const MaxButton = styled(Button, {
61
61
  $$color: '$colors$secondary800',
62
62
  },
63
63
  backgroundColor: '$$color',
64
- '&:focus-visible': {
65
- $$outline: '$colors$info600',
66
- [`.${darkTheme} &`]: {
67
- $$outline: '$colors$info100',
68
- },
69
- outlineColor: '$$outline',
70
- },
71
64
  });
@@ -95,7 +95,9 @@ export function SwapInput(props: SwapInputProps) {
95
95
  overflow: 'hidden',
96
96
  textOverflow: 'ellipsis',
97
97
  }}>
98
- {props.price.usdValue || props.price.error}
98
+ {props.price.usdValue
99
+ ? `~$${props.price.usdValue}`
100
+ : props.price.error}
99
101
  </Typography>
100
102
  )}
101
103
  </>