@astral/ui 1.50.0 → 1.50.1

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 (39) hide show
  1. package/ListItem/ListItem.d.ts +1 -1
  2. package/ListItem/ListItem.js +1 -13
  3. package/MenuGroup/MenuGroup.d.ts +8 -2
  4. package/MenuGroup/MenuGroup.js +2 -2
  5. package/MenuGroup/stories/styled.d.ts +1 -1
  6. package/MenuGroup/stories/styled.js +2 -2
  7. package/MenuGroup/styles.d.ts +8 -0
  8. package/MenuGroup/{styled.js → styles.js} +10 -5
  9. package/ProductSwitcher/ProductSwitcher.js +1 -1
  10. package/ProductSwitcher/ProductSwitcher.stories.js +8 -1
  11. package/ProductSwitcher/ProductSwitcherContent/ProductSwitcherContent.js +7 -5
  12. package/ProductSwitcher/ProductSwitcherContent/styles.d.ts +6 -30
  13. package/ProductSwitcher/ProductSwitcherContent/styles.js +13 -6
  14. package/ProductSwitcher/styles.d.ts +0 -5
  15. package/ProductSwitcher/styles.js +9 -13
  16. package/ProductSwitcher/types.d.ts +1 -0
  17. package/esm/ListItem/ListItem.d.ts +1 -1
  18. package/esm/ListItem/ListItem.js +1 -13
  19. package/esm/MenuGroup/MenuGroup.d.ts +8 -2
  20. package/esm/MenuGroup/MenuGroup.js +2 -2
  21. package/esm/MenuGroup/stories/styled.d.ts +1 -1
  22. package/esm/MenuGroup/stories/styled.js +2 -2
  23. package/esm/MenuGroup/styles.d.ts +8 -0
  24. package/esm/MenuGroup/{styled.js → styles.js} +9 -4
  25. package/esm/ProductSwitcher/ProductSwitcher.js +2 -2
  26. package/esm/ProductSwitcher/ProductSwitcher.stories.js +8 -1
  27. package/esm/ProductSwitcher/ProductSwitcherContent/ProductSwitcherContent.js +8 -6
  28. package/esm/ProductSwitcher/ProductSwitcherContent/styles.d.ts +6 -30
  29. package/esm/ProductSwitcher/ProductSwitcherContent/styles.js +12 -5
  30. package/esm/ProductSwitcher/styles.d.ts +0 -5
  31. package/esm/ProductSwitcher/styles.js +8 -12
  32. package/esm/ProductSwitcher/types.d.ts +1 -0
  33. package/package.json +2 -2
  34. package/MenuGroup/styled.d.ts +0 -8
  35. package/MenuGroup/types.d.ts +0 -8
  36. package/MenuGroup/types.js +0 -2
  37. package/esm/MenuGroup/styled.d.ts +0 -8
  38. package/esm/MenuGroup/types.d.ts +0 -8
  39. package/esm/MenuGroup/types.js +0 -1
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { ListItemProps } from './types';
3
- export declare const ListItem: ({ ...props }: ListItemProps) => JSX.Element;
3
+ export declare const ListItem: (props: ListItemProps) => JSX.Element;
@@ -1,21 +1,9 @@
1
1
  "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
3
  exports.ListItem = void 0;
15
4
  const jsx_runtime_1 = require("react/jsx-runtime");
16
5
  const styles_1 = require("./styles");
17
- const ListItem = (_a) => {
18
- var props = __rest(_a, []);
6
+ const ListItem = (props) => {
19
7
  return (0, jsx_runtime_1.jsx)(styles_1.StyledListItem, Object.assign({}, props));
20
8
  };
21
9
  exports.ListItem = ListItem;
@@ -1,3 +1,9 @@
1
- /// <reference types="react" />
2
- import { MenuGroupProps } from './types';
1
+ import { ReactNode } from 'react';
2
+ export type MenuGroupProps = {
3
+ children: ReactNode;
4
+ /**
5
+ * Заголовок группы
6
+ */
7
+ label: string;
8
+ };
3
9
  export declare const MenuGroup: (props: MenuGroupProps) => JSX.Element;
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MenuGroup = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const styled_1 = require("./styled");
6
+ const styles_1 = require("./styles");
7
7
  const MenuGroup = (props) => {
8
8
  const { children, label } = props;
9
9
  const upperCasedLabel = (0, react_1.useMemo)(() => label.toUpperCase(), [label]);
10
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(styled_1.StyledLabel, Object.assign({ variant: "h7" }, { children: upperCasedLabel })), (0, jsx_runtime_1.jsx)(styled_1.StyledContentWrapper, { children: children })] }));
10
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(styles_1.MenuGroupLabel, Object.assign({ component: "li", variant: "h7" }, { children: upperCasedLabel })), (0, jsx_runtime_1.jsx)(styles_1.MenuGroupContent, { children: (0, jsx_runtime_1.jsx)("ul", { children: children }) })] }));
11
11
  };
