@megafon/ui-core 3.0.2 → 3.1.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 (54) hide show
  1. package/CHANGELOG.md +22 -1
  2. package/dist/es/components/Banner/Banner.css +16 -0
  3. package/dist/es/components/Banner/Banner.js +10 -3
  4. package/dist/es/components/Button/Button.css +8 -8
  5. package/dist/es/components/Calendar/Calendar.d.ts +8 -0
  6. package/dist/es/components/Calendar/Calendar.js +20 -4
  7. package/dist/es/components/Calendar/components/Day/Day.d.ts +3 -0
  8. package/dist/es/components/Calendar/components/Day/Day.js +9 -5
  9. package/dist/es/components/Calendar/components/Month/Month.d.ts +5 -0
  10. package/dist/es/components/Calendar/components/Month/Month.js +14 -8
  11. package/dist/es/components/Carousel/Carousel.js +22 -3
  12. package/dist/es/components/Collapse/Collapse.js +55 -28
  13. package/dist/es/components/ContentArea/ContentArea.css +32 -22
  14. package/dist/es/components/ContentArea/ContentArea.d.ts +3 -2
  15. package/dist/es/components/ContentArea/ContentArea.js +11 -11
  16. package/dist/es/components/Counter/Counter.d.ts +7 -0
  17. package/dist/es/components/Counter/Counter.js +15 -8
  18. package/dist/es/components/Logo/Logo.js +8 -10
  19. package/dist/es/components/NavArrow/NavArrow.d.ts +3 -0
  20. package/dist/es/components/NavArrow/NavArrow.js +8 -4
  21. package/dist/es/components/Paragraph/Paragraph.js +1 -1
  22. package/dist/es/components/Search/Search.d.ts +7 -0
  23. package/dist/es/components/Search/Search.js +16 -9
  24. package/dist/es/components/Switcher/Switcher.d.ts +4 -0
  25. package/dist/es/components/Switcher/Switcher.js +22 -10
  26. package/dist/es/components/Tabs/Tabs.css +1 -1
  27. package/dist/es/components/TextLink/TextLink.js +6 -8
  28. package/dist/lib/components/Banner/Banner.css +16 -0
  29. package/dist/lib/components/Banner/Banner.js +10 -3
  30. package/dist/lib/components/Button/Button.css +8 -8
  31. package/dist/lib/components/Calendar/Calendar.d.ts +8 -0
  32. package/dist/lib/components/Calendar/Calendar.js +19 -3
  33. package/dist/lib/components/Calendar/components/Day/Day.d.ts +3 -0
  34. package/dist/lib/components/Calendar/components/Day/Day.js +8 -4
  35. package/dist/lib/components/Calendar/components/Month/Month.d.ts +5 -0
  36. package/dist/lib/components/Calendar/components/Month/Month.js +13 -7
  37. package/dist/lib/components/Carousel/Carousel.js +22 -3
  38. package/dist/lib/components/Collapse/Collapse.js +54 -30
  39. package/dist/lib/components/ContentArea/ContentArea.css +32 -22
  40. package/dist/lib/components/ContentArea/ContentArea.d.ts +3 -2
  41. package/dist/lib/components/ContentArea/ContentArea.js +11 -11
  42. package/dist/lib/components/Counter/Counter.d.ts +7 -0
  43. package/dist/lib/components/Counter/Counter.js +14 -7
  44. package/dist/lib/components/Logo/Logo.js +8 -10
  45. package/dist/lib/components/NavArrow/NavArrow.d.ts +3 -0
  46. package/dist/lib/components/NavArrow/NavArrow.js +7 -3
  47. package/dist/lib/components/Paragraph/Paragraph.js +1 -1
  48. package/dist/lib/components/Search/Search.d.ts +7 -0
  49. package/dist/lib/components/Search/Search.js +15 -8
  50. package/dist/lib/components/Switcher/Switcher.d.ts +4 -0
  51. package/dist/lib/components/Switcher/Switcher.js +25 -9
  52. package/dist/lib/components/Tabs/Tabs.css +1 -1
  53. package/dist/lib/components/TextLink/TextLink.js +6 -8
  54. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,27 @@
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.1.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.2...@megafon/ui-core@3.1.0) (2022-02-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **carousel:** add resize listener to nav display ([12abd93](https://github.com/MegafonWebLab/megafon-ui/commit/12abd93d226676d2c4f78968c9d5de032783ec8d))
12
+ * **colors:** fix colors usage ([f2f59a8](https://github.com/MegafonWebLab/megafon-ui/commit/f2f59a81644c157394817af1531dabb1c0b67b19))
13
+ * **components:** better view of default props values ([1817ed5](https://github.com/MegafonWebLab/megafon-ui/commit/1817ed5cd17fd78a0911a89020138f05d7af9833))
14
+ * **contentarea:** add 'black' color prop value; deprecate 'default' color prop value; more examples ([e0b0c72](https://github.com/MegafonWebLab/megafon-ui/commit/e0b0c723a37f0e42ccb1c0d30df8ae36e9c82920))
15
+
16
+
17
+ ### Features
18
+
19
+ * **banner:** add opacity for slides ([bb403a1](https://github.com/MegafonWebLab/megafon-ui/commit/bb403a1d38fd0c1efd3e1df3ed72ea4e5c772c40))
20
+ * **collapse:** changed collapse animation via setTimeout to requestAnimationFrame ([06d7b4f](https://github.com/MegafonWebLab/megafon-ui/commit/06d7b4ff0f3cdf3cc22fb1d45e8401e259636cf5))
21
+ * **ui-core:** add dataAttrs prop for interactive elements of components that did not have ([f495833](https://github.com/MegafonWebLab/megafon-ui/commit/f495833b33ac7823ae5992a3f7eb8b7cef82c036))
22
+
23
+
24
+
25
+
26
+
6
27
  ## [3.0.2](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.1...@megafon/ui-core@3.0.2) (2022-02-15)
7
28
 
8
29
 
@@ -76,7 +97,7 @@ remove depreacted value 'freshAsphalt'
76
97
  * **contentarea**, **paragraph**, **storebanner** and **breadcrumbs** components from no don't have
77
98
  'freshAsphalt' and 'clearWhite' as values for colorizing props
78
99
  * **paragraph:** remove from color prop values: 'spbSky0', 'spbSky1', 'spbSky2'
79
- * **paragraph**: prop color change values from 'base' to 'white' and from 'contend' to 'default';
100
+ * **paragraph**: prop color change values from 'base' to 'white' and from 'content' to 'default';
80
101
  remove deprecared values 'freshAsphalt' and 'clearWhite'
81
102
  * **storebanner**: prop theme change value from 'black' to 'default'; remove deprecated value 'clearWhite'
82
103
  * **tooltip:** change onOpen, onClose types; AccessibilityEventTypeNative from @megafon/ui-helpers
@@ -17,6 +17,15 @@
17
17
  height: 540px;
18
18
  }
19
19
  }
20
+ @media screen and (min-width: 1024px) {
21
+ .mfui-banner__slide {
22
+ -webkit-backface-visibility: hidden;
23
+ backface-visibility: hidden;
24
+ opacity: 0;
25
+ -webkit-transition: opacity 0.2s;
26
+ transition: opacity 0.2s;
27
+ }
28
+ }
20
29
  @media screen and (min-width: 1024px) and (max-width: 1279px) {
21
30
  .mfui-banner__slide {
22
31
  height: 420px;
@@ -27,6 +36,13 @@
27
36
  height: 400px;
28
37
  }
29
38
  }
39
+ @media screen and (min-width: 1024px) {
40
+ .mfui-banner .swiper-slide-visible {
41
+ opacity: 1;
42
+ -webkit-transition: opacity 0.4s;
43
+ transition: opacity 0.4s;
44
+ }
45
+ }
30
46
  .mfui-banner__arrow {
31
47
  position: absolute;
32
48
  top: 50%;
@@ -159,6 +159,7 @@ var Banner = function Banner(_ref) {
159
159
  className: cn('swiper'),
160
160
  loop: loop,
161
161
  autoplay: autoPlay ? getAutoPlayConfig(autoPlayDelay) : false,
162
+ watchSlidesVisibility: true,
162
163
  onSwiper: handleSwiper,
163
164
  onReachBeginning: handleReachBeginning,
164
165
  onReachEnd: handleReachEnd,
@@ -171,14 +172,20 @@ var Banner = function Banner(_ref) {
171
172
  key: i,
172
173
  className: cn('slide', classes === null || classes === void 0 ? void 0 : classes.slide)
173
174
  }), child);
174
- })), /*#__PURE__*/React.createElement(NavArrow, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowPrev), {
175
+ })), /*#__PURE__*/React.createElement(NavArrow, {
176
+ dataAttrs: {
177
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowPrev
178
+ },
175
179
  className: cn('arrow', {
176
180
  prev: true
177
181
  }, [classes.arrow]),
178
182
  onClick: handlePrevClick,
179
183
  disabled: !loop && isBeginning,
180
184
  theme: navArrowTheme
181
- })), /*#__PURE__*/React.createElement(NavArrow, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowNext), {
185
+ }), /*#__PURE__*/React.createElement(NavArrow, {
186
+ dataAttrs: {
187
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowNext
188
+ },
182
189
  className: cn('arrow', {
183
190
  next: true
184
191
  }, [classes.arrow]),
@@ -186,7 +193,7 @@ var Banner = function Banner(_ref) {
186
193
  onClick: handleNextClick,
187
194
  disabled: !loop && isEnd,
188
195
  theme: navArrowTheme
189
- })), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pagination), {
196
+ }), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pagination), {
190
197
  className: cn('pagination', {
191
198
  theme: navTheme,
192
199
  'bottom-offset': withPaginationBottomOffset
@@ -302,14 +302,14 @@
302
302
  fill: var(--stcWhite);
303
303
  }
304
304
  .mfui-button_no-touch.mfui-button_type_outline.mfui-button_theme_white {
305
- --base7: rgba(255, 255, 255, 0.07);
306
- --base14: rgba(255, 255, 255, 0.14);
305
+ --stcWhite7: rgba(255, 255, 255, 0.07);
306
+ --stcWhite14: rgba(255, 255, 255, 0.14);
307
307
  }
308
308
  .mfui-button_no-touch.mfui-button_type_outline.mfui-button_theme_white:not(.mfui-button_loading):hover {
309
- background-color: var(--base7);
309
+ background-color: var(--stcWhite7);
310
310
  }
311
311
  .mfui-button_no-touch.mfui-button_type_outline.mfui-button_theme_white:not(.mfui-button_loading):active {
312
- background-color: var(--base14);
312
+ background-color: var(--stcWhite14);
313
313
  }
314
314
  .mfui-button_type_outline.mfui-button_theme_black {
315
315
  color: var(--stcBlack);
@@ -321,14 +321,14 @@
321
321
  fill: var(--stcBlack);
322
322
  }
323
323
  .mfui-button_no-touch.mfui-button_type_outline.mfui-button_theme_black {
324
- --content7: rgba(51, 51, 51, 0.07);
325
- --content14: rgba(51, 51, 51, 0.14);
324
+ --stcBlack7: rgba(51, 51, 51, 0.07);
325
+ --stcBlack14: rgba(51, 51, 51, 0.14);
326
326
  }
327
327
  .mfui-button_no-touch.mfui-button_type_outline.mfui-button_theme_black:not(.mfui-button_loading):hover {
328
- background-color: var(--content7);
328
+ background-color: var(--stcBlack7);
329
329
  }
330
330
  .mfui-button_no-touch.mfui-button_type_outline.mfui-button_theme_black:not(.mfui-button_loading):active {
331
- background-color: var(--content14);
331
+ background-color: var(--stcBlack14);
332
332
  }
333
333
  .mfui-button_full-width {
334
334
  display: block;
@@ -1,6 +1,14 @@
1
1
  import React from 'react';
2
2
  import './Calendar.less';
3
3
  export interface ICalendarProps {
4
+ /** Дополнительные data атрибуты к внутренним элементам */
5
+ dataAttrs?: {
6
+ root?: Record<string, string>;
7
+ day?: Record<string, string>;
8
+ month?: Record<string, string>;
9
+ arrowLeft?: Record<string, string>;
10
+ arrowRight?: Record<string, string>;
11
+ };
4
12
  /** Переключение календаря в режим выбора одной даты вместо периода */
5
13
  isSingleDate?: boolean;
6
14
  /** Классы для модификации компонента */
@@ -22,7 +22,7 @@ var __rest = this && this.__rest || function (s, e) {
22
22
 
23
23
  import React, { useState, useEffect, useMemo } from 'react';
24
24
  import { START_DATE, END_DATE, useDatepicker, useMonth } from '@datepicker-react/hooks';
25
- import { cnCreate } from '@megafon/ui-helpers';
25
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
26
26
  import differenceInDays from 'date-fns/differenceInDays';
27
27
  import format from 'date-fns/format';
28
28
  import isAfter from 'date-fns/isAfter';
@@ -57,7 +57,8 @@ var monthLabelFormat = function monthLabelFormat(date) {
57
57
  var cn = cnCreate('mfui-calendar');
58
58
 
59
59
  var Calendar = function Calendar(_ref) {
60
- var _ref$isSingleDate = _ref.isSingleDate,
60
+ var dataAttrs = _ref.dataAttrs,
61
+ _ref$isSingleDate = _ref.isSingleDate,
61
62
  isSingleDate = _ref$isSingleDate === void 0 ? false : _ref$isSingleDate,
62
63
  _ref$startDate = _ref.startDate,
63
64
  startDate = _ref$startDate === void 0 ? null : _ref$startDate,
@@ -202,6 +203,9 @@ var Calendar = function Calendar(_ref) {
202
203
  }
203
204
 
204
205
  return /*#__PURE__*/React.createElement(Day, _extends({
206
+ dataAttrs: {
207
+ root: _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.day, index + 1))
208
+ },
205
209
  date: date,
206
210
  key: formatDate(date, 'dd-MM-yyyy'),
207
211
  dayLabel: dayLabel
@@ -240,6 +244,11 @@ var Calendar = function Calendar(_ref) {
240
244
  var isPrevMonthDisabled = !!minBookingDate && isSameMonth(new Date(year, month, 1), minBookingDate);
241
245
  var isNextMonthDisabled = !!maxBookingDate && isSameMonth(new Date(year, month, 1), maxBookingDate);
242
246
  return /*#__PURE__*/React.createElement(Month, {
247
+ dataAttrs: {
248
+ root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.month,
249
+ arrowLeft: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowLeft,
250
+ arrowRight: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowRight
251
+ },
243
252
  key: "".concat(year, "-").concat(month),
244
253
  year: year,
245
254
  weekdayLabels: weekdayLabels,
@@ -252,12 +261,19 @@ var Calendar = function Calendar(_ref) {
252
261
  });
253
262
  };
254
263
 
255
- return /*#__PURE__*/React.createElement("div", {
264
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
256
265
  className: cn([className])
257
- }, renderMonths());
266
+ }), renderMonths());
258
267
  };
259
268
 
260
269
  Calendar.propTypes = {
270
+ dataAttrs: PropTypes.shape({
271
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
272
+ day: PropTypes.objectOf(PropTypes.string.isRequired),
273
+ month: PropTypes.objectOf(PropTypes.string.isRequired),
274
+ arrowLeft: PropTypes.objectOf(PropTypes.string.isRequired),
275
+ arrowRight: PropTypes.objectOf(PropTypes.string.isRequired)
276
+ }),
261
277
  isSingleDate: PropTypes.bool,
262
278
  className: PropTypes.string,
263
279
  startDate: PropTypes.instanceOf(Date),
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
2
  import './Day.less';
3
3
  export interface IDayPickerProps {
4
+ dataAttrs?: {
5
+ root?: Record<string, string>;
6
+ };
4
7
  isDateSelected: (date: Date) => boolean;
5
8
  isDateHovered: (date: Date) => boolean;
6
9
  isFirstOrLastSelectedDate: (date: Date) => boolean;
@@ -18,7 +18,7 @@ var __rest = this && this.__rest || function (s, e) {
18
18
 
19
19
  import React from 'react';
20
20
  import { useDay } from '@datepicker-react/hooks';
21
- import { cnCreate } from '@megafon/ui-helpers';
21
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
22
22
  import isFirstDayOfMonth from 'date-fns/isFirstDayOfMonth';
23
23
  import isLastDayOfMonth from 'date-fns/isLastDayOfMonth';
24
24
  import isMonday from 'date-fns/isMonday';
@@ -28,12 +28,13 @@ import "./Day.css";
28
28
  var cn = cnCreate('mfui-day');
29
29
 
30
30
  var Day = function Day(_a) {
31
- var _a$isBetween = _a.isBetween,
31
+ var dataAttrs = _a.dataAttrs,
32
+ _a$isBetween = _a.isBetween,
32
33
  isBetween = _a$isBetween === void 0 ? false : _a$isBetween,
33
34
  dayLabel = _a.dayLabel,
34
35
  date = _a.date,
35
36
  onMouseLeave = _a.onMouseLeave,
36
- pickerProps = __rest(_a, ["isBetween", "dayLabel", "date", "onMouseLeave"]);
37
+ pickerProps = __rest(_a, ["dataAttrs", "isBetween", "dayLabel", "date", "onMouseLeave"]);
37
38
 
38
39
  var dayRef = React.useRef(null);
39
40
 
@@ -63,7 +64,7 @@ var Day = function Day(_a) {
63
64
  onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave();
64
65
  };
65
66
 
66
- return /*#__PURE__*/React.createElement("button", {
67
+ return /*#__PURE__*/React.createElement("button", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
67
68
  onClick: onClick,
68
69
  onKeyDown: onKeyDown,
69
70
  onMouseEnter: onMouseEnter,
@@ -72,12 +73,15 @@ var Day = function Day(_a) {
72
73
  type: "button",
73
74
  ref: dayRef,
74
75
  className: cn(modClasses)
75
- }, /*#__PURE__*/React.createElement("span", {
76
+ }), /*#__PURE__*/React.createElement("span", {
76
77
  className: cn('label')
77
78
  }, dayLabel));
78
79
  };
79
80
 
80
81
  Day.propTypes = {
82
+ dataAttrs: PropTypes.shape({
83
+ root: PropTypes.objectOf(PropTypes.string.isRequired)
84
+ }),
81
85
  dayLabel: PropTypes.string,
82
86
  date: PropTypes.instanceOf(Date).isRequired,
83
87
  focusedDate: PropTypes.instanceOf(Date),
@@ -8,6 +8,11 @@ export interface IMonthPickerProps {
8
8
  goToNextMonths: () => void;
9
9
  }
10
10
  export interface IMonthProps {
11
+ dataAttrs?: {
12
+ root?: Record<string, string>;
13
+ arrowLeft?: Record<string, string>;
14
+ arrowRight?: Record<string, string>;
15
+ };
11
16
  isPrevMonthDisabled: boolean;
12
17
  isNextMonthDisabled: boolean;
13
18
  year: number;
@@ -2,7 +2,7 @@ import "core-js/modules/es.array.concat";
2
2
  import "core-js/modules/es.array.map";
3
3
  import _extends from "@babel/runtime/helpers/extends";
4
4
  import React from 'react';
5
- import { checkEventIsClickOrEnterPress, cnCreate } from '@megafon/ui-helpers';
5
+ import { checkEventIsClickOrEnterPress, cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
6
6
  import "./Month.css";
7
7
  import PropTypes from 'prop-types';
8
8
 
@@ -29,7 +29,8 @@ var ArrowRight = function ArrowRight(props) {
29
29
  var cn = cnCreate('mfui-month');
30
30
 
31
31
  var Month = function Month(_ref) {
32
- var isPrevMonthDisabled = _ref.isPrevMonthDisabled,
32
+ var dataAttrs = _ref.dataAttrs,
33
+ isPrevMonthDisabled = _ref.isPrevMonthDisabled,
33
34
  isNextMonthDisabled = _ref.isNextMonthDisabled,
34
35
  year = _ref.year,
35
36
  monthLabel = _ref.monthLabel,
@@ -56,11 +57,11 @@ var Month = function Month(_ref) {
56
57
  return hasFocus ? tabIndexWithFocus : tabIndexWithoutFocus;
57
58
  };
58
59
 
59
- return /*#__PURE__*/React.createElement("div", {
60
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
60
61
  className: cn()
61
- }, /*#__PURE__*/React.createElement("div", {
62
+ }), /*#__PURE__*/React.createElement("div", {
62
63
  className: cn('header')
63
- }, /*#__PURE__*/React.createElement(ArrowLeft, {
64
+ }, /*#__PURE__*/React.createElement(ArrowLeft, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowLeft), {
64
65
  role: "button",
65
66
  tabIndex: getTabIndex(!isPrevMonthDisabled),
66
67
  className: cn('arrow', {
@@ -68,9 +69,9 @@ var Month = function Month(_ref) {
68
69
  }),
69
70
  onKeyDown: handleArrowLeftClick,
70
71
  onClick: handleArrowLeftClick
71
- }), /*#__PURE__*/React.createElement("span", {
72
+ })), /*#__PURE__*/React.createElement("span", {
72
73
  className: cn('title')
73
- }, "".concat(monthLabel, " ").concat(year)), /*#__PURE__*/React.createElement(ArrowRight, {
74
+ }, "".concat(monthLabel, " ").concat(year)), /*#__PURE__*/React.createElement(ArrowRight, _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowRight), {
74
75
  role: "button",
75
76
  tabIndex: getTabIndex(!isNextMonthDisabled),
76
77
  className: cn('arrow', {
@@ -78,7 +79,7 @@ var Month = function Month(_ref) {
78
79
  }),
79
80
  onKeyDown: handleArrowRightClick,
80
81
  onClick: handleArrowRightClick
81
- })), /*#__PURE__*/React.createElement("div", {
82
+ }))), /*#__PURE__*/React.createElement("div", {
82
83
  className: cn('weekday-labels')
83
84
  }, weekdayLabels.map(function (dayLabel, index) {
84
85
  return /*#__PURE__*/React.createElement("div", {
@@ -91,6 +92,11 @@ var Month = function Month(_ref) {
91
92
  };
92
93
 
93
94
  Month.propTypes = {
95
+ dataAttrs: PropTypes.shape({
96
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
97
+ arrowLeft: PropTypes.objectOf(PropTypes.string.isRequired),
98
+ arrowRight: PropTypes.objectOf(PropTypes.string.isRequired)
99
+ }),
94
100
  isPrevMonthDisabled: PropTypes.bool.isRequired,
95
101
  isNextMonthDisabled: PropTypes.bool.isRequired,
96
102
  year: PropTypes.number.isRequired,
@@ -180,14 +180,18 @@ var Carousel = function Carousel(_ref) {
180
180
  if (isBullet && swiperInstance) {
181
181
  increaseAutoplayDelay(swiperInstance);
182
182
  }
183
+ };
184
+
185
+ var handleNavDisplay = function handleNavDisplay(swiper) {
186
+ setBeginning(swiper.isBeginning);
187
+ setEnd(swiper.isEnd);
188
+ setLocked(swiper.isBeginning && swiper.isEnd);
183
189
  }; // https://github.com/nolimits4web/Swiper/issues/2346
184
190
 
185
191
 
186
192
  var handleSwiperResize = React.useCallback(function () {
187
193
  throttle(function (swiper) {
188
- setBeginning(swiper.isBeginning);
189
- setEnd(swiper.isEnd);
190
- setLocked(swiper.isBeginning && swiper.isEnd);
194
+ handleNavDisplay(swiper);
191
195
 
192
196
  if (swiper.params.slidesPerView === SlidesPerView.AUTO) {
193
197
  swiper.slides.css('width', '');
@@ -218,6 +222,21 @@ var Carousel = function Carousel(_ref) {
218
222
  e.nativeEvent.preventDefault();
219
223
  };
220
224
 
225
+ React.useEffect(function () {
226
+ if (!swiperInstance) {
227
+ return undefined;
228
+ }
229
+
230
+ var windowResizeHandler = function windowResizeHandler() {
231
+ return handleNavDisplay(swiperInstance);
232
+ };
233
+
234
+ var windowResizeHandlerThrottled = throttle(windowResizeHandler, throttleTime.resize);
235
+ window.addEventListener('resize', windowResizeHandlerThrottled);
236
+ return function () {
237
+ window.removeEventListener('resize', windowResizeHandlerThrottled);
238
+ };
239
+ }, [swiperInstance]);
221
240
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
222
241
  ref: rootRef,
223
242
  className: cn({
@@ -1,10 +1,20 @@
1
- import "core-js/modules/web.timers";
2
1
  import _extends from "@babel/runtime/helpers/extends";
3
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
2
  import * as React from 'react';
3
+ import { useCallback, useEffect } from 'react';
5
4
  import { filterDataAttrs } from '@megafon/ui-helpers';
6
5
  import * as PropTypes from 'prop-types';
7
- var BROWSER_DELAY = 100;
6
+ var sin = Math.sin,
7
+ cos = Math.cos,
8
+ min = Math.min,
9
+ PI = Math.PI;
10
+
11
+ var easeOutSine = function easeOutSine(progress) {
12
+ return sin(progress * PI / 2);
13
+ };
14
+
15
+ var easeInSine = function easeInSine(progress) {
16
+ return 1 - cos(progress * PI / 2);
17
+ };
8
18
 
9
19
  var Collapse = function Collapse(props) {
10
20
  var className = props.className,
@@ -16,58 +26,75 @@ var Collapse = function Collapse(props) {
16
26
  children = props.children,
17
27
  isOpened = props.isOpened,
18
28
  dataAttrs = props.dataAttrs;
29
+ var duration = animation ? animationDuration : 0;
30
+ var animationStart = React.useRef(null);
31
+ var animationId = React.useRef(null);
19
32
  var canUpdate = React.useRef(false);
20
- var timer = React.useRef(undefined);
21
33
  var rootNode = React.useRef(null);
34
+ useEffect(function () {
35
+ animationId.current && window.cancelAnimationFrame(animationId.current);
36
+ }, [isOpened]);
37
+ var animateSlide = useCallback(function (contentHeight, animationTime, timePassed) {
38
+ var isOpenAction = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
39
+
40
+ if (!rootNode.current) {
41
+ return;
42
+ }
22
43
 
23
- var _React$useState = React.useState('0px'),
24
- _React$useState2 = _slicedToArray(_React$useState, 2),
25
- height = _React$useState2[0],
26
- setHeight = _React$useState2[1];
44
+ if (!animationStart.current) {
45
+ animationStart.current = timePassed;
46
+ }
27
47
 
28
- var transition = animation ? "height ".concat(animationDuration / 1000, "s") : 'none';
29
- var duration = animation ? animationDuration : 0;
48
+ var runtime = timePassed - animationStart.current;
49
+ var progress = animationTime ? min(runtime / animationTime, 1) : 1;
50
+ var isAnimationInProgress = progress < 1;
51
+ var nextHeight = isOpenAction ? easeOutSine(progress) * contentHeight : contentHeight - easeInSine(progress) * contentHeight;
52
+ rootNode.current.style.height = "".concat(nextHeight, "px");
30
53
 
31
- var animateSlide = function animateSlide(finalHeight, delay) {
54
+ if (isAnimationInProgress) {
55
+ animationId.current = window.requestAnimationFrame(function (time) {
56
+ return animateSlide(contentHeight, animationTime, time, isOpenAction);
57
+ });
58
+ } else {
59
+ animationStart.current = null;
60
+ animationId.current = null;
61
+ }
62
+ }, []);
63
+ useEffect(function () {
32
64
  if (!rootNode.current) {
33
65
  return;
34
66
  }
35
67
 
36
- setHeight("".concat(rootNode.current.scrollHeight, "px"));
37
- timer.current = window.setTimeout(function () {
38
- setHeight(finalHeight);
39
- }, delay);
40
- };
68
+ var _rootNode$current$scr = rootNode.current.scrollHeight,
69
+ scrollHeight = _rootNode$current$scr === void 0 ? 0 : _rootNode$current$scr;
41
70
 
42
- React.useEffect(function () {
43
71
  switch (true) {
44
72
  case !canUpdate.current && isOpened:
45
- setHeight('auto');
73
+ rootNode.current.style.height = 'auto';
46
74
  break;
47
75
 
48
76
  case !canUpdate.current && !isOpened:
49
- setHeight('0px');
77
+ rootNode.current.style.height = '0px';
50
78
  break;
51
79
 
52
80
  case isOpened:
53
- animateSlide('auto', duration);
81
+ animationId.current = window.requestAnimationFrame(function (timePassed) {
82
+ return animateSlide(scrollHeight, duration, timePassed, true);
83
+ });
54
84
  break;
55
85
 
56
86
  default:
57
- animateSlide('0px', BROWSER_DELAY);
87
+ animationId.current = window.requestAnimationFrame(function (timePassed) {
88
+ return animateSlide(scrollHeight, duration, timePassed);
89
+ });
58
90
  }
59
91
 
60
92
  canUpdate.current = true;
61
- return function () {
62
- return clearTimeout(timer.current);
63
- };
64
- }, [isOpened, duration]);
93
+ }, [isOpened, duration, animateSlide]);
65
94
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
66
95
  className: className,
67
96
  style: {
68
- overflow: 'hidden',
69
- height: height,
70
- transition: transition
97
+ overflow: 'hidden'
71
98
  },
72
99
  ref: rootNode
73
100
  }), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.inner), {
@@ -5,30 +5,37 @@ h4,
5
5
  h5 {
6
6
  margin: 0;
7
7
  }
8
- .mfui-content-area_color_default {
9
- background-color: var(--content);
10
- }
11
- .mfui-content-area_color_white {
12
- background-color: var(--stcWhite);
8
+ .mfui-content-area {
9
+ /* deprecated */
10
+ /* deprecated */
13
11
  }
14
- .mfui-content-area_color_transparent {
12
+ .mfui-content-area_background-color_transparent {
15
13
  background-color: transparent;
16
14
  }
17
- .mfui-content-area_color_green {
15
+ .mfui-content-area_background-color_black {
16
+ background-color: var(--stcBlack);
17
+ }
18
+ .mfui-content-area_background-color_white {
19
+ background-color: var(--stcWhite);
20
+ }
21
+ .mfui-content-area_background-color_green {
18
22
  background-color: var(--brandGreen);
19
23
  }
20
- .mfui-content-area_color_purple {
24
+ .mfui-content-area_background-color_purple {
21
25
  background-color: var(--brandPurple);
22
26
  }
23
- .mfui-content-area_color_spbSky0 {
27
+ .mfui-content-area_background-color_spbSky0 {
24
28
  background-color: var(--spbSky0);
25
29
  }
26
- .mfui-content-area_color_spbSky1 {
30
+ .mfui-content-area_background-color_spbSky1 {
27
31
  background-color: var(--spbSky1);
28
32
  }
29
- .mfui-content-area_color_spbSky2 {
33
+ .mfui-content-area_background-color_spbSky2 {
30
34
  background-color: var(--spbSky2);
31
35
  }
36
+ .mfui-content-area_background-color_default {
37
+ background-color: var(--content);
38
+ }
32
39
  .mfui-content-area__inner {
33
40
  -webkit-box-sizing: content-box;
34
41
  box-sizing: content-box;
@@ -77,27 +84,30 @@ h5 {
77
84
  padding-right: 0;
78
85
  padding-left: 0;
79
86
  }
80
- .mfui-content-area__inner_color_default {
81
- background-color: var(--content);
87
+ .mfui-content-area__inner_background-color_transparent {
88
+ background-color: transparent;
82
89
  }
83
- .mfui-content-area__inner_color_white {
84
- background-color: var(--stcWhite);
90
+ .mfui-content-area__inner_background-color_black {
91
+ background-color: var(--stcBlack);
85
92
  }
86
- .mfui-content-area__inner_color_transparent {
87
- background-color: transparent;
93
+ .mfui-content-area__inner_background-color_white {
94
+ background-color: var(--stcWhite);
88
95
  }
89
- .mfui-content-area__inner_color_green {
96
+ .mfui-content-area__inner_background-color_green {
90
97
  background-color: var(--brandGreen);
91
98
  }
92
- .mfui-content-area__inner_color_purple {
99
+ .mfui-content-area__inner_background-color_purple {
93
100
  background-color: var(--brandPurple);
94
101
  }
95
- .mfui-content-area__inner_color_spbSky0 {
102
+ .mfui-content-area__inner_background-color_spbSky0 {
96
103
  background-color: var(--spbSky0);
97
104
  }
98
- .mfui-content-area__inner_color_spbSky1 {
105
+ .mfui-content-area__inner_background-color_spbSky1 {
99
106
  background-color: var(--spbSky1);
100
107
  }
101
- .mfui-content-area__inner_color_spbSky2 {
108
+ .mfui-content-area__inner_background-color_spbSky2 {
102
109
  background-color: var(--spbSky2);
103
110
  }
111
+ .mfui-content-area__inner_background-color_default {
112
+ background-color: var(--content);
113
+ }
@@ -1,14 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import './ContentArea.less';
3
3
  declare const BACKGROUND_COLORS: {
4
- readonly DEFAULT: "default";
5
- readonly WHITE: "white";
6
4
  readonly TRANSPARENT: "transparent";
5
+ readonly BLACK: "black";
6
+ readonly WHITE: "white";
7
7
  readonly GREEN: "green";
8
8
  readonly PURPLE: "purple";
9
9
  readonly SPB_SKY_0: "spbSky0";
10
10
  readonly SPB_SKY_1: "spbSky1";
11
11
  readonly SPB_SKY_2: "spbSky2";
12
+ readonly DEFAULT: "default";
12
13
  };
13
14
  export declare type BackgroundColorType = typeof BACKGROUND_COLORS[keyof typeof BACKGROUND_COLORS];
14
15
  declare const DisableIndents: {