@megafon/ui-core 3.0.0-beta.3 → 3.0.0-beta.7

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 (124) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/dist/es/colors/Colors.js +13 -0
  3. package/dist/es/components/Accordion/Accordion.d.ts +11 -3
  4. package/dist/es/components/Accordion/Accordion.js +14 -7
  5. package/dist/es/components/Banner/Banner.d.ts +10 -0
  6. package/dist/es/components/Banner/Banner.js +25 -11
  7. package/dist/es/components/Banner/BannerDot.d.ts +3 -0
  8. package/dist/es/components/Banner/BannerDot.js +8 -3
  9. package/dist/es/components/Button/Button.d.ts +8 -2
  10. package/dist/es/components/Button/Button.js +14 -6
  11. package/dist/es/components/Carousel/Carousel.d.ts +9 -2
  12. package/dist/es/components/Carousel/Carousel.js +14 -8
  13. package/dist/es/components/Checkbox/Checkbox.d.ts +8 -2
  14. package/dist/es/components/Checkbox/Checkbox.js +12 -7
  15. package/dist/es/components/Collapse/Collapse.d.ts +15 -3
  16. package/dist/es/components/Collapse/Collapse.js +11 -4
  17. package/dist/es/components/ContentArea/ContentArea.css +8 -59
  18. package/dist/es/components/ContentArea/ContentArea.d.ts +2 -6
  19. package/dist/es/components/ContentArea/ContentArea.js +5 -38
  20. package/dist/es/components/Counter/Counter.css +0 -47
  21. package/dist/es/components/Grid/Grid.css +0 -47
  22. package/dist/es/components/Header/Header.d.ts +6 -20
  23. package/dist/es/components/Header/Header.js +30 -66
  24. package/dist/es/components/InputLabel/InputLabel.d.ts +3 -0
  25. package/dist/es/components/InputLabel/InputLabel.js +9 -4
  26. package/dist/es/components/Link/Link.d.ts +6 -2
  27. package/dist/es/components/Link/Link.js +28 -4
  28. package/dist/es/components/Notification/Notification.css +0 -47
  29. package/dist/es/components/Notification/Notification.d.ts +8 -0
  30. package/dist/es/components/Notification/Notification.js +21 -4
  31. package/dist/es/components/Pagination/Pagination.d.ts +9 -2
  32. package/dist/es/components/Pagination/Pagination.js +20 -3
  33. package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.css +0 -47
  34. package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
  35. package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.js +11 -6
  36. package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +5 -2
  37. package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.js +10 -2
  38. package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.css +0 -47
  39. package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +5 -2
  40. package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +6 -1
  41. package/dist/es/components/Paragraph/Paragraph.css +9 -11
  42. package/dist/es/components/Paragraph/Paragraph.d.ts +12 -12
  43. package/dist/es/components/Paragraph/Paragraph.js +14 -36
  44. package/dist/es/components/Preloader/Preloader.d.ts +4 -0
  45. package/dist/es/components/Preloader/Preloader.js +10 -5
  46. package/dist/es/components/RadioButton/RadioButton.d.ts +8 -28
  47. package/dist/es/components/RadioButton/RadioButton.js +50 -85
  48. package/dist/es/components/Select/Select.d.ts +38 -5
  49. package/dist/es/components/Select/Select.js +50 -34
  50. package/dist/es/components/Tabs/Tab.d.ts +5 -2
  51. package/dist/es/components/Tabs/Tab.js +4 -2
  52. package/dist/es/components/Tabs/Tabs.d.ts +8 -0
  53. package/dist/es/components/Tabs/Tabs.js +29 -21
  54. package/dist/es/components/TextField/TextField.d.ts +8 -0
  55. package/dist/es/components/TextField/TextField.js +22 -10
  56. package/dist/es/components/TextLink/TextLink.js +7 -2
  57. package/dist/es/components/Tile/Tile.d.ts +5 -2
  58. package/dist/es/components/Tile/Tile.js +1 -1
  59. package/dist/es/components/Tooltip/Tooltip.d.ts +5 -0
  60. package/dist/es/components/Tooltip/Tooltip.js +10 -2
  61. package/dist/lib/colors/Colors.js +10 -0
  62. package/dist/lib/components/Accordion/Accordion.d.ts +11 -3
  63. package/dist/lib/components/Accordion/Accordion.js +14 -7
  64. package/dist/lib/components/Banner/Banner.d.ts +10 -0
  65. package/dist/lib/components/Banner/Banner.js +25 -10
  66. package/dist/lib/components/Banner/BannerDot.d.ts +3 -0
  67. package/dist/lib/components/Banner/BannerDot.js +10 -2
  68. package/dist/lib/components/Button/Button.d.ts +8 -2
  69. package/dist/lib/components/Button/Button.js +14 -6
  70. package/dist/lib/components/Carousel/Carousel.d.ts +9 -2
  71. package/dist/lib/components/Carousel/Carousel.js +14 -8
  72. package/dist/lib/components/Checkbox/Checkbox.d.ts +8 -2
  73. package/dist/lib/components/Checkbox/Checkbox.js +12 -7
  74. package/dist/lib/components/Collapse/Collapse.d.ts +15 -3
  75. package/dist/lib/components/Collapse/Collapse.js +13 -4
  76. package/dist/lib/components/ContentArea/ContentArea.css +8 -59
  77. package/dist/lib/components/ContentArea/ContentArea.d.ts +2 -6
  78. package/dist/lib/components/ContentArea/ContentArea.js +5 -41
  79. package/dist/lib/components/Counter/Counter.css +0 -47
  80. package/dist/lib/components/Grid/Grid.css +0 -47
  81. package/dist/lib/components/Header/Header.d.ts +6 -20
  82. package/dist/lib/components/Header/Header.js +30 -97
  83. package/dist/lib/components/InputLabel/InputLabel.d.ts +3 -0
  84. package/dist/lib/components/InputLabel/InputLabel.js +11 -3
  85. package/dist/lib/components/Link/Link.d.ts +6 -2
  86. package/dist/lib/components/Link/Link.js +33 -4
  87. package/dist/lib/components/Notification/Notification.css +0 -47
  88. package/dist/lib/components/Notification/Notification.d.ts +8 -0
  89. package/dist/lib/components/Notification/Notification.js +20 -3
  90. package/dist/lib/components/Pagination/Pagination.d.ts +9 -2
  91. package/dist/lib/components/Pagination/Pagination.js +20 -2
  92. package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.css +0 -47
  93. package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
  94. package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.js +11 -5
  95. package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +5 -2
  96. package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.js +9 -1
  97. package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.css +0 -47
  98. package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +5 -2
  99. package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +6 -1
  100. package/dist/lib/components/Paragraph/Paragraph.css +9 -11
  101. package/dist/lib/components/Paragraph/Paragraph.d.ts +12 -12
  102. package/dist/lib/components/Paragraph/Paragraph.js +15 -37
  103. package/dist/lib/components/Preloader/Preloader.d.ts +4 -0
  104. package/dist/lib/components/Preloader/Preloader.js +10 -4
  105. package/dist/lib/components/RadioButton/RadioButton.d.ts +8 -28
  106. package/dist/lib/components/RadioButton/RadioButton.js +51 -117
  107. package/dist/lib/components/Select/Select.d.ts +38 -5
  108. package/dist/lib/components/Select/Select.js +50 -34
  109. package/dist/lib/components/Tabs/Tab.d.ts +5 -2
  110. package/dist/lib/components/Tabs/Tab.js +4 -2
  111. package/dist/lib/components/Tabs/Tabs.d.ts +8 -0
  112. package/dist/lib/components/Tabs/Tabs.js +29 -21
  113. package/dist/lib/components/TextField/TextField.d.ts +8 -0
  114. package/dist/lib/components/TextField/TextField.js +20 -9
  115. package/dist/lib/components/TextLink/TextLink.js +7 -2
  116. package/dist/lib/components/Tile/Tile.d.ts +5 -2
  117. package/dist/lib/components/Tile/Tile.js +1 -1
  118. package/dist/lib/components/Tooltip/Tooltip.d.ts +5 -0
  119. package/dist/lib/components/Tooltip/Tooltip.js +9 -1
  120. package/package.json +5 -4
  121. package/styles/base.less +1 -60
  122. package/styles/colors.css +60 -0
  123. package/styles/colorsDark.css +62 -0
  124. package/styles/base.css +0 -54
