@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.
- package/CHANGELOG.md +22 -1
- 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 +22 -3
- 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/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 +22 -3
- 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/package.json +2 -2
|
@@ -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
|
/** Заголовок поля */
|
|
@@ -7,7 +7,7 @@ import "core-js/modules/es.string.split";
|
|
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
8
8
|
import _extends from "@babel/runtime/helpers/extends";
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { cnCreate } from '@megafon/ui-helpers';
|
|
10
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
11
11
|
import debounce from 'lodash.debounce';
|
|
12
12
|
import * as PropTypes from 'prop-types';
|
|
13
13
|
import InputLabel from "../InputLabel/InputLabel";
|
|
@@ -28,7 +28,8 @@ export var Verification = {
|
|
|
28
28
|
var cn = cnCreate('mfui-search');
|
|
29
29
|
|
|
30
30
|
var Search = function Search(_ref) {
|
|
31
|
-
var
|
|
31
|
+
var dataAttrs = _ref.dataAttrs,
|
|
32
|
+
_ref$value = _ref.value,
|
|
32
33
|
value = _ref$value === void 0 ? '' : _ref$value,
|
|
33
34
|
label = _ref.label,
|
|
34
35
|
placeholder = _ref.placeholder,
|
|
@@ -160,18 +161,18 @@ var Search = function Search(_ref) {
|
|
|
160
161
|
}));
|
|
161
162
|
};
|
|
162
163
|
|
|
163
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
164
165
|
className: cn({
|
|
165
166
|
open: isFocused,
|
|
166
167
|
disabled: disabled
|
|
167
168
|
}, [className])
|
|
168
|
-
}, label && /*#__PURE__*/React.createElement(InputLabel, null, label, required && /*#__PURE__*/React.createElement("span", {
|
|
169
|
+
}), label && /*#__PURE__*/React.createElement(InputLabel, null, label, required && /*#__PURE__*/React.createElement("span", {
|
|
169
170
|
className: cn('require-mark')
|
|
170
171
|
}, "*")), /*#__PURE__*/React.createElement("div", {
|
|
171
172
|
className: cn('control', {
|
|
172
173
|
error: verification === Verification.ERROR
|
|
173
174
|
}, [classes === null || classes === void 0 ? void 0 : classes.control])
|
|
174
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
175
|
+
}, /*#__PURE__*/React.createElement("input", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.searchField), {
|
|
175
176
|
className: cn('search-field'),
|
|
176
177
|
placeholder: placeholder,
|
|
177
178
|
value: searchQuery,
|
|
@@ -183,10 +184,10 @@ var Search = function Search(_ref) {
|
|
|
183
184
|
disabled: disabled,
|
|
184
185
|
type: "text",
|
|
185
186
|
autoComplete: "off"
|
|
186
|
-
}), !hideIcon && /*#__PURE__*/React.createElement("div", {
|
|
187
|
+
})), !hideIcon && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.submit), {
|
|
187
188
|
className: cn('icon-box'),
|
|
188
189
|
onClick: handleSearchSubmit
|
|
189
|
-
}, /*#__PURE__*/React.createElement(SearchIcon, {
|
|
190
|
+
}), /*#__PURE__*/React.createElement(SearchIcon, {
|
|
190
191
|
className: cn('icon', [classes === null || classes === void 0 ? void 0 : classes.icon])
|
|
191
192
|
})), !!items.length && /*#__PURE__*/React.createElement("div", {
|
|
192
193
|
className: cn('list')
|
|
@@ -195,14 +196,14 @@ var Search = function Search(_ref) {
|
|
|
195
196
|
}, items.map(function (_ref2, i) {
|
|
196
197
|
var itemValue = _ref2.value,
|
|
197
198
|
searchView = _ref2.searchView;
|
|
198
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
199
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, i + 1), {
|
|
199
200
|
className: cn('list-item', {
|
|
200
201
|
active: activeIndex === i
|
|
201
202
|
}),
|
|
202
203
|
onMouseDown: handleSelectSubmit(i),
|
|
203
204
|
onMouseEnter: handleHoverItem(i),
|
|
204
205
|
key: i
|
|
205
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
206
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
206
207
|
className: cn('item-title', [classes === null || classes === void 0 ? void 0 : classes.listItemTitle])
|
|
207
208
|
}, searchView || highlightString(itemValue)));
|
|
208
209
|
})))), noticeText && /*#__PURE__*/React.createElement("div", {
|
|
@@ -214,6 +215,12 @@ var Search = function Search(_ref) {
|
|
|
214
215
|
};
|
|
215
216
|
|
|
216
217
|
Search.propTypes = {
|
|
218
|
+
dataAttrs: PropTypes.shape({
|
|
219
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
220
|
+
searchField: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
221
|
+
submit: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
222
|
+
item: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
223
|
+
}),
|
|
217
224
|
value: PropTypes.string,
|
|
218
225
|
label: PropTypes.string,
|
|
219
226
|
placeholder: PropTypes.string,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import './Switcher.less';
|
|
3
3
|
export interface ISwitcherProps {
|
|
4
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
5
|
+
dataAttrs?: {
|
|
6
|
+
root?: Record<string, string>;
|
|
7
|
+
};
|
|
4
8
|
/** Дополнительный класс корневого элемента */
|
|
5
9
|
className?: string;
|
|
6
10
|
/** Управление состоянием вкл/выкл компонента */
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
import { cnCreate, detectTouch } from '@megafon/ui-helpers';
|
|
3
|
+
import { cnCreate, detectTouch, filterDataAttrs } from '@megafon/ui-helpers';
|
|
4
|
+
import * as PropTypes from 'prop-types';
|
|
3
5
|
import "./Switcher.css";
|
|
4
6
|
var cn = cnCreate('mfui-switcher');
|
|
5
7
|
|
|
6
|
-
var Switcher = function Switcher(
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
checked =
|
|
10
|
-
|
|
11
|
-
disabled =
|
|
12
|
-
|
|
8
|
+
var Switcher = function Switcher(_ref) {
|
|
9
|
+
var dataAttrs = _ref.dataAttrs,
|
|
10
|
+
className = _ref.className,
|
|
11
|
+
_ref$checked = _ref.checked,
|
|
12
|
+
checked = _ref$checked === void 0 ? false : _ref$checked,
|
|
13
|
+
_ref$disabled = _ref.disabled,
|
|
14
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
15
|
+
onChange = _ref.onChange;
|
|
13
16
|
var isTouch = detectTouch();
|
|
14
17
|
|
|
15
18
|
var handleChange = function handleChange(e) {
|
|
@@ -20,16 +23,25 @@ var Switcher = function Switcher(props) {
|
|
|
20
23
|
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
21
24
|
};
|
|
22
25
|
|
|
23
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
24
27
|
className: cn({
|
|
25
28
|
checked: checked,
|
|
26
29
|
disabled: disabled,
|
|
27
30
|
'no-touch': !isTouch
|
|
28
31
|
}, className),
|
|
29
32
|
onClick: handleChange
|
|
30
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
31
34
|
className: cn('pointer')
|
|
32
35
|
}));
|
|
33
36
|
};
|
|
34
37
|
|
|
38
|
+
Switcher.propTypes = {
|
|
39
|
+
dataAttrs: PropTypes.shape({
|
|
40
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
41
|
+
}),
|
|
42
|
+
className: PropTypes.string,
|
|
43
|
+
checked: PropTypes.bool,
|
|
44
|
+
disabled: PropTypes.bool,
|
|
45
|
+
onChange: PropTypes.func
|
|
46
|
+
};
|
|
35
47
|
export default Switcher;
|
|
@@ -6,9 +6,12 @@ import Link from "../Link/Link";
|
|
|
6
6
|
var cn = cnCreate('mfui-text-link');
|
|
7
7
|
|
|
8
8
|
var TextLink = function TextLink(_ref) {
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
var _ref$underlineVisibil = _ref.underlineVisibility,
|
|
10
|
+
underlineVisibility = _ref$underlineVisibil === void 0 ? 'hover' : _ref$underlineVisibil,
|
|
11
|
+
_ref$underlineStyle = _ref.underlineStyle,
|
|
12
|
+
underlineStyle = _ref$underlineStyle === void 0 ? 'solid' : _ref$underlineStyle,
|
|
13
|
+
_ref$color = _ref.color,
|
|
14
|
+
color = _ref$color === void 0 ? 'blue' : _ref$color,
|
|
12
15
|
className = _ref.className,
|
|
13
16
|
target = _ref.target,
|
|
14
17
|
href = _ref.href,
|
|
@@ -41,9 +44,4 @@ TextLink.propTypes = {
|
|
|
41
44
|
}),
|
|
42
45
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.string, PropTypes.node])
|
|
43
46
|
};
|
|
44
|
-
TextLink.defaultProps = {
|
|
45
|
-
underlineVisibility: 'hover',
|
|
46
|
-
underlineStyle: 'solid',
|
|
47
|
-
color: 'blue'
|
|
48
|
-
};
|
|
49
47
|
export default TextLink;
|
|
@@ -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%;
|
|
@@ -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;
|