@rango-dev/ui 0.35.1-next.5 → 0.35.1-next.6

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Notifications.styles.d.ts","sourceRoot":"","sources":["../../../../../../src/containers/Notifications/Notifications.styles.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAU,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAG1D,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAgBpB,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DASjB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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+1,23 @@
1
+ import type { CSS } from '../../theme';
2
+ import type { Asset } from 'rango-sdk';
3
+ type Notification = {
4
+ route: {
5
+ from: Asset;
6
+ to: Asset;
7
+ };
8
+ event: {
9
+ messageSeverity: string;
10
+ message: string;
11
+ };
12
+ requestId: string;
13
+ };
14
+ export type PropTypes = {
15
+ list: Notification[];
16
+ getBlockchainImage: (blockchain: string) => string;
17
+ getTokenImage: (token: Asset) => string;
18
+ onClickItem: (requestId: string) => void;
19
+ onClearAll: () => void;
20
+ containerStyles?: CSS;
21
+ };
22
+ export {};
23
+ //# sourceMappingURL=Notifications.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Notifications.types.d.ts","sourceRoot":"","sources":["../../../../../../src/containers/Notifications/Notifications.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE;QAAE,IAAI,EAAE,KAAK,CAAC;QAAC,EAAE,EAAE,KAAK,CAAA;KAAE,CAAC;IAClC,KAAK,EAAE;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,kBAAkB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IACnD,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC;IACxC,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,eAAe,CAAC,EAAE,GAAG,CAAC;CACvB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './Notifications';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/containers/Notifications/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './ConnectWalletsModal';
2
2
  export * from './Warnings';
3
3
  export * from './SwapInput';
4
+ export * from './Notifications';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/containers/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/containers/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/ui",
3
- "version": "0.35.1-next.5",
3
+ "version": "0.35.1-next.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -60,4 +60,4 @@
60
60
  "publishConfig": {
61
61
  "access": "public"
62
62
  }
