@megafon/ui-core 3.0.0-beta.6 → 3.0.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 +51 -67
- package/dist/es/colors/Colors.d.ts +2 -2
- package/dist/es/components/Accordion/Accordion.css +1 -15
- package/dist/es/components/Accordion/Accordion.d.ts +11 -5
- package/dist/es/components/Accordion/Accordion.js +16 -14
- package/dist/es/components/Banner/Banner.css +28 -0
- package/dist/es/components/Banner/Banner.d.ts +12 -0
- package/dist/es/components/Banner/Banner.js +40 -21
- package/dist/es/components/Banner/BannerDot.d.ts +3 -0
- package/dist/es/components/Banner/BannerDot.js +8 -3
- package/dist/es/components/Button/Button.d.ts +8 -2
- package/dist/es/components/Button/Button.js +17 -9
- package/dist/es/components/Calendar/Calendar.js +3 -2
- package/dist/es/components/Calendar/components/Day/Day.js +1 -1
- package/dist/es/components/Carousel/Carousel.d.ts +9 -2
- package/dist/es/components/Carousel/Carousel.js +31 -22
- package/dist/es/components/Checkbox/Checkbox.d.ts +8 -2
- package/dist/es/components/Checkbox/Checkbox.js +13 -8
- package/dist/es/components/Collapse/Collapse.d.ts +15 -3
- package/dist/es/components/Collapse/Collapse.js +11 -4
- package/dist/es/components/Counter/Counter.js +3 -3
- package/dist/es/components/Header/Header.d.ts +5 -2
- package/dist/es/components/Header/Header.js +4 -2
- package/dist/es/components/InputLabel/InputLabel.d.ts +3 -0
- package/dist/es/components/InputLabel/InputLabel.js +9 -4
- package/dist/es/components/Link/Link.d.ts +7 -3
- package/dist/es/components/Link/Link.js +26 -10
- package/dist/es/components/Notification/Notification.d.ts +8 -0
- package/dist/es/components/Notification/Notification.js +21 -4
- package/dist/es/components/Pagination/Pagination.d.ts +9 -2
- package/dist/es/components/Pagination/Pagination.js +20 -3
- package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
- package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.js +12 -7
- package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +5 -2
- package/dist/es/components/Pagination/components/PaginationButtons/PaginationButtons.js +10 -2
- package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +5 -2
- package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +6 -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 +4 -3
- package/dist/es/components/Paragraph/Paragraph.js +9 -7
- package/dist/es/components/Preloader/Preloader.d.ts +4 -0
- package/dist/es/components/Preloader/Preloader.js +10 -5
- package/dist/es/components/RadioButton/RadioButton.d.ts +7 -2
- package/dist/es/components/RadioButton/RadioButton.js +11 -7
- package/dist/es/components/Search/Search.js +4 -3
- package/dist/es/components/Select/Select.css +5 -2
- package/dist/es/components/Select/Select.d.ts +43 -50
- package/dist/es/components/Select/Select.js +374 -461
- package/dist/es/components/Select/reducer/selectReducer.d.ts +34 -0
- package/dist/es/components/Select/reducer/selectReducer.js +123 -0
- package/dist/es/components/Switcher/Switcher.css +19 -15
- package/dist/es/components/Switcher/Switcher.js +1 -1
- package/dist/es/components/Tabs/Tab.d.ts +5 -2
- package/dist/es/components/Tabs/Tab.js +4 -2
- package/dist/es/components/Tabs/Tabs.d.ts +10 -0
- package/dist/es/components/Tabs/Tabs.js +123 -70
- package/dist/es/components/TextField/TextField.d.ts +11 -1
- package/dist/es/components/TextField/TextField.js +36 -20
- package/dist/es/components/TextLink/TextLink.js +6 -1
- package/dist/es/components/Tile/Tile.d.ts +5 -2
- package/dist/es/components/Tile/Tile.js +2 -2
- package/dist/es/components/Tooltip/Tooltip.d.ts +5 -0
- package/dist/es/components/Tooltip/Tooltip.js +27 -19
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.js +1 -0
- package/dist/lib/colors/Colors.d.ts +2 -2
- package/dist/lib/components/Accordion/Accordion.css +1 -15
- package/dist/lib/components/Accordion/Accordion.d.ts +11 -5
- package/dist/lib/components/Accordion/Accordion.js +16 -14
- package/dist/lib/components/Banner/Banner.css +28 -0
- package/dist/lib/components/Banner/Banner.d.ts +12 -0
- package/dist/lib/components/Banner/Banner.js +40 -20
- package/dist/lib/components/Banner/BannerDot.d.ts +3 -0
- package/dist/lib/components/Banner/BannerDot.js +10 -2
- package/dist/lib/components/Button/Button.d.ts +8 -2
- package/dist/lib/components/Button/Button.js +17 -9
- package/dist/lib/components/Calendar/Calendar.js +3 -3
- package/dist/lib/components/Calendar/components/Day/Day.js +1 -1
- package/dist/lib/components/Carousel/Carousel.d.ts +9 -2
- package/dist/lib/components/Carousel/Carousel.js +29 -20
- package/dist/lib/components/Checkbox/Checkbox.d.ts +8 -2
- package/dist/lib/components/Checkbox/Checkbox.js +13 -8
- package/dist/lib/components/Collapse/Collapse.d.ts +15 -3
- package/dist/lib/components/Collapse/Collapse.js +13 -4
- package/dist/lib/components/Counter/Counter.js +3 -3
- package/dist/lib/components/Header/Header.d.ts +5 -2
- package/dist/lib/components/Header/Header.js +4 -2
- package/dist/lib/components/InputLabel/InputLabel.d.ts +3 -0
- package/dist/lib/components/InputLabel/InputLabel.js +11 -3
- package/dist/lib/components/Link/Link.d.ts +7 -3
- package/dist/lib/components/Link/Link.js +37 -23
- package/dist/lib/components/Notification/Notification.d.ts +8 -0
- package/dist/lib/components/Notification/Notification.js +20 -3
- package/dist/lib/components/Pagination/Pagination.d.ts +9 -2
- package/dist/lib/components/Pagination/Pagination.js +20 -2
- package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.d.ts +6 -3
- package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.js +12 -6
- package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.d.ts +5 -2
- package/dist/lib/components/Pagination/components/PaginationButtons/PaginationButtons.js +9 -1
- package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.d.ts +5 -2
- package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.js +6 -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 +4 -3
- package/dist/lib/components/Paragraph/Paragraph.js +11 -6
- package/dist/lib/components/Preloader/Preloader.d.ts +4 -0
- package/dist/lib/components/Preloader/Preloader.js +10 -4
- package/dist/lib/components/RadioButton/RadioButton.d.ts +7 -2
- package/dist/lib/components/RadioButton/RadioButton.js +11 -7
- package/dist/lib/components/Search/Search.js +4 -3
- package/dist/lib/components/Select/Select.css +5 -2
- package/dist/lib/components/Select/Select.d.ts +43 -50
- package/dist/lib/components/Select/Select.js +368 -484
- package/dist/lib/components/Select/reducer/selectReducer.d.ts +34 -0
- package/dist/lib/components/Select/reducer/selectReducer.js +136 -0
- package/dist/lib/components/Switcher/Switcher.css +19 -15
- package/dist/lib/components/Switcher/Switcher.js +1 -1
- package/dist/lib/components/Tabs/Tab.d.ts +5 -2
- package/dist/lib/components/Tabs/Tab.js +4 -2
- package/dist/lib/components/Tabs/Tabs.d.ts +10 -0
- package/dist/lib/components/Tabs/Tabs.js +123 -70
- package/dist/lib/components/TextField/TextField.d.ts +11 -1
- package/dist/lib/components/TextField/TextField.js +34 -19
- package/dist/lib/components/TextLink/TextLink.js +6 -1
- package/dist/lib/components/Tile/Tile.d.ts +5 -2
- package/dist/lib/components/Tile/Tile.js +2 -2
- package/dist/lib/components/Tooltip/Tooltip.d.ts +5 -0
- package/dist/lib/components/Tooltip/Tooltip.js +26 -18
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +8 -0
- package/package.json +4 -4
|
@@ -9,6 +9,8 @@ exports["default"] = void 0;
|
|
|
9
9
|
|
|
10
10
|
require("core-js/modules/es.object.values");
|
|
11
11
|
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
12
14
|
var React = _interopRequireWildcard(require("react"));
|
|
13
15
|
|
|
14
16
|
var _uiHelpers = require("@megafon/ui-helpers");
|
|
@@ -19,15 +21,14 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
19
21
|
|
|
20
22
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
23
|
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
22
26
|
var COLORS = {
|
|
23
27
|
INHERIT: 'inherit',
|
|
24
28
|
DEFAULT: 'default',
|
|
25
29
|
WHITE: 'white',
|
|
26
30
|
GREEN: 'green',
|
|
27
|
-
PURPLE: 'purple'
|
|
28
|
-
SPB_SKY_0: 'spbSky0',
|
|
29
|
-
SPB_SKY_1: 'spbSky1',
|
|
30
|
-
SPB_SKY_2: 'spbSky2'
|
|
31
|
+
PURPLE: 'purple'
|
|
31
32
|
};
|
|
32
33
|
var cn = (0, _uiHelpers.cnCreate)('mfui-paragraph');
|
|
33
34
|
|
|
@@ -40,18 +41,22 @@ var Paragraph = function Paragraph(_ref) {
|
|
|
40
41
|
className = _ref.className,
|
|
41
42
|
_ref$hasMargin = _ref.hasMargin,
|
|
42
43
|
hasMargin = _ref$hasMargin === void 0 ? true : _ref$hasMargin,
|
|
44
|
+
dataAttrs = _ref.dataAttrs,
|
|
43
45
|
children = _ref.children;
|
|
44
|
-
return /*#__PURE__*/React.createElement("p", {
|
|
46
|
+
return /*#__PURE__*/React.createElement("p", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
45
47
|
className: cn({
|
|
46
48
|
size: size,
|
|
47
49
|
align: align,
|
|
48
50
|
color: color,
|
|
49
51
|
'has-margin': hasMargin
|
|
50
52
|
}, className)
|
|
51
|
-
}, children);
|
|
53
|
+
}), children);
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
Paragraph.propTypes = {
|
|
57
|
+
dataAttrs: PropTypes.shape({
|
|
58
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
59
|
+
}),
|
|
55
60
|
align: PropTypes.oneOf(['left', 'center', 'right']),
|
|
56
61
|
size: PropTypes.oneOf(['regular', 'small']),
|
|
57
62
|
hasMargin: PropTypes.bool,
|
|
@@ -26,6 +26,10 @@ export interface IPreloaderProps {
|
|
|
26
26
|
sizeMobile?: PreloaderSizesType;
|
|
27
27
|
/** Дополнительный класс корневого элемента */
|
|
28
28
|
className?: string;
|
|
29
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
30
|
+
dataAttrs?: {
|
|
31
|
+
root?: Record<string, string>;
|
|
32
|
+
};
|
|
29
33
|
}
|
|
30
34
|
declare const Preloader: React.FC<IPreloaderProps>;
|
|
31
35
|
export default Preloader;
|
|
@@ -11,6 +11,8 @@ require("core-js/modules/es.object.values");
|
|
|
11
11
|
|
|
12
12
|
require("core-js/modules/web.timers");
|
|
13
13
|
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
14
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
17
|
|
|
16
18
|
var React = _interopRequireWildcard(require("react"));
|
|
@@ -47,7 +49,8 @@ var Preloader = function Preloader(_ref) {
|
|
|
47
49
|
sizeDesktop = _ref.sizeDesktop,
|
|
48
50
|
sizeTablet = _ref.sizeTablet,
|
|
49
51
|
sizeMobile = _ref.sizeMobile,
|
|
50
|
-
className = _ref.className
|
|
52
|
+
className = _ref.className,
|
|
53
|
+
dataAttrs = _ref.dataAttrs;
|
|
51
54
|
|
|
52
55
|
var _React$useState = React.useState(false),
|
|
53
56
|
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
@@ -62,7 +65,7 @@ var Preloader = function Preloader(_ref) {
|
|
|
62
65
|
clearTimeout(timerId);
|
|
63
66
|
};
|
|
64
67
|
}, []);
|
|
65
|
-
return isShowed ? /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
return isShowed ? /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
66
69
|
className: cn({
|
|
67
70
|
color: color,
|
|
68
71
|
'size-all': sizeAll,
|
|
@@ -71,7 +74,7 @@ var Preloader = function Preloader(_ref) {
|
|
|
71
74
|
'size-tablet': sizeTablet,
|
|
72
75
|
'size-mobile': sizeMobile
|
|
73
76
|
}, className)
|
|
74
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
75
78
|
className: cn('item', {
|
|
76
79
|
first: true
|
|
77
80
|
})
|
|
@@ -93,7 +96,10 @@ Preloader.propTypes = {
|
|
|
93
96
|
sizeDesktop: PropTypes.oneOf(Object.values(PreloaderSizes)),
|
|
94
97
|
sizeTablet: PropTypes.oneOf(Object.values(PreloaderSizes)),
|
|
95
98
|
sizeMobile: PropTypes.oneOf(Object.values(PreloaderSizes)),
|
|
96
|
-
className: PropTypes.string
|
|
99
|
+
className: PropTypes.string,
|
|
100
|
+
dataAttrs: PropTypes.shape({
|
|
101
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
102
|
+
})
|
|
97
103
|
};
|
|
98
104
|
var _default = Preloader;
|
|
99
105
|
exports["default"] = _default;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
3
2
|
import './RadioButton.less';
|
|
4
|
-
export interface IRadioButtonProps
|
|
3
|
+
export interface IRadioButtonProps {
|
|
5
4
|
/** Значение */
|
|
6
5
|
value: string;
|
|
7
6
|
/** Имя для тега form */
|
|
@@ -21,6 +20,12 @@ export interface IRadioButtonProps extends IFilterDataAttrs {
|
|
|
21
20
|
customInput?: string;
|
|
22
21
|
labelText?: string;
|
|
23
22
|
};
|
|
23
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
24
|
+
dataAttrs?: {
|
|
25
|
+
root?: Record<string, string>;
|
|
26
|
+
input?: Record<string, string>;
|
|
27
|
+
text?: Record<string, string>;
|
|
28
|
+
};
|
|
24
29
|
children?: React.ReactNode;
|
|
25
30
|
/** Обработчик изменения значения 'value' */
|
|
26
31
|
onChange?: (value: string) => void;
|
|
@@ -52,16 +52,16 @@ var RadioButton = function RadioButton(_ref) {
|
|
|
52
52
|
var rootClassNames = Array.isArray(className) ? [].concat((0, _toConsumableArray2["default"])(className), [classes.root]) : [className, classes.root];
|
|
53
53
|
|
|
54
54
|
var handleChange = function handleChange() {
|
|
55
|
-
return onChange
|
|
55
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
|
|
59
59
|
className: cn(rootClassNames)
|
|
60
|
-
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs)), /*#__PURE__*/React.createElement("label", {
|
|
60
|
+
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement("label", {
|
|
61
61
|
className: cn('label', {
|
|
62
62
|
disabled: disabled
|
|
63
63
|
}, classes.label)
|
|
64
|
-
}, /*#__PURE__*/React.createElement("input", (0, _extends2["default"])({}, checkedProp, {
|
|
64
|
+
}, /*#__PURE__*/React.createElement("input", (0, _extends2["default"])({}, checkedProp, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input), {
|
|
65
65
|
className: cn('input'),
|
|
66
66
|
type: "radio",
|
|
67
67
|
name: name,
|
|
@@ -71,11 +71,11 @@ var RadioButton = function RadioButton(_ref) {
|
|
|
71
71
|
ref: inputRef
|
|
72
72
|
})), /*#__PURE__*/React.createElement("div", {
|
|
73
73
|
className: cn('custom-input', classes.customInput)
|
|
74
|
-
}), children && /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
}), children && /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.text), {
|
|
75
75
|
className: cn('text', {
|
|
76
76
|
size: textSize
|
|
77
77
|
}, classes.labelText)
|
|
78
|
-
}, children)));
|
|
78
|
+
}), children)));
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
RadioButton.propTypes = {
|
|
@@ -91,12 +91,16 @@ RadioButton.propTypes = {
|
|
|
91
91
|
customInput: PropTypes.string,
|
|
92
92
|
labelText: PropTypes.string
|
|
93
93
|
}),
|
|
94
|
+
dataAttrs: PropTypes.shape({
|
|
95
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
96
|
+
input: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
97
|
+
text: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
98
|
+
}),
|
|
94
99
|
children: PropTypes.node,
|
|
95
100
|
onChange: PropTypes.func,
|
|
96
101
|
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
|
|
97
102
|
current: PropTypes.elementType
|
|
98
|
-
}), PropTypes.any])])
|
|
99
|
-
dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
103
|
+
}), PropTypes.any])])
|
|
100
104
|
};
|
|
101
105
|
var _default = RadioButton;
|
|
102
106
|
exports["default"] = _default;
|
|
@@ -100,7 +100,7 @@ var Search = function Search(_ref) {
|
|
|
100
100
|
setActiveIndex(-1);
|
|
101
101
|
|
|
102
102
|
if (changeDelay === 0) {
|
|
103
|
-
onChange
|
|
103
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(inputValue);
|
|
104
104
|
} else {
|
|
105
105
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
106
106
|
// @ts-ignore
|
|
@@ -124,7 +124,7 @@ var Search = function Search(_ref) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
var chosenValue = items[index].value;
|
|
127
|
-
onSubmit
|
|
127
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(chosenValue);
|
|
128
128
|
}, [disabled, items, onSubmit]);
|
|
129
129
|
|
|
130
130
|
var handleSelectSubmit = _react["default"].useCallback(function () {
|
|
@@ -139,7 +139,7 @@ var Search = function Search(_ref) {
|
|
|
139
139
|
|
|
140
140
|
var handleBlur = _react["default"].useCallback(function (e) {
|
|
141
141
|
setFocus(false);
|
|
142
|
-
onBlur
|
|
142
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
143
143
|
}, [onBlur]);
|
|
144
144
|
|
|
145
145
|
var handleClick = _react["default"].useCallback(function () {
|
|
@@ -161,6 +161,7 @@ var Search = function Search(_ref) {
|
|
|
161
161
|
e.preventDefault();
|
|
162
162
|
} else if (e.key === 'Enter' && activeIndex > -1) {
|
|
163
163
|
handleItemSubmit(activeIndex);
|
|
164
|
+
e.preventDefault();
|
|
164
165
|
} else if (e.key === 'Enter' && activeIndex === -1) {
|
|
165
166
|
handleSearchSubmit();
|
|
166
167
|
}
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
background-color: var(--base);
|
|
151
151
|
cursor: pointer;
|
|
152
152
|
}
|
|
153
|
-
.mfui-select__list-
|
|
153
|
+
.mfui-select__list-item_hovered {
|
|
154
154
|
background-color: var(--spbSky0);
|
|
155
155
|
}
|
|
156
156
|
.mfui-select__item-title {
|
|
@@ -177,7 +177,10 @@
|
|
|
177
177
|
background: -webkit-gradient(linear, left top, right top, from(rgba(255, 255, 255, 0)), to(var(--base)));
|
|
178
178
|
background: linear-gradient(to right, rgba(255, 255, 255, 0), var(--base));
|
|
179
179
|
}
|
|
180
|
-
.mfui-
|
|
180
|
+
.mfui-select__item-title_active {
|
|
181
|
+
font-weight: bold;
|
|
182
|
+
}
|
|
183
|
+
.mfui-select__list-item_hovered .mfui-select__item-title:after {
|
|
181
184
|
background: -webkit-gradient(linear, left top, right top, from(rgba(255, 255, 255, 0)), to(var(--spbSky0)));
|
|
182
185
|
background: linear-gradient(to right, rgba(255, 255, 255, 0), var(--spbSky0));
|
|
183
186
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
3
2
|
import * as PropTypes from 'prop-types';
|
|
4
3
|
import './Select.less';
|
|
5
4
|
export declare const Verification: {
|
|
@@ -16,6 +15,7 @@ export declare type SelectItemValueType = number | string | undefined;
|
|
|
16
15
|
declare type ElementOrString = JSX.Element[] | JSX.Element | Element[] | Element | string;
|
|
17
16
|
declare type ViewCallbackArguments = {
|
|
18
17
|
filterValue: string;
|
|
18
|
+
isItemActive: boolean;
|
|
19
19
|
};
|
|
20
20
|
export interface ISelectItem<T extends SelectItemValueType> {
|
|
21
21
|
/** Заголовок элемента в выпадающем списке */
|
|
@@ -27,7 +27,7 @@ export interface ISelectItem<T extends SelectItemValueType> {
|
|
|
27
27
|
/** Настраиваемое отображение выбранного элемента в поле селекта */
|
|
28
28
|
selectedView?: JSX.Element | Element | React.ReactElement;
|
|
29
29
|
}
|
|
30
|
-
export interface ISelectProps<T extends SelectItemValueType>
|
|
30
|
+
export interface ISelectProps<T extends SelectItemValueType> {
|
|
31
31
|
/** Тип компонента */
|
|
32
32
|
type?: SelectTypesType;
|
|
33
33
|
/** Заголовок поля */
|
|
@@ -62,6 +62,17 @@ export interface ISelectProps<T extends SelectItemValueType> extends IFilterData
|
|
|
62
62
|
listItem?: string;
|
|
63
63
|
listItemTitle?: string;
|
|
64
64
|
};
|
|
65
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
66
|
+
dataAttrs?: {
|
|
67
|
+
root?: Record<string, string>;
|
|
68
|
+
label?: Record<string, string>;
|
|
69
|
+
title?: Record<string, string>;
|
|
70
|
+
input?: Record<string, string>;
|
|
71
|
+
noticeText?: Record<string, string>;
|
|
72
|
+
listItem?: Record<string, string>;
|
|
73
|
+
listItemTitle?: Record<string, string>;
|
|
74
|
+
notFound?: Record<string, string>;
|
|
75
|
+
};
|
|
65
76
|
/** Обработчик выбора элемента селекта */
|
|
66
77
|
onSelect?: (e: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement> | null, dataItem?: ISelectItem<T>) => void;
|
|
67
78
|
/** Обработчик при открытом селекте */
|
|
@@ -69,16 +80,9 @@ export interface ISelectProps<T extends SelectItemValueType> extends IFilterData
|
|
|
69
80
|
/** Обработчик при закрытом селекте */
|
|
70
81
|
onClosed?: () => void;
|
|
71
82
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
filteredItems: Array<ISelectItem<T>>;
|
|
76
|
-
comparableInputValue: string;
|
|
77
|
-
inputValue: string;
|
|
78
|
-
isChoosenItem: boolean;
|
|
79
|
-
}
|
|
80
|
-
declare class Select<T extends SelectItemValueType> extends React.Component<ISelectProps<T>, ISelectState<T>> {
|
|
81
|
-
static propTypes: {
|
|
83
|
+
declare const Select: {
|
|
84
|
+
<T extends string | number | undefined>({ type, disabled, verification, noticeText, label, labelId, required, className, classes, dataAttrs, notFoundText, items, placeholder, currentValue, onClosed, onOpened, onSelect, }: ISelectProps<T>): JSX.Element;
|
|
85
|
+
propTypes: {
|
|
82
86
|
type: PropTypes.Requireable<"classic" | "combobox">;
|
|
83
87
|
label: PropTypes.Requireable<string>;
|
|
84
88
|
id: PropTypes.Requireable<string>;
|
|
@@ -99,6 +103,32 @@ declare class Select<T extends SelectItemValueType> extends React.Component<ISel
|
|
|
99
103
|
listItem: PropTypes.Requireable<string>;
|
|
100
104
|
listItemTitle: PropTypes.Requireable<string>;
|
|
101
105
|
}>>;
|
|
106
|
+
dataAttrs: PropTypes.Requireable<PropTypes.InferProps<{
|
|
107
|
+
root: PropTypes.Requireable<{
|
|
108
|
+
[x: string]: string;
|
|
109
|
+
}>;
|
|
110
|
+
label: PropTypes.Requireable<{
|
|
111
|
+
[x: string]: string;
|
|
112
|
+
}>;
|
|
113
|
+
title: PropTypes.Requireable<{
|
|
114
|
+
[x: string]: string;
|
|
115
|
+
}>;
|
|
116
|
+
input: PropTypes.Requireable<{
|
|
117
|
+
[x: string]: string;
|
|
118
|
+
}>;
|
|
119
|
+
noticeText: PropTypes.Requireable<{
|
|
120
|
+
[x: string]: string;
|
|
121
|
+
}>;
|
|
122
|
+
listItem: PropTypes.Requireable<{
|
|
123
|
+
[x: string]: string;
|
|
124
|
+
}>;
|
|
125
|
+
listItemTitle: PropTypes.Requireable<{
|
|
126
|
+
[x: string]: string;
|
|
127
|
+
}>;
|
|
128
|
+
notFound: PropTypes.Requireable<{
|
|
129
|
+
[x: string]: string;
|
|
130
|
+
}>;
|
|
131
|
+
}>>;
|
|
102
132
|
items: PropTypes.Validator<(Required<PropTypes.InferProps<{
|
|
103
133
|
view: PropTypes.Requireable<string | PropTypes.ReactElementLike | ((...args: any[]) => any)>;
|
|
104
134
|
selectedView: PropTypes.Requireable<string | PropTypes.ReactElementLike | ((...args: any[]) => any)>;
|
|
@@ -106,45 +136,8 @@ declare class Select<T extends SelectItemValueType> extends React.Component<ISel
|
|
|
106
136
|
value: PropTypes.Validator<string | number>;
|
|
107
137
|
}>> | null | undefined)[]>;
|
|
108
138
|
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
109
|
-
dataAttrs: PropTypes.Requireable<{
|
|
110
|
-
[x: string]: string;
|
|
111
|
-
}>;
|
|
112
139
|
onOpened: PropTypes.Requireable<(...args: any[]) => any>;
|
|
113
140
|
onClosed: PropTypes.Requireable<(...args: any[]) => any>;
|
|
114
141
|
};
|
|
115
|
-
|
|
116
|
-
disabled: boolean;
|
|
117
|
-
required: boolean;
|
|
118
|
-
type: string;
|
|
119
|
-
notFoundText: string;
|
|
120
|
-
};
|
|
121
|
-
itemWrapperNode: HTMLDivElement;
|
|
122
|
-
itemsNodeList: HTMLDivElement[];
|
|
123
|
-
selectNode: HTMLDivElement;
|
|
124
|
-
isTouch: boolean;
|
|
125
|
-
debouncedComboboxChange: any;
|
|
126
|
-
constructor(props: ISelectProps<T>);
|
|
127
|
-
componentDidMount(): void;
|
|
128
|
-
componentDidUpdate({ items: prevItems }: ISelectProps<T>): void;
|
|
129
|
-
componentWillUnmount(): void;
|
|
130
|
-
isEqualItems: (items: ISelectItem<T>[], prevItems: ISelectItem<T>[]) => boolean;
|
|
131
|
-
handleOpened: () => void;
|
|
132
|
-
handleClosed: () => void;
|
|
133
|
-
handleClickOutside: (e: MouseEvent) => void;
|
|
134
|
-
handleOpenDropdown: () => void;
|
|
135
|
-
handleSelectItem: (e: React.KeyboardEvent<HTMLDivElement> | React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
136
|
-
handleHoverItem: (index: number) => (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
137
|
-
handleComboboxFocus: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
138
|
-
handleChangeCombobox: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
139
|
-
handleKeyDown: (e: React.KeyboardEvent<HTMLDivElement>) => boolean;
|
|
140
|
-
highlightString: (title: string, view?: string | Element | JSX.Element | JSX.Element[] | Element[] | ((data: ViewCallbackArguments) => ElementOrString) | undefined) => ElementOrString;
|
|
141
|
-
getItemWrapper: (node: any) => void;
|
|
142
|
-
getSelectNode: (node: any) => void;
|
|
143
|
-
getNodeList: (node: any) => number;
|
|
144
|
-
scrollList(activeIndex: number): void;
|
|
145
|
-
renderTitle(): JSX.Element;
|
|
146
|
-
renderCombobox(): JSX.Element;
|
|
147
|
-
renderChildren(): JSX.Element;
|
|
148
|
-
render(): JSX.Element;
|
|
149
|
-
}
|
|
142
|
+
};
|
|
150
143
|
export default Select;
|