@megafon/ui-core 2.5.0 → 3.0.0-beta.11

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 (213) hide show
  1. package/CHANGELOG.md +156 -9
  2. package/dist/es/colors/ColorItem/ColorItem.css +1 -8
  3. package/dist/es/colors/ColorItem/ColorItem.js +1 -1
  4. package/dist/es/colors/Colors.css +3 -11
  5. package/dist/es/colors/Colors.d.ts +2 -2
  6. package/dist/es/colors/Colors.js +64 -4
  7. package/dist/es/colors/colorsData.js +78 -71
  8. package/dist/es/components/Accordion/Accordion.css +7 -27
  9. package/dist/es/components/Accordion/Accordion.d.ts +12 -7
  10. package/dist/es/components/Accordion/Accordion.js +25 -20
  11. package/dist/es/components/Banner/Banner.css +2 -37
  12. package/dist/es/components/Banner/Banner.d.ts +10 -2
  13. package/dist/es/components/Banner/Banner.js +35 -26
  14. package/dist/es/components/Banner/BannerDot.css +4 -11
  15. package/dist/es/components/Banner/BannerDot.d.ts +3 -0
  16. package/dist/es/components/Banner/BannerDot.js +8 -3
  17. package/dist/es/components/Button/Button.css +83 -74
  18. package/dist/es/components/Button/Button.d.ts +8 -2
  19. package/dist/es/components/Button/Button.js +16 -8
  20. package/dist/es/components/Calendar/Calendar.css +0 -7
  21. package/dist/es/components/Calendar/Calendar.js +2 -3
  22. package/dist/es/components/Calendar/components/Day/Day.css +10 -17
  23. package/dist/es/components/Calendar/components/Day/Day.js +1 -1
  24. package/dist/es/components/Calendar/components/Month/Month.css +3 -10
  25. package/dist/es/components/Calendar/components/Month/Month.js +21 -5
  26. package/dist/es/components/Carousel/Carousel.css +4 -11
  27. package/dist/es/components/Carousel/Carousel.d.ts +9 -2
  28. package/dist/es/components/Carousel/Carousel.js +28 -25
  29. package/dist/es/components/Checkbox/Checkbox.css +18 -25
  30. package/dist/es/components/Checkbox/Checkbox.d.ts +11 -27
  31. package/dist/es/components/Checkbox/Checkbox.js +77 -90
  32. package/dist/es/components/Collapse/Collapse.d.ts +15 -3
  33. package/dist/es/components/Collapse/Collapse.js +11 -4
  34. package/dist/es/components/ContentArea/ContentArea.css +18 -28
  35. package/dist/es/components/ContentArea/ContentArea.d.ts +2 -7
  36. package/dist/es/components/ContentArea/ContentArea.js +5 -39
  37. package/dist/es/components/Counter/Counter.css +14 -11
  38. package/dist/es/components/Counter/Counter.js +3 -3
  39. package/dist/es/components/Grid/GridColumn.css +0 -7
  40. package/dist/es/components/Header/Header.css +8 -12
  41. package/dist/es/components/Header/Header.d.ts +7 -21
  42. package/dist/es/components/Header/Header.js +31 -67
  43. package/dist/es/components/InputLabel/InputLabel.css +0 -7
  44. package/dist/es/components/InputLabel/InputLabel.d.ts +3 -0
  45. package/dist/es/components/InputLabel/InputLabel.js +9 -4
  46. package/dist/es/components/Link/Link.d.ts +3 -3
  47. package/dist/es/components/Link/Link.js +32 -21
  48. package/dist/es/components/List/List.css +9 -13
  49. package/dist/es/components/List/List.d.ts +1 -1
  50. package/dist/es/components/List/List.js +2 -2
  51. package/dist/es/components/List/ListItem.css +0 -7
  52. package/dist/es/components/Logo/Logo.css +0 -7
  53. package/dist/es/components/Logo/Logo.js +4 -8
  54. package/dist/es/components/NavArrow/NavArrow.css +5 -12
  55. package/dist/es/components/Notification/Notification.css +41 -24
  56. package/dist/es/components/Notification/Notification.d.ts +8 -0
  57. package/dist/es/components/Notification/Notification.js +21 -4
  58. package/dist/es/components/Pagination/Pagination.css +0 -7
  59. package/dist/es/components/Pagination/Pagination.d.ts +9 -2
  60. package/dist/es/components/Pagination/Pagination.js +20 -3
  61. package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.css +9 -9
  62. package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
  63. package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.js +12 -7
  64. package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +5 -2
  65. package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.js +10 -2
  66. package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +5 -2
  67. package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +6 -1
  68. package/dist/es/components/Pagination/helpers.d.ts +1 -1
  69. package/dist/es/components/Paragraph/Paragraph.css +10 -31
  70. package/dist/es/components/Paragraph/Paragraph.d.ts +9 -13
  71. package/dist/es/components/Paragraph/Paragraph.js +14 -40
  72. package/dist/es/components/Preloader/Preloader.css +5 -12
  73. package/dist/es/components/Preloader/Preloader.d.ts +4 -0
  74. package/dist/es/components/Preloader/Preloader.js +10 -5
  75. package/dist/es/components/RadioButton/RadioButton.css +7 -14
  76. package/dist/es/components/RadioButton/RadioButton.d.ts +8 -28
  77. package/dist/es/components/RadioButton/RadioButton.js +50 -85
  78. package/dist/es/components/Search/Search.css +20 -25
  79. package/dist/es/components/Search/Search.js +3 -4
  80. package/dist/es/components/Select/Select.css +34 -37
  81. package/dist/es/components/Select/Select.d.ts +43 -50
  82. package/dist/es/components/Select/Select.js +382 -461
  83. package/dist/es/components/Select/reducer/selectReducer.d.ts +34 -0
  84. package/dist/es/components/Select/reducer/selectReducer.js +123 -0
  85. package/dist/es/components/Switcher/Switcher.css +19 -25
  86. package/dist/es/components/Switcher/Switcher.js +1 -1
  87. package/dist/es/components/Tabs/Tab.d.ts +5 -2
  88. package/dist/es/components/Tabs/Tab.js +4 -2
  89. package/dist/es/components/Tabs/Tabs.css +30 -37
  90. package/dist/es/components/Tabs/Tabs.d.ts +8 -2
  91. package/dist/es/components/Tabs/Tabs.js +68 -105
  92. package/dist/es/components/TextField/TextField.css +27 -33
  93. package/dist/es/components/TextField/TextField.d.ts +9 -3
  94. package/dist/es/components/TextField/TextField.js +32 -24
  95. package/dist/es/components/TextLink/TextLink.css +10 -14
  96. package/dist/es/components/TextLink/TextLink.d.ts +1 -1
  97. package/dist/es/components/TextLink/TextLink.js +7 -2
  98. package/dist/es/components/Tile/Tile.css +2 -8
  99. package/dist/es/components/Tile/Tile.d.ts +5 -2
  100. package/dist/es/components/Tile/Tile.js +2 -2
  101. package/dist/es/components/Tooltip/Tooltip.css +1 -8
  102. package/dist/es/components/Tooltip/Tooltip.d.ts +8 -2
  103. package/dist/es/components/Tooltip/Tooltip.js +28 -27
  104. package/dist/es/index.d.ts +1 -0
  105. package/dist/es/index.js +1 -0
  106. package/dist/lib/colors/ColorItem/ColorItem.css +1 -8
  107. package/dist/lib/colors/ColorItem/ColorItem.js +1 -1
  108. package/dist/lib/colors/Colors.css +3 -11
  109. package/dist/lib/colors/Colors.d.ts +2 -2
  110. package/dist/lib/colors/Colors.js +63 -4
  111. package/dist/lib/colors/colorsData.js +78 -71
  112. package/dist/lib/components/Accordion/Accordion.css +7 -27
  113. package/dist/lib/components/Accordion/Accordion.d.ts +12 -7
  114. package/dist/lib/components/Accordion/Accordion.js +24 -19
  115. package/dist/lib/components/Banner/Banner.css +2 -37
  116. package/dist/lib/components/Banner/Banner.d.ts +10 -2
  117. package/dist/lib/components/Banner/Banner.js +35 -25
  118. package/dist/lib/components/Banner/BannerDot.css +4 -11
  119. package/dist/lib/components/Banner/BannerDot.d.ts +3 -0
  120. package/dist/lib/components/Banner/BannerDot.js +10 -2
  121. package/dist/lib/components/Button/Button.css +83 -74
  122. package/dist/lib/components/Button/Button.d.ts +8 -2
  123. package/dist/lib/components/Button/Button.js +16 -8
  124. package/dist/lib/components/Calendar/Calendar.css +0 -7
  125. package/dist/lib/components/Calendar/Calendar.js +3 -3
  126. package/dist/lib/components/Calendar/components/Day/Day.css +10 -17
  127. package/dist/lib/components/Calendar/components/Day/Day.js +1 -1
  128. package/dist/lib/components/Calendar/components/Month/Month.css +3 -10
  129. package/dist/lib/components/Calendar/components/Month/Month.js +20 -4
  130. package/dist/lib/components/Carousel/Carousel.css +4 -11
  131. package/dist/lib/components/Carousel/Carousel.d.ts +9 -2
  132. package/dist/lib/components/Carousel/Carousel.js +26 -23
  133. package/dist/lib/components/Checkbox/Checkbox.css +18 -25
  134. package/dist/lib/components/Checkbox/Checkbox.d.ts +11 -27
  135. package/dist/lib/components/Checkbox/Checkbox.js +82 -125
  136. package/dist/lib/components/Collapse/Collapse.d.ts +15 -3
  137. package/dist/lib/components/Collapse/Collapse.js +13 -4
  138. package/dist/lib/components/ContentArea/ContentArea.css +18 -28
  139. package/dist/lib/components/ContentArea/ContentArea.d.ts +2 -7
  140. package/dist/lib/components/ContentArea/ContentArea.js +5 -42
  141. package/dist/lib/components/Counter/Counter.css +14 -11
  142. package/dist/lib/components/Counter/Counter.js +3 -3
  143. package/dist/lib/components/Grid/GridColumn.css +0 -7
  144. package/dist/lib/components/Header/Header.css +8 -12
  145. package/dist/lib/components/Header/Header.d.ts +7 -21
  146. package/dist/lib/components/Header/Header.js +31 -98
  147. package/dist/lib/components/InputLabel/InputLabel.css +0 -7
  148. package/dist/lib/components/InputLabel/InputLabel.d.ts +3 -0
  149. package/dist/lib/components/InputLabel/InputLabel.js +11 -3
  150. package/dist/lib/components/Link/Link.d.ts +3 -3
  151. package/dist/lib/components/Link/Link.js +44 -26
  152. package/dist/lib/components/List/List.css +9 -13
  153. package/dist/lib/components/List/List.d.ts +1 -1
  154. package/dist/lib/components/List/List.js +2 -2
  155. package/dist/lib/components/List/ListItem.css +0 -7
  156. package/dist/lib/components/Logo/Logo.css +0 -7
  157. package/dist/lib/components/Logo/Logo.js +4 -8
  158. package/dist/lib/components/NavArrow/NavArrow.css +5 -12
  159. package/dist/lib/components/Notification/Notification.css +41 -24
  160. package/dist/lib/components/Notification/Notification.d.ts +8 -0
  161. package/dist/lib/components/Notification/Notification.js +20 -3
  162. package/dist/lib/components/Pagination/Pagination.css +0 -7
  163. package/dist/lib/components/Pagination/Pagination.d.ts +9 -2
  164. package/dist/lib/components/Pagination/Pagination.js +20 -2
  165. package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.css +9 -9
  166. package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
  167. package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.js +12 -6
  168. package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +5 -2
  169. package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.js +9 -1
  170. package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +5 -2
  171. package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +6 -1
  172. package/dist/lib/components/Pagination/helpers.d.ts +1 -1
  173. package/dist/lib/components/Paragraph/Paragraph.css +10 -31
  174. package/dist/lib/components/Paragraph/Paragraph.d.ts +9 -13
  175. package/dist/lib/components/Paragraph/Paragraph.js +15 -41
  176. package/dist/lib/components/Preloader/Preloader.css +5 -12
  177. package/dist/lib/components/Preloader/Preloader.d.ts +4 -0
  178. package/dist/lib/components/Preloader/Preloader.js +10 -4
  179. package/dist/lib/components/RadioButton/RadioButton.css +7 -14
  180. package/dist/lib/components/RadioButton/RadioButton.d.ts +8 -28
  181. package/dist/lib/components/RadioButton/RadioButton.js +51 -117
  182. package/dist/lib/components/Search/Search.css +20 -25
  183. package/dist/lib/components/Search/Search.js +3 -4
  184. package/dist/lib/components/Select/Select.css +34 -37
  185. package/dist/lib/components/Select/Select.d.ts +43 -50
  186. package/dist/lib/components/Select/Select.js +375 -483
  187. package/dist/lib/components/Select/reducer/selectReducer.d.ts +34 -0
  188. package/dist/lib/components/Select/reducer/selectReducer.js +136 -0
  189. package/dist/lib/components/Switcher/Switcher.css +19 -25
  190. package/dist/lib/components/Switcher/Switcher.js +1 -1
  191. package/dist/lib/components/Tabs/Tab.d.ts +5 -2
  192. package/dist/lib/components/Tabs/Tab.js +4 -2
  193. package/dist/lib/components/Tabs/Tabs.css +30 -37
  194. package/dist/lib/components/Tabs/Tabs.d.ts +8 -2
  195. package/dist/lib/components/Tabs/Tabs.js +68 -105
  196. package/dist/lib/components/TextField/TextField.css +27 -33
  197. package/dist/lib/components/TextField/TextField.d.ts +9 -3
  198. package/dist/lib/components/TextField/TextField.js +30 -23
  199. package/dist/lib/components/TextLink/TextLink.css +10 -14
  200. package/dist/lib/components/TextLink/TextLink.d.ts +1 -1
  201. package/dist/lib/components/TextLink/TextLink.js +7 -2
  202. package/dist/lib/components/Tile/Tile.css +2 -8
  203. package/dist/lib/components/Tile/Tile.d.ts +5 -2
  204. package/dist/lib/components/Tile/Tile.js +2 -2
  205. package/dist/lib/components/Tooltip/Tooltip.css +1 -8
  206. package/dist/lib/components/Tooltip/Tooltip.d.ts +8 -2
  207. package/dist/lib/components/Tooltip/Tooltip.js +27 -26
  208. package/dist/lib/index.d.ts +1 -0
  209. package/dist/lib/index.js +8 -0
  210. package/package.json +5 -4
  211. package/styles/base.less +2 -73
  212. package/styles/colors.css +60 -0
  213. package/styles/colorsDark.css +62 -0
