@ssa-ui-kit/widgets 0.0.19-alpha → 0.0.21-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.
Files changed (43) hide show
  1. package/custom-shots/widgets-bots-table--no-control-orders--menu-opened_[w1920px].png +0 -0
  2. package/custom-shots/widgets-bots-table--no-control-orders--run-reason-modal_[w1920px].png +0 -0
  3. package/custom-shots/widgets-collapsiblenavbar-opened__[w1439px].png +0 -0
  4. package/custom-shots/widgets-collapsiblenavbar-opened__[w1439px]_statistics_submenu_popover.png +0 -0
  5. package/custom-shots/widgets-collapsiblenavbar-opened__[w1920px].png +0 -0
  6. package/custom-shots/widgets-collapsiblenavbar-opened__[w1920px]_side_menu_expanded.png +0 -0
  7. package/custom-shots/widgets-collapsiblenavbar-opened__[w1920px]_statistics_submenu_expanded.png +0 -0
  8. package/custom-shots/widgets-collapsiblenavbar-opened__[w1920px]_statistics_submenu_popover.png +0 -0
  9. package/custom-shots/widgets-collapsiblenavbar-opened__[w899px]_menu_opened.png +0 -0
  10. package/custom-shots/widgets-collapsiblenavbar-opened__[w899px]_statistics_submenu.png +0 -0
  11. package/custom-shots/widgets-filters--default__[w1920px].png +0 -0
  12. package/custom-shots/widgets-filters--more-button-items-selected__[w390px].png +0 -0
  13. package/custom-shots/widgets-linkstabbar--current-focus__[w1920px].png +0 -0
  14. package/custom-shots/widgets-meal-nutrients--hint-opened__[w1440px].png +0 -0
  15. package/custom-shots/widgets-meal-nutrients--hint-opened__[w1920px].png +0 -0
  16. package/custom-shots/widgets-meal-nutrients--hint-opened__[w900px].png +0 -0
  17. package/custom-shots/widgets-meal-nutrients--hint-opened__dropdown__[w390px].png +0 -0
  18. package/custom-shots/widgets-notification-menu--is-opened__[w1920px].png +0 -0
  19. package/custom-shots/widgets-notification-menu--is-opened__[w900px].png +0 -0
  20. package/custom-shots/widgets-searchbox--cross-icon__[w900px].png +0 -0
  21. package/custom-shots/widgets-searchbox--search-icon__[w900px].png +0 -0
  22. package/custom-shots/widgets-table-filters--opened__[w1920px].png +0 -0
  23. package/custom-shots/widgets-trading-info-card--hover__[w1920px].png +0 -0
  24. package/custom-shots/widgets-user-profile--is-opened__[w1920px].png +0 -0
  25. package/dist/components/CollapsibleNavBar/TriggerIcon.d.ts +4 -2
  26. package/dist/components/CollapsibleNavBar/stories/CustomIcon.d.ts +1 -0
  27. package/dist/components/CollapsibleNavBar/types.d.ts +2 -1
  28. package/dist/components/NavBar/types.d.ts +3 -0
  29. package/dist/components/TradingInfoCard/TradingInfoCard.d.ts +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/index.js.map +1 -1
  32. package/package.json +4 -4
  33. package/src/components/CollapsibleNavBar/NavBarItemWithSubMenu.tsx +2 -2
  34. package/src/components/CollapsibleNavBar/NavBarItemWithoutSubMenu.tsx +7 -2
  35. package/src/components/CollapsibleNavBar/TriggerIcon.tsx +17 -7
  36. package/src/components/CollapsibleNavBar/stories/CollapsibleNavBar.stories.tsx +20 -0
  37. package/src/components/CollapsibleNavBar/stories/CustomIcon.tsx +20 -0
  38. package/src/components/CollapsibleNavBar/types.ts +2 -1
  39. package/src/components/NavBar/types.ts +3 -0
  40. package/src/components/TradingInfoCard/TradingInfoCard.stories.tsx +1 -1
  41. package/src/components/TradingInfoCard/TradingInfoCard.tsx +24 -18
  42. package/src/components/TradingScoreboard/helpers.tsx +1 -1
  43. package/tsbuildcache +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssa-ui-kit/widgets",
