@ssa-ui-kit/widgets 1.0.3 → 1.0.5

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 (37) hide show
  1. package/dist/components/AccountBalance/AccountBalance.d.ts +1 -1
  2. package/dist/components/AccountBalance/BalancePieChart.d.ts +1 -1
  3. package/dist/components/AccountBalance/index.d.ts +0 -1
  4. package/dist/components/AccountBalance/types.d.ts +5 -1
  5. package/dist/index.js +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/package.json +6 -6
  8. package/src/components/AccountBalance/AccountBalance.stories.tsx +6 -0
  9. package/src/components/AccountBalance/AccountBalance.tsx +30 -46
  10. package/src/components/AccountBalance/BalancePieChart.tsx +57 -23
  11. package/src/components/AccountBalance/BalancePieChartTitle.tsx +32 -23
  12. package/src/components/AccountBalance/index.ts +0 -1
  13. package/src/components/AccountBalance/types.ts +7 -2
  14. package/src/components/ExchangeAccount/ExchangeAccount.stories.tsx +2 -2
  15. package/src/components/ExchangeAccount/ExchangeAccount.tsx +17 -2
  16. package/src/components/ExchangeAccount/styles.ts +13 -31
  17. package/src/components/MealNutrients/MealNutrientsLineChart.tsx +3 -1
  18. package/tsbuildcache +1 -1
  19. package/tsconfig.build.json +2 -0
  20. package/dist/components/AccountBalance/WithLink.d.ts +0 -5
  21. package/src/components/AccountBalance/WithLink.tsx +0 -29
  22. /package/src/components/AccountBalance/{AccountBalance.spec.tsx → AccountBalance.specBackup.tsx} +0 -0
  23. /package/src/components/Activity/{Activity.spec.tsx → Activity.specBackup.tsx} +0 -0
  24. /package/src/components/Bmi/{Bmi.spec.tsx → Bmi.spec.Backup.tsx} +0 -0
  25. /package/src/components/BotsTable/{BotsTable.spec.tsx → BotsTable.specBackup.tsx} +0 -0
  26. /package/src/components/Calories/{Calories.spec.tsx → Calories.specBackup.tsx} +0 -0
  27. /package/src/components/ExchangeAccount/{ExchangeAccount.spec.tsx → ExchangeAccount.specBackup.tsx} +0 -0
  28. /package/src/components/ExchangeAccountKeys/{ExchangeAccountKeys.spec.tsx → ExchangeAccountKeys.specBackup.tsx} +0 -0
  29. /package/src/components/HeartRate/{HeartRate.spec.tsx → HeartRate.specBackup.tsx} +0 -0
  30. /package/src/components/ListGoals/{ListGoals.spec.tsx → ListGoals.specBackup.tsx} +0 -0
  31. /package/src/components/MealNutrients/{MealNutrients.spec.tsx → MealNutrients.specBackup.tsx} +0 -0
  32. /package/src/components/MealPlanner/{MealPlanner.spec.tsx → MealPlanner.specBackup.tsx} +0 -0
  33. /package/src/components/StepsCounter/{StepsCounter.spec.tsx → StepsCounter.specBackup.tsx} +0 -0
  34. /package/src/components/TradingInfoCard/{TradingInfoCard.spec.tsx → TradingInfoCard.specBackup.tsx} +0 -0
  35. /package/src/components/TradingScoreboard/{TradingScoreboard.spec.tsx → TradingScoreboard.specBackup.tsx} +0 -0
  36. /package/src/components/UpcomingWorkouts/{UpcomingWorkouts.spec.tsx → UpcomingWorkouts.specBackup.tsx} +0 -0
  37. /package/src/components/WaterConsume/{WaterConsume.spec.tsx → WaterConsume.specBackup.tsx} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssa-ui-kit/widgets",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "private": false,
@@ -29,7 +29,7 @@
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.0",
32
+ "@ssa-ui-kit/core": "^1.1.2",
33
33
  "@ssa-ui-kit/hooks": "^1.0.0",
34
34
  "@ssa-ui-kit/utils": "^1.0.0"
35
35
  },
@@ -55,10 +55,10 @@
55
55
  "@emotion/css": "^11.11.0",
56
56
  "@emotion/react": "^11.10.5",
57
57
  "@emotion/styled": "^11.10.5",
