@rango-dev/ui 0.28.2-next.1 → 0.28.2-next.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 (162) 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/ja.d.ts.map +1 -1
  7. package/dist/translations/pt.d.ts +2 -0
  8. package/dist/translations/pt.d.ts.map +1 -0
  9. package/dist/widget/ui/src/components/Alert/Alert.helpers.d.ts +3 -2
  10. package/dist/widget/ui/src/components/Alert/Alert.helpers.d.ts.map +1 -1
  11. package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts +9 -5
  12. package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts.map +1 -1
  13. package/dist/widget/ui/src/components/Alert/Alert.types.d.ts +3 -2
  14. package/dist/widget/ui/src/components/Alert/Alert.types.d.ts.map +1 -1
  15. package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.styles.d.ts +1 -0
  16. package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +1 -1
  17. package/dist/widget/ui/src/components/BottomLogo/BottomLogo.styles.d.ts +2 -0
  18. package/dist/widget/ui/src/components/BottomLogo/BottomLogo.styles.d.ts.map +1 -1
  19. package/dist/widget/ui/src/components/Button/Button.styles.d.ts +3 -0
  20. package/dist/widget/ui/src/components/Button/Button.styles.d.ts.map +1 -1
  21. package/dist/widget/ui/src/components/ChainToken/ChainToken.styles.d.ts +2 -0
  22. package/dist/widget/ui/src/components/ChainToken/ChainToken.styles.d.ts.map +1 -1
  23. package/dist/widget/ui/src/components/Checkbox/Checkbox.styles.d.ts +4 -0
  24. package/dist/widget/ui/src/components/Checkbox/Checkbox.styles.d.ts.map +1 -1
  25. package/dist/widget/ui/src/components/Chip/Chip.styles.d.ts +1 -0
  26. package/dist/widget/ui/src/components/Chip/Chip.styles.d.ts.map +1 -1
  27. package/dist/widget/ui/src/components/Collapsible/Collapsible.styles.d.ts +1 -0
  28. package/dist/widget/ui/src/components/Collapsible/Collapsible.styles.d.ts.map +1 -1
  29. package/dist/widget/ui/src/components/Divider/Divider.styles.d.ts +1 -0
  30. package/dist/widget/ui/src/components/Divider/Divider.styles.d.ts.map +1 -1
  31. package/dist/widget/ui/src/components/Drawer/Drawer.styles.d.ts +5 -0
  32. package/dist/widget/ui/src/components/Drawer/Drawer.styles.d.ts.map +1 -1
  33. package/dist/widget/ui/src/components/Flags/Portuguese.d.ts +4 -0
  34. package/dist/widget/ui/src/components/Flags/Portuguese.d.ts.map +1 -0
  35. package/dist/widget/ui/src/components/Flags/index.d.ts +2 -1
  36. package/dist/widget/ui/src/components/Flags/index.d.ts.map +1 -1
  37. package/dist/widget/ui/src/components/Header/Header.styles.d.ts +2 -0
  38. package/dist/widget/ui/src/components/Header/Header.styles.d.ts.map +1 -1
  39. package/dist/widget/ui/src/components/I18nManager/I18nManager.d.ts +1 -0
  40. package/dist/widget/ui/src/components/I18nManager/I18nManager.d.ts.map +1 -1
  41. package/dist/widget/ui/src/components/Icon/CloseIcon.d.ts +1 -0
  42. package/dist/widget/ui/src/components/Icon/CloseIcon.d.ts.map +1 -1
  43. package/dist/widget/ui/src/components/Icon/common.d.ts +2 -0
  44. package/dist/widget/ui/src/components/Icon/common.d.ts.map +1 -1
  45. package/dist/widget/ui/src/components/List/List.styles.d.ts +1 -0
  46. package/dist/widget/ui/src/components/List/List.styles.d.ts.map +1 -1
  47. package/dist/widget/ui/src/components/ListItem/ListItem.styles.d.ts +1 -0
  48. package/dist/widget/ui/src/components/ListItem/ListItem.styles.d.ts.map +1 -1
  49. package/dist/widget/ui/src/components/ListItemButton/ListItemButton.styles.d.ts +1 -0
  50. package/dist/widget/ui/src/components/ListItemButton/ListItemButton.styles.d.ts.map +1 -1
  51. package/dist/widget/ui/src/components/MessageBox/CollapsibleMessageBox.styles.d.ts +1 -0
  52. package/dist/widget/ui/src/components/MessageBox/CollapsibleMessageBox.styles.d.ts.map +1 -1
  53. package/dist/widget/ui/src/components/MessageBox/MessageBox.styles.d.ts +3 -0
  54. package/dist/widget/ui/src/components/MessageBox/MessageBox.styles.d.ts.map +1 -1
  55. package/dist/widget/ui/src/components/Modal/Modal.d.ts.map +1 -1
  56. package/dist/widget/ui/src/components/Modal/Modal.styles.d.ts +6 -0
  57. package/dist/widget/ui/src/components/Modal/Modal.styles.d.ts.map +1 -1
  58. package/dist/widget/ui/src/components/NotFound/NotFound.styles.d.ts +1 -0
  59. package/dist/widget/ui/src/components/NotFound/NotFound.styles.d.ts.map +1 -1
  60. package/dist/widget/ui/src/components/Popover/Popover.styles.d.ts +2 -0
  61. package/dist/widget/ui/src/components/Popover/Popover.styles.d.ts.map +1 -1
  62. package/dist/widget/ui/src/components/PriceImpact/PriceImpact.styles.d.ts +2 -0
  63. package/dist/widget/ui/src/components/PriceImpact/PriceImpact.styles.d.ts.map +1 -1
  64. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts +4 -0
  65. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts.map +1 -1
  66. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.types.d.ts +2 -1
  67. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.types.d.ts.map +1 -1
  68. package/dist/widget/ui/src/components/Radio/Radio.styles.d.ts +2 -0
  69. package/dist/widget/ui/src/components/Radio/Radio.styles.d.ts.map +1 -1
  70. package/dist/widget/ui/src/components/RadioGroup/RadioGroup.styles.d.ts +4 -0
  71. package/dist/widget/ui/src/components/RadioGroup/RadioGroup.styles.d.ts.map +1 -1
  72. package/dist/widget/ui/src/components/RefreshProgressButton/RefreshProgressButton.styles.d.ts +2 -0
  73. package/dist/widget/ui/src/components/RefreshProgressButton/RefreshProgressButton.styles.d.ts.map +1 -1
  74. package/dist/widget/ui/src/components/RoutesOverview/RoutesOverview.d.ts +1 -0
  75. package/dist/widget/ui/src/components/RoutesOverview/RoutesOverview.d.ts.map +1 -1
  76. package/dist/widget/ui/src/components/Select/Select.d.ts +4 -0
  77. package/dist/widget/ui/src/components/Select/Select.d.ts.map +1 -0
  78. package/dist/widget/ui/src/components/Select/Select.types.d.ts +12 -0
  79. package/dist/widget/ui/src/components/Select/Select.types.d.ts.map +1 -0
  80. package/dist/widget/ui/src/components/Select/index.d.ts +2 -0
  81. package/dist/widget/ui/src/components/Select/index.d.ts.map +1 -0
  82. package/dist/widget/ui/src/components/Select/select.styles.d.ts +492 -0
  83. package/dist/widget/ui/src/components/Select/select.styles.d.ts.map +1 -0
  84. package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts +3 -0
  85. package/dist/widget/ui/src/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts.map +1 -1
  86. package/dist/widget/ui/src/components/Skeleton/Skeleton.styles.d.ts +1 -0
  87. package/dist/widget/ui/src/components/Skeleton/Skeleton.styles.d.ts.map +1 -1
  88. package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts +6 -0
  89. package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts.map +1 -1
  90. package/dist/widget/ui/src/components/SvgIcon/SvgIcon.style.d.ts +1 -0
  91. package/dist/widget/ui/src/components/SvgIcon/SvgIcon.style.d.ts.map +1 -1
  92. package/dist/widget/ui/src/components/SwapDetailsPlaceholder/SwapDetailsPlaceholder.d.ts +1 -0
  93. package/dist/widget/ui/src/components/SwapDetailsPlaceholder/SwapDetailsPlaceholder.d.ts.map +1 -1
  94. package/dist/widget/ui/src/components/SwapListItem/SwapListItem.styles.d.ts +6 -0
  95. package/dist/widget/ui/src/components/SwapListItem/SwapListItem.styles.d.ts.map +1 -1
  96. package/dist/widget/ui/src/components/SwapListItem/SwapToken.styles.d.ts +9 -0
  97. package/dist/widget/ui/src/components/SwapListItem/SwapToken.styles.d.ts.map +1 -1
  98. package/dist/widget/ui/src/components/Switch/Switch.styles.d.ts +2 -0
  99. package/dist/widget/ui/src/components/Switch/Switch.styles.d.ts.map +1 -1
  100. package/dist/widget/ui/src/components/TextField/TextField.d.ts +1 -1
  101. package/dist/widget/ui/src/components/TextField/TextField.stories.d.ts +1 -1
  102. package/dist/widget/ui/src/components/TextField/TextField.styles.d.ts +3 -0
  103. package/dist/widget/ui/src/components/TextField/TextField.styles.d.ts.map +1 -1
  104. package/dist/widget/ui/src/components/Toast/Toast.d.ts.map +1 -1
  105. package/dist/widget/ui/src/components/Toast/Toast.helpers.d.ts +4 -0
  106. package/dist/widget/ui/src/components/Toast/Toast.helpers.d.ts.map +1 -1
  107. package/dist/widget/ui/src/components/Toast/Toast.styles.d.ts +173 -1
  108. package/dist/widget/ui/src/components/Toast/Toast.styles.d.ts.map +1 -1
  109. package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts +3 -0
  110. package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts.map +1 -1
  111. package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts +3 -0
  112. package/dist/widget/ui/src/components/Tooltip/Tooltip.styles.d.ts.map +1 -1
  113. package/dist/widget/ui/src/components/Typography/NotSelectableTypography.d.ts +164 -0
  114. package/dist/widget/ui/src/components/Typography/NotSelectableTypography.d.ts.map +1 -0
  115. package/dist/widget/ui/src/components/Typography/Typography.styles.d.ts +1 -0
  116. package/dist/widget/ui/src/components/Typography/Typography.styles.d.ts.map +1 -1
  117. package/dist/widget/ui/src/components/Typography/index.d.ts +1 -0
  118. package/dist/widget/ui/src/components/Typography/index.d.ts.map +1 -1
  119. package/dist/widget/ui/src/components/Wallet/Wallet.styles.d.ts +5 -0
  120. package/dist/widget/ui/src/components/Wallet/Wallet.styles.d.ts.map +1 -1
  121. package/dist/widget/ui/src/components/common/FilledCircle.d.ts +1 -0
  122. package/dist/widget/ui/src/components/common/FilledCircle.d.ts.map +1 -1
  123. package/dist/widget/ui/src/components/common/Image.d.ts +1 -0
  124. package/dist/widget/ui/src/components/common/Image.d.ts.map +1 -1
  125. package/dist/widget/ui/src/components/common/styles.d.ts +1 -0
  126. package/dist/widget/ui/src/components/common/styles.d.ts.map +1 -1
  127. package/dist/widget/ui/src/components/index.d.ts +1 -0
  128. package/dist/widget/ui/src/components/index.d.ts.map +1 -1
  129. package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.d.ts +10 -0
  130. package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.d.ts.map +1 -1
  131. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts +12 -1
  132. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts.map +1 -1
  133. package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts +5 -0
  134. package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts.map +1 -1
  135. package/dist/widget/ui/src/containers/TokenSelector/TokenSelector.d.ts +1 -0
  136. package/dist/widget/ui/src/containers/TokenSelector/TokenSelector.d.ts.map +1 -1
  137. package/dist/widget/ui/src/theme.d.ts +25 -13
  138. package/dist/widget/ui/src/theme.d.ts.map +1 -1
  139. package/package.json +5 -4
  140. package/readme.md +3 -1
  141. package/src/components/Alert/Alert.helpers.ts +13 -2
  142. package/src/components/Alert/Alert.styles.ts +7 -8
  143. package/src/components/Alert/Alert.tsx +6 -6
  144. package/src/components/Alert/Alert.types.ts +3 -2
  145. package/src/components/Flags/Portuguese.tsx +34 -0
  146. package/src/components/Flags/index.ts +2 -1
  147. package/src/components/I18nManager/I18nManager.tsx +2 -0
  148. package/src/components/Modal/Modal.tsx +19 -7
  149. package/src/components/QuoteCost/QuoteCost.styles.ts +0 -1
  150. package/src/components/QuoteCost/QuoteCost.types.ts +1 -1
  151. package/src/components/Select/Select.tsx +85 -0
  152. package/src/components/Select/Select.types.ts +10 -0
  153. package/src/components/Select/index.ts +1 -0
  154. package/src/components/Select/select.styles.ts +100 -0
  155. package/src/components/TextField/TextField.styles.ts +1 -0
  156. package/src/components/Toast/Toast.helpers.ts +5 -0
  157. package/src/components/Toast/Toast.styles.ts +209 -5
  158. package/src/components/Toast/Toast.tsx +59 -34
  159. package/src/components/Typography/NotSelectableTypography.ts +7 -0
  160. package/src/components/Typography/index.ts +1 -0
  161. package/src/components/index.ts +1 -0
  162. package/src/theme.ts +4 -1