@@ -34,11 +34,13 @@ var PaginationButtons = function PaginationButtons(_ref) {
34
34
  theme = _ref.theme,
35
35
  onClick = _ref.onClick,
36
36
  activeButton = _ref.activeButton,
37
- hiddenButton = _ref.hiddenButton;
37
+ hiddenButton = _ref.hiddenButton,
38
+ dataAttrs = _ref.dataAttrs;
38
39
  return /*#__PURE__*/_react["default"].createElement("div", {
39
40
  className: cn()
40
41
  }, items.map(function (pageNumber, index) {
41
42
  var isHiddenButton = hiddenButton === pageNumber;
43
+ var dataIndex = typeof pageNumber === 'number' ? pageNumber : undefined;
42
44
 
43
45
  if (isHiddenButton) {
44
46
  return /*#__PURE__*/_react["default"].createElement(_PaginationButton["default"], {
@@ -51,6 +53,9 @@ var PaginationButtons = function PaginationButtons(_ref) {
51
53
 
52
54
  var isActive = pageNumber === activeButton;
53
55
  return /*#__PURE__*/_react["default"].createElement(_PaginationButton["default"], {
56
+ dataAttrs: {
57
+ root: (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root, dataIndex)
58
+ },
54
59
  isActive: isActive,
55
60
  key: index,
56
61
  className: cn('button'),
@@ -66,6 +71,9 @@ PaginationButtons.propTypes = {
66
71
  theme: _propTypes["default"].oneOf(['default', 'light']),
67
72
  activeButton: _propTypes["default"].number.isRequired,
68
73
  hiddenButton: _propTypes["default"].string.isRequired,
74
+ dataAttrs: _propTypes["default"].shape({
75
+ root: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired)
76
+ }),
69
77
  onClick: _propTypes["default"].func.isRequired
70
78
  };
71
79
  var _default = PaginationButtons;
@@ -1,50 +1,3 @@
1
- :root {
2
- --green: #00B956;
3
- --purple: #731982;
4
- --base: #FFFFFF;
5
- --content: #333333;
6
- --spbSky0: #F6F6F6;
7
- --spbSky1: #EDEDED;
8
- --spbSky2: #D8D8D8;
9
- --spbSky3: #999999;
10
- --warmRedC: #EB5A40;
11
- --137C: #FFA717;
12
- --311C: #5BD9E5;
13
- --reflexBlue: #444189;
14
- --fury: #F62434;
15
- --systemBlue: #34AAF2;
16
- --background: #FFFFFF;
17
- --buttonHoverGreen: #10E272;
18
- --buttonhoverPurple: #534455;
19
- --buttonDown: #404D46;
20
- --gradientBasic: linear-gradient(90deg, #01873F 0%, #00B956 74%, #14CD6A 100%);
21
- --gradientVIP: linear-gradient(90deg, #5B1168 0%, #731982 74%, #821E93 100%);
22
- --gradientExclusive: linear-gradient(90deg, #2A2674 0%, #444189 74%, #504D93 100%);
23
- --STCWhite: #FFFFFF;
24
- --STCBlack: #333333;
25
- --STCWhite5: #FFFFFF0D;
26
- --STCWhite10: #FFFFFF1A;
27
- --STCWhite20: #FFFFFF33;
28
- --STCWhite50: #FFFFFF80;
29
- --STCBlack5: #3333330D;
30
- --STCBlack10: #3333331A;
31
- --STCBlack20: #33333333;
32
- --STCBlack50: #33333380;
33
- --green80: #0CDC78;
34
- --green20: #DDFFEC;
35
- --purple80: #AA67C1;
36
- --purple20: #FFEEFF;
37
- --warmRedC80: #FF765D;
38
- --warmRedC20: #FFCFC7;
39
- --137C80: #FFB945;
40
- --137C20: #FFEDD1;
41
- --311C80: #62E3FF;
42
- --311C20: #E1FAFF;
43
- --reflexBlue80: #554FC9;
44
- --reflexBlue20: #EBEAFF;
45
- --fury80: #F8505D;
46
- --fury20: #FFC5C9;
47
- }
48
1
  h1,
49
2
  h2,
50
3
  h3,
@@ -1,12 +1,15 @@
1
1
  import React from 'react';
2
2
  import './PaginationNavigation.less';
3
- interface IPaginationNavigation {
3
+ interface IPaginationNavigationProps {
4
4
  direction?: 'left' | 'right';
5
5
  theme?: 'default' | 'light';
6
6
  disabled?: boolean;
7
7
  isActive?: boolean;
8
8
  className?: string;
9
+ dataAttrs?: {
10
+ root?: Record<string, string>;
11
+ };
9
12
  onClick?: (value?: number | string) => void;
10
13
  }
11
- declare const PaginationNavigation: React.FC<IPaginationNavigation>;
14
+ declare const PaginationNavigation: React.FC<IPaginationNavigationProps>;
12
15
  export default PaginationNavigation;
@@ -34,8 +34,10 @@ var PaginationNavigation = function PaginationNavigation(_ref) {
34
34
  disabled = _ref.disabled,
35
35
  isActive = _ref.isActive,
36
36
  onClick = _ref.onClick,
37
- className = _ref.className;
37
+ className = _ref.className,
38
+ dataAttrs = _ref.dataAttrs;
38
39
  return /*#__PURE__*/_react["default"].createElement(_PaginationButton["default"], {
40
+ dataAttrs: dataAttrs,
39
41
  className: cn({
40
42
  direction: direction
41
43
  }, className),
@@ -54,6 +56,9 @@ PaginationNavigation.propTypes = {
54
56
  disabled: _propTypes["default"].bool,
55
57
  isActive: _propTypes["default"].bool,
56
58
  className: _propTypes["default"].string,
59
+ dataAttrs: _propTypes["default"].shape({
60
+ root: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired)
61
+ }),
57
62
  onClick: _propTypes["default"].func
58
63
  };
59
64
  var _default = PaginationNavigation;
@@ -23,16 +23,21 @@
23
23
  .mfui-paragraph_has-margin {
24
24
  margin: 0 0 16px;
25
25
  }
26
+ .mfui-paragraph_color_inherit {
27
+ color: inherit;
28
+ }
29
+ .mfui-paragraph_color_default {
30
+ color: var(--content);
31
+ }
32
+ .mfui-paragraph_color_white {
33
+ color: var(--stcWhite);
34
+ }
26
35
  .mfui-paragraph_color_green {
27
36
  color: var(--brandGreen);
28
37
  }
29
38
  .mfui-paragraph_color_purple {
30
39
  color: var(--brandPurple);
31
40
  }
32
- .mfui-paragraph_color_base,
33
- .mfui-paragraph_color_clearWhite {
34
- color: var(--stcWhite);
35
- }
36
41
  .mfui-paragraph_color_spbSky0 {
37
42
  color: var(--spbSky0);
38
43
  }
@@ -42,10 +47,3 @@
42
47
  .mfui-paragraph_color_spbSky2 {
43
48
  color: var(--spbSky2);
44
49
  }
45
- .mfui-paragraph_color_content,
46
- .mfui-paragraph_color_freshAsphalt {
47
- color: var(--content);
48
- }
49
- .mfui-paragraph_color_inherit {
50
- color: inherit;
51
- }
@@ -1,18 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import './Paragraph.less';
3
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
- INHERIT: string;
12
- /** @deprecated */
13
- CLEAR_WHITE: string;
14
- /** @deprecated */
15
- FRESH_ASPHALT: string;
4
+ readonly INHERIT: "inherit";
5
+ readonly DEFAULT: "default";
6
+ readonly WHITE: "white";
7
+ readonly GREEN: "green";
8
+ readonly PURPLE: "purple";
9
+ readonly SPB_SKY_0: "spbSky0";
10
+ readonly SPB_SKY_1: "spbSky1";
11
+ readonly SPB_SKY_2: "spbSky2";
16
12
  };
17
13
  declare type ColorType = typeof COLORS[keyof typeof COLORS];
18
14
  export interface IParagraphProps {
@@ -26,6 +22,10 @@ export interface IParagraphProps {
26
22
  color?: ColorType;
27
23
  /** Дополнительный класс корневого элемента */
28
24
  className?: string;
25
+ /** Дополнительные data атрибуты к внутренним элементам */
26
+ dataAttrs?: {
27
+ root?: Record<string, string>;
28
+ };
29
29
  }
30
30
  declare const Paragraph: React.FC<IParagraphProps>;
31
31
  export default Paragraph;
@@ -7,13 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports["default"] = void 0;
9
9
 
10
- require("core-js/modules/es.array.concat");
11
-
12
- require("core-js/modules/es.array.includes");
13
-
14
10
  require("core-js/modules/es.object.values");
15
11
 
16
- require("core-js/modules/es.string.includes");
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
17
13
 
18
14
  var React = _interopRequireWildcard(require("react"));
19
15
 
@@ -25,21 +21,17 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
25
21
 
26
22
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
23
 
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
+
28
26
  var COLORS = {
27
+ INHERIT: 'inherit',
28
+ DEFAULT: 'default',
29
+ WHITE: 'white',
29
30
  GREEN: 'green',
30
31
  PURPLE: 'purple',
31
- BASE: 'base',
32
32
  SPB_SKY_0: 'spbSky0',
33
33
  SPB_SKY_1: 'spbSky1',
34
- SPB_SKY_2: 'spbSky2',
35
- CONTENT: 'content',
36
- INHERIT: 'inherit',
37
-
38
- /** @deprecated */
39
- CLEAR_WHITE: 'clearWhite',
40
-
41
- /** @deprecated */
42
- FRESH_ASPHALT: 'freshAsphalt'
34
+ SPB_SKY_2: 'spbSky2'
43
35
  };
44
36
  var cn = (0, _uiHelpers.cnCreate)('mfui-paragraph');
45
37
 
@@ -48,44 +40,30 @@ var Paragraph = function Paragraph(_ref) {
48
40
  size = _ref$size === void 0 ? 'regular' : _ref$size,
49
41
  align = _ref.align,
50
42
  _ref$color = _ref.color,
51
- color = _ref$color === void 0 ? 'freshAsphalt' : _ref$color,
43
+ color = _ref$color === void 0 ? COLORS.DEFAULT : _ref$color,
52
44
  className = _ref.className,
53
45
  _ref$hasMargin = _ref.hasMargin,
54
46
  hasMargin = _ref$hasMargin === void 0 ? true : _ref$hasMargin,
47
+ dataAttrs = _ref.dataAttrs,
55
48
  children = _ref.children;
56
- return /*#__PURE__*/React.createElement("p", {
49
+ return /*#__PURE__*/React.createElement("p", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
57
50
  className: cn({
58
51
  size: size,
59
52
  align: align,
60
53
  color: color,
61
54
  'has-margin': hasMargin
62
55
  }, className)
63
- }, children);
56
+ }), children);
64
57
  };
65
58
 
66
59
  Paragraph.propTypes = {
60
+ dataAttrs: PropTypes.shape({
61
+ root: PropTypes.objectOf(PropTypes.string.isRequired)
62
+ }),
67
63
  align: PropTypes.oneOf(['left', 'center', 'right']),
68
64
  size: PropTypes.oneOf(['regular', 'small']),
69
65
  hasMargin: PropTypes.bool,
70
- color: function color(props, propName, componentName) {
71
- var deprecatedBlackValue = COLORS.FRESH_ASPHALT;
72
- var deprecatedWhiteValue = COLORS.CLEAR_WHITE;
73
- var propValue = props[propName];
74
-
75
- if (propValue && !Object.values(COLORS).includes(propValue)) {
76
- 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), "]"));
77
- }
78
-
79
- if (propValue && props[propName] === deprecatedBlackValue) {
80
- 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, "'"));
81
- }
82
-
83
- if (propValue && props[propName] === deprecatedWhiteValue) {
84
- 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, "'"));
85
- }
86
-
87
- return null;
88
- }
66
+ color: PropTypes.oneOf(Object.values(COLORS))
89
67
  };
90
68
  var _default = Paragraph;
91
69
  exports["default"] = _default;
@@ -26,6 +26,10 @@ export interface IPreloaderProps {
26
26
  sizeMobile?: PreloaderSizesType;
27
27
  /** Дополнительный класс корневого элемента */
28
28
  className?: string;
29
+ /** Дополнительные data атрибуты к внутренним элементам */
30
+ dataAttrs?: {
31
+ root?: Record<string, string>;
32
+ };
29
33
  }
30
34
  declare const Preloader: React.FC<IPreloaderProps>;
31
35
  export default Preloader;
@@ -11,6 +11,8 @@ require("core-js/modules/es.object.values");
11
11
 
12
12
  require("core-js/modules/web.timers");
13
13
 
14
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
+
14
16
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
17
 
16
18
  var React = _interopRequireWildcard(require("react"));
@@ -47,7 +49,8 @@ var Preloader = function Preloader(_ref) {
47
49
  sizeDesktop = _ref.sizeDesktop,
48
50
  sizeTablet = _ref.sizeTablet,
49
51
  sizeMobile = _ref.sizeMobile,
50
- className = _ref.className;
52
+ className = _ref.className,
53
+ dataAttrs = _ref.dataAttrs;
51
54
 
52
55
  var _React$useState = React.useState(false),
53
56
  _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
@@ -62,7 +65,7 @@ var Preloader = function Preloader(_ref) {
62
65
  clearTimeout(timerId);
63
66
  };
64
67
  }, []);
65
- return isShowed ? /*#__PURE__*/React.createElement("div", {
68
+ return isShowed ? /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
66
69
  className: cn({
67
70
  color: color,
68
71
  'size-all': sizeAll,
@@ -71,7 +74,7 @@ var Preloader = function Preloader(_ref) {
71
74
  'size-tablet': sizeTablet,
72
75
  'size-mobile': sizeMobile
73
76
  }, className)
74
- }, /*#__PURE__*/React.createElement("div", {
77
+ }), /*#__PURE__*/React.createElement("div", {
75
78
  className: cn('item', {
76
79
  first: true
77
80
  })
@@ -93,7 +96,10 @@ Preloader.propTypes = {
93
96
  sizeDesktop: PropTypes.oneOf(Object.values(PreloaderSizes)),
94
97
  sizeTablet: PropTypes.oneOf(Object.values(PreloaderSizes)),
95
98
  sizeMobile: PropTypes.oneOf(Object.values(PreloaderSizes)),
96
- className: PropTypes.string
99
+ className: PropTypes.string,
100
+ dataAttrs: PropTypes.shape({
101
+ root: PropTypes.objectOf(PropTypes.string.isRequired)
102
+ })
97
103
  };
98
104
  var _default = Preloader;
99
105
  exports["default"] = _default;
@@ -1,8 +1,6 @@
1
1
  import * as React from 'react';
2
- import { IFilterDataAttrs } from '@megafon/ui-helpers';
3
- import * as PropTypes from 'prop-types';
4
2
  import './RadioButton.less';
5
- export interface IRadioButtonProps extends IFilterDataAttrs {
3
+ export interface IRadioButtonProps {
6
4
  /** Значение */
7
5
  value: string;
8
6
  /** Имя для тега form */
@@ -22,35 +20,17 @@ export interface IRadioButtonProps extends IFilterDataAttrs {
22
20
  customInput?: string;
23
21
  labelText?: string;
24
22
  };
23
+ /** Дополнительные data атрибуты к внутренним элементам */
24
+ dataAttrs?: {
25
+ root?: Record<string, string>;
26
+ input?: Record<string, string>;
27
+ text?: Record<string, string>;
28
+ };
25
29
  children?: React.ReactNode;
26
30
  /** Обработчик изменения значения 'value' */
27
31
  onChange?: (value: string) => void;
28
32
  /** Ссылка на input */
29
33
  inputRef?: React.Ref<HTMLInputElement>;
30
34
  }
31
- declare class RadioButton extends React.Component<IRadioButtonProps> {
32
- static propTypes: {
33
- value: PropTypes.Validator<string>;
34
- name: PropTypes.Requireable<string>;
35
- textSize: PropTypes.Requireable<string>;
36
- disabled: PropTypes.Requireable<boolean>;
37
- isChecked: PropTypes.Requireable<boolean>;
38
- className: PropTypes.Requireable<string>;
39
- classes: PropTypes.Requireable<PropTypes.InferProps<{
40
- root: PropTypes.Requireable<string>;
41
- label: PropTypes.Requireable<string>;
42
- customInput: PropTypes.Requireable<string>;
43
- labelText: PropTypes.Requireable<string>;
44
- }>>;
45
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
46
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
47
- inputRef: PropTypes.Requireable<any>;
48
- dataAttrs: PropTypes.Requireable<{
49
- [x: string]: string;
50
- }>;
51
- };
52
- static defaultProps: Partial<IRadioButtonProps>;
53
- handleChange: () => void;
54
- render(): JSX.Element;
55
- }
35
+ declare const RadioButton: React.FC<IRadioButtonProps>;
56
36
  export default RadioButton;
@@ -11,30 +11,12 @@ require("core-js/modules/es.array.concat");
11
11
 
12
12
  require("core-js/modules/es.array.is-array");
13
13
 
14
- require("core-js/modules/es.date.to-string");
15
-
16
14
  require("core-js/modules/es.function.name");
17
15
 
18
- require("core-js/modules/es.object.to-string");
19
-
20
- require("core-js/modules/es.reflect.construct");
21
-
22
- require("core-js/modules/es.regexp.to-string");
23
-
24
16
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
25
17
 
26
18
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
27
19
 
28
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
29
-
30
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
31
-
32
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
33
-
34
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
35
-
36
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
37
-
38
20
  var React = _interopRequireWildcard(require("react"));
39
21
 
40
22
  var _uiHelpers = require("@megafon/ui-helpers");
@@ -47,102 +29,54 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
47
29
 
48
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
49
31
 
50
- function _createSuper(Derived) {
51
- return function () {
52
- var Super = (0, _getPrototypeOf2["default"])(Derived),
53
- result;
54
-
55
- if (_isNativeReflectConstruct()) {
56
- var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor;
57
- result = Reflect.construct(Super, arguments, NewTarget);
58
- } else {
59
- result = Super.apply(this, arguments);
60
- }
32
+ var cn = (0, _uiHelpers.cnCreate)('mfui-radio-button');
61
33
 
62
- return (0, _possibleConstructorReturn2["default"])(this, result);
34
+ var RadioButton = function RadioButton(_ref) {
35
+ var isChecked = _ref.isChecked,
36
+ _ref$disabled = _ref.disabled,
37
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
38
+ name = _ref.name,
39
+ value = _ref.value,
40
+ _ref$textSize = _ref.textSize,
41
+ textSize = _ref$textSize === void 0 ? 'medium' : _ref$textSize,
42
+ children = _ref.children,
43
+ inputRef = _ref.inputRef,
44
+ className = _ref.className,
45
+ _ref$classes = _ref.classes,
46
+ classes = _ref$classes === void 0 ? {} : _ref$classes,
47
+ dataAttrs = _ref.dataAttrs,
48
+ onChange = _ref.onChange;
49
+ var checkedProp = isChecked !== undefined ? {
50
+ checked: isChecked
51
+ } : {};
52
+ var rootClassNames = Array.isArray(className) ? [].concat((0, _toConsumableArray2["default"])(className), [classes.root]) : [className, classes.root];
53
+
54
+ var handleChange = function handleChange() {
55
+ return onChange && onChange(value);
63
56
  };
64
- }
65
-
66
- function _isNativeReflectConstruct() {
67
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
68
- if (Reflect.construct.sham) return false;
69
- if (typeof Proxy === "function") return true;
70
57
 
71
- try {
72
- Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
73
- return true;
74
- } catch (e) {
75
- return false;
76
- }
77
- }
78
-
79
- var cn = (0, _uiHelpers.cnCreate)('mfui-radio-button');
80
-
81
- var RadioButton = /*#__PURE__*/function (_React$Component) {
82
- (0, _inherits2["default"])(RadioButton, _React$Component);
83
-
84
- var _super = _createSuper(RadioButton);
85
-
86
- function RadioButton() {
87
- var _this;
88
-
89
- (0, _classCallCheck2["default"])(this, RadioButton);
90
- _this = _super.apply(this, arguments);
91
-
92
- _this.handleChange = function () {
93
- var _this$props = _this.props,
94
- onChange = _this$props.onChange,
95
- value = _this$props.value;
96
- onChange && onChange(value);
97
- };
98
-
99
- return _this;
100
- }
101
-
102
- (0, _createClass2["default"])(RadioButton, [{
103
- key: "render",
104
- value: function render() {
105
- var _this$props2 = this.props,
106
- isChecked = _this$props2.isChecked,
107
- disabled = _this$props2.disabled,
108
- name = _this$props2.name,
109
- value = _this$props2.value,
110
- textSize = _this$props2.textSize,
111
- children = _this$props2.children,
112
- inputRef = _this$props2.inputRef,
113
- className = _this$props2.className,
114
- _this$props2$classes = _this$props2.classes,
115
- classes = _this$props2$classes === void 0 ? {} : _this$props2$classes,
116
- dataAttrs = _this$props2.dataAttrs;
117
- var checkedProp = isChecked !== undefined ? {
118
- checked: isChecked
119
- } : {};
120
- var rootClassNames = Array.isArray(className) ? [].concat((0, _toConsumableArray2["default"])(className), [classes.root]) : [className, classes.root];
121
- return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
122
- className: cn(rootClassNames)
123
- }, (0, _uiHelpers.filterDataAttrs)(dataAttrs)), /*#__PURE__*/React.createElement("label", {
124
- className: cn('label', {
125
- disabled: disabled
126
- }, classes.label)
127
- }, /*#__PURE__*/React.createElement("input", (0, _extends2["default"])({}, checkedProp, {
128
- className: cn('input'),
129
- type: "radio",
130
- name: name,
131
- value: value,
132
- onChange: this.handleChange,
133
- disabled: disabled,
134
- ref: inputRef
135
- })), /*#__PURE__*/React.createElement("div", {
136
- className: cn('custom-input', classes.customInput)
137
- }), children && /*#__PURE__*/React.createElement("div", {
138
- className: cn('text', {
139
- size: textSize
140
- }, classes.labelText)
141
- }, children)));
142
- }
143
- }]);
144
- return RadioButton;
145
- }(React.Component);
58
+ return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
59
+ className: cn(rootClassNames)
60
+ }, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement("label", {
61
+ className: cn('label', {
62
+ disabled: disabled
63
+ }, classes.label)
64
+ }, /*#__PURE__*/React.createElement("input", (0, _extends2["default"])({}, checkedProp, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input), {
65
+ className: cn('input'),
66
+ type: "radio",
67
+ name: name,
68
+ value: value,
69
+ onChange: handleChange,
70
+ disabled: disabled,
71
+ ref: inputRef
72
+ })), /*#__PURE__*/React.createElement("div", {
73
+ className: cn('custom-input', classes.customInput)
74
+ }), children && /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.text), {
75
+ className: cn('text', {
76
+ size: textSize
77
+ }, classes.labelText)
78
+ }), children)));
79
+ };
146
80
 
147
81
  RadioButton.propTypes = {
148
82
  value: PropTypes.string.isRequired,
@@ -157,16 +91,16 @@ RadioButton.propTypes = {
157
91
  customInput: PropTypes.string,
158
92
  labelText: PropTypes.string
159
93
  }),
94
+ dataAttrs: PropTypes.shape({
95
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
96
+ input: PropTypes.objectOf(PropTypes.string.isRequired),
97
+ text: PropTypes.objectOf(PropTypes.string.isRequired)
98
+ }),
160
99
  children: PropTypes.node,
161
100
  onChange: PropTypes.func,
162
101
  inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
163
102
  current: PropTypes.elementType
164
- }), PropTypes.any])]),
165
- dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired)
166
- };
167
- RadioButton.defaultProps = {
168
- textSize: 'medium',
169
- disabled: false
103
+ }), PropTypes.any])])
170
104
  };
171
105
  var _default = RadioButton;
172
106
  exports["default"] = _default;