12
12
  exports.MenuGroup = MenuGroup;
@@ -35,4 +35,4 @@ export declare const StyledLabel: import("@emotion/styled").StyledComponent<Pick
35
35
  export declare const StyledMenuWrapper: import("@emotion/styled").StyledComponent<{
36
36
  theme?: import("@emotion/react").Theme | undefined;
37
37
  as?: import("react").ElementType<any> | undefined;
38
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
38
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
@@ -10,6 +10,6 @@ exports.StyledMenuItem = (0, styles_1.styled)(MenuItem_1.MenuItem) `
10
10
  exports.StyledLabel = (0, styles_1.styled)(Typography_1.Typography) `
11
11
  font-size: ${({ theme }) => theme.typography.h5.fontSize};
12
12
  `;
13
- exports.StyledMenuWrapper = styles_1.styled.div `
14
- padding-top: ${({ theme }) => theme.spacing(2)};
13
+ exports.StyledMenuWrapper = styles_1.styled.ul `
14
+ padding: ${({ theme }) => theme.spacing(2, 0, 0, 0)};
15
15
  `;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export declare const MenuGroupLabel: import("@emotion/styled").StyledComponent<Pick<import("react").PropsWithChildren<import("../Typography").TypographyProps>, string | number | symbol> & import("react").RefAttributes<HTMLElement> & {
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ }, {}, {}>;
5
+ export declare const MenuGroupContent: import("@emotion/styled").StyledComponent<{
6
+ theme?: import("@emotion/react").Theme | undefined;
7
+ as?: import("react").ElementType<any> | undefined;
8
+ }, import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
@@ -1,17 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StyledContentWrapper = exports.StyledLabel = void 0;
3
+ exports.MenuGroupContent = exports.MenuGroupLabel = void 0;
4
4
  const styles_1 = require("../styles");
5
5
  const Typography_1 = require("../Typography");
6
- exports.StyledLabel = (0, styles_1.styled)(Typography_1.Typography) `
6
+ exports.MenuGroupLabel = (0, styles_1.styled)(Typography_1.Typography) `
7
7
  display: block;
8
+ width: 100%;
8
9
  padding: ${({ theme }) => theme.spacing(2, 4)};
9
10
 
10
11
  color: ${({ theme }) => theme.palette.grey[700]};
11
12
  line-height: ${({ theme }) => theme.typography.pxToRem(16)};
12
13
  `;
13
- exports.StyledContentWrapper = styles_1.styled.div `
14
- & > li {
15
- padding-left: ${({ theme }) => theme.spacing(7)};
14
+ exports.MenuGroupContent = styles_1.styled.li `
15
+ width: 100%;
16
+
17
+ & ul {
18
+ padding: 0;
19
+
20
+ list-style: none;
16
21
  }
17
22
  `;
@@ -41,6 +41,6 @@ const ProductSwitcher = ({ getProducts }) => {
41
41
  }
42
42
  }
43
43
  });
44
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(IconButton_1.IconButton, Object.assign({ ref: anchorRef, selected: open, variant: "text", onClick: handleShowProducts }, { children: (0, jsx_runtime_1.jsx)(icons_1.ProductsFillMd, {}) })), (0, jsx_runtime_1.jsx)(styles_1.WidgetMenu, Object.assign({ open: open, anchorEl: anchorRef.current, onClose: handleCloseMenu }, { children: (0, jsx_runtime_1.jsx)(styles_1.ContentWrapper, { children: (0, jsx_runtime_1.jsx)(ProductSwitcherContent_1.ProductSwitcherContent, { isLoading: isLoading, isError: isError, products: products }) }) }))] }));
44
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(IconButton_1.IconButton, Object.assign({ ref: anchorRef, selected: open, variant: "text", onClick: handleShowProducts }, { children: (0, jsx_runtime_1.jsx)(icons_1.ProductsFillMd, {}) })), (0, jsx_runtime_1.jsx)(styles_1.WidgetMenu, Object.assign({ open: open, anchorEl: anchorRef.current, onClose: handleCloseMenu }, { children: (0, jsx_runtime_1.jsx)(ProductSwitcherContent_1.ProductSwitcherContent, { isLoading: isLoading, isError: isError, products: products }) }))] }));
45
45
  };
46
46
  exports.ProductSwitcher = ProductSwitcher;
