@ssa-ui-kit/widgets 1.0.8 → 1.0.10
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/AccountBalance/AccountBalance.d.ts +1 -1
- package/dist/components/AccountBalance/BalancePieChart.d.ts +1 -1
- package/dist/components/AccountBalance/types.d.ts +2 -0
- package/dist/components/ExchangeAccount/ExchangeAccount.d.ts +1 -1
- package/dist/components/ExchangeAccount/types.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/AccountBalance/AccountBalance.stories.tsx +2 -0
- package/src/components/AccountBalance/AccountBalance.tsx +13 -1
- package/src/components/AccountBalance/BalancePieChart.tsx +2 -0
- package/src/components/AccountBalance/BalancePieChartTitle.tsx +1 -4
- package/src/components/AccountBalance/types.ts +2 -0
- package/src/components/ExchangeAccount/ExchangeAccount.stories.tsx +19 -0
- package/src/components/ExchangeAccount/ExchangeAccount.tsx +3 -1
- package/src/components/ExchangeAccount/types.ts +2 -0
- package/tsbuildcache +1 -1
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.10",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"private": false,
|
|
@@ -29,9 +29,9 @@
|
|
|
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/
|
|
34
|
-
"@ssa-ui-kit/
|
|
32
|
+
"@ssa-ui-kit/core": "^1.1.7",
|
|
33
|
+
"@ssa-ui-kit/hooks": "^1.0.0",
|
|
34
|
+
"@ssa-ui-kit/utils": "^1.0.0"
|
|
35
35
|
},
|
|
36
36
|
"browserslist": [
|
|
37
37
|
">0.1%",
|
|
@@ -66,6 +66,7 @@ Custom.args = {
|
|
|
66
66
|
mainTheme.colors.green as string,
|
|
67
67
|
],
|
|
68
68
|
legendColorPalette: ['blue', 'green'],
|
|
69
|
+
widgetMaxWidth: '230px',
|
|
69
70
|
data: [
|
|
70
71
|
{
|
|
71
72
|
id: 'BTC',
|
|
@@ -106,6 +107,7 @@ WithoutPaletteColors.args = {
|
|
|
106
107
|
'linear-gradient(243.84deg, rgb(235, 117, 86), rgb(242, 136, 142))',
|
|
107
108
|
'#50AF95',
|
|
108
109
|
],
|
|
110
|
+
widgetMaxWidth: '230px',
|
|
109
111
|
data: [
|
|
110
112
|
{
|
|
111
113
|
id: 'BTC',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
1
2
|
import { useTheme } from '@emotion/react';
|
|
2
3
|
import { css } from '@emotion/css';
|
|
3
4
|
import { WithLink } from '@ssa-ui-kit/core';
|
|
@@ -12,9 +13,11 @@ export const AccountBalance = ({
|
|
|
12
13
|
variant = 'valueList',
|
|
13
14
|
fullscreenModeFeature = false,
|
|
14
15
|
activeHighlight = true,
|
|
16
|
+
widgetMaxWidth = '280px',
|
|
15
17
|
...props
|
|
16
18
|
}: AccountBalanceProps) => {
|
|
17
19
|
const theme = useTheme();
|
|
20
|
+
const [isFullscreenMode, setIsFullscreenMode] = useState(false);
|
|
18
21
|
|
|
19
22
|
return (
|
|
20
23
|
<WithLink link={link} onClick={onClick}>
|
|
@@ -23,10 +26,19 @@ export const AccountBalance = ({
|
|
|
23
26
|
variant={variant}
|
|
24
27
|
fullscreenModeFeature={fullscreenModeFeature}
|
|
25
28
|
activeHighlight={activeHighlight}
|
|
29
|
+
onFullscreenModeChange={setIsFullscreenMode}
|
|
26
30
|
pieChartProps={{
|
|
31
|
+
width: '100%',
|
|
27
32
|
cardProps: {
|
|
28
33
|
title,
|
|
29
|
-
className
|
|
34
|
+
className: [
|
|
35
|
+
css`
|
|
36
|
+
& > div:last-of-type {
|
|
37
|
+
max-width: ${isFullscreenMode ? '100%' : widgetMaxWidth};
|
|
38
|
+
}
|
|
39
|
+
`,
|
|
40
|
+
className,
|
|
41
|
+
].join(' '),
|
|
30
42
|
headerClassName: css([
|
|
31
43
|
{
|
|
32
44
|
fontSize: 11,
|
|
@@ -22,6 +22,7 @@ export const BalancePieChart = withTheme(
|
|
|
22
22
|
pieChartProps = {},
|
|
23
23
|
fullscreenModeFeature = false,
|
|
24
24
|
activeHighlight = false,
|
|
25
|
+
onFullscreenModeChange,
|
|
25
26
|
}: BalancePieChartProps) => {
|
|
26
27
|
const [isFullscreenMode, setFullscreenMode] = useState(false);
|
|
27
28
|
const { legendColorNames, pieChartColors } =
|
|
@@ -38,6 +39,7 @@ export const BalancePieChart = withTheme(
|
|
|
38
39
|
|
|
39
40
|
const handleFullscreenModeChange = (pieChartFullscreenMode: boolean) => {
|
|
40
41
|
setFullscreenMode(pieChartFullscreenMode);
|
|
42
|
+
onFullscreenModeChange?.(pieChartFullscreenMode);
|
|
41
43
|
};
|
|
42
44
|
return (
|
|
43
45
|
<PieChart
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { withTheme, css } from '@emotion/react';
|
|
2
2
|
import { Typography, useFullscreenMode } from '@ssa-ui-kit/core';
|
|
3
|
-
import { useTextSizeDecrease } from '@ssa-ui-kit/hooks';
|
|
4
3
|
import { BalancePieChartTitleProps } from './types';
|
|
5
4
|
|
|
6
5
|
export const BalancePieChartTitle = withTheme(
|
|
7
6
|
({ total, currency, theme }: BalancePieChartTitleProps) => {
|
|
8
|
-
const ref = useTextSizeDecrease();
|
|
9
7
|
const { isFullscreenMode } = useFullscreenMode();
|
|
10
8
|
return (
|
|
11
9
|
<Typography
|
|
12
|
-
ref={ref}
|
|
13
10
|
variant="body2"
|
|
14
11
|
weight="bold"
|
|
15
12
|
color={theme.colors.greyDarker}
|
|
@@ -20,7 +17,7 @@ export const BalancePieChartTitle = withTheme(
|
|
|
20
17
|
font-weight: 500;
|
|
21
18
|
`
|
|
22
19
|
: css`
|
|
23
|
-
font-size:
|
|
20
|
+
font-size: 10px;
|
|
24
21
|
padding: 0 14px;
|
|
25
22
|
line-height: 1;
|
|
26
23
|
`
|
|
@@ -23,6 +23,7 @@ type BalanceBase = {
|
|
|
23
23
|
export interface BalancePieChartProps extends WithTheme, BalanceBase {
|
|
24
24
|
pieChartProps?: Partial<PieChartProps>;
|
|
25
25
|
activeHighlight?: boolean;
|
|
26
|
+
onFullscreenModeChange?: (isFullscreenMode: boolean) => void;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export interface AccountBalanceProps extends BalanceBase {
|
|
@@ -31,6 +32,7 @@ export interface AccountBalanceProps extends BalanceBase {
|
|
|
31
32
|
onClick?: () => void;
|
|
32
33
|
link?: To;
|
|
33
34
|
activeHighlight?: boolean;
|
|
35
|
+
widgetMaxWidth?: string;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export type BalancePieChartTitleProps = Pick<
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import { css, useTheme } from '@emotion/react';
|
|
4
|
+
import { css as cssClassname } from '@emotion/css';
|
|
4
5
|
import { Icon, AddNewAccountCard } from '@ssa-ui-kit/core';
|
|
5
6
|
import { ExchangeAccount } from './ExchangeAccount';
|
|
6
7
|
import { dataValues } from './helpers';
|
|
@@ -19,6 +20,12 @@ export const Default: StoryObj<typeof ExchangeAccount> = () => {
|
|
|
19
20
|
data={dataValues[0].data}
|
|
20
21
|
onClick={() => alert('Card is clicked!')}
|
|
21
22
|
onDelete={() => alert('Card is deleted!')}
|
|
23
|
+
pieChartProps={{
|
|
24
|
+
className: cssClassname`
|
|
25
|
+
align-self: center;
|
|
26
|
+
max-width: 300px;
|
|
27
|
+
`,
|
|
28
|
+
}}
|
|
22
29
|
/>
|
|
23
30
|
);
|
|
24
31
|
};
|
|
@@ -40,6 +47,12 @@ export const WithLink: StoryObj<typeof ExchangeAccount> = () => {
|
|
|
40
47
|
link="/link"
|
|
41
48
|
onClick={() => alert('Card is clicked!')}
|
|
42
49
|
onDelete={() => alert('Card is deleted!')}
|
|
50
|
+
pieChartProps={{
|
|
51
|
+
className: cssClassname`
|
|
52
|
+
align-self: center;
|
|
53
|
+
max-width: 300px;
|
|
54
|
+
`,
|
|
55
|
+
}}
|
|
43
56
|
/>
|
|
44
57
|
}
|
|
45
58
|
/>
|
|
@@ -79,6 +92,12 @@ export const List: StoryObj<typeof ExchangeAccount> = () => {
|
|
|
79
92
|
data={item.data}
|
|
80
93
|
onClick={() => alert('Card is clicked!')}
|
|
81
94
|
onDelete={() => alert('Card is deleted!')}
|
|
95
|
+
pieChartProps={{
|
|
96
|
+
className: cssClassname`
|
|
97
|
+
align-self: center;
|
|
98
|
+
max-width: 300px;
|
|
99
|
+
`,
|
|
100
|
+
}}
|
|
82
101
|
/>
|
|
83
102
|
);
|
|
84
103
|
})}
|
|
@@ -19,6 +19,7 @@ export const ExchangeAccount = ({
|
|
|
19
19
|
status,
|
|
20
20
|
link,
|
|
21
21
|
data,
|
|
22
|
+
pieChartProps,
|
|
22
23
|
onClick,
|
|
23
24
|
onDelete,
|
|
24
25
|
}: ExchangeAccountProps) => {
|
|
@@ -69,7 +70,6 @@ export const ExchangeAccount = ({
|
|
|
69
70
|
<CardContent css={S.CardContent} direction="column">
|
|
70
71
|
<BalancePieChart
|
|
71
72
|
theme={theme}
|
|
72
|
-
{...data}
|
|
73
73
|
pieChartProps={{
|
|
74
74
|
className: css`
|
|
75
75
|
${theme.mediaQueries.md} {
|
|
@@ -79,7 +79,9 @@ export const ExchangeAccount = ({
|
|
|
79
79
|
flex-direction: column;
|
|
80
80
|
}
|
|
81
81
|
`,
|
|
82
|
+
...pieChartProps,
|
|
82
83
|
}}
|
|
84
|
+
{...data}
|
|
83
85
|
/>
|
|
84
86
|
</CardContent>
|
|
85
87
|
</CardBase>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { To } from 'react-router-dom';
|
|
2
|
+
import { PieChartProps } from '@ssa-ui-kit/core';
|
|
2
3
|
import { AccountBalanceProps } from '@components/AccountBalance';
|
|
3
4
|
|
|
4
5
|
export interface ExchangeAccountProps {
|
|
@@ -9,4 +10,5 @@ export interface ExchangeAccountProps {
|
|
|
9
10
|
onDelete: () => void;
|
|
10
11
|
link?: To;
|
|
11
12
|
data: Omit<AccountBalanceProps, 'title' | 'className' | 'onClick' | 'link'>;
|
|
13
|
+
pieChartProps?: Partial<PieChartProps>;
|
|
12
14
|
}
|