@astral/ui 1.50.0 → 1.51.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 (107) hide show
  1. package/BackdropStack/hooks/useBackdropStackToggle/useBackdropStackToggle.d.ts +2 -2
  2. package/BackdropStack/services/BackdropStackManager/BackdropStackManager.d.ts +30 -2
  3. package/BackdropStack/services/BackdropStackManager/BackdropStackManager.js +35 -3
  4. package/Button/styles.d.ts +1 -1
  5. package/ClickAwayListener/ClickAwayListener.d.ts +9 -0
  6. package/ClickAwayListener/ClickAwayListener.js +14 -0
  7. package/{esm/MenuGroup/types.js → ClickAwayListener/ClickAwayListener.test.d.ts} +0 -0
  8. package/ClickAwayListener/ClickAwayListener.test.js +37 -0
  9. package/ClickAwayListener/index.d.ts +1 -0
  10. package/{DatePicker/DatePickerClickAwayListener → ClickAwayListener}/index.js +1 -1
  11. package/DataGrid/DataGridNoData/styles.d.ts +1 -1
  12. package/DatePicker/DatePicker.d.ts +5 -3
  13. package/DatePicker/DatePicker.js +3 -3
  14. package/DatePicker/DatePicker.test.js +6 -0
  15. package/DatePicker/DatePickerPopper/DatePickerPopper.d.ts +2 -2
  16. package/Fab/styles.d.ts +1 -1
  17. package/IconButton/styles.d.ts +1 -1
  18. package/ListItem/ListItem.d.ts +1 -1
  19. package/ListItem/ListItem.js +1 -13
  20. package/MenuGroup/MenuGroup.d.ts +8 -2
  21. package/MenuGroup/MenuGroup.js +2 -2
  22. package/MenuGroup/stories/styled.d.ts +1 -1
  23. package/MenuGroup/stories/styled.js +2 -2
  24. package/MenuGroup/styles.d.ts +8 -0
  25. package/MenuGroup/{styled.js → styles.js} +10 -5
  26. package/ProductSwitcher/ProductSwitcher.js +1 -1
  27. package/ProductSwitcher/ProductSwitcher.stories.js +8 -1
  28. package/ProductSwitcher/ProductSwitcherContent/ProductSwitcherContent.js +7 -5
  29. package/ProductSwitcher/ProductSwitcherContent/styles.d.ts +6 -30
  30. package/ProductSwitcher/ProductSwitcherContent/styles.js +13 -6
  31. package/ProductSwitcher/styles.d.ts +0 -5
  32. package/ProductSwitcher/styles.js +9 -13
  33. package/ProductSwitcher/types.d.ts +1 -0
  34. package/SwipeableDrawer/styles.d.ts +1 -1
  35. package/Tooltip/styled.d.ts +1 -1
  36. package/esm/BackdropStack/hooks/useBackdropStackToggle/useBackdropStackToggle.d.ts +2 -2
  37. package/esm/BackdropStack/services/BackdropStackManager/BackdropStackManager.d.ts +30 -2
  38. package/esm/BackdropStack/services/BackdropStackManager/BackdropStackManager.js +35 -3
  39. package/esm/Button/styles.d.ts +1 -1
  40. package/esm/ClickAwayListener/ClickAwayListener.d.ts +9 -0
  41. package/esm/ClickAwayListener/ClickAwayListener.js +10 -0
  42. package/esm/ClickAwayListener/ClickAwayListener.test.d.ts +1 -0
  43. package/esm/ClickAwayListener/ClickAwayListener.test.js +35 -0
  44. package/esm/ClickAwayListener/index.d.ts +1 -0
  45. package/esm/ClickAwayListener/index.js +1 -0
  46. package/esm/DataGrid/DataGridNoData/styles.d.ts +1 -1
  47. package/esm/DatePicker/DatePicker.d.ts +5 -3
  48. package/esm/DatePicker/DatePicker.js +3 -3
  49. package/esm/DatePicker/DatePicker.test.js +6 -0
  50. package/esm/DatePicker/DatePickerPopper/DatePickerPopper.d.ts +2 -2
  51. package/esm/Fab/styles.d.ts +1 -1
  52. package/esm/IconButton/styles.d.ts +1 -1
  53. package/esm/ListItem/ListItem.d.ts +1 -1
  54. package/esm/ListItem/ListItem.js +1 -13
  55. package/esm/MenuGroup/MenuGroup.d.ts +8 -2
  56. package/esm/MenuGroup/MenuGroup.js +2 -2
  57. package/esm/MenuGroup/stories/styled.d.ts +1 -1
  58. package/esm/MenuGroup/stories/styled.js +2 -2
  59. package/esm/MenuGroup/styles.d.ts +8 -0
  60. package/esm/MenuGroup/{styled.js → styles.js} +9 -4
  61. package/esm/ProductSwitcher/ProductSwitcher.js +2 -2
  62. package/esm/ProductSwitcher/ProductSwitcher.stories.js +8 -1
  63. package/esm/ProductSwitcher/ProductSwitcherContent/ProductSwitcherContent.js +8 -6
  64. package/esm/ProductSwitcher/ProductSwitcherContent/styles.d.ts +6 -30
  65. package/esm/ProductSwitcher/ProductSwitcherContent/styles.js +12 -5
  66. package/esm/ProductSwitcher/styles.d.ts +0 -5
  67. package/esm/ProductSwitcher/styles.js +8 -12
  68. package/esm/ProductSwitcher/types.d.ts +1 -0
  69. package/esm/SwipeableDrawer/styles.d.ts +1 -1
  70. package/esm/Tooltip/styled.d.ts +1 -1
  71. package/esm/hooks/index.d.ts +2 -0
  72. package/esm/hooks/index.js +2 -0
  73. package/esm/hooks/useClickAwayEffect/index.d.ts +1 -0
  74. package/esm/hooks/useClickAwayEffect/index.js +1 -0
  75. package/esm/hooks/useClickAwayEffect/useClickAwayEffect.d.ts +25 -0
  76. package/esm/hooks/useClickAwayEffect/useClickAwayEffect.js +26 -0
  77. package/esm/hooks/useClickAwayEffect/useClickAwayEffect.test.d.ts +1 -0
  78. package/esm/hooks/useClickAwayEffect/useClickAwayEffect.test.js +42 -0
  79. package/esm/hooks/useEscapeClickEffect/useEscapeClickEffect.d.ts +2 -2
  80. package/esm/index.d.ts +2 -0
  81. package/esm/index.js +2 -0
  82. package/esm/types.d.ts +5 -1
  83. package/hooks/index.d.ts +2 -0
  84. package/hooks/index.js +2 -0
  85. package/hooks/useClickAwayEffect/index.d.ts +1 -0
  86. package/hooks/useClickAwayEffect/index.js +17 -0
  87. package/hooks/useClickAwayEffect/useClickAwayEffect.d.ts +25 -0
  88. package/hooks/useClickAwayEffect/useClickAwayEffect.js +30 -0
  89. package/hooks/useClickAwayEffect/useClickAwayEffect.test.d.ts +1 -0
  90. package/hooks/useClickAwayEffect/useClickAwayEffect.test.js +44 -0
  91. package/hooks/useEscapeClickEffect/useEscapeClickEffect.d.ts +2 -2
  92. package/index.d.ts +2 -0
  93. package/index.js +2 -0
  94. package/package.json +2 -2
  95. package/types.d.ts +5 -1
  96. package/DatePicker/DatePickerClickAwayListener/DatePickerClickAwayListener.d.ts +0 -6
  97. package/DatePicker/DatePickerClickAwayListener/DatePickerClickAwayListener.js +0 -7
  98. package/DatePicker/DatePickerClickAwayListener/index.d.ts +0 -1
  99. package/MenuGroup/styled.d.ts +0 -8
  100. package/MenuGroup/types.d.ts +0 -8
  101. package/MenuGroup/types.js +0 -2
  102. package/esm/DatePicker/DatePickerClickAwayListener/DatePickerClickAwayListener.d.ts +0 -6
  103. package/esm/DatePicker/DatePickerClickAwayListener/DatePickerClickAwayListener.js +0 -3
  104. package/esm/DatePicker/DatePickerClickAwayListener/index.d.ts +0 -1
  105. package/esm/DatePicker/DatePickerClickAwayListener/index.js +0 -1
  106. package/esm/MenuGroup/styled.d.ts +0 -8
  107. package/esm/MenuGroup/types.d.ts +0 -8
