@megafon/ui-core 2.1.0 → 2.1.4

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 (47) hide show
  1. package/CHANGELOG.md +47 -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 +213 -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/Carousel/Carousel.css +1 -1
  12. package/dist/es/components/Carousel/Carousel.js +6 -1
  13. package/dist/es/components/ContentArea/ContentArea.css +4 -0
  14. package/dist/es/components/ContentArea/ContentArea.d.ts +6 -2
  15. package/dist/es/components/ContentArea/ContentArea.js +39 -6
  16. package/dist/es/components/Counter/Counter.css +3 -3
  17. package/dist/es/components/NavArrow/NavArrow.css +1 -1
  18. package/dist/es/components/Notification/Notification.css +10 -19
  19. package/dist/es/components/Paragraph/Paragraph.css +2 -0
  20. package/dist/es/components/Paragraph/Paragraph.d.ts +17 -1
  21. package/dist/es/components/Paragraph/Paragraph.js +40 -1
  22. package/dist/es/components/Tabs/Tabs.css +2 -2
  23. package/dist/es/components/Tabs/Tabs.js +41 -32
  24. package/dist/lib/colors/ColorItem/ColorItem.css +52 -0
  25. package/dist/lib/colors/ColorItem/ColorItem.d.ts +12 -0
  26. package/dist/lib/colors/ColorItem/ColorItem.js +50 -0
  27. package/dist/lib/colors/Colors.css +203 -32
  28. package/dist/lib/colors/Colors.js +250 -36
  29. package/dist/lib/colors/colorsData.d.ts +20 -7
  30. package/dist/lib/colors/colorsData.js +213 -61
  31. package/dist/lib/components/Banner/BannerDot.css +2 -2
  32. package/dist/lib/components/Button/Button.css +11 -11
  33. package/dist/lib/components/Carousel/Carousel.css +1 -1
  34. package/dist/lib/components/Carousel/Carousel.js +6 -1
  35. package/dist/lib/components/ContentArea/ContentArea.css +4 -0
  36. package/dist/lib/components/ContentArea/ContentArea.d.ts +6 -2
  37. package/dist/lib/components/ContentArea/ContentArea.js +42 -6
  38. package/dist/lib/components/Counter/Counter.css +3 -3
  39. package/dist/lib/components/NavArrow/NavArrow.css +1 -1
  40. package/dist/lib/components/Notification/Notification.css +10 -19
  41. package/dist/lib/components/Paragraph/Paragraph.css +2 -0
  42. package/dist/lib/components/Paragraph/Paragraph.d.ts +17 -1
  43. package/dist/lib/components/Paragraph/Paragraph.js +44 -1
  44. package/dist/lib/components/Tabs/Tabs.css +2 -2
  45. package/dist/lib/components/Tabs/Tabs.js +41 -32
  46. package/package.json +4 -3
  47. package/styles/base.less +49 -21
@@ -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
  }
@@ -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
- readonly WHITE: "white";
4
+ readonly BASE: "base";
5
5
  readonly TRANSPARENT: "transparent";
6
6
  readonly GREEN: "green";
7
7
  readonly PURPLE: "purple";
8
8
  readonly SPB_SKY_0: "spbSky0";
9
9
  readonly SPB_SKY_1: "spbSky1";
10
10
  readonly SPB_SKY_2: "spbSky2";