@@ -1,4 +1,4 @@
1
- import { css, darkTheme, styled } from '../../theme';
1
+ import { darkTheme, styled } from '../../theme';
2
2
 
3
3
  export const Container = styled('div', {
4
4
  display: 'flex',
@@ -34,7 +34,6 @@ export const Container = styled('div', {
34
34
  },
35
35
  alarm: {
36
36
  padding: '$5 $10',
37
- alignItems: 'center',
38
37
  '.title_typography': {
39
38
  fontWeight: '$medium',
40
39
  },
@@ -106,6 +105,12 @@ export const Main = styled('div', {
106
105
  },
107
106
  });
108
107
 
108
+ export const TitleContainer = styled('div', {
109
+ display: 'flex',
110
+ alignItems: 'center',
111
+ flex: '1 0 0',
112
+ });
113
+
109
114
  export const IconHighlight = styled('div', {
110
115
  borderRadius: '$lg',
111
116
  width: '$20',
@@ -160,9 +165,3 @@ export const IconHighlight = styled('div', {
160
165
  },
161
166
  },
162
167
  });
163
-
164
- export const titleStyles = css({
165
- display: 'flex',
166
- alignItems: 'center',
167
- flex: '1 0 0',
168
- });
@@ -6,8 +6,8 @@ import React from 'react';
6
6
  import { Divider } from '../Divider';
7
7
  import { Typography } from '../Typography';
8
8
 
9
- import { getColor } from './Alert.helpers';
10
- import { Container, IconHighlight, Main, titleStyles } from './Alert.styles';
9
+ import { getColor, mapVariantToSize } from './Alert.helpers';
10
+ import { Container, IconHighlight, Main, TitleContainer } from './Alert.styles';
11
11
  import AlertIcon from './AlertIcon';
12
12
 
13
13
  export function Alert(props: PropsWithChildren<PropTypes>) {
@@ -25,11 +25,11 @@ export function Alert(props: PropsWithChildren<PropTypes>) {
25
25
  return (
26
26
  <Container
27
27
  className="_alert"
28
- style={containerStyles}
28
+ css={containerStyles}
29
29
  type={type}
30
30
  variant={variant}>
31
31
  <Main variant={variant}>
32
- <div className={titleStyles()}>
32
+ <TitleContainer>
33
33
  <IconHighlight type={type}>
34
34
  <AlertIcon type={type} />
35
35
  </IconHighlight>
@@ -40,11 +40,11 @@ export function Alert(props: PropsWithChildren<PropTypes>) {
40
40
  align={titleAlign}
41
41
  variant="body"
42
42
  className="title_typography"
43
- size={variant === 'regular' ? 'xsmall' : 'small'}>
43
+ size={mapVariantToSize(variant)}>
44
44
  {title}
45
45
  </Typography>
46
46
  )}
47
- </div>
47
+ </TitleContainer>
48
48
  {action ? <div>{action}</div> : null}
49
49
  </Main>
50
50
  {footer ? (
@@ -1,5 +1,6 @@
1
1
  import type { BaseAlign } from '../Typography/Typography.types';
2
- import type { CSSProperties, ReactNode } from 'react';
2
+ import type { ReactNode } from 'react';
3
+ import type { CSS } from 'src/theme';
3
4
 
4
5
  export type Type = 'success' | 'warning' | 'error' | 'info' | 'loading';
5
6
 
@@ -9,6 +10,6 @@ export interface PropTypes {
9
10
  footer?: ReactNode;
10
11
  action?: ReactNode;
11
12
  variant?: 'alarm' | 'regular';
12
- containerStyles?: CSSProperties;
13
+ containerStyles?: CSS;
13
14
  titleAlign?: BaseAlign;
14
15
  }
@@ -0,0 +1,34 @@
1
+ import type { FlagPropTypes } from './Flags.types';
2
+
3
+ import React from 'react';
4
+
5
+ import { DEFAULT_SIZE } from './Flags.constants';
6
+
7
+ export default function Portuguese(props: FlagPropTypes) {
8
+ const { size = DEFAULT_SIZE } = props;
9
+
10
+ return (
11
+ <svg
12
+ width={size}
13
+ height={size}
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ viewBox="0 0 512 512">
16
+ <mask id="a">
17
+ <circle cx="256" cy="256" r="256" fill="#fff" />
18
+ </mask>
19
+ <g mask="url(#a)">
20
+ <path fill="#6da544" d="M0 512h167l37.9-260.3L167 0H0z" />
21
+ <path fill="#d80027" d="M512 0H167v512h345z" />
22
+ <circle cx="167" cy="256" r="89" fill="#ffda44" />
23
+ <path
24
+ fill="#d80027"
25
+ d="M116.9 211.5V267a50 50 0 1 0 100.1 0v-55.6H117z"
26
+ />
27
+ <path
28
+ fill="#eee"
29
+ d="M167 283.8c-9.2 0-16.7-7.5-16.7-16.7V245h33.4v22c0 9.2-7.5 16.7-16.7 16.7z"
30
+ />
31
+ </g>
32
+ </svg>
33
+ );
34
+ }
@@ -1,8 +1,9 @@
1
1
  import English from './English';
2
2
  import French from './French';
3
3
  import Japanese from './Japanese';
4
+ import Portuguese from './Portuguese';
4
5
  import Spanish from './Spanish';
5
6
 
6
7
  export type { FlagPropTypes } from './Flags.types';
7
8
 
8
- export { English, Spanish, Japanese, French };
9
+ export { English, Spanish, Japanese, French, Portuguese };
@@ -15,12 +15,14 @@ import { messages as enMessages } from '../../../../../translations/en';
15
15
  import { messages as esMessages } from '../../../../../translations/es';
16
16
  import { messages as frMessages } from '../../../../../translations/fr';
17
17
  import { messages as jaMessages } from '../../../../../translations/ja';
18
+ import { messages as ptMessages } from '../../../../../translations/pt';
18
19
 
19
20
  const messages = {
20
21
  en: enMessages,
21
22
  es: esMessages,
22
23
  ja: jaMessages,
23
24
  fr: frMessages,
25
+ pt: ptMessages,
24
26
  };
25
27
 
26
28
  i18n.load(messages);
@@ -46,6 +46,8 @@ export function Modal(props: PropsWithChildren<PropTypes>) {
46
46
  const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
47
47
 
48
48
  const handleBackDropClick = (event: React.MouseEvent<HTMLDivElement>) => {
49
+ event.stopPropagation();
50
+
49
51
  if (event.target === event.currentTarget && dismissible) {
50
52
  onClose();
51
53
  }
@@ -58,15 +60,25 @@ export function Modal(props: PropsWithChildren<PropTypes>) {
58
60
  if (open) {
59
61
  setIsMount(true);
60
62
  container.style.overflow = 'hidden';
61
- timeoutRef.current = setTimeout(() => {
62
- setActive(true);
63
- }, transitionDuration?.enter || OPEN_DELAY);
63
+ timeoutRef.current = setTimeout(
64
+ () => {
65
+ setActive(true);
66
+ },
67
+ typeof transitionDuration?.enter !== 'undefined'
68
+ ? transitionDuration?.enter
69
+ : OPEN_DELAY
70
+ );
64
71
  } else {
65
72
  setActive(false);
66
- timeoutRef.current = setTimeout(() => {
67
- setIsMount(false);
68
- container.style.removeProperty('overflow');
69
- }, transitionDuration?.exit || CLOSED_DELAY);
73
+ timeoutRef.current = setTimeout(
74
+ () => {
75
+ setIsMount(false);
76
+ container.style.removeProperty('overflow');
77
+ },
78
+ typeof transitionDuration?.exit !== 'undefined'
79
+ ? transitionDuration?.exit
80
+ : CLOSED_DELAY
81
+ );
70
82
  }
71
83
  }
72
84
  return () => {
@@ -5,7 +5,6 @@ export const Container = styled('div', {
5
5
  display: 'flex',
6
6
  justifyContent: 'start',
7
7
  alignItems: 'center',
8
- paddingBottom: '$10',
9
8
  });
10
9
 
11
10
  export const Separator = styled('div', {
@@ -2,7 +2,7 @@ export type PropTypes = {
2
2
  fee: string;
3
3
  time: string | number;
4
4
  steps: number;
5
- onClickFee?: () => void;
5
+ onClickFee?: React.MouseEventHandler<HTMLDivElement>;
6
6
  tooltipGas?: string;
7
7
  feeWarning?: boolean;
8
8
  tooltipContainer?: HTMLElement;
@@ -0,0 +1,85 @@
1
+ import type { PropTypes } from './Select.types';
2
+
3
+ import * as Select from '@radix-ui/react-select';
4
+ import React, { useEffect, useRef, useState } from 'react';
5
+
6
+ import { ChevronDownIcon, ChevronUpIcon } from '../../icons';
7
+ import { Typography } from '../Typography';
8
+
9
+ import { SelectContent, SelectItem, SelectTrigger } from './select.styles';
10
+
11
+ export function SelectComponent(props: PropTypes) {
12
+ const [open, setOpen] = useState(false);
13
+ const selectRef = useRef<HTMLDivElement>(null);
14
+ const { options, value, container, handleItemClick } = props;
15
+ const handleToggle = () => {
16
+ setOpen((prev) => !prev);
17
+ };
18
+
19
+ const handleClickOutside = (e: MouseEvent) => {
20
+ if (selectRef.current && !selectRef.current.contains(e.target as Node)) {
21
+ setOpen(false);
22
+ }
23
+ };
24
+
25
+ useEffect(() => {
26
+ document.addEventListener('click', handleClickOutside);
27
+ return () => {
28
+ document.removeEventListener('click', handleClickOutside);
29
+ };
30
+ }, []);
31
+
32
+ return (
33
+ <div ref={selectRef}>
34
+ <Select.Root value={value.value} open={open}>
35
+ <SelectTrigger
36
+ onKeyDown={(event) => event.key === 'Enter' && handleToggle()}
37
+ onClick={handleToggle}
38
+ open={open}
39
+ aria-label={value.label}>
40
+ <Select.Value>
41
+ <Typography variant="body" size="small">
42
+ {value.label}
43
+ </Typography>
44
+ </Select.Value>
45
+
46
+ <Select.Icon className="SelectIcon">
47
+ <ChevronDownIcon size={12} />
48
+ </Select.Icon>
49
+ </SelectTrigger>
50
+ <Select.Portal container={container}>
51
+ <SelectContent>
52
+ <Select.ScrollUpButton className="SelectScrollButton">
53
+ <ChevronUpIcon />
54
+ </Select.ScrollUpButton>
55
+ <Select.Viewport className="SelectViewport">
56
+ <Select.Group>
57
+ {options.map(
58
+ (option) =>
59
+ option.value !== value?.value && (
60
+ <SelectItem
61
+ onClick={() => {
62
+ handleItemClick && handleItemClick(option);
63
+ handleToggle();
64
+ }}
65
+ key={option.value}
66
+ value={option.value}>
67
+ <Select.ItemText>
68
+ <Typography variant="body" size="small">
69
+ {option.label}
70
+ </Typography>
71
+ </Select.ItemText>
72
+ </SelectItem>
73
+ )
74
+ )}
75
+ </Select.Group>
76
+ </Select.Viewport>
77
+ <Select.ScrollDownButton className="SelectScrollButton">
78
+ <ChevronDownIcon />
79
+ </Select.ScrollDownButton>
80
+ </SelectContent>
81
+ </Select.Portal>
82
+ </Select.Root>
83
+ </div>
84
+ );
85
+ }
@@ -0,0 +1,10 @@
1
+ type Item = {
2
+ value: string;
3
+ label: string;
4
+ };
5
+ export type PropTypes = {
6
+ options: Item[];
7
+ handleItemClick?: (item: Item) => void;
8
+ value: Item;
9
+ container?: HTMLElement;
10
+ };
@@ -0,0 +1 @@
1
+ export { SelectComponent as Select } from './Select';
@@ -0,0 +1,100 @@
1
+ import * as Select from '@radix-ui/react-select';
2
+
3
+ import { darkTheme, styled } from '../../theme';
4
+
5
+ export const EXPANDABLE_QUOTE_TRANSITION_DURATION = 300;
6
+
7
+ export const SelectTrigger = styled(Select.Trigger, {
8
+ display: 'flex',
9
+ justifyContent: 'space-between',
10
+ alignItems: 'center',
11
+ cursor: 'pointer',
12
+ backgroundColor: '$secondary',
13
+ padding: '$5 $10',
14
+ border: 0,
15
+ whiteSpace: 'nowrap',
16
+
17
+ '& svg': {
18
+ transition: `all ${EXPANDABLE_QUOTE_TRANSITION_DURATION}ms ease`,
19
+ },
20
+
21
+ variants: {
22
+ open: {
23
+ true: {
24
+ borderTopLeftRadius: '$sm',
25
+ borderTopRightRadius: '$sm',
26
+ '& ._typography, & svg': {
27
+ color: '$secondary',
28
+ },
29
+
30
+ '& svg': {
31
+ transform: 'rotate(180deg)',
32
+ },
33
+ backgroundColor: '$neutral100',
34
+ [`.${darkTheme} &`]: {
35
+ backgroundColor: '$neutral300',
36
+ },
37
+ },
38
+ false: {
39
+ borderRadius: '$md',
40
+ '& ._typography, & svg': {
41
+ color: '$background',
42
+ [`.${darkTheme} &`]: {
43
+ color: '$foreground',
44
+ },
45
+ },
46
+ '& svg': {
47
+ transform: 'rotate(0)',
48
+ },
49
+ },
50
+ },
51
+ },
52
+ width: '100%',
53
+ '& ._typography': {
54
+ whiteSpace: 'nowrap',
55
+ overflow: 'hidden',
56
+ textOverflow: 'ellipsis',
57
+ width: '52px',
58
+ '@xs': {
59
+ width: 'auto',
60
+ },
61
+ },
62
+ });
63
+
64
+ export const SelectContent = styled(Select.Content, {
65
+ padding: '$5 $10',
66
+ width: '100%',
67
+ position: 'absolute',
68
+ top: '38px',
69
+ maxHeight: '146px',
70
+ overflowY: 'auto',
71
+ borderBottomLeftRadius: '$sm',
72
+ borderBottomRightRadius: '$sm',
73
+ boxShadow: '-5px 5px 10px 0px rgba(86, 86, 86, 0.10)',
74
+ backgroundColor: '$neutral100',
75
+ [`.${darkTheme} &`]: {
76
+ backgroundColor: '$neutral300',
77
+ },
78
+ });
79
+
80
+ export const SelectItem = styled(Select.Item, {
81
+ padding: '$10 0',
82
+ borderTop: '1px solid',
83
+ borderColor: '$neutral300',
84
+ [`.${darkTheme} &`]: {
85
+ borderColor: '$neutral400',
86
+ },
87
+ listStyleType: 'none',
88
+ cursor: 'pointer',
89
+ '&:hover': {
90
+ '& ._typography': {
91
+ color: '$colors$secondary',
92
+ },
93
+ },
94
+ '&:focus': {
95
+ outline: 'none',
96
+ '& ._typography': {
97
+ color: '$colors$secondary',
98
+ },
99
+ },
100
+ });
@@ -91,6 +91,7 @@ export const Input = styled('input', {
91
91
  border: 'none',
92
92
  outline: 'none',
93
93
  fontFamily: 'inherit',
94
+ maxWidth: '100%',
94
95
  variants: {
95
96
  suffix: {
96
97
  true: { marginRight: '$10' },
@@ -5,3 +5,8 @@ export function idGenerator() {
5
5
  return id;
6
6
  };
7
7
  }
8
+
9
+ export const TOAST_UNMOUNT_DELAY = 500; // the delay before the toast is unmounted
10
+ export const TOAST_TRANSITION_DURATION = 300; // the duration of the toast transition
11
+ export const HOVER_TRANSITION_DURATION = 200; // the duration of the toast transition hover
12
+ export const TOAST_HIDE_DELAY = 200; // the delay before the toast is invisible to shift remained toast smoothly
@@ -1,16 +1,217 @@
1
- import { darkTheme, keyframes, lightTheme, styled } from '../../theme';
1
+ import { css, darkTheme, lightTheme, styled } from '../../theme';
2
2
  import { Typography } from '../Typography';
3
3
 
4
- const toastOpacity = keyframes({
5
- from: { opacity: 0 },
6
- to: { opacity: 1 },
4
+ import {
5
+ HOVER_TRANSITION_DURATION,
6
+ TOAST_TRANSITION_DURATION,
7
+ } from './Toast.helpers';
8
+
9
+ export const toastContentStyles = css({
10
+ transition: `transform ${HOVER_TRANSITION_DURATION}ms ease-in-out`,
11
+ '&:hover': {
12
+ transform: 'scale(0.99)',
13
+ },
7
14
  });
8
15
 
9
16
  export const ToastContentContainer = styled('div', {
10
- animation: `${toastOpacity} .7s`,
17
+ transition: `transform ${TOAST_TRANSITION_DURATION}ms cubic-bezier(0, 0, 0.75, 1.25)`,
18
+ cursor: 'pointer',
19
+ variants: {
20
+ isActive: {
21
+ true: {},
22
+ },
23
+ isVisible: {
24
+ true: {},
25
+ },
26
+ position: {
27
+ 'right-top': {},
28
+ 'right-bottom': {},
29
+ 'left-top': {},
30
+ 'left-bottom': {},
31
+ 'center-top': {},
32
+ 'center-bottom': {},
33
+ },
34
+ },
35
+ compoundVariants: [
36
+ {
37
+ position: 'right-top',
38
+ isActive: true,
39
+ isVisible: true,
40
+ css: {
41
+ transform: 'translateX(0)',
42
+ maxHeight: '200px',
43
+ },
44
+ },
45
+ {
46
+ position: 'right-top',
47
+ isActive: false,
48
+ isVisible: true,
49
+ css: {
50
+ maxHeight: '200px',
51
+ transform: 'translateX(100%)',
52
+ },
53
+ },
54
+ {
55
+ position: 'right-top',
56
+ isActive: false,
57
+ isVisible: false,
58
+ css: {
59
+ maxHeight: '0px',
60
+ transform: 'translateX(100%)',
61
+ transition: `max-height ${TOAST_TRANSITION_DURATION}ms ease-in-out`,
62
+ },
63
+ },
64
+ {
65
+ position: 'right-bottom',
66
+ isActive: true,
67
+ isVisible: true,
68
+ css: {
69
+ transform: 'translateX(0)',
70
+ maxHeight: '200px',
71
+ },
72
+ },
73
+ {
74
+ position: 'right-bottom',
75
+ isActive: false,
76
+ isVisible: true,
77
+ css: {
78
+ transform: 'translateX(100%)',
79
+ maxHeight: '200px',
80
+ },
81
+ },
82
+ {
83
+ position: 'right-bottom',
84
+ isActive: false,
85
+ isVisible: false,
86
+ css: {
87
+ transform: 'translateX(100%)',
88
+ maxHeight: '0px',
89
+ transition: `max-height ${TOAST_TRANSITION_DURATION}ms ease-in-out`,
90
+ },
91
+ },
92
+ {
93
+ position: 'left-top',
94
+ isActive: true,
95
+ isVisible: true,
96
+ css: {
97
+ transform: 'translateX(0)',
98
+ maxHeight: '200px',
99
+ },
100
+ },
101
+ {
102
+ position: 'left-top',
103
+ isActive: false,
104
+ isVisible: true,
105
+ css: {
106
+ transform: 'translateX(-100%)',
107
+ maxHeight: '200px',
108
+ },
109
+ },
110
+ {
111
+ position: 'left-top',
112
+ isActive: false,
113
+ isVisible: false,
114
+ css: {
115
+ transform: 'translateX(-100%)',
116
+ maxHeight: '0px',
117
+ transition: `max-height ${TOAST_TRANSITION_DURATION}ms ease-in-out`,
118
+ },
119
+ },
120
+ {
121
+ position: 'left-bottom',
122
+ isActive: true,
123
+ isVisible: true,
124
+ css: {
125
+ transform: 'translateX(0)',
126
+ maxHeight: '200px',
127
+ },
128
+ },
129
+ {
130
+ position: 'left-bottom',
131
+ isActive: false,
132
+ isVisible: true,
133
+ css: {
134
+ transform: 'translateX(-100%)',
135
+ maxHeight: '200px',
136
+ },
137
+ },
138
+ {
139
+ position: 'left-bottom',
140
+ isActive: false,
141
+ isVisible: false,
142
+ css: {
143
+ transform: 'translateX(-100%)',
144
+ maxHeight: '0px',
145
+ transition: `max-height ${TOAST_TRANSITION_DURATION}ms ease-in-out`,
146
+ },
147
+ },
148
+ {
149
+ position: 'center-top',
150
+ isActive: true,
151
+ isVisible: true,
152
+ css: {
153
+ maxHeight: '200px',
154
+ transform: 'translateY(0)',
155
+ opacity: 1,
156
+ },
157
+ },
158
+ {
159
+ position: 'center-top',
160
+ isActive: false,
161
+ isVisible: true,
162
+ css: {
163
+ maxHeight: '200px',
164
+ transform: 'translateY(-1000%)',
165
+ opacity: 0,
166
+ },
167
+ },
168
+ {
169
+ position: 'center-top',
170
+ isActive: false,
171
+ isVisible: false,
172
+ css: {
173
+ maxHeight: '0px',
174
+ opacity: 0,
175
+ transform: 'translateY(-1000%)',
176
+ transition: `max-height ${TOAST_TRANSITION_DURATION}ms ease-in-out`,
177
+ },
178
+ },
179
+ {
180
+ position: 'center-bottom',
181
+ isActive: true,
182
+ isVisible: true,
183
+ css: {
184
+ transform: 'translateY(0)',
185
+ maxHeight: '200px',
186
+ opacity: 1,
187
+ },
188
+ },
189
+ {
190
+ position: 'center-bottom',
191
+ isActive: false,
192
+ isVisible: true,
193
+ css: {
194
+ transform: 'translateY(1000%)',
195
+ maxHeight: '200px',
196
+ opacity: 0,
197
+ },
198
+ },
199
+ {
200
+ position: 'center-bottom',
201
+ isActive: false,
202
+ isVisible: false,
203
+ css: {
204
+ transform: 'translateY(1000%)',
205
+ maxHeight: '0px',
206
+ opacity: 0,
207
+ transition: `max-height ${TOAST_TRANSITION_DURATION}ms ease-in-out`,
208
+ },
209
+ },
210
+ ],
11
211
  });
12
212
 
13
213
  export const ToastContainer = styled('div', {
214
+ overflow: 'hidden',
14
215
  position: 'absolute',
15
216
  zIndex: 9999,
16
217
  display: 'flex',
@@ -25,6 +226,7 @@ export const ToastContainer = styled('div', {
25
226
  'right-bottom': {
26
227
  right: 12,
27
228
  bottom: 2,
229
+ flexDirection: 'column-reverse',
28
230
  },
29
231
  'left-top': {
30
232
  left: 12,
@@ -33,6 +235,7 @@ export const ToastContainer = styled('div', {
33
235
  'left-bottom': {
34
236
  left: 12,
35
237
  bottom: 2,
238
+ flexDirection: 'column-reverse',
36
239
  },
37
240
  'center-top': {
38
241
  left: '50%',
@@ -43,6 +246,7 @@ export const ToastContainer = styled('div', {
43
246
  left: '50%',
44
247
  transform: 'translateX(-50%)',
45
248
  bottom: 2,
249
+ flexDirection: 'column-reverse',
46
250
  },
47
251
  },
48
252
  },