@megafon/ui-core 3.0.2 → 3.3.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.
- package/CHANGELOG.md +57 -1
- package/dist/es/components/Accordion/Accordion.css +1 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.css +70 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.d.ts +33 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.js +113 -0
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.css +32 -0
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.d.ts +22 -0
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.js +38 -0
- package/dist/es/components/Banner/Banner.css +16 -0
- package/dist/es/components/Banner/Banner.js +10 -3
- package/dist/es/components/Button/Button.css +8 -8
- package/dist/es/components/Calendar/Calendar.d.ts +8 -0
- package/dist/es/components/Calendar/Calendar.js +20 -4
- package/dist/es/components/Calendar/components/Day/Day.d.ts +3 -0
- package/dist/es/components/Calendar/components/Day/Day.js +9 -5
- package/dist/es/components/Calendar/components/Month/Month.d.ts +5 -0
- package/dist/es/components/Calendar/components/Month/Month.js +14 -8
- package/dist/es/components/Carousel/Carousel.js +31 -6
- package/dist/es/components/Checkbox/Checkbox.css +3 -0
- package/dist/es/components/Collapse/Collapse.js +55 -28
- package/dist/es/components/ContentArea/ContentArea.css +32 -22
- package/dist/es/components/ContentArea/ContentArea.d.ts +3 -2
- package/dist/es/components/ContentArea/ContentArea.js +11 -11
- package/dist/es/components/Counter/Counter.d.ts +7 -0
- package/dist/es/components/Counter/Counter.js +15 -8
- package/dist/es/components/Logo/Logo.js +8 -10
- package/dist/es/components/NavArrow/NavArrow.d.ts +3 -0
- package/dist/es/components/NavArrow/NavArrow.js +8 -4
- package/dist/es/components/Paragraph/Paragraph.js +1 -1
- package/dist/es/components/Search/Search.d.ts +7 -0
- package/dist/es/components/Search/Search.js +16 -9
- package/dist/es/components/Switcher/Switcher.d.ts +4 -0
- package/dist/es/components/Switcher/Switcher.js +22 -10
- package/dist/es/components/Tabs/Tabs.css +1 -1
- package/dist/es/components/TextLink/TextLink.js +6 -8
- package/dist/es/components/Tile/Tile.d.ts +2 -0
- package/dist/es/components/Tile/Tile.js +7 -3
- package/dist/es/index.d.ts +2 -0
- package/dist/es/index.js +2 -0
- package/dist/lib/components/Accordion/Accordion.css +1 -0
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.css +70 -0
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.d.ts +33 -0
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.js +134 -0
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.css +32 -0
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.d.ts +22 -0
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.js +59 -0
- package/dist/lib/components/Banner/Banner.css +16 -0
- package/dist/lib/components/Banner/Banner.js +10 -3
- package/dist/lib/components/Button/Button.css +8 -8
- package/dist/lib/components/Calendar/Calendar.d.ts +8 -0
- package/dist/lib/components/Calendar/Calendar.js +19 -3
- package/dist/lib/components/Calendar/components/Day/Day.d.ts +3 -0
- package/dist/lib/components/Calendar/components/Day/Day.js +8 -4
- package/dist/lib/components/Calendar/components/Month/Month.d.ts +5 -0
- package/dist/lib/components/Calendar/components/Month/Month.js +13 -7
- package/dist/lib/components/Carousel/Carousel.js +31 -6
- package/dist/lib/components/Checkbox/Checkbox.css +3 -0
- package/dist/lib/components/Collapse/Collapse.js +54 -30
- package/dist/lib/components/ContentArea/ContentArea.css +32 -22
- package/dist/lib/components/ContentArea/ContentArea.d.ts +3 -2
- package/dist/lib/components/ContentArea/ContentArea.js +11 -11
- package/dist/lib/components/Counter/Counter.d.ts +7 -0
- package/dist/lib/components/Counter/Counter.js +14 -7
- package/dist/lib/components/Logo/Logo.js +8 -10
- package/dist/lib/components/NavArrow/NavArrow.d.ts +3 -0
- package/dist/lib/components/NavArrow/NavArrow.js +7 -3
- package/dist/lib/components/Paragraph/Paragraph.js +1 -1
- package/dist/lib/components/Search/Search.d.ts +7 -0
- package/dist/lib/components/Search/Search.js +15 -8
- package/dist/lib/components/Switcher/Switcher.d.ts +4 -0
- package/dist/lib/components/Switcher/Switcher.js +25 -9
- package/dist/lib/components/Tabs/Tabs.css +1 -1
- package/dist/lib/components/TextLink/TextLink.js +6 -8
- package/dist/lib/components/Tile/Tile.d.ts +2 -0
- package/dist/lib/components/Tile/Tile.js +7 -3
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.js +16 -0
- package/package.json +4 -4
|
@@ -187,6 +187,7 @@ var Banner = function Banner(_ref) {
|
|
|
187
187
|
className: cn('swiper'),
|
|
188
188
|
loop: loop,
|
|
189
189
|
autoplay: autoPlay ? getAutoPlayConfig(autoPlayDelay) : false,
|
|
190
|
+
watchSlidesVisibility: true,
|
|
190
191
|
onSwiper: handleSwiper,
|
|
191
192
|
onReachBeginning: handleReachBeginning,
|
|
192
193
|
onReachEnd: handleReachEnd,
|
|
@@ -199,14 +200,20 @@ var Banner = function Banner(_ref) {
|
|
|
199
200
|
key: i,
|
|
200
201
|
className: cn('slide', classes === null || classes === void 0 ? void 0 : classes.slide)
|
|
201
202
|
}), child);
|
|
202
|
-
})), /*#__PURE__*/React.createElement(_NavArrow["default"],
|
|
203
|
+
})), /*#__PURE__*/React.createElement(_NavArrow["default"], {
|
|
204
|
+
dataAttrs: {
|
|
205
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowPrev
|
|
206
|
+
},
|
|
203
207
|
className: cn('arrow', {
|
|
204
208
|
prev: true
|
|
205
209
|
}, [classes.arrow]),
|
|
206
210
|
onClick: handlePrevClick,
|
|
207
211
|
disabled: !loop && isBeginning,
|
|
208
212
|
theme: navArrowTheme
|
|
209
|
-
})
|
|
213
|
+
}), /*#__PURE__*/React.createElement(_NavArrow["default"], {
|
|
214
|
+
dataAttrs: {
|
|
215
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowNext
|
|
216
|
+
},
|
|
210
217
|
className: cn('arrow', {
|
|
211
218
|
next: true
|
|
212
219
|
}, [classes.arrow]),
|
|
@@ -214,7 +221,7 @@ var Banner = function Banner(_ref) {
|
|
|
214
221
|
onClick: handleNextClick,
|
|
215
222
|
disabled: !loop && isEnd,
|
|
216
223
|
theme: navArrowTheme
|
|
217
|
-
})
|
|
224
|
+
}), /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.pagination), {
|
|
218
225
|
className: cn('pagination', {
|
|
219
226
|
theme: navTheme,
|
|
220
227
|
'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
|
-
--
|
|
306
|
-
--
|
|
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(--
|
|
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(--
|
|
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
|
-
--
|
|
325
|
-
--
|
|
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(--
|
|
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(--
|
|
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
|
/** Классы для модификации компонента */
|
|
@@ -90,7 +90,8 @@ var monthLabelFormat = function monthLabelFormat(date) {
|
|
|
90
90
|
var cn = (0, _uiHelpers.cnCreate)('mfui-calendar');
|
|
91
91
|
|
|
92
92
|
var Calendar = function Calendar(_ref) {
|
|
93
|
-
var
|
|
93
|
+
var dataAttrs = _ref.dataAttrs,
|
|
94
|
+
_ref$isSingleDate = _ref.isSingleDate,
|
|
94
95
|
isSingleDate = _ref$isSingleDate === void 0 ? false : _ref$isSingleDate,
|
|
95
96
|
_ref$startDate = _ref.startDate,
|
|
96
97
|
startDate = _ref$startDate === void 0 ? null : _ref$startDate,
|
|
@@ -235,6 +236,9 @@ var Calendar = function Calendar(_ref) {
|
|
|
235
236
|
}
|
|
236
237
|
|
|
237
238
|
return /*#__PURE__*/_react["default"].createElement(_Day["default"], (0, _extends2["default"])({
|
|
239
|
+
dataAttrs: {
|
|
240
|
+
root: (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.day, index + 1))
|
|
241
|
+
},
|
|
238
242
|
date: date,
|
|
239
243
|
key: formatDate(date, 'dd-MM-yyyy'),
|
|
240
244
|
dayLabel: dayLabel
|
|
@@ -272,6 +276,11 @@ var Calendar = function Calendar(_ref) {
|
|
|
272
276
|
var isPrevMonthDisabled = !!minBookingDate && (0, _isSameMonth["default"])(new Date(year, month, 1), minBookingDate);
|
|
273
277
|
var isNextMonthDisabled = !!maxBookingDate && (0, _isSameMonth["default"])(new Date(year, month, 1), maxBookingDate);
|
|
274
278
|
return /*#__PURE__*/_react["default"].createElement(_Month["default"], {
|
|
279
|
+
dataAttrs: {
|
|
280
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.month,
|
|
281
|
+
arrowLeft: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowLeft,
|
|
282
|
+
arrowRight: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowRight
|
|
283
|
+
},
|
|
275
284
|
key: "".concat(year, "-").concat(month),
|
|
276
285
|
year: year,
|
|
277
286
|
weekdayLabels: weekdayLabels,
|
|
@@ -284,12 +293,19 @@ var Calendar = function Calendar(_ref) {
|
|
|
284
293
|
});
|
|
285
294
|
};
|
|
286
295
|
|
|
287
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
296
|
+
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
288
297
|
className: cn([className])
|
|
289
|
-
}, renderMonths());
|
|
298
|
+
}), renderMonths());
|
|
290
299
|
};
|
|
291
300
|
|
|
292
301
|
Calendar.propTypes = {
|
|
302
|
+
dataAttrs: _propTypes["default"].shape({
|
|
303
|
+
root: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
|
304
|
+
day: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
|
305
|
+
month: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
|
306
|
+
arrowLeft: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
|
307
|
+
arrowRight: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired)
|
|
308
|
+
}),
|
|
293
309
|
isSingleDate: _propTypes["default"].bool,
|
|
294
310
|
className: _propTypes["default"].string,
|
|
295
311
|
startDate: _propTypes["default"].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;
|
|
@@ -47,12 +47,13 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
47
47
|
var cn = (0, _uiHelpers.cnCreate)('mfui-day');
|
|
48
48
|
|
|
49
49
|
var Day = function Day(_a) {
|
|
50
|
-
var
|
|
50
|
+
var dataAttrs = _a.dataAttrs,
|
|
51
|
+
_a$isBetween = _a.isBetween,
|
|
51
52
|
isBetween = _a$isBetween === void 0 ? false : _a$isBetween,
|
|
52
53
|
dayLabel = _a.dayLabel,
|
|
53
54
|
date = _a.date,
|
|
54
55
|
onMouseLeave = _a.onMouseLeave,
|
|
55
|
-
pickerProps = __rest(_a, ["isBetween", "dayLabel", "date", "onMouseLeave"]);
|
|
56
|
+
pickerProps = __rest(_a, ["dataAttrs", "isBetween", "dayLabel", "date", "onMouseLeave"]);
|
|
56
57
|
|
|
57
58
|
var dayRef = _react["default"].useRef(null);
|
|
58
59
|
|
|
@@ -82,7 +83,7 @@ var Day = function Day(_a) {
|
|
|
82
83
|
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave();
|
|
83
84
|
};
|
|
84
85
|
|
|
85
|
-
return /*#__PURE__*/_react["default"].createElement("button", {
|
|
86
|
+
return /*#__PURE__*/_react["default"].createElement("button", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
86
87
|
onClick: onClick,
|
|
87
88
|
onKeyDown: onKeyDown,
|
|
88
89
|
onMouseEnter: onMouseEnter,
|
|
@@ -91,12 +92,15 @@ var Day = function Day(_a) {
|
|
|
91
92
|
type: "button",
|
|
92
93
|
ref: dayRef,
|
|
93
94
|
className: cn(modClasses)
|
|
94
|
-
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
95
|
+
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
95
96
|
className: cn('label')
|
|
96
97
|
}, dayLabel));
|
|
97
98
|
};
|
|
98
99
|
|
|
99
100
|
Day.propTypes = {
|
|
101
|
+
dataAttrs: _propTypes["default"].shape({
|
|
102
|
+
root: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired)
|
|
103
|
+
}),
|
|
100
104
|
dayLabel: _propTypes["default"].string,
|
|
101
105
|
date: _propTypes["default"].instanceOf(Date).isRequired,
|
|
102
106
|
focusedDate: _propTypes["default"].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;
|
|
@@ -42,7 +42,8 @@ var ArrowRight = function ArrowRight(props) {
|
|
|
42
42
|
var cn = (0, _uiHelpers.cnCreate)('mfui-month');
|
|
43
43
|
|
|
44
44
|
var Month = function Month(_ref) {
|
|
45
|
-
var
|
|
45
|
+
var dataAttrs = _ref.dataAttrs,
|
|
46
|
+
isPrevMonthDisabled = _ref.isPrevMonthDisabled,
|
|
46
47
|
isNextMonthDisabled = _ref.isNextMonthDisabled,
|
|
47
48
|
year = _ref.year,
|
|
48
49
|
monthLabel = _ref.monthLabel,
|
|
@@ -69,11 +70,11 @@ var Month = function Month(_ref) {
|
|
|
69
70
|
return hasFocus ? tabIndexWithFocus : tabIndexWithoutFocus;
|
|
70
71
|
};
|
|
71
72
|
|
|
72
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
73
|
+
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
73
74
|
className: cn()
|
|
74
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
75
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
75
76
|
className: cn('header')
|
|
76
|
-
}, /*#__PURE__*/_react["default"].createElement(ArrowLeft, {
|
|
77
|
+
}, /*#__PURE__*/_react["default"].createElement(ArrowLeft, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowLeft), {
|
|
77
78
|
role: "button",
|
|
78
79
|
tabIndex: getTabIndex(!isPrevMonthDisabled),
|
|
79
80
|
className: cn('arrow', {
|
|
@@ -81,9 +82,9 @@ var Month = function Month(_ref) {
|
|
|
81
82
|
}),
|
|
82
83
|
onKeyDown: handleArrowLeftClick,
|
|
83
84
|
onClick: handleArrowLeftClick
|
|
84
|
-
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
85
|
+
})), /*#__PURE__*/_react["default"].createElement("span", {
|
|
85
86
|
className: cn('title')
|
|
86
|
-
}, "".concat(monthLabel, " ").concat(year)), /*#__PURE__*/_react["default"].createElement(ArrowRight, {
|
|
87
|
+
}, "".concat(monthLabel, " ").concat(year)), /*#__PURE__*/_react["default"].createElement(ArrowRight, (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.arrowRight), {
|
|
87
88
|
role: "button",
|
|
88
89
|
tabIndex: getTabIndex(!isNextMonthDisabled),
|
|
89
90
|
className: cn('arrow', {
|
|
@@ -91,7 +92,7 @@ var Month = function Month(_ref) {
|
|
|
91
92
|
}),
|
|
92
93
|
onKeyDown: handleArrowRightClick,
|
|
93
94
|
onClick: handleArrowRightClick
|
|
94
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
95
|
+
}))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
95
96
|
className: cn('weekday-labels')
|
|
96
97
|
}, weekdayLabels.map(function (dayLabel, index) {
|
|
97
98
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -104,6 +105,11 @@ var Month = function Month(_ref) {
|
|
|
104
105
|
};
|
|
105
106
|
|
|
106
107
|
Month.propTypes = {
|
|
108
|
+
dataAttrs: _propTypes["default"].shape({
|
|
109
|
+
root: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
|
110
|
+
arrowLeft: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired),
|
|
111
|
+
arrowRight: _propTypes["default"].objectOf(_propTypes["default"].string.isRequired)
|
|
112
|
+
}),
|
|
107
113
|
isPrevMonthDisabled: _propTypes["default"].bool.isRequired,
|
|
108
114
|
isNextMonthDisabled: _propTypes["default"].bool.isRequired,
|
|
109
115
|
year: _propTypes["default"].number.isRequired,
|
|
@@ -212,14 +212,18 @@ var Carousel = function Carousel(_ref) {
|
|
|
212
212
|
if (isBullet && swiperInstance) {
|
|
213
213
|
increaseAutoplayDelay(swiperInstance);
|
|
214
214
|
}
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
var handleNavDisplay = function handleNavDisplay(swiper) {
|
|
218
|
+
setBeginning(swiper.isBeginning);
|
|
219
|
+
setEnd(swiper.isEnd);
|
|
220
|
+
setLocked(swiper.isBeginning && swiper.isEnd);
|
|
215
221
|
}; // https://github.com/nolimits4web/Swiper/issues/2346
|
|
216
222
|
|
|
217
223
|
|
|
218
224
|
var handleSwiperResize = React.useCallback(function () {
|
|
219
225
|
(0, _lodash["default"])(function (swiper) {
|
|
220
|
-
|
|
221
|
-
setEnd(swiper.isEnd);
|
|
222
|
-
setLocked(swiper.isBeginning && swiper.isEnd);
|
|
226
|
+
handleNavDisplay(swiper);
|
|
223
227
|
|
|
224
228
|
if (swiper.params.slidesPerView === SlidesPerView.AUTO) {}
|
|
225
229
|
}, _throttleTime["default"].resize);
|
|
@@ -248,6 +252,21 @@ var Carousel = function Carousel(_ref) {
|
|
|
248
252
|
e.nativeEvent.preventDefault();
|
|
249
253
|
};
|
|
250
254
|
|
|
255
|
+
React.useEffect(function () {
|
|
256
|
+
if (!swiperInstance) {
|
|
257
|
+
return undefined;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
var windowResizeHandler = function windowResizeHandler() {
|
|
261
|
+
return handleNavDisplay(swiperInstance);
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
var windowResizeHandlerThrottled = (0, _lodash["default"])(windowResizeHandler, _throttleTime["default"].resize);
|
|
265
|
+
window.addEventListener('resize', windowResizeHandlerThrottled);
|
|
266
|
+
return function () {
|
|
267
|
+
window.removeEventListener('resize', windowResizeHandlerThrottled);
|
|
268
|
+
};
|
|
269
|
+
}, [swiperInstance]);
|
|
251
270
|
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
252
271
|
ref: rootRef,
|
|
253
272
|
className: cn({
|
|
@@ -292,7 +311,10 @@ var Carousel = function Carousel(_ref) {
|
|
|
292
311
|
onFocus: handleSlideFocus(i),
|
|
293
312
|
onMouseDown: disableFocusOnSlideClick
|
|
294
313
|
}), child);
|
|
295
|
-
})), /*#__PURE__*/React.createElement(_NavArrow["default"],
|
|
314
|
+
})), /*#__PURE__*/React.createElement(_NavArrow["default"], {
|
|
315
|
+
dataAttrs: {
|
|
316
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.prev
|
|
317
|
+
},
|
|
296
318
|
className: cn('arrow', {
|
|
297
319
|
prev: true,
|
|
298
320
|
locked: isLocked
|
|
@@ -300,7 +322,10 @@ var Carousel = function Carousel(_ref) {
|
|
|
300
322
|
onClick: handlePrevClick,
|
|
301
323
|
disabled: !loop && isBeginning,
|
|
302
324
|
theme: _NavArrow.Theme.PURPLE
|
|
303
|
-
})
|
|
325
|
+
}), /*#__PURE__*/React.createElement(_NavArrow["default"], {
|
|
326
|
+
dataAttrs: {
|
|
327
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.next
|
|
328
|
+
},
|
|
304
329
|
className: cn('arrow', {
|
|
305
330
|
next: true,
|
|
306
331
|
locked: isLocked
|
|
@@ -309,7 +334,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
309
334
|
onClick: handleNextClick,
|
|
310
335
|
disabled: !loop && isEnd,
|
|
311
336
|
theme: _NavArrow.Theme.PURPLE
|
|
312
|
-
}))
|
|
337
|
+
}));
|
|
313
338
|
};
|
|
314
339
|
|
|
315
340
|
Carousel.propTypes = {
|
|
@@ -7,12 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
|
|
10
|
-
require("core-js/modules/web.timers");
|
|
11
|
-
|
|
12
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
11
|
|
|
14
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
12
|
var React = _interopRequireWildcard(require("react"));
|
|
17
13
|
|
|
18
14
|
var _uiHelpers = require("@megafon/ui-helpers");
|
|
@@ -25,7 +21,18 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
25
21
|
|
|
26
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
23
|
|
|
28
|
-
var
|
|
24
|
+
var sin = Math.sin,
|
|
25
|
+
cos = Math.cos,
|
|
26
|
+
min = Math.min,
|
|
27
|
+
PI = Math.PI;
|
|
28
|
+
|
|
29
|
+
var easeOutSine = function easeOutSine(progress) {
|
|
30
|
+
return sin(progress * PI / 2);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var easeInSine = function easeInSine(progress) {
|
|
34
|
+
return 1 - cos(progress * PI / 2);
|
|
35
|
+
};
|
|
29
36
|
|
|
30
37
|
var Collapse = function Collapse(props) {
|
|
31
38
|
var className = props.className,
|
|
@@ -37,58 +44,75 @@ var Collapse = function Collapse(props) {
|
|
|
37
44
|
children = props.children,
|
|
38
45
|
isOpened = props.isOpened,
|
|
39
46
|
dataAttrs = props.dataAttrs;
|
|
47
|
+
var duration = animation ? animationDuration : 0;
|
|
48
|
+
var animationStart = React.useRef(null);
|
|
49
|
+
var animationId = React.useRef(null);
|
|
40
50
|
var canUpdate = React.useRef(false);
|
|
41
|
-
var timer = React.useRef(undefined);
|
|
42
51
|
var rootNode = React.useRef(null);
|
|
52
|
+
(0, React.useEffect)(function () {
|
|
53
|
+
animationId.current && window.cancelAnimationFrame(animationId.current);
|
|
54
|
+
}, [isOpened]);
|
|
55
|
+
var animateSlide = (0, React.useCallback)(function (contentHeight, animationTime, timePassed) {
|
|
56
|
+
var isOpenAction = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
43
57
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
setHeight = _React$useState2[1];
|
|
58
|
+
if (!rootNode.current) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
48
61
|
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
if (!animationStart.current) {
|
|
63
|
+
animationStart.current = timePassed;
|
|
64
|
+
}
|
|
51
65
|
|
|
52
|
-
|
|
66
|
+
var runtime = timePassed - animationStart.current;
|
|
67
|
+
var progress = animationTime ? min(runtime / animationTime, 1) : 1;
|
|
68
|
+
var isAnimationInProgress = progress < 1;
|
|
69
|
+
var nextHeight = isOpenAction ? easeOutSine(progress) * contentHeight : contentHeight - easeInSine(progress) * contentHeight;
|
|
70
|
+
rootNode.current.style.height = "".concat(nextHeight, "px");
|
|
71
|
+
|
|
72
|
+
if (isAnimationInProgress) {
|
|
73
|
+
animationId.current = window.requestAnimationFrame(function (time) {
|
|
74
|
+
return animateSlide(contentHeight, animationTime, time, isOpenAction);
|
|
75
|
+
});
|
|
76
|
+
} else {
|
|
77
|
+
animationStart.current = null;
|
|
78
|
+
animationId.current = null;
|
|
79
|
+
}
|
|
80
|
+
}, []);
|
|
81
|
+
(0, React.useEffect)(function () {
|
|
53
82
|
if (!rootNode.current) {
|
|
54
83
|
return;
|
|
55
84
|
}
|
|
56
85
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
setHeight(finalHeight);
|
|
60
|
-
}, delay);
|
|
61
|
-
};
|
|
86
|
+
var _rootNode$current$scr = rootNode.current.scrollHeight,
|
|
87
|
+
scrollHeight = _rootNode$current$scr === void 0 ? 0 : _rootNode$current$scr;
|
|
62
88
|
|
|
63
|
-
React.useEffect(function () {
|
|
64
89
|
switch (true) {
|
|
65
90
|
case !canUpdate.current && isOpened:
|
|
66
|
-
|
|
91
|
+
rootNode.current.style.height = 'auto';
|
|
67
92
|
break;
|
|
68
93
|
|
|
69
94
|
case !canUpdate.current && !isOpened:
|
|
70
|
-
|
|
95
|
+
rootNode.current.style.height = '0px';
|
|
71
96
|
break;
|
|
72
97
|
|
|
73
98
|
case isOpened:
|
|
74
|
-
|
|
99
|
+
animationId.current = window.requestAnimationFrame(function (timePassed) {
|
|
100
|
+
return animateSlide(scrollHeight, duration, timePassed, true);
|
|
101
|
+
});
|
|
75
102
|
break;
|
|
76
103
|
|
|
77
104
|
default:
|
|
78
|
-
|
|
105
|
+
animationId.current = window.requestAnimationFrame(function (timePassed) {
|
|
106
|
+
return animateSlide(scrollHeight, duration, timePassed);
|
|
107
|
+
});
|
|
79
108
|
}
|
|
80
109
|
|
|
81
110
|
canUpdate.current = true;
|
|
82
|
-
|
|
83
|
-
return clearTimeout(timer.current);
|
|
84
|
-
};
|
|
85
|
-
}, [isOpened, duration]);
|
|
111
|
+
}, [isOpened, duration, animateSlide]);
|
|
86
112
|
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
87
113
|
className: className,
|
|
88
114
|
style: {
|
|
89
|
-
overflow: 'hidden'
|
|
90
|
-
height: height,
|
|
91
|
-
transition: transition
|
|
115
|
+
overflow: 'hidden'
|
|
92
116
|
},
|
|
93
117
|
ref: rootNode
|
|
94
118
|
}), /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.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-
|
|
9
|
-
|
|
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-
|
|
12
|
+
.mfui-content-area_background-color_transparent {
|
|
15
13
|
background-color: transparent;
|
|
16
14
|
}
|
|
17
|
-
.mfui-content-
|
|
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-
|
|
24
|
+
.mfui-content-area_background-color_purple {
|
|
21
25
|
background-color: var(--brandPurple);
|
|
22
26
|
}
|
|
23
|
-
.mfui-content-
|
|
27
|
+
.mfui-content-area_background-color_spbSky0 {
|
|
24
28
|
background-color: var(--spbSky0);
|
|
25
29
|
}
|
|
26
|
-
.mfui-content-
|
|
30
|
+
.mfui-content-area_background-color_spbSky1 {
|
|
27
31
|
background-color: var(--spbSky1);
|
|
28
32
|
}
|
|
29
|
-
.mfui-content-
|
|
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-
|
|
81
|
-
background-color:
|
|
87
|
+
.mfui-content-area__inner_background-color_transparent {
|
|
88
|
+
background-color: transparent;
|
|
82
89
|
}
|
|
83
|
-
.mfui-content-
|
|
84
|
-
background-color: var(--
|
|
90
|
+
.mfui-content-area__inner_background-color_black {
|
|
91
|
+
background-color: var(--stcBlack);
|
|
85
92
|
}
|
|
86
|
-
.mfui-content-
|
|
87
|
-
background-color:
|
|
93
|
+
.mfui-content-area__inner_background-color_white {
|
|
94
|
+
background-color: var(--stcWhite);
|
|
88
95
|
}
|
|
89
|
-
.mfui-content-
|
|
96
|
+
.mfui-content-area__inner_background-color_green {
|
|
90
97
|
background-color: var(--brandGreen);
|
|
91
98
|
}
|
|
92
|
-
.mfui-content-
|
|
99
|
+
.mfui-content-area__inner_background-color_purple {
|
|
93
100
|
background-color: var(--brandPurple);
|
|
94
101
|
}
|
|
95
|
-
.mfui-content-
|
|
102
|
+
.mfui-content-area__inner_background-color_spbSky0 {
|
|
96
103
|
background-color: var(--spbSky0);
|
|
97
104
|
}
|
|
98
|
-
.mfui-content-
|
|
105
|
+
.mfui-content-area__inner_background-color_spbSky1 {
|
|
99
106
|
background-color: var(--spbSky1);
|
|
100
107
|
}
|
|
101
|
-
.mfui-content-
|
|
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: {
|
|
@@ -20,14 +20,16 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
20
20
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
21
|
|
|
22
22
|
var BACKGROUND_COLORS = {
|
|
23
|
-
DEFAULT: 'default',
|
|
24
|
-
WHITE: 'white',
|
|
25
23
|
TRANSPARENT: 'transparent',
|
|
24
|
+
BLACK: 'black',
|
|
25
|
+
WHITE: 'white',
|
|
26
26
|
GREEN: 'green',
|
|
27
27
|
PURPLE: 'purple',
|
|
28
28
|
SPB_SKY_0: 'spbSky0',
|
|
29
29
|
SPB_SKY_1: 'spbSky1',
|
|
30
|
-
SPB_SKY_2: 'spbSky2'
|
|
30
|
+
SPB_SKY_2: 'spbSky2',
|
|
31
|
+
// @deprecated
|
|
32
|
+
DEFAULT: 'default'
|
|
31
33
|
};
|
|
32
34
|
var DisableIndents = {
|
|
33
35
|
MOBILE: 'mobile',
|
|
@@ -38,20 +40,22 @@ var DisableIndents = {
|
|
|
38
40
|
var cn = (0, _uiHelpers.cnCreate)('mfui-content-area');
|
|
39
41
|
|
|
40
42
|
var ContentArea = function ContentArea(_ref) {
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
+
var _ref$outerBackgroundC = _ref.outerBackgroundColor,
|
|
44
|
+
outerBackgroundColor = _ref$outerBackgroundC === void 0 ? 'transparent' : _ref$outerBackgroundC,
|
|
45
|
+
_ref$innerBackgroundC = _ref.innerBackgroundColor,
|
|
46
|
+
innerBackgroundColor = _ref$innerBackgroundC === void 0 ? 'transparent' : _ref$innerBackgroundC,
|
|
43
47
|
disableIndents = _ref.disableIndents,
|
|
44
48
|
children = _ref.children,
|
|
45
49
|
className = _ref.className,
|
|
46
50
|
classes = _ref.classes;
|
|
47
51
|
return /*#__PURE__*/React.createElement("div", {
|
|
48
52
|
className: cn({
|
|
49
|
-
color: outerBackgroundColor
|
|
53
|
+
'background-color': outerBackgroundColor
|
|
50
54
|
}, [className, classes === null || classes === void 0 ? void 0 : classes.root])
|
|
51
55
|
}, /*#__PURE__*/React.createElement("div", {
|
|
52
56
|
className: cn('inner', {
|
|
53
57
|
'disable-indents': disableIndents,
|
|
54
|
-
color: innerBackgroundColor
|
|
58
|
+
'background-color': innerBackgroundColor
|
|
55
59
|
}, classes === null || classes === void 0 ? void 0 : classes.inner)
|
|
56
60
|
}, children));
|
|
57
61
|
};
|
|
@@ -66,9 +70,5 @@ ContentArea.propTypes = {
|
|
|
66
70
|
outerBackgroundColor: PropTypes.oneOf(Object.values(BACKGROUND_COLORS)),
|
|
67
71
|
innerBackgroundColor: PropTypes.oneOf(Object.values(BACKGROUND_COLORS))
|
|
68
72
|
};
|
|
69
|
-
ContentArea.defaultProps = {
|
|
70
|
-
outerBackgroundColor: 'transparent',
|
|
71
|
-
innerBackgroundColor: 'transparent'
|
|
72
|
-
};
|
|
73
73
|
var _default = ContentArea;
|
|
74
74
|
exports["default"] = _default;
|