@@ -122,8 +122,7 @@ var Carousel = function Carousel(_ref) {
122
122
  return;
123
123
  }
124
124
 
125
- autoplay.stop(); // eslint-disable-next-line no-param-reassign
126
-
125
+ autoplay.stop();
127
126
  params.autoplay.delay = autoPlayDelay * 3;
128
127
  autoplay.start();
129
128
  }, [autoPlayDelay]);
@@ -133,7 +132,7 @@ var Carousel = function Carousel(_ref) {
133
132
  }
134
133
 
135
134
  swiperInstance.slidePrev();
136
- onPrevClick === null || onPrevClick === void 0 ? void 0 : onPrevClick(swiperInstance.realIndex);
135
+ onPrevClick && onPrevClick(swiperInstance.realIndex);
137
136
  increaseAutoplayDelay(swiperInstance);
138
137
  }, [swiperInstance, onPrevClick, increaseAutoplayDelay]);
139
138
  var handleNextClick = React.useCallback(function () {
@@ -142,14 +141,14 @@ var Carousel = function Carousel(_ref) {
142
141
  }
143
142
 
144
143
  swiperInstance.slideNext();
145
- onNextClick === null || onNextClick === void 0 ? void 0 : onNextClick(swiperInstance.realIndex);
144
+ onNextClick && onNextClick(swiperInstance.realIndex);
146
145
  increaseAutoplayDelay(swiperInstance);
147
146
  }, [swiperInstance, onNextClick, increaseAutoplayDelay]);
