@megafon/ui-core 3.9.0 → 3.11.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.
- package/CHANGELOG.md +39 -0
- package/dist/es/components/Banner/Banner.d.ts +2 -0
- package/dist/es/components/Banner/Banner.js +46 -20
- package/dist/es/components/Button/Button.css +37 -0
- package/dist/es/components/Button/Button.d.ts +2 -0
- package/dist/es/components/Button/Button.js +10 -3
- package/dist/es/components/Notification/Notification.css +131 -33
- package/dist/es/components/Notification/Notification.d.ts +20 -0
- package/dist/es/components/Notification/Notification.js +176 -10
- package/dist/lib/components/Banner/Banner.d.ts +2 -0
- package/dist/lib/components/Banner/Banner.js +46 -20
- package/dist/lib/components/Button/Button.css +37 -0
- package/dist/lib/components/Button/Button.d.ts +2 -0
- package/dist/lib/components/Button/Button.js +10 -3
- package/dist/lib/components/Notification/Notification.css +131 -33
- package/dist/lib/components/Notification/Notification.d.ts +20 -0
- package/dist/lib/components/Notification/Notification.js +179 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,45 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.11.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.10.1...@megafon/ui-core@3.11.0) (2022-06-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **button:** fix font styles for extra small size ([f475b05](https://github.com/MegafonWebLab/megafon-ui/commit/f475b05ab9d62aa56645fb90ccdef88996e72a70))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **button:** add prop ellipsis ([1978277](https://github.com/MegafonWebLab/megafon-ui/commit/1978277a918cb680e32259042c1a7e3c58056b1b))
|
|
17
|
+
* **notification:** add ability to display button and collapse ([a5fe2f0](https://github.com/MegafonWebLab/megafon-ui/commit/a5fe2f0730b71469c2fb06a148b0e4574adb2d7b))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [3.10.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.10.0...@megafon/ui-core@3.10.1) (2022-06-07)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* **banner:** fix bug with hover on autoplay ([93271d8](https://github.com/MegafonWebLab/megafon-ui/commit/93271d8c8f9dd900c031d41f89207f61c41db063))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# [3.10.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.9.0...@megafon/ui-core@3.10.0) (2022-05-30)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
* **banner:** add new prop 'pauseOnHover' ([ac654c3](https://github.com/MegafonWebLab/megafon-ui/commit/ac654c3c23821a5d29ffd5cd91ff7337b3d087c1))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
6
45
|
# [3.9.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.8.0...@megafon/ui-core@3.9.0) (2022-05-27)
|
|
7
46
|
|
|
8
47
|
|
|
@@ -32,6 +32,8 @@ export interface IBannerProps {
|
|
|
32
32
|
autoPlay?: boolean;
|
|
33
33
|
/** Задержка автоматической прокрутки */
|
|
34
34
|
autoPlayDelay?: number;
|
|
35
|
+
/** Пауза автоматической прокрутки при наведении курсора на компонент */
|
|
36
|
+
pauseOnHover?: boolean;
|
|
35
37
|
/** Цветовая тема навигации */
|
|
36
38
|
navTheme?: NavThemeType;
|
|
37
39
|
/** Обработчик клика по стрелке "вперед" (должен быть обернут в useCallback) */
|
|
@@ -49,7 +49,9 @@ var Banner = function Banner(_ref) {
|
|
|
49
49
|
onPrevClick = _ref.onPrevClick,
|
|
50
50
|
onDotClick = _ref.onDotClick,
|
|
51
51
|
onChange = _ref.onChange,
|
|
52
|
-
dataAttrs = _ref.dataAttrs
|
|
52
|
+
dataAttrs = _ref.dataAttrs,
|
|
53
|
+
_ref$pauseOnHover = _ref.pauseOnHover,
|
|
54
|
+
pauseOnHover = _ref$pauseOnHover === void 0 ? false : _ref$pauseOnHover;
|
|
53
55
|
|
|
54
56
|
var _React$useState = React.useState(),
|
|
55
57
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -69,29 +71,42 @@ var Banner = function Banner(_ref) {
|
|
|
69
71
|
var _React$useState7 = React.useState(autoPlay),
|
|
70
72
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
71
73
|
isAutoPlaying = _React$useState8[0],
|
|
72
|
-
|
|
74
|
+
setAutoPlaying = _React$useState8[1];
|
|
73
75
|
|
|
74
76
|
var _React$useState9 = React.useState(0),
|
|
75
77
|
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
76
78
|
activeIndex = _React$useState10[0],
|
|
77
79
|
setActiveIndex = _React$useState10[1];
|
|
78
80
|
|
|
81
|
+
var _React$useState11 = React.useState(autoPlayDelay),
|
|
82
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
83
|
+
delay = _React$useState12[0],
|
|
84
|
+
setDelay = _React$useState12[1];
|
|
85
|
+
|
|
86
|
+
var _React$useState13 = React.useState(false),
|
|
87
|
+
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
|
88
|
+
isIncreasedDelay = _React$useState14[0],
|
|
89
|
+
setIsIncreasedDelay = _React$useState14[1];
|
|
90
|
+
|
|
79
91
|
var showDotTimer = loop ? isAutoPlaying : isAutoPlaying && !isEnd;
|
|
80
|
-
var dotTimerDelay =
|
|
92
|
+
var dotTimerDelay = delay / 1000;
|
|
81
93
|
var navArrowTheme = navTheme === NavTheme.DARK ? ArrowTheme.DARK : ArrowTheme.PURPLE;
|
|
94
|
+
var rootRef = React.useRef(null);
|
|
82
95
|
var increaseAutoplayDelay = React.useCallback(function (_ref2) {
|
|
83
96
|
var params = _ref2.params,
|
|
84
97
|
autoplay = _ref2.autoplay;
|
|
85
98
|
|
|
86
|
-
if (_typeof(params.autoplay) !== 'object' || !
|
|
99
|
+
if (_typeof(params.autoplay) !== 'object' || !autoPlay) {
|
|
87
100
|
return;
|
|
88
101
|
}
|
|
89
102
|
|
|
90
103
|
autoplay.stop(); // eslint-disable-next-line no-param-reassign
|
|
91
104
|
|
|
92
105
|
params.autoplay.delay = autoPlayDelay * 3;
|
|
106
|
+
setDelay(autoPlayDelay * 3);
|
|
107
|
+
setIsIncreasedDelay(true);
|
|
93
108
|
autoplay.start();
|
|
94
|
-
}, [autoPlayDelay]);
|
|
109
|
+
}, [autoPlay, autoPlayDelay]);
|
|
95
110
|
var handlePrevClick = React.useCallback(function () {
|
|
96
111
|
if (!swiperInstance) {
|
|
97
112
|
return;
|
|
@@ -99,8 +114,8 @@ var Banner = function Banner(_ref) {
|
|
|
99
114
|
|
|
100
115
|
swiperInstance.slidePrev();
|
|
101
116
|
onPrevClick === null || onPrevClick === void 0 ? void 0 : onPrevClick(swiperInstance.realIndex);
|
|
102
|
-
increaseAutoplayDelay(swiperInstance);
|
|
103
|
-
}, [swiperInstance, onPrevClick, increaseAutoplayDelay]);
|
|
117
|
+
!isIncreasedDelay && increaseAutoplayDelay(swiperInstance);
|
|
118
|
+
}, [swiperInstance, onPrevClick, isIncreasedDelay, increaseAutoplayDelay]);
|
|
104
119
|
var handleNextClick = React.useCallback(function () {
|
|
105
120
|
if (!swiperInstance) {
|
|
106
121
|
return;
|
|
@@ -108,8 +123,8 @@ var Banner = function Banner(_ref) {
|
|
|
108
123
|
|
|
109
124
|
swiperInstance.slideNext();
|
|
110
125
|
onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(swiperInstance.realIndex);
|
|
111
|
-
increaseAutoplayDelay(swiperInstance);
|
|
112
|
-
}, [swiperInstance, onNextClick, increaseAutoplayDelay]);
|
|
126
|
+
!isIncreasedDelay && increaseAutoplayDelay(swiperInstance);
|
|
127
|
+
}, [swiperInstance, onNextClick, isIncreasedDelay, increaseAutoplayDelay]);
|
|
113
128
|
var handleDotClick = React.useCallback(function (index) {
|
|
114
129
|
if (!swiperInstance) {
|
|
115
130
|
return;
|
|
@@ -122,11 +137,8 @@ var Banner = function Banner(_ref) {
|
|
|
122
137
|
}
|
|
123
138
|
|
|
124
139
|
onDotClick === null || onDotClick === void 0 ? void 0 : onDotClick(swiperInstance.realIndex);
|
|
125
|
-
increaseAutoplayDelay(swiperInstance);
|
|
126
|
-
}, [swiperInstance, loop, onDotClick, increaseAutoplayDelay]);
|
|
127
|
-
var handleSwiper = React.useCallback(function (swiper) {
|
|
128
|
-
setSwiperInstance(swiper);
|
|
129
|
-
}, []);
|
|
140
|
+
!isIncreasedDelay && increaseAutoplayDelay(swiperInstance);
|
|
141
|
+
}, [swiperInstance, loop, onDotClick, isIncreasedDelay, increaseAutoplayDelay]);
|
|
130
142
|
var handleReachBeginning = React.useCallback(function () {
|
|
131
143
|
setBeginning(true);
|
|
132
144
|
}, []);
|
|
@@ -148,24 +160,37 @@ var Banner = function Banner(_ref) {
|
|
|
148
160
|
setActiveIndex(realIndex);
|
|
149
161
|
onChange === null || onChange === void 0 ? void 0 : onChange(realIndex);
|
|
150
162
|
}, [onChange]);
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
163
|
+
React.useEffect(function () {
|
|
164
|
+
var rootElement = rootRef.current;
|
|
165
|
+
|
|
166
|
+
if (!pauseOnHover || !autoPlay) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener('mouseenter', function () {
|
|
171
|
+
swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.stop();
|
|
172
|
+
setAutoPlaying(false);
|
|
173
|
+
});
|
|
174
|
+
rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener('mouseleave', function () {
|
|
175
|
+
swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay.start();
|
|
176
|
+
setAutoPlaying(true);
|
|
177
|
+
});
|
|
178
|
+
}, [autoPlay, pauseOnHover, swiperInstance === null || swiperInstance === void 0 ? void 0 : swiperInstance.autoplay]);
|
|
154
179
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
155
180
|
className: cn({
|
|
156
181
|
'nav-theme': navTheme
|
|
157
|
-
}, className)
|
|
182
|
+
}, className),
|
|
183
|
+
ref: rootRef
|
|
158
184
|
}), /*#__PURE__*/React.createElement(Swiper, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.swiper), {
|
|
159
185
|
className: cn('swiper'),
|
|
160
186
|
loop: loop,
|
|
161
187
|
autoplay: autoPlay ? getAutoPlayConfig(autoPlayDelay) : false,
|
|
162
188
|
watchSlidesVisibility: true,
|
|
163
|
-
onSwiper:
|
|
189
|
+
onSwiper: setSwiperInstance,
|
|
164
190
|
onReachBeginning: handleReachBeginning,
|
|
165
191
|
onReachEnd: handleReachEnd,
|
|
166
192
|
onFromEdge: handleFromEdge,
|
|
167
193
|
onSlideChange: handleSlideChange,
|
|
168
|
-
onAutoplayStop: handleAutoplayStop,
|
|
169
194
|
onTouchEnd: increaseAutoplayDelay
|
|
170
195
|
}), React.Children.map(children, function (child, i) {
|
|
171
196
|
return /*#__PURE__*/React.createElement(SwiperSlide, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
|
|
@@ -232,6 +257,7 @@ Banner.propTypes = {
|
|
|
232
257
|
}),
|
|
233
258
|
autoPlay: PropTypes.bool,
|
|
234
259
|
autoPlayDelay: PropTypes.number,
|
|
260
|
+
pauseOnHover: PropTypes.bool,
|
|
235
261
|
navTheme: PropTypes.oneOf(Object.values(NavTheme)),
|
|
236
262
|
onNextClick: PropTypes.func,
|
|
237
263
|
onPrevClick: PropTypes.func,
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
padding: 0 32px;
|
|
9
9
|
border: none;
|
|
10
10
|
border-radius: 30px;
|
|
11
|
+
overflow: hidden;
|
|
11
12
|
color: var(--stcWhite);
|
|
12
13
|
font-weight: 500;
|
|
13
14
|
text-align: center;
|
|
@@ -21,7 +22,12 @@
|
|
|
21
22
|
appearance: none;
|
|
22
23
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
23
24
|
}
|
|
25
|
+
.mfui-button_size-all_extra-small {
|
|
26
|
+
padding: 0 16px;
|
|
27
|
+
}
|
|
24
28
|
.mfui-button_size-all_extra-small .mfui-button__inner {
|
|
29
|
+
font-size: 12px;
|
|
30
|
+
line-height: 16px;
|
|
25
31
|
min-width: 26px;
|
|
26
32
|
height: 26px;
|
|
27
33
|
}
|
|
@@ -54,7 +60,12 @@
|
|
|
54
60
|
height: 40px;
|
|
55
61
|
}
|
|
56
62
|
@media screen and (min-width: 1280px) {
|
|
63
|
+
.mfui-button_size-wide_extra-small {
|
|
64
|
+
padding: 0 16px;
|
|
65
|
+
}
|
|
57
66
|
.mfui-button_size-wide_extra-small .mfui-button__inner {
|
|
67
|
+
font-size: 12px;
|
|
68
|
+
line-height: 16px;
|
|
58
69
|
min-width: 26px;
|
|
59
70
|
height: 26px;
|
|
60
71
|
}
|
|
@@ -88,7 +99,12 @@
|
|
|
88
99
|
}
|
|
89
100
|
}
|
|
90
101
|
@media screen and (min-width: 1024px) {
|
|
102
|
+
.mfui-button_size-desktop_extra-small {
|
|
103
|
+
padding: 0 16px;
|
|
104
|
+
}
|
|
91
105
|
.mfui-button_size-desktop_extra-small .mfui-button__inner {
|
|
106
|
+
font-size: 12px;
|
|
107
|
+
line-height: 16px;
|
|
92
108
|
min-width: 26px;
|
|
93
109
|
height: 26px;
|
|
94
110
|
}
|
|
@@ -122,7 +138,12 @@
|
|
|
122
138
|
}
|
|
123
139
|
}
|
|
124
140
|
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
|
141
|
+
.mfui-button_size-tablet_extra-small {
|
|
142
|
+
padding: 0 16px;
|
|
143
|
+
}
|
|
125
144
|
.mfui-button_size-tablet_extra-small .mfui-button__inner {
|
|
145
|
+
font-size: 12px;
|
|
146
|
+
line-height: 16px;
|
|
126
147
|
min-width: 26px;
|
|
127
148
|
height: 26px;
|
|
128
149
|
}
|
|
@@ -156,7 +177,12 @@
|
|
|
156
177
|
}
|
|
157
178
|
}
|
|
158
179
|
@media screen and (max-width: 767px) {
|
|
180
|
+
.mfui-button_size-mobile_extra-small {
|
|
181
|
+
padding: 0 16px;
|
|
182
|
+
}
|
|
159
183
|
.mfui-button_size-mobile_extra-small .mfui-button__inner {
|
|
184
|
+
font-size: 12px;
|
|
185
|
+
line-height: 16px;
|
|
160
186
|
min-width: 26px;
|
|
161
187
|
height: 26px;
|
|
162
188
|
}
|
|
@@ -213,6 +239,11 @@
|
|
|
213
239
|
.mfui-button__text {
|
|
214
240
|
margin-bottom: 2px;
|
|
215
241
|
}
|
|
242
|
+
.mfui-button__text_ellipsis {
|
|
243
|
+
overflow: hidden;
|
|
244
|
+
white-space: nowrap;
|
|
245
|
+
text-overflow: ellipsis;
|
|
246
|
+
}
|
|
216
247
|
.mfui-button__content {
|
|
217
248
|
display: -webkit-box;
|
|
218
249
|
display: -ms-flexbox;
|
|
@@ -221,6 +252,12 @@
|
|
|
221
252
|
-ms-flex-align: center;
|
|
222
253
|
align-items: center;
|
|
223
254
|
}
|
|
255
|
+
.mfui-button__content_ellipsis {
|
|
256
|
+
width: inherit;
|
|
257
|
+
max-width: -webkit-fit-content;
|
|
258
|
+
max-width: -moz-fit-content;
|
|
259
|
+
max-width: fit-content;
|
|
260
|
+
}
|
|
224
261
|
.mfui-button__icon-arrow {
|
|
225
262
|
width: 32px;
|
|
226
263
|
height: 32px;
|
|
@@ -74,6 +74,8 @@ export interface IButtonProps {
|
|
|
74
74
|
disabled?: boolean;
|
|
75
75
|
/** Ссылка на элемент */
|
|
76
76
|
buttonRef?: Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
77
|
+
/** Обрезать текст при недостаточной ширине и добавлять многоточие */
|
|
78
|
+
ellipsis?: boolean;
|
|
77
79
|
/** Обработчик клика по кнопке */
|
|
78
80
|
onClick?: (e: React.SyntheticEvent<EventTarget>) => void;
|
|
79
81
|
}
|
|
@@ -81,6 +81,8 @@ var Button = function Button(_ref) {
|
|
|
81
81
|
icon = _ref.icon,
|
|
82
82
|
disabled = _ref.disabled,
|
|
83
83
|
children = _ref.children,
|
|
84
|
+
_ref$ellipsis = _ref.ellipsis,
|
|
85
|
+
ellipsis = _ref$ellipsis === void 0 ? false : _ref$ellipsis,
|
|
84
86
|
onClick = _ref.onClick,
|
|
85
87
|
dataAttrs = _ref.dataAttrs,
|
|
86
88
|
buttonRef = _ref.buttonRef;
|
|
@@ -123,15 +125,19 @@ var Button = function Button(_ref) {
|
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.content), {
|
|
126
|
-
className: cn('content',
|
|
128
|
+
className: cn('content', {
|
|
129
|
+
ellipsis: ellipsis
|
|
130
|
+
}, contentClassName)
|
|
127
131
|
}), icon && /*#__PURE__*/React.createElement("div", {
|
|
128
132
|
className: cn('icon')
|
|
129
133
|
}, icon), children && /*#__PURE__*/React.createElement("span", {
|
|
130
|
-
className: cn('text'
|
|
134
|
+
className: cn('text', {
|
|
135
|
+
ellipsis: ellipsis
|
|
136
|
+
})
|
|
131
137
|
}, children), !icon && showArrow && /*#__PURE__*/React.createElement(Arrow, {
|
|
132
138
|
className: cn('icon-arrow')
|
|
133
139
|
}));
|
|
134
|
-
}, [children, icon, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.content, contentClassName, showArrow]);
|
|
140
|
+
}, [children, icon, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.content, contentClassName, showArrow, ellipsis]);
|
|
135
141
|
var contentType = React.useMemo(function () {
|
|
136
142
|
switch (true) {
|
|
137
143
|
case icon && !children:
|
|
@@ -238,6 +244,7 @@ Button.propTypes = {
|
|
|
238
244
|
buttonRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
|
239
245
|
current: PropTypes.elementType
|
|
240
246
|
}), PropTypes.any])]),
|
|
247
|
+
ellipsis: PropTypes.bool,
|
|
241
248
|
onClick: PropTypes.func
|
|
242
249
|
};
|
|
243
250
|
export default Button;
|
|
@@ -7,17 +7,13 @@ h5 {
|
|
|
7
7
|
}
|
|
8
8
|
.mfui-notification {
|
|
9
9
|
position: relative;
|
|
10
|
-
padding:
|
|
10
|
+
padding: 20px 12px 20px 32px;
|
|
11
|
+
border-radius: 12px;
|
|
11
12
|
background-color: var(--base);
|
|
12
13
|
}
|
|
13
|
-
@media screen and (
|
|
14
|
+
@media screen and (max-width: 767px) {
|
|
14
15
|
.mfui-notification {
|
|
15
|
-
padding:
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
@media screen and (min-width: 1024px) {
|
|
19
|
-
.mfui-notification {
|
|
20
|
-
padding: 20px 32px;
|
|
16
|
+
padding: 16px 12px;
|
|
21
17
|
}
|
|
22
18
|
}
|
|
23
19
|
.mfui-notification__container {
|
|
@@ -38,14 +34,43 @@ h5 {
|
|
|
38
34
|
padding-right: 20px;
|
|
39
35
|
}
|
|
40
36
|
.mfui-notification__text {
|
|
41
|
-
font-size:
|
|
42
|
-
line-height:
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
line-height: 16px;
|
|
39
|
+
position: relative;
|
|
43
40
|
max-width: 100%;
|
|
44
41
|
margin: 0;
|
|
45
42
|
color: var(--content);
|
|
43
|
+
-webkit-transition: height 300ms;
|
|
44
|
+
transition: height 300ms;
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
@media screen and (min-width: 768px) {
|
|
47
|
+
.mfui-notification__text {
|
|
48
|
+
font-size: 15px;
|
|
49
|
+
line-height: 24px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
.mfui-notification__short-text {
|
|
53
|
+
position: static;
|
|
54
|
+
visibility: visible;
|
|
55
|
+
opacity: 1;
|
|
56
|
+
-webkit-transition: opacity 200ms;
|
|
57
|
+
transition: opacity 200ms;
|
|
58
|
+
}
|
|
59
|
+
.mfui-notification__short-text_hidden,
|
|
60
|
+
.mfui-notification__full-text {
|
|
61
|
+
position: absolute;
|
|
62
|
+
top: 0;
|
|
63
|
+
visibility: hidden;
|
|
64
|
+
opacity: 0;
|
|
65
|
+
-webkit-transition: opacity 300ms, visibility 300ms;
|
|
66
|
+
transition: opacity 300ms, visibility 300ms;
|
|
67
|
+
}
|
|
68
|
+
.mfui-notification__full-text_visible {
|
|
69
|
+
position: static;
|
|
70
|
+
visibility: visible;
|
|
71
|
+
opacity: 1;
|
|
72
|
+
-webkit-transition: opacity 200ms;
|
|
73
|
+
transition: opacity 200ms;
|
|
49
74
|
}
|
|
50
75
|
.mfui-notification__content {
|
|
51
76
|
display: -webkit-box;
|
|
@@ -61,23 +86,8 @@ h5 {
|
|
|
61
86
|
-ms-flex-item-align: center;
|
|
62
87
|
align-self: center;
|
|
63
88
|
width: 100%;
|
|
64
|
-
max-width: 212px;
|
|
65
89
|
margin-left: 12px;
|
|
66
|
-
|
|
67
|
-
@media screen and (min-width: 768px) {
|
|
68
|
-
.mfui-notification__content {
|
|
69
|
-
max-width: 540px;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
@media screen and (min-width: 1024px) {
|
|
73
|
-
.mfui-notification__content {
|
|
74
|
-
max-width: 640px;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
@media screen and (min-width: 1280px) {
|
|
78
|
-
.mfui-notification__content {
|
|
79
|
-
max-width: 840px;
|
|
80
|
-
}
|
|
90
|
+
overflow: hidden;
|
|
81
91
|
}
|
|
82
92
|
.mfui-notification__icon-container {
|
|
83
93
|
display: -webkit-box;
|
|
@@ -104,6 +114,45 @@ h5 {
|
|
|
104
114
|
min-width: 32px;
|
|
105
115
|
height: 32px;
|
|
106
116
|
}
|
|
117
|
+
.mfui-notification__text-container {
|
|
118
|
+
width: 85%;
|
|
119
|
+
margin-right: 56px;
|
|
120
|
+
}
|
|
121
|
+
@media screen and (min-width: 768px) {
|
|
122
|
+
.mfui-notification__text-container {
|
|
123
|
+
margin-right: 72px;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
.mfui-notification__bottom {
|
|
127
|
+
z-index: 1;
|
|
128
|
+
display: -webkit-box;
|
|
129
|
+
display: -ms-flexbox;
|
|
130
|
+
display: flex;
|
|
131
|
+
gap: 16px;
|
|
132
|
+
-webkit-box-align: end;
|
|
133
|
+
-ms-flex-align: end;
|
|
134
|
+
align-items: flex-end;
|
|
135
|
+
-webkit-box-pack: justify;
|
|
136
|
+
-ms-flex-pack: justify;
|
|
137
|
+
justify-content: space-between;
|
|
138
|
+
width: 100%;
|
|
139
|
+
margin-top: 8px;
|
|
140
|
+
}
|
|
141
|
+
@media screen and (min-width: 768px) {
|
|
142
|
+
.mfui-notification__bottom {
|
|
143
|
+
gap: 20px;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
.mfui-notification__bottom-block {
|
|
147
|
+
display: -webkit-box;
|
|
148
|
+
display: -ms-flexbox;
|
|
149
|
+
display: flex;
|
|
150
|
+
gap: 16px;
|
|
151
|
+
overflow: hidden;
|
|
152
|
+
}
|
|
153
|
+
.mfui-notification__bottom_has-button {
|
|
154
|
+
margin-top: 12px;
|
|
155
|
+
}
|
|
107
156
|
.mfui-notification__link {
|
|
108
157
|
font-size: 15px;
|
|
109
158
|
line-height: 24px;
|
|
@@ -114,16 +163,58 @@ h5 {
|
|
|
114
163
|
-webkit-box-align: center;
|
|
115
164
|
-ms-flex-align: center;
|
|
116
165
|
align-items: center;
|
|
117
|
-
margin-top: 8px;
|
|
118
166
|
cursor: pointer;
|
|
119
167
|
}
|
|
120
|
-
|
|
168
|
+
@media screen and (max-width: 767px) {
|
|
169
|
+
.mfui-notification__link {
|
|
170
|
+
font-size: 12px;
|
|
171
|
+
line-height: 16px;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
.mfui-notification__link-arrow,
|
|
175
|
+
.mfui-notification__collapse-arrow {
|
|
121
176
|
width: 20px;
|
|
122
177
|
min-width: 20px;
|
|
123
178
|
height: 20px;
|
|
124
|
-
margin-top: 4px;
|
|
125
179
|
fill: var(--systemBlue);
|
|
126
180
|
}
|
|
181
|
+
.mfui-notification__link-arrow {
|
|
182
|
+
margin-bottom: -2px;
|
|
183
|
+
}
|
|
184
|
+
@media screen and (min-width: 768px) {
|
|
185
|
+
.mfui-notification__link-arrow {
|
|
186
|
+
margin-bottom: -4px;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
.mfui-notification__collapse-button {
|
|
190
|
+
font-size: 15px;
|
|
191
|
+
line-height: 24px;
|
|
192
|
+
font-weight: 500;
|
|
193
|
+
display: -webkit-box;
|
|
194
|
+
display: -ms-flexbox;
|
|
195
|
+
display: flex;
|
|
196
|
+
-webkit-box-align: center;
|
|
197
|
+
-ms-flex-align: center;
|
|
198
|
+
align-items: center;
|
|
199
|
+
height: -webkit-fit-content;
|
|
200
|
+
height: -moz-fit-content;
|
|
201
|
+
height: fit-content;
|
|
202
|
+
padding: 0;
|
|
203
|
+
border: none;
|
|
204
|
+
color: var(--systemBlue);
|
|
205
|
+
text-align: right;
|
|
206
|
+
background-color: transparent;
|
|
207
|
+
cursor: pointer;
|
|
208
|
+
}
|
|
209
|
+
@media screen and (max-width: 767px) {
|
|
210
|
+
.mfui-notification__collapse-button {
|
|
211
|
+
font-size: 12px;
|
|
212
|
+
line-height: 16px;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
.mfui-notification__collapse_hidden {
|
|
216
|
+
visibility: hidden;
|
|
217
|
+
}
|
|
127
218
|
.mfui-notification__close {
|
|
128
219
|
position: absolute;
|
|
129
220
|
top: 8px;
|
|
@@ -153,10 +244,17 @@ h5 {
|
|
|
153
244
|
height: 32px;
|
|
154
245
|
}
|
|
155
246
|
}
|
|
247
|
+
.mfui-notification__close:hover {
|
|
248
|
+
background-color: var(--spbSky1);
|
|
249
|
+
}
|
|
250
|
+
.mfui-notification__close:active {
|
|
251
|
+
background-color: var(--spbSky2);
|
|
252
|
+
}
|
|
156
253
|
.mfui-notification__close-icon {
|
|
157
254
|
width: 10px;
|
|
158
255
|
height: 10px;
|
|
159
|
-
|
|
256
|
+
opacity: 0.5;
|
|
257
|
+
fill: var(--content);
|
|
160
258
|
}
|
|
161
259
|
.mfui-notification_type_error .mfui-notification__icon-container {
|
|
162
260
|
background-color: var(--fury20);
|
|
@@ -219,7 +317,7 @@ h5 {
|
|
|
219
317
|
.mfui-notification_colored.mfui-notification_type_error .mfui-notification__link {
|
|
220
318
|
color: var(--stcWhite);
|
|
221
319
|
}
|
|
222
|
-
.mfui-notification_colored.mfui-notification_type_error .mfui-
|
|
320
|
+
.mfui-notification_colored.mfui-notification_type_error .mfui-notification__link-arrow {
|
|
223
321
|
fill: var(--stcWhite);
|
|
224
322
|
}
|
|
225
323
|
.mfui-notification_colored.mfui-notification_type_error .mfui-notification__icon-container {
|
|
@@ -33,6 +33,20 @@ export interface INotificationProps {
|
|
|
33
33
|
hasCloseButton?: boolean;
|
|
34
34
|
/** Заголовок */
|
|
35
35
|
title?: string;
|
|
36
|
+
/** Короткий текст, отображаемый при закрытом расхлопе */
|
|
37
|
+
shortText?: string;
|
|
38
|
+
/** заголовок закрытого расхлопа */
|
|
39
|
+
closeCollapseTitle?: string;
|
|
40
|
+
/** заголовок открытого расхлопа */
|
|
41
|
+
openCollapseTitle?: string;
|
|
42
|
+
/** Управление состоянием открыт/закрыт расхлопа "Подробнее" */
|
|
43
|
+
isCollapseOpened?: boolean;
|
|
44
|
+
/** Текст кнопки */
|
|
45
|
+
buttonText?: string;
|
|
46
|
+
/** Лоадер кнопки */
|
|
47
|
+
buttonLoader?: boolean;
|
|
48
|
+
/** Заблокировать кнопку */
|
|
49
|
+
buttonDisable?: boolean;
|
|
36
50
|
/** Текст ссылки внизу уведомления */
|
|
37
51
|
link?: string;
|
|
38
52
|
/** rel - аргумент тега <a> для ссылки */
|
|
@@ -50,11 +64,17 @@ export interface INotificationProps {
|
|
|
50
64
|
text?: Record<string, string>;
|
|
51
65
|
link?: Record<string, string>;
|
|
52
66
|
close?: Record<string, string>;
|
|
67
|
+
button?: Record<string, string>;
|
|
68
|
+
collapseButton?: Record<string, string>;
|
|
53
69
|
};
|
|
54
70
|
/** Обработчик на закрытие */
|
|
55
71
|
onClose?: () => void;
|
|
56
72
|
/** Обработчик клика по ссылке */
|
|
57
73
|
onLinkClick?: () => void;
|
|
74
|
+
/** Обработчик клика по кнопке */
|
|
75
|
+
onButtonClick?: () => void;
|
|
76
|
+
/** Обработчик клика по кнопке расхлопа */
|
|
77
|
+
onCollapseButtonClick?: (value: boolean) => void;
|
|
58
78
|
}
|
|
59
79
|
declare const Notification: React.FC<INotificationProps>;
|
|
60
80
|
export default Notification;
|