@@ -20,42 +20,49 @@ exports.handleReject = handleReject;
20
20
  const handleGetProducts = () => {
21
21
  return new Promise((resolve) => setTimeout(() => resolve([
22
22
  {
23
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff53b1',
23
24
  url: '',
24
25
  name: 'Астрал.Отчет',
25
26
  logoUrl: 'https://identity.astral.ru/api/Files/06a5fb56-210c-4f08-bb7b-253a9103560f',
26
27
  color: '#2d77ff',
27
28
  },
28
29
  {
30
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff532',
29
31
  url: '',
30
32
  name: 'Астрал.ЭДО',
31
33
  logoUrl: 'https://identity.astral.ru/api/Files/b5b06b5a-2d0e-491b-9815-043d82f104aa',
32
34
  color: 'rgb(117 90 253)',
33
35
  },
34
36
  {
37
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff533',
35
38
  url: '',
36
39
  name: 'Астрал.КЭДО',
37
40
  logoUrl: 'https://identity.astral.ru/api/Files/f0519e97-7a50-4796-a8d2-877cd15c7668',
38
41
  color: 'rgb(117 90 253)',
39
42
  },
40
43
  {
41
- url: '',
44
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff534',
45
+ url: 'https://ofd.astralnalog.ru/lk',
42
46
  name: 'Астрал.ОФД',
43
47
  logoUrl: 'https://identity.astral.ru/api/Files/f0519e97-7a50-4796-a8d2-877cd15c7668',
44
48
  color: 'rgb(117 90 253)',
45
49
  },
46
50
  {
51
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff535',
47
52
  url: '',
48
53
  name: 'Астрал.ЭТ',
49
54
  logoUrl: 'https://identity.astral.ru/api/Files/ac497150-1926-47be-9e5f-42e739e7279c',
50
55
  color: 'rgb(55 103 152)',
51
56
  },
52
57
  {
58
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff536',
53
59
  url: '',
54
60
  name: 'Личный кабинет',
55
61
  logoUrl: 'https://identity.astral.ru/api/Files/9d214f12-c518-44e2-a711-fa1bf2b89fdd',
56
62
  color: 'rgb(10, 124, 255)',
57
63
  },
58
64
  {
65
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff537',
59
66
  url: '',
60
67
  name: 'Кабинет партнера',
61
68
  logoUrl: 'https://identity.astral.ru/api/Files/f0519e97-7a50-4796-a8d2-877cd15c7668',
@@ -2,16 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProductSwitcherContent = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const icons_1 = require("@astral/icons");
5
6
  const ContentState_1 = require("../../ContentState");
7
+ const MenuGroup_1 = require("../../MenuGroup");
8
+ const Typography_1 = require("../../Typography");
6
9
  const styles_1 = require("./styles");
7
10
  const ProductSwitcherContent = ({ isLoading, isError, products = [], }) => {
8
11
  return ((0, jsx_runtime_1.jsx)(ContentState_1.ContentState, Object.assign({ isLoading: isLoading, isCustom: isError, customState: {
9
12
  imgAlt: 'Что-то пошло не так',
10
- title: 'Что-то пошло не так',
13
+ title: ((0, jsx_runtime_1.jsxs)(styles_1.TitleErrorContainer, Object.assign({ container: true, autoFlow: "column", alignItems: "center", justifyContent: "center", component: "span" }, { children: [(0, jsx_runtime_1.jsx)(icons_1.ErrorFillSm, { color: "inherit" }), (0, jsx_runtime_1.jsx)(Typography_1.Typography, Object.assign({ variant: "h6", color: "grey", colorIntensity: 900 }, { children: "\u0427\u0442\u043E-\u0442\u043E \u043F\u043E\u0448\u043B\u043E \u043D\u0435 \u0442\u0430\u043A" }))] }))),
11
14
  description: 'Произошла ошибка. Повторите попытку позже.',
12
- // TODO: imgSrc обязательный параметр, а в title не засунуть текст с иконкой. Соответствующая доработка в задаче:
13
- // https://astraltrack.atlassian.net/jira/software/c/projects/UIKIT/boards/142?modal=detail&selectedIssue=UIKIT-435
14
- imgSrc: '',
15
- } }, { children: products.map((product) => ((0, jsx_runtime_1.jsxs)(styles_1.ProductItem, Object.assign({}, product, { children: [(0, jsx_runtime_1.jsx)(styles_1.Logo, { src: product.logoUrl, color: product.color }), product.name] }), product.name))) })));
15
+ } }, { children: (0, jsx_runtime_1.jsx)(MenuGroup_1.MenuGroup, Object.assign({ label: "\u041F\u0440\u043E\u0434\u0443\u043A\u0442\u044B \u044D\u043A\u043E\u0441\u0438\u0441\u0442\u0435\u043C\u044B" }, { children: products.map((product) => {
16
+ return ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsxs)(styles_1.ProductItem, Object.assign({ component: "a", href: product.url }, { children: [(0, jsx_runtime_1.jsx)(styles_1.Logo, { src: product.logoUrl, color: product.color }), (0, jsx_runtime_1.jsx)(Typography_1.Typography, Object.assign({ variant: "ui", color: "grey", colorIntensity: 900 }, { children: product.name }))] })) }, product.id));
17
+ }) })) })));
16
18
  };