148
147
  var handleSwiper = React.useCallback(function (swiper) {
149
148
  setSwiperInstance(swiper);
150
149
  setLocked(swiper.isBeginning && swiper.isEnd);
151
- getSwiper === null || getSwiper === void 0 ? void 0 : getSwiper(swiper);
152
- }, [getSwiper]);
150
+ getSwiper && getSwiper(swiper);
151
+ }, []);
153
152
  var handleReachBeginnig = React.useCallback(function () {
154
153
  setBeginning(true);
155
154
  }, []);
@@ -170,7 +169,7 @@ var Carousel = function Carousel(_ref) {
170
169
  var realIndex = _ref4.realIndex,
171
170
  previousIndex = _ref4.previousIndex,
172
171
  params = _ref4.params;
173
- onChange === null || onChange === void 0 ? void 0 : onChange(realIndex, previousIndex, params.slidesPerView);
172
+ onChange && onChange(realIndex, previousIndex, params.slidesPerView);
174
173
  }, [onChange]);
175
174
 
176
175
  var handleRootClick = function handleRootClick(e) {
@@ -183,17 +182,15 @@ var Carousel = function Carousel(_ref) {
183
182
  }; // https://github.com/nolimits4web/Swiper/issues/2346
184
183
 
185
184
 
186
- var handleSwiperResize = React.useCallback(function () {
187
- throttle(function (swiper) {
188
- setBeginning(swiper.isBeginning);
189
- setEnd(swiper.isEnd);
190
- setLocked(swiper.isBeginning && swiper.isEnd);
185
+ var handleSwiperResize = React.useCallback(throttle(function (swiper) {
186
+ setBeginning(swiper.isBeginning);
187
+ setEnd(swiper.isEnd);
188
+ setLocked(swiper.isBeginning && swiper.isEnd);
191
189
 
192
- if (swiper.params.slidesPerView === SlidesPerView.AUTO) {
193
- swiper.slides.css('width', '');
194
- }
195
- }, throttleTime.resize);
196
- }, []);
190
+ if (swiper.params.slidesPerView === SlidesPerView.AUTO) {
191
+ swiper.slides.css('width', '');
192
+ }
193
+ }, throttleTime.resize), []);
197
194
 
198
195
  var handleSlideFocus = function handleSlideFocus(index) {
199
196
  return function (e) {
@@ -218,7 +215,7 @@ var Carousel = function Carousel(_ref) {
218
215
  e.nativeEvent.preventDefault();
219
216
  };
220
217
 
221
- 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), {
222
219
  ref: rootRef,
223
220
  className: cn({
224
221
  'nav-theme': navTheme
@@ -226,7 +223,7 @@ var Carousel = function Carousel(_ref) {
226
223
  onClick: handleRootClick
227
224
  }), /*#__PURE__*/React.createElement(Swiper, _extends({}, containerModifier ? {
228
225
  containerModifierClass: containerModifier
229
- } : {}, {
226
+ } : {}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slider), {
230
227
  className: cn('swiper', {
231
228
  'default-inner-indents': !innerIndentsClass
232
229
  }, [innerIndentsClass, containerClass]),
@@ -256,13 +253,13 @@ var Carousel = function Carousel(_ref) {
256
253
  onTouchEnd: increaseAutoplayDelay,
257
254
  onResize: handleSwiperResize
258
255
  }), React.Children.map(children, function (child, i) {
259
- return /*#__PURE__*/React.createElement(SwiperSlide, {
256
+ return /*#__PURE__*/React.createElement(SwiperSlide, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slide, i + 1), {
260
257
  key: i,
261
258
  className: cn('slide', slideClass),
262
259
  onFocus: handleSlideFocus(i),
263
260
  onMouseDown: disableFocusOnSlideClick
264
- }, child);
265
- })), /*#__PURE__*/React.createElement(NavArrow, {
261
+ }), child);
262
+ })), /*#__PURE__*/React.createElement(NavArrow, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.prev), {
266
263
  className: cn('arrow', {
267
264
  prev: true,
268
265
  locked: isLocked
@@ -270,7 +267,7 @@ var Carousel = function Carousel(_ref) {
270
267
  onClick: handlePrevClick,
271
268
  disabled: !loop && isBeginning,
272
269
  theme: ArrowTheme.PURPLE
273
- }), /*#__PURE__*/React.createElement(NavArrow, {
270
+ })), /*#__PURE__*/React.createElement(NavArrow, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.next), {
274
271
  className: cn('arrow', {
275
272
  next: true,
276
273
  locked: isLocked
@@ -279,7 +276,7 @@ var Carousel = function Carousel(_ref) {
279
276
  onClick: handleNextClick,
280
277
  disabled: !loop && isEnd,
281
278
  theme: ArrowTheme.PURPLE
282
- }));
279
+ })));
283
280
  };
