@astral/ui 4.87.1 → 4.88.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.
- package/components/Alert/Alert.js +9 -5
- package/components/Alert/constants.d.ts +2 -0
- package/components/Alert/constants.js +2 -0
- package/components/Alert/styles.d.ts +1 -1
- package/components/Alert/styles.js +47 -193
- package/components/Alert/types.d.ts +7 -0
- package/components/Alert/useLogic/useLogic.d.ts +3 -2
- package/components/Alert/useLogic/useLogic.js +4 -2
- package/components/CollapsableAlert/CollapsableAlert.d.ts +6 -1
- package/components/CollapsableAlert/CollapsableAlert.js +1 -1
- package/components/DashboardAlert/DashboardAlert.d.ts +4 -0
- package/components/DashboardAlert/DashboardAlert.js +5 -1
- package/components/DashboardAlert/styles.js +13 -15
- package/components/DashboardAlert/types.d.ts +4 -1
- package/components/DashboardLayout/Main/Main.js +2 -2
- package/components/DashboardLayout/Main/styles.d.ts +4 -0
- package/components/DashboardLayout/Main/styles.js +7 -0
- package/components/PageAlert/PageAlert.d.ts +7 -0
- package/components/PageAlert/PageAlert.js +6 -2
- package/components/PageHeader/HeaderContent/styles.js +7 -2
- package/components/PageLayout/styles.js +4 -0
- package/components/Tabs/Tabs.d.ts +1 -1
- package/components/Tabs/Tabs.js +4 -2
- package/components/Tabs/constants.d.ts +3 -0
- package/components/Tabs/constants.js +4 -0
- package/components/Tabs/index.d.ts +2 -1
- package/components/Tabs/index.js +2 -1
- package/components/Tabs/public.d.ts +1 -0
- package/components/Tabs/public.js +1 -0
- package/components/fileUploading/FileUploader/faker.d.ts +1 -1
- package/components/fileUploading/PreviewFileUploader/faker.d.ts +1 -1
- package/hook-form/EditableText/EditingForm/useLogic/useLogic.d.ts +1 -1
- package/node/components/Alert/Alert.js +8 -4
- package/node/components/Alert/constants.d.ts +2 -0
- package/node/components/Alert/constants.js +2 -0
- package/node/components/Alert/styles.d.ts +1 -1
- package/node/components/Alert/styles.js +48 -194
- package/node/components/Alert/types.d.ts +7 -0
- package/node/components/Alert/useLogic/useLogic.d.ts +3 -2
- package/node/components/Alert/useLogic/useLogic.js +4 -2
- package/node/components/CollapsableAlert/CollapsableAlert.d.ts +6 -1
- package/node/components/CollapsableAlert/CollapsableAlert.js +1 -1
- package/node/components/DashboardAlert/DashboardAlert.d.ts +4 -0
- package/node/components/DashboardAlert/DashboardAlert.js +5 -1
- package/node/components/DashboardAlert/styles.js +13 -15
- package/node/components/DashboardAlert/types.d.ts +4 -1
- package/node/components/DashboardLayout/Main/Main.js +1 -1
- package/node/components/DashboardLayout/Main/styles.d.ts +4 -0
- package/node/components/DashboardLayout/Main/styles.js +8 -1
- package/node/components/PageAlert/PageAlert.d.ts +7 -0
- package/node/components/PageAlert/PageAlert.js +6 -2
- package/node/components/PageHeader/HeaderContent/styles.js +7 -2
- package/node/components/PageLayout/styles.js +4 -0
- package/node/components/Tabs/Tabs.d.ts +1 -1
- package/node/components/Tabs/Tabs.js +4 -2
- package/node/components/Tabs/constants.d.ts +3 -0
- package/node/components/Tabs/constants.js +7 -0
- package/node/components/Tabs/index.d.ts +2 -1
- package/node/components/Tabs/index.js +4 -1
- package/node/components/Tabs/public.d.ts +1 -0
- package/node/components/Tabs/public.js +3 -0
- package/node/components/fileUploading/FileUploader/faker.d.ts +1 -1
- package/node/components/fileUploading/PreviewFileUploader/faker.d.ts +1 -1
- package/node/hook-form/EditableText/EditingForm/useLogic/useLogic.d.ts +1 -1
- package/package.json +39 -39
- package/components/PageAlert/styles.d.ts +0 -7
- package/components/PageAlert/styles.js +0 -10
- package/node/components/PageAlert/styles.d.ts +0 -7
- 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 {
|
|
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
|
|
34
|
-
const { shouldRenderParagraph } = useLogic({
|
|
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:
|
|
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(
|
|
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
|
});
|
|
@@ -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
|
|
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
|
-
|
|
14
|
-
|
|
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:
|
|
22
|
-
|
|
23
|
-
gap: ${({ theme }) => theme.microSpacing(7, 4)};
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: flex-start;
|
|
24
30
|
|
|
25
|
-
padding: ${({ theme }) => theme.
|
|
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
|
-
|
|
250
|
-
|
|
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
|
-
|
|
264
|
-
grid-row: 1;
|
|
115
|
+
align-self: stretch;
|
|
265
116
|
|
|
117
|
+
min-width: 0;
|
|
118
|
+
margin: 0;
|
|
266
119
|
padding: 0;
|
|
267
120
|
|
|
268
|
-
|
|
269
|
-
grid-row: 2;
|
|
270
|
-
}
|
|
121
|
+
overflow-wrap: break-word;
|
|
271
122
|
`;
|
|
272
123
|
export const Title = styled(Typography) `
|
|
273
|
-
|
|
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
|
-
|
|
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, "
|
|
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,
|
|
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),
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
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(
|
|
11
|
+
return _jsx(DashboardAlert, { ...props });
|
|
8
12
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { styled } from '../../styled';
|
|
2
|
+
import { tabsClassnames } from '../../Tabs';
|
|
2
3
|
export const BreadcrumbsWrapper = styled.div `
|
|
3
4
|
grid-column: 2;
|
|
4
5
|
grid-row: 1;
|
|
@@ -13,10 +14,14 @@ export const TabsWrapper = styled.div `
|
|
|
13
14
|
grid-column: 1 / -1;
|
|
14
15
|
grid-row: 4;
|
|
15
16
|
|
|
16
|
-
padding-top: ${({ theme }) => theme.spacing(
|
|
17
|
+
padding-top: ${({ theme }) => theme.spacing(4)};
|
|
17
18
|
|
|
18
19
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
19
|
-
padding: ${({ theme }) => theme.spacing(0,
|
|
20
|
+
padding: ${({ theme }) => theme.spacing(0, 0, 4, 0)};
|
|
21
|
+
|
|
22
|
+
.${tabsClassnames.root} {
|
|
23
|
+
margin: ${({ theme }) => theme.spacing(0, 4)};
|
|
24
|
+
}
|
|
20
25
|
}
|
|
21
26
|
`;
|
|
22
27
|
export const PageSubheader = styled.div `
|
|
@@ -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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { TabsProps as MuiTabsProps } from '@mui/material/Tabs';
|
|
2
2
|
import { type WithoutEmotionSpecific } from '../types/WithoutEmotionSpecific';
|
|
3
3
|
export type TabsProps = WithoutEmotionSpecific<MuiTabsProps>;
|
|
4
|
-
export declare const Tabs: ({ ...tabsProps }: TabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const Tabs: ({ className, ...tabsProps }: TabsProps) => import("react/jsx-runtime").JSX.Element;
|
package/components/Tabs/Tabs.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useScrollToActiveElement } from '../useScrollToActiveElement';
|
|
3
|
+
import { classNames } from '../utils/classNames';
|
|
4
|
+
import { tabsClassnames } from './constants';
|
|
3
5
|
import { Container, Divider, StyledTabs, Wrapper } from './styles';
|
|
4
|
-
export const Tabs = ({ ...tabsProps }) => {
|
|
6
|
+
export const Tabs = ({ className, ...tabsProps }) => {
|
|
5
7
|
const { containerRef } = useScrollToActiveElement();
|
|
6
|
-
return (_jsx(Container, { children: _jsxs(Wrapper, { children: [_jsx(StyledTabs, { ...tabsProps, ref: containerRef }), _jsx(Divider, {})] }) }));
|
|
8
|
+
return (_jsx(Container, { children: _jsxs(Wrapper, { children: [_jsx(StyledTabs, { ...tabsProps, ref: containerRef, className: classNames(className, tabsClassnames.root) }), _jsx(Divider, {})] }) }));
|
|
7
9
|
};
|