@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
package/CHANGELOG.md CHANGED
@@ -3,6 +3,69 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.0.0-beta.7](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.0-beta.6...@megafon/ui-core@3.0.0-beta.7) (2022-02-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **components:** change tests for dataAttrs prop ([2a8f306](https://github.com/MegafonWebLab/megafon-ui/commit/2a8f3061a4e89f6877894e5947db7bae2827f86a))
12
+
13
+
14
+ ### Features
15
+
16
+ * **components:** add dataAttrs props in new format ([026d868](https://github.com/MegafonWebLab/megafon-ui/commit/026d8681743d55ea8c93d17000a64959093f7a05))
17
+
18
+
19
+
20
+
21
+
22
+ # [3.0.0-beta.6](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.0-beta.5...@megafon/ui-core@3.0.0-beta.6) (2022-02-02)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * color props values changes ([b279f2b](https://github.com/MegafonWebLab/megafon-ui/commit/b279f2b5af0edae92fe9825bbfa90a207cb8009a))
28
+ * remove deprecated props values ([add76f3](https://github.com/MegafonWebLab/megafon-ui/commit/add76f38a9ebad8b5b6504dfe6aae862746f0dfc))
29
+ * **colors:** rename green and purple to brandGreen and brandPurple ([2266734](https://github.com/MegafonWebLab/megafon-ui/commit/2266734336be1a0faa5f1736fdf39070442837b3))
30
+ * **core:** fix build ui-core ([458c824](https://github.com/MegafonWebLab/megafon-ui/commit/458c824aab639e4802db261d0416b3cee58ac274))
31
+ * **core:** separated colors.css file ([f0a4d72](https://github.com/MegafonWebLab/megafon-ui/commit/f0a4d728e0b30c5caeae5c8d9607e624fb4ea288))
32
+ * **textlink:** fix color prop type ([6edcea0](https://github.com/MegafonWebLab/megafon-ui/commit/6edcea06ce26d137611aaf022d3ee6f7da295366))
33
+
34
+
35
+ ### BREAKING CHANGES
36
+
37
+ * ContentArea: prop color change values from 'base' to 'white' and from 'content' to 'default';
38
+ remove depreacted value 'freshAsphalt'
39
+ Paragraph: prop color change values from 'base' to 'white' and from 'contend' to 'default';
40
+ remove deprecared values 'freshAsphalt' and 'clearWhite'
41
+ StoreBanner: prop theme change value from 'black' to 'default'; remove deprecated value 'clearWhite'
42
+ * ContentArea, Paragraph, StoreBanner and Breadcrumbs components from no don't have
43
+ freshAsphalt and clearWhite as values for colorize props
44
+
45
+
46
+
47
+
48
+
49
+ # [3.0.0-beta.5](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.0-beta.4...@megafon/ui-core@3.0.0-beta.5) (2022-01-28)
50
+
51
+
52
+ ### Features
53
+
54
+ * **header:** made header as a functional component ([81701ad](https://github.com/MegafonWebLab/megafon-ui/commit/81701ad87b6e9df2fe630bf4e183383264c0bb01))
55
+ * **radiobutton:** made radiobutton as a functional component ([65406af](https://github.com/MegafonWebLab/megafon-ui/commit/65406afc90fd82f7eb0fdcbbe78569fc98164e78))
56
+
57
+
58
+
59
+
60
+
61
+ # [3.0.0-beta.4](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.0-beta.3...@megafon/ui-core@3.0.0-beta.4) (2022-01-27)
62
+
63
+ **Note:** Version bump only for package @megafon/ui-core
64
+
65
+
66
+
67
+
68
+
6
69
  # [3.0.0-beta.3](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.0-beta.2...@megafon/ui-core@3.0.0-beta.3) (2022-01-24)
7
70
 
8
71
 
@@ -128,6 +128,19 @@ var Colors = function Colors() {
128
128
  _React$useState2 = _slicedToArray(_React$useState, 2),
129
129
  setCurrentTheme = _React$useState2[1];
130
130
 
131
+ var _React$useState3 = React.useState(false),
132
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
133
+ setLoad = _React$useState4[1];
134
+
135
+ React.useEffect(function () {
136
+ function load() {
137
+ setLoad(true);
138
+ document.removeEventListener('css-var-load', load);
139
+ }
140
+
141
+ document.addEventListener('css-var-load', load);
142
+ }, []);
143
+
131
144
  var getCurrentColorValue = function getCurrentColorValue(code) {
132
145
  return typeof document !== 'undefined' ? document.documentElement.style.getPropertyValue("--".concat(code)) : '';
133
146
  };
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
- import { IFilterDataAttrs } from '@megafon/ui-helpers';
3
2
  import './Accordion.less';
4
- export interface IAccordionProps extends IFilterDataAttrs {
3
+ export interface IAccordionProps {
5
4
  /** Ссылка на корневой элемент */
6
5
  rootRef?: React.Ref<HTMLDivElement>;
7
6
  /** Заголовок */
@@ -14,11 +13,20 @@ export interface IAccordionProps extends IFilterDataAttrs {
14
13
  className?: string;
15
14
  /** Дополнительные классы для корневого и внутренних элементов */
16
15
  classes?: {
17
- openedClass?: string;
18
16
  root?: string;
17
+ openedClass?: string;
19
18
  collapse?: string;
20
19
  titleWrap?: string;
21
20
  };
21
+ /** Дополнительные data атрибуты к внутренним элементам */
22
+ dataAttrs?: {
23
+ root?: Record<string, string>;
24
+ header?: Record<string, string>;
25
+ collapse?: Record<string, string>;
26
+ titleWrap?: Record<string, string>;
27
+ arrowUp?: Record<string, string>;
28
+ arrowDown?: Record<string, string>;
29
+ };
22
30
  /** Обработчик клика */
23
31
  onClickAccordion?: (isOpened: boolean) => void;
24
32
  }
@@ -60,30 +60,30 @@ var Accordion = function Accordion(_ref) {
60
60
  };
61
61
 
62
62
  var openedClassName = isOpenedState ? openedClass : undefined;
63
- return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs), {
63
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
64
64
  ref: rootRef,
65
65
  className: cn({
66
66
  open: isOpenedState
67
67
  }, [className, rootPropsClasses, openedClassName])
68
- }), /*#__PURE__*/React.createElement("div", {
68
+ }), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.titleWrap), {
69
69
  className: cn('title-wrap', [titleWrapPropsClasses]),
70
70
  onClick: handleClickTitle,
71
71
  onKeyDown: handleClickTitle
72
- }, /*#__PURE__*/React.createElement(Header, {
72
+ }), /*#__PURE__*/React.createElement(Header, _extends({
73
73
  as: "h5"
74
- }, title), /*#__PURE__*/React.createElement("div", {
74
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.header)), title), /*#__PURE__*/React.createElement("div", {
75
75
  tabIndex: 0,
76
76
  role: "button",
77
77
  className: cn('icon-box', {
78
78
  open: isOpenedState
79
79
  })
80
- }, isOpenedState ? /*#__PURE__*/React.createElement(ArrowUp, null) : /*#__PURE__*/React.createElement(ArrowDown, null))), /*#__PURE__*/React.createElement(Collapse, {
80
+ }, isOpenedState ? /*#__PURE__*/React.createElement(ArrowUp, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowUp)) : /*#__PURE__*/React.createElement(ArrowDown, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowDown)))), /*#__PURE__*/React.createElement(Collapse, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.collapse), {
81
81
  className: cn('content', collapsePropsClasses),
82
82
  classNameContainer: cn('content-inner', {
83
83
  'v-padding': hasVerticalPaddings
84
84
  }),
85
85
  isOpened: isOpenedState
86
- }, children));
86
+ }), children));
87
87
  };
88
88
 
89
89
  Accordion.propTypes = {
@@ -100,7 +100,14 @@ Accordion.propTypes = {
100
100
  collapse: PropTypes.string,
101
101
  titleWrap: PropTypes.string
102
102
  }),
103
- dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
103
+ dataAttrs: PropTypes.shape({
104
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
105
+ header: PropTypes.objectOf(PropTypes.string.isRequired),
106
+ collapse: PropTypes.objectOf(PropTypes.string.isRequired),
107
+ titleWrap: PropTypes.objectOf(PropTypes.string.isRequired),
108
+ arrowUp: PropTypes.objectOf(PropTypes.string.isRequired),
109
+ arrowDown: PropTypes.objectOf(PropTypes.string.isRequired)
110
+ }),
104
111
  onClickAccordion: PropTypes.func
105
112
  };
106
113
  export default Accordion;
@@ -16,6 +16,16 @@ export interface IBannerProps {
16
16
  slide?: string;
17
17
  arrow?: string;
18
18
  };
19
+ /** Дополнительные data атрибуты к внутренним элементам */
20
+ dataAttrs?: {
21
+ root?: Record<string, string>;
22
+ swiper?: Record<string, string>;
23
+ slide?: Record<string, string>;
24
+ arrowPrev?: Record<string, string>;
25
+ arrowNext?: Record<string, string>;
26
+ pagination?: Record<string, string>;
27
+ dot?: Record<string, string>;
28
+ };
19
29
  /** Автоматическая прокрутка */
20
30
  autoPlay?: boolean;
21
31
  /** Задержка автоматической прокрутки */
@@ -1,9 +1,10 @@
1
1
  import "core-js/modules/es.array.map";
2
2
  import "core-js/modules/es.object.values";
3
+ import _extends from "@babel/runtime/helpers/extends";
3
4
  import _typeof from "@babel/runtime/helpers/typeof";
4
5
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
6
  import * as React from 'react';
6
- import { cnCreate } from '@megafon/ui-helpers';
7
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
7
8
  import * as PropTypes from 'prop-types';
8
9
  import SwiperCore, { Autoplay } from 'swiper';
9
10
  import { Swiper, SwiperSlide } from 'swiper/react';
@@ -45,7 +46,8 @@ var Banner = function Banner(_ref) {
45
46
  onNextClick = _ref.onNextClick,
46
47
  onPrevClick = _ref.onPrevClick,
47
48
  onDotClick = _ref.onDotClick,
48
- onChange = _ref.onChange;
49
+ onChange = _ref.onChange,
50
+ dataAttrs = _ref.dataAttrs;
49
51
 
50
52
  var _React$useState = React.useState(),
51
53
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -146,11 +148,11 @@ var Banner = function Banner(_ref) {
146
148
  var handleAutoplayStop = React.useCallback(function () {
147
149
  setAutoPlayning(false);
148
150
  }, []);
149
- return /*#__PURE__*/React.createElement("div", {
151
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
150
152
  className: cn({
151
153
  'nav-theme': navTheme
152
154
  }, className)
153
- }, /*#__PURE__*/React.createElement(Swiper, {
155
+ }), /*#__PURE__*/React.createElement(Swiper, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.swiper), {
154
156
  className: cn('swiper'),
155
157
  loop: loop,
156
158
  autoplay: autoPlay ? getAutoPlayConfig(autoPlayDelay) : false,
@@ -161,19 +163,19 @@ var Banner = function Banner(_ref) {
161
163
  onSlideChange: handleSlideChange,
162
164
  onAutoplayStop: handleAutoplayStop,
163
165
  onTouchEnd: increaseAutoplayDelay
164
- }, React.Children.map(children, function (child, i) {
165
- return /*#__PURE__*/React.createElement(SwiperSlide, {
166
+ }), React.Children.map(children, function (child, i) {
167
+ return /*#__PURE__*/React.createElement(SwiperSlide, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
166
168
  key: i,
167
169
  className: cn('slide', classes === null || classes === void 0 ? void 0 : classes.slide)
168
- }, child);
169
- })), /*#__PURE__*/React.createElement(NavArrow, {
170
+ }), child);
171
+ })), /*#__PURE__*/React.createElement(NavArrow, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowPrev), {
170
172
  className: cn('arrow', {
171
173
  prev: true
172
174
  }, [classes.arrow]),
173
175
  onClick: handlePrevClick,
174
176
  disabled: !loop && isBeginning,
175
177
  theme: navArrowTheme
176
- }), /*#__PURE__*/React.createElement(NavArrow, {
178
+ })), /*#__PURE__*/React.createElement(NavArrow, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowNext), {
177
179
  className: cn('arrow', {
178
180
  next: true
179
181
  }, [classes.arrow]),
@@ -181,12 +183,15 @@ var Banner = function Banner(_ref) {
181
183
  onClick: handleNextClick,
182
184
  disabled: !loop && isEnd,
183
185
  theme: navArrowTheme
184
- }), /*#__PURE__*/React.createElement("div", {
186
+ })), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pagination), {
185
187
  className: cn('pagination', {
186
188
  theme: navTheme
187
189
  })
188
- }, React.Children.map(children, function (_, i) {
190
+ }), React.Children.map(children, function (_, i) {
189
191
  return /*#__PURE__*/React.createElement(BannerDot, {
192
+ dataAttrs: {
193
+ root: _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.dot, i + 1))
194
+ },
190
195
  key: i,
191
196
  className: cn('dot'),
192
197
  index: i,
@@ -204,6 +209,15 @@ Banner.propTypes = {
204
209
  classes: PropTypes.shape({
205
210
  slide: PropTypes.string
206
211
  }),
212
+ dataAttrs: PropTypes.shape({
213
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
214
+ swiper: PropTypes.objectOf(PropTypes.string.isRequired),
215
+ slide: PropTypes.objectOf(PropTypes.string.isRequired),
216
+ arrowPrev: PropTypes.objectOf(PropTypes.string.isRequired),
217
+ arrowNext: PropTypes.objectOf(PropTypes.string.isRequired),
218
+ pagination: PropTypes.objectOf(PropTypes.string.isRequired),
219
+ dot: PropTypes.objectOf(PropTypes.string.isRequired)
220
+ }),
207
221
  autoPlay: PropTypes.bool,
208
222
  autoPlayDelay: PropTypes.number,
209
223
  navTheme: PropTypes.oneOf(Object.values(NavTheme)),
@@ -6,6 +6,9 @@ export interface IBannerDotProps {
6
6
  isActive: boolean;
7
7
  showTimer: boolean;
8
8
  timerDelay: number;
9
+ dataAttrs?: {
10
+ root?: Record<string, string>;
11
+ };
9
12
  onClick: (index: number) => void;
10
13
  }
11
14
  declare const BannerDot: React.FC<IBannerDotProps>;
@@ -1,11 +1,13 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import * as React from 'react';
2
- import { cnCreate } from '@megafon/ui-helpers';
3
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
3
4
  import * as PropTypes from 'prop-types';
4
5
  import "./BannerDot.css";
5
6
  var cn = cnCreate('mfui-banner-dot');
6
7
 
7
8
  var BannerDot = function BannerDot(_ref) {
8
9
  var className = _ref.className,
10
+ dataAttrs = _ref.dataAttrs,
9
11
  index = _ref.index,
10
12
  isActive = _ref.isActive,
11
13
  showTimer = _ref.showTimer,
@@ -14,13 +16,13 @@ var BannerDot = function BannerDot(_ref) {
14
16
  var handleDotClick = React.useCallback(function () {
15
17
  onClick(index);
16
18
  }, [onClick, index]);
17
- return /*#__PURE__*/React.createElement("div", {
19
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
18
20
  className: cn({
19
21
  active: isActive,
20
22
  timer: showTimer
21
23
  }, className),
22
24
  onClick: handleDotClick
23
- }, showTimer && isActive && /*#__PURE__*/React.createElement("svg", {
25
+ }), showTimer && isActive && /*#__PURE__*/React.createElement("svg", {
24
26
  className: cn('timer'),
25
27
  viewBox: "0 0 100 100"
26
28
  }, /*#__PURE__*/React.createElement("circle", {
@@ -36,6 +38,9 @@ var BannerDot = function BannerDot(_ref) {
36
38
 
37
39
  BannerDot.propTypes = {
38
40
  className: PropTypes.string,
41
+ dataAttrs: PropTypes.shape({
42
+ root: PropTypes.objectOf(PropTypes.string.isRequired)
43
+ }),
39
44
  index: PropTypes.number.isRequired,
40
45
  isActive: PropTypes.bool.isRequired,
41
46
  showTimer: PropTypes.bool.isRequired,
@@ -1,5 +1,4 @@
1
1
  import React, { Ref } from 'react';
2
- import { IFilterDataAttrs } from '@megafon/ui-helpers';
3
2
  import './Button.less';
4
3
  export declare const ButtonTypes: {
5
4
  readonly PRIMARY: "primary";
@@ -19,7 +18,7 @@ export declare const ButtonSizes: {
19
18
  readonly LARGE: "large";
20
19
  };
21
20
  declare type ButtonSizesType = typeof ButtonSizes[keyof typeof ButtonSizes];
22
- export interface IButtonProps extends IFilterDataAttrs {
21
+ export interface IButtonProps {
23
22
  /** Дополнительный класс корневого элемента */
24
23
  className?: string | string[];
25
24
  /** Дополнительные классы для внутренних элементов */
@@ -31,6 +30,13 @@ export interface IButtonProps extends IFilterDataAttrs {
31
30
  /** Inner container class */
32
31
  inner?: string;
33
32
  };
33
+ /** Дополнительные data атрибуты к внутренним элементам */
34
+ dataAttrs?: {
35
+ root?: Record<string, string>;
36
+ content?: Record<string, string>;
37
+ inner?: Record<string, string>;
38
+ loader?: Record<string, string>;
39
+ };
34
40
  /** Тема компонента */
35
41
  theme?: ButtonThemesType;
36
42
  /** Тип компонента */
@@ -121,9 +121,9 @@ var Button = function Button(_ref) {
121
121
  return null;
122
122
  }
123
123
 
124
- return /*#__PURE__*/React.createElement("div", {
124
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.content), {
125
125
  className: cn('content', contentClassName)
126
- }, icon && /*#__PURE__*/React.createElement("div", {
126
+ }), icon && /*#__PURE__*/React.createElement("div", {
127
127
  className: cn('icon')
128
128
  }, icon), children && /*#__PURE__*/React.createElement("span", {
129
129
  className: cn('text')
@@ -145,6 +145,9 @@ var Button = function Button(_ref) {
145
145
  }, [icon, children]);
146
146
  var renderedLoader = React.useMemo(function () {
147
147
  return /*#__PURE__*/React.createElement(Preloader, {
148
+ dataAttrs: {
149
+ root: filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.loader)
150
+ },
148
151
  color: loaderColor,
149
152
  sizeAll: getLoaderSize(sizeAll),
150
153
  sizeWide: sizeWide && getLoaderSize(sizeWide),
@@ -174,7 +177,7 @@ var Button = function Button(_ref) {
174
177
  React.useEffect(function () {
175
178
  setTouch(detectTouch());
176
179
  }, []);
177
- return /*#__PURE__*/React.createElement(ElementType, _extends({}, filterDataAttrs(dataAttrs), {
180
+ return /*#__PURE__*/React.createElement(ElementType, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
178
181
  className: cn({
179
182
  type: type,
180
183
  theme: currentTheme,
@@ -197,9 +200,9 @@ var Button = function Button(_ref) {
197
200
  onClick: handleClick,
198
201
  disabled: !href && disabled,
199
202
  ref: buttonRef
200
- }), /*#__PURE__*/React.createElement("div", {
203
+ }), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.inner), {
201
204
  className: cn('inner', innerClassName)
202
- }, !showLoader ? renderedContent : renderedLoader));
205
+ }), !showLoader ? renderedContent : renderedLoader));
203
206
  };
204
207
 
205
208
  Button.propTypes = {
@@ -208,6 +211,12 @@ Button.propTypes = {
208
211
  content: PropTypes.string,
209
212
  inner: PropTypes.string
210
213
  }),
214
+ dataAttrs: PropTypes.shape({
215
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
216
+ content: PropTypes.objectOf(PropTypes.string.isRequired),
217
+ inner: PropTypes.objectOf(PropTypes.string.isRequired),
218
+ loader: PropTypes.objectOf(PropTypes.string.isRequired)
219
+ }),
211
220
  theme: PropTypes.oneOf(Object.values(ButtonThemes)),
212
221
  type: PropTypes.oneOf(Object.values(ButtonTypes)),
213
222
  href: PropTypes.string,
@@ -225,7 +234,6 @@ Button.propTypes = {
225
234
  showArrow: PropTypes.bool,
226
235
  icon: PropTypes.element,
227
236
  disabled: PropTypes.bool,
228
- dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
229
237
  buttonRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
230
238
  current: PropTypes.elementType
231
239
  }), PropTypes.any])]),
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import { IFilterDataAttrs } from '@megafon/ui-helpers';
3
2
  import SwiperCore from 'swiper';
4
3
  import { PaginationOptions } from 'swiper/types/components/pagination';
5
4
  import './Carousel.less';
@@ -24,7 +23,7 @@ export declare type SlidesSettingsType = {
24
23
  spaceBetween: number;
25
24
  };
26
25
  };
27
- export interface ICarouselProps extends IFilterDataAttrs {
26
+ export interface ICarouselProps {
28
27
  /** Ссылка на корневой элемент */
29
28
  rootRef?: React.Ref<HTMLDivElement>;
30
29
  /** Дополнительные классы для корневого элемента */
@@ -39,6 +38,14 @@ export interface ICarouselProps extends IFilterDataAttrs {
39
38
  next?: string;
40
39
  slide?: string;
41
40
  };
41
+ /** Дополнительные data атрибуты к внутренним элементам */
42
+ dataAttrs?: {
43
+ root?: Record<string, string>;
44
+ slider?: Record<string, string>;
45
+ prev?: Record<string, string>;
46
+ next?: Record<string, string>;
47
+ slide?: Record<string, string>;
48
+ };
42
49
  /** Настройки слайдов */
43
50
  slidesSettings?: SlidesSettingsType;
44
51
  /** Смена слайдов с зацикливанием */
@@ -215,7 +215,7 @@ var Carousel = function Carousel(_ref) {
215
215
  e.nativeEvent.preventDefault();
216
216
  };
217
217
 
218
- return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs), {
218
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
219
219
  ref: rootRef,
220
220
  className: cn({
221
221
  'nav-theme': navTheme
@@ -223,7 +223,7 @@ var Carousel = function Carousel(_ref) {
223
223
  onClick: handleRootClick
224
224
  }), /*#__PURE__*/React.createElement(Swiper, _extends({}, containerModifier ? {
225
225
  containerModifierClass: containerModifier
226
- } : {}, {
226
+ } : {}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slider), {
227
227
  className: cn('swiper', {
228
228
  'default-inner-indents': !innerIndentsClass
229
229
  }, [innerIndentsClass, containerClass]),
@@ -253,13 +253,13 @@ var Carousel = function Carousel(_ref) {
253
253
  onTouchEnd: increaseAutoplayDelay,
254
254
  onResize: handleSwiperResize
255
255
  }), React.Children.map(children, function (child, i) {
256
- return /*#__PURE__*/React.createElement(SwiperSlide, {
256
+ return /*#__PURE__*/React.createElement(SwiperSlide, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
257
257
  key: i,
258
258
  className: cn('slide', slideClass),
259
259
  onFocus: handleSlideFocus(i),
260
260
  onMouseDown: disableFocusOnSlideClick
261
- }, child);
262
- })), /*#__PURE__*/React.createElement(NavArrow, {
261
+ }), child);
262
+ })), /*#__PURE__*/React.createElement(NavArrow, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.prev), {
263
263
  className: cn('arrow', {
264
264
  prev: true,
265
265
  locked: isLocked
@@ -267,7 +267,7 @@ var Carousel = function Carousel(_ref) {
267
267
  onClick: handlePrevClick,
268
268
  disabled: !loop && isBeginning,
269
269
  theme: ArrowTheme.PURPLE
270
- }), /*#__PURE__*/React.createElement(NavArrow, {
270
+ })), /*#__PURE__*/React.createElement(NavArrow, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.next), {
271
271
  className: cn('arrow', {
272
272
  next: true,
273
273
  locked: isLocked
@@ -276,7 +276,7 @@ var Carousel = function Carousel(_ref) {
276
276
  onClick: handleNextClick,
277
277
  disabled: !loop && isEnd,
278
278
  theme: ArrowTheme.PURPLE
279
- }));
279
+ })));
280
280
  };
281
281
 
282
282
  Carousel.propTypes = {
@@ -293,7 +293,13 @@ Carousel.propTypes = {
293
293
  next: PropTypes.string,
294
294
  slide: PropTypes.string
295
295
  }),
296
- dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
296
+ dataAttrs: PropTypes.shape({
297
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
298
+ slider: PropTypes.objectOf(PropTypes.string.isRequired),
299
+ prev: PropTypes.objectOf(PropTypes.string.isRequired),
300
+ next: PropTypes.objectOf(PropTypes.string.isRequired),
301
+ slide: PropTypes.objectOf(PropTypes.string.isRequired)
302
+ }),
297
303
  slidesSettings: PropTypes.objectOf(checkBreakpointsPropTypes({
298
304
  slidesPerView: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(Object.values(SlidesPerView))]).isRequired,
299
305
  spaceBetween: PropTypes.number.isRequired,
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
- import { IFilterDataAttrs } from '@megafon/ui-helpers';
3
2
  import './Checkbox.less';
4
- export interface ICheckboxProps extends IFilterDataAttrs {
3
+ export interface ICheckboxProps {
5
4
  /** Цвет чекбокса */
6
5
  color?: 'dark' | 'light';
7
6
  /** Дополнительный класс корневого элемента */
@@ -11,6 +10,13 @@ export interface ICheckboxProps extends IFilterDataAttrs {
11
10
  inner?: string;
12
11
  icon?: string;
13
12
  };
13
+ /** Дополнительные data атрибуты к внутренним элементам */
14
+ dataAttrs?: {
15
+ root?: Record<string, string>;
16
+ input?: Record<string, string>;
17
+ customInput?: Record<string, string>;
18
+ extraContent?: Record<string, string>;
19
+ };
14
20
  /** Размер текста */
15
21
  fontSize?: 'regular' | 'small';
16
22
  /** Имя компонента в DOM */
@@ -60,13 +60,13 @@ var Checkbox = function Checkbox(_ref) {
60
60
  disabled: disabled,
61
61
  error: error
62
62
  }, className)
63
- }, filterDataAttrs(dataAttrs)), /*#__PURE__*/React.createElement("div", {
63
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement("div", {
64
64
  className: cn('inner', [classes === null || classes === void 0 ? void 0 : classes.inner])
65
65
  }, /*#__PURE__*/React.createElement("label", {
66
66
  className: cn('label', {
67
67
  'no-touch': !isTouch
68
68
  })
69
- }, /*#__PURE__*/React.createElement("input", {
69
+ }, /*#__PURE__*/React.createElement("input", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input), {
70
70
  className: cn('input'),
71
71
  type: "checkbox",
72
72
  tabIndex: -1,
@@ -75,17 +75,17 @@ var Checkbox = function Checkbox(_ref) {
75
75
  checked: isChecked,
76
76
  onChange: handleChange,
77
77
  disabled: disabled
78
- }), /*#__PURE__*/React.createElement("div", {
78
+ })), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.customInput), {
79
79
  tabIndex: 0,
80
80
  role: "checkbox",
81
81
  "aria-checked": isChecked,
82
82
  className: cn('custom-input', [classes === null || classes === void 0 ? void 0 : classes.icon]),
83
83
  onKeyDown: handleChange
84
- }, /*#__PURE__*/React.createElement(CheckedIcon, {
84
+ }), /*#__PURE__*/React.createElement(CheckedIcon, {
85
85
  className: cn('icon')
86
- })), children), extraContent && /*#__PURE__*/React.createElement("span", {
86
+ })), children), extraContent && /*#__PURE__*/React.createElement("span", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.extraContent), {
87
87
  className: cn('extra-content')
88
- }, extraContent)));
88
+ }), extraContent)));
89
89
  };
90
90
 
91
91
  Checkbox.propTypes = {
@@ -97,9 +97,14 @@ Checkbox.propTypes = {
97
97
  checked: PropTypes.bool,
98
98
  disabled: PropTypes.bool,
99
99
  error: PropTypes.bool,
100
+ dataAttrs: PropTypes.shape({
101
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
102
+ input: PropTypes.objectOf(PropTypes.string.isRequired),
103
+ customInput: PropTypes.objectOf(PropTypes.string.isRequired),
104
+ extraContent: PropTypes.objectOf(PropTypes.string.isRequired)
105
+ }),
100
106
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.element, PropTypes.string]).isRequired,
101
107
  extraContent: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.element, PropTypes.string]),