284
281
 
285
282
  Carousel.propTypes = {
@@ -296,7 +293,13 @@ Carousel.propTypes = {
296
293
  next: PropTypes.string,
297
294
  slide: PropTypes.string
298
295
  }),
299
- 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
+ }),
300
303
  slidesSettings: PropTypes.objectOf(checkBreakpointsPropTypes({
301
304
  slidesPerView: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(Object.values(SlidesPerView))]).isRequired,
302
305
  spaceBetween: PropTypes.number.isRequired,
@@ -1,10 +1,3 @@
1
- h1,
2
- h2,
3
- h3,
4
- h4,
5
- h5 {
6
- margin: 0;
7
- }
8
1
  .mfui-checkbox {
9
2
  margin: 0 5px 12px 5px;
10
3
  }
@@ -89,32 +82,32 @@ h5 {
89
82
  top: 0;
90
83
  }
91
84
  .mfui-checkbox_color_dark .mfui-checkbox__custom-input {
92
- border-color: #D8D8D8;
85
+ border-color: var(--spbSky2);
93
86
  }
94
87
  .mfui-checkbox_color_dark .mfui-checkbox__label_no-touch:hover .mfui-checkbox__custom-input {
95
- border-color: #10E272;
88
+ border-color: var(--buttonHoverGreen);
96
89
  }
97
90
  .mfui-checkbox_color_dark .mfui-checkbox__label:active .mfui-checkbox__custom-input {
98
- border-color: #404D46 !important;
99
- background-color: #404D46;
91
+ border-color: var(--buttonDown) !important;
92
+ background-color: var(--buttonDown);
100
93
  }
101
94
  .mfui-checkbox_color_dark .mfui-checkbox__icon {
102
- fill: #FFFFFF;
95
+ fill: var(--stcWhite);
103
96
  }
104
97
  .mfui-checkbox_color_dark.mfui-checkbox_checked .mfui-checkbox__custom-input {
105
- border-color: #00B956;
106
- color: #FFFFFF;
107
- background-color: #00B956;
98
+ border-color: var(--brandGreen);
99
+ color: var(--stcWhite);
100
+ background-color: var(--brandGreen);
108
101
  }
109
102
  .mfui-checkbox_color_dark.mfui-checkbox_checked .mfui-checkbox__label_no-touch:hover .mfui-checkbox__custom-input {
110
- background-color: #10E272;
103
+ background-color: var(--buttonHoverGreen);
111
104
  }
112
105
  .mfui-checkbox_color_dark.mfui-checkbox_checked .mfui-checkbox__label:active .mfui-checkbox__custom-input {
113
- background-color: #404D46 !important;
106
+ background-color: var(--buttonDown) !important;
114
107
  }
115
108
  .mfui-checkbox_color_dark.mfui-checkbox_checked.mfui-checkbox_disabled .mfui-checkbox__custom-input,
116
109
  .mfui-checkbox_color_dark.mfui-checkbox_checked.mfui-checkbox_disabled .mfui-checkbox__label:active .mfui-checkbox__custom-input {
117
- background-color: #D8D8D8;
110
+ background-color: var(--spbSky2);
118
111
  }
119
112
  .mfui-checkbox_color_dark.mfui-checkbox_disabled .mfui-checkbox__label {
120
113
  cursor: default;
@@ -122,17 +115,17 @@ h5 {
122
115
  }
123
116
  .mfui-checkbox_color_dark.mfui-checkbox_disabled .mfui-checkbox__custom-input,
124
117
  .mfui-checkbox_color_dark.mfui-checkbox_disabled .mfui-checkbox__label:active .mfui-checkbox__custom-input {
125
- border-color: #D8D8D8 !important;
126
- background-color: #EDEDED;
118
+ border-color: var(--spbSky2) !important;
119
+ background-color: var(--spbSky1);
127
120
  }
128
121
  .mfui-checkbox_color_dark.mfui-checkbox_error .mfui-checkbox__custom-input {
129
- border-color: #F62434;
122
+ border-color: var(--fury);
130
123
  }
131
124
  .mfui-checkbox_color_light {
132
- color: #FFFFFF;
125
+ color: var(--stcWhite);
133
126
  }
134
127
  .mfui-checkbox_color_light .mfui-checkbox__custom-input {
135
- border-color: #FFFFFF;
136
- color: #00B956;
137
- background-color: #FFFFFF;
128
+ border-color: var(--stcWhite);
129
+ color: var(--brandGreen);
130
+ background-color: var(--stcWhite);
138
131
  }
@@ -1,8 +1,6 @@
1
- import * as React from 'react';
2
- import { IFilterDataAttrs } from '@megafon/ui-helpers';
3
- import * as PropTypes from 'prop-types';
1
+ import React from 'react';
4
2
  import './Checkbox.less';
5
- export interface ICheckboxProps extends IFilterDataAttrs {
3
+ export interface ICheckboxProps {
6
4
  /** Цвет чекбокса */
7
5
  color?: 'dark' | 'light';
8
6
  /** Дополнительный класс корневого элемента */
@@ -12,6 +10,13 @@ export interface ICheckboxProps extends IFilterDataAttrs {
12
10
  inner?: string;
13
11
  icon?: string;
14
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
+ };
15
20
  /** Размер текста */
16
21
  fontSize?: 'regular' | 'small';
17
22
  /** Имя компонента в DOM */
@@ -28,28 +33,7 @@ export interface ICheckboxProps extends IFilterDataAttrs {
28
33
  extraContent?: JSX.Element[] | Element[] | JSX.Element | Element | string;
29
34
  children: JSX.Element[] | Element[] | JSX.Element | Element | string;
30
35
  /** Обработчик изменения значения */
31
- onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
32
- }
33
- declare class Checkbox extends React.Component<ICheckboxProps> {
34
- static propTypes: {
35
- className: PropTypes.Requireable<string>;
36
- fontSize: PropTypes.Requireable<string>;
37
- color: PropTypes.Requireable<string>;
38
- name: PropTypes.Requireable<string>;
39
- value: PropTypes.Requireable<string>;
40
- checked: PropTypes.Requireable<boolean>;
41
- disabled: PropTypes.Requireable<boolean>;
42
- error: PropTypes.Requireable<boolean>;
43
- children: PropTypes.Requireable<string | PropTypes.ReactElementLike | (PropTypes.ReactElementLike | null | undefined)[]>;
44
- extraContent: PropTypes.Requireable<string | PropTypes.ReactElementLike | (PropTypes.ReactElementLike | null | undefined)[]>;
45
- dataAttrs: PropTypes.Requireable<{
46
- [x: string]: string;
47
- }>;
48
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
49
- };
50
- static defaultProps: Partial<ICheckboxProps>;
51
- isTouch: boolean;
52
- handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
53
- render(): JSX.Element;
36
+ onChange?: (checked: boolean) => void;
54
37
  }
38
+ declare const Checkbox: React.FC<ICheckboxProps>;
55
39
  export default Checkbox;
@@ -1,21 +1,8 @@
1
- import "core-js/modules/es.date.to-string";
2
1
  import "core-js/modules/es.function.name";
3
- import "core-js/modules/es.object.to-string";
4
- import "core-js/modules/es.reflect.construct";
5
- import "core-js/modules/es.regexp.to-string";
6
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
7
- import _createClass from "@babel/runtime/helpers/createClass";
8
- import _inherits from "@babel/runtime/helpers/inherits";
9
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
10
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
11
3
  import _extends from "@babel/runtime/helpers/extends";
12
-
13
- function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
-
15
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
16
-
17
- import * as React from 'react';
18
- import { cnCreate, detectTouch, filterDataAttrs } from '@megafon/ui-helpers';
4
+ import React, { useState, useEffect } from 'react';
5
+ import { checkEventIsClickOrEnterPress, cnCreate, detectTouch, filterDataAttrs } from '@megafon/ui-helpers';
19
6
  import * as PropTypes from 'prop-types';
20
7
  import "./Checkbox.css";
21
8
 
@@ -27,79 +14,79 @@ var CheckedIcon = function CheckedIcon(props) {
27
14
  }));
28
15
  };
29
16
 
17
+ var CHANGE_KEY = 'change';
30
18
  var cn = cnCreate('mfui-checkbox');
31
19
 
32
- var Checkbox = /*#__PURE__*/function (_React$Component) {
33
- _inherits(Checkbox, _React$Component);
34
-
35
- var _super = _createSuper(Checkbox);
36
-
37
- function Checkbox() {
38
- var _this;
20
+ var Checkbox = function Checkbox(_ref) {
21
+ var className = _ref.className,
22
+ _ref$fontSize = _ref.fontSize,
23
+ fontSize = _ref$fontSize === void 0 ? 'regular' : _ref$fontSize,
24
+ name = _ref.name,
25
+ _ref$color = _ref.color,
26
+ color = _ref$color === void 0 ? 'dark' : _ref$color,
27
+ value = _ref.value,
28
+ _ref$checked = _ref.checked,
29
+ checked = _ref$checked === void 0 ? false : _ref$checked,
30
+ disabled = _ref.disabled,
31
+ error = _ref.error,
32
+ children = _ref.children,
33
+ extraContent = _ref.extraContent,
34
+ dataAttrs = _ref.dataAttrs,
35
+ classes = _ref.classes,
36
+ onChange = _ref.onChange;
37
+ var isTouch = detectTouch();
39
38
 
40
- _classCallCheck(this, Checkbox);
39
+ var _useState = useState(checked),
40
+ _useState2 = _slicedToArray(_useState, 2),
41
+ isChecked = _useState2[0],
42
+ setIsChecked = _useState2[1];
41
43
 
42
- _this = _super.apply(this, arguments);
43
- _this.isTouch = detectTouch();
44
+ useEffect(function () {
45
+ setIsChecked(checked);
46
+ }, [checked]);
44
47
 
45
- _this.handleChange = function (e) {
46
- var onChange = _this.props.onChange;
47
- onChange === null || onChange === void 0 ? void 0 : onChange(e);
48
- };
49
-
50
- return _this;
51
- }
52
-
53
- _createClass(Checkbox, [{
54
- key: "render",
55
- value: function render() {
56
- var _this$props = this.props,
57
- className = _this$props.className,
58
- fontSize = _this$props.fontSize,
59
- name = _this$props.name,
60
- color = _this$props.color,
61
- value = _this$props.value,
62
- checked = _this$props.checked,
63
- disabled = _this$props.disabled,
64
- error = _this$props.error,
65
- children = _this$props.children,
66
- extraContent = _this$props.extraContent,
67
- dataAttrs = _this$props.dataAttrs,
68
- classes = _this$props.classes;
69
- return /*#__PURE__*/React.createElement("div", _extends({
70
- className: cn('', {
71
- 'font-size': fontSize,
72
- color: color,
73
- checked: checked,
74
- disabled: disabled,
75
- error: error
76
- }, className)
77
- }, filterDataAttrs(dataAttrs)), /*#__PURE__*/React.createElement("div", {
78
- className: cn('inner', [classes === null || classes === void 0 ? void 0 : classes.inner])
79
- }, /*#__PURE__*/React.createElement("label", {
80
- className: cn('label', {
81
- 'no-touch': !this.isTouch
82
- })
83
- }, /*#__PURE__*/React.createElement("input", {
84
- className: cn('input'),
85
- type: "checkbox",
86
- name: name,
87
- value: value,
88
- checked: checked,
89
- onChange: this.handleChange,
90
- disabled: disabled
91
- }), /*#__PURE__*/React.createElement("div", {
92
- className: cn('custom-input', [classes === null || classes === void 0 ? void 0 : classes.icon])
93
- }, /*#__PURE__*/React.createElement(CheckedIcon, {
94
- className: cn('icon')
95
- })), children), extraContent && /*#__PURE__*/React.createElement("span", {
96
- className: cn('extra-content')
97
- }, extraContent)));
48
+ var handleChange = function handleChange(e) {
49
+ if (checkEventIsClickOrEnterPress(e) || e.type === CHANGE_KEY) {
50
+ setIsChecked(!isChecked);
51
+ onChange && onChange(!isChecked);
98
52
  }
99
- }]);
53
+ };
100
54
 
101
- return Checkbox;
102
- }(React.Component);
55
+ return /*#__PURE__*/React.createElement("div", _extends({
56
+ className: cn('', {
57
+ 'font-size': fontSize,
58
+ color: color,
59
+ checked: isChecked,
60
+ disabled: disabled,
61
+ error: error
62
+ }, className)
63
+ }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement("div", {
64
+ className: cn('inner', [classes === null || classes === void 0 ? void 0 : classes.inner])
65
+ }, /*#__PURE__*/React.createElement("label", {
66
+ className: cn('label', {
67
+ 'no-touch': !isTouch
68
+ })
69
+ }, /*#__PURE__*/React.createElement("input", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input), {
70
+ className: cn('input'),
71
+ type: "checkbox",
72
+ tabIndex: -1,
73
+ name: name,
74
+ value: value,
75
+ checked: isChecked,
76
+ onChange: handleChange,
77
+ disabled: disabled
78
+ })), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.customInput), {
79
+ tabIndex: 0,
80
+ role: "checkbox",
81
+ "aria-checked": isChecked,
82
+ className: cn('custom-input', [classes === null || classes === void 0 ? void 0 : classes.icon]),
83
+ onKeyDown: handleChange
84
+ }), /*#__PURE__*/React.createElement(CheckedIcon, {
85
+ className: cn('icon')
86
+ })), children), extraContent && /*#__PURE__*/React.createElement("span", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.extraContent), {
87
+ className: cn('extra-content')
88
+ }), extraContent)));
89
+ };
103
90
 