@@ -1,5 +1,5 @@
1
1
  import { SyntheticEvent } from 'react';
2
- import { Reason } from '../../../types';
2
+ import { CloseEventReason } from '../../../types';
3
3
  /**
4
4
  * @description необязательные настройки для использоввания хука
5
5
  */
@@ -23,7 +23,7 @@ type ReturnElements = {
23
23
  /**
24
24
  * @description метод вызываемый при закрытии элемента, внутри него определяется состояние isOpened
25
25
  */
26
- handleClose: (event?: SyntheticEvent<Element, Event> | Event | {}, reason?: Reason) => void;
26
+ handleClose: (event?: SyntheticEvent<Element, Event> | Event | {}, reason?: CloseEventReason) => void;
27
27
  };
28
28
  type UseBackdropStackToggleFunc = (options?: Options) => ReturnElements;
29
29
  /**
@@ -1,15 +1,43 @@
1
- import { Reason } from '../../../types';
1
+ import { CloseEventReason } from '../../../types';
2
+ /**
3
+ * @description айдишка модалки/поппера/тултипа
4
+ */
2
5
  type PopId = string;
3
6
  declare class BackdropStackManager {
4
7
  private stack;
8
+ /**
9
+ * @description сохраняем информацию о том какой был предыдущий вызов pop,
10
+ * нужен для предотвращения синхронного закрытия при последовательности 'blur' и 'backdropClick' в рамках одного клика
11
+ */
5
12
  private previousPopInfo;
13
+ /**
14
+ * @description крайняя айдишка клика по странице
15
+ */
6
16
  private currentPointerId;
7
17
  constructor();
18
+ /**
19
+ * @description метод проверки на конфликт причины закрытия с предыдущим
20
+ */
8
21
  private checkOn;
22
+ /**
23
+ * @description метод генерации случайной айдишки
24
+ */
9
25
  generateID: () => string;
26
+ /**
27
+ * @description форс метод для удалении подписанного компонента из очереди,
28
+ * может быть полезно при массовом анмаунте компонентов
29
+ */
10
30
  remove: (id: PopId) => void;
31
+ /**
32
+ * @description метод добавления в стек
33
+ */
11
34
  push: (id: PopId) => void;
12
- pop: (id: PopId, reason?: Reason) => boolean;
35
+ /**
36
+ * @description метод для запроса на выход из очереди,
37
+ * если все ок, то вернется true, что означает разрешение на выход и компонент будет вычеркнут из очереди,
38
+ * соответственно возврат false означает запрет, и компонент остается в очереди
39
+ */
40
+ pop: (id: PopId, reason?: CloseEventReason) => boolean;
13
41
  }
