@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
@@ -96,7 +96,7 @@ var Button = function Button(_ref) {
96
96
  return;
97
97
  }
98
98
 
99
- onClick && onClick(e);
99
+ onClick === null || onClick === void 0 ? void 0 : onClick(e);
100
100
  }, [disabled, onClick]);
101
101
  var currentTheme = React.useMemo(function () {
102
102
  return type === ButtonTypes.PRIMARY && theme === ButtonThemes.BLACK ? ButtonThemes.GREEN : theme;
@@ -121,16 +121,16 @@ 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')
130
130
  }, children), !icon && showArrow && /*#__PURE__*/React.createElement(Arrow, {
131
131
  className: cn('icon-arrow')
132
132
  }));
133
- }, [contentClassName, showArrow, icon, children]);
133
+ }, [children, icon, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.content, contentClassName, showArrow]);
134
134
  var contentType = React.useMemo(function () {
135
135
  switch (true) {
136
136
  case icon && !children:
@@ -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),
@@ -152,7 +155,7 @@ var Button = function Button(_ref) {
152
155
  sizeTablet: sizeTablet && getLoaderSize(sizeTablet),
153
156
  sizeMobile: sizeMobile && getLoaderSize(sizeMobile)
154
157
  });
155
- }, [sizeAll, sizeWide, sizeDesktop, sizeTablet, sizeMobile]);
158
+ }, [dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.loader, loaderColor, sizeAll, sizeWide, sizeDesktop, sizeTablet, sizeMobile]);
156
159
 
