@ssa-ui-kit/widgets 1.0.11 → 1.0.13
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/AccountKeys/AccountKeys.d.ts +2 -0
- package/dist/components/AccountKeys/index.d.ts +2 -0
- package/dist/components/{ExchangeAccountKeys → AccountKeys}/types.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/jest-setup.ts +3 -0
- package/package.json +3 -3
- package/src/components/AccountBalance/BalancePieChart.tsx +20 -2
- package/src/components/{ExchangeAccountKeys/ExchangeAccountKeys.specBackup.tsx → AccountKeys/AccountKeys.specBackup.tsx} +1 -1
- package/src/components/AccountKeys/AccountKeys.stories.tsx +14 -0
- package/src/components/{ExchangeAccountKeys/ExchangeAccountKeys.tsx → AccountKeys/AccountKeys.tsx} +3 -3
- package/src/components/AccountKeys/index.ts +2 -0
- package/src/components/{ExchangeAccountKeys → AccountKeys}/stories/StoryComponent.tsx +2 -2
- package/src/components/{ExchangeAccountKeys → AccountKeys}/types.ts +1 -1
- package/src/components/TradingInfoCard/TradingInfoCardTooltip.tsx +1 -1
- package/src/index.ts +1 -1
- package/tsbuildcache +1 -1
- package/dist/components/ExchangeAccountKeys/ExchangeAccountKeys.d.ts +0 -2
- package/dist/components/ExchangeAccountKeys/index.d.ts +0 -2
- package/src/components/ExchangeAccountKeys/ExchangeAccountKeys.stories.tsx +0 -14
- package/src/components/ExchangeAccountKeys/index.ts +0 -2
- /package/dist/components/{ExchangeAccountKeys → AccountKeys}/helpers.d.ts +0 -0
- /package/dist/components/{ExchangeAccountKeys → AccountKeys}/stories/StoryComponent.d.ts +0 -0
- /package/dist/components/{ExchangeAccountKeys → AccountKeys}/styles.d.ts +0 -0
- /package/src/components/{ExchangeAccountKeys → AccountKeys}/helpers.ts +0 -0
- /package/src/components/{ExchangeAccountKeys → AccountKeys}/styles.ts +0 -0
package/jest-setup.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ssa-ui-kit/widgets",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"private": false,
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"js-tokens": "^4.0.0",
|
|
30
30
|
"loose-envify": "^1.4.0",
|
|
31
31
|
"scheduler": "^0.23.0",
|
|
32
|
-
"@ssa-ui-kit/core": "^1.1.
|
|
33
|
-
"@ssa-ui-kit/hooks": "^1.0.
|
|
32
|
+
"@ssa-ui-kit/core": "^1.1.49",
|
|
33
|
+
"@ssa-ui-kit/hooks": "^1.0.2",
|
|
34
34
|
"@ssa-ui-kit/utils": "^1.0.0"
|
|
35
35
|
},
|
|
36
36
|
"browserslist": [
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
PieChartFeatures,
|
|
6
6
|
PieChartLegend,
|
|
7
7
|
pieChartPalettes,
|
|
8
|
+
mainTheme,
|
|
8
9
|
} from '@ssa-ui-kit/core';
|
|
9
10
|
import { BalancePieChartTitle } from './BalancePieChartTitle';
|
|
10
11
|
|
|
@@ -29,6 +30,23 @@ export const BalancePieChart = withTheme(
|
|
|
29
30
|
pieChartPalettes.getBalancePalette(theme);
|
|
30
31
|
const featuresList = new Set<PieChartFeatures>();
|
|
31
32
|
|
|
33
|
+
const filteredIndexes: number[] = [];
|
|
34
|
+
const chartData = data?.filter((item, index) => {
|
|
35
|
+
const isSaved = item.value !== 0;
|
|
36
|
+
if (!isSaved) {
|
|
37
|
+
filteredIndexes.push(index);
|
|
38
|
+
}
|
|
39
|
+
return isSaved;
|
|
40
|
+
});
|
|
41
|
+
const chartColors = (chartColorPalette || pieChartColors).filter(
|
|
42
|
+
(item, index) => !filteredIndexes.includes(index),
|
|
43
|
+
);
|
|
44
|
+
if (chartColors.length < chartData.length) {
|
|
45
|
+
for (let i = 0; i < chartData.length - chartColors.length; i++) {
|
|
46
|
+
chartColors.push(mainTheme.colors.purpleLighter as string);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
32
50
|
if (Object.keys(pieChartProps.cardProps || {}).length) {
|
|
33
51
|
featuresList.add('header');
|
|
34
52
|
}
|
|
@@ -43,9 +61,9 @@ export const BalancePieChart = withTheme(
|
|
|
43
61
|
};
|
|
44
62
|
return (
|
|
45
63
|
<PieChart
|
|
46
|
-
data={
|
|
64
|
+
data={chartData}
|
|
47
65
|
features={Array.from(featuresList)}
|
|
48
|
-
colors={
|
|
66
|
+
colors={chartColors}
|
|
49
67
|
onFullscreenModeChange={handleFullscreenModeChange}
|
|
50
68
|
animate={false}
|
|
51
69
|
title={
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import userEvent from '@testing-library/user-event';
|
|
2
2
|
import { StoryComponent } from './stories/StoryComponent';
|
|
3
3
|
|
|
4
|
-
describe('
|
|
4
|
+
describe('AccountKeys', () => {
|
|
5
5
|
it('Renders with title', () => {
|
|
6
6
|
const { getByText } = render(<StoryComponent onDelete={jest.fn()} />);
|
|
7
7
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AccountKeys } from './AccountKeys';
|
|
3
|
+
import { StoryComponent } from './stories/StoryComponent';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Trading/AccountKeys',
|
|
7
|
+
component: AccountKeys,
|
|
8
|
+
} as Meta<typeof AccountKeys>;
|
|
9
|
+
|
|
10
|
+
export const Default: StoryObj<typeof AccountKeys> = () => (
|
|
11
|
+
<StoryComponent onDelete={() => alert('Account Deleted!')} />
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
Default.args = {};
|
package/src/components/{ExchangeAccountKeys/ExchangeAccountKeys.tsx → AccountKeys/AccountKeys.tsx}
RENAMED
|
@@ -8,17 +8,17 @@ import {
|
|
|
8
8
|
Icon,
|
|
9
9
|
Typography,
|
|
10
10
|
} from '@ssa-ui-kit/core';
|
|
11
|
-
import {
|
|
11
|
+
import { AccountKeysProps } from './types';
|
|
12
12
|
import * as S from './styles';
|
|
13
13
|
|
|
14
|
-
export const
|
|
14
|
+
export const AccountKeys = ({
|
|
15
15
|
title,
|
|
16
16
|
apiKey,
|
|
17
17
|
secretKey,
|
|
18
18
|
onDelete,
|
|
19
19
|
onVisibilityChange,
|
|
20
20
|
isDisabled,
|
|
21
|
-
}:
|
|
21
|
+
}: AccountKeysProps) => {
|
|
22
22
|
const [isVisible, setIsVisible] = useState(false);
|
|
23
23
|
const theme = useTheme();
|
|
24
24
|
const placeholder = <span>******</span>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AccountKeys } from '../AccountKeys';
|
|
3
3
|
import { getMockData } from '../helpers';
|
|
4
4
|
|
|
5
5
|
interface onDelete {
|
|
@@ -21,7 +21,7 @@ export const StoryComponent = ({ onDelete }: onDelete) => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
|
-
<
|
|
24
|
+
<AccountKeys
|
|
25
25
|
title="Account Name"
|
|
26
26
|
apiKey="123456789012345678901234567890"
|
|
27
27
|
secretKey={secretKey}
|
package/src/index.ts
CHANGED
|
@@ -33,4 +33,4 @@ export * from './components/TradingScoreboard';
|
|
|
33
33
|
export * from './components/BotsTable';
|
|
34
34
|
export * from './components/AccountBalance';
|
|
35
35
|
export * from './components/ExchangeAccount';
|
|
36
|
-
export * from './components/
|
|
36
|
+
export * from './components/AccountKeys';
|