17
19
  exports.ProductSwitcherContent = ProductSwitcherContent;
@@ -1,35 +1,11 @@
1
1
  /// <reference types="react" />
2
- export declare const ProductItem: import("@emotion/styled").StyledComponent<{
3
- autoFocus?: boolean | undefined;
4
- classes?: Partial<import("@mui/material").MenuItemClasses> | undefined;
5
- dense?: boolean | undefined;
6
- disabled?: boolean | undefined;
7
- disableGutters?: boolean | undefined;
8
- divider?: boolean | undefined;
9
- selected?: boolean | undefined;
10
- sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
11
- } & Omit<{
12
- action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
13
- centerRipple?: boolean | undefined;
14
- children?: import("react").ReactNode;
15
- classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
16
- disabled?: boolean | undefined;
17
- disableRipple?: boolean | undefined;
18
- disableTouchRipple?: boolean | undefined;
19
- focusRipple?: boolean | undefined;
20
- focusVisibleClassName?: string | undefined;
21
- LinkComponent?: import("react").ElementType<any> | undefined;
22
- onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
23
- sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
24
- tabIndex?: number | undefined;
25
- TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
26
- touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
27
- }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "css" | "key" | keyof import("react").LiHTMLAttributes<HTMLLIElement>> & {
28
- ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
29
- }, "disabled" | "action" | "divider" | "sx" | "onFocusVisible" | "tabIndex" | "children" | "autoFocus" | "selected" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef" | "dense" | "disableGutters"> & {
30
- theme?: import("@emotion/react").Theme | undefined;
31
- }, {}, {}>;
2
+ export declare const ProductItem: import("@mui/material").ExtendButtonBase<import("@mui/material").MenuItemTypeMap<{}, "li">>;
32
3
  export declare const Logo: import("@emotion/styled").StyledComponent<{
33
4
  theme?: import("@emotion/react").Theme | undefined;
34
5
  as?: import("react").ElementType<any> | undefined;
35
6
  }, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
7
+ export declare const TitleErrorContainer: import("@emotion/styled").StyledComponent<import("../../Grid").GridContainerProps & import("../../Grid").GridElementsProps & {
8
+ children?: import("react").ReactNode;
9
+ } & import("react").RefAttributes<HTMLElement> & {
10
+ theme?: import("@emotion/react").Theme | undefined;
11
+ }, {}, {}>;
@@ -1,18 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Logo = exports.ProductItem = void 0;
3
+ exports.TitleErrorContainer = exports.Logo = exports.ProductItem = void 0;
4
4
  const styles_1 = require("../../styles");
5
5
  const MenuItem_1 = require("../../MenuItem");
6
+ const Grid_1 = require("../../Grid");
7
+ // as typeof MenuItem необходим для возможности прокинуть component
8
+ // https://github.com/mui/material-ui/issues/15695
6
9
  exports.ProductItem = (0, styles_1.styled)(MenuItem_1.MenuItem) `
7
- width: 100%;
8
-
9
- border-radius: ${({ theme }) => theme.shape.small};
10
+ padding-left: ${({ theme }) => theme.spacing(6)};
10
11
  `;
11
- exports.Logo = styles_1.styled.img `
12
+ exports.Logo = (0, styles_1.styled)('img', {
13
+ shouldForwardProp: (prop) => prop !== 'color',
14
+ }) `
12
15
  width: 40px;
13
16
  height: 40px;
14
- margin-right: ${({ theme }) => theme.spacing(2)};
17
+ margin-right: ${({ theme }) => theme.spacing(4)};
15
18
 
16
19
  background-color: ${({ color }) => color};
17
20
  border-radius: ${({ theme }) => theme.shape.small};
18
21
  `;
22
+ exports.TitleErrorContainer = (0, styles_1.styled)(Grid_1.Grid) `
23
+ color: ${({ theme }) => theme.palette.error.dark};
24
+ column-gap: ${({ theme }) => theme.spacing(2)};
25
+ `;
@@ -1,8 +1,3 @@
1
- /// <reference types="react" />
2
- export declare const ContentWrapper: import("@emotion/styled").StyledComponent<{
3
- theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any> | undefined;
5
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
1
  export declare const WidgetMenu: import("@emotion/styled").StyledComponent<import("../Menu").MenuProps & {
7
2
  theme?: import("@emotion/react").Theme | undefined;
8
3
  }, {}, {}>;
@@ -1,20 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WidgetMenu = exports.ContentWrapper = void 0;
3
+ exports.WidgetMenu = void 0;
4
4
  const styles_1 = require("../styles");
5
5
  const Menu_1 = require("../Menu");
6
- exports.ContentWrapper = styles_1.styled.div `
7
- display: flex;
8
- flex-direction: column;
9
- align-items: center;
10
- justify-content: center;
11
- min-width: 240px;
12
- max-width: 280px;
13
- min-height: 150px;
14
- padding: ${({ theme }) => theme.spacing(2)};
15
- `;
16
6
  exports.WidgetMenu = (0, styles_1.styled)(Menu_1.Menu) `
