@rango-dev/widget-embedded 0.23.1-next.17 → 0.23.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.
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -283
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +1 -1
- package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/QuoteTrigger.d.ts.map +1 -1
- package/dist/components/Quotes/Quotes.d.ts.map +1 -1
- package/dist/components/Slippage/Slippage.d.ts.map +1 -1
- package/dist/containers/App/App.styles.d.ts.map +1 -1
- package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
- package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/utils/ui.d.ts +5 -2
- package/dist/utils/ui.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +5 -11
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +7 -11
- package/src/components/ConfirmWalletsModal/WalletList.tsx +2 -2
- package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.ts +1 -1
- package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.tsx +4 -4
- package/src/components/Quote/Quote.tsx +7 -4
- package/src/components/Quote/QuoteTrigger.tsx +4 -5
- package/src/components/Quotes/Quotes.tsx +4 -3
- package/src/components/Slippage/Slippage.tsx +11 -13
- package/src/containers/App/App.styles.ts +0 -4
- package/src/containers/ExpandedQuotes/ExpandedQuotes.styles.ts +1 -0
- package/src/pages/ConfirmSwapPage.tsx +7 -1
- package/src/pages/Home.tsx +1 -1
- package/src/pages/LiquiditySourcePage.tsx +3 -1
- package/src/pages/SettingsPage.tsx +0 -1
- package/src/utils/ui.ts +7 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAmD5E,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAmD5E,wBAAgB,eAAe,sBAkU9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiquiditySourcePage.d.ts","sourceRoot":"","sources":["../../src/pages/LiquiditySourcePage.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAcxC,UAAU,SAAS;IACjB,UAAU,EAAE,WAAW,GAAG,SAAS,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,EAAE,UAAU,EAAE,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"LiquiditySourcePage.d.ts","sourceRoot":"","sources":["../../src/pages/LiquiditySourcePage.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAcxC,UAAU,SAAS;IACjB,UAAU,EAAE,WAAW,GAAG,SAAS,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,EAAE,UAAU,EAAE,EAAE,SAAS,qBA+H5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,wBAAgB,YAAY,
|
|
1
|
+
{"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,wBAAgB,YAAY,sBA8C3B"}
|
package/dist/utils/ui.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { WidgetTheme } from '../types';
|
|
2
2
|
import type { createTheme } from '@rango-dev/ui';
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
4
|
interface CustomizedThemeValues {
|
|
5
5
|
id: string;
|
|
6
6
|
tokens: Parameters<typeof createTheme>[0];
|
|
@@ -10,6 +10,9 @@ interface CustomizedTheme {
|
|
|
10
10
|
dark: undefined | CustomizedThemeValues;
|
|
11
11
|
}
|
|
12
12
|
export declare function customizedThemeTokens(colors: WidgetTheme['colors']): CustomizedTheme;
|
|
13
|
-
export declare function joinList(list:
|
|
13
|
+
export declare function joinList(list: {
|
|
14
|
+
element: React.JSX.Element;
|
|
15
|
+
key: string;
|
|
16
|
+
}[], divider: React.JSX.Element): React.JSX.Element[];
|
|
14
17
|
export {};
|
|
15
18
|
//# sourceMappingURL=ui.d.ts.map
|
package/dist/utils/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/utils/ui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/utils/ui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAMjD,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,UAAU,qBAAqB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C;AAED,UAAU,eAAe;IACvB,KAAK,EAAE,SAAS,GAAG,qBAAqB,CAAC;IACzC,IAAI,EAAE,SAAS,GAAG,qBAAqB,CAAC;CACzC;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,GAC5B,eAAe,CA6CjB;AAED,wBAAgB,QAAQ,CACtB,IAAI,EAAE;IAAE,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,EACnD,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,uBAiB3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.23.1-next.
|
|
3
|
+
"version": "0.23.1-next.19",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@rango-dev/queue-manager-core": "^0.26.0",
|
|
26
26
|
"@rango-dev/queue-manager-rango-preset": "^0.28.1-next.3",
|
|
27
27
|
"@rango-dev/queue-manager-react": "^0.26.0",
|
|
28
|
-
"@rango-dev/ui": "^0.29.1-next.
|
|
28
|
+
"@rango-dev/ui": "^0.29.1-next.15",
|
|
29
29
|
"@rango-dev/wallets-react": "^0.14.1-next.1",
|
|
30
30
|
"@rango-dev/wallets-shared": "^0.28.1-next.1",
|
|
31
31
|
"bignumber.js": "^9.1.1",
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Button,
|
|
3
|
-
css,
|
|
4
|
-
darkTheme,
|
|
5
|
-
IconButton,
|
|
6
|
-
styled,
|
|
7
|
-
TextField,
|
|
8
|
-
} from '@rango-dev/ui';
|
|
1
|
+
import { css, darkTheme, IconButton, styled, TextField } from '@rango-dev/ui';
|
|
9
2
|
|
|
10
3
|
export const Title = styled('div', {
|
|
11
4
|
display: 'flex',
|
|
@@ -130,10 +123,11 @@ export const StyledTextField = styled(TextField, {
|
|
|
130
123
|
|
|
131
124
|
export const Wallets = styled('div', { overflow: 'visible', width: '100%' });
|
|
132
125
|
|
|
133
|
-
export const CustomDestinationButton = styled(
|
|
126
|
+
export const CustomDestinationButton = styled('div', {
|
|
134
127
|
width: '100%',
|
|
135
|
-
borderRadius: '$sm
|
|
136
|
-
|
|
128
|
+
borderRadius: '$sm',
|
|
129
|
+
display: 'flex',
|
|
130
|
+
padding: '$15',
|
|
137
131
|
justifyContent: 'space-between',
|
|
138
132
|
alignItems: 'center',
|
|
139
133
|
$$color: '$colors$neutral100',
|
|
@@ -417,17 +417,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
417
417
|
open={showCustomDestination}
|
|
418
418
|
triggerAnchor="top"
|
|
419
419
|
trigger={
|
|
420
|
-
<CustomDestinationButton
|
|
421
|
-
fullWidth
|
|
422
|
-
variant="default"
|
|
423
|
-
suffix={
|
|
424
|
-
<ExpandedIcon
|
|
425
|
-
orientation={
|
|
426
|
-
showCustomDestination ? 'up' : 'down'
|
|
427
|
-
}>
|
|
428
|
-
<ChevronDownIcon size={10} color="gray" />
|
|
429
|
-
</ExpandedIcon>
|
|
430
|
-
}>
|
|
420
|
+
<CustomDestinationButton>
|
|
431
421
|
<div className="button__content">
|
|
432
422
|
<WalletIcon size={18} color="info" />
|
|
433
423
|
<Divider size={4} direction="horizontal" />
|
|
@@ -435,6 +425,12 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
435
425
|
{i18n.t('Send to a different address')}
|
|
436
426
|
</Typography>
|
|
437
427
|
</div>
|
|
428
|
+
<ExpandedIcon
|
|
429
|
+
orientation={
|
|
430
|
+
showCustomDestination ? 'up' : 'down'
|
|
431
|
+
}>
|
|
432
|
+
<ChevronDownIcon size={10} color="gray" />
|
|
433
|
+
</ExpandedIcon>
|
|
438
434
|
</CustomDestinationButton>
|
|
439
435
|
}
|
|
440
436
|
onClickTrigger={() =>
|
|
@@ -198,7 +198,7 @@ export function WalletList(props: PropTypes) {
|
|
|
198
198
|
)
|
|
199
199
|
: undefined;
|
|
200
200
|
return (
|
|
201
|
-
|
|
201
|
+
<React.Fragment key={`${wallet.title}_${blockchainDisplayName}`}>
|
|
202
202
|
<WalletModal
|
|
203
203
|
open={openWalletStateModal === wallet.type}
|
|
204
204
|
onClose={handleCloseWalletModal}
|
|
@@ -302,7 +302,7 @@ export function WalletList(props: PropTypes) {
|
|
|
302
302
|
disabled={!isActiveTab}
|
|
303
303
|
{...wallet}
|
|
304
304
|
/>
|
|
305
|
-
|
|
305
|
+
</React.Fragment>
|
|
306
306
|
);
|
|
307
307
|
})}
|
|
308
308
|
{shouldShowMoreWallets && (
|
|
@@ -3,16 +3,16 @@ import React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { LiquiditySourceList } from '../SettingsContainer';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { CustomListItem } from './LoadingLiquiditySourceList.styles';
|
|
7
7
|
|
|
8
8
|
const ITEM_SKELETON_COUNT = 30;
|
|
9
9
|
export function LoadingLiquiditySourceList() {
|
|
10
10
|
return (
|
|
11
11
|
<LiquiditySourceList>
|
|
12
|
-
{Array.from(Array(ITEM_SKELETON_COUNT), (
|
|
13
|
-
<
|
|
12
|
+
{Array.from(Array(ITEM_SKELETON_COUNT), (_, index) => (
|
|
13
|
+
<CustomListItem
|
|
14
14
|
hasDivider
|
|
15
|
-
key={
|
|
15
|
+
key={index}
|
|
16
16
|
start={<Skeleton variant="circular" width={35} height={35} />}
|
|
17
17
|
title={<Skeleton variant="text" size="large" width={90} />}
|
|
18
18
|
end={<Checkbox checked={false} />}
|
|
@@ -300,6 +300,8 @@ export function Quote(props: QuoteProps) {
|
|
|
300
300
|
GAS_FEE_MAX_DECIMALS
|
|
301
301
|
);
|
|
302
302
|
|
|
303
|
+
const feeWarning = totalFee.gte(new BigNumber(GAS_FEE_MAX));
|
|
304
|
+
|
|
303
305
|
return fullExpandedMode ? (
|
|
304
306
|
<FullExpandedQuote
|
|
305
307
|
selected={selected}
|
|
@@ -308,6 +310,7 @@ export function Quote(props: QuoteProps) {
|
|
|
308
310
|
tooltipContainer={getExpanded()}
|
|
309
311
|
steps={steps}
|
|
310
312
|
tags={sortedQuoteTags}
|
|
313
|
+
feeWarning={feeWarning}
|
|
311
314
|
percentageChange={percentageChange}
|
|
312
315
|
warningLevel={priceImpactWarningLevel}
|
|
313
316
|
outputPrice={{
|
|
@@ -329,10 +332,10 @@ export function Quote(props: QuoteProps) {
|
|
|
329
332
|
{sortedQuoteTags.map((tag, index) => {
|
|
330
333
|
const key = `${tag.value}_${index}`;
|
|
331
334
|
return (
|
|
332
|
-
|
|
333
|
-
<QuoteTag label={tag.label}
|
|
335
|
+
<React.Fragment key={key}>
|
|
336
|
+
<QuoteTag label={tag.label} value={tag.value} />
|
|
334
337
|
<Divider size={4} direction="horizontal" />
|
|
335
|
-
|
|
338
|
+
</React.Fragment>
|
|
336
339
|
);
|
|
337
340
|
})}
|
|
338
341
|
</TagContainer>
|
|
@@ -345,7 +348,7 @@ export function Quote(props: QuoteProps) {
|
|
|
345
348
|
quote={quote}
|
|
346
349
|
time={totalTime}
|
|
347
350
|
fee={fee}
|
|
348
|
-
feeWarning={
|
|
351
|
+
feeWarning={feeWarning}
|
|
349
352
|
showModalFee={showModalFee}
|
|
350
353
|
steps={numberOfSteps}
|
|
351
354
|
/>
|
|
@@ -73,14 +73,14 @@ export function QuoteTrigger(props: QuoteTriggerProps) {
|
|
|
73
73
|
);
|
|
74
74
|
|
|
75
75
|
return isMobile || isTablet ? (
|
|
76
|
-
|
|
76
|
+
<React.Fragment key={key}>
|
|
77
77
|
<ImageComponent
|
|
78
78
|
content={step.swapper.displayName}
|
|
79
79
|
src={step.swapper.image}
|
|
80
80
|
state={step.state}
|
|
81
81
|
/>
|
|
82
82
|
{index !== numberOfSteps - 1 && <>{arrow}</>}
|
|
83
|
-
|
|
83
|
+
</React.Fragment>
|
|
84
84
|
) : (
|
|
85
85
|
<React.Fragment key={key}>
|
|
86
86
|
{numberOfSteps <= MAX_STEPS ||
|
|
@@ -148,12 +148,11 @@ export function QuoteTrigger(props: QuoteTriggerProps) {
|
|
|
148
148
|
</Typography>
|
|
149
149
|
<Divider direction="horizontal" size={4} />
|
|
150
150
|
{blockchains.map((blockchain, index) => (
|
|
151
|
-
|
|
151
|
+
<React.Fragment key={blockchain.displayName}>
|
|
152
152
|
{blockchains.length <= MAX_BLOCKCHAINS ||
|
|
153
153
|
(blockchains.length > MAX_BLOCKCHAINS &&
|
|
154
154
|
index < MAX_BLOCKCHAINS - 1) ? (
|
|
155
155
|
<ImageComponent
|
|
156
|
-
key={blockchain.displayName}
|
|
157
156
|
content={''}
|
|
158
157
|
src={blockchain.image}
|
|
159
158
|
open={false}
|
|
@@ -190,7 +189,7 @@ export function QuoteTrigger(props: QuoteTriggerProps) {
|
|
|
190
189
|
</Tooltip>
|
|
191
190
|
)
|
|
192
191
|
)}
|
|
193
|
-
|
|
192
|
+
</React.Fragment>
|
|
194
193
|
))}
|
|
195
194
|
|
|
196
195
|
<Divider direction="horizontal" size={32} />
|
|
@@ -79,7 +79,7 @@ export function Quotes(props: PropTypes) {
|
|
|
79
79
|
expanded={false}
|
|
80
80
|
/>
|
|
81
81
|
)}
|
|
82
|
-
<Divider size={16} />
|
|
82
|
+
{index !== ITEM_SKELETON_COUNT - 1 && <Divider size={16} />}
|
|
83
83
|
</React.Fragment>
|
|
84
84
|
))}
|
|
85
85
|
|
|
@@ -97,9 +97,10 @@ export function Quotes(props: PropTypes) {
|
|
|
97
97
|
</>
|
|
98
98
|
)}
|
|
99
99
|
{hasQuotes
|
|
100
|
-
? sortQuotes.map((quote) => {
|
|
100
|
+
? sortQuotes.map((quote, index) => {
|
|
101
101
|
const quoteWarning = getQuoteWarning(quote);
|
|
102
102
|
const quoteError = getQuoteError(quote.swaps);
|
|
103
|
+
const lastIndex = sortQuotes.length - 1 === index;
|
|
103
104
|
|
|
104
105
|
return (
|
|
105
106
|
<React.Fragment key={quote.requestId}>
|
|
@@ -124,7 +125,7 @@ export function Quotes(props: PropTypes) {
|
|
|
124
125
|
}}
|
|
125
126
|
type="list-item"
|
|
126
127
|
/>
|
|
127
|
-
<Divider size={16} />
|
|
128
|
+
{!lastIndex && <Divider size={16} />}
|
|
128
129
|
</React.Fragment>
|
|
129
130
|
);
|
|
130
131
|
})
|
|
@@ -47,19 +47,17 @@ export function Slippage() {
|
|
|
47
47
|
{SLIPPAGES.map((slippageItem, index) => {
|
|
48
48
|
const key = `slippage-${index}`;
|
|
49
49
|
return (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/>
|
|
62
|
-
</>
|
|
50
|
+
<SlippageChip
|
|
51
|
+
key={key}
|
|
52
|
+
onClick={() => {
|
|
53
|
+
if (customSlippage) {
|
|
54
|
+
setCustomSlippage(null);
|
|
55
|
+
}
|
|
56
|
+
setSlippage(slippageItem);
|
|
57
|
+
}}
|
|
58
|
+
selected={!customSlippage && slippageItem === slippage}
|
|
59
|
+
label={`${slippageItem.toString()}%`}
|
|
60
|
+
/>
|
|
63
61
|
);
|
|
64
62
|
})}
|
|
65
63
|
<TextField
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { styled } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
3
|
export const MainContainer = styled('div', {
|
|
4
|
-
display: 'flex',
|
|
5
|
-
justifyContent: 'center',
|
|
6
|
-
alignItems: 'center',
|
|
7
4
|
fontFamily: '$widget',
|
|
8
5
|
boxSizing: 'border-box',
|
|
9
6
|
textAlign: 'left',
|
|
10
|
-
|
|
11
7
|
'& *, *::before, *::after': {
|
|
12
8
|
boxSizing: 'inherit',
|
|
13
9
|
},
|
|
@@ -371,7 +371,13 @@ export function ConfirmSwapPage() {
|
|
|
371
371
|
</div>
|
|
372
372
|
<Divider size="12" />
|
|
373
373
|
|
|
374
|
-
{joinList(
|
|
374
|
+
{joinList(
|
|
375
|
+
alerts.map((alert, index) => ({
|
|
376
|
+
element: alert,
|
|
377
|
+
key: `alert-${index}`,
|
|
378
|
+
})),
|
|
379
|
+
<Divider size={10} />
|
|
380
|
+
)}
|
|
375
381
|
{alerts.length > 0 ? <Divider size={10} /> : null}
|
|
376
382
|
|
|
377
383
|
<QuoteInfo
|
package/src/pages/Home.tsx
CHANGED
|
@@ -136,11 +136,13 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
|
|
|
136
136
|
fetchStatus === 'success' && (
|
|
137
137
|
<LiquiditySourceList disabled={campaignMode}>
|
|
138
138
|
{filteredList.map((sourceItem) => {
|
|
139
|
+
const { groupTitle, ...otherProps } = sourceItem;
|
|
140
|
+
|
|
139
141
|
return (
|
|
140
142
|
<React.Fragment key={sourceItem.id}>
|
|
141
143
|
<ListItemButton
|
|
142
144
|
style={{ height: '61px' }}
|
|
143
|
-
{...
|
|
145
|
+
{...otherProps}
|
|
144
146
|
selected={false}
|
|
145
147
|
hasDivider
|
|
146
148
|
/>
|
package/src/utils/ui.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
2
|
import type { WidgetTheme } from '../types';
|
|
3
3
|
import type { createTheme } from '@rango-dev/ui';
|
|
4
|
-
import type React from 'react';
|
|
5
4
|
|
|
6
5
|
import {
|
|
7
6
|
theme as baseThemeTokens,
|
|
8
7
|
darkColors as defaultDarkColors,
|
|
9
8
|
} from '@rango-dev/ui';
|
|
9
|
+
import React from 'react';
|
|
10
10
|
|
|
11
11
|
import { generateColors } from '../utils/colors';
|
|
12
12
|
import { toHash } from '../utils/hash';
|
|
@@ -73,18 +73,20 @@ export function customizedThemeTokens(
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
export function joinList(
|
|
76
|
-
list: React.JSX.Element[],
|
|
76
|
+
list: { element: React.JSX.Element; key: string }[],
|
|
77
77
|
divider: React.JSX.Element
|
|
78
78
|
) {
|
|
79
79
|
if (list.length <= 1) {
|
|
80
|
-
return list;
|
|
80
|
+
return list.map(({ element, key }) => React.cloneElement(element, { key }));
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
const output: React.JSX.Element[] = [];
|
|
84
84
|
list.forEach((item, index) => {
|
|
85
|
-
|
|
85
|
+
const { element, key } = item;
|
|
86
|
+
output.push(React.cloneElement(element, { key }));
|
|
86
87
|
if (index < list.length - 1) {
|
|
87
|
-
|
|
88
|
+
const key = `divider-${index}`;
|
|
89
|
+
output.push(React.cloneElement(divider, { key }));
|
|
88
90
|
}
|
|
89
91
|
});
|
|
90
92
|
|