@ssa-ui-kit/widgets 0.0.15-alpha → 0.0.17-alpha
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/LICENSE +21 -0
- package/dist/components/AccountBalance/AccountBalance.d.ts +1 -1
- package/dist/components/AccountBalance/BalancePieChart.d.ts +1 -1
- package/dist/components/AccountBalance/BalancePieChartTitle.d.ts +1 -1
- package/dist/components/AccountBalance/types.d.ts +4 -1
- package/dist/components/CollapsibleNavBar/NavBarAccordionContent.d.ts +2 -1
- package/dist/components/CollapsibleNavBar/NavBarItemWithSubMenu.d.ts +2 -1
- package/dist/components/CollapsibleNavBar/NavBarItemWithoutSubMenu.d.ts +2 -1
- package/dist/components/PieChart/PieChartLegend.d.ts +1 -1
- package/dist/components/PieChart/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.spec.tsx +29 -0
- package/src/components/AccountBalance/AccountBalance.stories.tsx +42 -0
- package/src/components/AccountBalance/AccountBalance.tsx +2 -1
- package/src/components/AccountBalance/BalancePieChart.tsx +13 -4
- package/src/components/AccountBalance/types.ts +4 -1
- package/src/components/CollapsibleNavBar/CollapsibleNavBar.tsx +21 -11
- package/src/components/CollapsibleNavBar/NavBarAccordionContent.tsx +3 -0
- package/src/components/CollapsibleNavBar/NavBarItemWithSubMenu.tsx +3 -0
- package/src/components/CollapsibleNavBar/NavBarItemWithoutSubMenu.tsx +3 -1
- package/src/components/PieChart/PieChartLegend.tsx +38 -15
- package/src/components/PieChart/types.ts +2 -0
- package/tsbuildcache +1 -1
- package/storybook-static/0.19f2e251.iframe.bundle.js +0 -1
- package/storybook-static/106.f1e6d14d.iframe.bundle.js +0 -44
- package/storybook-static/106.f1e6d14d.iframe.bundle.js.map +0 -1
- package/storybook-static/162.50e9b926.iframe.bundle.js +0 -1
- package/storybook-static/291.c8585ee9.iframe.bundle.js +0 -1
- package/storybook-static/293.c50861da.iframe.bundle.js +0 -2
- package/storybook-static/293.c50861da.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/36.713e1566.iframe.bundle.js +0 -1
- package/storybook-static/460.8dc4e7c6.iframe.bundle.js +0 -402
- package/storybook-static/460.8dc4e7c6.iframe.bundle.js.LICENSE.txt +0 -64
- package/storybook-static/460.8dc4e7c6.iframe.bundle.js.map +0 -1
- package/storybook-static/576.98c3eb27.iframe.bundle.js +0 -1
- package/storybook-static/620.61fd9060.iframe.bundle.js +0 -1
- package/storybook-static/696.e559304f.iframe.bundle.js +0 -2
- package/storybook-static/696.e559304f.iframe.bundle.js.LICENSE.txt +0 -32
- package/storybook-static/710.ab631936.iframe.bundle.js +0 -1
- package/storybook-static/829.7385f99b.iframe.bundle.js +0 -139
- package/storybook-static/829.7385f99b.iframe.bundle.js.map +0 -1
- package/storybook-static/834.04cdfc87.iframe.bundle.js +0 -1
- package/storybook-static/945.ddb2ee2f.iframe.bundle.js +0 -1
- package/storybook-static/components-Activity-Activity-stories.107a3fa3.iframe.bundle.js +0 -1
- package/storybook-static/components-Bmi-Bmi-stories.b8c54168.iframe.bundle.js +0 -1
- package/storybook-static/components-Calories-Calories-stories.8851a637.iframe.bundle.js +0 -1
- package/storybook-static/components-CardList-CardList-stories.963f2911.iframe.bundle.js +0 -1
- package/storybook-static/components-HeartRate-HeartRate-stories.f9844316.iframe.bundle.js +0 -1
- package/storybook-static/components-ListGoals-ListGoals-stories.ca994275.iframe.bundle.js +0 -1
- package/storybook-static/components-MealNutrients-MealNutrients-stories.1850ecb0.iframe.bundle.js +0 -1
- package/storybook-static/components-MealPlanner-MealPlanner-stories.542c85fc.iframe.bundle.js +0 -1
- package/storybook-static/components-NavBar-NavBar-stories.73f09876.iframe.bundle.js +0 -1
- package/storybook-static/components-ProgressInfo-ProgressInfo-stories.f6b5466e.iframe.bundle.js +0 -1
- package/storybook-static/components-StepsCounter-StepsCounter-stories.967e384f.iframe.bundle.js +0 -1
- package/storybook-static/components-UpcomingWorkouts-UpcomingWorkouts-stories.ba735508.iframe.bundle.js +0 -1
- package/storybook-static/components-WaterConsume-WaterConsume-stories.4b5e8cb5.iframe.bundle.js +0 -1
- package/storybook-static/favicon.svg +0 -7
- package/storybook-static/iframe.html +0 -355
- package/storybook-static/index.html +0 -126
- package/storybook-static/index.json +0 -1
- package/storybook-static/main.912c7e67.iframe.bundle.js +0 -1
- package/storybook-static/project.json +0 -1
- package/storybook-static/runtime~main.e664d5e5.iframe.bundle.js +0 -1
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +0 -4
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js.map +0 -7
- package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js +0 -13
- package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js.map +0 -7
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +0 -117
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.LEGAL.txt +0 -18
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.map +0 -7
- package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js +0 -4
- package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js.map +0 -7
- package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js +0 -4
- package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js.map +0 -7
- package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js +0 -4
- package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js.map +0 -7
- package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js +0 -4
- package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js.map +0 -7
- package/storybook-static/sb-addons/interactions-8/manager-bundle.js +0 -28
- package/storybook-static/sb-addons/interactions-8/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/interactions-8/manager-bundle.js.map +0 -7
- package/storybook-static/sb-addons/links-0/manager-bundle.js +0 -4
- package/storybook-static/sb-addons/links-0/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/links-0/manager-bundle.js.map +0 -7
- package/storybook-static/sb-common-assets/fonts.css +0 -31
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/GlobalScrollAreaStyles-DZEYMYDM-UAEZM2KF.js +0 -7
- package/storybook-static/sb-manager/OverlayScrollbars-OGE3XJTA-T3S33YR7.js +0 -1
- package/storybook-static/sb-manager/WithTooltip-I4CCNYWD-ZW5IOTVO.js +0 -1
- package/storybook-static/sb-manager/chunk-3FAXWWKG.js +0 -15
- package/storybook-static/sb-manager/chunk-AA6TEL5N.js +0 -207
- package/storybook-static/sb-manager/chunk-AM2ZNZZH.js +0 -136
- package/storybook-static/sb-manager/chunk-AS2AMEUR.js +0 -1
- package/storybook-static/sb-manager/chunk-FPTBIX6P.js +0 -403
- package/storybook-static/sb-manager/chunk-IPZYHIL3.js +0 -7
- package/storybook-static/sb-manager/chunk-QPL63VNK.js +0 -1
- package/storybook-static/sb-manager/chunk-R5BIZIS3.js +0 -1
- package/storybook-static/sb-manager/formatter-OJ5LH2CX-IQX6U4TO.js +0 -156
- package/storybook-static/sb-manager/globals.js +0 -1
- package/storybook-static/sb-manager/index.js +0 -1
- package/storybook-static/sb-manager/runtime.js +0 -1
- package/storybook-static/sb-manager/syntaxhighlighter-SIPZPD4I-WOB5MYBW.js +0 -1
- package/storybook-static/sb-preview/globals.js +0 -1
- package/storybook-static/sb-preview/runtime.js +0 -105
- package/storybook-static/stories.json +0 -1
- package/tsconfig.tsbuildinfo +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ssa-ui-kit/widgets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17-alpha",
|
|
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": "^0.0.
|
|
33
|
-
"@ssa-ui-kit/
|
|
34
|
-
"@ssa-ui-kit/
|
|
32
|
+
"@ssa-ui-kit/core": "^0.0.12-alpha",
|
|
33
|
+
"@ssa-ui-kit/utils": "^0.0.1-alpha",
|
|
34
|
+
"@ssa-ui-kit/hooks": "^0.0.1-alpha"
|
|
35
35
|
},
|
|
36
36
|
"browserslist": [
|
|
37
37
|
">0.1%",
|
|
@@ -79,4 +79,33 @@ describe('AccountBalance', () => {
|
|
|
79
79
|
await fireEvent.click(linkEl);
|
|
80
80
|
expect(onClick).toHaveBeenCalledTimes(1);
|
|
81
81
|
});
|
|
82
|
+
|
|
83
|
+
it('Renders without value list', () => {
|
|
84
|
+
const { getByText } = render(
|
|
85
|
+
<AccountBalance
|
|
86
|
+
total="798"
|
|
87
|
+
currency="USDT"
|
|
88
|
+
variant="withoutValueList"
|
|
89
|
+
data={[
|
|
90
|
+
{
|
|
91
|
+
id: 'BTC',
|
|
92
|
+
label: 'BTC',
|
|
93
|
+
legendValue: 1,
|
|
94
|
+
value: 871.23,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'LTC',
|
|
98
|
+
label: 'LTC',
|
|
99
|
+
legendValue: 7,
|
|
100
|
+
value: 530.25,
|
|
101
|
+
},
|
|
102
|
+
]}
|
|
103
|
+
/>,
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
getByText('1 BTC');
|
|
107
|
+
getByText('871.23 USDT');
|
|
108
|
+
getByText('7 LTC');
|
|
109
|
+
getByText('530.25 USDT');
|
|
110
|
+
});
|
|
82
111
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { mainTheme } from '@ssa-ui-kit/core';
|
|
3
5
|
|
|
4
6
|
import { data } from './stories/fixtures';
|
|
5
7
|
|
|
@@ -33,3 +35,43 @@ WithLink.args = {
|
|
|
33
35
|
...Default.args,
|
|
34
36
|
link: '/',
|
|
35
37
|
};
|
|
38
|
+
|
|
39
|
+
export const Custom: StoryObj<typeof AccountBalance> = (
|
|
40
|
+
args: AccountBalanceProps,
|
|
41
|
+
) => {
|
|
42
|
+
return (
|
|
43
|
+
<AccountBalance
|
|
44
|
+
{...args}
|
|
45
|
+
css={css`
|
|
46
|
+
ul li {
|
|
47
|
+
height: auto;
|
|
48
|
+
}
|
|
49
|
+
`}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
Custom.args = {
|
|
55
|
+
total: 48700.53569,
|
|
56
|
+
currency: 'USDT',
|
|
57
|
+
variant: 'withoutValueList',
|
|
58
|
+
chartColorPalette: [
|
|
59
|
+
mainTheme.colors.blue as string,
|
|
60
|
+
mainTheme.colors.green as string,
|
|
61
|
+
],
|
|
62
|
+
legendColorPalette: ['blue', 'green'],
|
|
63
|
+
data: [
|
|
64
|
+
{
|
|
65
|
+
id: 'BTC',
|
|
66
|
+
label: 'BTC',
|
|
67
|
+
value: 571.23,
|
|
68
|
+
legendValue: 12323,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'LTC',
|
|
72
|
+
label: 'LTC',
|
|
73
|
+
value: 530.25,
|
|
74
|
+
legendValue: 12323,
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
};
|
|
@@ -9,6 +9,7 @@ export const AccountBalance = ({
|
|
|
9
9
|
className,
|
|
10
10
|
onClick,
|
|
11
11
|
link,
|
|
12
|
+
variant = 'valueList',
|
|
12
13
|
...props
|
|
13
14
|
}: AccountBalanceProps) => {
|
|
14
15
|
const theme = useTheme();
|
|
@@ -55,7 +56,7 @@ export const AccountBalance = ({
|
|
|
55
56
|
width: 100%;
|
|
56
57
|
display: block;
|
|
57
58
|
`}>
|
|
58
|
-
<BalancePieChart theme={theme} {...props} />
|
|
59
|
+
<BalancePieChart theme={theme} variant={variant} {...props} />
|
|
59
60
|
</CardContent>
|
|
60
61
|
</Card>
|
|
61
62
|
</WithLink>
|
|
@@ -10,14 +10,21 @@ import { BalancePieChartTitle } from './BalancePieChartTitle';
|
|
|
10
10
|
import { BalancePieChartProps } from './types';
|
|
11
11
|
|
|
12
12
|
export const BalancePieChart = withTheme(
|
|
13
|
-
({
|
|
13
|
+
({
|
|
14
|
+
total,
|
|
15
|
+
currency,
|
|
16
|
+
data,
|
|
17
|
+
theme,
|
|
18
|
+
chartColorPalette,
|
|
19
|
+
legendColorPalette,
|
|
20
|
+
variant = 'valueList',
|
|
21
|
+
}: BalancePieChartProps) => {
|
|
14
22
|
const { legendColorNames, pieChartColors } =
|
|
15
23
|
pieChartPalettes.getBalancePalette(theme);
|
|
16
|
-
|
|
17
24
|
return (
|
|
18
25
|
<PieChart
|
|
19
26
|
data={data}
|
|
20
|
-
colors={pieChartColors}
|
|
27
|
+
colors={chartColorPalette || pieChartColors}
|
|
21
28
|
animate={false}
|
|
22
29
|
title={
|
|
23
30
|
<BalancePieChartTitle
|
|
@@ -41,7 +48,9 @@ export const BalancePieChart = withTheme(
|
|
|
41
48
|
`}>
|
|
42
49
|
<PieChartLegend
|
|
43
50
|
data={data}
|
|
44
|
-
colors={legendColorNames}
|
|
51
|
+
colors={legendColorPalette || legendColorNames}
|
|
52
|
+
variant={variant}
|
|
53
|
+
currency={currency}
|
|
45
54
|
markerStyles={css`
|
|
46
55
|
width: 10px;
|
|
47
56
|
height: 10px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Theme } from '@ssa-ui-kit/core';
|
|
1
|
+
import { MainColors, Theme } from '@ssa-ui-kit/core';
|
|
2
2
|
import type { To } from 'react-router-dom';
|
|
3
3
|
|
|
4
4
|
interface WithTheme {
|
|
@@ -8,6 +8,9 @@ interface WithTheme {
|
|
|
8
8
|
type BalanceBase = {
|
|
9
9
|
total: number | string;
|
|
10
10
|
currency: string;
|
|
11
|
+
legendColorPalette?: Array<keyof MainColors>;
|
|
12
|
+
chartColorPalette?: string[];
|
|
13
|
+
variant?: 'valueList' | 'withoutValueList';
|
|
11
14
|
data: Array<{
|
|
12
15
|
id: string | number;
|
|
13
16
|
value: number;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useState, useId, useEffect } from 'react';
|
|
2
2
|
import { Wrapper } from '@ssa-ui-kit/core';
|
|
3
|
+
import { useWindowSize } from '@ssa-ui-kit/hooks';
|
|
3
4
|
import * as S from './styles';
|
|
4
5
|
|
|
6
|
+
import { SCREEN_SIZES } from '../../consts';
|
|
5
7
|
import CollapsibleNavBarBase from './CollapsibleNavBarBase';
|
|
6
8
|
import CollapsibleNavBarWrapper from './CollapsibleNavBarWrapper';
|
|
7
9
|
import CollapsibleNavBarList from './CollapsibleNavBarList';
|
|
@@ -10,7 +12,6 @@ import { CollapsibleNavBarExtendedProps } from './types';
|
|
|
10
12
|
import { NavContentToggle } from './CollapsibleNavContentToggle';
|
|
11
13
|
import { NavBarItemWithSubMenu } from './NavBarItemWithSubMenu';
|
|
12
14
|
import { NavBarItemWithoutSubMenu } from './NavBarItemWithoutSubMenu';
|
|
13
|
-
|
|
14
15
|
/**
|
|
15
16
|
* UI Component that shows the collapsible navigation bar
|
|
16
17
|
*/
|
|
@@ -19,18 +20,19 @@ export const CollapsibleNavBar = ({
|
|
|
19
20
|
renderLogo,
|
|
20
21
|
}: CollapsibleNavBarExtendedProps) => {
|
|
21
22
|
const toggleId = useId();
|
|
23
|
+
const { width } = useWindowSize();
|
|
22
24
|
const [isChecked, onToggle] = useState(false);
|
|
25
|
+
const isMobile = width < SCREEN_SIZES['900'].width;
|
|
23
26
|
|
|
24
27
|
useEffect(() => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
+
onToggle(false);
|
|
29
|
+
}, [width]);
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
}
|
|
31
|
+
const handleCloseMobileMenu = () => {
|
|
32
|
+
if (isMobile) {
|
|
33
|
+
onToggle(!isChecked);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
34
36
|
|
|
35
37
|
return (
|
|
36
38
|
<CollapsibleNavBarBase className={isChecked ? 'opened' : undefined}>
|
|
@@ -55,9 +57,17 @@ export const CollapsibleNavBar = ({
|
|
|
55
57
|
const { iconName, title } = item;
|
|
56
58
|
const keyName = iconName + title.replace(' ', '').toLowerCase();
|
|
57
59
|
return 'items' in item ? (
|
|
58
|
-
<NavBarItemWithSubMenu
|
|
60
|
+
<NavBarItemWithSubMenu
|
|
61
|
+
item={item}
|
|
62
|
+
key={keyName}
|
|
63
|
+
onClick={handleCloseMobileMenu}
|
|
64
|
+
/>
|
|
59
65
|
) : (
|
|
60
|
-
<NavBarItemWithoutSubMenu
|
|
66
|
+
<NavBarItemWithoutSubMenu
|
|
67
|
+
item={item}
|
|
68
|
+
key={keyName}
|
|
69
|
+
onClick={handleCloseMobileMenu}
|
|
70
|
+
/>
|
|
61
71
|
);
|
|
62
72
|
})}
|
|
63
73
|
</CollapsibleNavBarList>
|
|
@@ -26,12 +26,14 @@ export const NavBarAccordionContent = ({
|
|
|
26
26
|
accordionUniqueName,
|
|
27
27
|
prefix,
|
|
28
28
|
isPopover,
|
|
29
|
+
onClick,
|
|
29
30
|
...rest
|
|
30
31
|
}: RenderContentProps & {
|
|
31
32
|
items: Array<{ path: string; title: string }>;
|
|
32
33
|
accordionUniqueName: string;
|
|
33
34
|
prefix?: string;
|
|
34
35
|
isPopover?: boolean;
|
|
36
|
+
onClick?: () => void;
|
|
35
37
|
}) => (
|
|
36
38
|
<AccordionContent
|
|
37
39
|
{...rest}
|
|
@@ -41,6 +43,7 @@ export const NavBarAccordionContent = ({
|
|
|
41
43
|
key={`${accordionUniqueName}-link-${subMenuItem.title
|
|
42
44
|
.replace(' ', '')
|
|
43
45
|
.toLowerCase()}`}
|
|
46
|
+
onClick={onClick}
|
|
44
47
|
to={'/' + prefix + subMenuItem.path}>
|
|
45
48
|
{subMenuItem.title}
|
|
46
49
|
</Link>
|
|
@@ -18,8 +18,10 @@ const Link = CollapsibleNavBarLink.withComponent('div');
|
|
|
18
18
|
|
|
19
19
|
export const NavBarItemWithSubMenu = ({
|
|
20
20
|
item,
|
|
21
|
+
onClick,
|
|
21
22
|
}: {
|
|
22
23
|
item: CollapsibleNavBarGroup;
|
|
24
|
+
onClick?: () => void;
|
|
23
25
|
}) => {
|
|
24
26
|
const { iconName, iconSize, title, items, prefix, css } = item;
|
|
25
27
|
const uniqName = iconName + title.replace(' ', '').toLowerCase();
|
|
@@ -55,6 +57,7 @@ export const NavBarItemWithSubMenu = ({
|
|
|
55
57
|
accordionUniqueName={accordionUniqName}
|
|
56
58
|
prefix={prefix}
|
|
57
59
|
isPopover={false}
|
|
60
|
+
onClick={onClick}
|
|
58
61
|
{...props}
|
|
59
62
|
/>
|
|
60
63
|
)}
|
|
@@ -6,8 +6,10 @@ import * as T from './types';
|
|
|
6
6
|
|
|
7
7
|
export const NavBarItemWithoutSubMenu = ({
|
|
8
8
|
item,
|
|
9
|
+
onClick,
|
|
9
10
|
}: {
|
|
10
11
|
item: T.CollapsibleNavBarItem;
|
|
12
|
+
onClick?: () => void;
|
|
11
13
|
}) => {
|
|
12
14
|
const { path, iconName, title, iconSize, css } = item;
|
|
13
15
|
const Icon = () => (
|
|
@@ -16,7 +18,7 @@ export const NavBarItemWithoutSubMenu = ({
|
|
|
16
18
|
|
|
17
19
|
return (
|
|
18
20
|
<CollapsibleNavBarItem key={path}>
|
|
19
|
-
<CollapsibleNavBarLink to={'/' + path}>
|
|
21
|
+
<CollapsibleNavBarLink to={'/' + path} onClick={onClick}>
|
|
20
22
|
<CollapsibleNavBarPopover triggerIcon={<Icon />} title={title} />
|
|
21
23
|
<Icon />
|
|
22
24
|
<span>{title}</span>
|
|
@@ -12,15 +12,18 @@ export const PieChartLegend = ({
|
|
|
12
12
|
renderLabel,
|
|
13
13
|
renderValue,
|
|
14
14
|
markerStyles,
|
|
15
|
+
currency,
|
|
15
16
|
labelListStyles,
|
|
16
17
|
valueListStyles,
|
|
18
|
+
variant = 'valueList',
|
|
17
19
|
}: PieChartLegendProps) => {
|
|
18
20
|
const theme = useTheme();
|
|
21
|
+
const isValueList = variant === 'valueList';
|
|
19
22
|
return (
|
|
20
23
|
<Fragment>
|
|
21
24
|
<PieChartLegendList css={labelListStyles}>
|
|
22
25
|
{data.map((item, index) => {
|
|
23
|
-
const { id, label } = item;
|
|
26
|
+
const { id, label, value, legendValue } = item;
|
|
24
27
|
return (
|
|
25
28
|
<li key={`tag-${id}`}>
|
|
26
29
|
<PieChartLegendMarker
|
|
@@ -28,24 +31,44 @@ export const PieChartLegend = ({
|
|
|
28
31
|
as={'span'}
|
|
29
32
|
css={markerStyles}
|
|
30
33
|
/>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
{isValueList ? (
|
|
35
|
+
<Typography variant="h6">
|
|
36
|
+
{typeof renderLabel === 'function'
|
|
37
|
+
? renderLabel(item)
|
|
38
|
+
: label}
|
|
39
|
+
</Typography>
|
|
40
|
+
) : (
|
|
41
|
+
<Typography
|
|
42
|
+
variant="subtitle"
|
|
43
|
+
css={{
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexDirection: 'column',
|
|
46
|
+
}}>
|
|
47
|
+
<span>
|
|
48
|
+
{legendValue as React.ReactNode} {label}
|
|
49
|
+
</span>
|
|
50
|
+
<span css={{ fontWeight: '400' }}>
|
|
51
|
+
{value} {currency}
|
|
52
|
+
</span>
|
|
53
|
+
</Typography>
|
|
54
|
+
)}
|
|
34
55
|
</li>
|
|
35
56
|
);
|
|
36
57
|
})}
|
|
37
58
|
</PieChartLegendList>
|
|
38
|
-
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
59
|
+
{isValueList && (
|
|
60
|
+
<PieChartLegendList css={valueListStyles}>
|
|
61
|
+
{data.map((item) => (
|
|
62
|
+
<li key={`subtitle-${item.id}`}>
|
|
63
|
+
<Typography variant="subtitle" color={theme.colors.greyDarker60}>
|
|
64
|
+
{typeof renderValue === 'function'
|
|
65
|
+
? renderValue(item)
|
|
66
|
+
: item.value}
|
|
67
|
+
</Typography>
|
|
68
|
+
</li>
|
|
69
|
+
))}
|
|
70
|
+
</PieChartLegendList>
|
|
71
|
+
)}
|
|
49
72
|
</Fragment>
|
|
50
73
|
);
|
|
51
74
|
};
|
|
@@ -23,6 +23,8 @@ export interface PieChartLegendProps {
|
|
|
23
23
|
renderLabel?: (item: PieChartLegendItem) => NonNullable<React.ReactNode>;
|
|
24
24
|
className?: string;
|
|
25
25
|
markerStyles?: SerializedStyles;
|
|
26
|
+
currency?: string;
|
|
26
27
|
labelListStyles?: SerializedStyles;
|
|
27
28
|
valueListStyles?: SerializedStyles;
|
|
29
|
+
variant?: 'valueList' | 'withoutValueList';
|
|
28
30
|
}
|