3
- "version": "0.0.19-alpha",
3
+ "version": "0.0.21-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.14-alpha",
33
- "@ssa-ui-kit/hooks": "^0.0.1-alpha",
34
- "@ssa-ui-kit/utils": "^0.0.1-alpha"
32
+ "@ssa-ui-kit/core": "^0.0.19-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%",
@@ -23,7 +23,7 @@ export const NavBarItemWithSubMenu = ({
23
23
  item: CollapsibleNavBarGroup;
24
24
  onClick?: () => void;
25
25
  }) => {
26
- const { iconName, iconSize, title, items, prefix, css } = item;
26
+ const { iconName, iconSize, title, items, prefix, css, CustomIcon } = item;
27
27
  const uniqName = iconName + title.replace(' ', '').toLowerCase();
28
28
  const accordionUniqName = uniqName + 'accordion';
29
29
  const match = useMatch(prefix + ':id');
@@ -81,7 +81,7 @@ export const NavBarItemWithSubMenu = ({
81
81
  </Link>
82
82
 
83
83
  <Link to="" className={`icon-wrapper${match ? ' active' : ''}`}>
84
- <Icon />
84
+ {CustomIcon ? <CustomIcon /> : <Icon />}
85
85
  <AccordionTitle {...data} css={S.AccordionTitle} />
86
86
  </Link>
87
87
  </Wrapper>
@@ -11,9 +11,14 @@ export const NavBarItemWithoutSubMenu = ({
11
11
  item: T.CollapsibleNavBarItem;
12
12
  onClick?: () => void;
13
13
  }) => {
14
- const { path, iconName, title, iconSize, css } = item;
14
+ const { path, iconName, title, iconSize, css, CustomIcon } = item;
15
15
  const Icon = () => (
16
- <TriggerIcon iconName={iconName} iconSize={iconSize} css={{ ...css }} />
16
+ <TriggerIcon
17
+ iconName={iconName}
18
+ iconSize={iconSize}
19
+ CustomIcon={CustomIcon}
20
+ css={{ ...css }}
21
+ />
17
22
  );
18
23
 
19
24
  return (
@@ -1,14 +1,16 @@
1
1
  import { css, useTheme } from '@emotion/react';
2
- import { Wrapper, Icon, IMapIcons } from '@ssa-ui-kit/core';
2
+ import { Wrapper, Icon, IMapIcons, SVGProps } from '@ssa-ui-kit/core';
3
3
 
4
4
  export const TriggerIcon = ({
5
5
  iconName,
6
6
  iconSize,
7
7
  className,
8
+ CustomIcon,
8
9
  }: {
9
10
  iconName: keyof IMapIcons;
10
11
  iconSize?: number;
11
12
  className?: string;
13
+ CustomIcon?: (props: Omit<SVGProps, 'fill'>) => JSX.Element;
12
14
  }) => {
13
15
  const theme = useTheme();
14
16
  return (
@@ -22,12 +24,20 @@ export const TriggerIcon = ({
22
24
  height: 26px;
23
25
  `}
24
26
  className="trigger-icon">
25
- <Icon
26
- name={iconName}
27
- color={theme.colors.grey}
28
- size={iconSize}
29
- className={className}
30
- />
27
+ {CustomIcon ? (
28
+ <CustomIcon
29
+ size={iconSize}
30
+ className={className}
31
+ color={theme.colors.grey}
32
+ />
33
+ ) : (
34
+ <Icon
35
+ name={iconName}
36
+ color={theme.colors.grey}
37
+ size={iconSize}
38
+ className={className}
39
+ />
40
+ )}
31
41
  </Wrapper>
32
42
  );
33
43
  };
@@ -8,6 +8,7 @@ import { CollapsibleNavBar } from '../CollapsibleNavBar';
8
8
  import { ITEMS } from './consts';
9
9
  import { Logo } from './Logo';
10
10
  import { Layout } from './Layout';
11
+ import { CustomIcon } from './CustomIcon';
11
12
 
12
13
  type Args = Parameters<typeof CollapsibleNavBar>[0];
13
14
 
@@ -51,3 +52,22 @@ export default {
51
52
  } as Meta<typeof CollapsibleNavBar>;
52
53
 
53
54
  export const Default = {};
55
+
56
+ export const WithCustomIcon = {
57
+ title: 'With Custom Icon',
58
+ component: CollapsibleNavBar,
59
+ parameters: {
60
+ layout: 'fullscreen',
61
+ },
62
+ args: {
63
+ items: [
64
+ ...ITEMS,
65
+ {
66
+ path: 'custom',
67
+ CustomIcon,
68
+ title: 'Item with custom icon',
69
+ },
70
+ ],
71
+ renderLogo: <Logo />,
72
+ },
73
+ } as Meta<typeof CollapsibleNavBar>;
@@ -0,0 +1,20 @@
1
+ export const CustomIcon = () => {
2
+ const size = 24;
3
+ const fill = 'rgb(195, 197, 204)';
4
+ const props = {};
5
+ return (
6
+ <svg
7
+ className="svg-icon"
8
+ width={size}
9
+ height={size}
10
+ viewBox="0 0 1024 1024"
11
+ version="1.1"
12
+ xmlns="http://www.w3.org/2000/svg"
13
+ {...props}>
14
+ <path
15
+ d="M708.76 993.953333a53.366667 53.366667 0 0 1-46.28-26.666666L532.1 741.466667l-154.666667 148.586666A21.333333 21.333333 0 0 1 341.333333 874.666667V192a21.333333 21.333333 0 0 1 6.706667-15.526667c5.333333-5.02 15.26-8.74 25.72-2.666666l91.946667 53.086666 498.833333 288a21.333333 21.333333 0 0 1-4.733333 38.966667l-206 59.64 130.386666 225.826667a53.333333 53.333333 0 0 1-19.526666 72.826666l-129.333334 74.666667a53.02 53.02 0 0 1-26.573333 7.133333z m-171.806667-308.073333a20.666667 20.666667 0 0 1 3 0.213333 21.333333 21.333333 0 0 1 15.48 10.453334l144 249.413333a10.666667 10.666667 0 0 0 14.566667 3.906667l129.333333-74.666667a10.666667 10.666667 0 0 0 3.906667-14.573333l-144-249.413334a21.333333 21.333333 0 0 1 12.546667-31.16l184.053333-53.286666L384 228.953333v595.633334l138.18-132.76a21.333333 21.333333 0 0 1 14.773333-5.946667zM298.666667 661.333333a21.333333 21.333333 0 0 0-21.333334-21.333333H96a10.666667 10.666667 0 0 1-10.666667-10.666667V96a10.666667 10.666667 0 0 1 10.666667-10.666667h746.666667a10.666667 10.666667 0 0 1 10.666666 10.666667v266.666667a21.333333 21.333333 0 0 0 42.666667 0V96a53.393333 53.393333 0 0 0-53.333333-53.333333H96a53.393333 53.393333 0 0 0-53.333333 53.333333v533.333333a53.393333 53.393333 0 0 0 53.333333 53.333334h181.333333a21.333333 21.333333 0 0 0 21.333334-21.333334z"
16
+ fill={fill}
17
+ />
18
+ </svg>
19
+ );
20
+ };
@@ -5,9 +5,10 @@ export interface CollapsibleNavBarItem extends NavBarExtendedItem {
5
5
  css?: React.CSSProperties;
6
6
  }
7
7
 
8
- export interface CollapsibleNavBarGroup extends Required<NavBarExtendedGroup> {
8
+ export interface CollapsibleNavBarGroup extends NavBarExtendedGroup {
9
9
  iconSize: number;
10
10
  css?: React.CSSProperties;
11
+ prefix: string;
11
12
  }
12
13
 
13
14
  export interface CollapsibleNavBarExtendedProps {
@@ -1,3 +1,4 @@
1
+ import { EmotionJSX } from '@emotion/react/types/jsx-namespace';
1
2
  import { IMapIcons } from '@ssa-ui-kit/core';
2
3
 
3
4
  export interface INavBarProps {
@@ -5,12 +6,14 @@ export interface INavBarProps {
5
6
  }
6
7
 
7
8
  export type NavBarExtendedItem = {
9
+ CustomIcon?: () => EmotionJSX.Element;
8
10
  path: string;
9
11
  iconName: keyof IMapIcons;
10
12
  title: string;
11
13
  };
12
14
 
13
15
  export type NavBarExtendedGroup = {
16
+ CustomIcon?: () => EmotionJSX.Element;
14
17
  prefix?: string;
15
18
  iconName: keyof IMapIcons;
16
19
  title: string;
@@ -24,7 +24,7 @@ export const Default: StoryObj<typeof TradingInfoCard> = (
24
24
  };
25
25
 
26
26
  Default.args = {
27
- value: '500',
27
+ value: 500.55,
28
28
  unit: 'USD',
29
29
  title: 'Turnover',
30
30
  };
@@ -5,34 +5,24 @@ import TradingInfoCardTooltip from './TradingInfoCardTooltip';
5
5
  import TradingInfoCardWrapper from './TradingInfoCardWrapper';
6
6
  import { ITradingInfoCardProps } from './types';
7
7
 
8
- const TradingInfoCard = ({
8
+ const TradingInfoCardView = ({
9
9
  value,
10
10
  unit,
11
11
  title,
12
- onClick,
13
12
  icon,
14
13
  link,
14
+ onClick,
15
15
  }: ITradingInfoCardProps) => {
16
16
  const number = Number(value);
17
- const isInteger = Number.isInteger(number);
18
- const currentValue = Number.isNaN(number) ? value : Math.floor(number);
17
+ const currentValue = Number.isNaN(number)
18
+ ? value
19
+ : number.toFixed(1).includes('.0')
20
+ ? Math.floor(number)
21
+ : number.toFixed(1);
19
22
 
20
23
  return (
21
24
  <TradingInfoCardWrapper onClick={onClick} link={link}>
22
- {isInteger || Number.isNaN(number) ? (
23
- <TradingInfoCardContent value={currentValue} unit={unit} icon={icon} />
24
- ) : (
25
- <TradingInfoCardTooltip
26
- trigger={
27
- <TradingInfoCardContent
28
- value={currentValue}
29
- unit={unit}
30
- icon={icon}
31
- />
32
- }>
33
- {value} {unit}
34
- </TradingInfoCardTooltip>
35
- )}
25
+ <TradingInfoCardContent value={currentValue} unit={unit} icon={icon} />
36
26
  <CardContent>
37
27
  <Typography css={{ fontSize: '12px' }}>{title}</Typography>
38
28
  </CardContent>
@@ -40,4 +30,20 @@ const TradingInfoCard = ({
40
30
  );
41
31
  };
42
32
 
33
+ const TradingInfoCard = (props: ITradingInfoCardProps) => {
34
+ const { value, unit } = props;
35
+ const number = Number(value);
36
+ const isInteger = Number.isInteger(number);
37
+
38
+ if (isInteger || Number.isNaN(number)) {
39
+ return <TradingInfoCardView {...props} />;
40
+ } else {
41
+ return (
42
+ <TradingInfoCardTooltip trigger={<TradingInfoCardView {...props} />}>
43
+ {value} {unit}
44
+ </TradingInfoCardTooltip>
45
+ );
46
+ }
47
+ };
48
+
43
49
  export default TradingInfoCard;
@@ -68,7 +68,7 @@ export const oneLineBoardArr = [
68
68
  title: 'Orders',
69
69
  },
70
70
  {
71
- value: '500.025',
71
+ value: '500.125',
72
72
  unit: 'USD',
73
73
  title: 'Turnover',
74
74
  },