@rango-dev/ui 0.28.2-next.0 → 0.28.2-next.2
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/Alert/Alert.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts +4 -4
- package/dist/widget/ui/src/components/Alert/Alert.types.d.ts +2 -0
- package/dist/widget/ui/src/components/Alert/Alert.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Button/Button.d.ts +6 -6
- package/dist/widget/ui/src/components/Button/Button.styles.d.ts +1 -1
- package/dist/widget/ui/src/components/Divider/Divider.d.ts +1 -1
- package/dist/widget/ui/src/components/Divider/Divider.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Divider/Divider.styles.d.ts +2 -2
- package/dist/widget/ui/src/components/Icon/common.d.ts +2 -2
- package/dist/widget/ui/src/components/MessageBox/MessageBox.styles.d.ts +1 -1
- package/dist/widget/ui/src/components/Modal/Modal.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Modal/Modal.types.d.ts +6 -1
- package/dist/widget/ui/src/components/Modal/Modal.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/RadioGroup/RadioGroup.styles.d.ts +1 -1
- package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts +4 -4
- package/dist/widget/ui/src/components/SvgIcon/SvgIcon.style.d.ts +1 -1
- package/dist/widget/ui/src/components/Toast/Toast.Provider.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Toast/Toast.stories.d.ts +4 -3
- package/dist/widget/ui/src/components/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Toast/Toast.styles.d.ts +4 -6
- package/dist/widget/ui/src/components/Toast/Toast.styles.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Toast/Toast.types.d.ts +14 -14
- package/dist/widget/ui/src/components/Toast/Toast.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts +1 -1
- package/dist/widget/ui/src/components/Typography/NotSelectableTypography.d.ts +163 -0
- package/dist/widget/ui/src/components/Typography/NotSelectableTypography.d.ts.map +1 -0
- package/dist/widget/ui/src/components/Typography/Typography.types.d.ts +1 -1
- package/dist/widget/ui/src/components/Typography/Typography.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/Typography/index.d.ts +1 -0
- package/dist/widget/ui/src/components/Typography/index.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/ConnectWalletsModal/ConnectWalletsModal.d.ts.map +1 -1
- package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts +6 -6
- package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts +6 -6
- package/dist/widget/ui/src/icons/Autorenew.d.ts +5 -0
- package/dist/widget/ui/src/icons/Autorenew.d.ts.map +1 -0
- package/dist/widget/ui/src/icons/Exit.d.ts +5 -0
- package/dist/widget/ui/src/icons/Exit.d.ts.map +1 -0
- package/dist/widget/ui/src/icons/Swap.d.ts +5 -0
- package/dist/widget/ui/src/icons/Swap.d.ts.map +1 -0
- package/dist/widget/ui/src/icons/index.d.ts +3 -0
- package/dist/widget/ui/src/icons/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Alert/Alert.tsx +2 -0
- package/src/components/Alert/Alert.types.ts +2 -0
- package/src/components/Divider/Divider.tsx +2 -1
- package/src/components/Modal/Modal.tsx +6 -5
- package/src/components/Modal/Modal.types.ts +6 -1
- package/src/components/Toast/Toast.Provider.tsx +82 -44
- package/src/components/Toast/Toast.stories.tsx +18 -21
- package/src/components/Toast/Toast.styles.ts +74 -38
- package/src/components/Toast/Toast.tsx +54 -27
- package/src/components/Toast/Toast.types.ts +19 -17
- package/src/components/Typography/NotSelectableTypography.ts +7 -0
- package/src/components/Typography/Typography.types.tsx +1 -1
- package/src/components/Typography/index.ts +1 -0
- package/src/containers/ConnectWalletsModal/ConnectWalletsModal.tsx +3 -1
- package/src/icons/Autorenew.tsx +20 -0
- package/src/icons/Exit.tsx +20 -0
- package/src/icons/Swap.tsx +20 -0
- package/src/icons/index.ts +3 -0
|
@@ -2,9 +2,12 @@ import type { ToastProps } from './Toast.types';
|
|
|
2
2
|
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
4
|
|
|
5
|
+
import { CloseIcon } from '../../icons';
|
|
6
|
+
import { Alert } from '../Alert';
|
|
5
7
|
import { IconHighlight } from '../Alert/Alert.styles';
|
|
6
8
|
import AlertIcon from '../Alert/AlertIcon';
|
|
7
9
|
import { Divider } from '../Divider';
|
|
10
|
+
import { IconButton } from '../IconButton';
|
|
8
11
|
|
|
9
12
|
import { useToast } from './Toast.Provider';
|
|
10
13
|
import {
|
|
@@ -14,46 +17,70 @@ import {
|
|
|
14
17
|
ToastContentContainer,
|
|
15
18
|
} from './Toast.styles';
|
|
16
19
|
|
|
17
|
-
const DEFAULT_HIDE_DURATION = 3_000;
|
|
18
|
-
|
|
19
20
|
export const Toast = (props: ToastProps) => {
|
|
20
|
-
const {
|
|
21
|
+
const {
|
|
22
|
+
id,
|
|
23
|
+
autoHideDuration,
|
|
24
|
+
onClose,
|
|
25
|
+
type,
|
|
26
|
+
title,
|
|
27
|
+
position,
|
|
28
|
+
hasCloseIcon = true,
|
|
29
|
+
hideOnTap = true,
|
|
30
|
+
variant = 'standard',
|
|
31
|
+
} = props;
|
|
21
32
|
const { removeToast } = useToast();
|
|
22
33
|
useEffect(() => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
let cleanup;
|
|
35
|
+
|
|
36
|
+
if (autoHideDuration) {
|
|
37
|
+
const timer = setTimeout(() => {
|
|
38
|
+
handleClose();
|
|
39
|
+
}, autoHideDuration);
|
|
26
40
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
41
|
+
cleanup = () => clearTimeout(timer);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return cleanup;
|
|
30
45
|
}, [id]);
|
|
31
46
|
|
|
47
|
+
const handleClose = () => {
|
|
48
|
+
removeToast(id, position);
|
|
49
|
+
onClose?.();
|
|
50
|
+
};
|
|
51
|
+
|
|
32
52
|
return (
|
|
33
|
-
<ToastContentContainer
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
type={props.type}
|
|
40
|
-
style={props.style}>
|
|
53
|
+
<ToastContentContainer>
|
|
54
|
+
<AlertBox
|
|
55
|
+
onClick={hideOnTap ? handleClose : undefined}
|
|
56
|
+
variant={variant}
|
|
57
|
+
type={type}>
|
|
58
|
+
{variant === 'custom' ? (
|
|
41
59
|
<AlertFlexContainer>
|
|
42
|
-
<IconHighlight type={
|
|
43
|
-
<AlertIcon type={
|
|
60
|
+
<IconHighlight type={type} align="center">
|
|
61
|
+
<AlertIcon type={type} />
|
|
44
62
|
</IconHighlight>
|
|
45
63
|
<Divider direction="horizontal" size={10} />
|
|
46
|
-
<StyledTypography
|
|
47
|
-
variant="body"
|
|
48
|
-
size="small"
|
|
49
|
-
color={props.titleColor}
|
|
50
|
-
hasColor={!!props.titleColor}
|
|
51
|
-
align="left">
|
|
64
|
+
<StyledTypography variant="body" size="small" align="left">
|
|
52
65
|
{props.title}
|
|
53
66
|
</StyledTypography>
|
|
54
67
|
</AlertFlexContainer>
|
|
55
|
-
|
|
56
|
-
|
|
68
|
+
) : (
|
|
69
|
+
<Alert
|
|
70
|
+
title={title}
|
|
71
|
+
type={type}
|
|
72
|
+
variant="alarm"
|
|
73
|
+
titleAlign="left"
|
|
74
|
+
action={
|
|
75
|
+
hasCloseIcon ? (
|
|
76
|
+
<IconButton variant="ghost" size="xsmall" onClick={handleClose}>
|
|
77
|
+
<CloseIcon size={12} />
|
|
78
|
+
</IconButton>
|
|
79
|
+
) : undefined
|
|
80
|
+
}
|
|
81
|
+
/>
|
|
82
|
+
)}
|
|
83
|
+
</AlertBox>
|
|
57
84
|
</ToastContentContainer>
|
|
58
85
|
);
|
|
59
86
|
};
|
|
@@ -1,31 +1,33 @@
|
|
|
1
|
+
import type { ToastContainer } from './Toast.styles';
|
|
1
2
|
import type { Type } from '../Alert/Alert.types';
|
|
2
|
-
import type
|
|
3
|
+
import type * as Stitches from '@stitches/react';
|
|
4
|
+
import type { CSSProperties } from 'react';
|
|
3
5
|
|
|
6
|
+
type BaseProps = Stitches.VariantProps<typeof ToastContainer>;
|
|
7
|
+
export type ToastPosition = Exclude<BaseProps['position'], object>;
|
|
4
8
|
export interface ProviderPropTypes {
|
|
5
9
|
container: HTMLElement;
|
|
6
|
-
anchorOrigin?: {
|
|
7
|
-
horizontal: 'left' | 'right';
|
|
8
|
-
vertical: 'bottom' | 'top';
|
|
9
|
-
};
|
|
10
|
-
containerStyle?: CSSProperties;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
export type ToastType = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
export type ToastType = {
|
|
13
|
+
autoHideDuration?: number;
|
|
14
|
+
id?: number | string;
|
|
15
|
+
containerStyle?: CSSProperties;
|
|
16
|
+
onClose?: () => void;
|
|
17
|
+
position: ToastPosition;
|
|
18
|
+
title: string;
|
|
19
|
+
type: Type;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
hasCloseIcon?: boolean;
|
|
22
|
+
hideOnTap?: boolean;
|
|
23
|
+
variant?: 'custom' | 'standard';
|
|
24
|
+
};
|
|
22
25
|
|
|
23
26
|
export type ToastProps = ToastType & {
|
|
24
27
|
id: number | string;
|
|
25
|
-
horizontal: 'left' | 'right';
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
export type ProviderContext = {
|
|
29
31
|
addToast: (content: ToastType) => void;
|
|
30
|
-
removeToast: (id: number | string) => void;
|
|
32
|
+
removeToast: (id: number | string, position: ToastPosition) => void;
|
|
31
33
|
};
|
|
@@ -4,7 +4,7 @@ import type * as Stitches from '@stitches/react';
|
|
|
4
4
|
type BaseProps = Stitches.VariantProps<typeof TypographyContainer>;
|
|
5
5
|
type BaseSizes = Exclude<BaseProps['size'], object>;
|
|
6
6
|
type BaseVariants = Exclude<BaseProps['variant'], object>;
|
|
7
|
-
type BaseAlign = Exclude<BaseProps['align'], object>;
|
|
7
|
+
export type BaseAlign = Exclude<BaseProps['align'], object>;
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
10
10
|
type margin = 2 | 4 | 8 | 12;
|
|
@@ -30,7 +30,9 @@ export function ConnectWalletsModal(props: PropTypes) {
|
|
|
30
30
|
title={i18n.t('Connect Wallets')}
|
|
31
31
|
open={open}
|
|
32
32
|
onClose={onClose}
|
|
33
|
-
|
|
33
|
+
styles={{
|
|
34
|
+
container: { width: '75%', maxWidth: '30rem', height: '60%' },
|
|
35
|
+
}}>
|
|
34
36
|
<ModalContent>
|
|
35
37
|
{list.map((info) => (
|
|
36
38
|
<Wallet {...info} key={info.title} onClick={onSelect} />
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SvgIconPropsWithChildren } from '../components/SvgIcon';
|
|
2
|
+
|
|
3
|
+
import React, { createElement } from 'react';
|
|
4
|
+
|
|
5
|
+
import { SvgIcon } from '../components/SvgIcon';
|
|
6
|
+
|
|
7
|
+
function SvgAutorenew(props: SvgIconPropsWithChildren) {
|
|
8
|
+
return createElement(
|
|
9
|
+
SvgIcon,
|
|
10
|
+
props,
|
|
11
|
+
<svg viewBox="0 0 24 24">
|
|
12
|
+
<path
|
|
13
|
+
fillRule="evenodd"
|
|
14
|
+
d="M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6zm6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26z"
|
|
15
|
+
fill="currentColor"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export default SvgAutorenew;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SvgIconPropsWithChildren } from '../components/SvgIcon';
|
|
2
|
+
|
|
3
|
+
import React, { createElement } from 'react';
|
|
4
|
+
|
|
5
|
+
import { SvgIcon } from '../components/SvgIcon';
|
|
6
|
+
|
|
7
|
+
function SvgExit(props: SvgIconPropsWithChildren) {
|
|
8
|
+
return createElement(
|
|
9
|
+
SvgIcon,
|
|
10
|
+
props,
|
|
11
|
+
<svg viewBox="0 0 24 24">
|
|
12
|
+
<path
|
|
13
|
+
fillRule="evenodd"
|
|
14
|
+
d="M10.09 15.59 11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
|
|
15
|
+
fill="currentColor"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export default SvgExit;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SvgIconPropsWithChildren } from '../components/SvgIcon';
|
|
2
|
+
|
|
3
|
+
import React, { createElement } from 'react';
|
|
4
|
+
|
|
5
|
+
import { SvgIcon } from '../components/SvgIcon';
|
|
6
|
+
|
|
7
|
+
function SvgSwap(props: SvgIconPropsWithChildren) {
|
|
8
|
+
return createElement(
|
|
9
|
+
SvgIcon,
|
|
10
|
+
props,
|
|
11
|
+
<svg viewBox="0 0 24 24">
|
|
12
|
+
<path
|
|
13
|
+
fillRule="evenodd"
|
|
14
|
+
d="M6.99 11 3 15l3.99 4v-3H14v-2H6.99v-3zM21 9l-3.99-4v3H10v2h7.01v3L21 9z"
|
|
15
|
+
fill="currentColor"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export default SvgSwap;
|
package/src/icons/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as AddIcon } from './Add';
|
|
2
2
|
export { default as AutoThemeIcon } from './AutoTheme';
|
|
3
|
+
export { default as AutorenewIcon } from './Autorenew';
|
|
3
4
|
export { default as BorderRadiusIcon } from './BorderRadius';
|
|
4
5
|
export { default as ChevronDownIcon } from './ChevronDown';
|
|
5
6
|
export { default as ChevronLeftIcon } from './ChevronLeft';
|
|
@@ -16,6 +17,7 @@ export { default as DesktopIcon } from './Desktop';
|
|
|
16
17
|
export { default as DoneIcon } from './Done';
|
|
17
18
|
export { default as EvmCategoryIcon } from './EvmCategory';
|
|
18
19
|
export { default as ErrorIcon } from './Error';
|
|
20
|
+
export { default as ExitIcon } from './Exit';
|
|
19
21
|
export { default as ExternalLinkIcon } from './ExternalLink';
|
|
20
22
|
export { default as FontIcon } from './Font';
|
|
21
23
|
export { default as GasIcon } from './Gas';
|
|
@@ -41,6 +43,7 @@ export { default as RefreshIcon } from './Refresh';
|
|
|
41
43
|
export { default as ReverseIcon } from './Reverse';
|
|
42
44
|
export { default as RouteIcon } from './Route';
|
|
43
45
|
export { default as SearchIcon } from './Search';
|
|
46
|
+
export { default as SwapIcon } from './Swap';
|
|
44
47
|
export { default as TimeIcon } from './Time';
|
|
45
48
|
export { default as TransactionIcon } from './Transaction';
|
|
46
49
|
export { default as UtxoCategoryIcon } from './UtxoCategory';
|