@astral/ui 4.87.0 → 4.88.0

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 (61) hide show
  1. package/components/Alert/Alert.js +9 -5
  2. package/components/Alert/constants.d.ts +2 -0
  3. package/components/Alert/constants.js +2 -0
  4. package/components/Alert/styles.d.ts +1 -1
  5. package/components/Alert/styles.js +47 -193
  6. package/components/Alert/types.d.ts +7 -0
  7. package/components/Alert/useLogic/useLogic.d.ts +3 -2
  8. package/components/Alert/useLogic/useLogic.js +4 -2
  9. package/components/CollapsableAlert/CollapsableAlert.d.ts +6 -1
  10. package/components/CollapsableAlert/CollapsableAlert.js +1 -1
  11. package/components/DashboardAlert/DashboardAlert.d.ts +4 -0
  12. package/components/DashboardAlert/DashboardAlert.js +5 -1
  13. package/components/DashboardAlert/styles.js +13 -15
  14. package/components/DashboardAlert/types.d.ts +4 -1
  15. package/components/DashboardLayout/Main/Main.js +2 -2
  16. package/components/DashboardLayout/Main/styles.d.ts +4 -0
  17. package/components/DashboardLayout/Main/styles.js +7 -0
  18. package/components/PageAlert/PageAlert.d.ts +7 -0
  19. package/components/PageAlert/PageAlert.js +6 -2
  20. package/components/PageLayout/styles.js +4 -0
  21. package/components/Select/Select.js +1 -1
  22. package/components/Select/useLogic/useLogic.d.ts +1 -1
  23. package/components/TagsList/types.d.ts +2 -2
  24. package/components/TagsList/useLogic/useLogic.js +16 -10
  25. package/components/TagsList/utils/getKey/getKey.js +4 -4
  26. package/components/fileUploading/FileUploader/faker.d.ts +1 -1
  27. package/components/fileUploading/PreviewFileUploader/faker.d.ts +1 -1
  28. package/hook-form/EditableText/EditingForm/useLogic/useLogic.d.ts +1 -1
  29. package/node/components/Alert/Alert.js +8 -4
  30. package/node/components/Alert/constants.d.ts +2 -0
  31. package/node/components/Alert/constants.js +2 -0
  32. package/node/components/Alert/styles.d.ts +1 -1
  33. package/node/components/Alert/styles.js +48 -194
  34. package/node/components/Alert/types.d.ts +7 -0
  35. package/node/components/Alert/useLogic/useLogic.d.ts +3 -2
  36. package/node/components/Alert/useLogic/useLogic.js +4 -2
  37. package/node/components/CollapsableAlert/CollapsableAlert.d.ts +6 -1
  38. package/node/components/CollapsableAlert/CollapsableAlert.js +1 -1
  39. package/node/components/DashboardAlert/DashboardAlert.d.ts +4 -0
  40. package/node/components/DashboardAlert/DashboardAlert.js +5 -1
  41. package/node/components/DashboardAlert/styles.js +13 -15
  42. package/node/components/DashboardAlert/types.d.ts +4 -1
  43. package/node/components/DashboardLayout/Main/Main.js +1 -1
  44. package/node/components/DashboardLayout/Main/styles.d.ts +4 -0
  45. package/node/components/DashboardLayout/Main/styles.js +8 -1
  46. package/node/components/PageAlert/PageAlert.d.ts +7 -0
  47. package/node/components/PageAlert/PageAlert.js +6 -2
  48. package/node/components/PageLayout/styles.js +4 -0
  49. package/node/components/Select/Select.js +1 -1
  50. package/node/components/Select/useLogic/useLogic.d.ts +1 -1
  51. package/node/components/TagsList/types.d.ts +2 -2
  52. package/node/components/TagsList/useLogic/useLogic.js +16 -10
  53. package/node/components/TagsList/utils/getKey/getKey.js +4 -4
  54. package/node/components/fileUploading/FileUploader/faker.d.ts +1 -1
  55. package/node/components/fileUploading/PreviewFileUploader/faker.d.ts +1 -1
  56. package/node/hook-form/EditableText/EditingForm/useLogic/useLogic.d.ts +1 -1
  57. package/package.json +39 -39
  58. package/components/PageAlert/styles.d.ts +0 -7
  59. package/components/PageAlert/styles.js +0 -10
  60. package/node/components/PageAlert/styles.d.ts +0 -7
  61. package/node/components/PageAlert/styles.js +0 -13
@@ -9,7 +9,7 @@ import { Collapse } from '../Collapse';
9
9
  import { classNames } from '../utils/classNames';
10
10
  import { cva } from '../utils/cva';
11
11
  import { alertClassnames } from './constants';
