@megafon/ui-core 2.0.0 → 2.1.3

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 (55) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/es/colors/ColorItem/ColorItem.css +52 -0
  3. package/dist/es/colors/ColorItem/ColorItem.d.ts +12 -0
  4. package/dist/es/colors/ColorItem/ColorItem.js +35 -0
  5. package/dist/es/colors/Colors.css +203 -32
  6. package/dist/es/colors/Colors.js +243 -35
  7. package/dist/es/colors/colorsData.d.ts +20 -7
  8. package/dist/es/colors/colorsData.js +204 -61
  9. package/dist/es/components/Banner/BannerDot.css +2 -2
  10. package/dist/es/components/Button/Button.css +11 -11
  11. package/dist/es/components/Button/Button.js +11 -4
  12. package/dist/es/components/Carousel/Carousel.css +1 -1
  13. package/dist/es/components/Carousel/Carousel.js +6 -1
  14. package/dist/es/components/ContentArea/ContentArea.css +4 -0
  15. package/dist/es/components/ContentArea/ContentArea.d.ts +13 -9
  16. package/dist/es/components/ContentArea/ContentArea.js +39 -6
  17. package/dist/es/components/Counter/Counter.css +3 -3
  18. package/dist/es/components/NavArrow/NavArrow.css +1 -1
  19. package/dist/es/components/Notification/Notification.css +10 -19
  20. package/dist/es/components/Paragraph/Paragraph.css +2 -0
  21. package/dist/es/components/Paragraph/Paragraph.d.ts +17 -1
  22. package/dist/es/components/Paragraph/Paragraph.js +40 -1
  23. package/dist/es/components/Tabs/Tab.d.ts +2 -0
  24. package/dist/es/components/Tabs/Tabs.css +2 -2
  25. package/dist/es/components/Tabs/Tabs.d.ts +2 -0
  26. package/dist/es/components/Tabs/Tabs.js +12 -2
  27. package/dist/es/components/TextField/TextField.js +8 -3
  28. package/dist/lib/colors/ColorItem/ColorItem.css +52 -0
  29. package/dist/lib/colors/ColorItem/ColorItem.d.ts +12 -0
  30. package/dist/lib/colors/ColorItem/ColorItem.js +50 -0
  31. package/dist/lib/colors/Colors.css +203 -32
  32. package/dist/lib/colors/Colors.js +250 -36
  33. package/dist/lib/colors/colorsData.d.ts +20 -7
  34. package/dist/lib/colors/colorsData.js +204 -61
  35. package/dist/lib/components/Banner/BannerDot.css +2 -2
  36. package/dist/lib/components/Button/Button.css +11 -11
  37. package/dist/lib/components/Button/Button.js +12 -4
  38. package/dist/lib/components/Carousel/Carousel.css +1 -1
  39. package/dist/lib/components/Carousel/Carousel.js +6 -1
  40. package/dist/lib/components/ContentArea/ContentArea.css +4 -0
  41. package/dist/lib/components/ContentArea/ContentArea.d.ts +13 -9
  42. package/dist/lib/components/ContentArea/ContentArea.js +42 -6
  43. package/dist/lib/components/Counter/Counter.css +3 -3
  44. package/dist/lib/components/NavArrow/NavArrow.css +1 -1
  45. package/dist/lib/components/Notification/Notification.css +10 -19
  46. package/dist/lib/components/Paragraph/Paragraph.css +2 -0
  47. package/dist/lib/components/Paragraph/Paragraph.d.ts +17 -1
  48. package/dist/lib/components/Paragraph/Paragraph.js +44 -1
  49. package/dist/lib/components/Tabs/Tab.d.ts +2 -0
  50. package/dist/lib/components/Tabs/Tabs.css +2 -2
  51. package/dist/lib/components/Tabs/Tabs.d.ts +2 -0
  52. package/dist/lib/components/Tabs/Tabs.js +12 -2
  53. package/dist/lib/components/TextField/TextField.js +8 -3
  54. package/package.json +4 -3
  55. package/styles/base.less +87 -39
@@ -231,9 +231,9 @@ h5 {
231
231
  fill: #FFFFFF;
232
232
  }
233
233
  .mfui-button_no-touch.mfui-button_type_primary.mfui-button_theme_purple:not(.mfui-button_loading):hover {
234
- background-color: #A500BF;
235
- -webkit-box-shadow: inset 0 0 0 1px #A500BF;
236
- box-shadow: inset 0 0 0 1px #A500BF;
234
+ background-color: #534455;
235
+ -webkit-box-shadow: inset 0 0 0 1px #534455;
236
+ box-shadow: inset 0 0 0 1px #534455;
237
237
  }