14
42
  export declare const backdropStackManager: BackdropStackManager;
15
43
  export {};
@@ -1,29 +1,61 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.backdropStackManager = void 0;
4
+ /**
5
+ * @description расширяемый набор конфликтующих причин закрытия с кликом по бэкдропу модалки,
6
+ * т.к. некоторые способы закрытия вызываются раньше, чем вызов backdropClick,
7
+ * а при несоблюдении последовательности возникают конфликты
8
+ */
9
+ const backdropConflictsReasons = new Set([
10
+ 'blur',
11
+ 'clickAway',
12
+ ]);
4
13
  class BackdropStackManager {
5
14
  constructor() {
6
15
  var _a;
7
16
  this.stack = [];
8
- // сохраняем информацию о том какой был предыдущий вызов pop,
9
- // нужен для предотвращения синхронного закрытия при последовательности 'blur' и 'backdropClick' в рамках одного клика
17
+ /**
18
+ * @description сохраняем информацию о том какой был предыдущий вызов pop,
19
+ * нужен для предотвращения синхронного закрытия при последовательности 'blur' и 'backdropClick' в рамках одного клика
20
+ */
10
21
  this.previousPopInfo = [null, null];
22
+ /**
23
+ * @description крайняя айдишка клика по странице
24
+ */
11
25
  this.currentPointerId = null;
26
+ /**
27
+ * @description метод проверки на конфликт причины закрытия с предыдущим
28
+ */
12
29
  this.checkOn = (reason) => {
13
30
  const [previousReason, previousPointerId] = this.previousPopInfo;
14
31
  return (reason === 'backdropClick' &&
15
- previousReason === 'blur' &&
32
+ backdropConflictsReasons.has(previousReason) &&
16
33
  previousPointerId === this.currentPointerId);
17
34
  };
35
+ /**
36
+ * @description метод генерации случайной айдишки
37
+ */
18
38
  this.generateID = () => {
19
39
  return String(Math.random());
20
40
  };
41
+ /**
42
+ * @description форс метод для удалении подписанного компонента из очереди,
43
+ * может быть полезно при массовом анмаунте компонентов
44
+ */
21
45
  this.remove = (id) => {
22
46
  this.stack = this.stack.filter((item) => item !== id);
23
47
  };
48
+ /**
49
+ * @description метод добавления в стек
50
+ */
24
51
  this.push = (id) => {
25
52
  this.stack.push(id);
26
53
  };
54
+ /**
55
+ * @description метод для запроса на выход из очереди,
56
+ * если все ок, то вернется true, что означает разрешение на выход и компонент будет вычеркнут из очереди,
57
+ * соответственно возврат false означает запрет, и компонент остается в очереди
58
+ */
27
59
  this.pop = (id, reason) => {
28
60
  if (this.checkOn(reason)) {
29
61
  return false;
@@ -64,7 +64,7 @@ export declare const LoadingButtonWrapper: import("@emotion/styled").StyledCompo
64
64
  ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
65
65
  }, "disabled" | "action" | "color" | "sx" | "href" | "onFocusVisible" | "tabIndex" | "children" | "variant" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "startIcon" | "loading" | "loadingIndicator" | "loadingPosition"> & {
66
66
  theme?: import("@emotion/react").Theme | undefined;
67
- } & Omit<import("../types").WithoutEmotionSpecific<import("@mui/lab").LoadingButtonProps<"button", {}>>, "color" | "variant"> & {
67
+ } & Omit<import("..").WithoutEmotionSpecific<import("@mui/lab").LoadingButtonProps<"button", {}>>, "color" | "variant"> & {
68
68
  variant?: "link" | "light" | "text" | "contained" | undefined;
69
69
  color?: "primary" | "error" | "warning" | "success" | undefined;
70
70
  component?: import("react").ElementType<any> | undefined;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { UseClickAwayListenerOptions } from '../hooks';
3
+ export type ClickAwayListenerProps = Omit<UseClickAwayListenerOptions, 'ref'> & {
4
+ children: JSX.Element;
5
+ };
6
+ /**
7
+ * @description компонент предоставляющий обертку для работы с хуком useClickAwayEffect
8
+ */
9
+ export declare const ClickAwayListener: ({ onClickAway, preventBubbling, isActive, children, }: ClickAwayListenerProps) => import("react").FunctionComponentElement<any>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClickAwayListener = void 0;
4
+ const react_1 = require("react");
5
+ const hooks_1 = require("../hooks");
6
+ /**
7
+ * @description компонент предоставляющий обертку для работы с хуком useClickAwayEffect
8
+ */
9
+ const ClickAwayListener = ({ onClickAway, preventBubbling, isActive, children, }) => {
10
+ const ref = (0, react_1.useRef)(null);
11
+ (0, hooks_1.useClickAwayEffect)({ ref, onClickAway, preventBubbling, isActive });
12
+ return react_1.Children.only((0, react_1.cloneElement)(children, { ref }));
13
+ };
14
+ exports.ClickAwayListener = ClickAwayListener;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const jsx_runtime_1 = require("react/jsx-runtime");
13
+ const tests_1 = require("@astral/tests");
14
+ const vitest_1 = require("vitest");
15
+ const ClickAwayListener_1 = require("./ClickAwayListener");
16
+ describe('ClickAwayListener', () => {
17
+ it('Props:isActive=true: при клике внутри onClickAway не вызывается', () => __awaiter(void 0, void 0, void 0, function* () {
18
+ const onClickAway = vitest_1.vi.fn();
19
+ (0, tests_1.renderWithTheme)((0, jsx_runtime_1.jsx)(ClickAwayListener_1.ClickAwayListener, Object.assign({ onClickAway: onClickAway, isActive: true }, { children: (0, jsx_runtime_1.jsx)("div", { children: "Lorem" }) })));
20
+ const div = tests_1.screen.getByText('Lorem');
21
+ yield tests_1.userEvents.click(div);
22
+ expect(onClickAway).toBeCalledTimes(0);
23
+ }));
24
+ it('Props:isActive=false: при клике внутри onClickAway не вызывается', () => __awaiter(void 0, void 0, void 0, function* () {
25
+ const onClickAway = vitest_1.vi.fn();
26
+ (0, tests_1.renderWithTheme)((0, jsx_runtime_1.jsx)(ClickAwayListener_1.ClickAwayListener, Object.assign({ onClickAway: onClickAway, isActive: false }, { children: (0, jsx_runtime_1.jsx)("div", { children: "Lorem" }) })));
27
+ const div = tests_1.screen.getByText('Lorem');
28
+ yield tests_1.userEvents.click(div);
29
+ expect(onClickAway).toBeCalledTimes(0);
30
+ }));
31
+ it('Props:isActive=true: при клике снаружи, onClickAway вызывается', () => __awaiter(void 0, void 0, void 0, function* () {
32
+ const onClickAway = vitest_1.vi.fn();
33
+ (0, tests_1.renderWithTheme)((0, jsx_runtime_1.jsx)(ClickAwayListener_1.ClickAwayListener, Object.assign({ onClickAway: onClickAway, isActive: true }, { children: (0, jsx_runtime_1.jsx)("div", { children: "Lorem" }) })));
34
+ yield tests_1.userEvents.click(document.body);
35
+ expect(onClickAway).toBeCalledTimes(1);
36
+ }));
37
+ });
@@ -0,0 +1 @@
1
+ export * from './ClickAwayListener';
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./DatePickerClickAwayListener"), exports);
17
+ __exportStar(require("./ClickAwayListener"), exports);
@@ -16,7 +16,7 @@ export declare const DataGridNoDataIcon: import("@emotion/styled").StyledCompone
16
16
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
17
17
  export declare const DataGridNoDataFigcaption: import("@emotion/styled").StyledComponent<Pick<import("react").PropsWithChildren<TypographyProps>, string | number | symbol> & import("react").RefAttributes<HTMLElement> & {
18
18
  theme?: import("@emotion/react").Theme | undefined;
19
- } & Omit<import("@mui/material/OverridableComponent").OverrideProps<import("../../types").WithoutEmotionSpecific<import("@mui/material").TypographyTypeMap<{}, "span">>, import("react").ElementType<any>>, "color" | "variant"> & {
19
+ } & Omit<import("@mui/material/OverridableComponent").OverrideProps<import("../..").WithoutEmotionSpecific<import("@mui/material").TypographyTypeMap<{}, "span">>, import("react").ElementType<any>>, "color" | "variant"> & {
20
20
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
21
21
  component?: import("react").ElementType<any> | undefined;
22
22
  color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
@@ -1,7 +1,7 @@
1
1
  import { SyntheticEvent } from 'react';
2
2
  import { TextFieldProps } from '../TextField';
3
3
  import { DateMask } from '../utils/date';
4
- import { Reason } from '../types';
4
+ import { CloseEventReason } from '../types';
5
5
  import { MinMaxDate } from './types';
6
6
  import { MondayFirst } from './DayPicker';
7
7
  export type DatePickerProps = MondayFirst & Partial<MinMaxDate> & {
@@ -16,13 +16,14 @@ export type DatePickerProps = MondayFirst & Partial<MinMaxDate> & {
16
16
  onChange?: (date?: Date) => void;
17
17
  onBlur?: () => void;
18
18
  onOpen?: () => void;
19
- onClose?: (event?: SyntheticEvent<Element, Event> | Event, reason?: Reason) => void;
19
+ onClose?: (event?: SyntheticEvent<Element, Event> | Event, reason?: CloseEventReason) => void;
20
20
  inputProps?: Omit<TextFieldProps, 'ref' | 'value' | 'onChange'>;
21
21
  disabled?: boolean;
22
22
  /**
23
23
  * @description Принимает только Date object, включая невалидную дату Invalid date
24
24
  * */
25
25
  value?: Date;
26
+ className?: string;
26
27
  };
27
28
  export declare const DatePicker: import("react").ForwardRefExoticComponent<MondayFirst & Partial<MinMaxDate> & {
28
29
  /**
@@ -36,11 +37,12 @@ export declare const DatePicker: import("react").ForwardRefExoticComponent<Monda
36
37
  onChange?: ((date?: Date) => void) | undefined;
37
38
  onBlur?: (() => void) | undefined;
38
39
  onOpen?: (() => void) | undefined;
39
- onClose?: ((event?: SyntheticEvent<Element, Event> | Event, reason?: Reason) => void) | undefined;
40
+ onClose?: ((event?: SyntheticEvent<Element, Event> | Event, reason?: CloseEventReason) => void) | undefined;
40
41
  inputProps?: Omit<TextFieldProps, "ref" | "value" | "onChange"> | undefined;
41
42
  disabled?: boolean | undefined;
42
43
  /**
43
44
  * @description Принимает только Date object, включая невалидную дату Invalid date
44
45
  * */
45
46
  value?: Date | undefined;
47
+ className?: string | undefined;
46
48
  } & import("react").RefAttributes<HTMLInputElement>>;
@@ -15,13 +15,13 @@ exports.DatePicker = void 0;
15
15
  const jsx_runtime_1 = require("react/jsx-runtime");
16
16
  const react_1 = require("react");
17
17
  const hooks_1 = require("../hooks");
18
- const DatePickerClickAwayListener_1 = require("./DatePickerClickAwayListener");
18
+ const ClickAwayListener_1 = require("../ClickAwayListener");
19
19
  const DatePickerInput_1 = require("./DatePickerInput");
20
20
  const DatePickerPopper_1 = require("./DatePickerPopper");
21
21
  const MinMaxDateContext_1 = require("./MinMaxDateContext");
22
22
  const YearMonthDayPicker_1 = require("./YearMonthDayPicker");
23
23
  const hooks_2 = require("./hooks");
24
- const DatePickerInner = (0, react_1.forwardRef)(({ onChange, onOpen, onBlur, onClose, mask = 'DD.MM.YYYY', isMondayFirst, inputProps, disabled, value, }, forwardedRef) => {
24
+ const DatePickerInner = (0, react_1.forwardRef)(({ onChange, onOpen, onBlur, onClose, mask = 'DD.MM.YYYY', isMondayFirst, inputProps, disabled, value, className, }, forwardedRef) => {
25
25
  const { maxDate, minDate } = (0, react_1.useContext)(MinMaxDateContext_1.MinMaxDateContext);
26
26
  const ref = (0, hooks_1.useForwardedRef)(forwardedRef);
27
27
  const [isOpenPopper, openPopper, closePopper] = (0, hooks_1.useToggle)({
@@ -47,7 +47,7 @@ const DatePickerInner = (0, react_1.forwardRef)(({ onChange, onOpen, onBlur, onC
47
47
  const handleChangeMaskInput = (e) => {
48
48
  onChangeMaskedValue(e.target.value);
49
49
  };
50
- return ((0, jsx_runtime_1.jsxs)(DatePickerClickAwayListener_1.DatePickerClickAwayListener, Object.assign({ onClickAway: handleClosePopper }, { children: [(0, jsx_runtime_1.jsx)(DatePickerInput_1.DatePickerInput, Object.assign({}, inputProps, { mask: mask, onNativeChange: handleChangeMaskInput, disabled: disabled, value: maskedValue, ref: ref, onFocus: openPopper })), (0, jsx_runtime_1.jsx)(DatePickerPopper_1.DatePickerPopper, Object.assign({ open: isOpenPopper, onClose: handleClosePopper, anchorEl: ref === null || ref === void 0 ? void 0 : ref.current }, { children: (0, jsx_runtime_1.jsx)(YearMonthDayPicker_1.YearMonthDayPicker, { isMondayFirst: isMondayFirst, selectedDate: selectedBaseDate, onChange: handleDayPick, date: selectedBaseDate || baseDate }) }))] })));
50
+ return ((0, jsx_runtime_1.jsx)(ClickAwayListener_1.ClickAwayListener, Object.assign({ isActive: isOpenPopper, onClickAway: handleClosePopper }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: className }, { children: [(0, jsx_runtime_1.jsx)(DatePickerInput_1.DatePickerInput, Object.assign({}, inputProps, { mask: mask, onNativeChange: handleChangeMaskInput, disabled: disabled, value: maskedValue, ref: ref, onFocus: openPopper })), (0, jsx_runtime_1.jsx)(DatePickerPopper_1.DatePickerPopper, Object.assign({ open: isOpenPopper, onClose: handleClosePopper, anchorEl: ref === null || ref === void 0 ? void 0 : ref.current }, { children: (0, jsx_runtime_1.jsx)(YearMonthDayPicker_1.YearMonthDayPicker, { isMondayFirst: isMondayFirst, selectedDate: selectedBaseDate, onChange: handleDayPick, date: selectedBaseDate || baseDate }) }))] })) })));
51
51
  });
52
52
  exports.DatePicker = (0, react_1.forwardRef)((_a, forwardedRef) => {
53
53
  var { minDate, maxDate } = _a, props = __rest(_a, ["minDate", "maxDate"]);
@@ -89,4 +89,10 @@ describe('DatePicker', () => {
89
89
  yield tests_1.userEvents.tab();
90
90
  expect(onBlur).not.toBeCalled();
91
91
  }));
92
+ it('Props:onBlur: не вызывается при клике мимо инпута, если поповер закрыт', () => __awaiter(void 0, void 0, void 0, function* () {
93
+ const onBlur = vitest_1.vi.fn();
94
+ (0, tests_1.renderWithTheme)((0, jsx_runtime_1.jsx)(DatePicker_1.DatePicker, { onBlur: onBlur }));
95
+ yield tests_1.userEvents.click(document.body);
96
+ expect(onBlur).not.toBeCalled();
97
+ }));
92
98
  });
@@ -1,7 +1,7 @@
1
1
  import { PropsWithChildren, SyntheticEvent } from 'react';
2
2
  import { PopperProps } from '@mui/material';
3
- import { Reason, WithoutEmotionSpecific } from '../../types';
3
+ import { CloseEventReason, WithoutEmotionSpecific } from '../../types';
4
4
  export type DatePickerProps = PropsWithChildren<Omit<WithoutEmotionSpecific<PopperProps>, 'children'>> & {
5
- onClose?: (_?: SyntheticEvent<Element, Event> | Event, reason?: Reason) => void;
5
+ onClose?: (_?: SyntheticEvent<Element, Event> | Event, reason?: CloseEventReason) => void;
6
6
  };
7
7
  export declare const DatePickerPopper: ({ children, onClose, ...props }: DatePickerProps) => JSX.Element;
package/Fab/styles.d.ts CHANGED
@@ -30,7 +30,7 @@ export declare const StyledFab: import("@emotion/styled").StyledComponent<{
30
30
  ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
31
31
  }, "disabled" | "action" | "color" | "sx" | "href" | "onFocusVisible" | "tabIndex" | "children" | "variant" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & {
32
32
  theme?: import("@emotion/react").Theme | undefined;
33
- } & Omit<import("../types").WithoutEmotionSpecific<import("@mui/material").FabProps<"button", {}>>, "color" | "variant"> & {
33
+ } & Omit<import("..").WithoutEmotionSpecific<import("@mui/material").FabProps<"button", {}>>, "color" | "variant"> & {
34
34
  color?: "primary" | "default" | "error" | "warning" | "success" | undefined;
35
35
  variant?: "square" | "circular" | "extended" | undefined;
36
36
  } & {
@@ -8,7 +8,7 @@ export declare const getButtonSize: ({ size, }: IconButtonWrapperThemeProps) =>
8
8
  export declare const getButtonSizeMobile: ({ size, }: IconButtonWrapperThemeProps) => string;
9
9
  export declare const IconButtonWrapper: import("@emotion/styled").StyledComponent<Pick<import("../ButtonBase").BaseButtonProps, "color" | "translate" | keyof import("@mui/base").ButtonUnstyledOwnProps | "form" | "slot" | "style" | "title" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "component" | "variant" | "size" | "selected"> & import("react").RefAttributes<HTMLButtonElement> & {
10
10
  theme?: import("@emotion/react").Theme | undefined;
11
- } & Omit<import("../types").WithoutEmotionSpecific<import("@mui/lab").LoadingButtonProps<"button", {}>>, "color" | "variant"> & {
11
+ } & Omit<import("..").WithoutEmotionSpecific<import("@mui/lab").LoadingButtonProps<"button", {}>>, "color" | "variant"> & {
12
12
  variant?: "link" | "light" | "text" | "contained" | undefined;
13
13
  color?: "primary" | "error" | "warning" | "success" | undefined;
14
14
  component?: import("react").ElementType<any> | undefined;
@@ -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
+ }, {}, {}>;