@megafon/ui-core 3.0.0-beta.9 → 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 +68 -84
- package/README.md +2 -2
- package/dist/es/colors/Colors.d.ts +2 -2
- package/dist/es/colors/colorsData.js +1 -1
- package/dist/es/components/Accordion/Accordion.js +1 -1
- package/dist/es/components/Banner/Banner.css +44 -0
- package/dist/es/components/Banner/Banner.d.ts +2 -0
- package/dist/es/components/Banner/Banner.js +25 -13
- package/dist/es/components/Button/Button.css +11 -11
- package/dist/es/components/Button/Button.js +3 -3
- package/dist/es/components/Calendar/Calendar.d.ts +8 -0
- package/dist/es/components/Calendar/Calendar.js +23 -6
- package/dist/es/components/Calendar/components/Day/Day.d.ts +3 -0
- package/dist/es/components/Calendar/components/Day/Day.js +10 -6
- 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 +35 -13
- package/dist/es/components/Checkbox/Checkbox.js +1 -1
- 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 +18 -11
- package/dist/es/components/Link/Link.d.ts +1 -1
- package/dist/es/components/Link/Link.js +19 -27
- package/dist/es/components/Logo/Logo.js +9 -11
- package/dist/es/components/NavArrow/NavArrow.css +1 -1
- package/dist/es/components/NavArrow/NavArrow.d.ts +3 -0
- package/dist/es/components/NavArrow/NavArrow.js +8 -4
- package/dist/es/components/Notification/Notification.css +34 -25
- package/dist/es/components/Notification/Notification.js +4 -2
- package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.js +1 -1
- package/dist/es/components/Pagination/helpers.d.ts +1 -1
- package/dist/es/components/Paragraph/Paragraph.css +0 -9
- package/dist/es/components/Paragraph/Paragraph.d.ts +0 -3
- package/dist/es/components/Paragraph/Paragraph.js +2 -5
- package/dist/es/components/RadioButton/RadioButton.js +1 -1
- package/dist/es/components/Search/Search.d.ts +7 -0
- package/dist/es/components/Search/Search.js +20 -12
- package/dist/es/components/Select/Select.js +6 -14
- package/dist/es/components/Switcher/Switcher.css +19 -15
- package/dist/es/components/Switcher/Switcher.d.ts +4 -0
- package/dist/es/components/Switcher/Switcher.js +23 -11
- package/dist/es/components/Tabs/Tabs.css +1 -1
- package/dist/es/components/Tabs/Tabs.d.ts +2 -0
- package/dist/es/components/Tabs/Tabs.js +94 -49
- package/dist/es/components/TextField/TextField.d.ts +3 -1
- package/dist/es/components/TextField/TextField.js +14 -10
- package/dist/es/components/TextLink/TextLink.js +6 -8
- package/dist/es/components/Tile/Tile.js +4 -2
- package/dist/es/components/Tooltip/Tooltip.js +17 -17
- package/dist/lib/colors/Colors.d.ts +2 -2
- package/dist/lib/colors/colorsData.js +1 -1
- package/dist/lib/components/Accordion/Accordion.js +1 -1
- package/dist/lib/components/Banner/Banner.css +44 -0
- package/dist/lib/components/Banner/Banner.d.ts +2 -0
- package/dist/lib/components/Banner/Banner.js +25 -13
- package/dist/lib/components/Button/Button.css +11 -11
- package/dist/lib/components/Button/Button.js +3 -3
- package/dist/lib/components/Calendar/Calendar.d.ts +8 -0
- package/dist/lib/components/Calendar/Calendar.js +22 -6
- package/dist/lib/components/Calendar/components/Day/Day.d.ts +3 -0
- package/dist/lib/components/Calendar/components/Day/Day.js +9 -5
- 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 +33 -11
- package/dist/lib/components/Checkbox/Checkbox.js +1 -1
- 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 +17 -10
- package/dist/lib/components/Link/Link.d.ts +1 -1
- package/dist/lib/components/Link/Link.js +28 -43
- package/dist/lib/components/Logo/Logo.js +9 -11
- package/dist/lib/components/NavArrow/NavArrow.css +1 -1
- package/dist/lib/components/NavArrow/NavArrow.d.ts +3 -0
- package/dist/lib/components/NavArrow/NavArrow.js +7 -3
- package/dist/lib/components/Notification/Notification.css +34 -25
- package/dist/lib/components/Notification/Notification.js +4 -2
- package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.js +1 -1
- package/dist/lib/components/Pagination/helpers.d.ts +1 -1
- package/dist/lib/components/Paragraph/Paragraph.css +0 -9
- package/dist/lib/components/Paragraph/Paragraph.d.ts +0 -3
- package/dist/lib/components/Paragraph/Paragraph.js +2 -5
- package/dist/lib/components/RadioButton/RadioButton.js +1 -1
- package/dist/lib/components/Search/Search.d.ts +7 -0
- package/dist/lib/components/Search/Search.js +19 -11
- package/dist/lib/components/Select/Select.js +6 -14
- package/dist/lib/components/Switcher/Switcher.css +19 -15
- package/dist/lib/components/Switcher/Switcher.d.ts +4 -0
- package/dist/lib/components/Switcher/Switcher.js +26 -10
- package/dist/lib/components/Tabs/Tabs.css +1 -1
- package/dist/lib/components/Tabs/Tabs.d.ts +2 -0
- package/dist/lib/components/Tabs/Tabs.js +94 -49
- package/dist/lib/components/TextField/TextField.d.ts +3 -1
- package/dist/lib/components/TextField/TextField.js +14 -10
- package/dist/lib/components/TextLink/TextLink.js +6 -8
- package/dist/lib/components/Tile/Tile.js +4 -2
- package/dist/lib/components/Tooltip/Tooltip.js +17 -17
- package/package.json +4 -4
- package/styles/colors.css +2 -2
- package/styles/colorsDark.css +1 -1
|
@@ -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,
|
|
@@ -56,15 +57,15 @@ var Counter = function Counter(_ref) {
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
if (inputValue < min) {
|
|
59
|
-
onChange
|
|
60
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(min);
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
if (inputValue > max) {
|
|
63
|
-
onChange
|
|
64
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(max);
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
if (inputValue >= min && inputValue <= max) {
|
|
67
|
-
onChange
|
|
68
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
|
|
68
69
|
}
|
|
69
70
|
}, [min, max, onChange, isControlled]);
|
|
70
71
|
var handleMinusClick = React.useCallback(function () {
|
|
@@ -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,
|
|
@@ -1,33 +1,25 @@
|
|
|
1
|
-
import "core-js/modules/es.symbol";
|
|
2
|
-
import "core-js/modules/es.array.index-of";
|
|
3
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
-
|
|
5
|
-
var __rest = this && this.__rest || function (s, e) {
|
|
6
|
-
var t = {};
|
|
7
|
-
|
|
8
|
-
for (var p in s) {
|
|
9
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
13
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
14
|
-
}
|
|
15
|
-
return t;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
import * as React from 'react';
|
|
2
|
+
import React from 'react';
|
|
19
3
|
import { filterDataAttrs } from '@megafon/ui-helpers';
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
var Link = function Link(_a) {
|
|
23
|
-
var dataAttrs = _a.dataAttrs,
|
|
24
|
-
props = __rest(_a, ["dataAttrs"]);
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
25
5
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
6
|
+
var Link = function Link(_ref) {
|
|
7
|
+
var target = _ref.target,
|
|
8
|
+
href = _ref.href,
|
|
9
|
+
rel = _ref.rel,
|
|
10
|
+
onClick = _ref.onClick,
|
|
11
|
+
className = _ref.className,
|
|
12
|
+
download = _ref.download,
|
|
13
|
+
children = _ref.children,
|
|
14
|
+
dataAttrs = _ref.dataAttrs;
|
|
15
|
+
return /*#__PURE__*/React.createElement("a", _extends({
|
|
16
|
+
className: className,
|
|
17
|
+
href: href,
|
|
18
|
+
target: target,
|
|
19
|
+
rel: rel,
|
|
20
|
+
download: download,
|
|
21
|
+
onClick: onClick
|
|
22
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), children);
|
|
31
23
|
};
|
|
32
24
|
|
|
33
25
|
Link.propTypes = {
|
|
@@ -25,7 +25,7 @@ var greenVerticalImg = function greenVerticalImg(props) {
|
|
|
25
25
|
fill: "none",
|
|
26
26
|
d: "M-213 356.4h169v128.5h-169z"
|
|
27
27
|
}), /*#__PURE__*/React.createElement("g", {
|
|
28
|
-
fill: "#
|
|
28
|
+
fill: "#00B956"
|
|
29
29
|
}, /*#__PURE__*/React.createElement("path", {
|
|
30
30
|
d: "M-124.9 372.3v32.4c0 1.4-1.2 2.5-2.6 2.5h-3.9c-.2 0-.3.2-.3.3v27.2c1 .1 1.9.1 2.9.1 17.4 0 31.5-14.1 31.5-31.5 0-15.8-12-29.1-27.6-31zm-.6 48.4c-2.2 0-3.9-1.8-3.9-3.9 0-2.2 1.8-3.9 3.9-3.9 2.2 0 3.9 1.8 3.9 3.9 0 2.2-1.8 3.9-3.9 3.9zm9.2 0c-2.2 0-3.9-1.8-3.9-3.9 0-2.2 1.8-3.9 3.9-3.9 2.2 0 3.9 1.8 3.9 3.9 0 2.2-1.7 3.9-3.9 3.9zm9.2 0c-2.2 0-3.9-1.8-3.9-3.9 0-2.2 1.8-3.9 3.9-3.9s3.9 1.8 3.9 3.9c0 2.2-1.7 3.9-3.9 3.9z"
|
|
31
31
|
}), /*#__PURE__*/React.createElement("path", {
|
|
@@ -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;
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
background-color: var(--brandPurple);
|
|
29
29
|
}
|
|
30
30
|
.mfui-nav-arrow_theme_purple:hover:not(:disabled) {
|
|
31
|
-
background-color: var(--
|
|
31
|
+
background-color: var(--buttonHoverPurple);
|
|
32
32
|
}
|
|
33
33
|
.mfui-nav-arrow_theme_dark {
|
|
34
34
|
background-color: var(--stcBlack20);
|
|
@@ -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)),
|
|
@@ -126,31 +126,38 @@ h5 {
|
|
|
126
126
|
}
|
|
127
127
|
.mfui-notification__close {
|
|
128
128
|
position: absolute;
|
|
129
|
-
top:
|
|
130
|
-
right:
|
|
129
|
+
top: 8px;
|
|
130
|
+
right: 8px;
|
|
131
131
|
display: -webkit-box;
|
|
132
132
|
display: -ms-flexbox;
|
|
133
133
|
display: flex;
|
|
134
|
+
-webkit-box-align: center;
|
|
135
|
+
-ms-flex-align: center;
|
|
136
|
+
align-items: center;
|
|
137
|
+
-webkit-box-pack: center;
|
|
138
|
+
-ms-flex-pack: center;
|
|
139
|
+
justify-content: center;
|
|
140
|
+
width: 24px;
|
|
141
|
+
height: 24px;
|
|
134
142
|
padding: 0;
|
|
135
143
|
border: none;
|
|
136
144
|
border-radius: 50%;
|
|
137
|
-
background: transparent;
|
|
138
|
-
cursor: pointer;
|
|
139
|
-
}
|
|
140
|
-
.mfui-notification__close:hover {
|
|
141
145
|
background-color: var(--stcBlack5);
|
|
142
|
-
|
|
143
|
-
.mfui-notification__close-icon {
|
|
144
|
-
width: 20px;
|
|
145
|
-
height: 20px;
|
|
146
|
-
fill: var(--content);
|
|
146
|
+
cursor: pointer;
|
|
147
147
|
}
|
|
148
148
|
@media screen and (min-width: 768px) {
|
|
149
|
-
.mfui-notification__close
|
|
149
|
+
.mfui-notification__close {
|
|
150
|
+
top: 12px;
|
|
151
|
+
right: 12px;
|
|
150
152
|
width: 32px;
|
|
151
153
|
height: 32px;
|
|
152
154
|
}
|
|
153
155
|
}
|
|
156
|
+
.mfui-notification__close-icon {
|
|
157
|
+
width: 10px;
|
|
158
|
+
height: 10px;
|
|
159
|
+
fill: var(--stcBlack50);
|
|
160
|
+
}
|
|
154
161
|
.mfui-notification_type_error .mfui-notification__icon-container {
|
|
155
162
|
background-color: var(--fury20);
|
|
156
163
|
}
|
|
@@ -182,36 +189,38 @@ h5 {
|
|
|
182
189
|
.mfui-notification_colored .mfui-notification__icon-container {
|
|
183
190
|
background-color: var(--stcWhite);
|
|
184
191
|
}
|
|
185
|
-
.mfui-notification_colored
|
|
186
|
-
background-color: var(--
|
|
192
|
+
.mfui-notification_colored.mfui-notification_type_success {
|
|
193
|
+
background-color: var(--brandGreen20);
|
|
187
194
|
}
|
|
188
195
|
.mfui-notification_colored.mfui-notification_type_success .mfui-notification__title,
|
|
189
|
-
.mfui-notification_colored.mfui-notification_type_error .mfui-notification__title,
|
|
190
196
|
.mfui-notification_colored.mfui-notification_type_success .mfui-notification__text,
|
|
197
|
+
.mfui-notification_colored.mfui-notification_type_success .mfui-notification__link {
|
|
198
|
+
color: var(--stcBlack);
|
|
199
|
+
}
|
|
200
|
+
.mfui-notification_colored.mfui-notification_type_success .mfui-notification__right-arrow {
|
|
201
|
+
fill: var(--stcBlack);
|
|
202
|
+
}
|
|
203
|
+
.mfui-notification_colored.mfui-notification_type_success .mfui-notification__icon-container {
|
|
204
|
+
background-color: var(--stcWhite);
|
|
205
|
+
}
|
|
206
|
+
.mfui-notification_colored.mfui-notification_type_error {
|
|
207
|
+
background-color: var(--fury80);
|
|
208
|
+
}
|
|
209
|
+
.mfui-notification_colored.mfui-notification_type_error .mfui-notification__title,
|
|
191
210
|
.mfui-notification_colored.mfui-notification_type_error .mfui-notification__text,
|
|
192
|
-
.mfui-notification_colored.mfui-notification_type_success .mfui-notification__link,
|
|
193
211
|
.mfui-notification_colored.mfui-notification_type_error .mfui-notification__link {
|
|
194
212
|
color: var(--stcWhite);
|
|
195
213
|
}
|
|
196
|
-
.mfui-notification_colored.mfui-notification_type_success .mfui-notification__right-arrow,
|
|
197
214
|
.mfui-notification_colored.mfui-notification_type_error .mfui-notification__right-arrow {
|
|
198
215
|
fill: var(--stcWhite);
|
|
199
216
|
}
|
|
200
|
-
.mfui-notification_colored.mfui-notification_type_success .mfui-notification__icon-container,
|
|
201
217
|
.mfui-notification_colored.mfui-notification_type_error .mfui-notification__icon-container {
|
|
202
218
|
background-color: var(--stcWhite20);
|
|
203
219
|
}
|
|
204
|
-
.mfui-notification_colored.mfui-notification_type_success .mfui-notification__icon-container svg,
|
|
205
220
|
.mfui-notification_colored.mfui-notification_type_error .mfui-notification__icon-container svg {
|
|
206
221
|
/* stylelint-disable-line max-nesting-depth */
|
|
207
222
|
fill: var(--stcWhite);
|
|
208
223
|
}
|
|
209
|
-
.mfui-notification_colored.mfui-notification_type_success {
|
|
210
|
-
background-color: var(--brandGreen);
|
|
211
|
-
}
|
|
212
|
-
.mfui-notification_colored.mfui-notification_type_error {
|
|
213
|
-
background-color: var(--fury80);
|
|
214
|
-
}
|
|
215
224
|
.mfui-notification_colored.mfui-notification_type_info .mfui-notification__title,
|
|
216
225
|
.mfui-notification_colored.mfui-notification_type_warning .mfui-notification__title,
|
|
217
226
|
.mfui-notification_colored.mfui-notification_type_info .mfui-notification__text,
|
|
@@ -53,9 +53,11 @@ var InfoIcon = function InfoIcon(props) {
|
|
|
53
53
|
|
|
54
54
|
var CancelIcon = function CancelIcon(props) {
|
|
55
55
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
56
|
-
viewBox: "0 0
|
|
56
|
+
viewBox: "0 0 10 10"
|
|
57
57
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
58
|
-
|
|
58
|
+
fillRule: "evenodd",
|
|
59
|
+
clipRule: "evenodd",
|
|
60
|
+
d: "M5 3.75L1.25 0 0 1.25 3.75 5 0 8.75 1.25 10 5 6.25 8.75 10 10 8.75 6.25 5 10 1.25 8.75 0 5 3.75z"
|
|
59
61
|
}));
|
|
60
62
|
};
|
|
61
63
|
|
|
@@ -19,7 +19,7 @@ var PaginationButton = function PaginationButton(_ref) {
|
|
|
19
19
|
dataAttrs = _ref.dataAttrs;
|
|
20
20
|
|
|
21
21
|
var handleClick = function handleClick() {
|
|
22
|
-
onClick
|
|
22
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(value);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
return /*#__PURE__*/React.createElement("button", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const getRange: (from:
|
|
1
|
+
declare const getRange: (from: number, to: number, step?: number) => number[];
|
|
2
2
|
export default getRange;
|
|
@@ -38,12 +38,3 @@
|
|
|
38
38
|
.mfui-paragraph_color_purple {
|
|
39
39
|
color: var(--brandPurple);
|
|
40
40
|
}
|
|
41
|
-
.mfui-paragraph_color_spbSky0 {
|
|
42
|
-
color: var(--spbSky0);
|
|
43
|
-
}
|
|
44
|
-
.mfui-paragraph_color_spbSky1 {
|
|
45
|
-
color: var(--spbSky1);
|
|
46
|
-
}
|
|
47
|
-
.mfui-paragraph_color_spbSky2 {
|
|
48
|
-
color: var(--spbSky2);
|
|
49
|
-
}
|
|
@@ -6,9 +6,6 @@ declare const COLORS: {
|
|
|
6
6
|
readonly WHITE: "white";
|
|
7
7
|
readonly GREEN: "green";
|
|
8
8
|
readonly PURPLE: "purple";
|
|
9
|
-
readonly SPB_SKY_0: "spbSky0";
|
|
10
|
-
readonly SPB_SKY_1: "spbSky1";
|
|
11
|
-
readonly SPB_SKY_2: "spbSky2";
|
|
12
9
|
};
|
|
13
10
|
declare type ColorType = typeof COLORS[keyof typeof COLORS];
|
|
14
11
|
export interface IParagraphProps {
|
|
@@ -9,10 +9,7 @@ var COLORS = {
|
|
|
9
9
|
DEFAULT: 'default',
|
|
10
10
|
WHITE: 'white',
|
|
11
11
|
GREEN: 'green',
|
|
12
|
-
PURPLE: 'purple'
|
|
13
|
-
SPB_SKY_0: 'spbSky0',
|
|
14
|
-
SPB_SKY_1: 'spbSky1',
|
|
15
|
-
SPB_SKY_2: 'spbSky2'
|
|
12
|
+
PURPLE: 'purple'
|
|
16
13
|
};
|
|
17
14
|
var cn = cnCreate('mfui-paragraph');
|
|
18
15
|
|
|
@@ -21,7 +18,7 @@ var Paragraph = function Paragraph(_ref) {
|
|
|
21
18
|
size = _ref$size === void 0 ? 'regular' : _ref$size,
|
|
22
19
|
align = _ref.align,
|
|
23
20
|
_ref$color = _ref.color,
|
|
24
|
-
color = _ref$color === void 0 ?
|
|
21
|
+
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
25
22
|
className = _ref.className,
|
|
26
23
|
_ref$hasMargin = _ref.hasMargin,
|
|
27
24
|
hasMargin = _ref$hasMargin === void 0 ? true : _ref$hasMargin,
|
|
@@ -30,7 +30,7 @@ var RadioButton = function RadioButton(_ref) {
|
|
|
30
30
|
var rootClassNames = Array.isArray(className) ? [].concat(_toConsumableArray(className), [classes.root]) : [className, classes.root];
|
|
31
31
|
|
|
32
32
|
var handleChange = function handleChange() {
|
|
33
|
-
return onChange
|
|
33
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
@@ -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,
|
|
@@ -72,7 +73,7 @@ var Search = function Search(_ref) {
|
|
|
72
73
|
setActiveIndex(-1);
|
|
73
74
|
|
|
74
75
|
if (changeDelay === 0) {
|
|
75
|
-
onChange
|
|
76
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
|
|
76
77
|
} else {
|
|
77
78
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
78
79
|
// @ts-ignore
|
|
@@ -93,7 +94,7 @@ var Search = function Search(_ref) {
|
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
var chosenValue = items[index].value;
|
|
96
|
-
onSubmit
|
|
97
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(chosenValue);
|
|
97
98
|
}, [disabled, items, onSubmit]);
|
|
98
99
|
var handleSelectSubmit = React.useCallback(function () {
|
|
99
100
|
return function () {
|
|
@@ -105,7 +106,7 @@ var Search = function Search(_ref) {
|
|
|
105
106
|
}, []);
|
|
106
107
|
var handleBlur = React.useCallback(function (e) {
|
|
107
108
|
setFocus(false);
|
|
108
|
-
onBlur
|
|
109
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
109
110
|
}, [onBlur]);
|
|
110
111
|
var handleClick = React.useCallback(function () {
|
|
111
112
|
if (activeIndex >= 0) {
|
|
@@ -125,6 +126,7 @@ var Search = function Search(_ref) {
|
|
|
125
126
|
e.preventDefault();
|
|
126
127
|
} else if (e.key === 'Enter' && activeIndex > -1) {
|
|
127
128
|
handleItemSubmit(activeIndex);
|
|
129
|
+
e.preventDefault();
|
|
128
130
|
} else if (e.key === 'Enter' && activeIndex === -1) {
|
|
129
131
|
handleSearchSubmit();
|
|
130
132
|
}
|
|
@@ -159,18 +161,18 @@ var Search = function Search(_ref) {
|
|
|
159
161
|
}));
|
|
160
162
|
};
|
|
161
163
|
|
|
162
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
163
165
|
className: cn({
|
|
164
166
|
open: isFocused,
|
|
165
167
|
disabled: disabled
|
|
166
168
|
}, [className])
|
|
167
|
-
}, 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", {
|
|
168
170
|
className: cn('require-mark')
|
|
169
171
|
}, "*")), /*#__PURE__*/React.createElement("div", {
|
|
170
172
|
className: cn('control', {
|
|
171
173
|
error: verification === Verification.ERROR
|
|
172
174
|
}, [classes === null || classes === void 0 ? void 0 : classes.control])
|
|
173
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
175
|
+
}, /*#__PURE__*/React.createElement("input", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.searchField), {
|
|
174
176
|
className: cn('search-field'),
|
|
175
177
|
placeholder: placeholder,
|
|
176
178
|
value: searchQuery,
|
|
@@ -182,10 +184,10 @@ var Search = function Search(_ref) {
|
|
|
182
184
|
disabled: disabled,
|
|
183
185
|
type: "text",
|
|
184
186
|
autoComplete: "off"
|
|
185
|
-
}), !hideIcon && /*#__PURE__*/React.createElement("div", {
|
|
187
|
+
})), !hideIcon && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.submit), {
|
|
186
188
|
className: cn('icon-box'),
|
|
187
189
|
onClick: handleSearchSubmit
|
|
188
|
-
}, /*#__PURE__*/React.createElement(SearchIcon, {
|
|
190
|
+
}), /*#__PURE__*/React.createElement(SearchIcon, {
|
|
189
191
|
className: cn('icon', [classes === null || classes === void 0 ? void 0 : classes.icon])
|
|
190
192
|
})), !!items.length && /*#__PURE__*/React.createElement("div", {
|
|
191
193
|
className: cn('list')
|
|
@@ -194,14 +196,14 @@ var Search = function Search(_ref) {
|
|
|
194
196
|
}, items.map(function (_ref2, i) {
|
|
195
197
|
var itemValue = _ref2.value,
|
|
196
198
|
searchView = _ref2.searchView;
|
|
197
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
199
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.item, i + 1), {
|
|
198
200
|
className: cn('list-item', {
|
|
199
201
|
active: activeIndex === i
|
|
200
202
|
}),
|
|
201
203
|
onMouseDown: handleSelectSubmit(i),
|
|
202
204
|
onMouseEnter: handleHoverItem(i),
|
|
203
205
|
key: i
|
|
204
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
206
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
205
207
|
className: cn('item-title', [classes === null || classes === void 0 ? void 0 : classes.listItemTitle])
|
|
206
208
|
}, searchView || highlightString(itemValue)));
|
|
207
209
|
})))), noticeText && /*#__PURE__*/React.createElement("div", {
|
|
@@ -213,6 +215,12 @@ var Search = function Search(_ref) {
|
|
|
213
215
|
};
|
|
214
216
|
|
|
215
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
|
+
}),
|
|
216
224
|
value: PropTypes.string,
|
|
217
225
|
label: PropTypes.string,
|
|
218
226
|
placeholder: PropTypes.string,
|
|
@@ -89,15 +89,7 @@ var Select = function Select(_ref) {
|
|
|
89
89
|
var isTouch = detectTouch();
|
|
90
90
|
var currentIndex = itemsList.findIndex(function (elem) {
|
|
91
91
|
return elem.value === currentValue;
|
|
92
|
-
});
|
|
93
|
-
// so it triggers onClosed callback call
|
|
94
|
-
|
|
95
|
-
var handleClosed = function handleClosed() {
|
|
96
|
-
onClosed === null || onClosed === void 0 ? void 0 : onClosed(); // eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
97
|
-
|
|
98
|
-
document.removeEventListener('click', handleClickOutside);
|
|
99
|
-
};
|
|
100
|
-
|
|
92
|
+
});
|
|
101
93
|
var handleClickOutside = useCallback(function (e) {
|
|
102
94
|
var _a;
|
|
103
95
|
|
|
@@ -105,12 +97,12 @@ var Select = function Select(_ref) {
|
|
|
105
97
|
return;
|
|
106
98
|
}
|
|
107
99
|
|
|
108
|
-
|
|
100
|
+
onClosed === null || onClosed === void 0 ? void 0 : onClosed();
|
|
109
101
|
changeSelectState({
|
|
110
102
|
type: TOGGLE_DROPDOWN,
|
|
111
103
|
isOpened: false
|
|
112
104
|
});
|
|
113
|
-
}, [isOpened]);
|
|
105
|
+
}, [onClosed, isOpened]);
|
|
114
106
|
|
|
115
107
|
var scrollList = function scrollList(itemIndex) {
|
|
116
108
|
if (!itemsNodeList.current.length) {
|
|
@@ -154,7 +146,7 @@ var Select = function Select(_ref) {
|
|
|
154
146
|
return function () {
|
|
155
147
|
document.removeEventListener('click', handleClickOutside);
|
|
156
148
|
};
|
|
157
|
-
}, [isOpened, currentIndex]);
|
|
149
|
+
}, [isOpened, currentIndex, onOpened, handleClickOutside]);
|
|
158
150
|
useEffect(function () {
|
|
159
151
|
changeSelectState({
|
|
160
152
|
type: UPDATE_ITEMS_LIST,
|
|
@@ -199,7 +191,7 @@ var Select = function Select(_ref) {
|
|
|
199
191
|
type: TOGGLE_DROPDOWN,
|
|
200
192
|
isOpened: !isCurrentlyOpened
|
|
201
193
|
});
|
|
202
|
-
isCurrentlyOpened &&
|
|
194
|
+
isCurrentlyOpened && (onClosed === null || onClosed === void 0 ? void 0 : onClosed());
|
|
203
195
|
};
|
|
204
196
|
|
|
205
197
|
var handleSelectItem = function handleSelectItem(e) {
|
|
@@ -220,7 +212,7 @@ var Select = function Select(_ref) {
|
|
|
220
212
|
items: items
|
|
221
213
|
});
|
|
222
214
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(e, item);
|
|
223
|
-
|
|
215
|
+
onClosed === null || onClosed === void 0 ? void 0 : onClosed();
|
|
224
216
|
};
|
|
225
217
|
|
|
226
218
|
var handleHoverItem = function handleHoverItem(index) {
|