157
160
  var setRelAttribute = function setRelAttribute() {
158
161
  if (ElementType !== 'a') {
@@ -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])]),
@@ -113,7 +113,7 @@ var Calendar = function Calendar(_ref) {
113
113
  useEffect(function () {
114
114
  var propsStartDate = calendarStateFromProps.startDate;
115
115
  setCalendarState(calendarStateFromProps);
116
- propsStartDate && goToDate(propsStartDate);
116
+ propsStartDate && goToDate(propsStartDate); // eslint-disable-next-line react-hooks/exhaustive-deps
117
117
  }, [calendarStateFromProps]);
118
118
 
119
119
  var getCalendarState = function getCalendarState(date) {
@@ -178,7 +178,7 @@ var Calendar = function Calendar(_ref) {
178
178
  var nextStartDate = nextState.startDate,
179
179
  nextEndDate = nextState.endDate;
180
180
  setCalendarState(nextState);
181
- onChange && onChange(nextStartDate, nextEndDate);
181
+ onChange === null || onChange === void 0 ? void 0 : onChange(nextStartDate, nextEndDate);
182
182
  };
183
183
 
184
184
  var handleDateHover = function handleDateHover(date) {
@@ -224,6 +224,7 @@ var Calendar = function Calendar(_ref) {
224
224
  var month = _ref2.month,
225
225
  year = _ref2.year;
226
226
 
227
+ // eslint-disable-next-line react-hooks/rules-of-hooks
227
228
  var _useMonth = useMonth({
228
229
  year: year,
229
230
  month: month,
@@ -60,7 +60,7 @@ var Day = function Day(_a) {
60
60
  };
61
61
 
62
62
  var handleMouseLeave = function handleMouseLeave() {
63
- onMouseLeave && onMouseLeave();
63
+ onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave();
64
64
  };
65
65
 
66
66
  return /*#__PURE__*/React.createElement("button", {
@@ -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
  /** Смена слайдов с зацикливанием */
@@ -122,7 +122,8 @@ var Carousel = function Carousel(_ref) {
122
122
  return;
123
123
  }
124
124
 
125
- autoplay.stop();
125
+ autoplay.stop(); // eslint-disable-next-line no-param-reassign
126
+
126
127
  params.autoplay.delay = autoPlayDelay * 3;
127
128
  autoplay.start();
128
129
  }, [autoPlayDelay]);
@@ -132,7 +133,7 @@ var Carousel = function Carousel(_ref) {
132
133
  }
133
134
 
134
135
  swiperInstance.slidePrev();
135
- onPrevClick && onPrevClick(swiperInstance.realIndex);
136
+ onPrevClick === null || onPrevClick === void 0 ? void 0 : onPrevClick(swiperInstance.realIndex);
136
137
  increaseAutoplayDelay(swiperInstance);
137
138
  }, [swiperInstance, onPrevClick, increaseAutoplayDelay]);
138
139
  var handleNextClick = React.useCallback(function () {
@@ -141,14 +142,14 @@ var Carousel = function Carousel(_ref) {
141
142
  }
142
143
 
143
144
  swiperInstance.slideNext();
144
- onNextClick && onNextClick(swiperInstance.realIndex);
145
+ onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(swiperInstance.realIndex);
145
146
  increaseAutoplayDelay(swiperInstance);
146
147
  }, [swiperInstance, onNextClick, increaseAutoplayDelay]);
147
148
  var handleSwiper = React.useCallback(function (swiper) {
148
149
  setSwiperInstance(swiper);
149
150
  setLocked(swiper.isBeginning && swiper.isEnd);
150
- getSwiper && getSwiper(swiper);
151
- }, []);
151
+ getSwiper === null || getSwiper === void 0 ? void 0 : getSwiper(swiper);
152
+ }, [getSwiper]);
152
153
  var handleReachBeginnig = React.useCallback(function () {
153
154
  setBeginning(true);
154
155
  }, []);
@@ -169,7 +170,7 @@ var Carousel = function Carousel(_ref) {
169
170
  var realIndex = _ref4.realIndex,
170
171
  previousIndex = _ref4.previousIndex,
171
172
  params = _ref4.params;
172
- onChange && onChange(realIndex, previousIndex, params.slidesPerView);
173
+ onChange === null || onChange === void 0 ? void 0 : onChange(realIndex, previousIndex, params.slidesPerView);
173
174
  }, [onChange]);
174
175
 
175
176
  var handleRootClick = function handleRootClick(e) {
@@ -182,15 +183,17 @@ var Carousel = function Carousel(_ref) {
182
183
  }; // https://github.com/nolimits4web/Swiper/issues/2346
183
184
 
184
185
 
185
- var handleSwiperResize = React.useCallback(throttle(function (swiper) {
186
- setBeginning(swiper.isBeginning);
187
- setEnd(swiper.isEnd);
188
- setLocked(swiper.isBeginning && swiper.isEnd);
186
+ var handleSwiperResize = React.useCallback(function () {
187
+ throttle(function (swiper) {
188
+ setBeginning(swiper.isBeginning);
189
+ setEnd(swiper.isEnd);
190
+ setLocked(swiper.isBeginning && swiper.isEnd);
189
191
 
190
- if (swiper.params.slidesPerView === SlidesPerView.AUTO) {
191
- swiper.slides.css('width', '');
192
- }
193
- }, throttleTime.resize), []);
192
+ if (swiper.params.slidesPerView === SlidesPerView.AUTO) {
193
+ swiper.slides.css('width', '');
194
+ }
195
+ }, throttleTime.resize);
196
+ }, []);
194
197
 
195
198
  var handleSlideFocus = function handleSlideFocus(index) {
196
199
  return function (e) {
@@ -215,7 +218,7 @@ var Carousel = function Carousel(_ref) {
215
218
  e.nativeEvent.preventDefault();
216
219
  };
217
220
 
218
- return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs), {
221
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
219
222
  ref: rootRef,
220
223
  className: cn({
221
224
  'nav-theme': navTheme
@@ -223,7 +226,7 @@ var Carousel = function Carousel(_ref) {
223
226
  onClick: handleRootClick
224
227
  }), /*#__PURE__*/React.createElement(Swiper, _extends({}, containerModifier ? {
225
228
  containerModifierClass: containerModifier
226
- } : {}, {
229
+ } : {}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slider), {
227
230
  className: cn('swiper', {
228
231
  'default-inner-indents': !innerIndentsClass
229
232
  }, [innerIndentsClass, containerClass]),
@@ -253,13 +256,13 @@ var Carousel = function Carousel(_ref) {
253
256
  onTouchEnd: increaseAutoplayDelay,
254
257
  onResize: handleSwiperResize
255
258
  }), React.Children.map(children, function (child, i) {
256
- return /*#__PURE__*/React.createElement(SwiperSlide, {
259
+ return /*#__PURE__*/React.createElement(SwiperSlide, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
257
260
  key: i,
258
261
  className: cn('slide', slideClass),
259
262
  onFocus: handleSlideFocus(i),
260
263
  onMouseDown: disableFocusOnSlideClick
261
- }, child);
262
- })), /*#__PURE__*/React.createElement(NavArrow, {
264
+ }), child);
265
+ })), /*#__PURE__*/React.createElement(NavArrow, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.prev), {
263
266
  className: cn('arrow', {
264
267
  prev: true,
265
268
  locked: isLocked
@@ -267,7 +270,7 @@ var Carousel = function Carousel(_ref) {
267
270
  onClick: handlePrevClick,
268
271
  disabled: !loop && isBeginning,
269
272
  theme: ArrowTheme.PURPLE
270
- }), /*#__PURE__*/React.createElement(NavArrow, {
273
+ })), /*#__PURE__*/React.createElement(NavArrow, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.next), {
271
274
  className: cn('arrow', {
272
275
  next: true,
273
276
  locked: isLocked
@@ -276,7 +279,7 @@ var Carousel = function Carousel(_ref) {
276
279
  onClick: handleNextClick,
277
280
  disabled: !loop && isEnd,
278
281
  theme: ArrowTheme.PURPLE
279
- }));
282
+ })));
280
283
  };