11
- readonly FRESH_ASPHALT: "freshAsphalt";
11
+ readonly CONTENT: "content";
12
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;
@@ -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;
@@ -96,36 +96,41 @@ var Tabs = function Tabs(_ref) {
96
96
 
97
97
  var _React$useState9 = React.useState(0),
98
98
  _React$useState10 = _slicedToArray(_React$useState9, 2),
99
- underlineWidth = _React$useState10[0],
100
- setUnderlineWidth = _React$useState10[1];
99
+ activeTabWidth = _React$useState10[0],
100
+ setActiveTabWidth = _React$useState10[1];
101
101
 
102
102
  var _React$useState11 = React.useState(0),
103
103
  _React$useState12 = _slicedToArray(_React$useState11, 2),
104
- underlineTranslate = _React$useState12[0],
105
- setUnderlineTranslate = _React$useState12[1];
104
+ underlineWidth = _React$useState12[0],
105
+ setUnderlineWidth = _React$useState12[1];
106
106
 
107
- var _React$useState13 = React.useState('none'),
107
+ var _React$useState13 = React.useState(0),
108
108
  _React$useState14 = _slicedToArray(_React$useState13, 2),
109
- underlineTransition = _React$useState14[0],
110
- setUnderlineTransition = _React$useState14[1];
109
+ underlineTranslate = _React$useState14[0],
110
+ setUnderlineTranslate = _React$useState14[1];
111
111
 
112
- var _React$useState15 = React.useState('auto'),
112
+ var _React$useState15 = React.useState('none'),
113
113
  _React$useState16 = _slicedToArray(_React$useState15, 2),
114
- tabListHeight = _React$useState16[0],
115
- setTabListHeight = _React$useState16[1];
114
+ underlineTransition = _React$useState16[0],
115
+ setUnderlineTransition = _React$useState16[1];
116
116
 
117
- var _React$useState17 = React.useState(false),
117
+ var _React$useState17 = React.useState('auto'),
118
118
  _React$useState18 = _slicedToArray(_React$useState17, 2),
119
- isSticky = _React$useState18[0],
120
- setSticky = _React$useState18[1];
119
+ tabListHeight = _React$useState18[0],
120
+ setTabListHeight = _React$useState18[1];
121
121
 
122
- var _React$useState19 = React.useState({
122
+ var _React$useState19 = React.useState(false),
123
+ _React$useState20 = _slicedToArray(_React$useState19, 2),
124
+ isSticky = _React$useState20[0],
125
+ setSticky = _React$useState20[1];
126
+
127
+ var _React$useState21 = React.useState({
123
128
  left: 0,
124
129
  right: 0
125
130
  }),
126
- _React$useState20 = _slicedToArray(_React$useState19, 2),
127
- stickyOffset = _React$useState20[0],
128
- setStickyOffset = _React$useState20[1];
131
+ _React$useState22 = _slicedToArray(_React$useState21, 2),
132
+ stickyOffset = _React$useState22[0],
133
+ setStickyOffset = _React$useState22[1];
129
134
 
130
135
  var setTabRef = React.useCallback(function (tab) {
131
136
  tab && tabsRef.current.push(tab);
@@ -135,12 +140,6 @@ var Tabs = function Tabs(_ref) {
135
140
  return;
136
141
  }
137
142
 
138
- var tabNodeChild = tabsRef.current[currentIndex].firstElementChild;
139
-
140
- var _ref2 = tabNodeChild || {},
141
- _ref2$clientWidth = _ref2.clientWidth,
142
- clientWidth = _ref2$clientWidth === void 0 ? 0 : _ref2$clientWidth;
143
-
144
143
  var translate = _toConsumableArray(tabsRef.current).splice(0, currentIndex).reduce(function (accWidth, node) {
145
144
  var _node$getBoundingClie = node.getBoundingClientRect(),
146
145
  width = _node$getBoundingClie.width;
@@ -148,9 +147,9 @@ var Tabs = function Tabs(_ref) {
148
147
  return accWidth + width;
149
148
  }, 0);
150
149
 
151
- setUnderlineWidth(clientWidth);
150
+ setUnderlineWidth(activeTabWidth);
152
151
  setUnderlineTranslate(translate);
153
- }, [currentIndex]);
152
+ }, [currentIndex, activeTabWidth]);
154
153
  var calculateSticky = React.useCallback(function () {
155
154
  if (!sticky || !rootRef.current || !tabListRef.current) {
156
155
  return;
@@ -247,12 +246,12 @@ var Tabs = function Tabs(_ref) {
247
246
  }, []);
248
247
  React.useEffect(function () {
249
248
  var observer = new IntersectionObserver(function (entries) {
250
- entries.forEach(function (_ref3) {
251
- var isIntersecting = _ref3.isIntersecting,
252
- _ref3$boundingClientR = _ref3.boundingClientRect,
253
- top = _ref3$boundingClientR.top,
254
- left = _ref3$boundingClientR.left,
255
- right = _ref3$boundingClientR.right;
249
+ entries.forEach(function (_ref2) {
250
+ var isIntersecting = _ref2.isIntersecting,
251
+ _ref2$boundingClientR = _ref2.boundingClientRect,
252
+ top = _ref2$boundingClientR.top,
253
+ left = _ref2$boundingClientR.left,
254
+ right = _ref2$boundingClientR.right;
256
255
 
257
256
  if (!sticky || !rootRef.current || !tabListRef.current) {
258
257
  return;
@@ -294,10 +293,20 @@ var Tabs = function Tabs(_ref) {
294
293
  }, [calculateSticky]);
295
294
  React.useEffect(function () {
296
295
  var handleResize = throttle(function () {
297
- calculateUnderline();
298
296
  calculateSticky();
299
297
  }, 300);
298
+ var activeTabNode = tabsRef.current[currentIndex];
299
+ var resizeObserver = new ResizeObserver(function (entries) {
300
+ if (!entries.length || !entries[0]) {
301
+ return;
302
+ }
303
+
304
+ var width = entries[0].contentRect.width;
305
+ setActiveTabWidth(width);
306
+ calculateUnderline();
307
+ });
300
308
  calculateUnderline();
309
+ resizeObserver.observe(activeTabNode);
301
310
  window.addEventListener('resize', handleResize);
302
311
  return function () {
303
312
  window.removeEventListener('resize', handleResize);
@@ -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;