@megafon/ui-core 9.2.1 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/Badges/PromoBadge/PromoBadge.css +1 -1
- package/dist/es/components/Badges/PromoBadge/PromoBadge.d.ts +7 -0
- package/dist/es/components/Badges/PromoBadge/PromoBadge.js +44 -4
- package/dist/es/components/Chips/Chips/Chip.css +1 -1
- package/dist/es/components/Chips/Chips/Chip.d.ts +14 -3
- package/dist/es/components/Chips/Chips/Chip.js +31 -5
- package/dist/es/components/Chips/Chips/ChipBadge.css +1 -0
- package/dist/es/components/Chips/Chips/ChipBadge.d.ts +8 -0
- package/dist/es/components/Chips/Chips/ChipBadge.js +29 -0
- package/dist/es/components/Chips/Chips/Chips.css +1 -1
- package/dist/es/components/Chips/Chips/Chips.d.ts +6 -6
- package/dist/es/components/Chips/Chips/Chips.js +2 -2
- package/dist/es/components/Chips/Chips/components/ChipsDropdown/ChipsDropdown.css +1 -1
- package/dist/es/components/Chips/Chips/components/ChipsDropdown/ChipsDropdown.d.ts +6 -6
- package/dist/es/components/Chips/Chips/components/ChipsDropdown/ChipsDropdown.js +5 -9
- package/dist/es/components/Chips/Chips/components/ChipsScrollPanel/ChipsScrollPanel.css +1 -1
- package/dist/es/components/Chips/Chips/components/ChipsScrollPanel/ChipsScrollPanel.d.ts +6 -6
- package/dist/es/components/Chips/Chips/components/ChipsScrollPanel/ChipsScrollPanel.js +2 -2
- package/dist/es/components/Modal/Modal.css +1 -1
- package/dist/es/components/Modal/Modal.js +15 -7
- package/dist/es/components/Modal/utils/utils.d.ts +1 -1
- package/dist/es/components/Modal/utils/utils.js +5 -1
- package/dist/es/components/MultipleSelect/MultipleSelect.css +1 -0
- package/dist/es/components/MultipleSelect/MultipleSelect.d.ts +63 -0
- package/dist/es/components/MultipleSelect/MultipleSelect.js +235 -0
- package/dist/es/components/Row/Row.css +1 -1
- package/dist/es/components/Row/Row.js +1 -1
- package/dist/es/components/Tooltip/Tooltip.d.ts +6 -0
- package/dist/es/components/Tooltip/Tooltip.js +19 -6
- package/dist/es/index.d.ts +2 -0
- package/dist/es/index.js +2 -0
- package/dist/lib/components/Badges/PromoBadge/PromoBadge.css +1 -1
- package/dist/lib/components/Badges/PromoBadge/PromoBadge.d.ts +7 -0
- package/dist/lib/components/Badges/PromoBadge/PromoBadge.js +45 -5
- package/dist/lib/components/Chips/Chips/Chip.css +1 -1
- package/dist/lib/components/Chips/Chips/Chip.d.ts +14 -3
- package/dist/lib/components/Chips/Chips/Chip.js +32 -6
- package/dist/lib/components/Chips/Chips/ChipBadge.css +1 -0
- package/dist/lib/components/Chips/Chips/ChipBadge.d.ts +8 -0
- package/dist/lib/components/Chips/Chips/ChipBadge.js +38 -0
- package/dist/lib/components/Chips/Chips/Chips.css +1 -1
- package/dist/lib/components/Chips/Chips/Chips.d.ts +6 -6
- package/dist/lib/components/Chips/Chips/Chips.js +2 -2
- package/dist/lib/components/Chips/Chips/components/ChipsDropdown/ChipsDropdown.css +1 -1
- package/dist/lib/components/Chips/Chips/components/ChipsDropdown/ChipsDropdown.d.ts +6 -6
- package/dist/lib/components/Chips/Chips/components/ChipsDropdown/ChipsDropdown.js +5 -9
- package/dist/lib/components/Chips/Chips/components/ChipsScrollPanel/ChipsScrollPanel.css +1 -1
- package/dist/lib/components/Chips/Chips/components/ChipsScrollPanel/ChipsScrollPanel.d.ts +6 -6
- package/dist/lib/components/Chips/Chips/components/ChipsScrollPanel/ChipsScrollPanel.js +2 -2
- package/dist/lib/components/Modal/Modal.css +1 -1
- package/dist/lib/components/Modal/Modal.js +14 -6
- package/dist/lib/components/Modal/utils/utils.d.ts +1 -1
- package/dist/lib/components/Modal/utils/utils.js +6 -2
- package/dist/lib/components/MultipleSelect/MultipleSelect.css +1 -0
- package/dist/lib/components/MultipleSelect/MultipleSelect.d.ts +63 -0
- package/dist/lib/components/MultipleSelect/MultipleSelect.js +244 -0
- package/dist/lib/components/Row/Row.css +1 -1
- package/dist/lib/components/Row/Row.js +1 -1
- package/dist/lib/components/Tooltip/Tooltip.d.ts +6 -0
- package/dist/lib/components/Tooltip/Tooltip.js +19 -6
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.js +14 -0
- package/package.json +2 -2
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './MultipleSelect.scss';
|
|
3
|
+
export type ItemValueType = number | string | undefined;
|
|
4
|
+
export type ItemType = {
|
|
5
|
+
/** Заголовок элемента */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Уникальный идентификатор элемента */
|
|
8
|
+
value: ItemValueType;
|
|
9
|
+
};
|
|
10
|
+
export interface IMultipleSelectProps {
|
|
11
|
+
/** Дополнительный класс корневого элемента */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Элементы выпадающего списка */
|
|
14
|
+
items: ItemType[];
|
|
15
|
+
/** Список выбранных элементов */
|
|
16
|
+
selectedItems?: ItemType[];
|
|
17
|
+
/** Ограничение количества выбранных элементов */
|
|
18
|
+
selectLimit?: number;
|
|
19
|
+
/** Текст внутри поля по умолчанию */
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
/** Максимальное вводимое количество символов */
|
|
22
|
+
maxLength?: number;
|
|
23
|
+
/** Текст при отсутствии результатов поиска */
|
|
24
|
+
notFoundText?: string;
|
|
25
|
+
/** Дополнительный текст под полем */
|
|
26
|
+
noticeText?: string;
|
|
27
|
+
/** Отключенное состояние */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/** Пользовательская функция поиска */
|
|
30
|
+
customSearchFilter?: (item: ItemType, searchQuery: string) => boolean;
|
|
31
|
+
/** Обработчик выбора элемента селекта */
|
|
32
|
+
onSelect?: (items: ItemType[]) => void;
|
|
33
|
+
/** Обработчик выхода из фокуса */
|
|
34
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
35
|
+
/** Обработчик входа в фокус */
|
|
36
|
+
onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
37
|
+
/** Обработчик изменения поля при поиске */
|
|
38
|
+
onSearch?: (query: string) => void;
|
|
39
|
+
/** Использование функции debounce для onSearch */
|
|
40
|
+
searchDelay?: number;
|
|
41
|
+
/** Переводит компонент в контролируемое состояние */
|
|
42
|
+
isControlled?: boolean;
|
|
43
|
+
/** Дополнительные классы для внутренних элементов */
|
|
44
|
+
classes?: {
|
|
45
|
+
root?: string;
|
|
46
|
+
input?: string;
|
|
47
|
+
list?: string;
|
|
48
|
+
listItem?: string;
|
|
49
|
+
tag?: string;
|
|
50
|
+
tagButton?: string;
|
|
51
|
+
};
|
|
52
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
53
|
+
dataAttrs?: {
|
|
54
|
+
root?: Record<string, string>;
|
|
55
|
+
input?: Record<string, string>;
|
|
56
|
+
list?: Record<string, string>;
|
|
57
|
+
listItem?: Record<string, string>;
|
|
58
|
+
tag?: Record<string, string>;
|
|
59
|
+
tagButton?: Record<string, string>;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
declare const MultipleSelect: React.FC<IMultipleSelectProps>;
|
|
63
|
+
export default MultipleSelect;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
+
import "core-js/modules/es.array.concat.js";
|
|
5
|
+
import "core-js/modules/es.array.filter.js";
|
|
6
|
+
import "core-js/modules/es.array.includes.js";
|
|
7
|
+
import "core-js/modules/es.array.map.js";
|
|
8
|
+
import "core-js/modules/es.array.some.js";
|
|
9
|
+
import "core-js/modules/es.object.to-string.js";
|
|
10
|
+
import "core-js/modules/es.string.includes.js";
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
13
|
+
import debounce from 'lodash.debounce';
|
|
14
|
+
import Dropdown from "../Dropdown/Dropdown";
|
|
15
|
+
import "./MultipleSelect.css";
|
|
16
|
+
var ClearIcon = function ClearIcon(props) {
|
|
17
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
18
|
+
viewBox: "0 0 20 20"
|
|
19
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
20
|
+
d: "M5.762 5.76a1 1 0 011.415 0l2.795 2.79 2.788-2.785a1.001 1.001 0 011.415 1.414l-2.788 2.785 2.789 2.787a1 1 0 01-1.414 1.414l-2.79-2.787-2.796 2.794A1 1 0 115.76 12.76l2.796-2.794-2.795-2.792a1 1 0 010-1.414z"
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
23
|
+
var ArrowIcon = function ArrowIcon(props) {
|
|
24
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
25
|
+
viewBox: "0 0 32 32"
|
|
26
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
27
|
+
d: "M16.774 18.697a1.092 1.092 0 01-1.51 0l-3.953-3.82c-.682-.66-.165-1.877.794-1.877h7.798c.96 0 1.465 1.217.783 1.876l-3.912 3.82z"
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
var isItemSelected = function isItemSelected(item, selectedItems) {
|
|
31
|
+
return selectedItems.some(function (selectedItem) {
|
|
32
|
+
return selectedItem.value === item.value;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
var cn = cnCreate('mfui-9-multiple-select');
|
|
36
|
+
var MultipleSelect = function MultipleSelect(_ref) {
|
|
37
|
+
var items = _ref.items,
|
|
38
|
+
_ref$selectedItems = _ref.selectedItems,
|
|
39
|
+
selectedItems = _ref$selectedItems === void 0 ? [] : _ref$selectedItems,
|
|
40
|
+
placeholder = _ref.placeholder,
|
|
41
|
+
selectLimit = _ref.selectLimit,
|
|
42
|
+
maxLength = _ref.maxLength,
|
|
43
|
+
className = _ref.className,
|
|
44
|
+
_ref$notFoundText = _ref.notFoundText,
|
|
45
|
+
notFoundText = _ref$notFoundText === void 0 ? 'Ничего не нашлось' : _ref$notFoundText,
|
|
46
|
+
noticeText = _ref.noticeText,
|
|
47
|
+
_ref$disabled = _ref.disabled,
|
|
48
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
49
|
+
customSearchFilter = _ref.customSearchFilter,
|
|
50
|
+
onSelect = _ref.onSelect,
|
|
51
|
+
onBlur = _ref.onBlur,
|
|
52
|
+
onFocus = _ref.onFocus,
|
|
53
|
+
onSearch = _ref.onSearch,
|
|
54
|
+
searchDelay = _ref.searchDelay,
|
|
55
|
+
isControlled = _ref.isControlled,
|
|
56
|
+
_ref$classes = _ref.classes,
|
|
57
|
+
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
|
58
|
+
dataAttrs = _ref.dataAttrs;
|
|
59
|
+
var _React$useState = React.useState(false),
|
|
60
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
61
|
+
isDropdownOpen = _React$useState2[0],
|
|
62
|
+
setIsDropdownOpen = _React$useState2[1];
|
|
63
|
+
var _React$useState3 = React.useState(selectedItems),
|
|
64
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
65
|
+
innerSelectedItems = _React$useState4[0],
|
|
66
|
+
setInnerSelectedItems = _React$useState4[1];
|
|
67
|
+
var _React$useState5 = React.useState(items),
|
|
68
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
69
|
+
innerCurrentItems = _React$useState6[0],
|
|
70
|
+
setInnerCurrentItems = _React$useState6[1];
|
|
71
|
+
var _React$useState7 = React.useState(''),
|
|
72
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
73
|
+
searchQuery = _React$useState8[0],
|
|
74
|
+
setSearchQuery = _React$useState8[1];
|
|
75
|
+
var containerRef = React.useRef(null);
|
|
76
|
+
var inputRef = React.useRef(null);
|
|
77
|
+
var currentItems = isControlled ? items : innerCurrentItems;
|
|
78
|
+
var currentSelectedItems = isControlled ? selectedItems : innerSelectedItems;
|
|
79
|
+
var isSelectActive = !selectLimit || currentSelectedItems.length < selectLimit;
|
|
80
|
+
var filteredItems = currentSelectedItems.length ? currentItems.filter(function (item) {
|
|
81
|
+
return !isItemSelected(item, currentSelectedItems);
|
|
82
|
+
}) : currentItems;
|
|
83
|
+
var showItemsList = isDropdownOpen && isSelectActive;
|
|
84
|
+
var debouncedSearch = React.useMemo(function () {
|
|
85
|
+
return debounce(function (query) {
|
|
86
|
+
return onSearch === null || onSearch === void 0 ? void 0 : onSearch(query);
|
|
87
|
+
}, searchDelay);
|
|
88
|
+
}, [onSearch, searchDelay]);
|
|
89
|
+
var filterItemsBySearch = React.useCallback(function (itemsToFilter, query) {
|
|
90
|
+
if (!query) {
|
|
91
|
+
return itemsToFilter;
|
|
92
|
+
}
|
|
93
|
+
if (customSearchFilter) {
|
|
94
|
+
return itemsToFilter.filter(function (item) {
|
|
95
|
+
return customSearchFilter(item, query);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return itemsToFilter.filter(function (item) {
|
|
99
|
+
return item.title.toLowerCase().includes(query.toLowerCase());
|
|
100
|
+
});
|
|
101
|
+
}, [customSearchFilter]);
|
|
102
|
+
var handleInputChange = React.useCallback(function (e) {
|
|
103
|
+
var _e$target$value = e.target.value,
|
|
104
|
+
inputValue = _e$target$value === void 0 ? '' : _e$target$value;
|
|
105
|
+
setSearchQuery(inputValue);
|
|
106
|
+
if (!isControlled) {
|
|
107
|
+
var matchesItems = filterItemsBySearch(items, inputValue);
|
|
108
|
+
setInnerCurrentItems(matchesItems);
|
|
109
|
+
}
|
|
110
|
+
if (!searchDelay) {
|
|
111
|
+
onSearch === null || onSearch === void 0 ? void 0 : onSearch(inputValue);
|
|
112
|
+
} else {
|
|
113
|
+
debouncedSearch(inputValue);
|
|
114
|
+
}
|
|
115
|
+
}, [debouncedSearch, filterItemsBySearch, isControlled, items, onSearch, searchDelay]);
|
|
116
|
+
var handleSelectItem = React.useCallback(function (item) {
|
|
117
|
+
if (!isSelectActive) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
var newSelectedItems = [].concat(_toConsumableArray(currentSelectedItems), [item]);
|
|
121
|
+
!isControlled && setInnerSelectedItems(newSelectedItems);
|
|
122
|
+
setSearchQuery('');
|
|
123
|
+
inputRef.current && inputRef.current.focus();
|
|
124
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelectedItems);
|
|
125
|
+
}, [isControlled, isSelectActive, onSelect, currentSelectedItems]);
|
|
126
|
+
var handleSelect = function handleSelect(index) {
|
|
127
|
+
return function () {
|
|
128
|
+
var targetItem = filteredItems[index];
|
|
129
|
+
handleSelectItem(targetItem);
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
var handleFocus = React.useCallback(function (e) {
|
|
133
|
+
setIsDropdownOpen(true);
|
|
134
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
135
|
+
}, [onFocus]);
|
|
136
|
+
var handleBlur = React.useCallback(function (e) {
|
|
137
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
138
|
+
}, [onBlur]);
|
|
139
|
+
var removeSelectedItem = React.useCallback(function (itemToRemove) {
|
|
140
|
+
return function () {
|
|
141
|
+
var newSelectedItems = currentSelectedItems.filter(function (item) {
|
|
142
|
+
return item.value !== itemToRemove.value;
|
|
143
|
+
});
|
|
144
|
+
!isControlled && setInnerSelectedItems(newSelectedItems);
|
|
145
|
+
setIsDropdownOpen(true);
|
|
146
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelectedItems);
|
|
147
|
+
};
|
|
148
|
+
}, [currentSelectedItems, isControlled, onSelect]);
|
|
149
|
+
var handleToggleDropdown = React.useCallback(function () {
|
|
150
|
+
setIsDropdownOpen(function (prev) {
|
|
151
|
+
return !prev;
|
|
152
|
+
});
|
|
153
|
+
}, []);
|
|
154
|
+
var handleDropdownClose = function handleDropdownClose() {
|
|
155
|
+
setIsDropdownOpen(false);
|
|
156
|
+
};
|
|
157
|
+
React.useEffect(function () {
|
|
158
|
+
if (!searchQuery && !isControlled) {
|
|
159
|
+
setInnerCurrentItems(items);
|
|
160
|
+
}
|
|
161
|
+
}, [isControlled, items, searchQuery]);
|
|
162
|
+
var renderList = function renderList() {
|
|
163
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
164
|
+
isOpen: showItemsList,
|
|
165
|
+
targetRef: containerRef,
|
|
166
|
+
items: filteredItems,
|
|
167
|
+
emptyText: notFoundText,
|
|
168
|
+
onItemClick: handleSelect,
|
|
169
|
+
onClose: handleDropdownClose,
|
|
170
|
+
classes: {
|
|
171
|
+
list: classes === null || classes === void 0 ? void 0 : classes.list,
|
|
172
|
+
item: classes === null || classes === void 0 ? void 0 : classes.listItem
|
|
173
|
+
},
|
|
174
|
+
dataAttrs: {
|
|
175
|
+
list: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.list,
|
|
176
|
+
item: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.listItem
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
var renderItemTag = function renderItemTag(item, i) {
|
|
181
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
182
|
+
key: item.value,
|
|
183
|
+
className: cn('tag', [classes === null || classes === void 0 ? void 0 : classes.tag])
|
|
184
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.tag, i + 1)), /*#__PURE__*/React.createElement("span", {
|
|
185
|
+
className: cn('tag-title')
|
|
186
|
+
}, item.title), /*#__PURE__*/React.createElement("button", _extends({
|
|
187
|
+
className: cn('tag-button', [classes === null || classes === void 0 ? void 0 : classes.tagButton])
|
|
188
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.tagButton, i + 1), {
|
|
189
|
+
type: "button",
|
|
190
|
+
disabled: disabled,
|
|
191
|
+
onClick: removeSelectedItem(item)
|
|
192
|
+
}), /*#__PURE__*/React.createElement(ClearIcon, {
|
|
193
|
+
className: cn('tag-button-icon')
|
|
194
|
+
})));
|
|
195
|
+
};
|
|
196
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
197
|
+
className: cn({
|
|
198
|
+
open: showItemsList,
|
|
199
|
+
disabled: disabled
|
|
200
|
+
}, [className, classes.root])
|
|
201
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement("div", {
|
|
202
|
+
className: cn('control', {
|
|
203
|
+
active: isSelectActive
|
|
204
|
+
}),
|
|
205
|
+
ref: containerRef
|
|
206
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
207
|
+
className: cn('input-container')
|
|
208
|
+
}, currentSelectedItems === null || currentSelectedItems === void 0 ? void 0 : currentSelectedItems.map(function (item, i) {
|
|
209
|
+
return renderItemTag(item, i);
|
|
210
|
+
}), isSelectActive && /*#__PURE__*/React.createElement("input", _extends({
|
|
211
|
+
className: cn('input', [classes.input])
|
|
212
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input), {
|
|
213
|
+
id: "search",
|
|
214
|
+
placeholder: placeholder,
|
|
215
|
+
value: searchQuery,
|
|
216
|
+
maxLength: maxLength,
|
|
217
|
+
disabled: disabled,
|
|
218
|
+
onChange: handleInputChange,
|
|
219
|
+
onFocus: handleFocus,
|
|
220
|
+
onBlur: handleBlur,
|
|
221
|
+
type: "text",
|
|
222
|
+
autoComplete: "off",
|
|
223
|
+
ref: inputRef
|
|
224
|
+
}))), /*#__PURE__*/React.createElement("button", {
|
|
225
|
+
className: cn('arrow-button'),
|
|
226
|
+
type: "button",
|
|
227
|
+
disabled: !isSelectActive || disabled,
|
|
228
|
+
onClick: handleToggleDropdown
|
|
229
|
+
}, /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
230
|
+
className: cn('arrow-icon')
|
|
231
|
+
})), renderList()), noticeText && /*#__PURE__*/React.createElement("div", {
|
|
232
|
+
className: cn('notice-text')
|
|
233
|
+
}, noticeText));
|
|
234
|
+
};
|
|
235
|
+
export default MultipleSelect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
h1,h2,h3,h4,h5{margin:0}.mfui-9-row{background-color:var(--base);border:none;border-radius:16px;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--content);display:inline-block;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;padding:12px 16px;position:relative;text-decoration:none;-webkit-transition:background-color,color,-webkit-box-shadow;transition:background-color,color,-webkit-box-shadow;transition:background-color,color,box-shadow;transition:background-color,color,box-shadow,-webkit-box-shadow;-webkit-transition-duration:.3s;transition-duration:.3s;width:100%}.mfui-9-row:focus-visible{-webkit-animation:focus-outline-shrink .3s linear forwards;animation:focus-outline-shrink .3s linear forwards;outline-offset:2px}@-webkit-keyframes focus-outline-shrink{0%{outline:0 solid var(--137C)}to{outline:4px solid var(--137C)}}@keyframes focus-outline-shrink{0%{outline:0 solid var(--137C)}to{outline:4px solid var(--137C)}}.mfui-9-row:focus{outline:none}@media screen and (min-width:768px){.mfui-9-row{padding:20px 24px}}@media screen and (min-width:1024px){.mfui-9-row{padding:24px 32px}}.mfui-9-row:hover{text-decoration:none}.mfui-9-row__wrapper{width:100%}.mfui-9-row__icon-container,.mfui-9-row__wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.mfui-9-row__icon-container{-ms-flex-negative:0;flex-shrink:0;-webkit-box-pack:center;-ms-flex-pack:center;height:40px;justify-content:center;margin-right:8px;width:40px}@media screen and (
|
|
1
|
+
h1,h2,h3,h4,h5{margin:0}.mfui-9-row{background-color:var(--base);border:none;border-radius:16px;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--content);display:inline-block;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;padding:12px 16px;position:relative;text-decoration:none;-webkit-transition:background-color,color,-webkit-box-shadow;transition:background-color,color,-webkit-box-shadow;transition:background-color,color,box-shadow;transition:background-color,color,box-shadow,-webkit-box-shadow;-webkit-transition-duration:.3s;transition-duration:.3s;width:100%}.mfui-9-row:focus-visible{-webkit-animation:focus-outline-shrink .3s linear forwards;animation:focus-outline-shrink .3s linear forwards;outline-offset:2px}@-webkit-keyframes focus-outline-shrink{0%{outline:0 solid var(--137C)}to{outline:4px solid var(--137C)}}@keyframes focus-outline-shrink{0%{outline:0 solid var(--137C)}to{outline:4px solid var(--137C)}}.mfui-9-row:focus{outline:none}@media screen and (min-width:768px){.mfui-9-row{padding:20px 24px}}@media screen and (min-width:1024px){.mfui-9-row{padding:24px 32px}}.mfui-9-row:hover{text-decoration:none}.mfui-9-row__wrapper{width:100%}.mfui-9-row__icon-container,.mfui-9-row__wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.mfui-9-row__icon-container{-ms-flex-negative:0;flex-shrink:0;-webkit-box-pack:center;-ms-flex-pack:center;height:40px;justify-content:center;margin-right:8px;width:40px}@media screen and (min-width:768px) and (max-width:1023px){.mfui-9-row__icon-container{height:48px;margin-right:12px;width:48px}}@media screen and (min-width:1024px) and (max-width:1279px){.mfui-9-row__icon-container{height:52px;margin-right:16px;width:52px}}@media screen and (min-width:1280px){.mfui-9-row__icon-container{height:56px;width:56px}}.mfui-9-row__icon-container svg{fill:var(--content)}.mfui-9-row__icon-container_colored{background-color:var(--brandGreen20);border-radius:12px}.mfui-9-row__icon-container_colored svg{fill:url(#row-icon-linear-gradient)}.mfui-9-row__gradient-defs{height:0;overflow:hidden;pointer-events:none;position:absolute;width:0}.mfui-9-row__icon-container_gray-simple{background-color:var(--spbSky0);border-radius:12px}.mfui-9-row__icon,.mfui-9-row__icon svg{height:32px;min-width:32px;width:32px}@media screen and (max-width:767px){.mfui-9-row__icon,.mfui-9-row__icon svg{height:20px;min-width:20px;width:20px}}.mfui-9-row__header{margin-right:auto;padding-right:12px}.mfui-9-row__sub-title{color:var(--spbSky3);font-size:12px;line-height:18px;margin-top:2px}@media screen and (min-width:768px){.mfui-9-row__sub-title:not(.mfui-9-row_size_small){font-size:15px;line-height:24px;margin-top:4px}}.mfui-9-row__arrow{height:32px;min-width:32px;width:32px;fill:var(--spbSky3)}@media screen and (max-width:767px){.mfui-9-row__arrow{height:20px;margin-left:4px;min-width:20px;width:20px}}@media screen and (min-width:768px){.mfui-9-row__arrow{margin-left:4px}}@media screen and (min-width:1024px){.mfui-9-row__arrow{margin-left:12px}}.mfui-9-row__children{font-size:15px;font-weight:500;line-height:24px}@media screen and (min-width:768px){.mfui-9-row__children{font-size:18px;font-weight:500;letter-spacing:.5px;line-height:24px}}@media screen and (min-width:768px) and (min-width:1280px){.mfui-9-row__children{font-size:20px;line-height:28px}}.mfui-9-row_view_shadow{-webkit-box-shadow:0 2px 12px rgba(0,0,0,.1);box-shadow:0 2px 12px rgba(0,0,0,.1)}.mfui-9-row_view_stroke{background-color:inherit;border:1px solid var(--spbSky2)}.mfui-9-row_view_gray{background-color:var(--spbSky0)}.mfui-9-row_view_gray .mfui-9-row__icon-container{background-color:var(--base);border-radius:12px}.mfui-9-row_view_white{background-color:var(--base)}.mfui-9-row_pointer{cursor:pointer}.mfui-9-row_pointer.mfui-9-row_view_shadow:hover{-webkit-box-shadow:0 8px 28px rgba(0,0,0,.1);box-shadow:0 8px 28px rgba(0,0,0,.1)}.mfui-9-row_pointer.mfui-9-row_view_shadow:hover:after{background-color:var(--stcWhite10);border-radius:12px;bottom:0;content:"";left:0;pointer-events:none;position:absolute;right:0;top:0}.mfui-9-row_pointer.mfui-9-row_view_stroke:hover{background-color:var(--spbSky0)}.mfui-9-row_pointer.mfui-9-row_view_gray:hover{background-color:var(--spbSky1)}.mfui-9-row_pointer.mfui-9-row_view_white:hover{-webkit-box-shadow:0 8px 28px rgba(0,0,0,.1);box-shadow:0 8px 28px rgba(0,0,0,.1)}.mfui-9-row_pointer.mfui-9-row_view_white:hover:after{background-color:var(--stcWhite10);border-radius:12px;bottom:0;content:"";left:0;pointer-events:none;position:absolute;right:0;top:0}.mfui-9-row_has-arrow{padding-right:12px}@media screen and (min-width:768px){.mfui-9-row_has-arrow{padding-right:16px}}@media screen and (min-width:1024px){.mfui-9-row_has-arrow{padding-right:20px}}@media screen and (min-width:768px){.mfui-9-row_has-arrow.mfui-9-row_size_small{padding-right:16px}}@media screen and (max-width:767px){.mfui-9-row_has-icon{padding:12px}}@media screen and (min-width:768px){.mfui-9-row_size_small{padding:16px 24px 16px 20px}}@media screen and (min-width:1024px){.mfui-9-row_size_small{padding:20px 24px}.mfui-9-row_size_small .mfui-9-row__sub-title{font-size:15px;line-height:24px;margin-top:4px}}@media screen and (min-width:768px) and (max-width:1023px){.mfui-9-row_size_small .mfui-9-row__icon-container{height:40px;width:40px}}@media screen and (min-width:1024px){.mfui-9-row_size_small .mfui-9-row__icon-container{height:48px;width:48px}}@media screen and (min-width:768px) and (max-width:1023px){.mfui-9-row_size_small .mfui-9-row__icon,.mfui-9-row_size_small .mfui-9-row__icon svg{height:20px;min-width:20px;width:20px}}@media screen and (max-width:1023px){.mfui-9-row_size_small .mfui-9-row__arrow{height:20px;margin-left:4px;min-width:20px;width:20px}}.mfui-9-row_size_small .mfui-9-row__children{font-size:15px;font-weight:500;line-height:24px}.mfui-9-row_auto-height{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:auto}
|
|
@@ -43,7 +43,7 @@ var Row = function Row(_ref) {
|
|
|
43
43
|
var ElementType = href ? 'a' : 'div';
|
|
44
44
|
var isActive = !showLoader && (!!href || !!onClick);
|
|
45
45
|
var isSmallSize = size === 'small';
|
|
46
|
-
var isGraySimpleIcon = !isIconColored && (backgroundView === 'stroke' || backgroundView === 'shadow');
|
|
46
|
+
var isGraySimpleIcon = !isIconColored && (backgroundView === 'stroke' || backgroundView === 'shadow' || backgroundView === 'white');
|
|
47
47
|
var _useResolution = useResolution(),
|
|
48
48
|
isMobile = _useResolution.isMobile;
|
|
49
49
|
var getTitleStyle = function getTitleStyle() {
|
|
@@ -58,6 +58,12 @@ export interface ITooltipProps {
|
|
|
58
58
|
title?: string;
|
|
59
59
|
/** Текст кнопки */
|
|
60
60
|
buttonText?: string;
|
|
61
|
+
/** Ссылка кнопки */
|
|
62
|
+
buttonHref?: string;
|
|
63
|
+
/** Target - свойство тега <a> кнопки */
|
|
64
|
+
buttonTarget?: '_self' | '_blank' | '_parent' | '_top';
|
|
65
|
+
/** Rel - атрибут тега <a> кнопки */
|
|
66
|
+
buttonRel?: string;
|
|
61
67
|
/** Текст */
|
|
62
68
|
text?: string;
|
|
63
69
|
/** Наличие кнопки-крестика "Закрыть" */
|
|
@@ -98,6 +98,10 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
98
98
|
_ref$size = _ref.size,
|
|
99
99
|
size = _ref$size === void 0 ? 'big' : _ref$size,
|
|
100
100
|
buttonText = _ref.buttonText,
|
|
101
|
+
buttonHref = _ref.buttonHref,
|
|
102
|
+
_ref$buttonTarget = _ref.buttonTarget,
|
|
103
|
+
buttonTarget = _ref$buttonTarget === void 0 ? '_self' : _ref$buttonTarget,
|
|
104
|
+
buttonRel = _ref.buttonRel,
|
|
101
105
|
hasCloseButton = _ref.hasCloseButton,
|
|
102
106
|
_ref$colorTheme = _ref.colorTheme,
|
|
103
107
|
theme = _ref$colorTheme === void 0 ? 'white' : _ref$colorTheme,
|
|
@@ -316,25 +320,34 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
316
320
|
var renderedFullContent = useMemo(function () {
|
|
317
321
|
var hasButtonMargin = !!title || !!text;
|
|
318
322
|
var hasChildrenMargin = hasButtonMargin || !!buttonText;
|
|
323
|
+
var isLink = !!buttonHref;
|
|
324
|
+
var ButtonElementType = isLink ? 'a' : 'button';
|
|
325
|
+
var linkProps = {
|
|
326
|
+
href: buttonHref,
|
|
327
|
+
target: buttonTarget,
|
|
328
|
+
rel: buttonRel,
|
|
329
|
+
onClick: onClick
|
|
330
|
+
};
|
|
331
|
+
var buttonProps = {
|
|
332
|
+
onClick: onClick,
|
|
333
|
+
type: 'button'
|
|
334
|
+
};
|
|
319
335
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !!title && /*#__PURE__*/React.createElement(Header, {
|
|
320
336
|
className: cn('title'),
|
|
321
337
|
as: "h5",
|
|
322
338
|
space: "tight"
|
|
323
|
-
}, title), !!text && renderedText, !!buttonText && /*#__PURE__*/React.createElement(
|
|
324
|
-
type: "button",
|
|
339
|
+
}, title), !!text && renderedText, !!buttonText && /*#__PURE__*/React.createElement(ButtonElementType, _extends({
|
|
325
340
|
className: cn('button', {
|
|
326
341
|
margin: hasButtonMargin
|
|
327
342
|
}, [buttonClassName])
|
|
328
|
-
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button), {
|
|
329
|
-
onClick: onClick
|
|
330
|
-
}), buttonText, /*#__PURE__*/React.createElement(RightArrow, {
|
|
343
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button), isLink ? linkProps : buttonProps), buttonText, /*#__PURE__*/React.createElement(RightArrow, {
|
|
331
344
|
className: cn('button-arrow')
|
|
332
345
|
})), !!children && /*#__PURE__*/React.createElement("div", {
|
|
333
346
|
className: cn('addititonal-content', {
|
|
334
347
|
margin: hasChildrenMargin
|
|
335
348
|
})
|
|
336
349
|
}, children));
|
|
337
|
-
}, [title, text, buttonText,
|
|
350
|
+
}, [title, text, buttonText, buttonHref, buttonTarget, buttonRel, onClick, renderedText, buttonClassName, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button, children]);
|
|
338
351
|
var template = /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
339
352
|
className: cn({
|
|
340
353
|
theme: theme,
|
package/dist/es/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { default as Carousel } from './components/Carousel/Carousel';
|
|
|
10
10
|
export { default as Checkbox } from './components/Checkbox/Checkbox';
|
|
11
11
|
export { default as checkBreakpointsPropTypes } from './components/Carousel/checkBreakpointsPropTypes';
|
|
12
12
|
export { default as Chip } from './components/Chips/Chips/Chip';
|
|
13
|
+
export { default as ChipBadge } from './components/Chips/Chips/ChipBadge';
|
|
13
14
|
export { default as Chips } from './components/Chips/Chips/Chips';
|
|
14
15
|
export { default as ChipsDropdown } from './components/Chips/Chips/components/ChipsDropdown/ChipsDropdown';
|
|
15
16
|
export { default as ChipsScrollPanel } from './components/Chips/Chips/components/ChipsScrollPanel/ChipsScrollPanel';
|
|
@@ -40,6 +41,7 @@ export { default as ModalContent } from './components/Modal/_ModalContent/ModalC
|
|
|
40
41
|
export { default as ModalDesktop } from './components/Modal/_ModalDesktop/ModalDesktop';
|
|
41
42
|
export { default as ModalMobile } from './components/Modal/_ModalMobile/ModalMobile';
|
|
42
43
|
export { default as Month } from './components/Calendar/components/_Month/Month';
|
|
44
|
+
export { default as MultipleSelect } from './components/MultipleSelect/MultipleSelect';
|
|
43
45
|
export { default as NavArrow } from './components/NavArrow/NavArrow';
|
|
44
46
|
export { default as Notification } from './components/Notification/Notification';
|
|
45
47
|
export { default as NotificationBadge } from './components/Badges/NotificationBadge/NotificationBadge';
|
package/dist/es/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { default as Carousel } from "./components/Carousel/Carousel";
|
|
|
10
10
|
export { default as Checkbox } from "./components/Checkbox/Checkbox";
|
|
11
11
|
export { default as checkBreakpointsPropTypes } from "./components/Carousel/checkBreakpointsPropTypes";
|
|
12
12
|
export { default as Chip } from "./components/Chips/Chips/Chip";
|
|
13
|
+
export { default as ChipBadge } from "./components/Chips/Chips/ChipBadge";
|
|
13
14
|
export { default as Chips } from "./components/Chips/Chips/Chips";
|
|
14
15
|
export { default as ChipsDropdown } from "./components/Chips/Chips/components/ChipsDropdown/ChipsDropdown";
|
|
15
16
|
export { default as ChipsScrollPanel } from "./components/Chips/Chips/components/ChipsScrollPanel/ChipsScrollPanel";
|
|
@@ -40,6 +41,7 @@ export { default as ModalContent } from "./components/Modal/_ModalContent/ModalC
|
|
|
40
41
|
export { default as ModalDesktop } from "./components/Modal/_ModalDesktop/ModalDesktop";
|
|
41
42
|
export { default as ModalMobile } from "./components/Modal/_ModalMobile/ModalMobile";
|
|
42
43
|
export { default as Month } from "./components/Calendar/components/_Month/Month";
|
|
44
|
+
export { default as MultipleSelect } from "./components/MultipleSelect/MultipleSelect";
|
|
43
45
|
export { default as NavArrow } from "./components/NavArrow/NavArrow";
|
|
44
46
|
export { default as Notification } from "./components/Notification/Notification";
|
|
45
47
|
export { default as NotificationBadge } from "./components/Badges/NotificationBadge/NotificationBadge";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
h1,h2,h3,h4,h5{margin:0}.mfui-9-promo-badge{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-radius:8px;color:var(--stcWhite);padding:
|
|
1
|
+
h1,h2,h3,h4,h5{margin:0}.mfui-9-promo-badge{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-radius:8px;color:var(--stcWhite);padding:3px 10px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.mfui-9-promo-badge_color_berry{background-color:var(--berry)}.mfui-9-promo-badge_color_brand-purple-20{background-color:var(--brandPurple20);color:var(--brandPurple)}.mfui-9-promo-badge_color_brand-purple{background-color:var(--brandPurple)}.mfui-9-promo-badge_color_night{background-color:var(--night)}.mfui-9-promo-badge_color_sky{background-color:var(--sky)}.mfui-9-promo-badge_color_flamingo{background-color:var(--flamingo)}.mfui-9-promo-badge_color_gradient-purple{background:var(--gradientPurple1);color:var(--stcWhite)}.mfui-9-promo-badge_color_gray{background:var(--spbSky0);color:var(--content)}.mfui-9-promo-badge_color_white{background:var(--base);color:var(--content)}.mfui-9-promo-badge_icon{padding:3px 8px}.mfui-9-promo-badge_size_small{border-radius:8px;height:20px;padding:0 8px}.mfui-9-promo-badge__text{font-family:inherit;font-size:12px;font-weight:500;line-height:18px}.mfui-9-promo-badge__text_size_small{font-size:10px;line-height:12px}.mfui-9-promo-badge__icon{display:-webkit-box;display:-ms-flexbox;display:flex;margin-right:4px}.mfui-9-promo-badge__icon_size_small{margin-left:-4px;margin-right:2px}
|
|
@@ -9,6 +9,7 @@ export declare const PromoBadgeColors: {
|
|
|
9
9
|
readonly FLAMINGO: "flamingo";
|
|
10
10
|
readonly GRADIENT_PURPLE: "gradient-purple";
|
|
11
11
|
readonly GRAY: "gray";
|
|
12
|
+
readonly WHITE: "white";
|
|
12
13
|
};
|
|
13
14
|
type PromoBadgeColorsType = (typeof PromoBadgeColors)[keyof typeof PromoBadgeColors];
|
|
14
15
|
export declare const PromoBadgeSize: {
|
|
@@ -16,11 +17,17 @@ export declare const PromoBadgeSize: {
|
|
|
16
17
|
readonly MEDIUM: "medium";
|
|
17
18
|
};
|
|
18
19
|
type PromoBadgeSizeType = (typeof PromoBadgeSize)[keyof typeof PromoBadgeSize];
|
|
20
|
+
export declare const PromoBadgeIcon: {
|
|
21
|
+
readonly PERSONAL: "personal";
|
|
22
|
+
};
|
|
23
|
+
type PromoBadgeIconType = (typeof PromoBadgeIcon)[keyof typeof PromoBadgeIcon];
|
|
19
24
|
export interface IPromoBadgeProps {
|
|
20
25
|
/** Цвет промо-бэйджа */
|
|
21
26
|
color?: PromoBadgeColorsType;
|
|
22
27
|
/** Размер промо-бэйджа */
|
|
23
28
|
size?: PromoBadgeSizeType;
|
|
29
|
+
/** Иконка промо-бэйджа */
|
|
30
|
+
icon?: PromoBadgeIconType;
|
|
24
31
|
/** Дополнительный класс корневого элемента */
|
|
25
32
|
className?: string;
|
|
26
33
|
/** Дополнительные data-атрибуты к внутренним элементам */
|
|
@@ -4,13 +4,39 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports["default"] = exports.PromoBadgeSize = exports.PromoBadgeColors = void 0;
|
|
7
|
+
exports["default"] = exports.PromoBadgeSize = exports.PromoBadgeIcon = exports.PromoBadgeColors = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var React = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _uiHelpers = require("@megafon/ui-helpers");
|
|
11
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
|
+
var PersonalIcon = function PersonalIcon(props) {
|
|
16
|
+
return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
|
|
17
|
+
width: 14,
|
|
18
|
+
height: 14,
|
|
19
|
+
viewBox: "0 0 14 14",
|
|
20
|
+
fill: "none"
|
|
21
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
22
|
+
fillRule: "evenodd",
|
|
23
|
+
clipRule: "evenodd",
|
|
24
|
+
d: "M4.287 7.7a.2.2 0 01.193.15l.26 1.036c.053.215.071.278.102.326a.4.4 0 00.12.121c.05.03.112.049.327.103l1.035.258a.2.2 0 010 .387l-1.035.259c-.215.054-.278.072-.326.102a.4.4 0 00-.121.121c-.03.049-.049.112-.103.327l-.259 1.035a.2.2 0 01-.385 0l-.26-1.035c-.053-.216-.072-.278-.103-.327a.397.397 0 00-.12-.12c-.048-.031-.11-.05-.326-.103l-1.035-.259a.2.2 0 01-.151-.193.2.2 0 01.151-.194l1.035-.258c.215-.054.278-.072.326-.103a.398.398 0 00.12-.121c.031-.048.05-.11.104-.326l.259-1.035a.199.199 0 01.192-.15zM8.75 2.45c.146 0 .273.1.309.241l.414 1.657c.086.345.115.445.165.522.05.077.115.143.192.192.077.05.178.08.522.166l1.657.414a.318.318 0 010 .617l-1.657.414c-.344.086-.445.115-.522.165a.636.636 0 00-.192.192c-.05.078-.08.178-.165.523l-.414 1.656a.318.318 0 01-.618 0l-.414-1.656c-.086-.345-.115-.445-.165-.523a.636.636 0 00-.192-.192c-.077-.05-.178-.079-.523-.165l-1.656-.414a.318.318 0 010-.617l1.656-.414c.345-.087.446-.116.523-.165a.636.636 0 00.192-.193c.05-.077.08-.177.165-.522l.414-1.657a.318.318 0 01.309-.24zM4.2 1.4c.058 0 .109.04.123.096l.166.663c.035.138.046.178.066.21.02.03.046.057.077.076.03.02.071.031.209.066l.663.166a.128.128 0 010 .247l-.663.165c-.138.034-.178.047-.21.066a.256.256 0 00-.076.077c-.02.031-.031.071-.066.208l-.166.664a.127.127 0 01-.247 0l-.165-.664c-.034-.137-.047-.177-.066-.208a.254.254 0 00-.077-.077c-.031-.02-.071-.032-.21-.066l-.662-.165a.127.127 0 010-.247l.663-.166c.137-.035.178-.046.209-.066a.257.257 0 00.077-.077c.02-.03.032-.071.066-.209l.165-.663A.128.128 0 014.2 1.4z",
|
|
25
|
+
fill: "url(#PersonalIcon__paint0_linear_30332_1078)"
|
|
26
|
+
}), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
27
|
+
id: "PersonalIcon__paint0_linear_30332_1078",
|
|
28
|
+
x1: 11.873,
|
|
29
|
+
y1: 2.079,
|
|
30
|
+
x2: 6.33,
|
|
31
|
+
y2: 3.363,
|
|
32
|
+
gradientUnits: "userSpaceOnUse"
|
|
33
|
+
}, /*#__PURE__*/React.createElement("stop", {
|
|
34
|
+
stopColor: "#3CB9FF"
|
|
35
|
+
}), /*#__PURE__*/React.createElement("stop", {
|
|
36
|
+
offset: 1,
|
|
37
|
+
stopColor: "#AA5AFF"
|
|
38
|
+
}))));
|
|
39
|
+
};
|
|
14
40
|
var PromoBadgeColors = exports.PromoBadgeColors = {
|
|
15
41
|
BERRY: 'berry',
|
|
16
42
|
BRAND_PURPLE_20: 'brand-purple-20',
|
|
@@ -19,28 +45,42 @@ var PromoBadgeColors = exports.PromoBadgeColors = {
|
|
|
19
45
|
SKY: 'sky',
|
|
20
46
|
FLAMINGO: 'flamingo',
|
|
21
47
|
GRADIENT_PURPLE: 'gradient-purple',
|
|
22
|
-
GRAY: 'gray'
|
|
48
|
+
GRAY: 'gray',
|
|
49
|
+
WHITE: 'white'
|
|
23
50
|
};
|
|
24
51
|
var PromoBadgeSize = exports.PromoBadgeSize = {
|
|
25
52
|
SMALL: 'small',
|
|
26
53
|
MEDIUM: 'medium'
|
|
27
54
|
};
|
|
55
|
+
var PromoBadgeIcon = exports.PromoBadgeIcon = {
|
|
56
|
+
PERSONAL: 'personal'
|
|
57
|
+
};
|
|
58
|
+
var iconMap = (0, _defineProperty2["default"])({}, PromoBadgeIcon.PERSONAL, PersonalIcon);
|
|
28
59
|
var cn = (0, _uiHelpers.cnCreate)('mfui-9-promo-badge');
|
|
29
60
|
var PromoBadge = function PromoBadge(_ref) {
|
|
30
61
|
var _ref$color = _ref.color,
|
|
31
62
|
color = _ref$color === void 0 ? PromoBadgeColors.SKY : _ref$color,
|
|
32
63
|
_ref$size = _ref.size,
|
|
33
64
|
size = _ref$size === void 0 ? PromoBadgeSize.MEDIUM : _ref$size,
|
|
65
|
+
icon = _ref.icon,
|
|
34
66
|
className = _ref.className,
|
|
35
67
|
children = _ref.children,
|
|
36
68
|
dataAttrs = _ref.dataAttrs;
|
|
69
|
+
var IconComponent = icon ? iconMap[icon] : null;
|
|
37
70
|
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
38
71
|
className: cn({
|
|
39
72
|
color: color,
|
|
40
|
-
size: size
|
|
73
|
+
size: size,
|
|
74
|
+
icon: !!IconComponent
|
|
41
75
|
}, className)
|
|
42
|
-
}), /*#__PURE__*/React.createElement("
|
|
43
|
-
className: cn('
|
|
76
|
+
}), IconComponent && /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
className: cn('icon', {
|
|
78
|
+
size: size
|
|
79
|
+
})
|
|
80
|
+
}, /*#__PURE__*/React.createElement(IconComponent, null)), /*#__PURE__*/React.createElement("span", {
|
|
81
|
+
className: cn('text', {
|
|
82
|
+
size: size
|
|
83
|
+
})
|
|
44
84
|
}, children));
|
|
45
85
|
};
|
|
46
86
|
var _default = exports["default"] = PromoBadge;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
h1,h2,h3,h4,h5{margin:0}.mfui-9-chip{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-family:inherit;font-size:15px;font-weight:500;line-height:24px;-webkit-box-align:center;-ms-flex-align:center;align-items:center
|
|
1
|
+
h1,h2,h3,h4,h5{margin:0}.mfui-9-chip{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-family:inherit;font-size:15px;font-weight:500;line-height:24px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;border:none;border-radius:20px;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--content);justify-content:center;overflow:hidden;padding:8px 20px;text-align:center;text-decoration:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;outline:none;-webkit-transition:background-color .3s,color .3s;transition:background-color .3s,color .3s}.mfui-9-chip:focus-visible{-webkit-animation:focus-outline-shrink .3s linear forwards;animation:focus-outline-shrink .3s linear forwards;outline-offset:-4px}@-webkit-keyframes focus-outline-shrink{0%{outline:0 solid var(--137C)}to{outline:4px solid var(--137C)}}@keyframes focus-outline-shrink{0%{outline:0 solid var(--137C)}to{outline:4px solid var(--137C)}}.mfui-9-chip:focus{outline:none}@media screen and (max-width:767px){.mfui-9-chip{padding:4px 12px}}.mfui-9-chip__inner{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mfui-9-chip__counter{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--spbSky3);margin-left:6px}@media screen and (max-width:767px){.mfui-9-chip__counter{margin-left:4px}}.mfui-9-chip__icon,.mfui-9-chip__icon-arrow{display:block;margin:2px 0;max-height:20px;min-width:20px;width:20px}.mfui-9-chip__icon svg,.mfui-9-chip__icon-arrow svg{display:block;height:100%;-webkit-transition:fill .3s;transition:fill .3s;width:100%;fill:var(--content)}.mfui-9-chip__icon-arrow{-webkit-transition:-webkit-transform .6s;transition:-webkit-transform .6s;transition:transform .6s;transition:transform .6s,-webkit-transform .6s}.mfui-9-chip_with-icon .mfui-9-chip__inner{margin-left:6px}@media screen and (max-width:767px){.mfui-9-chip_with-icon .mfui-9-chip__inner{margin-left:4px}}.mfui-9-chip_with-arrow{padding-right:14px}@media screen and (max-width:767px){.mfui-9-chip_with-arrow{padding-right:6px}}.mfui-9-chip_type_filter .mfui-9-chip__counter{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;border-radius:32px;font-size:12px;height:24px;justify-content:center;line-height:14px;min-width:24px;padding:0 4px 2px}@media screen and (min-width:768px){.mfui-9-chip_type_filter .mfui-9-chip__counter{height:32px;min-width:32px;padding-left:6px;padding-right:6px}}.mfui-9-chip_type_default .mfui-9-chip__icon svg{fill:var(--spbSky3)}.mfui-9-chip_theme_white{background-color:var(--spbSky0)}.mfui-9-chip_theme_gray,.mfui-9-chip_theme_white.mfui-9-chip_opened,.mfui-9-chip_theme_white:hover{background-color:var(--spbSky1)}.mfui-9-chip_theme_gray.mfui-9-chip_opened,.mfui-9-chip_theme_gray:hover{background-color:var(--spbSky2)}.mfui-9-chip_opened .mfui-9-chip__icon-arrow{-webkit-transform:rotate(-180deg);transform:rotate(-180deg)}.mfui-9-chip_disabled,.mfui-9-chip_disabled:hover{background-color:var(--spbSky0);color:var(--spbSky3);cursor:default;pointer-events:none}.mfui-9-chip_disabled .mfui-9-chip__icon svg,.mfui-9-chip_disabled:hover .mfui-9-chip__icon svg{fill:var(--spbSky3)}.mfui-9-chip_disabled .mfui-9-chip__icon-arrow svg,.mfui-9-chip_disabled:hover .mfui-9-chip__icon-arrow svg{fill:var(--spbSky2)}.mfui-9-chip_disabled .mfui-9-chip__counter,.mfui-9-chip_disabled:hover .mfui-9-chip__counter{color:var(--spbSky2)}.mfui-9-chip_disabled.mfui-9-chip_theme_gray,.mfui-9-chip_disabled.mfui-9-chip_theme_gray:hover{background-color:var(--spbSky1)}.mfui-9-chip_checked:not(.mfui-9-chip_type_filter.mfui-9-chip_with-counter){background-color:var(--night);color:var(--stcWhite)}.mfui-9-chip_checked:not(.mfui-9-chip_type_filter.mfui-9-chip_with-counter) svg{fill:var(--stcWhite)}.mfui-9-chip_checked:not(.mfui-9-chip_type_filter.mfui-9-chip_with-counter) .mfui-9-chip__counter{color:var(--stcWhite)}.mfui-9-chip_checked.mfui-9-chip_color_black:not(.mfui-9-chip_type_filter.mfui-9-chip_with-counter){background-color:var(--content);color:var(--base)}.mfui-9-chip_checked.mfui-9-chip_color_black:not(.mfui-9-chip_type_filter.mfui-9-chip_with-counter) svg{fill:var(--base)}.mfui-9-chip_checked.mfui-9-chip_color_black:not(.mfui-9-chip_type_filter.mfui-9-chip_with-counter) .mfui-9-chip__counter{color:var(--base)}.mfui-9-chip_checked.mfui-9-chip_type_filter.mfui-9-chip_with-counter{padding-bottom:4px;padding-right:4px;padding-top:4px}.mfui-9-chip_checked.mfui-9-chip_type_filter .mfui-9-chip__counter{background-color:var(--night);color:var(--stcWhite)}.mfui-9-chip_checked.mfui-9-chip_type_filter.mfui-9-chip_color_black .mfui-9-chip__counter{background-color:var(--content);color:var(--base)}
|
|
@@ -11,6 +11,11 @@ export declare const ChipThemes: {
|
|
|
11
11
|
readonly GRAY: "gray";
|
|
12
12
|
};
|
|
13
13
|
export type ChipsThemeType = (typeof ChipThemes)[keyof typeof ChipThemes];
|
|
14
|
+
export declare const ChipType: {
|
|
15
|
+
readonly DEFAULT: "default";
|
|
16
|
+
readonly FILTER: "filter";
|
|
17
|
+
};
|
|
18
|
+
export type ChipTypeType = (typeof ChipType)[keyof typeof ChipType];
|
|
14
19
|
export declare const ChipArrow: {
|
|
15
20
|
readonly UP: "up";
|
|
16
21
|
readonly DOWN: "down";
|
|
@@ -21,20 +26,26 @@ export interface IChipProps {
|
|
|
21
26
|
id: ChipIdType;
|
|
22
27
|
/** Заголовок */
|
|
23
28
|
title?: string;
|
|
29
|
+
/** Тип */
|
|
30
|
+
type?: ChipTypeType;
|
|
24
31
|
/** Цвет активного элемента компонента */
|
|
25
32
|
color?: ChipColorsType;
|
|
26
|
-
/**
|
|
33
|
+
/** Цветовая тема */
|
|
27
34
|
theme?: ChipsThemeType;
|
|
28
|
-
/**
|
|
35
|
+
/** Активное состояние */
|
|
29
36
|
checked?: boolean;
|
|
37
|
+
/** Открытое состояние */
|
|
38
|
+
opened?: boolean;
|
|
30
39
|
/** Отключенное состояние */
|
|
31
40
|
disabled?: boolean;
|
|
32
41
|
/** Иконка */
|
|
33
42
|
icon?: JSX.Element;
|
|
34
43
|
/** Значение счетчика */
|
|
35
44
|
counterValue?: number;
|
|
36
|
-
/** Стрелка вверх или вниз */
|
|
45
|
+
/** DEPRECATED Стрелка вверх или вниз (Используйте opened и showArrow) */
|
|
37
46
|
arrow?: ChipArrowType;
|
|
47
|
+
/** Показать стрелку */
|
|
48
|
+
showArrow?: boolean;
|
|
38
49
|
/** Обработчик нажатия */
|
|
39
50
|
onClick?: (e: React.SyntheticEvent<EventTarget>, id?: ChipIdType) => void;
|
|
40
51
|
/** Дочерние элементы */
|