63
- }
63
+ }
@@ -0,0 +1,19 @@
1
+ import { i18n } from '@lingui/core';
2
+ import React from 'react';
3
+
4
+ import { Divider, Typography } from '../../components';
5
+ import { NoNotificationIcon } from '../../icons';
6
+
7
+ import { NotFoundContainer } from './Notifications.styles';
8
+
9
+ export function NotificationNotFound() {
10
+ return (
11
+ <NotFoundContainer>
12
+ <NoNotificationIcon color="secondary" size={26} />
13
+ <Divider size={12} />
14
+ <Typography variant="body" size="medium" color="neutral700">
15
+ {i18n.t('There are no notifications.')}
16
+ </Typography>
17
+ </NotFoundContainer>
18
+ );
19
+ }
@@ -0,0 +1,82 @@
1
+ import { Button, ListItemButton } from '../../components';
2
+ import { darkTheme, styled } from '../../theme';
3
+
4
+ export const Container = styled('div', {
5
+ borderRadius: '$sm',
6
+ padding: '0 $10 $10 $10',
7
+ width: '350px',
8
+ maxWidth: '90vw',
9
+ minHeight: '150px',
10
+ maxHeight: '207px',
11
+ overflowY: 'auto',
12
+ background: 'inherit',
13
+ variants: {
14
+ equalPadding: {
15
+ true: {
16
+ padding: '$10',
17
+ },
18
+ },
19
+ },
20
+ });
21
+
22
+ export const Header = styled('div', {
23
+ padding: '$10 $10 0 $10',
24
+ display: 'flex',
25
+ justifyContent: 'space-between',
26
+ alignItems: 'center',
27
+ background: 'inherit',
28
+ position: 'sticky',
29
+ top: '0',
30
+ zIndex: 999,
31
+ });
32
+
33
+ export const ClearAllButton = styled(Button, {
34
+ padding: '$5 !important',
35
+ });
36
+
37
+ export const List = styled('ul', {
38
+ padding: 0,
39
+ margin: 0,
40
+ listStyle: 'none',
41
+
42
+ '.to-chain-token': {
43
+ transform: 'translateX(-3px)',
44
+ },
45
+ });
46
+
47
+ export const ListItem = styled(ListItemButton, {
48
+ variants: {
49
+ actionRequired: {
50
+ true: {
51
+ backgroundColor: '$error300',
52
+ [`.${darkTheme} &`]: {
53
+ backgroundColor: '$error600',
54
+ },
55
+ },
56
+ },
57
+ },
58
+ });
59
+
60
+ export const Images = styled('div', {
61
+ display: 'flex',
62
+ padding: '0 0 0 $5',
63
+ alignItems: 'center',
64
+ alignSelf: 'stretch',
65
+ });
66
+
67
+ export const NotFoundContainer = styled('div', {
68
+ display: 'flex',
69
+ justifyContent: 'center',
70
+ alignItems: 'center',
71
+ flexDirection: 'column',
72
+ padding: '$10',
73
+ width: '100%',
74
+ height: '150px',
75
+ });
76
+
77
+ export const IconContainer = styled('span', {
78
+ display: 'flex',
79
+ justifyContent: 'center',
80
+ alignItems: 'center',
81
+ paddingRight: '$8',
82
+ });
@@ -0,0 +1,108 @@
1
+ import type { PropTypes } from './Notifications.types';
2
+
3
+ import { i18n } from '@lingui/core';
4
+ import React from 'react';
5
+
6
+ import { ChainToken, Divider, Typography } from '../../components';
7
+ import { ChevronRightIcon } from '../../icons';
8
+
9
+ import { NotificationNotFound } from './NotificationNotFound';
10
+ import {
11
+ ClearAllButton,
12
+ Container,
13
+ Header,
14
+ IconContainer,
15
+ Images,
16
+ List,
17
+ ListItem,
18
+ } from './Notifications.styles';
19
+
20
+ export function Notifications(props: PropTypes) {
21
+ const {
22
+ list,
23
+ getBlockchainImage,
24
+ getTokenImage,
25
+ onClickItem,
26
+ onClearAll,
27
+ containerStyles,
28
+ } = props;
29
+ return (
30
+ <Container equalPadding={list.length === 0} css={containerStyles}>
31
+ {list.length > 0 && (
32
+ <>
33
+ <Header>
34
+ <Typography variant="label" size="medium">
35
+ {i18n.t('Notifications')}
36
+ </Typography>
37
+ <ClearAllButton variant="ghost" size="xsmall" onClick={onClearAll}>
38
+ <Typography variant="body" size="xsmall" color="neutral700">
39
+ {i18n.t('Clear all')}
40
+ </Typography>
41
+ </ClearAllButton>
42
+ </Header>
43
+ <Divider direction="vertical" size={4} />
44
+ </>
45
+ )}
46
+ {list.length ? (
47
+ <List>
48
+ {list.map((notificationItem, index) => {
49
+ const { route, requestId, event } = notificationItem;
50
+ const fromTokenImage = getTokenImage(route.from);
51
+
52
+ const fromBlockchainImage = getBlockchainImage(
53
+ route.from.blockchain
54
+ );
55
+
56
+ const toTokenImage = getTokenImage(route.to);
57
+
58
+ const toBlockchainImage = getBlockchainImage(route.to.blockchain);
59
+
60
+ return (
61
+ <React.Fragment key={requestId}>
62
+ {index > 0 && <Divider size={4} />}
63
+ <ListItem
64
+ onClick={() => onClickItem(requestId)}
65
+ actionRequired={event.messageSeverity === 'warning'}
66
+ title={
67
+ <Typography
68
+ variant="body"
69
+ size="small"
70
+ color={
71
+ event.messageSeverity === 'warning'
72
+ ? '$foreground'
73
+ : '$neutral700'
74
+ }>
75
+ {i18n.t(event.message)}
76
+ </Typography>
77
+ }
78
+ id={requestId}
79
+ start={
80
+ <Images>
81
+ <ChainToken
82
+ tokenImage={fromTokenImage}
83
+ chainImage={fromBlockchainImage}
84
+ size="small"
85
+ />
86
+ <ChainToken
87
+ tokenImage={toTokenImage}
88
+ chainImage={toBlockchainImage}
89
+ size="small"
90
+ />
91
+ </Images>
92
+ }
93
+ end={
94
+ <IconContainer>
95
+ <ChevronRightIcon size={12} color="gray" />
96
+ </IconContainer>
97
+ }
98
+ />
99
+ </React.Fragment>
100
+ );
101
+ })}
102
+ </List>
103
+ ) : (
104
+ <NotificationNotFound />
105
+ )}
106
+ </Container>
107
+ );
108
+ }
@@ -0,0 +1,17 @@
1
+ import type { CSS } from '../../theme';
2
+ import type { Asset } from 'rango-sdk';
3
+
4
+ type Notification = {
5
+ route: { from: Asset; to: Asset };
6
+ event: { messageSeverity: string; message: string };
7
+ requestId: string;
8
+ };
9
+
10
+ export type PropTypes = {
11
+ list: Notification[];
12
+ getBlockchainImage: (blockchain: string) => string;
13
+ getTokenImage: (token: Asset) => string;
14
+ onClickItem: (requestId: string) => void;
15
+ onClearAll: () => void;
16
+ containerStyles?: CSS;
17
+ };
@@ -0,0 +1 @@
1
+ export * from './Notifications';
@@ -1,3 +1,4 @@
1
1
  export * from './ConnectWalletsModal';
2
2
  export * from './Warnings';
3
3
  export * from './SwapInput';
4
+ export * from './Notifications';