@megafon/ui-core 3.0.0-beta.6 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.md +51 -67
  2. package/dist/es/colors/Colors.d.ts +2 -2
  3. package/dist/es/components/Accordion/Accordion.css +1 -15
  4. package/dist/es/components/Accordion/Accordion.d.ts +11 -5
  5. package/dist/es/components/Accordion/Accordion.js +16 -14
  6. package/dist/es/components/Banner/Banner.css +28 -0
  7. package/dist/es/components/Banner/Banner.d.ts +12 -0
  8. package/dist/es/components/Banner/Banner.js +40 -21
  9. package/dist/es/components/Banner/BannerDot.d.ts +3 -0
  10. package/dist/es/components/Banner/BannerDot.js +8 -3
  11. package/dist/es/components/Button/Button.d.ts +8 -2
  12. package/dist/es/components/Button/Button.js +17 -9
  13. package/dist/es/components/Calendar/Calendar.js +3 -2
  14. package/dist/es/components/Calendar/components/Day/Day.js +1 -1
  15. package/dist/es/components/Carousel/Carousel.d.ts +9 -2
  16. package/dist/es/components/Carousel/Carousel.js +31 -22
  17. package/dist/es/components/Checkbox/Checkbox.d.ts +8 -2
  18. package/dist/es/components/Checkbox/Checkbox.js +13 -8
  19. package/dist/es/components/Collapse/Collapse.d.ts +15 -3
  20. package/dist/es/components/Collapse/Collapse.js +11 -4
  21. package/dist/es/components/Counter/Counter.js +3 -3
  22. package/dist/es/components/Header/Header.d.ts +5 -2
  23. package/dist/es/components/Header/Header.js +4 -2
  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 +7 -3
  27. package/dist/es/components/Link/Link.js +26 -10
  28. package/dist/es/components/Notification/Notification.d.ts +8 -0
  29. package/dist/es/components/Notification/Notification.js +21 -4
  30. package/dist/es/components/Pagination/Pagination.d.ts +9 -2
  31. package/dist/es/components/Pagination/Pagination.js +20 -3
  32. package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
  33. package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.js +12 -7
  34. package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +5 -2
  35. package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.js +10 -2
  36. package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +5 -2
  37. package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +6 -1
  38. package/dist/es/components/Pagination/helpers.d.ts +1 -1
  39. package/dist/es/components/Paragraph/Paragraph.css +0 -9
  40. package/dist/es/components/Paragraph/Paragraph.d.ts +4 -3
  41. package/dist/es/components/Paragraph/Paragraph.js +9 -7
  42. package/dist/es/components/Preloader/Preloader.d.ts +4 -0
  43. package/dist/es/components/Preloader/Preloader.js +10 -5
  44. package/dist/es/components/RadioButton/RadioButton.d.ts +7 -2
  45. package/dist/es/components/RadioButton/RadioButton.js +11 -7
  46. package/dist/es/components/Search/Search.js +4 -3
  47. package/dist/es/components/Select/Select.css +5 -2
  48. package/dist/es/components/Select/Select.d.ts +43 -50
  49. package/dist/es/components/Select/Select.js +374 -461
  50. package/dist/es/components/Select/reducer/selectReducer.d.ts +34 -0
  51. package/dist/es/components/Select/reducer/selectReducer.js +123 -0
  52. package/dist/es/components/Switcher/Switcher.css +19 -15
  53. package/dist/es/components/Switcher/Switcher.js +1 -1
  54. package/dist/es/components/Tabs/Tab.d.ts +5 -2
  55. package/dist/es/components/Tabs/Tab.js +4 -2
  56. package/dist/es/components/Tabs/Tabs.d.ts +10 -0
  57. package/dist/es/components/Tabs/Tabs.js +123 -70
  58. package/dist/es/components/TextField/TextField.d.ts +11 -1
  59. package/dist/es/components/TextField/TextField.js +36 -20
  60. package/dist/es/components/TextLink/TextLink.js +6 -1
  61. package/dist/es/components/Tile/Tile.d.ts +5 -2
  62. package/dist/es/components/Tile/Tile.js +2 -2
  63. package/dist/es/components/Tooltip/Tooltip.d.ts +5 -0
  64. package/dist/es/components/Tooltip/Tooltip.js +27 -19
  65. package/dist/es/index.d.ts +1 -0
  66. package/dist/es/index.js +1 -0
  67. package/dist/lib/colors/Colors.d.ts +2 -2
  68. package/dist/lib/components/Accordion/Accordion.css +1 -15
  69. package/dist/lib/components/Accordion/Accordion.d.ts +11 -5
  70. package/dist/lib/components/Accordion/Accordion.js +16 -14
  71. package/dist/lib/components/Banner/Banner.css +28 -0
  72. package/dist/lib/components/Banner/Banner.d.ts +12 -0
  73. package/dist/lib/components/Banner/Banner.js +40 -20
  74. package/dist/lib/components/Banner/BannerDot.d.ts +3 -0
  75. package/dist/lib/components/Banner/BannerDot.js +10 -2
  76. package/dist/lib/components/Button/Button.d.ts +8 -2
  77. package/dist/lib/components/Button/Button.js +17 -9
  78. package/dist/lib/components/Calendar/Calendar.js +3 -3
  79. package/dist/lib/components/Calendar/components/Day/Day.js +1 -1
  80. package/dist/lib/components/Carousel/Carousel.d.ts +9 -2
  81. package/dist/lib/components/Carousel/Carousel.js +29 -20
  82. package/dist/lib/components/Checkbox/Checkbox.d.ts +8 -2
  83. package/dist/lib/components/Checkbox/Checkbox.js +13 -8
  84. package/dist/lib/components/Collapse/Collapse.d.ts +15 -3
  85. package/dist/lib/components/Collapse/Collapse.js +13 -4
  86. package/dist/lib/components/Counter/Counter.js +3 -3
  87. package/dist/lib/components/Header/Header.d.ts +5 -2
  88. package/dist/lib/components/Header/Header.js +4 -2
  89. package/dist/lib/components/InputLabel/InputLabel.d.ts +3 -0
  90. package/dist/lib/components/InputLabel/InputLabel.js +11 -3
  91. package/dist/lib/components/Link/Link.d.ts +7 -3
  92. package/dist/lib/components/Link/Link.js +37 -23
  93. package/dist/lib/components/Notification/Notification.d.ts +8 -0
  94. package/dist/lib/components/Notification/Notification.js +20 -3
  95. package/dist/lib/components/Pagination/Pagination.d.ts +9 -2
  96. package/dist/lib/components/Pagination/Pagination.js +20 -2
  97. package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
  98. package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.js +12 -6
  99. package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +5 -2
  100. package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.js +9 -1
  101. package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +5 -2
  102. package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +6 -1
  103. package/dist/lib/components/Pagination/helpers.d.ts +1 -1
  104. package/dist/lib/components/Paragraph/Paragraph.css +0 -9
  105. package/dist/lib/components/Paragraph/Paragraph.d.ts +4 -3
  106. package/dist/lib/components/Paragraph/Paragraph.js +11 -6
  107. package/dist/lib/components/Preloader/Preloader.d.ts +4 -0
  108. package/dist/lib/components/Preloader/Preloader.js +10 -4
  109. package/dist/lib/components/RadioButton/RadioButton.d.ts +7 -2
  110. package/dist/lib/components/RadioButton/RadioButton.js +11 -7
  111. package/dist/lib/components/Search/Search.js +4 -3
  112. package/dist/lib/components/Select/Select.css +5 -2
  113. package/dist/lib/components/Select/Select.d.ts +43 -50
  114. package/dist/lib/components/Select/Select.js +368 -484
  115. package/dist/lib/components/Select/reducer/selectReducer.d.ts +34 -0
  116. package/dist/lib/components/Select/reducer/selectReducer.js +136 -0
  117. package/dist/lib/components/Switcher/Switcher.css +19 -15
  118. package/dist/lib/components/Switcher/Switcher.js +1 -1
  119. package/dist/lib/components/Tabs/Tab.d.ts +5 -2
  120. package/dist/lib/components/Tabs/Tab.js +4 -2
  121. package/dist/lib/components/Tabs/Tabs.d.ts +10 -0
  122. package/dist/lib/components/Tabs/Tabs.js +123 -70
  123. package/dist/lib/components/TextField/TextField.d.ts +11 -1
  124. package/dist/lib/components/TextField/TextField.js +34 -19
  125. package/dist/lib/components/TextLink/TextLink.js +6 -1
  126. package/dist/lib/components/Tile/Tile.d.ts +5 -2
  127. package/dist/lib/components/Tile/Tile.js +2 -2
  128. package/dist/lib/components/Tooltip/Tooltip.d.ts +5 -0
  129. package/dist/lib/components/Tooltip/Tooltip.js +26 -18
  130. package/dist/lib/index.d.ts +1 -0
  131. package/dist/lib/index.js +8 -0
  132. package/package.json +4 -4