238
238
  .mfui-button_no-touch.mfui-button_type_primary.mfui-button_theme_purple:not(.mfui-button_loading):active {
239
239
  background-color: #404D46;
@@ -332,7 +332,7 @@ h5 {
332
332
  .mfui-button.mfui-button_no-touch.mfui-button_type_primary.mfui-button_disabled,
333
333
  .mfui-button.mfui-button_no-touch.mfui-button_type_primary.mfui-button_disabled:hover,
334
334
  .mfui-button.mfui-button_no-touch.mfui-button_type_primary.mfui-button_disabled:active {
335
- color: rgba(51, 51, 51, 0.5);
335
+ color: #33333380;
336
336
  background-color: #EDEDED;
337
337
  -webkit-box-shadow: inset 0 0 0 1px #D8D8D8;
338
338
  box-shadow: inset 0 0 0 1px #D8D8D8;
@@ -341,28 +341,28 @@ h5 {
341
341
  .mfui-button.mfui-button_no-touch.mfui-button_type_primary.mfui-button_disabled svg,
342
342
  .mfui-button.mfui-button_no-touch.mfui-button_type_primary.mfui-button_disabled:hover svg,
343
343
  .mfui-button.mfui-button_no-touch.mfui-button_type_primary.mfui-button_disabled:active svg {
344
- fill: rgba(51, 51, 51, 0.5);
344
+ fill: #33333380;
345
345
  }
346
346
  .mfui-button.mfui-button_type_outline.mfui-button_theme_white.mfui-button_disabled,
347
347
  .mfui-button.mfui-button_no-touch.mfui-button_type_outline.mfui-button_theme_white.mfui-button_disabled,
348
348
  .mfui-button.mfui-button_no-touch.mfui-button_type_outline.mfui-button_theme_white.mfui-button_disabled:hover,
349
349
  .mfui-button.mfui-button_no-touch.mfui-button_type_outline.mfui-button_theme_white.mfui-button_disabled:active {
350
- color: rgba(255, 255, 255, 0.5);
350
+ color: #FFFFFF80;
351
351
  background-color: transparent;
352
- -webkit-box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
353
- box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
352
+ -webkit-box-shadow: inset 0 0 0 1px #FFFFFF80;
353
+ box-shadow: inset 0 0 0 1px #FFFFFF80;
354
354
  }
355
355
  .mfui-button.mfui-button_type_outline.mfui-button_theme_white.mfui-button_disabled svg,
356
356
  .mfui-button.mfui-button_no-touch.mfui-button_type_outline.mfui-button_theme_white.mfui-button_disabled svg,
357
357
  .mfui-button.mfui-button_no-touch.mfui-button_type_outline.mfui-button_theme_white.mfui-button_disabled:hover svg,
358
358
  .mfui-button.mfui-button_no-touch.mfui-button_type_outline.mfui-button_theme_white.mfui-button_disabled:active svg {
359
- fill: rgba(255, 255, 255, 0.5);
359
+ fill: #FFFFFF80;
360
360
  }
361
361
  .mfui-button.mfui-button_type_outline.mfui-button_disabled,
362
362
  .mfui-button.mfui-button_no-touch.mfui-button_type_outline.mfui-button_disabled,
363
363
  .mfui-button.mfui-button_no-touch.mfui-button_type_outline.mfui-button_disabled:hover,
364
364
  .mfui-button.mfui-button_no-touch.mfui-button_type_outline.mfui-button_disabled:active {
365
- color: rgba(51, 51, 51, 0.5);
365
+ color: #33333380;
366
366
  background-color: transparent;
367
367
  -webkit-box-shadow: inset 0 0 0 1px #D8D8D8;
368
368
  box-shadow: inset 0 0 0 1px #D8D8D8;
@@ -371,5 +371,5 @@ h5 {
371
371
  .mfui-button.mfui-button_no-touch.mfui-button_type_outline.mfui-button_disabled svg,
372
372
  .mfui-button.mfui-button_no-touch.mfui-button_type_outline.mfui-button_disabled:hover svg,
373
373
  .mfui-button.mfui-button_no-touch.mfui-button_type_outline.mfui-button_disabled:active svg {
374
- fill: rgba(51, 51, 51, 0.5);
374
+ fill: #33333380;
375
375
  }
@@ -2,6 +2,7 @@ import "core-js/modules/es.array.concat";
2
2
  import "core-js/modules/es.array.is-array";
3
3
  import "core-js/modules/es.object.values";
4
4
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
6
  import _extends from "@babel/runtime/helpers/extends";
6
7
  import React from 'react';
7
8
  import { cnCreate, detectTouch, filterDataAttrs } from '@megafon/ui-helpers';
@@ -82,9 +83,12 @@ var Button = function Button(_ref) {
82
83
  onClick = _ref.onClick,
83
84
  dataAttrs = _ref.dataAttrs,
84
85
  buttonRef = _ref.buttonRef;
85
- var isTouch = React.useMemo(function () {
86
- return detectTouch();
87
- }, []);
86
+
87
+ var _React$useState = React.useState(false),
88
+ _React$useState2 = _slicedToArray(_React$useState, 2),
89
+ isTouch = _React$useState2[0],
90
+ setTouch = _React$useState2[1];
91
+
88
92
  var ElementType = href ? 'a' : 'button';
89
93
  var handleClick = React.useCallback(function (e) {
90
94
  if (disabled) {
@@ -167,6 +171,9 @@ var Button = function Button(_ref) {
167
171
  };
168
172
 
169
173
  var classNameValue = Array.isArray(className) ? [].concat(_toConsumableArray(className), [rootClassName]) : [className, rootClassName];
174
+ React.useEffect(function () {
175
+ setTouch(detectTouch());
176
+ }, []);
170
177
  return /*#__PURE__*/React.createElement(ElementType, _extends({}, filterDataAttrs(dataAttrs), {
171
178
  className: cn({
172
179
  type: type,
@@ -183,7 +190,7 @@ var Button = function Button(_ref) {
183
190
  'content-type': contentType
184
191
  }, classNameValue),
185
192
  href: href,
186
- download: href && download,
193
+ download: !!href && download,
187
194
  target: href ? target : undefined,
188
195
  rel: setRelAttribute(),
189
196
  type: href ? undefined : actionType,
@@ -158,7 +158,7 @@ h5 {
158
158
  margin-right: 8px;
159
159
  }
160
160
  .mfui-carousel_nav-theme_green .swiper-pagination-bullet:before {
161
- background-color: rgba(255, 255, 255, 0.5);
161
+ background-color: #FFFFFF80;
162
162
  }
163
163
  .mfui-carousel_nav-theme_light .swiper-pagination-bullet:before {
164
164
  background-color: rgba(51, 51, 51, 0.25);
@@ -211,6 +211,10 @@ var Carousel = function Carousel(_ref) {
211
211
  };
212
212
  };
213
213
 
214
+ var disableFocusOnSlideClick = function disableFocusOnSlideClick(e) {
215
+ e.nativeEvent.preventDefault();
216
+ };
217
+
214
218
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs), {
215
219
  ref: rootRef,
216
220
  className: cn({
@@ -252,7 +256,8 @@ var Carousel = function Carousel(_ref) {
252
256
  return /*#__PURE__*/React.createElement(SwiperSlide, {
253
257
  key: i,
254
258
  className: cn('slide', slideClass),
255
- onFocus: handleSlideFocus(i)
259
+ onFocus: handleSlideFocus(i),
260
+ onMouseDown: disableFocusOnSlideClick
256
261
  }, child);
257
262
  })), /*#__PURE__*/React.createElement(NavArrow, {
258
263
  className: cn('arrow', {
@@ -5,6 +5,7 @@ h4,
5
5
  h5 {
6
6
  margin: 0;
7
7
  }
8
+ .mfui-content-area_color_base,
8
9
  .mfui-content-area_color_white {
9
10
  background-color: #FFFFFF;
10
11
  }
@@ -26,6 +27,7 @@ h5 {
26
27
  .mfui-content-area_color_spbSky2 {
27
28
  background-color: #D8D8D8;
28
29
  }
30
+ .mfui-content-area_color_content,
29
31
  .mfui-content-area_color_freshAsphalt {
30
32
  background-color: #333333;
31
33
  }
@@ -80,6 +82,7 @@ h5 {
80
82
  padding-right: 0;
81
83
  padding-left: 0;
82
84
  }
85
+ .mfui-content-area__inner_color_base,
83
86
  .mfui-content-area__inner_color_white {
84
87
  background-color: #FFFFFF;
85
88
  }
@@ -101,6 +104,7 @@ h5 {
101
104
  .mfui-content-area__inner_color_spbSky2 {
102
105
  background-color: #D8D8D8;
103
106
  }
107
+ .mfui-content-area__inner_color_content,
104
108
  .mfui-content-area__inner_color_freshAsphalt {
105
109
  background-color: #333333;
106
110
  }
@@ -1,15 +1,19 @@
1
1
  import * as React from 'react';
2
2
  import './ContentArea.less';
3
3
  declare const BACKGROUND_COLORS: {
4
- WHITE: string;
5
- TRANSPARENT: string;
6
- GREEN: string;
7
- PURPLE: string;
8
- SPB_SKY_0: string;
9
- SPB_SKY_1: string;
10
- SPB_SKY_2: string;
11
- FRESH_ASPHALT: string;
12
- FULL_BLACK: string;
4
+ readonly BASE: "base";
5
+ readonly TRANSPARENT: "transparent";
6
+ readonly GREEN: "green";
7
+ readonly PURPLE: "purple";
8
+ readonly SPB_SKY_0: "spbSky0";
9
+ readonly SPB_SKY_1: "spbSky1";
10
+ readonly SPB_SKY_2: "spbSky2";
11
+ readonly CONTENT: "content";
12
+ readonly FULL_BLACK: "fullBlack";
13
+ /** @deprecated */
14
+ readonly WHITE: "white";
15
+ /** @deprecated */
16
+ readonly FRESH_ASPHALT: "freshAsphalt";
13
17
  };
14
18
  export declare type BackgroundColorType = typeof BACKGROUND_COLORS[keyof typeof BACKGROUND_COLORS];
15
19
  declare const DisableIndents: {
@@ -1,18 +1,27 @@
1
+ import "core-js/modules/es.array.concat";
2
+ import "core-js/modules/es.array.includes";
1
3
  import "core-js/modules/es.object.values";
4
+ import "core-js/modules/es.string.includes";
2
5
  import * as React from 'react';
3
6
  import { cnCreate } from '@megafon/ui-helpers';
4
7
  import * as PropTypes from 'prop-types';
5
8
  import "./ContentArea.css";
6
9
  var BACKGROUND_COLORS = {
7
- WHITE: 'white',
10
+ BASE: 'base',
8
11
  TRANSPARENT: 'transparent',
9
12
  GREEN: 'green',
10
13
  PURPLE: 'purple',
11
14
  SPB_SKY_0: 'spbSky0',
12
15
  SPB_SKY_1: 'spbSky1',
13
16
  SPB_SKY_2: 'spbSky2',
14
- FRESH_ASPHALT: 'freshAsphalt',
15
- FULL_BLACK: 'fullBlack'
17
+ CONTENT: 'content',
18
+ FULL_BLACK: 'fullBlack',
19
+
20
+ /** @deprecated */
21
+ WHITE: 'white',
22
+
23
+ /** @deprecated */
24
+ FRESH_ASPHALT: 'freshAsphalt'
16
25
  };
17
26
  var DisableIndents = {
18
27
  MOBILE: 'mobile',
@@ -41,15 +50,39 @@ var ContentArea = function ContentArea(_ref) {
41
50
  }, children));
42
51
  };
43
52
 
53
+ var colorsCustomPropTypes = function colorsCustomPropTypes(props, propName, componentName) {
54
+ var deprecatedBlackValue = BACKGROUND_COLORS.FRESH_ASPHALT;
55
+ var deprecatedWhiteValue = BACKGROUND_COLORS.WHITE;
56
+ var propValue = props[propName];
57
+
58
+ if (propValue && !Object.values(BACKGROUND_COLORS).includes(propValue)) {
59
+ return new Error("Failed prop type: Invalid prop '".concat(propName, "' of value '").concat(propValue, "' supplied to '").concat(componentName, "',\n expected one of [").concat(Object.values(BACKGROUND_COLORS), "]"));
60
+ }
61
+
62
+ if (propValue && propValue === deprecatedBlackValue) {
63
+ return new Error("Failed prop type: Invalid prop '".concat(propName, "' of value '").concat(propValue, "' supplied to '").concat(componentName, "',\n value '").concat(deprecatedBlackValue, "' is deprecated, please use value '").concat(BACKGROUND_COLORS.CONTENT, "'"));
64
+ }
65
+
66
+ if (propValue && propValue === deprecatedWhiteValue) {
67
+ return new Error("Failed prop type: Invalid prop '".concat(propName, "' of value '").concat(propValue, "' supplied to '").concat(componentName, "',\n value '").concat(deprecatedWhiteValue, "' is deprecated, please use value '").concat(BACKGROUND_COLORS.BASE, "'"));
68
+ }
69
+
70
+ return null;
71
+ };
72
+
44
73
  ContentArea.propTypes = {
45
- outerBackgroundColor: PropTypes.oneOf(Object.values(BACKGROUND_COLORS)),
46
- innerBackgroundColor: PropTypes.oneOf(Object.values(BACKGROUND_COLORS)),
47
74
  disableIndents: PropTypes.oneOf(Object.values(DisableIndents)),
48
75
  className: PropTypes.string,
49
76
  classes: PropTypes.shape({
50
77
  root: PropTypes.string,
51
78
  inner: PropTypes.string
52
- })
79
+ }),
80
+ outerBackgroundColor: function outerBackgroundColor(props, propName, componentName) {
81
+ return colorsCustomPropTypes(props, propName, componentName);
82
+ },
83
+ innerBackgroundColor: function innerBackgroundColor(props, propName, componentName) {
84
+ return colorsCustomPropTypes(props, propName, componentName);
85
+ }
53
86
  };
54
87
  ContentArea.defaultProps = {
55
88
  outerBackgroundColor: 'transparent',
@@ -59,7 +59,7 @@ h5 {
59
59
  cursor: default;
60
60
  }
61
61
  .mfui-counter__btn:disabled .mfui-counter__icon {
62
- fill: rgba(51, 51, 51, 0.5);
62
+ fill: #33333380;
63
63
  }
64
64
  .mfui-counter__btn_left {
65
65
  border-top-left-radius: 50px;
@@ -113,8 +113,8 @@ h5 {
113
113
  .mfui-counter_disabled .mfui-counter__input {
114
114
  background-color: #EDEDED;
115
115
  cursor: default;
116
- color: rgba(51, 51, 51, 0.5);
116
+ color: #33333380;
117
117
  }
118
118
  .mfui-counter_disabled .mfui-counter__icon {
119
- fill: rgba(51, 51, 51, 0.5);
119
+ fill: #33333380;
120
120
  }
@@ -35,7 +35,7 @@ h5 {
35
35
  background-color: #731982;
36
36
  }
37
37
  .mfui-nav-arrow_theme_purple:hover:not(:disabled) {
38
- background-color: #A500BF;
38
+ background-color: #534455;
39
39
  }
40
40
  .mfui-nav-arrow_theme_dark {
41
41
  background-color: rgba(0, 0, 0, 0.25);
@@ -149,28 +149,28 @@ h5 {
149
149
  }
150
150
  }
151
151
  .mfui-notification_type_error .mfui-notification__icon-container {
152
- background-color: rgba(235, 90, 64, 0.2);
152
+ background-color: #FFC4C9;
153
153
  }
154
154
  .mfui-notification_type_error .mfui-notification__icon-container svg {
155
155
  /* stylelint-disable-line max-nesting-depth */
156
- fill: #EB5A40;
156
+ fill: #F62434;
157
157
  }
158
158
  .mfui-notification_type_success .mfui-notification__icon-container {
159
- background-color: rgba(0, 185, 86, 0.2);
159
+ background-color: #DDFFEC;
160
160
  }
161
161
  .mfui-notification_type_success .mfui-notification__icon-container svg {
162
162
  /* stylelint-disable-line max-nesting-depth */
163
163
  fill: #00B956;
164
164
  }
165
165
  .mfui-notification_type_warning .mfui-notification__icon-container {
166
- background-color: rgba(255, 167, 23, 0.2);
166
+ background-color: #FFEDD1;
167
167
  }
168
168
  .mfui-notification_type_warning .mfui-notification__icon-container svg {
169
169
  /* stylelint-disable-line max-nesting-depth */
170
170
  fill: #FFA717;
171
171
  }
172
172
  .mfui-notification_type_info .mfui-notification__icon-container {
173
- background-color: rgba(91, 217, 229, 0.2);
173
+ background-color: #E1FAFF;
174
174
  }
175
175
  .mfui-notification_type_info .mfui-notification__icon-container svg {
176
176
  /* stylelint-disable-line max-nesting-depth */
@@ -180,10 +180,10 @@ h5 {
180
180
  background-color: #FFFFFF;
181
181
  }
182
182
  .mfui-notification_colored .mfui-notification__close:hover {
183
- background-color: rgba(255, 255, 255, 0.6);
183
+ background-color: rgba(255, 255, 255, 0.3);
184
184
  }
185
185
  .mfui-notification_colored.mfui-notification_type_error {
186
- background-color: #F1515D;
186
+ background-color: #F8505D;
187
187
  }
188
188
  .mfui-notification_colored.mfui-notification_type_error .mfui-notification__title,
189
189
  .mfui-notification_colored.mfui-notification_type_error .mfui-notification__text,
@@ -194,27 +194,18 @@ h5 {
194
194
  fill: #FFFFFF;
195
195
  }
196
196
  .mfui-notification_colored.mfui-notification_type_error .mfui-notification__icon-container {
197
- background-color: rgba(255, 255, 255, 0.2);
197
+ background-color: #FFFFFF33;
198
198
  }
199
199
  .mfui-notification_colored.mfui-notification_type_error .mfui-notification__icon-container svg {
200
200
  /* stylelint-disable-line max-nesting-depth */
201
201
  fill: #FFFFFF;
202
202
  }
203
203
  .mfui-notification_colored.mfui-notification_type_success {
204
- background-color: rgba(0, 185, 86, 0.1);
205
- }
206
- .mfui-notification_colored.mfui-notification_type_success .mfui-notification__icon-container svg {
207
- fill: #00B956;
204
+ background-color: #DDFFEC;
208
205
  }
209
206
  .mfui-notification_colored.mfui-notification_type_warning {
210
207
  background-color: #FFEDD1;
211
208
  }
212
- .mfui-notification_colored.mfui-notification_type_warning .mfui-notification__icon-container svg {
213
- fill: #FFA717;
214
- }
215
209
  .mfui-notification_colored.mfui-notification_type_info {
216
- background-color: #DEF7FA;
217
- }
218
- .mfui-notification_colored.mfui-notification_type_info .mfui-notification__icon-container svg {
219
- fill: #5BD9E5;
210
+ background-color: #E1FAFF;
220
211
  }
@@ -36,6 +36,7 @@ h5 {
36
36
  .mfui-paragraph_color_purple {
37
37
  color: #731982;
38
38
  }
39
+ .mfui-paragraph_color_base,
39
40
  .mfui-paragraph_color_clearWhite {
40
41
  color: #FFFFFF;
41
42
  }
@@ -48,6 +49,7 @@ h5 {
48
49
  .mfui-paragraph_color_spbSky2 {
49
50
  color: #D8D8D8;
50
51
  }
52
+ .mfui-paragraph_color_content,
51
53
  .mfui-paragraph_color_freshAsphalt {
52
54
  color: #333333;
53
55
  }
@@ -1,5 +1,21 @@
1
1
  import * as React from 'react';
2
2
  import './Paragraph.less';
3
+ declare const COLORS: {
4
+ GREEN: string;
5
+ PURPLE: string;
6
+ BASE: string;
7
+ SPB_SKY_0: string;
8
+ SPB_SKY_1: string;
9
+ SPB_SKY_2: string;
10
+ CONTENT: string;
11
+ FULL_BLACK: string;
12
+ INHERIT: string;
13
+ /** @deprecated */
14
+ CLEAR_WHITE: string;
15
+ /** @deprecated */
16
+ FRESH_ASPHALT: string;
17
+ };
18
+ declare type ColorType = typeof COLORS[keyof typeof COLORS];
3
19
  export interface IParagraphProps {
4
20
  /** Выравнивание по горизонтали */
5
21
  align?: 'left' | 'center' | 'right';
@@ -8,7 +24,7 @@ export interface IParagraphProps {
8
24
  /** Вертикальный отступ (включен по умолчанию) */
9
25
  hasMargin?: boolean;
10
26
  /** Цвет текста */
11
- color?: 'green' | 'purple' | 'clearWhite' | 'spbSky0' | 'spbSky1' | 'spbSky2' | 'freshAsphalt' | 'fullBlack' | 'inherit';
27
+ color?: ColorType;
12
28
  /** Дополнительный класс корневого элемента */
13
29
  className?: string;
14
30
  }
@@ -1,7 +1,28 @@
1
+ import "core-js/modules/es.array.concat";
2
+ import "core-js/modules/es.array.includes";
3
+ import "core-js/modules/es.object.values";
4
+ import "core-js/modules/es.string.includes";
1
5
  import * as React from 'react';
2
6
  import { cnCreate } from '@megafon/ui-helpers';
3
7
  import * as PropTypes from 'prop-types';
4
8
  import "./Paragraph.css";
9
+ var COLORS = {
10
+ GREEN: 'green',
11
+ PURPLE: 'purple',
12
+ BASE: 'base',
13
+ SPB_SKY_0: 'spbSky0',
14
+ SPB_SKY_1: 'spbSky1',
15
+ SPB_SKY_2: 'spbSky2',
16
+ CONTENT: 'content',
17
+ FULL_BLACK: 'fullBlack',
18
+ INHERIT: 'inherit',
19
+
20
+ /** @deprecated */
21
+ CLEAR_WHITE: 'clearWhite',
22
+
23
+ /** @deprecated */
24
+ FRESH_ASPHALT: 'freshAsphalt'
25
+ };
5
26
  var cn = cnCreate('mfui-paragraph');
6
27
 
7
28
  var Paragraph = function Paragraph(_ref) {
@@ -28,6 +49,24 @@ Paragraph.propTypes = {
28
49
  align: PropTypes.oneOf(['left', 'center', 'right']),
29
50
  size: PropTypes.oneOf(['regular', 'small']),
30
51
  hasMargin: PropTypes.bool,
31
- color: PropTypes.oneOf(['green', 'purple', 'clearWhite', 'spbSky0', 'spbSky1', 'spbSky2', 'freshAsphalt', 'fullBlack', 'inherit'])
52
+ color: function color(props, propName, componentName) {
53
+ var deprecatedBlackValue = COLORS.FRESH_ASPHALT;
54
+ var deprecatedWhiteValue = COLORS.CLEAR_WHITE;
55
+ var propValue = props[propName];
56
+
57
+ if (propValue && !Object.values(COLORS).includes(propValue)) {
58
+ return new Error("Failed prop type: Invalid prop '".concat(propName, "' of value '").concat(propValue, "' supplied to '").concat(componentName, "', \n expected one of [").concat(Object.values(COLORS), "]"));
59
+ }
60
+
61
+ if (propValue && props[propName] === deprecatedBlackValue) {
62
+ return new Error("Failed prop type: Invalid prop '".concat(propName, "' of value '").concat(propValue, "' supplied to '").concat(componentName, "',\n value '").concat(deprecatedBlackValue, "' is deprecated, please use value '").concat(COLORS.CONTENT, "'"));
63
+ }
64
+
65
+ if (propValue && props[propName] === deprecatedWhiteValue) {
66
+ return new Error("Failed prop type: Invalid prop '".concat(propName, "' of value '").concat(propValue, "' supplied to '").concat(componentName, "',\n value '").concat(deprecatedWhiteValue, "' is deprecated, please use value '").concat(COLORS.BASE, "'"));
67
+ }
68
+
69
+ return null;
70
+ }
32
71
  };
33
72
  export default Paragraph;
@@ -7,6 +7,8 @@ export interface ITabProps extends IFilterDataAttrs {
7
7
  icon?: React.ReactNode;
8
8
  /** Ссылка */
9
9
  href?: string;
10
+ /** Дочерние элементы */
11
+ children?: React.ReactNode;
10
12
  /** Функция рендера компонента-обертки для заголовка и иконки */
11
13
  renderTabWrapper?: (tab: React.ReactNode) => React.ReactNode;
12
14
  }
@@ -254,8 +254,8 @@ h5 {
254
254
  border-color: rgba(237, 237, 237, 0.5);
255
255
  }
256
256
  .mfui-tabs_tab-color_green:not(.mfui-tabs_sticky) .mfui-tabs__tab-inner {
257
- color: rgba(255, 255, 255, 0.5);
258
- fill: rgba(255, 255, 255, 0.5);
257
+ color: #FFFFFF80;
258
+ fill: #FFFFFF80;
259
259
  }
260
260
  .mfui-tabs_tab-color_green:not(.mfui-tabs_sticky) .mfui-tabs__tab-inner:hover {
261
261
  color: #FFFFFF;
@@ -39,6 +39,8 @@ export interface ITabsProps {
39
39
  currentIndex?: number;
40
40
  /** Индекс активного таба по умолчанию (не работает в режиме управления табами снаружи) */
41
41
  defaultIndex?: number;
42
+ /** Рендер содержимого только для текущего таба */
43
+ renderOnlyCurrentPanel?: boolean;
42
44
  /** Обработчика клика по табам */
43
45
  onTabClick?: (index: number) => void;
44
46
  children: Array<React.ReactElement<ITabProps>>;
@@ -64,6 +64,8 @@ var Tabs = function Tabs(_ref) {
64
64
  _ref$defaultIndex = _ref.defaultIndex,
65
65
  defaultIndex = _ref$defaultIndex === void 0 ? 0 : _ref$defaultIndex,
66
66
  outerIndex = _ref.currentIndex,
67
+ _ref$renderOnlyCurren = _ref.renderOnlyCurrentPanel,
68
+ renderOnlyCurrentPanel = _ref$renderOnlyCurren === void 0 ? false : _ref$renderOnlyCurren,
67
69
  children = _ref.children,
68
70
  onTabClick = _ref.onTabClick;
69
71
  var tabsRef = React.useRef([]);
@@ -219,11 +221,18 @@ var Tabs = function Tabs(_ref) {
219
221
  }, [renderTab, children]);
220
222
  var renderPanels = React.useCallback(function () {
221
223
  return React.Children.map(children, function (child, i) {
224
+ var panel = child.props.children;
225
+ var isCurrentPanel = currentIndex === i;
226
+
227
+ if (!panel || renderOnlyCurrentPanel && !isCurrentPanel) {
228
+ return null;
229
+ }
230
+
222
231
  return /*#__PURE__*/React.createElement("div", {
223
232
  className: cn('panel', {
224
- current: currentIndex === i
233
+ current: isCurrentPanel
225
234
  })
226
- }, child);
235
+ }, panel);
227
236
  });
228
237
  }, [children, currentIndex]);
229
238
  var handleReachBeginning = React.useCallback(function (swiper) {
@@ -371,6 +380,7 @@ Tabs.propTypes = {
371
380
  sticky: PropTypes.bool,
372
381
  currentIndex: PropTypes.number,
373
382
  defaultIndex: PropTypes.number,
383
+ renderOnlyCurrentPanel: PropTypes.bool,
374
384
  onTabClick: PropTypes.func
375
385
  };
376
386
  export default Tabs;
@@ -125,6 +125,11 @@ var TextField = function TextField(_ref) {
125
125
  isMaxLimitExceeded = _useState10[0],
126
126
  setIsMaxLimitExceeded = _useState10[1];
127
127
 
128
+ var _useState11 = useState(false),
129
+ _useState12 = _slicedToArray(_useState11, 2),
130
+ isTouch = _useState12[0],
131
+ setTouch = _useState12[1];
132
+
128
133
  var fieldNode = useRef();
129
134
  var isPasswordType = useMemo(function () {
130
135
  return type === 'password';
@@ -132,9 +137,6 @@ var TextField = function TextField(_ref) {
132
137
  var isVisiblePassword = useMemo(function () {
133
138
  return isPasswordType && !isPasswordHidden;
134
139
  }, [isPasswordHidden, isPasswordType]);
135
- var isTouch = useMemo(function () {
136
- return detectTouch();
137
- }, []);
138
140
  var checkSymbolMaxLimit = useCallback(function () {
139
141
  var textareaValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
140
142
 
@@ -148,6 +150,9 @@ var TextField = function TextField(_ref) {
148
150
  !isControlled && setInputValue(value);
149
151
  checkSymbolMaxLimit(value);
150
152
  }, [value, checkSymbolMaxLimit]);
153
+ useEffect(function () {
154
+ setTouch(detectTouch());
155
+ }, []);
151
156
  var togglePasswordHiding = useCallback(function () {
152
157
  return setPasswordHidden(function (prevPassState) {
153
158
  return !prevPassState;
@@ -0,0 +1,52 @@
1
+ h1,
2
+ h2,
3
+ h3,
4
+ h4,
5
+ h5 {
6
+ margin: 0;
7
+ }
8
+ .color-item {
9
+ display: -webkit-box;
10
+ display: -ms-flexbox;
11
+ display: flex;
12
+ -webkit-box-orient: vertical;
13
+ -webkit-box-direction: normal;
14
+ -ms-flex-direction: column;
15
+ flex-direction: column;
16
+ -webkit-box-align: center;
17
+ -ms-flex-align: center;
18
+ align-items: center;
19
+ width: 120px;
20
+ text-align: center;
21
+ }
22
+ .color-item__container {
23
+ position: relative;
24
+ width: 48px;
25
+ height: 48px;
26
+ margin-bottom: 8px;
27
+ }
28
+ .color-item__color {
29
+ position: relative;
30
+ z-index: 0;
31
+ width: 100%;
32
+ height: 100%;
33
+ border-radius: 50%;
34
+ }
35
+ .color-item__parent-color {
36
+ position: absolute;
37
+ top: 0;
38
+ right: 0;
39
+ z-index: 1;
40
+ width: 16px;
41
+ height: 16px;
42
+ border-radius: 50%;
43
+ }
44
+ .color-item__name {
45
+ font-size: 14px;
46
+ line-height: 20px;
47
+ }
48
+ .color-item__code {
49
+ color: #33333380;
50
+ font-size: 12px;
51
+ line-height: 18px;
52
+ }
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import './ColorItem.less';
3
+ declare type Props = {
4
+ colorCode: string;
5
+ colorName: string;
6
+ parentColorCode?: string;
7
+ gradient?: string;
8
+ border?: string;
9
+ className?: string;
10
+ };
11
+ declare const ColorItem: React.FC<Props>;
12
+ export default ColorItem;