281
284
 
282
285
  Carousel.propTypes = {
@@ -293,7 +296,13 @@ Carousel.propTypes = {
293
296
  next: PropTypes.string,
294
297
  slide: PropTypes.string
295
298
  }),
296
- dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
299
+ dataAttrs: PropTypes.shape({
300
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
301
+ slider: PropTypes.objectOf(PropTypes.string.isRequired),
302
+ prev: PropTypes.objectOf(PropTypes.string.isRequired),
303
+ next: PropTypes.objectOf(PropTypes.string.isRequired),
304
+ slide: PropTypes.objectOf(PropTypes.string.isRequired)
305
+ }),
297
306
  slidesSettings: PropTypes.objectOf(checkBreakpointsPropTypes({
298
307
  slidesPerView: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(Object.values(SlidesPerView))]).isRequired,
299
308
  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 */
@@ -48,7 +48,7 @@ var Checkbox = function Checkbox(_ref) {
48
48
  var handleChange = function handleChange(e) {
49
49
  if (checkEventIsClickOrEnterPress(e) || e.type === CHANGE_KEY) {
50
50
  setIsChecked(!isChecked);
51
- onChange && onChange(!isChecked);
51
+ onChange === null || onChange === void 0 ? void 0 : onChange(!isChecked);
52
52
  }
53
53
  };
54
54
 
@@ -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
  };
@@ -1,6 +1,8 @@
1
1
  import "core-js/modules/web.timers";
2
+ import _extends from "@babel/runtime/helpers/extends";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
4
  import * as React from 'react';
5
+ import { filterDataAttrs } from '@megafon/ui-helpers';
4
6
  import * as PropTypes from 'prop-types';
5
7
  var BROWSER_DELAY = 100;
6
8
 
@@ -12,7 +14,8 @@ var Collapse = function Collapse(props) {
12
14
  _props$animationDurat = props.animationDuration,
13
15
  animationDuration = _props$animationDurat === void 0 ? 300 : _props$animationDurat,
14
16
  children = props.children,
15
- isOpened = props.isOpened;
17
+ isOpened = props.isOpened,
18
+ dataAttrs = props.dataAttrs;
16
19
  var canUpdate = React.useRef(false);
17
20
  var timer = React.useRef(undefined);
18
21
  var rootNode = React.useRef(null);
@@ -59,7 +62,7 @@ var Collapse = function Collapse(props) {
59
62
  return clearTimeout(timer.current);
60
63
  };
61
64
  }, [isOpened, duration]);