@@ -2,7 +2,7 @@ import "core-js/modules/es.object.values";
2
2
  import "core-js/modules/es.string.link";
3
3
  import _extends from "@babel/runtime/helpers/extends";
4
4
  import React from 'react';
5
- import { cnCreate } from '@megafon/ui-helpers';
5
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
6
6
  import * as PropTypes from 'prop-types';
7
7
  import Header from "../Header/Header";
8
8
  import TextLink from "../TextLink/TextLink";
@@ -89,11 +89,15 @@ var Notification = function Notification(_ref) {
89
89
  href = _ref.href,
90
90
  target = _ref.target,
91
91
  icon = _ref.icon,
92
+ dataAttrs = _ref.dataAttrs,
92
93
  onClose = _ref.onClose,
93
94
  onLinkClick = _ref.onLinkClick;
94
95
 
95
96
  var renderLink = function renderLink() {
96
97
  return /*#__PURE__*/React.createElement(TextLink, {
98
+ dataAttrs: {
99
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.link
100
+ },
97
101
  className: cn('link'),
98
102
  onClick: onLinkClick,
99
103
  rel: rel,
@@ -129,6 +133,9 @@ var Notification = function Notification(_ref) {
129
133
  };
130
134
 
131
135
  return /*#__PURE__*/React.createElement(Tile, {
136
+ dataAttrs: {
137
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root
138
+ },
132
139
  radius: "rounded",
133
140
  shadowLevel: shadowLevel,
134
141
  className: cn({
@@ -142,19 +149,22 @@ var Notification = function Notification(_ref) {
142
149
  }, renderIcon()), /*#__PURE__*/React.createElement("div", {
143
150
  className: cn('content')
144
151
  }, title && /*#__PURE__*/React.createElement(Header, {
152
+ dataAttrs: {
153
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.title
154
+ },
145
155
  as: "h5",
146
156
  className: cn('title', {
147
157
  'close-padding': hasCloseButton
148
158
  })
149
- }, title), /*#__PURE__*/React.createElement("p", {
159
+ }, title), /*#__PURE__*/React.createElement("p", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.text), {
150
160
  className: cn('text', {
151
161
  'close-padding': hasCloseButton && !title
152
162
  })
153
- }, children), link && renderLink())), hasCloseButton && /*#__PURE__*/React.createElement("button", {
163
+ }), children), link && renderLink())), hasCloseButton && /*#__PURE__*/React.createElement("button", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.close), {
154
164
  className: cn('close'),
155
165
  type: "button",
156
166
  onClick: onClose
157
- }, /*#__PURE__*/React.createElement(CancelIcon, {
167
+ }), /*#__PURE__*/React.createElement(CancelIcon, {
158
168
  className: cn('close-icon')
159
169
  })));
