@rango-dev/widget-embedded 0.1.11-next.11 → 0.1.11-next.14

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 (40) hide show
  1. package/dist/components/ConfirmSwapErrors.d.ts +1 -1
  2. package/dist/components/ConfirmSwapErrors.d.ts.map +1 -1
  3. package/dist/components/ConfirmSwapWarnings.d.ts +1 -2
  4. package/dist/components/ConfirmSwapWarnings.d.ts.map +1 -1
  5. package/dist/components/warnings/BalanceErrors.d.ts +7 -0
  6. package/dist/components/warnings/BalanceErrors.d.ts.map +1 -0
  7. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  8. package/dist/pages/Home.d.ts.map +1 -1
  9. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  10. package/dist/store/bestRoute.d.ts.map +1 -1
  11. package/dist/types/routing.d.ts +8 -8
  12. package/dist/types/routing.d.ts.map +1 -1
  13. package/dist/utils/numbers.d.ts +1 -0
  14. package/dist/utils/numbers.d.ts.map +1 -1
  15. package/dist/utils/routing.d.ts +4 -4
  16. package/dist/utils/routing.d.ts.map +1 -1
  17. package/dist/utils/time.d.ts.map +1 -1
  18. package/dist/widget-embedded.cjs.development.js +283 -261
  19. package/dist/widget-embedded.cjs.development.js.map +1 -1
  20. package/dist/widget-embedded.cjs.production.min.js +283 -261
  21. package/dist/widget-embedded.cjs.production.min.js.map +1 -1
  22. package/dist/widget-embedded.esm.js +283 -261
  23. package/dist/widget-embedded.esm.js.map +1 -1
  24. package/package.json +2 -2
  25. package/src/components/ConfirmSwapErrors.tsx +8 -16
  26. package/src/components/ConfirmSwapWarnings.tsx +5 -15
  27. package/src/components/warnings/BalanceErrors.tsx +45 -0
  28. package/src/hooks/useConfirmSwap.ts +2 -2
  29. package/src/pages/ConfirmSwapPage.tsx +3 -1
  30. package/src/pages/Home.tsx +6 -8
  31. package/src/pages/SwapDetailsPage.tsx +7 -13
  32. package/src/pages/WalletsPage.tsx +1 -1
  33. package/src/store/bestRoute.ts +5 -3
  34. package/src/types/routing.ts +4 -4
  35. package/src/utils/numbers.ts +4 -0
  36. package/src/utils/routing.ts +31 -11
  37. package/src/utils/time.ts +2 -8
  38. package/dist/components/warnings/BalanceWarnings.d.ts +0 -7
  39. package/dist/components/warnings/BalanceWarnings.d.ts.map +0 -1
  40. package/src/components/warnings/BalanceWarnings.tsx +0 -40
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.1.11-next.11",
3
+ "version": "0.1.11-next.14",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "browserslist": "> 0.5%, last 2 versions, not dead",
12
12
  "scripts": {
13
13
  "watch-tsc": "tsc --watch --noEmit",
14
- "dev": "parcel public/index.html -p 3001 --cache-dir=.parcel-cache",
14
+ "dev": "parcel public/index.html -p 3001 --no-cache",
15
15
  "dev-tsc": "npm-run-all --parallel watch-tsc dev",
16
16
  "build:app": "parcel build --cache-dir=.parcel-cache",
17
17
  "build": "tsdx build --entry ./src/lib.tsx"
@@ -1,38 +1,30 @@
1
1
  import React from 'react';
2
- import { Typography } from '@rango-dev/ui';
3
2
  import { ConfirmSwapError, ConfirmSwapErrorTypes } from '../types';
4
3
  import { MinRequiredSlippage } from './warnings/MinRequiredSlippage';
4
+ import { BalanceErrors } from './warnings/BalanceErrors';
5
5
 
6
6
  export function ConfirmSwapErrors(errors: ConfirmSwapError[]) {
7
7
  return errors.flatMap((error) => {
8
8
  switch (error.type) {
9
9
  case ConfirmSwapErrorTypes.NO_ROUTE:
10
- return (
11
- <Typography variant="body2">
12
- No routes found. Please try again later.
13
- </Typography>
14
- );
10
+ return "No routes found. Please try again later."
15
11
  case ConfirmSwapErrorTypes.REQUEST_FAILED:
16
- return (
17
- <Typography variant="body2">{`Failed to confirm swap ${
12
+ return `Failed to confirm swap ${
18
13
  error.status ? `'status': ${error.status})` : ''
19
- }, please try again.`}</Typography>
20
- );
14
+ }, please try again.`
21
15
 
22
16
  case ConfirmSwapErrorTypes.ROUTE_UPDATED_WITH_HIGH_VALUE_LOSS:
23
- return (
24
- <Typography variant="body2">
25
- Route updated and price impact is too high, try again later!
26
- </Typography>
27
- );
17
+ return "Route updated and price impact is too high, try again later!"
28
18
  case ConfirmSwapErrorTypes.INSUFFICIENT_SLIPPAGE:
29
19
  return (
30
20
  <MinRequiredSlippage
31
21
  minRequiredSlippage={error.minRequiredSlippage}
32
22
  />
33
23
  );
24
+ case ConfirmSwapErrorTypes.INSUFFICIENT_BALANCE:
25
+ return <BalanceErrors messages={error.messages} />;
34
26
  default:
35
27
  return [];
36
28
  }
37
29
  });
38
- }
30
+ }
@@ -1,35 +1,25 @@
1
- import React from 'react';
2
- import { Typography } from '@rango-dev/ui';
3
1
  import { ConfirmSwapWarningTypes, ConfirmSwapWarnings } from '../types';
4
- import { BalanceWarnings } from './warnings/BalanceWarnings';
5
2
 
6
3
  export function ConfirmSwapWarnings(warnings: ConfirmSwapWarnings[]) {
7
4
  return warnings.flatMap((warning) => {
8
5
  switch (warning.type) {
9
6
  case ConfirmSwapWarningTypes.ROUTE_UPDATED:
10
- return <Typography variant="body2">Route has been updated.</Typography>;
7
+ return "Route has been updated.";
11
8
  case ConfirmSwapWarningTypes.ROUTE_AND_OUTPUT_AMOUNT_UPDATED:
12
9
  return (
13
- <Typography variant="body2">{`Output amount changed to ${warning.newOutputAmount}
14
- (${warning.percentageChange}% change).`}</Typography>
10
+ `Output amount changed to ${warning.newOutputAmount} (${warning.percentageChange}% change).`
15
11
  );
16
12
 
17
13
  case ConfirmSwapWarningTypes.ROUTE_SWAPPERS_UPDATED:
18
14
  return (
19
- <Typography variant="body2">
20
- Route swappers has been updated.
21
- </Typography>
15
+ "Route swappers has been updated."
22
16
  );
23
17
  case ConfirmSwapWarningTypes.ROUTE_COINS_UPDATED:
24
18
  return (
25
- <Typography variant="body2">
26
- Route internal coins has been updated.
27
- </Typography>
19
+ "Route internal coins has been updated."
28
20
  );
29
- case ConfirmSwapWarningTypes.INSUFFICIENT_BALANCE:
30
- return <BalanceWarnings messages={warning.messages} />;
31
21
  default:
32
22
  return [];
33
23
  }
34
24
  });
35
- }
25
+ }
@@ -0,0 +1,45 @@
1
+ import { Spacer, styled, Typography } from '@rango-dev/ui';
2
+ import React from 'react';
3
+
4
+ interface PropTypes {
5
+ messages: string[];
6
+ }
7
+
8
+ const List = styled('ul', {
9
+ variants: {
10
+ showListStyle: {
11
+ true: { paddingLeft: '$24' },
12
+ },
13
+ },
14
+ });
15
+
16
+ const ListItem = styled('li', {
17
+ variants: {
18
+ showListStyle: {
19
+ true: { listStyleType: 'disc', listStylePosition: 'outside' },
20
+ },
21
+ },
22
+ });
23
+
24
+ const Message = styled(Typography, {
25
+ display: 'block',
26
+ });
27
+
28
+ export function BalanceErrors({ messages }: PropTypes) {
29
+ const showListStyle = messages.length > 1;
30
+ return (
31
+ <>
32
+ <Typography className="title" variant="title" color={'error'}>
33
+ Insufficent Balance:
34
+ </Typography>
35
+ <Spacer size={8} direction="vertical" />
36
+ <List showListStyle={showListStyle}>
37
+ {messages.map((warning) => (
38
+ <ListItem showListStyle={showListStyle}>
39
+ <Message variant="body3">- {warning}</Message>
40
+ </ListItem>
41
+ ))}
42
+ </List>
43
+ </>
44
+ );
45
+ }
@@ -198,8 +198,8 @@ export function useConfirmSwap(): ConfirmSwap {
198
198
  const enoughBalance = balanceWarnings.length === 0;
199
199
 
200
200
  if (!enoughBalance)
201
- confirmSwapState.warnings.push({
202
- type: ConfirmSwapWarningTypes.INSUFFICIENT_BALANCE,
201
+ confirmSwapState.errors.push({
202
+ type: ConfirmSwapErrorTypes.INSUFFICIENT_BALANCE,
203
203
  messages: balanceWarnings,
204
204
  });
205
205
 
@@ -112,7 +112,9 @@ export function ConfirmSwapPage() {
112
112
  navigate(navigationRoutes.swaps + `/${swap.requestId}`, {
113
113
  replace: true,
114
114
  });
115
- setInputAmount('');
115
+ setTimeout(() => {
116
+ setInputAmount('');
117
+ }, 0);
116
118
  }
117
119
  });
118
120
  }}