104
91
  Checkbox.propTypes = {
105
92
  className: PropTypes.string,
@@ -110,14 +97,14 @@ Checkbox.propTypes = {
110
97
  checked: PropTypes.bool,
111
98
  disabled: PropTypes.bool,
112
99
  error: PropTypes.bool,
113
- children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.string]),
114
- extraContent: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.string]),
115
- dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
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
+ }),
106
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.element, PropTypes.string]).isRequired,
107
+ extraContent: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.element, PropTypes.string]),
116
108
  onChange: PropTypes.func
117
109
  };
118
- Checkbox.defaultProps = {
119
- color: 'dark',
120
- fontSize: 'regular',
121
- checked: false
122
- };
123
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;
@@ -5,34 +5,29 @@ h4,
5
5
  h5 {
6
6
  margin: 0;
7
7
  }
8
- .mfui-content-area_color_base,
8
+ .mfui-content-area_color_default {
9
+ background-color: var(--content);
10
+ }
9
11
  .mfui-content-area_color_white {
10
- background-color: #FFFFFF;
12
+ background-color: var(--stcWhite);
11
13
  }
12
14
  .mfui-content-area_color_transparent {
13
15
  background-color: transparent;
14
16
  }
15
17
  .mfui-content-area_color_green {
16
- background-color: #00B956;
18
+ background-color: var(--brandGreen);
17
19
  }
