@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
|
@@ -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
|
|
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
|
-
|
|
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({
|
|
@@ -262,7 +281,10 @@ var Carousel = function Carousel(_ref) {
|
|
|
262
281
|
onFocus: handleSlideFocus(i),
|
|
263
282
|
onMouseDown: disableFocusOnSlideClick
|
|
264
283
|
}), child);
|
|
265
|
-
})), /*#__PURE__*/React.createElement(NavArrow,
|
|
284
|
+
})), /*#__PURE__*/React.createElement(NavArrow, {
|
|
285
|
+
dataAttrs: {
|
|
286
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.prev
|
|
287
|
+
},
|
|
266
288
|
className: cn('arrow', {
|
|
267
289
|
prev: true,
|
|
268
290
|
locked: isLocked
|
|
@@ -270,7 +292,10 @@ var Carousel = function Carousel(_ref) {
|
|
|
270
292
|
onClick: handlePrevClick,
|
|
271
293
|
disabled: !loop && isBeginning,
|
|
272
294
|
theme: ArrowTheme.PURPLE
|
|
273
|
-
})
|
|
295
|
+
}), /*#__PURE__*/React.createElement(NavArrow, {
|
|
296
|
+
dataAttrs: {
|
|
297
|
+
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.next
|
|
298
|
+
},
|
|
274
299
|
className: cn('arrow', {
|
|
275
300
|
next: true,
|
|
276
301
|
locked: isLocked
|
|
@@ -279,7 +304,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
279
304
|
onClick: handleNextClick,
|
|
280
305
|
disabled: !loop && isEnd,
|
|
281
306
|
theme: ArrowTheme.PURPLE
|
|
282
|
-
}))
|
|
307
|
+
}));
|
|
283
308
|
};
|
|
284
309
|
|
|
285
310
|
Carousel.propTypes = {
|
|
@@ -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
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
setHeight = _React$useState2[1];
|
|
44
|
+
if (!animationStart.current) {
|
|
45
|
+
animationStart.current = timePassed;
|
|
46
|
+
}
|
|
27
47
|
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
|
|
37
|
-
|
|
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
|
-
|
|
73
|
+
rootNode.current.style.height = 'auto';
|
|
46
74
|
break;
|
|
47
75
|
|
|
48
76
|
case !canUpdate.current && !isOpened:
|
|
49
|
-
|
|
77
|
+
rootNode.current.style.height = '0px';
|
|
50
78
|
break;
|
|
51
79
|
|
|
52
80
|
case isOpened:
|
|
53
|
-
|
|
81
|
+
animationId.current = window.requestAnimationFrame(function (timePassed) {
|
|
82
|
+
return animateSlide(scrollHeight, duration, timePassed, true);
|
|
83
|
+
});
|
|
54
84
|
break;
|
|
55
85
|
|
|
56
86
|
default:
|
|
57
|
-
|
|
87
|
+
animationId.current = window.requestAnimationFrame(function (timePassed) {
|
|
88
|
+
return animateSlide(scrollHeight, duration, timePassed);
|
|
89
|
+
});
|
|
58
90
|
}
|
|
59
91
|
|
|
60
92
|
canUpdate.current = true;
|
|
61
|
-
|
|
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-
|
|
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: {
|
|
@@ -4,14 +4,16 @@ import { cnCreate } from '@megafon/ui-helpers';
|
|
|
4
4
|
import * as PropTypes from 'prop-types';
|
|
5
5
|
import "./ContentArea.css";
|
|
6
6
|
var BACKGROUND_COLORS = {
|
|
7
|
-
DEFAULT: 'default',
|
|
8
|
-
WHITE: 'white',
|
|
9
7
|
TRANSPARENT: 'transparent',
|
|
8
|
+
BLACK: 'black',
|
|
9
|
+
WHITE: 'white',
|
|
10
10
|
GREEN: 'green',
|
|
11
11
|
PURPLE: 'purple',
|
|
12
12
|
SPB_SKY_0: 'spbSky0',
|
|
13
13
|
SPB_SKY_1: 'spbSky1',
|
|
14
|
-
SPB_SKY_2: 'spbSky2'
|
|
14
|
+
SPB_SKY_2: 'spbSky2',
|
|
15
|
+
// @deprecated
|
|
16
|
+
DEFAULT: 'default'
|
|
15
17
|
};
|
|
16
18
|
var DisableIndents = {
|
|
17
19
|
MOBILE: 'mobile',
|
|
@@ -22,20 +24,22 @@ var DisableIndents = {
|
|
|
22
24
|
var cn = cnCreate('mfui-content-area');
|
|
23
25
|
|
|
24
26
|
var ContentArea = function ContentArea(_ref) {
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
+
var _ref$outerBackgroundC = _ref.outerBackgroundColor,
|
|
28
|
+
outerBackgroundColor = _ref$outerBackgroundC === void 0 ? 'transparent' : _ref$outerBackgroundC,
|
|
29
|
+
_ref$innerBackgroundC = _ref.innerBackgroundColor,
|
|
30
|
+
innerBackgroundColor = _ref$innerBackgroundC === void 0 ? 'transparent' : _ref$innerBackgroundC,
|
|
27
31
|
disableIndents = _ref.disableIndents,
|
|
28
32
|
children = _ref.children,
|
|
29
33
|
className = _ref.className,
|
|
30
34
|
classes = _ref.classes;
|
|
31
35
|
return /*#__PURE__*/React.createElement("div", {
|
|
32
36
|
className: cn({
|
|
33
|
-
color: outerBackgroundColor
|
|
37
|
+
'background-color': outerBackgroundColor
|
|
34
38
|
}, [className, classes === null || classes === void 0 ? void 0 : classes.root])
|
|
35
39
|
}, /*#__PURE__*/React.createElement("div", {
|
|
36
40
|
className: cn('inner', {
|
|
37
41
|
'disable-indents': disableIndents,
|
|
38
|
-
color: innerBackgroundColor
|
|
42
|
+
'background-color': innerBackgroundColor
|
|
39
43
|
}, classes === null || classes === void 0 ? void 0 : classes.inner)
|
|
40
44
|
}, children));
|
|
41
45
|
};
|
|
@@ -50,8 +54,4 @@ ContentArea.propTypes = {
|
|
|
50
54
|
outerBackgroundColor: PropTypes.oneOf(Object.values(BACKGROUND_COLORS)),
|
|
51
55
|
innerBackgroundColor: PropTypes.oneOf(Object.values(BACKGROUND_COLORS))
|
|
52
56
|
};
|
|
53
|
-
ContentArea.defaultProps = {
|
|
54
|
-
outerBackgroundColor: 'transparent',
|
|
55
|
-
innerBackgroundColor: 'transparent'
|
|
56
|
-
};
|
|
57
57
|
export default ContentArea;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import './Counter.less';
|
|
3
3
|
export interface ICounterProps {
|
|
4
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
5
|
+
dataAttrs?: {
|
|
6
|
+
root?: Record<string, string>;
|
|
7
|
+
minus?: Record<string, string>;
|
|
8
|
+
plus?: Record<string, string>;
|
|
9
|
+
input?: Record<string, string>;
|
|
10
|
+
};
|
|
4
11
|
/** Переводит компонент в контролируемое состояние */
|
|
5
12
|
isControlled?: boolean;
|
|
6
13
|
/** Внешнее значение для контролируемого компонента */
|
|
@@ -2,7 +2,7 @@ import "core-js/modules/es.number.constructor";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { cnCreate } from '@megafon/ui-helpers';
|
|
5
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
6
6
|
import * as PropTypes from 'prop-types';
|
|
7
7
|
import "./Counter.css";
|
|
8
8
|
|
|
@@ -25,7 +25,8 @@ var IconPlus = function IconPlus(props) {
|
|
|
25
25
|
var cn = cnCreate('mfui-counter');
|
|
26
26
|
|
|
27
27
|
var Counter = function Counter(_ref) {
|
|
28
|
-
var
|
|
28
|
+
var dataAttrs = _ref.dataAttrs,
|
|
29
|
+
_ref$isControlled = _ref.isControlled,
|
|
29
30
|
isControlled = _ref$isControlled === void 0 ? false : _ref$isControlled,
|
|
30
31
|
_ref$value = _ref.value,
|
|
31
32
|
value = _ref$value === void 0 ? 0 : _ref$value,
|
|
@@ -96,40 +97,46 @@ var Counter = function Counter(_ref) {
|
|
|
96
97
|
handleValueChange(max);
|
|
97
98
|
}
|
|
98
99
|
}, [handleValueChange, min, max]);
|
|
99
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
100
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
100
101
|
className: cn({
|
|
101
102
|
disabled: disabled
|
|
102
103
|
}, [className, classes.root])
|
|
103
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
104
|
+
}), /*#__PURE__*/React.createElement("button", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.minus), {
|
|
104
105
|
className: cn('btn', {
|
|
105
106
|
left: true
|
|
106
107
|
}, classes.buttonMinus),
|
|
107
108
|
type: "button",
|
|
108
109
|
disabled: disabled || (isControlled ? value : counter) <= min,
|
|
109
110
|
onClick: handleMinusClick
|
|
110
|
-
}, /*#__PURE__*/React.createElement(IconMinus, {
|
|
111
|
+
}), /*#__PURE__*/React.createElement(IconMinus, {
|
|
111
112
|
className: cn('icon')
|
|
112
113
|
})), /*#__PURE__*/React.createElement("div", {
|
|
113
114
|
className: cn('input-box')
|
|
114
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
115
|
+
}, /*#__PURE__*/React.createElement("input", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input), {
|
|
115
116
|
className: cn('input', classes.input),
|
|
116
117
|
value: isControlled ? value : counter,
|
|
117
118
|
onChange: handleInputChange,
|
|
118
119
|
onBlur: handleInputBlur,
|
|
119
120
|
disabled: disabled
|
|
120
|
-
})), /*#__PURE__*/React.createElement("button", {
|
|
121
|
+
}))), /*#__PURE__*/React.createElement("button", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.plus), {
|
|
121
122
|
className: cn('btn', {
|
|
122
123
|
right: true
|
|
123
124
|
}, classes.buttonPlus),
|
|
124
125
|
type: "button",
|
|
125
126
|
disabled: disabled || counter >= max || value >= max,
|
|
126
127
|
onClick: handlePlusClick
|
|
127
|
-
}, /*#__PURE__*/React.createElement(IconPlus, {
|
|
128
|
+
}), /*#__PURE__*/React.createElement(IconPlus, {
|
|
128
129
|
className: cn('icon')
|
|
129
130
|
})));
|
|
130
131
|
};
|
|
131
132
|
|
|
132
133
|
Counter.propTypes = {
|
|
134
|
+
dataAttrs: PropTypes.shape({
|
|
135
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
136
|
+
minus: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
137
|
+
plus: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
138
|
+
input: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
139
|
+
}),
|
|
133
140
|
isControlled: PropTypes.bool,
|
|
134
141
|
value: PropTypes.number,
|
|
135
142
|
initialValue: PropTypes.number,
|
|
@@ -37,10 +37,14 @@ var cn = cnCreate('mfui-logo');
|
|
|
37
37
|
|
|
38
38
|
var Logo = function Logo(_ref) {
|
|
39
39
|
var className = _ref.className,
|
|
40
|
-
color = _ref.color,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
_ref$color = _ref.color,
|
|
41
|
+
color = _ref$color === void 0 ? 'green' : _ref$color,
|
|
42
|
+
_ref$view = _ref.view,
|
|
43
|
+
view = _ref$view === void 0 ? 'horizontal' : _ref$view,
|
|
44
|
+
_ref$target = _ref.target,
|
|
45
|
+
target = _ref$target === void 0 ? '_blank' : _ref$target,
|
|
46
|
+
_ref$href = _ref.href,
|
|
47
|
+
href = _ref$href === void 0 ? '/' : _ref$href;
|
|
44
48
|
var images = {
|
|
45
49
|
'green-horizontal': greenHorizontalImg,
|
|
46
50
|
'green-vertical': greenVerticalImg
|
|
@@ -66,10 +70,4 @@ Logo.propTypes = {
|
|
|
66
70
|
href: PropTypes.string,
|
|
67
71
|
className: PropTypes.string
|
|
68
72
|
};
|
|
69
|
-
Logo.defaultProps = {
|
|
70
|
-
color: 'green',
|
|
71
|
-
view: 'horizontal',
|
|
72
|
-
target: '_blank',
|
|
73
|
-
href: '/'
|
|
74
|
-
};
|
|
75
73
|
export default Logo;
|
|
@@ -11,6 +11,9 @@ export declare const View: {
|
|
|
11
11
|
declare type ThemeType = typeof Theme[keyof typeof Theme];
|
|
12
12
|
declare type ViewType = typeof View[keyof typeof View];
|
|
13
13
|
export interface INavArrowProps {
|
|
14
|
+
dataAttrs?: {
|
|
15
|
+
root?: Record<string, string>;
|
|
16
|
+
};
|
|
14
17
|
className?: string;
|
|
15
18
|
theme?: ThemeType;
|
|
16
19
|
view?: ViewType;
|
|
@@ -2,7 +2,7 @@ import "core-js/modules/es.object.values";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import "./NavArrow.css";
|
|
5
|
-
import { cnCreate } from '@megafon/ui-helpers';
|
|
5
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
6
6
|
import * as PropTypes from 'prop-types';
|
|
7
7
|
|
|
8
8
|
var ArrowLeft = function ArrowLeft(props) {
|
|
@@ -32,7 +32,8 @@ export var View = {
|
|
|
32
32
|
var cn = cnCreate('mfui-nav-arrow');
|
|
33
33
|
|
|
34
34
|
var NavArrow = function NavArrow(_ref) {
|
|
35
|
-
var
|
|
35
|
+
var dataAttrs = _ref.dataAttrs,
|
|
36
|
+
className = _ref.className,
|
|
36
37
|
_ref$view = _ref.view,
|
|
37
38
|
view = _ref$view === void 0 ? View.PREV : _ref$view,
|
|
38
39
|
_ref$theme = _ref.theme,
|
|
@@ -53,17 +54,20 @@ var NavArrow = function NavArrow(_ref) {
|
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
}, [view]);
|
|
56
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
57
|
+
return /*#__PURE__*/React.createElement("button", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
57
58
|
type: "button",
|
|
58
59
|
className: cn({
|
|
59
60
|
theme: theme
|
|
60
61
|
}, className),
|
|
61
62
|
onClick: onClick,
|
|
62
63
|
disabled: disabled
|
|
63
|
-
}, renderIcon());
|
|
64
|
+
}), renderIcon());
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
NavArrow.propTypes = {
|
|
68
|
+
dataAttrs: PropTypes.shape({
|
|
69
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
70
|
+
}),
|
|
67
71
|
className: PropTypes.string,
|
|
68
72
|
theme: PropTypes.oneOf(Object.values(Theme)),
|
|
69
73
|
view: PropTypes.oneOf(Object.values(View)),
|
|
@@ -18,7 +18,7 @@ var Paragraph = function Paragraph(_ref) {
|
|
|
18
18
|
size = _ref$size === void 0 ? 'regular' : _ref$size,
|
|
19
19
|
align = _ref.align,
|
|
20
20
|
_ref$color = _ref.color,
|
|
21
|
-
color = _ref$color === void 0 ?
|
|
21
|
+
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
22
22
|
className = _ref.className,
|
|
23
23
|
_ref$hasMargin = _ref.hasMargin,
|
|
24
24
|
hasMargin = _ref$hasMargin === void 0 ? true : _ref$hasMargin,
|
|
@@ -13,6 +13,13 @@ export declare type SearchItem = {
|
|
|
13
13
|
searchView?: ElementOrString;
|
|
14
14
|
};
|
|
15
15
|
export interface ISearchProps {
|
|
16
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
17
|
+
dataAttrs?: {
|
|
18
|
+
root?: Record<string, string>;
|
|
19
|
+
searchField?: Record<string, string>;
|
|
20
|
+
submit?: Record<string, string>;
|
|
21
|
+
item?: Record<string, string>;
|
|
22
|
+
};
|
|
16
23
|
/** Значение */
|
|
17
24
|
value?: string;
|
|
18
25
|
/** Заголовок поля */
|