160
170
  };
@@ -171,6 +181,13 @@ Notification.propTypes = {
171
181
  href: PropTypes.string,
172
182
  target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
173
183
  icon: PropTypes.element,
184
+ dataAttrs: PropTypes.shape({
185
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
186
+ title: PropTypes.objectOf(PropTypes.string.isRequired),
187
+ text: PropTypes.objectOf(PropTypes.string.isRequired),
188
+ link: PropTypes.objectOf(PropTypes.string.isRequired),
189
+ close: PropTypes.objectOf(PropTypes.string.isRequired)
190
+ }),
174
191
  onClose: PropTypes.func,
175
192
  onLinkClick: PropTypes.func
176
193
  };
@@ -1,6 +1,13 @@
1
1
  import React from 'react';
2
2
  import './Pagination.less';
3
- interface IPagination {
3
+ interface IPaginationProps {
4
+ /** Дополнительные data атрибуты к внутренним элементам */
5
+ dataAttrs?: {
6
+ root?: Record<string, string>;
7
+ prev?: Record<string, string>;
8
+ next?: Record<string, string>;
9
+ button?: Record<string, string>;
10
+ };
4
11
  /** Общее количество страниц */
5
12
  totalPages: number;
6
13
  /** Номер текущей страницы */
@@ -10,5 +17,5 @@ interface IPagination {
10
17
  /** Обработчик изменения активной страницы */
11
18
  onChange: (value: number) => void;
12
19
  }
13
- declare const Pagination: React.FC<IPagination>;
20
+ declare const Pagination: React.FC<IPaginationProps>;
14
21
  export default Pagination;
@@ -1,5 +1,6 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import React from 'react';
2
- import { cnCreate } from '@megafon/ui-helpers';
3
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
3
4
  import PropTypes from 'prop-types';
4
5
  import "./Pagination.css";
5
6
  import PaginationButtons from "./components/PaginationButtons/PaginationButtons";
@@ -10,6 +11,7 @@ var cn = cnCreate('mfui-pagination');
10
11
  var Pagination = function Pagination(_ref) {
11
12
  var totalPages = _ref.totalPages,
12
13
  activePage = _ref.activePage,
14
+ dataAttrs = _ref.dataAttrs,
13
15
  _ref$theme = _ref.theme,
14
16
  theme = _ref$theme === void 0 ? 'default' : _ref$theme,
15
17
  onChange = _ref.onChange;
@@ -23,21 +25,30 @@ var Pagination = function Pagination(_ref) {
23
25
  var handlePageButtonClick = React.useCallback(function (value) {
24
26
  onChange(value);
25
27
  }, [onChange]);
26
- return /*#__PURE__*/React.createElement("div", {
28
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
27
29
  className: cn()
28
- }, /*#__PURE__*/React.createElement(PaginationNavigation, {
30
+ }), /*#__PURE__*/React.createElement(PaginationNavigation, {
31
+ dataAttrs: {
32
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.prev
33
+ },
29
34
  direction: "left",
30
35
  disabled: activePage === Button.FIRST,
31
36
  onClick: handleBackClick,
32
37
  className: cn('button'),
33
38
  theme: theme
34
39
  }), /*#__PURE__*/React.createElement(PaginationButtons, {
40
+ dataAttrs: {
41
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button
42
+ },
35
43
  items: paginationItems,
36
44
  activeButton: activePage,
37
45
  hiddenButton: Button.HIDDEN,
38
46
  theme: theme,
39
47
  onClick: handlePageButtonClick
40
48
  }), /*#__PURE__*/React.createElement(PaginationNavigation, {
49
+ dataAttrs: {
50
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.next
51
+ },
41
52
  disabled: activePage === totalPages,
42
53
  onClick: handleNextClick,
43
54
  className: cn('button'),
@@ -49,6 +60,12 @@ Pagination.propTypes = {
49
60
  totalPages: PropTypes.number.isRequired,
50
61
  activePage: PropTypes.number.isRequired,
51
62
  theme: PropTypes.oneOf(['default', 'light']),
63
+ dataAttrs: PropTypes.shape({
64
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
65
+ prev: PropTypes.objectOf(PropTypes.string.isRequired),
66
+ next: PropTypes.objectOf(PropTypes.string.isRequired),
67
+ button: PropTypes.objectOf(PropTypes.string.isRequired)
68
+ }),
52
69
  onChange: PropTypes.func.isRequired
53
70
  };
54
71
  export default Pagination;
@@ -1,13 +1,16 @@
1
1
  import React from 'react';
2
2
  import './PaginationButton.less';
3
3
  declare type ValueType = string | number;
4
- export interface IPaginationButton {
4
+ export interface IPaginationButtonProps {
5
5
  disabled?: boolean;
6
6
  isActive?: boolean;
7
7
  theme?: 'default' | 'light';
8
+ value?: ValueType;
8
9
  className?: string;
10
+ dataAttrs?: {
11
+ root?: Record<string, string>;
12
+ };
9
13
  onClick?: (value?: ValueType) => void;
10
- value?: ValueType;
11
14
  }
12
- declare const PaginationButton: React.FC<IPaginationButton>;
15
+ declare const PaginationButton: React.FC<IPaginationButtonProps>;
13
16
  export default PaginationButton;
@@ -1,5 +1,6 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import React from 'react';
2
- import { cnCreate } from '@megafon/ui-helpers';
3
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
3
4
  import PropTypes from 'prop-types';
4
5
  import "./PaginationButton.css";
5
6
  var cn = cnCreate('mfui-pagination-button');
@@ -14,13 +15,14 @@ var PaginationButton = function PaginationButton(_ref) {
14
15
  className = _ref.className,
15
16
  children = _ref.children,
16
17
  onClick = _ref.onClick,
17
- value = _ref.value;
18
+ value = _ref.value,
19
+ dataAttrs = _ref.dataAttrs;
18
20
 
19
21
  var handleClick = function handleClick() {
20
- onClick && onClick(value);
22
+ onClick === null || onClick === void 0 ? void 0 : onClick(value);
21
23
  };
22
24
 
23
- return /*#__PURE__*/React.createElement("button", {
25
+ return /*#__PURE__*/React.createElement("button", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
24
26
  className: cn({
25
27
  active: isActive,
26
28
  theme: theme
@@ -28,7 +30,7 @@ var PaginationButton = function PaginationButton(_ref) {
28
30
  disabled: disabled,
29
31
  onClick: handleClick,
30
32
  type: "button"
31
- }, children);
33
+ }), children);
32
34
  };
33
35
 
34
36
  PaginationButton.propTypes = {
@@ -36,7 +38,10 @@ PaginationButton.propTypes = {
36
38
  isActive: PropTypes.bool,
37
39
  theme: PropTypes.oneOf(['default', 'light']),
38
40
  className: PropTypes.string,
39
- onClick: PropTypes.func,
40
- value: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
41
+ value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
42
+ dataAttrs: PropTypes.shape({
43
+ root: PropTypes.objectOf(PropTypes.string.isRequired)
44
+ }),
45
+ onClick: PropTypes.func
41
46
  };
42
47
  export default PaginationButton;
@@ -1,11 +1,14 @@
1
1
  import React from 'react';
2
2
  import './PaginationButtons.less';
3
- interface IPaginationButtons {
3
+ interface IPaginationButtonsProps {
4
4
  items: Array<string | number>;
5
5
  theme?: 'default' | 'light';
6
6
  activeButton: number;
7
7
  hiddenButton: string;
8
+ dataAttrs?: {
9
+ root?: Record<string, string>;
10
+ };
8
11
  onClick: (value?: number | string) => void;
9
12
  }
10
- declare const PaginationButtons: React.FC<IPaginationButtons>;
13
+ declare const PaginationButtons: React.FC<IPaginationButtonsProps>;
11
14
  export default PaginationButtons;
@@ -1,7 +1,7 @@
1
1
  import "core-js/modules/es.array.map";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import React from 'react';
4
- import { cnCreate } from '@megafon/ui-helpers';
4
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
5
5
  import PropTypes from 'prop-types';
6
6
  import PaginationButton from "../PaginationButton/PaginationButton";
7
7
  import "./PaginationButtons.css";
@@ -21,11 +21,13 @@ var PaginationButtons = function PaginationButtons(_ref) {
21
21
  theme = _ref.theme,
22
22
  onClick = _ref.onClick,
23
23
  activeButton = _ref.activeButton,
24
- hiddenButton = _ref.hiddenButton;
24
+ hiddenButton = _ref.hiddenButton,
25
+ dataAttrs = _ref.dataAttrs;
25
26
  return /*#__PURE__*/React.createElement("div", {
26
27
  className: cn()
27
28
  }, items.map(function (pageNumber, index) {
28
29
  var isHiddenButton = hiddenButton === pageNumber;
30
+ var dataIndex = typeof pageNumber === 'number' ? pageNumber : undefined;
29
31
 
30
32
  if (isHiddenButton) {
31
33
  return /*#__PURE__*/React.createElement(PaginationButton, {
@@ -38,6 +40,9 @@ var PaginationButtons = function PaginationButtons(_ref) {
38
40
 
39
41
  var isActive = pageNumber === activeButton;
40
42
  return /*#__PURE__*/React.createElement(PaginationButton, {
43
+ dataAttrs: {
44
+ root: filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root, dataIndex)
45
+ },
41
46
  isActive: isActive,
42
47
  key: index,
43
48
  className: cn('button'),
@@ -53,6 +58,9 @@ PaginationButtons.propTypes = {
53
58
  theme: PropTypes.oneOf(['default', 'light']),
54
59
  activeButton: PropTypes.number.isRequired,
55
60
  hiddenButton: PropTypes.string.isRequired,
61
+ dataAttrs: PropTypes.shape({
62
+ root: PropTypes.objectOf(PropTypes.string.isRequired)
63
+ }),
56
64
  onClick: PropTypes.func.isRequired
57
65
  };
58
66
  export default PaginationButtons;
@@ -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;
@@ -22,8 +22,10 @@ var PaginationNavigation = function PaginationNavigation(_ref) {
22
22
  disabled = _ref.disabled,
23
23
  isActive = _ref.isActive,
24
24
  onClick = _ref.onClick,
25
- className = _ref.className;
25
+ className = _ref.className,
26
+ dataAttrs = _ref.dataAttrs;
26
27
  return /*#__PURE__*/React.createElement(PaginationButton, {
28
+ dataAttrs: dataAttrs,
27
29
  className: cn({
28
30
  direction: direction
29
31
  }, className),
@@ -42,6 +44,9 @@ PaginationNavigation.propTypes = {
42
44
  disabled: PropTypes.bool,
43
45
  isActive: PropTypes.bool,
44
46
  className: PropTypes.string,
47
+ dataAttrs: PropTypes.shape({
48
+ root: PropTypes.objectOf(PropTypes.string.isRequired)
49
+ }),
45
50
  onClick: PropTypes.func
46
51
  };
47
52
  export default PaginationNavigation;
@@ -1,2 +1,2 @@
1
- declare const getRange: (from: any, to: any, step?: number) => number[];
1
+ declare const getRange: (from: number, to: number, step?: number) => number[];
2
2
  export default getRange;
@@ -38,12 +38,3 @@
38
38
  .mfui-paragraph_color_purple {
39
39
  color: var(--brandPurple);
40
40
  }
41
- .mfui-paragraph_color_spbSky0 {
42
- color: var(--spbSky0);
43
- }
44
- .mfui-paragraph_color_spbSky1 {
45
- color: var(--spbSky1);
46
- }
47
- .mfui-paragraph_color_spbSky2 {
48
- color: var(--spbSky2);
49
- }
@@ -6,9 +6,6 @@ declare const COLORS: {
6
6
  readonly WHITE: "white";
7
7
  readonly GREEN: "green";
8
8
  readonly PURPLE: "purple";
9
- readonly SPB_SKY_0: "spbSky0";
10
- readonly SPB_SKY_1: "spbSky1";
11
- readonly SPB_SKY_2: "spbSky2";
12
9
  };
13
10
  declare type ColorType = typeof COLORS[keyof typeof COLORS];
14
11
  export interface IParagraphProps {
@@ -22,6 +19,10 @@ export interface IParagraphProps {
22
19
  color?: ColorType;
23
20
  /** Дополнительный класс корневого элемента */
24
21
  className?: string;
22
+ /** Дополнительные data атрибуты к внутренним элементам */
23
+ dataAttrs?: {
24
+ root?: Record<string, string>;
25
+ };
25
26
  }
26
27
  declare const Paragraph: React.FC<IParagraphProps>;
27
28
  export default Paragraph;
@@ -1,6 +1,7 @@
1
1
  import "core-js/modules/es.object.values";
2
+ import _extends from "@babel/runtime/helpers/extends";
2
3
  import * as React from 'react';
3
- import { cnCreate } from '@megafon/ui-helpers';
4
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
4
5
  import * as PropTypes from 'prop-types';
5
6
  import "./Paragraph.css";
6
7
  var COLORS = {
@@ -8,10 +9,7 @@ var COLORS = {
8
9
  DEFAULT: 'default',
9
10
  WHITE: 'white',
10
11
  GREEN: 'green',
11
- PURPLE: 'purple',
12
- SPB_SKY_0: 'spbSky0',
13
- SPB_SKY_1: 'spbSky1',
14
- SPB_SKY_2: 'spbSky2'
12
+ PURPLE: 'purple'
15
13
  };
16
14
  var cn = cnCreate('mfui-paragraph');
17
15
 
@@ -24,18 +22,22 @@ var Paragraph = function Paragraph(_ref) {
24
22
  className = _ref.className,
25
23
  _ref$hasMargin = _ref.hasMargin,
26
24
  hasMargin = _ref$hasMargin === void 0 ? true : _ref$hasMargin,
25
+ dataAttrs = _ref.dataAttrs,
27
26
  children = _ref.children;
28
- return /*#__PURE__*/React.createElement("p", {
27
+ return /*#__PURE__*/React.createElement("p", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
29
28
  className: cn({
30
29
  size: size,
31
30
  align: align,
32
31
  color: color,
33
32
  'has-margin': hasMargin
34
33
  }, className)
35
- }, children);
34
+ }), children);
36
35
  };
37
36
 
38
37
  Paragraph.propTypes = {
38
+ dataAttrs: PropTypes.shape({
39
+ root: PropTypes.objectOf(PropTypes.string.isRequired)
40
+ }),
39
41
  align: PropTypes.oneOf(['left', 'center', 'right']),
40
42
  size: PropTypes.oneOf(['regular', 'small']),
41
43
  hasMargin: PropTypes.bool,
@@ -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;
@@ -1,8 +1,9 @@
1
1
  import "core-js/modules/es.object.values";
2
2
  import "core-js/modules/web.timers";
3
+ import _extends from "@babel/runtime/helpers/extends";
3
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
5
  import * as React from 'react';
5
- import { cnCreate } from '@megafon/ui-helpers';
6
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
6
7
  import * as PropTypes from 'prop-types';
7
8
  import "./Preloader.css";
8
9
  export var PreloaderColors = {
@@ -25,7 +26,8 @@ var Preloader = function Preloader(_ref) {
25
26
  sizeDesktop = _ref.sizeDesktop,
26
27
  sizeTablet = _ref.sizeTablet,
27
28
  sizeMobile = _ref.sizeMobile,
28
- className = _ref.className;
29
+ className = _ref.className,
30
+ dataAttrs = _ref.dataAttrs;
29
31
 
30
32
  var _React$useState = React.useState(false),
31
33
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -40,7 +42,7 @@ var Preloader = function Preloader(_ref) {
40
42
  clearTimeout(timerId);
41
43
  };
42
44
  }, []);
43
- return isShowed ? /*#__PURE__*/React.createElement("div", {
45
+ return isShowed ? /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
44
46
  className: cn({
45
47
  color: color,
46
48
  'size-all': sizeAll,
@@ -49,7 +51,7 @@ var Preloader = function Preloader(_ref) {
49
51
  'size-tablet': sizeTablet,
50
52
  'size-mobile': sizeMobile
51
53
  }, className)
52
- }, /*#__PURE__*/React.createElement("div", {
54
+ }), /*#__PURE__*/React.createElement("div", {
53
55
  className: cn('item', {
54
56
  first: true
55
57
  })
@@ -71,6 +73,9 @@ Preloader.propTypes = {
71
73
  sizeDesktop: PropTypes.oneOf(Object.values(PreloaderSizes)),
72
74
  sizeTablet: PropTypes.oneOf(Object.values(PreloaderSizes)),
73
75
  sizeMobile: PropTypes.oneOf(Object.values(PreloaderSizes)),
74
- className: PropTypes.string
76
+ className: PropTypes.string,
77
+ dataAttrs: PropTypes.shape({
78
+ root: PropTypes.objectOf(PropTypes.string.isRequired)
79
+ })
75
80
  };
76
81
  export default Preloader;
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
- import { IFilterDataAttrs } from '@megafon/ui-helpers';
3
2
  import './RadioButton.less';
4
- export interface IRadioButtonProps extends IFilterDataAttrs {
3
+ export interface IRadioButtonProps {
5
4
  /** Значение */
6
5
  value: string;
7
6
  /** Имя для тега form */
@@ -21,6 +20,12 @@ export interface IRadioButtonProps extends IFilterDataAttrs {
21
20
  customInput?: string;
22
21
  labelText?: string;
23
22
  };
23
+ /** Дополнительные data атрибуты к внутренним элементам */
24
+ dataAttrs?: {
25
+ root?: Record<string, string>;
26
+ input?: Record<string, string>;
27
+ text?: Record<string, string>;
28
+ };
24
29
  children?: React.ReactNode;
25
30
  /** Обработчик изменения значения 'value' */
26
31
  onChange?: (value: string) => void;
@@ -30,16 +30,16 @@ var RadioButton = function RadioButton(_ref) {
30
30
  var rootClassNames = Array.isArray(className) ? [].concat(_toConsumableArray(className), [classes.root]) : [className, classes.root];
31
31
 
32
32
  var handleChange = function handleChange() {
33
- return onChange && onChange(value);
33
+ return onChange === null || onChange === void 0 ? void 0 : onChange(value);
34
34
  };
35
35
 
36
36
  return /*#__PURE__*/React.createElement("div", _extends({
37
37
  className: cn(rootClassNames)
38
- }, filterDataAttrs(dataAttrs)), /*#__PURE__*/React.createElement("label", {
38
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement("label", {
39
39
  className: cn('label', {
40
40
  disabled: disabled
41
41
  }, classes.label)
42
- }, /*#__PURE__*/React.createElement("input", _extends({}, checkedProp, {
42
+ }, /*#__PURE__*/React.createElement("input", _extends({}, checkedProp, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input), {
43
43
  className: cn('input'),
44
44
  type: "radio",
45
45
  name: name,
@@ -49,11 +49,11 @@ var RadioButton = function RadioButton(_ref) {
49
49
  ref: inputRef
50
50
  })), /*#__PURE__*/React.createElement("div", {
51
51
  className: cn('custom-input', classes.customInput)
52
- }), children && /*#__PURE__*/React.createElement("div", {
52
+ }), children && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.text), {
53
53
  className: cn('text', {
54
54
  size: textSize
55
55
  }, classes.labelText)
56
- }, children)));
56
+ }), children)));
57
57
  };
58
58
 
59
59
  RadioButton.propTypes = {
@@ -69,11 +69,15 @@ RadioButton.propTypes = {
69
69
  customInput: PropTypes.string,
70
70
  labelText: PropTypes.string
71
71
  }),
72
+ dataAttrs: PropTypes.shape({
73
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
74
+ input: PropTypes.objectOf(PropTypes.string.isRequired),
75
+ text: PropTypes.objectOf(PropTypes.string.isRequired)
76
+ }),
72
77
  children: PropTypes.node,
73
78
  onChange: PropTypes.func,
74
79
  inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
75
80
  current: PropTypes.elementType
76
- }), PropTypes.any])]),
77
- dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired)
81
+ }), PropTypes.any])])
78
82
  };
79
83
  export default RadioButton;
@@ -72,7 +72,7 @@ var Search = function Search(_ref) {
72
72
  setActiveIndex(-1);
73
73
 
74
74
  if (changeDelay === 0) {
75
- onChange && onChange(inputValue);
75
+ onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
76
76
  } else {
77
77
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
78
78
  // @ts-ignore
@@ -93,7 +93,7 @@ var Search = function Search(_ref) {
93
93
  }
94
94
 
95
95
  var chosenValue = items[index].value;
96
- onSubmit && onSubmit(chosenValue);
96
+ onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(chosenValue);
97
97
  }, [disabled, items, onSubmit]);
98
98
  var handleSelectSubmit = React.useCallback(function () {
99
99
  return function () {
@@ -105,7 +105,7 @@ var Search = function Search(_ref) {
105
105
  }, []);
106
106
  var handleBlur = React.useCallback(function (e) {
107
107
  setFocus(false);
108
- onBlur && onBlur(e);
108
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
109
109
  }, [onBlur]);
110
110
  var handleClick = React.useCallback(function () {
111
111
  if (activeIndex >= 0) {
@@ -125,6 +125,7 @@ var Search = function Search(_ref) {
125
125
  e.preventDefault();
126
126
  } else if (e.key === 'Enter' && activeIndex > -1) {
127
127
  handleItemSubmit(activeIndex);
128
+ e.preventDefault();
128
129
  } else if (e.key === 'Enter' && activeIndex === -1) {
129
130
  handleSearchSubmit();
130
131
  }
@@ -150,7 +150,7 @@
150
150
  background-color: var(--base);
151
151
  cursor: pointer;
152
152
  }
153
- .mfui-select__list-item_active {
153
+ .mfui-select__list-item_hovered {
154
154
  background-color: var(--spbSky0);
155
155
  }
156
156
  .mfui-select__item-title {
@@ -177,7 +177,10 @@
177
177
  background: -webkit-gradient(linear, left top, right top, from(rgba(255, 255, 255, 0)), to(var(--base)));
178
178
  background: linear-gradient(to right, rgba(255, 255, 255, 0), var(--base));
179
179
  }
180
- .mfui-select__list-item_active .mfui-select__item-title:after {
180
+ .mfui-select__item-title_active {
181
+ font-weight: bold;
182
+ }
183
+ .mfui-select__list-item_hovered .mfui-select__item-title:after {
181
184
  background: -webkit-gradient(linear, left top, right top, from(rgba(255, 255, 255, 0)), to(var(--spbSky0)));
182
185
  background: linear-gradient(to right, rgba(255, 255, 255, 0), var(--spbSky0));
183
186
  }