62
- return /*#__PURE__*/React.createElement("div", {
65
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
63
66
  className: className,
64
67
  style: {
65
68
  overflow: 'hidden',
@@ -67,9 +70,9 @@ var Collapse = function Collapse(props) {
67
70
  transition: transition
68
71
  },
69
72
  ref: rootNode
70
- }, /*#__PURE__*/React.createElement("div", {
73
+ }), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.inner), {
71
74
  className: classNameContainer
72
- }, children));
75
+ }), children));
73
76
  };
74
77
 
75
78
  Collapse.propTypes = {
@@ -78,6 +81,10 @@ Collapse.propTypes = {
78
81
  isOpened: PropTypes.bool.isRequired,
79
82
  animationDuration: PropTypes.number,
80
83
  animation: PropTypes.bool,
84
+ dataAttrs: PropTypes.shape({
85
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
86
+ inner: PropTypes.objectOf(PropTypes.string.isRequired)
87
+ }),
81
88
  children: PropTypes.node.isRequired
82
89
  };
83
90
  export default Collapse;
@@ -56,15 +56,15 @@ var Counter = function Counter(_ref) {
56
56
  }
57
57
 
58
58
  if (inputValue < min) {
59
- onChange && onChange(min);
59
+ onChange === null || onChange === void 0 ? void 0 : onChange(min);
60
60
  }
61
61
 
62
62
  if (inputValue > max) {
63
- onChange && onChange(max);
63
+ onChange === null || onChange === void 0 ? void 0 : onChange(max);
64
64
  }
65
65
 
66
66
  if (inputValue >= min && inputValue <= max) {
67
- onChange && onChange(inputValue);
67
+ onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
68
68
  }
69
69
  }, [min, max, onChange, isControlled]);
