@megafon/ui-core 3.10.1 → 3.12.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/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.12.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.12.0...@megafon/ui-core@3.12.1) (2022-08-02)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **carousel:** popup input focus ([b1c117a](https://github.com/MegafonWebLab/megafon-ui/commit/b1c117ac1ed560182e61133393ec65f14527958f))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.12.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.11.0...@megafon/ui-core@3.12.0) (2022-06-28)
18
+
19
+
20
+ ### Features
21
+
22
+ * **tab:** add data-attribute for inner element ([43e58e1](https://github.com/MegafonWebLab/megafon-ui/commit/43e58e12b8da661020f4b48f55245492c21ad376))
23
+
24
+
25
+
26
+
27
+
28
+ # [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)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **button:** fix font styles for extra small size ([f475b05](https://github.com/MegafonWebLab/megafon-ui/commit/f475b05ab9d62aa56645fb90ccdef88996e72a70))
34
+
35
+
36
+ ### Features
37
+
38
+ * **button:** add prop ellipsis ([1978277](https://github.com/MegafonWebLab/megafon-ui/commit/1978277a918cb680e32259042c1a7e3c58056b1b))
39
+ * **notification:** add ability to display button and collapse ([a5fe2f0](https://github.com/MegafonWebLab/megafon-ui/commit/a5fe2f0730b71469c2fb06a148b0e4574adb2d7b))
40
+
41
+
42
+
43
+
44
+
6
45
  ## [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)
7
46
 
8
47
 
@@ -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', contentClassName)
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;
@@ -219,7 +219,9 @@ var Carousel = function Carousel(_ref) {
219
219
  };
220
220
 
221
221
  var disableFocusOnSlideClick = function disableFocusOnSlideClick(e) {
222
- e.nativeEvent.preventDefault();
222
+ if (e.nativeEvent.target.closest(".".concat(cn()))) {
223
+ e.nativeEvent.preventDefault();
224
+ }
223
225
  };
224
226
 
225
227
  React.useEffect(function () {
@@ -7,17 +7,13 @@ h5 {
7
7
  }
8
8
  .mfui-notification {
9
9
  position: relative;
10
- padding: 16px 12px;
10
+ padding: 20px 12px 20px 32px;
11
+ border-radius: 12px;
11
12
  background-color: var(--base);
12
13
  }
13
- @media screen and (min-width: 768px) {
14
+ @media screen and (max-width: 767px) {
14
15
  .mfui-notification {
15
- padding: 20px 28px;
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: 15px;
42
- line-height: 24px;
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
- .mfui-notification__text_close-padding {
48
- padding-right: 20px;
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
- .mfui-notification__right-arrow {
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
- fill: var(--stcBlack50);
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-notification__right-arrow {
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;