18
20
  .mfui-content-area_color_purple {
19
- background-color: #731982;
21
+ background-color: var(--brandPurple);
20
22
  }
21
23
  .mfui-content-area_color_spbSky0 {
22
- background-color: #F6F6F6;
24
+ background-color: var(--spbSky0);
23
25
  }
24
26
  .mfui-content-area_color_spbSky1 {
25
- background-color: #EDEDED;
27
+ background-color: var(--spbSky1);
26
28
  }
27
29
  .mfui-content-area_color_spbSky2 {
28
- background-color: #D8D8D8;
29
- }
30
- .mfui-content-area_color_content,
31
- .mfui-content-area_color_freshAsphalt {
32
- background-color: #333333;
33
- }
34
- .mfui-content-area_color_fullBlack {
35
- background-color: #000000;
30
+ background-color: var(--spbSky2);
36
31
  }
37
32
  .mfui-content-area__inner {
38
33
  -webkit-box-sizing: content-box;
@@ -82,32 +77,27 @@ h5 {
82
77
  padding-right: 0;
83
78
  padding-left: 0;
84
79
  }
85
- .mfui-content-area__inner_color_base,
80
+ .mfui-content-area__inner_color_default {
81
+ background-color: var(--content);
82
+ }
86
83
  .mfui-content-area__inner_color_white {
87
- background-color: #FFFFFF;
84
+ background-color: var(--stcWhite);
88
85
  }
89
86
  .mfui-content-area__inner_color_transparent {
90
87
  background-color: transparent;
91
88
  }
92
89
  .mfui-content-area__inner_color_green {
93
- background-color: #00B956;
90
+ background-color: var(--brandGreen);
94
91
  }
95
92
  .mfui-content-area__inner_color_purple {
96
- background-color: #731982;
93
+ background-color: var(--brandPurple);
97
94
  }
98
95
  .mfui-content-area__inner_color_spbSky0 {
99
- background-color: #F6F6F6;
96
+ background-color: var(--spbSky0);
100
97
  }
101
98
  .mfui-content-area__inner_color_spbSky1 {
102
- background-color: #EDEDED;
99
+ background-color: var(--spbSky1);
103
100
  }
104
101
  .mfui-content-area__inner_color_spbSky2 {
105
- background-color: #D8D8D8;
106
- }
107
- .mfui-content-area__inner_color_content,
108
- .mfui-content-area__inner_color_freshAsphalt {
109
- background-color: #333333;
110
- }
111
- .mfui-content-area__inner_color_fullBlack {
112
- background-color: #000000;
102
+ background-color: var(--spbSky2);
113
103
  }
@@ -1,19 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import './ContentArea.less';
3
3
  declare const BACKGROUND_COLORS: {
4
- readonly BASE: "base";
4
+ readonly DEFAULT: "default";
5
+ readonly WHITE: "white";
5
6
  readonly TRANSPARENT: "transparent";
6
7
  readonly GREEN: "green";
7
8
  readonly PURPLE: "purple";
8
9
  readonly SPB_SKY_0: "spbSky0";
9
10
  readonly SPB_SKY_1: "spbSky1";
10
11
  readonly SPB_SKY_2: "spbSky2";
11
- readonly CONTENT: "content";
12
- readonly FULL_BLACK: "fullBlack";
13
- /** @deprecated */
14
- readonly WHITE: "white";
15
- /** @deprecated */
16
- readonly FRESH_ASPHALT: "freshAsphalt";
17
12
  };
18
13
  export declare type BackgroundColorType = typeof BACKGROUND_COLORS[keyof typeof BACKGROUND_COLORS];
19
14
  declare const DisableIndents: {