70
70
  var handleMinusClick = React.useCallback(function () {
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
- import { IFilterDataAttrs } from '@megafon/ui-helpers';
3
2
  import './Header.less';
4
- interface IHeaderProps extends IFilterDataAttrs {
3
+ interface IHeaderProps {
5
4
  /** Тег */
6
5
  as?: 'h1' | 'h2' | 'h3' | 'h5';
7
6
  /** Цвет */
@@ -12,6 +11,10 @@ interface IHeaderProps extends IFilterDataAttrs {
12
11
  addition?: JSX.Element;
13
12
  /** Дополнительный класс корневого элемента */
14
13
  className?: string | string[];
14
+ /** Дополнительные data атрибуты к внутренним элементам */
15
+ dataAttrs?: {
16
+ root?: Record<string, string>;
17
+ };
15
18
  /** Горизонтальное выравнивание */
16
19
  hAlign?: 'inherit' | 'left' | 'center' | 'right';
17
20
  /** Обработчик клика */
@@ -19,7 +19,7 @@ var Header = function Header(_ref) {
19
19
  margin = _ref.margin,
20
20
  onClick = _ref.onClick;
21
21
  var ElementType = level;
22
- return /*#__PURE__*/React.createElement(ElementType, _extends({}, filterDataAttrs(dataAttrs), {
22
+ return /*#__PURE__*/React.createElement(ElementType, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
23
23
  className: cn({
24
24
  color: color,
25
25
  margin: margin,
@@ -38,7 +38,9 @@ Header.propTypes = {
38
38
  margin: PropTypes.bool,
39
39
  addition: PropTypes.element,
40
40
  hAlign: PropTypes.oneOf(['inherit', 'left', 'center', 'right']),
41
- dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
41
+ dataAttrs: PropTypes.shape({
42
+ root: PropTypes.objectOf(PropTypes.string.isRequired)
43
+ }),
42
44
  onClick: PropTypes.func
43
45
  };
44
46
  export default Header;
@@ -2,6 +2,9 @@ import * as React from 'react';
2
2
  import './InputLabel.less';
3
3
  export interface IInputLabelProps {
4
4
  htmlFor?: string;
5
+ dataAttrs?: {
6
+ root?: Record<string, string>;
7
+ };
5
8
  }
6
9
  declare const InputLabel: React.FC<IInputLabelProps>;
7
10
  export default InputLabel;
@@ -1,19 +1,24 @@
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 "./InputLabel.css";
5
6
  var cn = cnCreate('mfui-input-label');
6
7
 
7
8
  var InputLabel = function InputLabel(_ref) {
8
9
  var htmlFor = _ref.htmlFor,
10
+ dataAttrs = _ref.dataAttrs,
9
11
  children = _ref.children;
10
- return /*#__PURE__*/React.createElement("label", {
12
+ return /*#__PURE__*/React.createElement("label", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
11
13
  htmlFor: htmlFor,
12
14
  className: cn()
13
- }, children);
15
+ }), children);
14
16
  };
15
17
 
16
18
  InputLabel.propTypes = {
17
- htmlFor: PropTypes.string
19
+ htmlFor: PropTypes.string,
20
+ dataAttrs: PropTypes.shape({
21
+ root: PropTypes.objectOf(PropTypes.string.isRequired)
22
+ })
18
23
  };
19
24
  export default InputLabel;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  export interface ILinkProps {
3
3
  /** Дополнительный класс корневого элемента */
4
4
  className?: string;
@@ -8,11 +8,15 @@ export interface ILinkProps {
8
8
  target?: '_self' | '_blank' | '_parent' | '_top';
9
9
  /** rel - аргумент тега <a> */
10
10
  rel?: string;
11
- /** Обработчик клика */
12
- onClick?: (e: React.MouseEvent<EventTarget>) => void;
13
11
  /** Добавление атрибута download */
14
12
  download?: boolean;
13
+ /** Дополнительные data атрибуты к внутренним элементам */
14
+ dataAttrs?: {
15
+ root?: Record<string, string>;
16
+ };
15
17
  children?: JSX.Element[] | Element[] | JSX.Element | string | Element | React.ReactNode;
18
+ /** Обработчик клика */
19
+ onClick?: (e: React.MouseEvent<EventTarget>) => void;
16
20
  }
17
21
  declare const Link: React.FC<ILinkProps>;
18
22
  export default Link;
@@ -1,12 +1,25 @@
1
- import * as React from 'react';
2
- import * as PropTypes from 'prop-types';
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import { filterDataAttrs } from '@megafon/ui-helpers';
4
+ import PropTypes from 'prop-types';
3
5
 
4
- var Link = function Link(props) {
5
- return (
6
- /*#__PURE__*/
7
- // eslint-disable-next-line jsx-a11y/anchor-has-content
8
- React.createElement("a", props)
9
- );
6
+ var Link = function Link(_ref) {
7
+ var target = _ref.target,
8
+ href = _ref.href,
9
+ rel = _ref.rel,
10
+ onClick = _ref.onClick,
11
+ className = _ref.className,
12
+ download = _ref.download,
13
+ children = _ref.children,
14
+ dataAttrs = _ref.dataAttrs;
15
+ return /*#__PURE__*/React.createElement("a", _extends({
16
+ className: className,
17
+ href: href,
18
+ target: target,
19
+ rel: rel,
20
+ download: download,
21
+ onClick: onClick
22
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), children);
10
23
  };
11
24
 
12
25
  Link.propTypes = {
@@ -14,8 +27,11 @@ Link.propTypes = {
14
27
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.string, PropTypes.node]),
15
28
  target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
16
29
  className: PropTypes.string,
30
+ dataAttrs: PropTypes.shape({
31
+ root: PropTypes.objectOf(PropTypes.string.isRequired)
32
+ }),
17
33
  rel: PropTypes.string,
18
- onClick: PropTypes.func,
19
- download: PropTypes.bool
34
+ download: PropTypes.bool,
35
+ onClick: PropTypes.func
20
36
  };
21
37
  export default Link;
@@ -37,6 +37,14 @@ export interface INotificationProps {
37
37
  target?: '_self' | '_blank' | '_parent' | '_top';
38
38
  /** Иконка */
39
39
  icon?: JSX.Element;
40
+ /** Дополнительные data атрибуты к внутренним элементам */
41
+ dataAttrs?: {
42
+ root?: Record<string, string>;
43
+ title?: Record<string, string>;
44
+ text?: Record<string, string>;
45
+ link?: Record<string, string>;
46
+ close?: Record<string, string>;
47
+ };
40
48
  /** Обработчик на закрытие */
41
49
  onClose?: () => void;
42
50
  /** Обработчик клика по ссылке */