17
- .MuiList-root {
18
- padding: 0;
7
+ .MuiPaper-root > .MuiList-root {
8
+ display: flex;
9
+ flex-direction: column;
10
+ align-items: center;
11
+ justify-content: center;
12
+ width: 285px;
13
+ min-height: 124px;
14
+ padding: ${({ theme }) => theme.spacing(3, 0)};
19
15
  }
20
16
  `;
@@ -1,4 +1,5 @@
1
1
  export type WidgetProduct = {
2
+ id: string;
2
3
  url: string;
3
4
  name: string;
4
5
  logoUrl: string;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { ListItemProps } from './types';
3
- export declare const ListItem: ({ ...props }: ListItemProps) => JSX.Element;
3
+ export declare const ListItem: (props: ListItemProps) => JSX.Element;
@@ -1,17 +1,5 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
1
  import { jsx as _jsx } from "react/jsx-runtime";
13
2
  import { StyledListItem } from './styles';
14
- export const ListItem = (_a) => {
15
- var props = __rest(_a, []);
3
+ export const ListItem = (props) => {
16
4
  return _jsx(StyledListItem, Object.assign({}, props));
17
5
  };
@@ -1,3 +1,9 @@
1
- /// <reference types="react" />
2
- import { MenuGroupProps } from './types';
1
+ import { ReactNode } from 'react';
2
+ export type MenuGroupProps = {
3
+ children: ReactNode;
4
+ /**
5
+ * Заголовок группы
6
+ */
7
+ label: string;
8
+ };
3
9
  export declare const MenuGroup: (props: MenuGroupProps) => JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
- import { StyledContentWrapper, StyledLabel } from './styled';
3
+ import { MenuGroupContent, MenuGroupLabel } from './styles';
4
4
  export const MenuGroup = (props) => {
5
5
  const { children, label } = props;
6
6
  const upperCasedLabel = useMemo(() => label.toUpperCase(), [label]);
7
- return (_jsxs(_Fragment, { children: [_jsx(StyledLabel, Object.assign({ variant: "h7" }, { children: upperCasedLabel })), _jsx(StyledContentWrapper, { children: children })] }));
7
+ return (_jsxs(_Fragment, { children: [_jsx(MenuGroupLabel, Object.assign({ component: "li", variant: "h7" }, { children: upperCasedLabel })), _jsx(MenuGroupContent, { children: _jsx("ul", { children: children }) })] }));
8
8
  };
@@ -35,4 +35,4 @@ export declare const StyledLabel: import("@emotion/styled").StyledComponent<Pick
35
35
  export declare const StyledMenuWrapper: import("@emotion/styled").StyledComponent<{
36
36
  theme?: import("@emotion/react").Theme | undefined;
37
37
  as?: import("react").ElementType<any> | undefined;
38
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
38
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
@@ -7,6 +7,6 @@ export const StyledMenuItem = styled(MenuItem) `
7
7
  export const StyledLabel = styled(Typography) `
8
8
  font-size: ${({ theme }) => theme.typography.h5.fontSize};
9
9
  `;
10
- export const StyledMenuWrapper = styled.div `
11
- padding-top: ${({ theme }) => theme.spacing(2)};
10
+ export const StyledMenuWrapper = styled.ul `
11
+ padding: ${({ theme }) => theme.spacing(2, 0, 0, 0)};
12
12
  `;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export declare const MenuGroupLabel: import("@emotion/styled").StyledComponent<Pick<import("react").PropsWithChildren<import("../Typography").TypographyProps>, string | number | symbol> & import("react").RefAttributes<HTMLElement> & {
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ }, {}, {}>;
5
+ export declare const MenuGroupContent: import("@emotion/styled").StyledComponent<{
6
+ theme?: import("@emotion/react").Theme | undefined;
7
+ as?: import("react").ElementType<any> | undefined;
8
+ }, import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
@@ -1,14 +1,19 @@
1
1
  import { styled } from '../styles';
2
2
  import { Typography } from '../Typography';
3
- export const StyledLabel = styled(Typography) `
3
+ export const MenuGroupLabel = styled(Typography) `
4
4
  display: block;
5
+ width: 100%;
5
6
  padding: ${({ theme }) => theme.spacing(2, 4)};
6
7
 
7
8
  color: ${({ theme }) => theme.palette.grey[700]};
8
9
  line-height: ${({ theme }) => theme.typography.pxToRem(16)};
9
10
  `;
10
- export const StyledContentWrapper = styled.div `
11
- & > li {
12
- padding-left: ${({ theme }) => theme.spacing(7)};
11
+ export const MenuGroupContent = styled.li `
12
+ width: 100%;
13
+
14
+ & ul {
15
+ padding: 0;
16
+
17
+ list-style: none;
13
18
  }
14
19
  `;
@@ -14,7 +14,7 @@ import { ConfigContext } from '../ConfigProvider';
14
14
  import { IconButton } from '../IconButton';
15
15
  import { useMenu } from '../hooks';
16
16
  import { ProductSwitcherContent } from './ProductSwitcherContent';
17
- import { ContentWrapper, WidgetMenu } from './styles';
17
+ import { WidgetMenu } from './styles';
18
18
  export const ProductSwitcher = ({ getProducts }) => {
19
19
  const [products, setProducts] = useState([]);
20
20
  const [isLoading, setIsLoading] = useState(false);
@@ -38,5 +38,5 @@ export const ProductSwitcher = ({ getProducts }) => {
38
38
  }
39
39
  }
40
40
  });
41
- return (_jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ ref: anchorRef, selected: open, variant: "text", onClick: handleShowProducts }, { children: _jsx(ProductsFillMd, {}) })), _jsx(WidgetMenu, Object.assign({ open: open, anchorEl: anchorRef.current, onClose: handleCloseMenu }, { children: _jsx(ContentWrapper, { children: _jsx(ProductSwitcherContent, { isLoading: isLoading, isError: isError, products: products }) }) }))] }));
41
+ return (_jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ ref: anchorRef, selected: open, variant: "text", onClick: handleShowProducts }, { children: _jsx(ProductsFillMd, {}) })), _jsx(WidgetMenu, Object.assign({ open: open, anchorEl: anchorRef.current, onClose: handleCloseMenu }, { children: _jsx(ProductSwitcherContent, { isLoading: isLoading, isError: isError, products: products }) }))] }));
42
42
  };
@@ -16,42 +16,49 @@ export const handleReject = () => {
16
16
  export const handleGetProducts = () => {
17
17
  return new Promise((resolve) => setTimeout(() => resolve([
18
18
  {
19
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff53b1',
19
20
  url: '',
20
21
  name: 'Астрал.Отчет',
21
22
  logoUrl: 'https://identity.astral.ru/api/Files/06a5fb56-210c-4f08-bb7b-253a9103560f',
22
23
  color: '#2d77ff',
23
24
  },
24
25
  {
26
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff532',
25
27
  url: '',
26
28
  name: 'Астрал.ЭДО',
27
29
  logoUrl: 'https://identity.astral.ru/api/Files/b5b06b5a-2d0e-491b-9815-043d82f104aa',
28
30
  color: 'rgb(117 90 253)',
29
31
  },
30
32
  {
33
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff533',
31
34
  url: '',
32
35
  name: 'Астрал.КЭДО',
33
36
  logoUrl: 'https://identity.astral.ru/api/Files/f0519e97-7a50-4796-a8d2-877cd15c7668',
34
37
  color: 'rgb(117 90 253)',
35
38
  },
36
39
  {
37
- url: '',
40
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff534',
41
+ url: 'https://ofd.astralnalog.ru/lk',
38
42
  name: 'Астрал.ОФД',
39
43
  logoUrl: 'https://identity.astral.ru/api/Files/f0519e97-7a50-4796-a8d2-877cd15c7668',
40
44
  color: 'rgb(117 90 253)',
41
45
  },
42
46
  {
47
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff535',
43
48
  url: '',
44
49
  name: 'Астрал.ЭТ',
45
50
  logoUrl: 'https://identity.astral.ru/api/Files/ac497150-1926-47be-9e5f-42e739e7279c',
46
51
  color: 'rgb(55 103 152)',
47
52
  },
48
53
  {
54
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff536',
49
55
  url: '',
50
56
  name: 'Личный кабинет',
51
57
  logoUrl: 'https://identity.astral.ru/api/Files/9d214f12-c518-44e2-a711-fa1bf2b89fdd',
52
58
  color: 'rgb(10, 124, 255)',
53
59
  },
54
60
  {
61
+ id: '49d3ce2a-d57c-4794-b659-f80e31ff537',
55
62
  url: '',
56
63
  name: 'Кабинет партнера',
57
64
  logoUrl: 'https://identity.astral.ru/api/Files/f0519e97-7a50-4796-a8d2-877cd15c7668',
@@ -1,13 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ErrorFillSm } from '@astral/icons';
2
3
  import { ContentState } from '../../ContentState';
3
- import { Logo, ProductItem } from './styles';
4
+ import { MenuGroup } from '../../MenuGroup';
5
+ import { Typography } from '../../Typography';
6
+ import { Logo, ProductItem, TitleErrorContainer } from './styles';
4
7
  export const ProductSwitcherContent = ({ isLoading, isError, products = [], }) => {
5
8
  return (_jsx(ContentState, Object.assign({ isLoading: isLoading, isCustom: isError, customState: {
6
9
  imgAlt: 'Что-то пошло не так',
7
- title: 'Что-то пошло не так',
10
+ title: (_jsxs(TitleErrorContainer, Object.assign({ container: true, autoFlow: "column", alignItems: "center", justifyContent: "center", component: "span" }, { children: [_jsx(ErrorFillSm, { color: "inherit" }), _jsx(Typography, Object.assign({ variant: "h6", color: "grey", colorIntensity: 900 }, { children: "\u0427\u0442\u043E-\u0442\u043E \u043F\u043E\u0448\u043B\u043E \u043D\u0435 \u0442\u0430\u043A" }))] }))),
8
11
  description: 'Произошла ошибка. Повторите попытку позже.',
9
- // TODO: imgSrc обязательный параметр, а в title не засунуть текст с иконкой. Соответствующая доработка в задаче:
10
- // https://astraltrack.atlassian.net/jira/software/c/projects/UIKIT/boards/142?modal=detail&selectedIssue=UIKIT-435
11
- imgSrc: '',
12
- } }, { children: products.map((product) => (_jsxs(ProductItem, Object.assign({}, product, { children: [_jsx(Logo, { src: product.logoUrl, color: product.color }), product.name] }), product.name))) })));
12
+ } }, { children: _jsx(MenuGroup, Object.assign({ label: "\u041F\u0440\u043E\u0434\u0443\u043A\u0442\u044B \u044D\u043A\u043E\u0441\u0438\u0441\u0442\u0435\u043C\u044B" }, { children: products.map((product) => {
13
+ return (_jsx("li", { children: _jsxs(ProductItem, Object.assign({ component: "a", href: product.url }, { children: [_jsx(Logo, { src: product.logoUrl, color: product.color }), _jsx(Typography, Object.assign({ variant: "ui", color: "grey", colorIntensity: 900 }, { children: product.name }))] })) }, product.id));
14
+ }) })) })));
13
15
  };
@@ -1,35 +1,11 @@
1
1
  /// <reference types="react" />
2
- export declare const ProductItem: import("@emotion/styled").StyledComponent<{
3
- autoFocus?: boolean | undefined;
4
- classes?: Partial<import("@mui/material").MenuItemClasses> | undefined;
5
- dense?: boolean | undefined;
6
- disabled?: boolean | undefined;
7
- disableGutters?: boolean | undefined;
8
- divider?: boolean | undefined;
9
- selected?: boolean | undefined;
10
- sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
11
- } & Omit<{
12
- action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
13
- centerRipple?: boolean | undefined;
14
- children?: import("react").ReactNode;
15
- classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
16
- disabled?: boolean | undefined;
17
- disableRipple?: boolean | undefined;
18
- disableTouchRipple?: boolean | undefined;
19
- focusRipple?: boolean | undefined;
20
- focusVisibleClassName?: string | undefined;
21
- LinkComponent?: import("react").ElementType<any> | undefined;
22
- onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
23
- sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
24
- tabIndex?: number | undefined;
25
- TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
26
- touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
27
- }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "css" | "key" | keyof import("react").LiHTMLAttributes<HTMLLIElement>> & {
28
- ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
29
- }, "disabled" | "action" | "divider" | "sx" | "onFocusVisible" | "tabIndex" | "children" | "autoFocus" | "selected" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef" | "dense" | "disableGutters"> & {
30
- theme?: import("@emotion/react").Theme | undefined;
31
- }, {}, {}>;
2
+ export declare const ProductItem: import("@mui/material").ExtendButtonBase<import("@mui/material").MenuItemTypeMap<{}, "li">>;
32
3
  export declare const Logo: import("@emotion/styled").StyledComponent<{
33
4
  theme?: import("@emotion/react").Theme | undefined;
34
5
  as?: import("react").ElementType<any> | undefined;
35
6
  }, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
7
+ export declare const TitleErrorContainer: import("@emotion/styled").StyledComponent<import("../../Grid").GridContainerProps & import("../../Grid").GridElementsProps & {
8
+ children?: import("react").ReactNode;
9
+ } & import("react").RefAttributes<HTMLElement> & {
10
+ theme?: import("@emotion/react").Theme | undefined;
11
+ }, {}, {}>;
@@ -1,15 +1,22 @@
1
1
  import { styled } from '../../styles';
2
2
  import { MenuItem } from '../../MenuItem';
3
+ import { Grid } from '../../Grid';
4
+ // as typeof MenuItem необходим для возможности прокинуть component
5
+ // https://github.com/mui/material-ui/issues/15695
3
6
  export const ProductItem = styled(MenuItem) `
4
- width: 100%;
5
-
6
- border-radius: ${({ theme }) => theme.shape.small};
7
+ padding-left: ${({ theme }) => theme.spacing(6)};
7
8
  `;
8
- export const Logo = styled.img `
9
+ export const Logo = styled('img', {
10
+ shouldForwardProp: (prop) => prop !== 'color',
11
+ }) `
9
12
  width: 40px;
10
13
  height: 40px;
11
- margin-right: ${({ theme }) => theme.spacing(2)};
14
+ margin-right: ${({ theme }) => theme.spacing(4)};
12
15
 
13
16
  background-color: ${({ color }) => color};
14
17
  border-radius: ${({ theme }) => theme.shape.small};
15
18
  `;
19
+ export const TitleErrorContainer = styled(Grid) `
20
+ color: ${({ theme }) => theme.palette.error.dark};
21
+ column-gap: ${({ theme }) => theme.spacing(2)};
22
+ `;
@@ -1,8 +1,3 @@
1
- /// <reference types="react" />
2
- export declare const ContentWrapper: import("@emotion/styled").StyledComponent<{
3
- theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any> | undefined;
5
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
1
  export declare const WidgetMenu: import("@emotion/styled").StyledComponent<import("../Menu").MenuProps & {
7
2
  theme?: import("@emotion/react").Theme | undefined;
8
3
  }, {}, {}>;
@@ -1,17 +1,13 @@
1
1
  import { styled } from '../styles';
2
2
  import { Menu } from '../Menu';
3
- export const ContentWrapper = styled.div `
4
- display: flex;
5
- flex-direction: column;
6
- align-items: center;
7
- justify-content: center;
8
- min-width: 240px;
9
- max-width: 280px;
10
- min-height: 150px;
11
- padding: ${({ theme }) => theme.spacing(2)};
12
- `;
13
3
  export const WidgetMenu = styled(Menu) `
14
- .MuiList-root {
15
- padding: 0;
4
+ .MuiPaper-root > .MuiList-root {
5
+ display: flex;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ justify-content: center;
9
+ width: 285px;
10
+ min-height: 124px;
11
+ padding: ${({ theme }) => theme.spacing(3, 0)};
16
12
  }
17
13
  `;
@@ -1,4 +1,5 @@
1
1
  export type WidgetProduct = {
2
+ id: string;
2
3
  url: string;
3
4
  name: string;
4
5
  logoUrl: string;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "1.50.0",
3
+ "version": "1.50.1",
4
4
  "browser": "./esm/index.js",
5
5
  "main": "./index.js",
6
6
  "dependencies": {
7
- "@astral/icons": "^1.50.0",
7
+ "@astral/icons": "^1.50.1",
8
8
  "@emotion/cache": "11.7.1",
9
9
  "@emotion/react": "11.9.0",
10
10
  "@emotion/server": "11.4.0",
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const StyledLabel: import("@emotion/styled").StyledComponent<Pick<import("react").PropsWithChildren<import("../Typography").TypographyProps>, string | number | symbol> & import("react").RefAttributes<HTMLElement> & {
3
- theme?: import("@emotion/react").Theme | undefined;
4
- }, {}, {}>;
5
- export declare const StyledContentWrapper: import("@emotion/styled").StyledComponent<{
6
- theme?: import("@emotion/react").Theme | undefined;
7
- as?: import("react").ElementType<any> | undefined;
8
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,8 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export type MenuGroupProps = {
3
- children: ReactNode;
4
- /**
5
- * Заголовок группы
6
- */
7
- label: string;
8
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const StyledLabel: import("@emotion/styled").StyledComponent<Pick<import("react").PropsWithChildren<import("../Typography").TypographyProps>, string | number | symbol> & import("react").RefAttributes<HTMLElement> & {
3
- theme?: import("@emotion/react").Theme | undefined;
4
- }, {}, {}>;
5
- export declare const StyledContentWrapper: import("@emotion/styled").StyledComponent<{
6
- theme?: import("@emotion/react").Theme | undefined;
7
- as?: import("react").ElementType<any> | undefined;
8
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,8 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export type MenuGroupProps = {
3
- children: ReactNode;
4
- /**
5
- * Заголовок группы
6
- */
7
- label: string;
8
- };
@@ -1 +0,0 @@
1
- export {};