@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,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
require("core-js/modules/es.array.concat.js");
|
|
12
|
+
require("core-js/modules/es.array.filter.js");
|
|
13
|
+
require("core-js/modules/es.array.includes.js");
|
|
14
|
+
require("core-js/modules/es.array.map.js");
|
|
15
|
+
require("core-js/modules/es.array.some.js");
|
|
16
|
+
require("core-js/modules/es.object.to-string.js");
|
|
17
|
+
require("core-js/modules/es.string.includes.js");
|
|
18
|
+
var React = _interopRequireWildcard(require("react"));
|
|
19
|
+
var _uiHelpers = require("@megafon/ui-helpers");
|
|
20
|
+
var _lodash = _interopRequireDefault(require("lodash.debounce"));
|
|
21
|
+
var _Dropdown = _interopRequireDefault(require("../Dropdown/Dropdown"));
|
|
22
|
+
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); }
|
|
23
|
+
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; }
|
|
24
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
25
|
+
var ClearIcon = function ClearIcon(props) {
|
|
26
|
+
return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
|
|
27
|
+
viewBox: "0 0 20 20"
|
|
28
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
29
|
+
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"
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
var ArrowIcon = function ArrowIcon(props) {
|
|
33
|
+
return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
|
|
34
|
+
viewBox: "0 0 32 32"
|
|
35
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
36
|
+
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"
|
|
37
|
+
}));
|
|
38
|
+
};
|
|
39
|
+
var isItemSelected = function isItemSelected(item, selectedItems) {
|
|
40
|
+
return selectedItems.some(function (selectedItem) {
|
|
41
|
+
return selectedItem.value === item.value;
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var cn = (0, _uiHelpers.cnCreate)('mfui-9-multiple-select');
|
|
45
|
+
var MultipleSelect = function MultipleSelect(_ref) {
|
|
46
|
+
var items = _ref.items,
|
|
47
|
+
_ref$selectedItems = _ref.selectedItems,
|
|
48
|
+
selectedItems = _ref$selectedItems === void 0 ? [] : _ref$selectedItems,
|
|
49
|
+
placeholder = _ref.placeholder,
|
|
50
|
+
selectLimit = _ref.selectLimit,
|
|
51
|
+
maxLength = _ref.maxLength,
|
|
52
|
+
className = _ref.className,
|
|
53
|
+
_ref$notFoundText = _ref.notFoundText,
|
|
54
|
+
notFoundText = _ref$notFoundText === void 0 ? 'Ничего не нашлось' : _ref$notFoundText,
|
|
55
|
+
noticeText = _ref.noticeText,
|
|
56
|
+
_ref$disabled = _ref.disabled,
|
|
57
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
58
|
+
customSearchFilter = _ref.customSearchFilter,
|
|
59
|
+
onSelect = _ref.onSelect,
|
|
60
|
+
onBlur = _ref.onBlur,
|
|
61
|
+
onFocus = _ref.onFocus,
|
|
62
|
+
onSearch = _ref.onSearch,
|
|
63
|
+
searchDelay = _ref.searchDelay,
|
|
64
|
+
isControlled = _ref.isControlled,
|
|
65
|
+
_ref$classes = _ref.classes,
|
|
66
|
+
classes = _ref$classes === void 0 ? {} : _ref$classes,
|
|
67
|
+
dataAttrs = _ref.dataAttrs;
|
|
68
|
+
var _React$useState = React.useState(false),
|
|
69
|
+
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
70
|
+
isDropdownOpen = _React$useState2[0],
|
|
71
|
+
setIsDropdownOpen = _React$useState2[1];
|
|
72
|
+
var _React$useState3 = React.useState(selectedItems),
|
|
73
|
+
_React$useState4 = (0, _slicedToArray2["default"])(_React$useState3, 2),
|
|
74
|
+
innerSelectedItems = _React$useState4[0],
|
|
75
|
+
setInnerSelectedItems = _React$useState4[1];
|
|
76
|
+
var _React$useState5 = React.useState(items),
|
|
77
|
+
_React$useState6 = (0, _slicedToArray2["default"])(_React$useState5, 2),
|
|
78
|
+
innerCurrentItems = _React$useState6[0],
|
|
79
|
+
setInnerCurrentItems = _React$useState6[1];
|
|
80
|
+
var _React$useState7 = React.useState(''),
|
|
81
|
+
_React$useState8 = (0, _slicedToArray2["default"])(_React$useState7, 2),
|
|
82
|
+
searchQuery = _React$useState8[0],
|
|
83
|
+
setSearchQuery = _React$useState8[1];
|
|
84
|
+
var containerRef = React.useRef(null);
|
|
85
|
+
var inputRef = React.useRef(null);
|
|
86
|
+
var currentItems = isControlled ? items : innerCurrentItems;
|
|
87
|
+
var currentSelectedItems = isControlled ? selectedItems : innerSelectedItems;
|
|
88
|
+
var isSelectActive = !selectLimit || currentSelectedItems.length < selectLimit;
|
|
89
|
+
var filteredItems = currentSelectedItems.length ? currentItems.filter(function (item) {
|
|
90
|
+
return !isItemSelected(item, currentSelectedItems);
|
|
91
|
+
}) : currentItems;
|
|
92
|
+
var showItemsList = isDropdownOpen && isSelectActive;
|
|
93
|
+
var debouncedSearch = React.useMemo(function () {
|
|
94
|
+
return (0, _lodash["default"])(function (query) {
|
|
95
|
+
return onSearch === null || onSearch === void 0 ? void 0 : onSearch(query);
|
|
96
|
+
}, searchDelay);
|
|
97
|
+
}, [onSearch, searchDelay]);
|
|
98
|
+
var filterItemsBySearch = React.useCallback(function (itemsToFilter, query) {
|
|
99
|
+
if (!query) {
|
|
100
|
+
return itemsToFilter;
|
|
101
|
+
}
|
|
102
|
+
if (customSearchFilter) {
|
|
103
|
+
return itemsToFilter.filter(function (item) {
|
|
104
|
+
return customSearchFilter(item, query);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return itemsToFilter.filter(function (item) {
|
|
108
|
+
return item.title.toLowerCase().includes(query.toLowerCase());
|
|
109
|
+
});
|
|
110
|
+
}, [customSearchFilter]);
|
|
111
|
+
var handleInputChange = React.useCallback(function (e) {
|
|
112
|
+
var _e$target$value = e.target.value,
|
|
113
|
+
inputValue = _e$target$value === void 0 ? '' : _e$target$value;
|
|
114
|
+
setSearchQuery(inputValue);
|
|
115
|
+
if (!isControlled) {
|
|
116
|
+
var matchesItems = filterItemsBySearch(items, inputValue);
|
|
117
|
+
setInnerCurrentItems(matchesItems);
|
|
118
|
+
}
|
|
119
|
+
if (!searchDelay) {
|
|
120
|
+
onSearch === null || onSearch === void 0 ? void 0 : onSearch(inputValue);
|
|
121
|
+
} else {
|
|
122
|
+
debouncedSearch(inputValue);
|
|
123
|
+
}
|
|
124
|
+
}, [debouncedSearch, filterItemsBySearch, isControlled, items, onSearch, searchDelay]);
|
|
125
|
+
var handleSelectItem = React.useCallback(function (item) {
|
|
126
|
+
if (!isSelectActive) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
var newSelectedItems = [].concat((0, _toConsumableArray2["default"])(currentSelectedItems), [item]);
|
|
130
|
+
!isControlled && setInnerSelectedItems(newSelectedItems);
|
|
131
|
+
setSearchQuery('');
|
|
132
|
+
inputRef.current && inputRef.current.focus();
|
|
133
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelectedItems);
|
|
134
|
+
}, [isControlled, isSelectActive, onSelect, currentSelectedItems]);
|
|
135
|
+
var handleSelect = function handleSelect(index) {
|
|
136
|
+
return function () {
|
|
137
|
+
var targetItem = filteredItems[index];
|
|
138
|
+
handleSelectItem(targetItem);
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
var handleFocus = React.useCallback(function (e) {
|
|
142
|
+
setIsDropdownOpen(true);
|
|
143
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
144
|
+
}, [onFocus]);
|
|
145
|
+
var handleBlur = React.useCallback(function (e) {
|
|
146
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
147
|
+
}, [onBlur]);
|
|
148
|
+
var removeSelectedItem = React.useCallback(function (itemToRemove) {
|
|
149
|
+
return function () {
|
|
150
|
+
var newSelectedItems = currentSelectedItems.filter(function (item) {
|
|
151
|
+
return item.value !== itemToRemove.value;
|
|
152
|
+
});
|
|
153
|
+
!isControlled && setInnerSelectedItems(newSelectedItems);
|
|
154
|
+
setIsDropdownOpen(true);
|
|
155
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelectedItems);
|
|
156
|
+
};
|
|
157
|
+
}, [currentSelectedItems, isControlled, onSelect]);
|
|
158
|
+
var handleToggleDropdown = React.useCallback(function () {
|
|
159
|
+
setIsDropdownOpen(function (prev) {
|
|
160
|
+
return !prev;
|
|
161
|
+
});
|
|
162
|
+
}, []);
|
|
163
|
+
var handleDropdownClose = function handleDropdownClose() {
|
|
164
|
+
setIsDropdownOpen(false);
|
|
165
|
+
};
|
|
166
|
+
React.useEffect(function () {
|
|
167
|
+
if (!searchQuery && !isControlled) {
|
|
168
|
+
setInnerCurrentItems(items);
|
|
169
|
+
}
|
|
170
|
+
}, [isControlled, items, searchQuery]);
|
|
171
|
+
var renderList = function renderList() {
|
|
172
|
+
return /*#__PURE__*/React.createElement(_Dropdown["default"], {
|
|
173
|
+
isOpen: showItemsList,
|
|
174
|
+
targetRef: containerRef,
|
|
175
|
+
items: filteredItems,
|
|
176
|
+
emptyText: notFoundText,
|
|
177
|
+
onItemClick: handleSelect,
|
|
178
|
+
onClose: handleDropdownClose,
|
|
179
|
+
classes: {
|
|
180
|
+
list: classes === null || classes === void 0 ? void 0 : classes.list,
|
|
181
|
+
item: classes === null || classes === void 0 ? void 0 : classes.listItem
|
|
182
|
+
},
|
|
183
|
+
dataAttrs: {
|
|
184
|
+
list: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.list,
|
|
185
|
+
item: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.listItem
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
var renderItemTag = function renderItemTag(item, i) {
|
|
190
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
|
|
191
|
+
key: item.value,
|
|
192
|
+
className: cn('tag', [classes === null || classes === void 0 ? void 0 : classes.tag])
|
|
193
|
+
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.tag, i + 1)), /*#__PURE__*/React.createElement("span", {
|
|
194
|
+
className: cn('tag-title')
|
|
195
|
+
}, item.title), /*#__PURE__*/React.createElement("button", (0, _extends2["default"])({
|
|
196
|
+
className: cn('tag-button', [classes === null || classes === void 0 ? void 0 : classes.tagButton])
|
|
197
|
+
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.tagButton, i + 1), {
|
|
198
|
+
type: "button",
|
|
199
|
+
disabled: disabled,
|
|
200
|
+
onClick: removeSelectedItem(item)
|
|
201
|
+
}), /*#__PURE__*/React.createElement(ClearIcon, {
|
|
202
|
+
className: cn('tag-button-icon')
|
|
203
|
+
})));
|
|
204
|
+
};
|
|
205
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
|
|
206
|
+
className: cn({
|
|
207
|
+
open: showItemsList,
|
|
208
|
+
disabled: disabled
|
|
209
|
+
}, [className, classes.root])
|
|
210
|
+
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement("div", {
|
|
211
|
+
className: cn('control', {
|
|
212
|
+
active: isSelectActive
|
|
213
|
+
}),
|
|
214
|
+
ref: containerRef
|
|
215
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
216
|
+
className: cn('input-container')
|
|
217
|
+
}, currentSelectedItems === null || currentSelectedItems === void 0 ? void 0 : currentSelectedItems.map(function (item, i) {
|
|
218
|
+
return renderItemTag(item, i);
|
|
219
|
+
}), isSelectActive && /*#__PURE__*/React.createElement("input", (0, _extends2["default"])({
|
|
220
|
+
className: cn('input', [classes.input])
|
|
221
|
+
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input), {
|
|
222
|
+
id: "search",
|
|
223
|
+
placeholder: placeholder,
|
|
224
|
+
value: searchQuery,
|
|
225
|
+
maxLength: maxLength,
|
|
226
|
+
disabled: disabled,
|
|
227
|
+
onChange: handleInputChange,
|
|
228
|
+
onFocus: handleFocus,
|
|
229
|
+
onBlur: handleBlur,
|
|
230
|
+
type: "text",
|
|
231
|
+
autoComplete: "off",
|
|
232
|
+
ref: inputRef
|
|
233
|
+
}))), /*#__PURE__*/React.createElement("button", {
|
|
234
|
+
className: cn('arrow-button'),
|
|
235
|
+
type: "button",
|
|
236
|
+
disabled: !isSelectActive || disabled,
|
|
237
|
+
onClick: handleToggleDropdown
|
|
238
|
+
}, /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
239
|
+
className: cn('arrow-icon')
|
|
240
|
+
})), renderList()), noticeText && /*#__PURE__*/React.createElement("div", {
|
|
241
|
+
className: cn('notice-text')
|
|
242
|
+
}, noticeText));
|
|
243
|
+
};
|
|
244
|
+
var _default = exports["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}
|
|
@@ -52,7 +52,7 @@ var Row = function Row(_ref) {
|
|
|
52
52
|
var ElementType = href ? 'a' : 'div';
|
|
53
53
|
var isActive = !showLoader && (!!href || !!onClick);
|
|
54
54
|
var isSmallSize = size === 'small';
|
|
55
|
-
var isGraySimpleIcon = !isIconColored && (backgroundView === 'stroke' || backgroundView === 'shadow');
|
|
55
|
+
var isGraySimpleIcon = !isIconColored && (backgroundView === 'stroke' || backgroundView === 'shadow' || backgroundView === 'white');
|
|
56
56
|
var _useResolution = (0, _useResolution2["default"])(),
|
|
57
57
|
isMobile = _useResolution.isMobile;
|
|
58
58
|
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
|
/** Наличие кнопки-крестика "Закрыть" */
|
|
@@ -107,6 +107,10 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
107
107
|
_ref$size = _ref.size,
|
|
108
108
|
size = _ref$size === void 0 ? 'big' : _ref$size,
|
|
109
109
|
buttonText = _ref.buttonText,
|
|
110
|
+
buttonHref = _ref.buttonHref,
|
|
111
|
+
_ref$buttonTarget = _ref.buttonTarget,
|
|
112
|
+
buttonTarget = _ref$buttonTarget === void 0 ? '_self' : _ref$buttonTarget,
|
|
113
|
+
buttonRel = _ref.buttonRel,
|
|
110
114
|
hasCloseButton = _ref.hasCloseButton,
|
|
111
115
|
_ref$colorTheme = _ref.colorTheme,
|
|
112
116
|
theme = _ref$colorTheme === void 0 ? 'white' : _ref$colorTheme,
|
|
@@ -325,25 +329,34 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
325
329
|
var renderedFullContent = useMemo(function () {
|
|
326
330
|
var hasButtonMargin = !!title || !!text;
|
|
327
331
|
var hasChildrenMargin = hasButtonMargin || !!buttonText;
|
|
332
|
+
var isLink = !!buttonHref;
|
|
333
|
+
var ButtonElementType = isLink ? 'a' : 'button';
|
|
334
|
+
var linkProps = {
|
|
335
|
+
href: buttonHref,
|
|
336
|
+
target: buttonTarget,
|
|
337
|
+
rel: buttonRel,
|
|
338
|
+
onClick: onClick
|
|
339
|
+
};
|
|
340
|
+
var buttonProps = {
|
|
341
|
+
onClick: onClick,
|
|
342
|
+
type: 'button'
|
|
343
|
+
};
|
|
328
344
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !!title && /*#__PURE__*/React.createElement(_Header["default"], {
|
|
329
345
|
className: cn('title'),
|
|
330
346
|
as: "h5",
|
|
331
347
|
space: "tight"
|
|
332
|
-
}, title), !!text && renderedText, !!buttonText && /*#__PURE__*/React.createElement(
|
|
333
|
-
type: "button",
|
|
348
|
+
}, title), !!text && renderedText, !!buttonText && /*#__PURE__*/React.createElement(ButtonElementType, (0, _extends2["default"])({
|
|
334
349
|
className: cn('button', {
|
|
335
350
|
margin: hasButtonMargin
|
|
336
351
|
}, [buttonClassName])
|
|
337
|
-
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button), {
|
|
338
|
-
onClick: onClick
|
|
339
|
-
}), buttonText, /*#__PURE__*/React.createElement(RightArrow, {
|
|
352
|
+
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button), isLink ? linkProps : buttonProps), buttonText, /*#__PURE__*/React.createElement(RightArrow, {
|
|
340
353
|
className: cn('button-arrow')
|
|
341
354
|
})), !!children && /*#__PURE__*/React.createElement("div", {
|
|
342
355
|
className: cn('addititonal-content', {
|
|
343
356
|
margin: hasChildrenMargin
|
|
344
357
|
})
|
|
345
358
|
}, children));
|
|
346
|
-
}, [title, text, buttonText,
|
|
359
|
+
}, [title, text, buttonText, buttonHref, buttonTarget, buttonRel, onClick, renderedText, buttonClassName, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button, children]);
|
|
347
360
|
var template = /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
348
361
|
className: cn({
|
|
349
362
|
theme: theme,
|
package/dist/lib/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/lib/index.js
CHANGED
|
@@ -69,6 +69,12 @@ Object.defineProperty(exports, "Chip", {
|
|
|
69
69
|
return _Chip["default"];
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
+
Object.defineProperty(exports, "ChipBadge", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function get() {
|
|
75
|
+
return _ChipBadge["default"];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
72
78
|
Object.defineProperty(exports, "ChipSuggest", {
|
|
73
79
|
enumerable: true,
|
|
74
80
|
get: function get() {
|
|
@@ -243,6 +249,12 @@ Object.defineProperty(exports, "Month", {
|
|
|
243
249
|
return _Month["default"];
|
|
244
250
|
}
|
|
245
251
|
});
|
|
252
|
+
Object.defineProperty(exports, "MultipleSelect", {
|
|
253
|
+
enumerable: true,
|
|
254
|
+
get: function get() {
|
|
255
|
+
return _MultipleSelect["default"];
|
|
256
|
+
}
|
|
257
|
+
});
|
|
246
258
|
Object.defineProperty(exports, "NavArrow", {
|
|
247
259
|
enumerable: true,
|
|
248
260
|
get: function get() {
|
|
@@ -561,6 +573,7 @@ var _Carousel = _interopRequireDefault(require("./components/Carousel/Carousel")
|
|
|
561
573
|
var _Checkbox = _interopRequireDefault(require("./components/Checkbox/Checkbox"));
|
|
562
574
|
var _checkBreakpointsPropTypes = _interopRequireDefault(require("./components/Carousel/checkBreakpointsPropTypes"));
|
|
563
575
|
var _Chip = _interopRequireDefault(require("./components/Chips/Chips/Chip"));
|
|
576
|
+
var _ChipBadge = _interopRequireDefault(require("./components/Chips/Chips/ChipBadge"));
|
|
564
577
|
var _Chips = _interopRequireDefault(require("./components/Chips/Chips/Chips"));
|
|
565
578
|
var _ChipsDropdown = _interopRequireDefault(require("./components/Chips/Chips/components/ChipsDropdown/ChipsDropdown"));
|
|
566
579
|
var _ChipsScrollPanel = _interopRequireDefault(require("./components/Chips/Chips/components/ChipsScrollPanel/ChipsScrollPanel"));
|
|
@@ -591,6 +604,7 @@ var _ModalContent = _interopRequireDefault(require("./components/Modal/_ModalCon
|
|
|
591
604
|
var _ModalDesktop = _interopRequireDefault(require("./components/Modal/_ModalDesktop/ModalDesktop"));
|
|
592
605
|
var _ModalMobile = _interopRequireDefault(require("./components/Modal/_ModalMobile/ModalMobile"));
|
|
593
606
|
var _Month = _interopRequireDefault(require("./components/Calendar/components/_Month/Month"));
|
|
607
|
+
var _MultipleSelect = _interopRequireDefault(require("./components/MultipleSelect/MultipleSelect"));
|
|
594
608
|
var _NavArrow = _interopRequireDefault(require("./components/NavArrow/NavArrow"));
|
|
595
609
|
var _Notification = _interopRequireDefault(require("./components/Notification/Notification"));
|
|
596
610
|
var _NotificationBadge = _interopRequireDefault(require("./components/Badges/NotificationBadge/NotificationBadge"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@megafon/ui-core",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"styles"
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"simplebar-react": "^3.2.5",
|
|
105
105
|
"swiper": "^12.1.2"
|
|
106
106
|
},
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "e090c9565de565ddb498c09b2ae596972996828c"
|
|
108
108
|
}
|