102
- dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
103
108
  onChange: PropTypes.func
104
109
  };
105
110
  export default Checkbox;
@@ -1,23 +1,35 @@
1
1
  import * as React from 'react';
2
2
  import * as PropTypes from 'prop-types';
3
- declare type DefaultProps = {
3
+ declare type CollapseDefaultProps = {
4
4
  animation?: boolean;
5
5
  animationDuration?: number;
6
6
  };
7
- declare type Props = DefaultProps & {
7
+ declare type CollapseProps = CollapseDefaultProps & {
8
8
  className: string;
9
9
  classNameContainer: string;
10
10
  isOpened: boolean;
11
+ dataAttrs?: {
12
+ root?: Record<string, string>;
13
+ inner?: Record<string, string>;
14
+ };
11
15
  children: React.ReactNode;
12
16
  };
13
17
  declare const Collapse: {
14
- (props: Props): React.FunctionComponentElement<Props>;
18
+ (props: CollapseProps): React.FunctionComponentElement<CollapseProps>;
15
19
  propTypes: {
16
20
  className: PropTypes.Requireable<string>;
17
21
  classNameContainer: PropTypes.Requireable<string>;
18
22
  isOpened: PropTypes.Validator<boolean>;
19
23
  animationDuration: PropTypes.Requireable<number>;
20
24
  animation: PropTypes.Requireable<boolean>;
25
+ dataAttrs: PropTypes.Requireable<PropTypes.InferProps<{
26
+ root: PropTypes.Requireable<{
27
+ [x: string]: string;
28
+ }>;
29
+ inner: PropTypes.Requireable<{
30
+ [x: string]: string;
31
+ }>;
32
+ }>>;
21
33
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
22
34
  };
23
35
  };