@@ -36,6 +36,7 @@ import {
36
36
  import BigNumber from 'bignumber.js';
37
37
  import { HeaderButtons } from '../components/HeaderButtons';
38
38
  import { useUiStore } from '../store/ui';
39
+ import { getFormatedBestRoute } from '../utils/routing';
39
40
 
40
41
  const Container = styled('div', {
41
42
  display: 'flex',
@@ -177,7 +178,7 @@ export function Home() {
177
178
  <BestRoute
178
179
  error={bestRouteError}
179
180
  loading={fetchingBestRoute}
180
- data={bestRoute}
181
+ data={getFormatedBestRoute(bestRoute)}
181
182
  totalFee={numberToString(totalFeeInUsd, 0, 2)}
182
183
  feeWarning={highFee}
183
184
  totalTime={secondsToString(totalArrivalTime(bestRoute))}
@@ -190,14 +191,11 @@ export function Home() {
190
191
  {hasLimitError(bestRoute) && (
191
192
  <Alert type="error" title={`${swap?.swapperId} Limit`}>
192
193
  <>
193
- <Typography variant="body2">{fromAmountRangeError}</Typography>
194
- <br />
195
- <Typography variant="body2">
196
- Yours: {numberToString(swap?.fromAmount || null)}
197
- {swap?.from.symbol}
194
+ <Typography variant="body3">
195
+ {fromAmountRangeError}, Yours: {numberToString(swap?.fromAmount || null)}
196
+ &nbsp;{swap?.from.symbol}
198
197
  </Typography>
199
- <br />
200
- <Typography variant="body2">{recommendation}</Typography>
198
+ <Typography variant="body3">{recommendation}</Typography>
201
199
  </>
202
200
  </Alert>
203
201
  )}
@@ -4,7 +4,7 @@ import useCopyToClipboard from '../hooks/useCopyToClipboard';
4
4
  import { useManager } from '@rango-dev/queue-manager-react';
5
5
  import { useNavigateBack } from '../hooks/useNavigateBack';
6
6
  import { getPendingSwaps } from '../utils/queue';
7
- import { SwapHistory, Spacer } from '@rango-dev/ui';
7
+ import { SwapHistory } from '@rango-dev/ui';
8
8
  import { useUiStore } from '../store/ui';
9
9
  import {
10
10
  cancelSwap,
@@ -25,11 +25,10 @@ import {
25
25
  isNetworkStatusInWarningState,
26
26
  shouldRetrySwap,
27
27
  } from '../utils/swap';
28
- import { TokenPreview } from '../components/TokenPreview';
29
- import { numberToString } from '../utils/numbers';
30
28
  //@ts-ignore
31
29
  import { t } from 'i18next';
32
30
  import { SwapDetailsPlaceholder } from '../components/SwapDetailsPlaceholder';
31
+ import { getFormatedPendingSwap } from '../utils/routing';
33
32
 
34
33
  export function SwapDetailsPage() {
35
34
  const selectedSwapRequestId = useUiStore.use.selectedSwapRequestId();
@@ -45,7 +44,7 @@ export function SwapDetailsPage() {
45
44
  useEffect(() => {
46
45
  setTimeout(() => {
47
46
  setLoading(false);
48
- }, 5000);
47
+ }, 5_000);
49
48
  }, []);
50
49
 
51
50
  const pendingSwaps = getPendingSwaps(manager);
@@ -68,11 +67,6 @@ export function SwapDetailsPage() {
68
67
  />
69
68
  );
70
69
 
71
- const firstStep = swap.steps[0];
72
- const lastStep = swap.steps[swap.steps.length - 1];
73
- const fromAmount = numberToString(swap.inputAmount);
74
- const toAmount = numberToString(swap.simulationResult.outputAmount);
75
-
76
70
  const currentStep = getCurrentStep(swap);
77
71
 
78
72
  const currentStepBlockchain = currentStep
@@ -106,12 +100,13 @@ export function SwapDetailsPage() {
106
100
  return (
107
101
  <SwapHistory
108
102
  onBack={navigateBackFrom.bind(null, navigationRoutes.swapDetails)}
103
+ /* TODO: It was temporarily removed to find a better solution*/
104
+ /*
109
105
  previewInputs={
110
106
  <>
111
107
  <TokenPreview
112
108
  chain={{
113
109
  displayName: firstStep?.fromBlockchain || '',
114
- // @ts-ignore
115
110
  logo: firstStep?.fromBlockchainLogo || '',
116
111
  }}
117
112
  token={{
@@ -126,7 +121,6 @@ export function SwapDetailsPage() {
126
121
  <TokenPreview
127
122
  chain={{
128
123
  displayName: lastStep?.toBlockchain || '',
129
- //@ts-ignore
130
124
  logo: lastStep?.toBlockchainLogo || '',
131
125
  }}
132
126
  token={{
@@ -139,8 +133,8 @@ export function SwapDetailsPage() {
139
133
  />
140
134
  </>
141
135
  }
142
- //todo: move PendingSwap type to rango-types
143
- pendingSwap={swap}
136
+ */
137
+ pendingSwap={getFormatedPendingSwap(swap)}
144
138
  onCopy={handleCopy}
145
139
  isCopied={isCopied}
146
140
  onCancel={onCancel}
@@ -113,7 +113,7 @@ export function WalletsPage({ supportedWallets, multiWallets }: PropTypes) {
113
113
  <>
114
114
  {walletErrorMessage && (
115
115
  <AlertContainer>
116
- <Alert type="error">{walletErrorMessage}</Alert>
116
+ <Alert type="error" title={walletErrorMessage}/>
117
117
  </AlertContainer>
118
118
  )}
119
119
  {loadingMetaStatus === 'loading' && (
@@ -22,6 +22,8 @@ import { useWalletsStore } from './wallets';
22
22
  import { TokenWithBalance } from '../pages/SelectTokenPage';
23
23
  import { PendingSwap } from '@rango-dev/queue-manager-rango-preset/dist/shared';
24
24
  import { debounce } from '../utils/common';
25
+ import { isPositiveNumber } from '../utils/numbers';
26
+
25
27
  const getUsdValue = (token: Token | null, amount: string) =>
26
28
  new BigNumber(amount || ZERO).multipliedBy(token?.usdPrice || 0);
27
29
 
@@ -72,7 +74,7 @@ export const useBestRouteStore = createSelectors(
72
74
  set((state) => {
73
75
  let outputAmount: BigNumber | null = null;
74
76
  let outputUsdValue: BigNumber = ZERO;
75
- if (!state.inputAmount || state.inputAmount === '0') return {};
77
+ if (!isPositiveNumber(state.inputAmount)) return {};
76
78
  if (!!bestRoute) {
77
79
  outputAmount = !!bestRoute.result?.outputAmount
78
80
  ? new BigNumber(bestRoute.result?.outputAmount)
@@ -251,7 +253,7 @@ const bestRoute = (
251
253
  const { fromToken, toToken, inputAmount } = bestRouteStore.getState();
252
254
  const { slippage, customSlippage, disabledLiquiditySources, affiliateRef } =
253
255
  settingsStore.getState();
254
- if (!fromToken || !toToken || !inputAmount || inputAmount === '0') return;
256
+ if (!fromToken || !toToken || !isPositiveNumber(inputAmount)) return;
255
257
  abortController?.abort();
256
258
  abortController = new AbortController();
257
259
  const userSlippage = !!customSlippage ? customSlippage : slippage;
@@ -296,7 +298,7 @@ const bestRoute = (
296
298
  const bestRouteParamsListener = () => {
297
299
  const { fromToken, toToken, inputAmount, inputUsdValue } =
298
300
  useBestRouteStore.getState();
299
- if (!inputAmount || inputAmount === '0' || inputUsdValue.eq(0))
301
+ if (!isPositiveNumber(inputAmount) || inputUsdValue.eq(0))
300
302
  return bestRouteStore.setState({ loading: false });
301
303
 
302
304
  if (tokensAreEqual(fromToken, toToken))
@@ -33,6 +33,7 @@ export enum ConfirmSwapErrorTypes {
33
33
  ROUTE_UPDATED_WITH_HIGH_VALUE_LOSS,
34
34
  REQUEST_FAILED,
35
35
  INSUFFICIENT_SLIPPAGE,
36
+ INSUFFICIENT_BALANCE,
36
37
  }
37
38
 
38
39
  export type ConfirmSwapError =
@@ -44,11 +45,13 @@ export type ConfirmSwapError =
44
45
  type: ConfirmSwapErrorTypes.INSUFFICIENT_SLIPPAGE;
45
46
  minRequiredSlippage: string | null;
46
47
  }
48
+ | { type: ConfirmSwapErrorTypes.INSUFFICIENT_BALANCE; messages: string[] }
47
49
  | {
48
50
  type: Exclude<
49
51
  ConfirmSwapErrorTypes,
50
52
  | ConfirmSwapErrorTypes.REQUEST_FAILED
51
53
  | ConfirmSwapErrorTypes.INSUFFICIENT_SLIPPAGE
54
+ | ConfirmSwapErrorTypes.INSUFFICIENT_BALANCE
52
55
  >;
53
56
  };
54
57
 
@@ -58,12 +61,10 @@ export type ConfirmSwapWarnings =
58
61
  newOutputAmount: string;
59
62
  percentageChange: string;
60
63
  }
61
- | { type: ConfirmSwapWarningTypes.INSUFFICIENT_BALANCE; messages: string[] }
62
64
  | {
63
65
  type: Exclude<
64
66
  ConfirmSwapWarningTypes,
65
- | ConfirmSwapWarningTypes.ROUTE_AND_OUTPUT_AMOUNT_UPDATED
66
- | ConfirmSwapWarningTypes.INSUFFICIENT_BALANCE
67
+ ConfirmSwapWarningTypes.ROUTE_AND_OUTPUT_AMOUNT_UPDATED
67
68
  >;
68
69
  };
69
70
 
@@ -72,5 +73,4 @@ export enum ConfirmSwapWarningTypes {
72
73
  ROUTE_SWAPPERS_UPDATED,
73
74
  ROUTE_COINS_UPDATED,
74
75
  ROUTE_AND_OUTPUT_AMOUNT_UPDATED,
75
- INSUFFICIENT_BALANCE,
76
76
  }
@@ -131,3 +131,7 @@ export const decimalNumber = (number = '0', toFixed: number) =>
131
131
 
132
132
  export const containsText = (text: string, searchText: string) =>
133
133
  text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
134
+
135
+ export const isPositiveNumber = (text?: string) =>
136
+ !!text && parseFloat(text) > 0;
137
+ 10;
@@ -7,10 +7,8 @@ import { BestRouteResponse, BlockchainMeta, Token } from 'rango-sdk';
7
7
  import { areEqual } from './common';
8
8
  import { SelectedWallet } from './wallets';
9
9
  import { BestRouteEqualityParams } from '../types';
10
- import { TokenMeta } from '@rango-dev/ui/dist/types/meta';
11
10
  import { numberToString } from './numbers';
12
- import { getUsdFeeOfStep } from './swap';
13
- import { BestRouteWithFee } from '@rango-dev/ui';
11
+ import { PendingSwap } from '@rango-dev/queue-manager-rango-preset';
14
12
 
15
13
  export function searchParamsToToken(
16
14
  tokens: Token[],
@@ -142,19 +140,41 @@ export function isRouteParametersChanged(params: BestRouteEqualityParams) {
142
140
  return false;
143
141
  }
144
142
 
145
- export function getBestRouteWithCalculatedFees(
146
- bestRoute: BestRouteResponse | null,
147
- tokens: TokenMeta[]
148
- ): BestRouteWithFee | null {
149
- if (!bestRoute || !bestRoute.result) return null;
150
- const swapsWithFee = (bestRoute?.result?.swaps || []).map((swap) => ({
143
+ export function getFormatedBestRoute(
144
+ bestRoute: BestRouteResponse | null
145
+ ): BestRouteResponse | null {
146
+ if (!bestRoute) return null;
147
+
148
+ const formatedSwaps = (bestRoute.result?.swaps || []).map((swap) => ({
151
149
  ...swap,
152
- feeInUsd: numberToString(getUsdFeeOfStep(swap, tokens), 0, 2),
150
+ fromAmount: numberToString(swap.fromAmount, 6, 6),
151
+ toAmount: numberToString(swap.toAmount, 6, 6),
153
152
  }));
154
153
 
155
154
  return {
156
155
  ...bestRoute,
157
- result: { ...bestRoute.result, swaps: swapsWithFee },
156
+ ...(bestRoute.result && {
157
+ result: { ...bestRoute.result, swaps: formatedSwaps },
158
+ }),
159
+ };
160
+ }
161
+
162
+ export function getFormatedPendingSwap(pendingSwap: PendingSwap): PendingSwap {
163
+ const formatedSteps = pendingSwap.steps.map((step) => ({
164
+ ...step,
165
+ feeInUsd: numberToString(step.feeInUsd, 4, 4),
166
+ outputAmount: numberToString(step.outputAmount, 6, 6),
167
+ expectedOutputAmountHumanReadable: numberToString(
168
+ step.expectedOutputAmountHumanReadable,
169
+ 6,
170
+ 6
171
+ ),
172
+ }));
173
+
174
+ return {
175
+ ...pendingSwap,
176
+ inputAmount: numberToString(pendingSwap.inputAmount, 6, 6),
177
+ steps: formatedSteps,
158
178
  };
159
179
  }
160
180
 
package/src/utils/time.ts CHANGED
@@ -41,12 +41,6 @@ export function timeSince(timeMillis: number): string {
41
41
 
42
42
  export function getSwapDate(pendingSwap: PendingSwap) {
43
43
  return pendingSwap.finishTime
44
- ? `Finished ${timeSince(parseInt(pendingSwap.finishTime))} ago @ ${new Date(
45
- parseInt(pendingSwap.finishTime)
46
- ).toLocaleString()}`
47
- : `Started ${timeSince(
48
- parseInt(pendingSwap.creationTime)
49
- )} ago @ ${new Date(
50
- parseInt(pendingSwap.creationTime)
51
- ).toLocaleString()}`;
44
+ ? `${timeSince(parseInt(pendingSwap.finishTime))} ago`
45
+ : `${timeSince(parseInt(pendingSwap.creationTime))} ago`;
52
46
  }
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- interface PropTypes {
3
- messages: string[];
4
- }
5
- export declare function BalanceWarnings({ messages }: PropTypes): JSX.Element;
6
- export {};
7
- //# sourceMappingURL=BalanceWarnings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BalanceWarnings.d.ts","sourceRoot":"","sources":["../../src/components/warnings/BalanceWarnings.tsx"],"names":[],"mappings":";AAGA,UAAU,SAAS;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAuBD,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE,SAAS,eAWtD"}
@@ -1,40 +0,0 @@
1
- import { styled, Typography } from '@rango-dev/ui';
2
- import React from 'react';
3
-
4
- interface PropTypes {
5
- messages: string[];
6
- }
7
-
8
- const List = styled('ul', {
9
- variants: {
10
- showListStyle: {
11
- true: { paddingLeft: '$24' },
12
- },
13
- },
14
- });
15
-
16
- const ListItem = styled('li', {
17
- variants: {
18
- showListStyle: {
19
- true: { listStyleType: 'disc', listStylePosition: 'outside' },
20
- },
21
- },
22
- });
23
-
24
- const Message = styled(Typography, {
25
- display: 'block',
26
- color: '$warning500 !important',
27
- });
28
-
29
- export function BalanceWarnings({ messages }: PropTypes) {
30
- const showListStyle = messages.length > 1;
31
- return (
32
- <List showListStyle={showListStyle}>
33
- {messages.map((warning) => (
34
- <ListItem showListStyle={showListStyle}>
35
- <Message variant="body2">{warning}</Message>
36
- </ListItem>
37
- ))}
38
- </List>
39
- );
40
- }