12
- import { Content, IconWrapper, StyledGrid, StyledIconButton, StyledTypography, Title, Wrapper, } from './styles';
12
+ import { BodyWrapper, IconWrapper, StyledGrid, StyledIconButton, StyledTypography, Title, Wrapper, } from './styles';
13
13
  import { useLogic } from './useLogic';
14
14
  const alertCva = cva(alertClassnames.root, {
15
15
  variants: {
@@ -30,8 +30,12 @@ const alertCva = cva(alertClassnames.root, {
30
30
  },
31
31
  },
32
32
  });
33
- export const Alert = forwardRef(({ children, title, closeText = 'Скрыть', display = true, actions, onClose, severity = 'info', style, className, icon, unmountOnExit, }, ref) => {
34
- const { shouldRenderParagraph } = useLogic({ children });
33
+ export const Alert = forwardRef(({ children, title, closeText = 'Скрыть', isShow, display, actions, onClose, severity = 'info', style, className, icon, unmountOnExit, }, ref) => {
34
+ const { shouldRenderParagraph, isVisible } = useLogic({
35
+ children,
36
+ isShow,
37
+ display,
38
+ });
35
39
  const renderCloseButton = () => {
36
40
  return (_jsx(StyledIconButton, { variant: "text", color: "grey", onClick: onClose, "aria-label": closeText, title: closeText, className: alertClassnames.closeButton, children: _jsx(CrossOutlineMd, {}) }));
37
41
  };
@@ -44,10 +48,10 @@ export const Alert = forwardRef(({ children, title, closeText = 'Скрыть',
44
48
  };
45
49
  return (_jsx(IconWrapper, { className: alertClassnames.iconWrapper, children: icon ?? iconMapping[severity] }));
46
50
  };
47
- return (_jsx(Collapse, { in: display, unmountOnExit: unmountOnExit, children: _jsxs(Wrapper, { style: style, className: classNames(alertCva({
51
+ return (_jsx(Collapse, { in: isVisible, unmountOnExit: unmountOnExit, children: _jsxs(Wrapper, { style: style, className: classNames(alertClassnames.contentWrapper, alertCva({
48
52
  hasTitle: Boolean(title),
49
53
  hasCloseButton: Boolean(onClose),
50
54
  hasActions: Boolean(actions),
51
55
  severity,
52
- }), className), role: "alert", ref: ref, children: [_jsxs(Content, { className: alertClassnames.contentWrapper, children: [renderIcon(), title && (_jsx(Title, { variant: "h5", className: alertClassnames.title, children: title })), onClose && renderCloseButton(), _jsx(StyledTypography, { component: shouldRenderParagraph ? 'p' : 'div', className: alertClassnames.content, children: children })] }), actions && (_jsx(StyledGrid, { container: true, spacing: 4, children: actions }))] }) }));
56
+ }), className), role: "alert", ref: ref, children: [renderIcon(), _jsxs(BodyWrapper, { className: alertClassnames.bodyWrapper, children: [title && (_jsx(Title, { variant: "h5", className: alertClassnames.title, children: title })), _jsx(StyledTypography, { component: shouldRenderParagraph ? 'p' : 'div', className: alertClassnames.content, children: children }), actions && (_jsx(StyledGrid, { container: true, spacing: 4, className: alertClassnames.actions, children: actions }))] }), onClose && renderCloseButton()] }) }));
53
57
  });
@@ -4,7 +4,9 @@ export declare const alertClassnames: {
4
4
  title: string;
5
5
  closeButton: string;
6
6
  contentWrapper: string;
7
+ bodyWrapper: string;
7
8
  content: string;
9
+ actions: string;
8
10
  hasTitle: string;
9
11
  hasCloseButton: string;
10
12
  hasActions: string;
@@ -5,7 +5,9 @@ export const alertClassnames = {
5
5
  title: createUIKitClassname('alert__title'),
6
6
  closeButton: createUIKitClassname('alert__close-button'),
7
7
  contentWrapper: createUIKitClassname('alert__content-wrapper'),
8
+ bodyWrapper: createUIKitClassname('alert__body-wrapper'),
8
9
  content: createUIKitClassname('alert__content'),
10
+ actions: createUIKitClassname('alert__actions'),
9
11
  hasTitle: createUIKitClassname('alert_has-title'),
10
12
  hasCloseButton: createUIKitClassname('alert_has-close-button'),
11
13
  hasActions: createUIKitClassname('alert_has-actions'),
@@ -20,7 +20,7 @@ export declare const IconWrapper: import("../styled").StyledComponent<{
20
20
  theme?: import("@emotion/react").Theme | undefined;
21
21
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
22
22
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
23
- export declare const Content: import("../styled").StyledComponent<{
23
+ export declare const BodyWrapper: import("../styled").StyledComponent<{
24
24
  theme?: import("@emotion/react").Theme | undefined;
25
25
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
26
26
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -6,23 +6,29 @@ import { Typography } from '../Typography';
6
6
  import { alertClassnames } from './constants';
7
7
  export const StyledGrid = styled(Grid) `
8
8
  grid-auto-flow: column;
9
- grid-column: 2 / -1;
10
9
  justify-content: flex-start;
11
10
  `;
12
11
  export const StyledIconButton = styled(IconButton) `
13
- grid-column: 3;
14
- grid-row: 1;
12
+ flex-shrink: 0;
13
+ align-self: flex-start;
14
+
15
+ /* Центрируем кнопку по ее строке, как и иконку:
16
+ отступ строки сверху + половина разницы высот кнопки и строки */
17
+ margin-top: ${({ theme }) => `calc(${theme.microSpacing(3)} + (20px - 32px) / 2)`};
18
+
19
+ ${({ theme }) => theme.breakpoints.down('sm')} {
20
+ margin-top: ${({ theme }) => `calc(${theme.microSpacing(3)} + (20px - 40px) / 2)`};
21
+ }
15
22
 
16
23
  &:hover {
17
24
  background-color: rgb(0 0 0 / 4%);
18
25
  }
19
26
  `;
20
27
  export const Wrapper = styled.div `
21
- display: grid;
22
- grid-template-columns: 20px 1fr 32px;
23
- gap: ${({ theme }) => theme.microSpacing(7, 4)};
28
+ display: flex;
29
+ align-items: flex-start;
24
30
 
25
- padding: ${({ theme }) => theme.microSpacing(9, 8, 9, 8)};
31
+ padding: ${({ theme }) => theme.spacing(3, 4)};
26
32
 
27
33
  border: 1px solid transparent;
28
34
  border-radius: ${({ theme }) => theme.shape.medium};
@@ -62,179 +68,17 @@ export const Wrapper = styled.div `
62
68
  color: ${({ theme }) => theme.palette.warning[800]};
63
69
  }
64
70
  }
65
-
66
- /* hasCloseButton only */
67
- &.${alertClassnames.hasCloseButton}:not(.${alertClassnames.hasTitle}):not(.${alertClassnames.hasActions}) {
68
- padding: ${({ theme }) => theme.microSpacing(6, 6, 6, 8)};
69
- }
70
-
71
- /* hasActions only */
72
- &.${alertClassnames.hasActions}:not(.${alertClassnames.hasTitle}):not(.${alertClassnames.hasCloseButton}) {
73
- padding: ${({ theme }) => theme.microSpacing(9, 8, 8, 8)};
74
- }
75
-
76
- /* hasActions and hasCloseButton */
77
- &.${alertClassnames.hasActions}.${alertClassnames.hasCloseButton}:not(.${alertClassnames.hasTitle}) {
78
- padding: ${({ theme }) => theme.microSpacing(6, 6, 8, 8)};
79
- }
80
-
81
- /* hasTitle only */
82
- &.${alertClassnames.hasTitle}:not(.${alertClassnames.hasActions}):not(.${alertClassnames.hasCloseButton}) {
83
- padding: ${({ theme }) => theme.microSpacing(6, 8, 6, 8)};
84
- }
85
-
86
- /* hasTitle and hasCloseButton */
87
- &.${alertClassnames.hasTitle}.${alertClassnames.hasCloseButton}:not(.${alertClassnames.hasActions}) {
88
- padding: ${({ theme }) => theme.microSpacing(6, 6, 6, 8)};
89
- }
90
-
91
- /* hasTitle and hasActions */
92
- &.${alertClassnames.hasTitle}.${alertClassnames.hasActions}:not(.${alertClassnames.hasCloseButton}) {
93
- padding: ${({ theme }) => theme.microSpacing(6, 8, 8, 8)};
94
- }
95
-
96
- /* all three */
97
- &.${alertClassnames.hasTitle}.${alertClassnames.hasActions}.${alertClassnames.hasCloseButton} {
98
- padding: ${({ theme }) => theme.microSpacing(6, 6, 8, 8)};
99
- }
100
-
101
- &.${alertClassnames.hasTitle} {
102
- gap: ${({ theme }) => theme.spacing(3, 2)};
103
-
104
- .${alertClassnames.contentWrapper} {
105
- grid-template-rows: minmax(32px, auto) auto;
106
- align-items: center;
107
- }
108
-
109
- .${alertClassnames.content} {
110
- grid-row: 2;
111
- }
112
- }
113
-
114
- &:not(.${alertClassnames.hasTitle}) {
115
- .${alertClassnames.contentWrapper} {
116
- align-items: flex-start;
117
- }
118
- }
119
-
120
- &.${alertClassnames.hasCloseButton}:not(.${alertClassnames.hasTitle}) {
121
- .${alertClassnames.iconWrapper} {
122
- padding-top: ${({ theme }) => theme.microSpacing(3)};
123
- }
124
- }
125
-
126
- &.${alertClassnames.hasCloseButton} {
127
- .${alertClassnames.title} {
128
- grid-column: 2;
129
- }
130
-
131
- &:not(.${alertClassnames.hasTitle}) {
132
- .${alertClassnames.content} {
133
- grid-column: 2;
134
- }
135
-
136
- .${alertClassnames.contentWrapper} {
137
- grid-template-rows: minmax(32px, auto);
138
- }
139
-
140
- .${alertClassnames.content} {
141
- padding: ${({ theme }) => theme.microSpacing(3, 0)};
142
- }
143
- }
144
-
145
- &.${alertClassnames.hasActions}:not(.${alertClassnames.hasTitle}) {
146
- .${alertClassnames.content} {
147
- padding: ${({ theme }) => theme.microSpacing(3, 0, 0)};
148
- }
149
- }
150
- }
151
-
152
- ${({ theme }) => theme.breakpoints.down('sm')} {
153
- grid-row-gap: ${({ theme }) => theme.spacing(4)};
154
- grid-template-columns: 24px 1fr 40px;
155
-
156
- padding: ${({ theme }) => theme.microSpacing(8, 8, 9, 8)};
157
-
158
- .${alertClassnames.contentWrapper} {
159
- grid-template-columns: 24px 1fr 40px;
160
- }
161
-
162
- /* hasCloseButton only */
163
- &.${alertClassnames.hasCloseButton}:not(.${alertClassnames.hasTitle}):not(.${alertClassnames.hasActions}) {
164
- padding: ${({ theme }) => theme.microSpacing(4, 4, 9, 8)};
165
- }
166
-
167
- /* hasActions only */
168
- &.${alertClassnames.hasActions}:not(.${alertClassnames.hasTitle}):not(.${alertClassnames.hasCloseButton}) {
169
- padding: ${({ theme }) => theme.microSpacing(8, 8, 10, 8)};
170
- }
171
-
172
- /* hasActions and hasCloseButton */
173
- &.${alertClassnames.hasCloseButton}.${alertClassnames.hasActions}:not(.${alertClassnames.hasTitle}) {
174
- padding: ${({ theme }) => theme.microSpacing(4, 4, 10, 8)};
175
- }
176
-
177
- /* hasTitle only */
178
- &.${alertClassnames.hasTitle}:not(.${alertClassnames.hasActions}):not(.${alertClassnames.hasCloseButton}) {
179
- padding: ${({ theme }) => theme.microSpacing(8, 8, 8, 8)};
180
- }
181
-
182
- /* hasTitle and hasCloseButton */
183
- &.${alertClassnames.hasTitle}.${alertClassnames.hasCloseButton}:not(.${alertClassnames.hasActions}) {
184
- padding: ${({ theme }) => theme.microSpacing(4, 4, 8, 8)};
185
- }
186
-
187
- /* hasTitle and hasActions */
188
- &.${alertClassnames.hasTitle}.${alertClassnames.hasActions}:not(.${alertClassnames.hasCloseButton}) {
189
- padding: ${({ theme }) => theme.microSpacing(8, 8, 10, 8)};
190
- }
191
-
192
- /* нет модификаторов */
193
- &:not(.${alertClassnames.hasTitle}):not(.${alertClassnames.hasActions}):not(.${alertClassnames.hasCloseButton}) {
194
- .${alertClassnames.content} {
195
- padding-top: ${({ theme }) => theme.microSpacing(1)};
196
- }
197
- }
198
-
199
- /* all three */
200
- &.${alertClassnames.hasTitle}.${alertClassnames.hasActions}.${alertClassnames.hasCloseButton} {
201
- padding: ${({ theme }) => theme.microSpacing(4, 4, 10, 8)};
202
- }
203
-
204
- /* for close button without title */
205
- &.${alertClassnames.hasCloseButton}:not(.${alertClassnames.hasTitle}) {
206
- .${alertClassnames.iconWrapper} {
207
- padding-top: ${({ theme }) => theme.spacing(2)};
208
- }
209
- }
210
-
211
- /* close button only case */
212
- &.${alertClassnames.hasCloseButton}:not(.${alertClassnames.hasTitle}):not(.${alertClassnames.hasActions}) {
213
- .${alertClassnames.content} {
214
- padding-top: ${({ theme }) => theme.microSpacing(5)};
215
- padding-bottom: 0;
216
- }
217
- }
218
-
219
- /* actions only case */
220
- &.${alertClassnames.hasActions}:not(.${alertClassnames.hasTitle}):not(.${alertClassnames.hasCloseButton}) {
221
- .${alertClassnames.content} {
222
- padding-top: ${({ theme }) => theme.microSpacing(1)};
223
- padding-bottom: 0;
224
- }
225
- }
226
-
227
- /* actions + close button case */
228
- &.${alertClassnames.hasActions}.${alertClassnames.hasCloseButton}:not(.${alertClassnames.hasTitle}) {
229
- .${alertClassnames.content} {
230
- padding-top: ${({ theme }) => theme.microSpacing(5)};
231
- padding-bottom: 0;
232
- }
233
- }
234
- }
235
71
  `;
236
72
  export const IconWrapper = styled.div `
73
+ display: flex;
74
+ flex-shrink: 0;
75
+ align-items: center;
76
+
77
+ /* Высота строки текста (line-height body1): иконка центрируется по первой строке,
78
+ а не по собственному боксу, поэтому высота не зависит от размера иконки */
237
79
  height: 20px;
80
+ margin-right: ${({ theme }) => theme.spacing(2)};
81
+ margin-block: ${({ theme }) => theme.microSpacing(3)};
238
82
 
239
83
  color: inherit;
240
84
 
@@ -245,30 +89,40 @@ export const IconWrapper = styled.div `
245
89
  font-size: 24px;
246
90
  }
247
91
  }
92
+ `;
93
+ export const BodyWrapper = styled.div `
94
+ display: flex;
95
+ flex: 1;
96
+ flex-direction: column;
97
+ align-items: flex-start;
248
98
 
249
- ${({ theme }) => theme.breakpoints.down('sm')} {
250
- height: 24px;
99
+ min-width: 0;
100
+ margin-block: ${({ theme }) => theme.microSpacing(3)};
101
+
102
+ .${alertClassnames.hasCloseButton} & {
103
+ margin-right: ${({ theme }) => theme.spacing(1)};
251
104
  }
252
- `;
253
- export const Content = styled.div `
254
- display: grid;
255
- grid-column: 1 / -1;
256
- grid-gap: ${({ theme }) => theme.microSpacing(1, 4)};
257
- grid-template-columns: 20px 1fr 32px;
258
- grid-template-rows: minmax(20px, auto);
259
- align-items: unset;
260
105
 
106
+ & > .${alertClassnames.title} + .${alertClassnames.content} {
107
+ margin-top: ${({ theme }) => theme.spacing(1)};
108
+ }
109
+
110
+ & > .${alertClassnames.actions} {
111
+ margin-top: ${({ theme }) => theme.spacing(2)};
112
+ }
261
113
  `;
262
114
  export const StyledTypography = styled(Typography) `
263
- grid-column: 2 / -1;
264
- grid-row: 1;
115
+ align-self: stretch;
265
116
 
117
+ min-width: 0;
118
+ margin: 0;
266
119
  padding: 0;
267
120
 
268
- .${alertClassnames.hasTitle} & {
269
- grid-row: 2;
270
- }
121
+ overflow-wrap: break-word;
271
122
  `;
272
123
  export const Title = styled(Typography) `
273
- grid-column: 2 / -1;
124
+ min-width: 0;
125
+ margin: 0;
126
+
127
+ overflow-wrap: break-word;
274
128
  `;
@@ -20,9 +20,16 @@ export type AlertProps = {
20
20
  * Используется для отображения набора действий
21
21
  */
22
22
  actions?: ReactNode;
23
+ /**
24
+ * @example <Alert isShow={false}>Сообщение</Alert>
25
+ * Флаг для отображения/скрытия компонента Alert
26
+ */
27
+ isShow?: boolean;
23
28
  /**
24
29
  * @example <Alert display={false}>Сообщение</Alert>
25
30
  * Флаг для отображения/скрытия компонента Alert
31
+ *
32
+ * @deprecated Используйте `isShow`. Проп будет удалён в следующей major версии пакета.
26
33
  */
27
34
  display?: boolean;
28
35
  /**
@@ -1,6 +1,7 @@
1
1
  import { type AlertProps } from '../types';
2
- type UseLogicParams = Pick<AlertProps, 'children'>;
3
- export declare const useLogic: ({ children }: UseLogicParams) => {
2
+ type UseLogicParams = Pick<AlertProps, 'children' | 'isShow' | 'display'>;
3
+ export declare const useLogic: ({ children, isShow, display }: UseLogicParams) => {
4
4
  shouldRenderParagraph: boolean;
5
+ isVisible: boolean;
5
6
  };
6
7
  export {};
@@ -1,4 +1,6 @@
1
- export const useLogic = ({ children }) => {
1
+ export const useLogic = ({ children, isShow, display }) => {
2
2
  const shouldRenderParagraph = typeof children === 'string' || typeof children === 'number';
3
- return { shouldRenderParagraph };
3
+ // display - deprecated проп, поддерживается для обратной совместимости, приоритет у isShow
4
+ const isVisible = isShow ?? display ?? true;
5
+ return { shouldRenderParagraph, isVisible };
4
6
  };
@@ -1,7 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { type AccordionProps } from '../Accordion';
3
3
  import { type AlertProps } from '../Alert';
4
- export declare const CollapsableAlert: import("react").ForwardRefExoticComponent<Pick<AlertProps, "display" | "icon" | "actions" | "severity"> & Omit<AccordionProps, "onChange" | "summary" | "startAdornment"> & {
4
+ export declare const CollapsableAlert: import("react").ForwardRefExoticComponent<Pick<AlertProps, "icon" | "actions" | "severity"> & Omit<AccordionProps, "onChange" | "summary" | "startAdornment"> & {
5
5
  title: AccordionProps['summary'];
6
6
  onExpandedChange?: AccordionProps['onChange'];
7
+ /**
8
+ * @example <CollapsableAlert display={false}>Сообщение</CollapsableAlert>
9
+ * Флаг для отображения/скрытия компонента
10
+ */
11
+ display?: boolean | undefined;
7
12
  } & import("react").RefAttributes<HTMLDivElement>>;
@@ -3,5 +3,5 @@ import { forwardRef } from 'react';
3
3
  import { Accordion } from '../Accordion';
4
4
  import { Alert } from '../Alert';
5
5
  export const CollapsableAlert = forwardRef(({ title, icon, severity = 'info', actions, display = true, children, isExpanded, onExpandedChange, subtitle, summaryVariant, }, ref) => {
6
- return (_jsx(Alert, { ref: ref, severity: severity, icon: icon, display: display, actions: actions, children: _jsx(Accordion, { summary: title, isExpanded: isExpanded, onChange: onExpandedChange, subtitle: subtitle, summaryVariant: summaryVariant, children: children }) }));
6
+ return (_jsx(Alert, { ref: ref, severity: severity, icon: icon, isShow: display, actions: actions, children: _jsx(Accordion, { summary: title, isExpanded: isExpanded, onChange: onExpandedChange, subtitle: subtitle, summaryVariant: summaryVariant, children: children }) }));
7
7
  });
@@ -1,5 +1,9 @@
1
1
  import type { DashboardAlertProps } from './types';
2
2
  /**
3
3
  * Компонент отображения уведомления на всех страницах приложения
4
+ *
5
+ * @deprecated Компонент будет удалён — планируется полный переход на {@link Alert}.
6
+ * Не используйте `DashboardAlert` в новом коде, вместо него используйте `Alert`.
7
+ * Подробнее — в разделе «DashboardAlert / PageAlert» V5 Migration Guide.
4
8
  */
5
9
  export declare const DashboardAlert: (props: DashboardAlertProps) => import("react/jsx-runtime").JSX.Element;
@@ -5,9 +5,13 @@ import { dashboardAlertClassnames } from './constants';
5
5
  import { StyledAlert, StyledButton } from './styles';
6
6
  /**
7
7
  * Компонент отображения уведомления на всех страницах приложения
8
+ *
9
+ * @deprecated Компонент будет удалён — планируется полный переход на {@link Alert}.
10
+ * Не используйте `DashboardAlert` в новом коде, вместо него используйте `Alert`.
11
+ * Подробнее — в разделе «DashboardAlert / PageAlert» V5 Migration Guide.
8
12
  */
9
13
  export const DashboardAlert = (props) => {
10
14
  const { linkButtonProps, children, isShow, className, ...restProps } = props;
11
15
  const { name, color: linkButtonColor, ...restButtonProps } = linkButtonProps || {};
12
- return (_jsx(StyledAlert, { className: classNames(dashboardAlertClassnames.root, className), display: isShow, ...restProps, children: _jsxs(Typography, { variant: "body1", children: [children, "\u00A0", linkButtonProps && (_jsx(StyledButton, { variant: "link", ...restButtonProps, children: name }))] }) }));
16
+ return (_jsx(StyledAlert, { className: classNames(dashboardAlertClassnames.root, className), isShow: isShow, ...restProps, children: _jsxs(Typography, { variant: "body1", children: [children, "\u00A0", linkButtonProps && (_jsx(StyledButton, { variant: "link", ...restButtonProps, children: name }))] }) }));
13
17
  };
@@ -5,25 +5,13 @@ import { styled } from '../styled';
5
5
  import { dashboardAlertClassnames } from './constants';
6
6
  export const StyledAlert = styled(Alert) `
7
7
  &.${alertClassnames.root}.${dashboardAlertClassnames.root}.${dashboardAlertClassnames.root} {
8
- grid-template-columns: 24px 1fr 32px;
8
+ align-items: center;
9
9
 
10
- margin-bottom: ${({ theme }) => theme.spacing(4)};
11
10
  padding: ${({ theme }) => theme.spacing(3, 4)};
12
11
 
13
-
14
- .${alertClassnames.contentWrapper} {
15
- grid-template-columns: 24px 1fr 32px;
16
- grid-template-rows: minmax(32px, auto);
17
- align-items: center;
18
-
19
- ${({ theme }) => theme.breakpoints.down('sm')} {
20
- align-items: flex-start;
21
- }
22
- }
23
-
24
12
  .${alertClassnames.iconWrapper} {
25
13
  height: 24px;
26
- padding: 0;
14
+ margin-block: 0;
27
15
 
28
16
  & .${svgIconClassnames.root} {
29
17
  font-size: 24px;
@@ -35,7 +23,17 @@ export const StyledAlert = styled(Alert) `
35
23
  }
36
24
 
37
25
  ${({ theme }) => theme.breakpoints.down('sm')} {
38
- margin: ${({ theme }) => theme.spacing(3, 4, 1)};
26
+ align-items: flex-start;
27
+
28
+ /* иконка 24px, выравниваем текст к ней, как в старой вёрстке */
29
+ .${alertClassnames.bodyWrapper} {
30
+ margin-block: ${({ theme }) => theme.microSpacing(1, 0)};
31
+ }
32
+
33
+ /* и кнопку закрытия к ней же: половина разницы высот кнопки и иконки */
34
+ .${alertClassnames.closeButton} {
35
+ margin-top: calc((24px - 40px) / 2);
36
+ }
39
37
  }
40
38
  }
41
39
  `;
@@ -4,7 +4,10 @@ import type { ButtonProps } from '../Button';
4
4
  export type LinkButtonProps<TComponent extends ElementType = ElementType> = Omit<ButtonProps<TComponent>, 'children' | 'size' | 'color' | 'key'> & {
5
5
  name?: string;
6
6
  } & Omit<ComponentProps<TComponent>, ''>;
7
- export type DashboardAlertProps = Omit<AlertProps, 'actions' | 'slotProps' | 'slots' | 'title' | 'display'> & {
7
+ /**
8
+ * @deprecated Тип будет удалён вместе с `DashboardAlert` — переход на {@link Alert} / `AlertProps`.
9
+ */
10
+ export type DashboardAlertProps = Omit<AlertProps, 'actions' | 'slotProps' | 'slots' | 'title' | 'display' | 'isShow'> & {
8
11
  /**
9
12
  * Параметры ссылки
10
13
  */
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
3
  import { dashboardLayoutMainClassnames } from './constants';
4
- import { AlertWrapper, MainRoot } from './styles';
4
+ import { AlertContainer, AlertWrapper, MainRoot } from './styles';
5
5
  import { useLogic } from './useLogic';
6
6
  /**
7
7
  * Основной контент приложения
8
8
  */
9
9
  export const Main = forwardRef(({ children, alert }, ref) => {
10
10
  const { onAnimationEnd, alertContainerRef } = useLogic();
11
- return (_jsxs(_Fragment, { children: [_jsx(AlertWrapper, { ref: alertContainerRef, className: dashboardLayoutMainClassnames.alert, children: alert }), _jsx(MainRoot, { className: dashboardLayoutMainClassnames.main, ref: ref, onAnimationEnd: onAnimationEnd, children: children })] }));
11
+ return (_jsxs(_Fragment, { children: [_jsx(AlertWrapper, { ref: alertContainerRef, className: dashboardLayoutMainClassnames.alert, children: alert && _jsx(AlertContainer, { children: alert }) }), _jsx(MainRoot, { className: dashboardLayoutMainClassnames.main, ref: ref, onAnimationEnd: onAnimationEnd, children: children })] }));
12
12
  });
@@ -7,3 +7,7 @@ export declare const AlertWrapper: import("../../styled").StyledComponent<{
7
7
  theme?: import("@emotion/react").Theme | undefined;
8
8
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
9
9
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
+ export declare const AlertContainer: import("../../styled").StyledComponent<{
11
+ theme?: import("@emotion/react").Theme | undefined;
12
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
13
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -20,3 +20,10 @@ export const AlertWrapper = styled.div `
20
20
  background-color: ${({ theme }) => theme.palette.background.default};
21
21
  }
22
22
  `;
23
+ export const AlertContainer = styled.div `
24
+ margin-bottom: ${({ theme }) => theme.spacing(4)};
25
+
26
+ ${({ theme }) => theme.breakpoints.down('sm')} {
27
+ margin: ${({ theme }) => theme.spacing(3, 4, 1)};
28
+ }
29
+ `;
@@ -1,6 +1,13 @@
1
1
  import { type DashboardAlertProps } from '../DashboardAlert';
2
+ /**
3
+ * @deprecated Тип будет удалён вместе с `PageAlert` — переход на {@link Alert} / `AlertProps`.
4
+ */
2
5
  export type PageAlertProps = DashboardAlertProps;
3
6
  /**
4
7
  * Компонент отображения уведомления на странице приложения
8
+ *
9
+ * @deprecated Компонент будет удалён — планируется полный переход на {@link Alert}.
10
+ * Не используйте `PageAlert` в новом коде, вместо него используйте `Alert`.
11
+ * Подробнее — в разделе «DashboardAlert / PageAlert» V5 Migration Guide.
5
12
  */
6
13
  export declare const PageAlert: (props: PageAlertProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { StyledDashboardAlert } from './styles';
2
+ import { DashboardAlert } from '../DashboardAlert';
3
3
  /**
4
4
  * Компонент отображения уведомления на странице приложения
5
+ *
6
+ * @deprecated Компонент будет удалён — планируется полный переход на {@link Alert}.
7
+ * Не используйте `PageAlert` в новом коде, вместо него используйте `Alert`.
8
+ * Подробнее — в разделе «DashboardAlert / PageAlert» V5 Migration Guide.
5
9
  */
6
10
  export const PageAlert = (props) => {
7
- return _jsx(StyledDashboardAlert, { ...props });
11
+ return _jsx(DashboardAlert, { ...props });
8
12
  };
@@ -4,12 +4,16 @@ export const MobileAlertWrapper = styled.div `
4
4
  ${({ theme }) => theme.breakpoints.down('sm')} {
5
5
  display: block;
6
6
 
7
+ margin: ${({ theme }) => theme.spacing(3, 4, 0, 4)};
8
+
7
9
  background-color: ${({ theme }) => theme.palette.background.default};
8
10
  }
9
11
  `;
10
12
  export const DesktopAlertWrapper = styled.div `
11
13
  display: block;
12
14
 
15
+ margin-bottom: ${({ theme }) => theme.spacing(4)};
16
+
13
17
  ${({ theme }) => theme.breakpoints.down('sm')} {
14
18
  display: none;
15
19
  }
@@ -34,7 +34,7 @@ const SelectInner = ({ required, getOptionLabel, placeholder, helperText, hideHe
34
34
  const renderValue = (selectedOptions) => {
35
35
  // Массив с выбранными опциями
36
36
  if (Array.isArray(selectedOptions) && selectedOptions.length) {
37
- return (_jsx(TagsList, { data: selectedOptions, keyId: "value", getOptionLabel: getOptionLabel || ((optionLabel) => optionLabel), onChange: handleChangeArrayValue, onClick: openSelect }));
37
+ return (_jsx(TagsList, { data: selectedOptions, getOptionLabel: getOptionLabel || ((optionLabel) => optionLabel), onChange: handleChangeArrayValue, onClick: openSelect }));
38
38
  }
39
39
  // Пустой массив или пустая строка
40
40
  if ((Array.isArray(selectedOptions) || typeof selectedOptions === 'string') &&
@@ -13,7 +13,7 @@ export declare const useLogic: <TValue>({ value, onChange, children, open: exter
13
13
  isSelectedAll: boolean | undefined;
14
14
  isIndeterminate: boolean | undefined;
15
15
  optionsLength: number | null;
16
- handleChangeArrayValue: (inputValue: TValue[] | undefined) => void | undefined;
16
+ handleChangeArrayValue: (inputValue: unknown[] | undefined) => void | undefined;
17
17
  selectAllClassName: string | undefined;
18
18
  findMenuItemsLabel: (nodes: ReactNode, selectedValue: TValue) => ReactNode;
19
19
  isShowingPlaceholder: boolean;
@@ -1,5 +1,5 @@
1
1
  import { type MouseEvent, type RefObject } from 'react';
2
- export type TagValue = string | Record<string, unknown>;
2
+ export type TagValue = string | number | Record<string, unknown>;
3
3
  export type TagsListProps<TData extends TagValue = TagValue> = {
4
4
  /**
5
5
  * Название класса, применяется к корневому компоненту
@@ -17,7 +17,7 @@ export type TagsListProps<TData extends TagValue = TagValue> = {
17
17
  * Поле, используемое в качестве ключа списка.
18
18
  * Если не передано, для генерации ключа будет использоваться getOptionLabel
19
19
  */
20
- keyId?: TData extends string ? never : keyof TData;
20
+ keyId?: TData extends object ? keyof TData : never;
21
21
  /**
22
22
  * Используется для определения строкового значения опции
23
23
  */