58
- "@nivo/core": "^0.83.0",
59
- "@nivo/line": "^0.83.0",
60
- "@nivo/pie": "^0.83.0",
61
- "@nivo/scales": "^0.83.0",
58
+ "@nivo/core": "^0.84.0",
59
+ "@nivo/line": "^0.84.0",
60
+ "@nivo/pie": "^0.84.0",
61
+ "@nivo/scales": "^0.84.0",
62
62
  "react": "18.x",
63
63
  "react-dom": "18.x",
64
64
  "react-hook-form": "^7.46.1",
@@ -20,6 +20,12 @@ Default.args = {
20
20
  data,
21
21
  };
22
22
 
23
+ export const WithFullscreenMode: StoryObj<typeof AccountBalance> = {};
24
+ WithFullscreenMode.args = {
25
+ ...Default.args,
26
+ fullscreenModeFeature: true,
27
+ };
28
+
23
29
  export const WithLink: StoryObj<typeof AccountBalance> = (
24
30
  args: AccountBalanceProps,
25
31
  ) => {
@@ -1,7 +1,7 @@
1
- import { css, useTheme } from '@emotion/react';
2
- import { Card, CardContent, CardHeader, Typography } from '@ssa-ui-kit/core';
1
+ import { useTheme } from '@emotion/react';
2
+ import { css } from '@emotion/css';
3
+ import { WithLink } from '@ssa-ui-kit/core';
3
4
  import { BalancePieChart } from './BalancePieChart';
4
- import { WithLink } from './WithLink';
5
5
  import { AccountBalanceProps } from './types';
6
6
 
7
7
  export const AccountBalance = ({
@@ -10,55 +10,39 @@ export const AccountBalance = ({
10
10
  onClick,
11
11
  link,
12
12
  variant = 'valueList',
13
+ fullscreenModeFeature = false,
14
+ activeHighlight = true,
13
15
  ...props
14
16
  }: AccountBalanceProps) => {
15
17
  const theme = useTheme();
16
18
 
17
19
  return (
18
20
  <WithLink link={link} onClick={onClick}>
19
- <Card
20
- className={className}
21
- onClick={link ? undefined : onClick}
22
- css={css`
23
- border-radius: 20px;
24
- padding: 5px 10px;
25
- width: 100%;
26
-
27
- ${theme.mediaQueries.md} {
28
- padding: 10px;
29
- }
30
-
31
- ${theme.mediaQueries.lg} {
32
- padding: 12px 20px 11px;
33
- }
34
-
35
- box-shadow: 0 10px 40px 0 ${theme.colors.greyShadow};
36
- `}>
37
- <CardHeader
38
- css={css`
39
- margin-bottom: 10px;
40
- `}>
41
- <Typography
42
- variant="h3"
43
- weight="bold"
44
- css={css`
45
- font-size: 16px;
46
- ${theme.mediaQueries.md} {
47
- font-size: 20px;
48
- }
49
- `}>
50
- {title}
51
- </Typography>
52
- </CardHeader>
53
- <CardContent
54
- css={css`
55
- max-width: 406px;
56
- width: 100%;
57
- display: block;
58
- `}>
59
- <BalancePieChart theme={theme} variant={variant} {...props} />
60
- </CardContent>
61
- </Card>
21
+ <BalancePieChart
22
+ theme={theme}
23
+ variant={variant}
24
+ fullscreenModeFeature={fullscreenModeFeature}
25
+ activeHighlight={activeHighlight}
26
+ pieChartProps={{
27
+ cardProps: {
28
+ title,
29
+ className,
30
+ headerClassName: css([
31
+ {
32
+ fontSize: 11,
33
+ },
34
+ ]),
35
+ contentClassName: css([
36
+ {
37
+ [theme.mediaQueries.md]: {
38
+ alignItems: 'center !important',
39
+ },
40
+ },
41
+ ]),
42
+ },
43
+ }}
44
+ {...props}
45
+ />
62
46
  </WithLink>
63
47
  );
64
48
  };
@@ -1,6 +1,11 @@
1
+ import { useState } from 'react';
1
2
  import { withTheme, css } from '@emotion/react';
2
-
3
- import { PieChart, PieChartLegend, pieChartPalettes } from '@ssa-ui-kit/core';
3
+ import {
4
+ PieChart,
5
+ PieChartFeatures,
6
+ PieChartLegend,
7
+ pieChartPalettes,
8
+ } from '@ssa-ui-kit/core';
4
9
  import { BalancePieChartTitle } from './BalancePieChartTitle';
5
10
 
6
11
  import { BalancePieChartProps } from './types';
@@ -14,13 +19,32 @@ export const BalancePieChart = withTheme(
14
19
  chartColorPalette,
15
20
  legendColorPalette,
16
21
  variant = 'valueList',
22
+ pieChartProps = {},
23
+ fullscreenModeFeature = false,
24
+ activeHighlight = false,
17
25
  }: BalancePieChartProps) => {
26
+ const [isFullscreenMode, setFullscreenMode] = useState(false);
18
27
  const { legendColorNames, pieChartColors } =
19
28
  pieChartPalettes.getBalancePalette(theme);
29
+ const featuresList = new Set<PieChartFeatures>();
30
+
31
+ if (Object.keys(pieChartProps.cardProps || {}).length) {
32
+ featuresList.add('header');
33
+ }
34
+ if (fullscreenModeFeature) {
35
+ featuresList.add('header');
36
+ featuresList.add('fullscreenMode');
37
+ }
38
+
39
+ const handleFullscreenModeChange = (pieChartFullscreenMode: boolean) => {
40
+ setFullscreenMode(pieChartFullscreenMode);
41
+ };
20
42
  return (
21
43
  <PieChart
22
44
  data={data}
45
+ features={Array.from(featuresList)}
23
46
  colors={chartColorPalette || pieChartColors}
47
+ onFullscreenModeChange={handleFullscreenModeChange}
24
48
  animate={false}
25
49
  title={
26
50
  <BalancePieChartTitle
@@ -29,51 +53,61 @@ export const BalancePieChart = withTheme(
29
53
  currency={currency}
30
54
  />
31
55
  }
32
- css={css`
33
- div:nth-of-type(1) {
34
- width: 100px;
35
- height: 100px;
36
- }
37
-
38
- ${theme.mediaQueries.lg} {
56
+ css={
57
+ !isFullscreenMode &&
58
+ css`
39
59
  div:nth-of-type(1) {
40
- width: 120px;
41
- height: 120px;
60
+ width: 100px;
61
+ height: 100px;
42
62
  }
43
- }
44
- `}>
63
+
64
+ ${theme.mediaQueries.lg} {
65
+ div:nth-of-type(1) {
66
+ width: 120px;
67
+ height: 120px;
68
+ }
69
+ }
70
+ `
71
+ }
72
+ width={'100%'}
73
+ {...pieChartProps}>
45
74
  <PieChartLegend
46
75
  data={data}
47
76
  colors={legendColorPalette || legendColorNames}
48
77
  variant={variant}
49
78
  currency={currency}
79
+ activeHighlight={activeHighlight}
50
80
  markerStyles={css`
51
81
  width: 10px;
52
82
  height: 10px;
53
83
  margin-right: 5px;
54
84
  `}
55
85
  labelListStyles={css`
56
- gap: 5px;
86
+ gap: 0;
87
+ li {
88
+ height: 22.5px;
89
+ }
57
90
  h6 {
58
91
  font-weight: 700;
59
- font-size: 12px;
92
+ line-height: 22.5px;
93
+ font-size: ${!isFullscreenMode && '12px'};
60
94
  ${theme.mediaQueries.md} {
61
- font-size: 13px;
95
+ font-size: ${!isFullscreenMode && '13px'};
62
96
  }
63
97
  ${theme.mediaQueries.lg} {
64
- font-size: 14px;
98
+ font-size: ${!isFullscreenMode && '14px'};
65
99
  }
66
100
  }
67
-
68
- ${theme.mediaQueries.lg} {
69
- margin-left: -20%;
70
- }
71
101
  `}
72
102
  valueListStyles={css`
73
- gap: 5px;
103
+ gap: 0;
104
+ li {
105
+ height: 22.5px;
106
+ }
74
107
  h6 {
108
+ line-height: 22.5px;
75
109
  color: ${theme.colors.greyDarker80};
76
- font-size: 11px;
110
+ font-size: ${isFullscreenMode ? '12px' : '11px'};
77
111
  ${theme.mediaQueries.lg} {
78
112
  font-size: 12px;
79
113
  }
@@ -1,45 +1,54 @@
1
1
  import { withTheme, css } from '@emotion/react';
2
- import { Typography } from '@ssa-ui-kit/core';
2
+ import { Typography, useFullscreenMode } from '@ssa-ui-kit/core';
3
3
  import { useTextSizeDecrease } from '@ssa-ui-kit/hooks';
4
4
  import { BalancePieChartTitleProps } from './types';
5
5
 
6
6
  export const BalancePieChartTitle = withTheme(
7
7
  ({ total, currency, theme }: BalancePieChartTitleProps) => {
8
8
  const ref = useTextSizeDecrease();
9
+ const { isFullscreenMode } = useFullscreenMode();
9
10
  return (
10
11
  <Typography
11
12
  ref={ref}
12
13
  variant="body2"
13
14
  weight="bold"
14
15
  color={theme.colors.greyDarker}
15
- css={css`
16
- font-size: 13px;
17
- padding: 0 14px;
18
- ${theme.mediaQueries.md} {
19
- font-size: 14px;
20
- }
21
- ${theme.mediaQueries.lg} {
22
- font-size: 16px;
23
- }
24
- line-height: 1;
25
- `}>
16
+ css={
17
+ isFullscreenMode
18
+ ? css`
19
+ font-size: 24px !important;
20
+ font-weight: 500;
21
+ `
22
+ : css`
23
+ font-size: 13px;
24
+ padding: 0 14px;
25
+ line-height: 1;
26
+ `
27
+ }>
26
28
  {total}
27
29
  <Typography
28
30
  variant="body2"
29
31
  weight="regular"
30
32
  as="span"
31
33
  color={theme.colors.greyDarker80}
32
- css={css`
33
- display: block;
34
- font-size: 12px;
35
- ${theme.mediaQueries.md} {
36
- font-size: 13px;
37
- }
38
- ${theme.mediaQueries.lg} {
39
- font-size: 14px;
40
- }
41
- line-height: 25px;
42
- `}>
34
+ css={
35
+ isFullscreenMode
36
+ ? css`
37
+ font-size: 18px;
38
+ margin-left: 10px;
39
+ `
40
+ : css`
41
+ display: block;
42
+ font-size: 12px;
43
+ ${theme.mediaQueries.md} {
44
+ font-size: 13px;
45
+ }
46
+ ${theme.mediaQueries.lg} {
47
+ font-size: 14px;
48
+ }
49
+ line-height: 25px;
50
+ `
51
+ }>
43
52
  {currency}
44
53
  </Typography>
45
54
  </Typography>
@@ -1,5 +1,4 @@
1
1
  export { AccountBalance } from './AccountBalance';
2
2
  export { BalancePieChart } from './BalancePieChart';
3
3
  export { BalancePieChartTitle } from './BalancePieChartTitle';
4
- export { WithLink } from './WithLink';
5
4
  export * from './types';
@@ -1,5 +1,5 @@
1
- import { MainColors, Theme } from '@ssa-ui-kit/core';
2
1
  import type { To } from 'react-router-dom';
2
+ import { MainColors, PieChartProps, Theme } from '@ssa-ui-kit/core';
3
3
 
4
4
  interface WithTheme {
5
5
  theme: Theme;
@@ -11,6 +11,7 @@ type BalanceBase = {
11
11
  legendColorPalette?: Array<keyof MainColors | string>;
12
12
  chartColorPalette?: string[];
13
13
  variant?: 'valueList' | 'withoutValueList';
14
+ fullscreenModeFeature?: boolean;
14
15
  data: Array<{
15
16
  id: string | number;
16
17
  value: number;
@@ -19,13 +20,17 @@ type BalanceBase = {
19
20
  }>;
20
21
  };
21
22
 
22
- export interface BalancePieChartProps extends WithTheme, BalanceBase {}
23
+ export interface BalancePieChartProps extends WithTheme, BalanceBase {
24
+ pieChartProps?: Partial<PieChartProps>;
25
+ activeHighlight?: boolean;
26
+ }
23
27
 
24
28
  export interface AccountBalanceProps extends BalanceBase {
25
29
  title?: string;
26
30
  className?: string;
27
31
  onClick?: () => void;
28
32
  link?: To;
33
+ activeHighlight?: boolean;
29
34
  }
30
35
 
31
36
  export type BalancePieChartTitleProps = Pick<
@@ -56,12 +56,12 @@ export const List: StoryObj<typeof ExchangeAccount> = () => {
56
56
  <div
57
57
  css={css`
58
58
  display: grid;
59
- grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
59
+ grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
60
60
  gap: 10px;
61
61
 
62
62
  ${theme.mediaQueries.md} {
63
63
  max-width: 1542px;
64
- grid-template-columns: repeat(3, minmax(200px, 1fr));
64
+ grid-template-columns: repeat(3, minmax(270px, 1fr));
65
65
  gap: 20px;
66
66
  }
67
67
  `}>
@@ -1,3 +1,4 @@
1
+ import { css } from '@emotion/css';
1
2
  import { useTheme } from '@emotion/react';
2
3
  import {
3
4
  Button,
@@ -6,8 +7,9 @@ import {
6
7
  CardHeader,
7
8
  Icon,
8
9
  Typography,
10
+ WithLink,
9
11
  } from '@ssa-ui-kit/core';
10
- import { BalancePieChart, WithLink } from '@components/AccountBalance';
12
+ import { BalancePieChart } from '@components/AccountBalance';
11
13
  import { ExchangeAccountProps } from './types';
12
14
  import * as S from './styles';
13
15
 
@@ -65,7 +67,20 @@ export const ExchangeAccount = ({
65
67
  {isActive ? status : 'Not available'}
66
68
  </Typography>
67
69
  <CardContent css={S.CardContent} direction="column">
68
- <BalancePieChart theme={theme} {...data} />
70
+ <BalancePieChart
71
+ theme={theme}
72
+ {...data}
73
+ pieChartProps={{
74
+ className: css`
75
+ ${theme.mediaQueries.md} {
76
+ flex-direction: row;
77
+ }
78
+ ${theme.mediaQueries.lg} {
79
+ flex-direction: column;
80
+ }
81
+ `,
82
+ }}
83
+ />
69
84
  </CardContent>
70
85
  </CardBase>
71
86
  </WithLink>
@@ -83,6 +83,9 @@ export const Status = (theme: Theme) => css`
83
83
  export const CardContent = (theme: Theme) => css`
84
84
  width: 100%;
85
85
  padding: 10px 20px;
86
+ & > div {
87
+ flex-direction: row;
88
+ }
86
89
 
87
90
  ul:last-child {
88
91
  li {
@@ -91,43 +94,22 @@ export const CardContent = (theme: Theme) => css`
91
94
  }
92
95
  }
93
96
 
94
- ${theme.mediaQueries.md} {
95
- > div {
96
- display: block;
97
- text-align: center;
98
-
99
- .pie-chart-wrapper {
100
- margin: 0 auto 6px;
101
- }
102
- }
103
-
104
- ul {
105
- display: inline-flex;
106
- height: auto;
97
+ ${theme.mediaQueries.sm} {
98
+ & > div {
99
+ justify-content: space-around;
107
100
  }
101
+ }
108
102
 
109
- ul:last-child {
110
- margin-left: 30px;
103
+ ${theme.mediaQueries.md} {
104
+ justify-content: space-around;
105
+ & > div {
106
+ flex-direction: column;
111
107
  }
112
108
  }
113
109
 
114
110
  ${theme.mediaQueries.lg} {
115
- > div {
116
- display: flex;
117
- justify-content: space-around;
118
-
119
- .pie-chart-wrapper {
120
- margin: 0 10px 0 0;
121
- }
122
- }
123
-
124
- ul {
125
- display: flex;
126
- margin-left: 0;
127
- }
128
-
129
- ul:last-child {
130
- margin-left: 10px;
111
+ & > div {
112
+ flex-direction: row;
131
113
  }
132
114
  }
133
115
  `;
@@ -55,7 +55,9 @@ export const MealNutrientsLineChart = ({ data, ...props }: LineSvgProps) => {
55
55
  strokeDasharray: '8 8',
56
56
  },
57
57
  },
58
- fontFamily: "'Manrope', sans-serif",
58
+ text: {
59
+ fontFamily: "'Manrope', sans-serif",
60
+ },
59
61
  },
60
62
  },
61
63
  ),