@salutejs/plasma-new-hope 0.336.0-canary.2220.17591054284.0 → 0.336.0-canary.2222.17612018746.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/cjs/components/Autocomplete/Autocomplete.css +0 -2
- package/cjs/components/Combobox/ComboboxNew/Combobox.css +0 -2
- package/cjs/components/Combobox/ComboboxNew/Combobox.js +50 -27
- package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/hooks/getPathMaps.js +4 -1
- package/cjs/components/Combobox/ComboboxNew/hooks/getPathMaps.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/utils/getRemovedElement.js +17 -0
- package/cjs/components/Combobox/ComboboxNew/utils/getRemovedElement.js.map +1 -0
- package/cjs/components/DatePicker/RangeDate/RangeDate.css +0 -2
- package/cjs/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +0 -2
- package/cjs/components/DatePicker/SingleDate/SingleDate.css +0 -2
- package/cjs/components/Drawer/Drawer.css +2 -2
- package/cjs/components/Drawer/Drawer.js +10 -7
- package/cjs/components/Drawer/Drawer.js.map +1 -1
- package/cjs/components/Drawer/Drawer.styles.js +10 -2
- package/cjs/components/Drawer/Drawer.styles.js.map +1 -1
- package/cjs/components/Drawer/{Drawer.styles_h5od79.css → Drawer.styles_pltzxq.css} +1 -1
- package/cjs/components/Drawer/Drawer.tokens.js +10 -0
- package/cjs/components/Drawer/Drawer.tokens.js.map +1 -1
- package/cjs/components/Pagination/Pagination.css +0 -2
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +0 -2
- package/cjs/components/Range/Range.css +0 -2
- package/cjs/components/Select/Select.css +0 -2
- package/cjs/components/Select/ui/Target/Target.css +0 -2
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.css +0 -2
- package/cjs/components/Slider/Slider.css +0 -2
- package/cjs/components/Slider/components/DoubleUncontrolled/DoubleUncontrolled.css +0 -2
- package/cjs/components/Table/Table.css +0 -2
- package/cjs/components/Table/ui/Cell/Cell.css +0 -2
- package/cjs/components/Table/ui/EditableCell/EditableCell.css +0 -2
- package/cjs/components/Table/ui/HeadCell/HeadCell.css +0 -2
- package/cjs/components/Table/ui/HeadCell/ui/Filter/Filter.css +0 -2
- package/cjs/components/TextField/TextField.js +3 -14
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/engines/common.js +11 -1
- package/cjs/engines/common.js.map +1 -1
- package/cjs/index.css +2 -4
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +58 -26
- package/emotion/cjs/components/Combobox/ComboboxNew/hooks/getPathMaps.js +5 -2
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/getRemovedElement.js +20 -0
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/index.js +4 -0
- package/emotion/cjs/components/Drawer/Drawer.js +13 -4
- package/emotion/cjs/components/Drawer/Drawer.styles.js +7 -4
- package/emotion/cjs/components/Drawer/Drawer.tokens.js +12 -0
- package/emotion/cjs/components/TextField/TextField.js +4 -16
- package/emotion/cjs/components/TextField/ui/index.js +3 -12
- package/emotion/cjs/engines/common.js +14 -1
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +59 -27
- package/emotion/es/components/Combobox/ComboboxNew/hooks/getPathMaps.js +5 -2
- package/emotion/es/components/Combobox/ComboboxNew/utils/getRemovedElement.js +10 -0
- package/emotion/es/components/Combobox/ComboboxNew/utils/index.js +1 -0
- package/emotion/es/components/Drawer/Drawer.js +9 -5
- package/emotion/es/components/Drawer/Drawer.styles.js +8 -5
- package/emotion/es/components/Drawer/Drawer.tokens.js +9 -0
- package/emotion/es/components/TextField/TextField.js +5 -17
- package/emotion/es/components/TextField/ui/index.js +0 -1
- package/emotion/es/engines/common.js +14 -1
- package/es/components/Autocomplete/Autocomplete.css +0 -2
- package/es/components/Combobox/ComboboxNew/Combobox.css +0 -2
- package/es/components/Combobox/ComboboxNew/Combobox.js +51 -28
- package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/hooks/getPathMaps.js +4 -1
- package/es/components/Combobox/ComboboxNew/hooks/getPathMaps.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/utils/getRemovedElement.js +13 -0
- package/es/components/Combobox/ComboboxNew/utils/getRemovedElement.js.map +1 -0
- package/es/components/DatePicker/RangeDate/RangeDate.css +0 -2
- package/es/components/DatePicker/RangeDate/RangeDatePopover/RangeDatePopover.css +0 -2
- package/es/components/DatePicker/SingleDate/SingleDate.css +0 -2
- package/es/components/Drawer/Drawer.css +2 -2
- package/es/components/Drawer/Drawer.js +8 -6
- package/es/components/Drawer/Drawer.js.map +1 -1
- package/es/components/Drawer/Drawer.styles.js +10 -2
- package/es/components/Drawer/Drawer.styles.js.map +1 -1
- package/es/components/Drawer/{Drawer.styles_h5od79.css → Drawer.styles_pltzxq.css} +1 -1
- package/es/components/Drawer/Drawer.tokens.js +10 -1
- package/es/components/Drawer/Drawer.tokens.js.map +1 -1
- package/es/components/Pagination/Pagination.css +0 -2
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +0 -2
- package/es/components/Range/Range.css +0 -2
- package/es/components/Select/Select.css +0 -2
- package/es/components/Select/ui/Target/Target.css +0 -2
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.css +0 -2
- package/es/components/Slider/Slider.css +0 -2
- package/es/components/Slider/components/DoubleUncontrolled/DoubleUncontrolled.css +0 -2
- package/es/components/Table/Table.css +0 -2
- package/es/components/Table/ui/Cell/Cell.css +0 -2
- package/es/components/Table/ui/EditableCell/EditableCell.css +0 -2
- package/es/components/Table/ui/HeadCell/HeadCell.css +0 -2
- package/es/components/Table/ui/HeadCell/ui/Filter/Filter.css +0 -2
- package/es/components/TextField/TextField.js +3 -14
- package/es/components/TextField/TextField.js.map +1 -1
- package/es/engines/common.js +12 -2
- package/es/engines/common.js.map +1 -1
- package/es/index.css +2 -4
- package/package.json +2 -2
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +58 -26
- package/styled-components/cjs/components/Combobox/ComboboxNew/hooks/getPathMaps.js +5 -2
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/getRemovedElement.js +20 -0
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/index.js +4 -0
- package/styled-components/cjs/components/Drawer/Drawer.js +13 -4
- package/styled-components/cjs/components/Drawer/Drawer.styles.js +14 -4
- package/styled-components/cjs/components/Drawer/Drawer.tokens.js +12 -0
- package/styled-components/cjs/components/TextField/TextField.js +3 -15
- package/styled-components/cjs/components/TextField/ui/index.js +3 -12
- package/styled-components/cjs/engines/common.js +14 -1
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +59 -27
- package/styled-components/es/components/Combobox/ComboboxNew/hooks/getPathMaps.js +5 -2
- package/styled-components/es/components/Combobox/ComboboxNew/utils/getRemovedElement.js +10 -0
- package/styled-components/es/components/Combobox/ComboboxNew/utils/index.js +1 -0
- package/styled-components/es/components/Drawer/Drawer.js +9 -5
- package/styled-components/es/components/Drawer/Drawer.styles.js +15 -5
- package/styled-components/es/components/Drawer/Drawer.tokens.js +9 -0
- package/styled-components/es/components/TextField/TextField.js +4 -16
- package/styled-components/es/components/TextField/ui/index.js +0 -1
- package/styled-components/es/engines/common.js +14 -1
- package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/hooks/getPathMaps.d.ts +2 -1
- package/types/components/Combobox/ComboboxNew/hooks/getPathMaps.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/utils/getRemovedElement.d.ts +2 -0
- package/types/components/Combobox/ComboboxNew/utils/getRemovedElement.d.ts.map +1 -0
- package/types/components/Combobox/ComboboxNew/utils/index.d.ts +1 -0
- package/types/components/Combobox/ComboboxNew/utils/index.d.ts.map +1 -1
- package/types/components/Drawer/Drawer.d.ts +2 -0
- package/types/components/Drawer/Drawer.d.ts.map +1 -1
- package/types/components/Drawer/Drawer.styles.d.ts +2 -1
- package/types/components/Drawer/Drawer.styles.d.ts.map +1 -1
- package/types/components/Drawer/Drawer.tokens.d.ts +9 -0
- package/types/components/Drawer/Drawer.tokens.d.ts.map +1 -1
- package/types/components/Drawer/Drawer.types.d.ts +16 -0
- package/types/components/Drawer/Drawer.types.d.ts.map +1 -1
- package/types/components/NumberFormat/NumberFormat.d.ts.map +1 -1
- package/types/components/NumberFormat/NumberFormat.types.d.ts +1 -1
- package/types/components/TextField/TextField.d.ts.map +1 -1
- package/types/components/TextField/TextField.types.d.ts +2 -2
- package/types/components/TextField/ui/index.d.ts +0 -1
- package/types/components/TextField/ui/index.d.ts.map +1 -1
- package/types/engines/common.d.ts.map +1 -1
- package/types/examples/components/Drawer/Drawer.d.ts +1 -0
- package/types/examples/components/Drawer/Drawer.d.ts.map +1 -1
- package/types/examples/components/NumberFormat/NumberFormat.d.ts.map +1 -1
- package/cjs/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.css +0 -54
- package/cjs/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.js +0 -74
- package/cjs/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.js.map +0 -1
- package/cjs/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.styles.js +0 -25
- package/cjs/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.styles.js.map +0 -1
- package/cjs/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.styles_119gtz1.css +0 -1
- package/emotion/cjs/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.js +0 -69
- package/emotion/cjs/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.styles.js +0 -32
- package/emotion/es/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.js +0 -54
- package/emotion/es/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.styles.js +0 -18
- package/es/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.css +0 -54
- package/es/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.js +0 -66
- package/es/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.js.map +0 -1
- package/es/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.styles.js +0 -21
- package/es/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.styles.js.map +0 -1
- package/es/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.styles_119gtz1.css +0 -1
- package/styled-components/cjs/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.js +0 -69
- package/styled-components/cjs/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.styles.js +0 -87
- package/styled-components/es/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.js +0 -54
- package/styled-components/es/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.styles.js +0 -73
- package/types/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.d.ts +0 -19
- package/types/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.d.ts.map +0 -1
- package/types/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.styles.d.ts +0 -2
- package/types/components/TextField/ui/TextFieldChipNew/TextFieldChipNew.styles.d.ts.map +0 -1
@@ -42,14 +42,16 @@ var getPathMap = function(items) {
|
|
42
42
|
var getTreeMaps = function(items) {
|
43
43
|
var valueToCheckedMap = new Map();
|
44
44
|
var valueToItemMap = new Map();
|
45
|
+
var labelToItemMap = new Map();
|
45
46
|
var rec = function(items) {
|
46
47
|
var prevIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
|
47
48
|
items === null || items === void 0 ? void 0 : items.forEach(function(item, index) {
|
48
|
-
var value = item.value, innerItems = item.items;
|
49
|
+
var value = item.value, label = item.label, innerItems = item.items;
|
49
50
|
var currIndex = "".concat(prevIndex, "/").concat(index).replace(/^(\/)/, '');
|
50
51
|
valueToCheckedMap.set(value, false);
|
51
52
|
if ((0, _utils.isEmpty)(innerItems) || !innerItems) {
|
52
53
|
valueToItemMap.set(value, item);
|
54
|
+
labelToItemMap.set(label, item);
|
53
55
|
} else {
|
54
56
|
rec(innerItems, currIndex);
|
55
57
|
}
|
@@ -58,6 +60,7 @@ var getTreeMaps = function(items) {
|
|
58
60
|
rec(items);
|
59
61
|
return [
|
60
62
|
valueToCheckedMap,
|
61
|
-
valueToItemMap
|
63
|
+
valueToItemMap,
|
64
|
+
labelToItemMap
|
62
65
|
];
|
63
66
|
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
// Утилита для определения какой чип был удален
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "getRemovedElement", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function() {
|
9
|
+
return getRemovedElement;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
var getRemovedElement = function(prevValues, newValues) {
|
13
|
+
var isTargetAmount = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
14
|
+
if (isTargetAmount) {
|
15
|
+
return null;
|
16
|
+
}
|
17
|
+
return prevValues.filter(function(item) {
|
18
|
+
return !newValues.includes(item);
|
19
|
+
})[0] || null;
|
20
|
+
};
|
@@ -15,6 +15,9 @@ _export(exports, {
|
|
15
15
|
get getItemId () {
|
16
16
|
return _getItemId.getItemId;
|
17
17
|
},
|
18
|
+
get getRemovedElement () {
|
19
|
+
return _getRemovedElement.getRemovedElement;
|
20
|
+
},
|
18
21
|
get getTextValue () {
|
19
22
|
return _getTextValue.getTextValue;
|
20
23
|
},
|
@@ -41,4 +44,5 @@ var _updateSingleAncestors = require("./updateSingleAncestors");
|
|
41
44
|
var _sizeToIconSize = require("./sizeToIconSize");
|
42
45
|
var _filterItems = require("./filterItems");
|
43
46
|
var _getItemId = require("./getItemId");
|
47
|
+
var _getRemovedElement = require("./getRemovedElement");
|
44
48
|
var _getTextValue = require("./getTextValue");
|
@@ -17,6 +17,7 @@ _export(exports, {
|
|
17
17
|
}
|
18
18
|
});
|
19
19
|
var _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
20
|
+
var _classnames = /*#__PURE__*/ _interop_require_default(require("classnames"));
|
20
21
|
var _plasmacore = require("@salutejs/plasma-core");
|
21
22
|
var _utils = require("../../utils");
|
22
23
|
var _Popup = require("../Popup");
|
@@ -43,6 +44,11 @@ function _define_property(obj, key, value) {
|
|
43
44
|
}
|
44
45
|
return obj;
|
45
46
|
}
|
47
|
+
function _interop_require_default(obj) {
|
48
|
+
return obj && obj.__esModule ? obj : {
|
49
|
+
default: obj
|
50
|
+
};
|
51
|
+
}
|
46
52
|
function _getRequireWildcardCache(nodeInterop) {
|
47
53
|
if (typeof WeakMap !== "function") return null;
|
48
54
|
var cacheBabelInterop = new WeakMap();
|
@@ -128,7 +134,7 @@ function _object_without_properties_loose(source, excluded) {
|
|
128
134
|
}
|
129
135
|
var drawerRoot = function(Root) {
|
130
136
|
return /*#__PURE__*/ (0, _react.forwardRef)(function(_param, outerRef) {
|
131
|
-
var id = _param.id, zIndex = _param.zIndex, popupInfo = _param.popupInfo, withBlur = _param.withBlur, children = _param.children, view = _param.view, size = _param.size, width = _param.width, height = _param.height, isOpen = _param.isOpen, opened = _param.opened, initialFocusRef = _param.initialFocusRef, focusAfterRef = _param.focusAfterRef, className = _param.className, customBackgroundColor = _param.customBackgroundColor, customContentBackgroundColor = _param.customContentBackgroundColor, onClose = _param.onClose, onOverlayClick = _param.onOverlayClick, onEscKeyDown = _param.onEscKeyDown, offset = _param.offset, frame = _param.frame, _param_borderRadius = _param.borderRadius, borderRadius = _param_borderRadius === void 0 ? 'none' : _param_borderRadius, _param_placement = _param.placement, placement = _param_placement === void 0 ? 'right' : _param_placement, _param_closeOnEsc = _param.closeOnEsc, closeOnEsc = _param_closeOnEsc === void 0 ? true : _param_closeOnEsc, _param_closeOnOverlayClick = _param.closeOnOverlayClick, closeOnOverlayClick = _param_closeOnOverlayClick === void 0 ? true : _param_closeOnOverlayClick, _param_asModal = _param.asModal, asModal = _param_asModal === void 0 ? true : _param_asModal, draggable = _param.draggable, rest = _object_without_properties(_param, [
|
137
|
+
var id = _param.id, zIndex = _param.zIndex, popupInfo = _param.popupInfo, withBlur = _param.withBlur, children = _param.children, view = _param.view, size = _param.size, width = _param.width, height = _param.height, isOpen = _param.isOpen, opened = _param.opened, initialFocusRef = _param.initialFocusRef, focusAfterRef = _param.focusAfterRef, animationInfo = _param.animationInfo, className = _param.className, customBackgroundColor = _param.customBackgroundColor, customContentBackgroundColor = _param.customContentBackgroundColor, onClose = _param.onClose, onOverlayClick = _param.onOverlayClick, onEscKeyDown = _param.onEscKeyDown, offset = _param.offset, frame = _param.frame, _param_borderRadius = _param.borderRadius, borderRadius = _param_borderRadius === void 0 ? 'none' : _param_borderRadius, _param_placement = _param.placement, placement = _param_placement === void 0 ? 'right' : _param_placement, _param_closeOnEsc = _param.closeOnEsc, closeOnEsc = _param_closeOnEsc === void 0 ? true : _param_closeOnEsc, _param_closeOnOverlayClick = _param.closeOnOverlayClick, closeOnOverlayClick = _param_closeOnOverlayClick === void 0 ? true : _param_closeOnOverlayClick, _param_asModal = _param.asModal, asModal = _param_asModal === void 0 ? true : _param_asModal, draggable = _param.draggable, rest = _object_without_properties(_param, [
|
132
138
|
"id",
|
133
139
|
"zIndex",
|
134
140
|
"popupInfo",
|
@@ -142,6 +148,7 @@ var drawerRoot = function(Root) {
|
|
142
148
|
"opened",
|
143
149
|
"initialFocusRef",
|
144
150
|
"focusAfterRef",
|
151
|
+
"animationInfo",
|
145
152
|
"className",
|
146
153
|
"customBackgroundColor",
|
147
154
|
"customContentBackgroundColor",
|
@@ -191,10 +198,11 @@ var drawerRoot = function(Root) {
|
|
191
198
|
onClose();
|
192
199
|
}
|
193
200
|
};
|
201
|
+
var _obj;
|
194
202
|
return /*#__PURE__*/ _react.default.createElement(_Drawerstyles.StyledPopup, _object_spread({
|
195
203
|
id: innerId,
|
196
204
|
ref: asModal ? innerRef : outerRef,
|
197
|
-
className: (0,
|
205
|
+
className: (0, _classnames.default)(placementClass, className, (_obj = {}, _define_property(_obj, _Drawertokens.classes.enterCustomAnimation, animationInfo === null || animationInfo === void 0 ? void 0 : animationInfo.enter), _define_property(_obj, _Drawertokens.classes.exitCustomAnimation, animationInfo === null || animationInfo === void 0 ? void 0 : animationInfo.exit), _obj)),
|
198
206
|
opened: innerIsOpen,
|
199
207
|
zIndex: zIndex,
|
200
208
|
placement: placement,
|
@@ -204,6 +212,7 @@ var drawerRoot = function(Root) {
|
|
204
212
|
height: innerHeight,
|
205
213
|
offset: offset,
|
206
214
|
withAnimation: true,
|
215
|
+
drawerAnimationInfo: animationInfo,
|
207
216
|
overlay: asModal && /*#__PURE__*/ _react.default.createElement(Root, {
|
208
217
|
view: view
|
209
218
|
}, /*#__PURE__*/ _react.default.createElement(_Overlay.Overlay, {
|
@@ -216,6 +225,7 @@ var drawerRoot = function(Root) {
|
|
216
225
|
onOverlayClick: onDrawerOverlayKeyDown
|
217
226
|
}))
|
218
227
|
}, rest), /*#__PURE__*/ _react.default.createElement(Root, {
|
228
|
+
className: _Drawertokens.classes.panel,
|
219
229
|
view: view,
|
220
230
|
size: size,
|
221
231
|
style: {
|
@@ -227,8 +237,7 @@ var drawerRoot = function(Root) {
|
|
227
237
|
width: innerWidth,
|
228
238
|
height: innerHeight,
|
229
239
|
customBackgroundColor: customBackgroundColor,
|
230
|
-
customContentBackgroundColor: customContentBackgroundColor
|
231
|
-
className: className
|
240
|
+
customContentBackgroundColor: customContentBackgroundColor
|
232
241
|
}, children)));
|
233
242
|
});
|
234
243
|
};
|
@@ -82,7 +82,7 @@ var getAnimationStyles = function() {
|
|
82
82
|
};
|
83
83
|
var StyledPanel = (0, _styledcomponents.default)(Panel).withConfig({
|
84
84
|
displayName: "Drawer.styles__StyledPanel",
|
85
|
-
componentId: "sc-
|
85
|
+
componentId: "sc-5f1f6af-0"
|
86
86
|
})([
|
87
87
|
"",
|
88
88
|
":var(",
|
@@ -90,7 +90,7 @@ var StyledPanel = (0, _styledcomponents.default)(Panel).withConfig({
|
|
90
90
|
], _Panel.panelTokens.closeColor, _Drawertokens.tokens.closeIconColor);
|
91
91
|
var StyledPopup = (0, _styledcomponents.default)(Popup).withConfig({
|
92
92
|
displayName: "Drawer.styles__StyledPopup",
|
93
|
-
componentId: "sc-
|
93
|
+
componentId: "sc-5f1f6af-1"
|
94
94
|
})([
|
95
95
|
"&&.",
|
96
96
|
"{animation:fadeIn 0.2s forwards;scrollbar-gutter:stable;}&&.",
|
@@ -100,11 +100,21 @@ var StyledPopup = (0, _styledcomponents.default)(Popup).withConfig({
|
|
100
100
|
" > div{width:",
|
101
101
|
";height:",
|
102
102
|
";}",
|
103
|
-
""
|
103
|
+
" &.",
|
104
|
+
"{&& .",
|
105
|
+
"{animation:",
|
106
|
+
";}}&.",
|
107
|
+
"{&&.",
|
108
|
+
" .",
|
109
|
+
"{animation:var(",
|
110
|
+
");}}"
|
104
111
|
], _Drawertokens.classes.overlay, _Popup.popupClasses.endAnimation, _Drawertokens.classes.overlay, _Popup.popupClasses.root, _Popup.popupClasses.root, function(param) {
|
105
112
|
var width = param.width;
|
106
113
|
return width || 'auto';
|
107
114
|
}, function(param) {
|
108
115
|
var height = param.height;
|
109
116
|
return height || 'auto';
|
110
|
-
}, getAnimationStyles())
|
117
|
+
}, getAnimationStyles(), _Drawertokens.classes.enterCustomAnimation, _Popup.popupClasses.root, function(param) {
|
118
|
+
var drawerAnimationInfo = param.drawerAnimationInfo;
|
119
|
+
return (drawerAnimationInfo === null || drawerAnimationInfo === void 0 ? void 0 : drawerAnimationInfo.enter) || "var(".concat(_Drawertokens.privateTokens.enterAnimation, ")");
|
120
|
+
}, _Drawertokens.classes.exitCustomAnimation, _Popup.popupClasses.endAnimation, _Popup.popupClasses.root, _Drawertokens.privateTokens.customExitAnimation);
|
@@ -12,6 +12,9 @@ _export(exports, {
|
|
12
12
|
get classes () {
|
13
13
|
return classes;
|
14
14
|
},
|
15
|
+
get privateTokens () {
|
16
|
+
return privateTokens;
|
17
|
+
},
|
15
18
|
get tokens () {
|
16
19
|
return tokens;
|
17
20
|
}
|
@@ -21,6 +24,9 @@ var classes = {
|
|
21
24
|
header: 'drawer-header',
|
22
25
|
footer: 'drawer-footer',
|
23
26
|
overlay: 'drawer-overlay',
|
27
|
+
panel: 'drawer-panel',
|
28
|
+
enterCustomAnimation: 'drawer-enter-custom-animation',
|
29
|
+
exitCustomAnimation: 'drawer-exit-custom-animation',
|
24
30
|
horizontal: 'drawer-horizontal',
|
25
31
|
hasHeader: 'drawer-has-header',
|
26
32
|
isRightClose: 'drawer-right-close-button',
|
@@ -29,6 +35,12 @@ var classes = {
|
|
29
35
|
rightPlacement: 'drawer-right-placement',
|
30
36
|
leftPlacement: 'drawer-left-placement'
|
31
37
|
};
|
38
|
+
var privateTokens = {
|
39
|
+
enterAnimation: '--plasma__private-drawer-enter-animation',
|
40
|
+
exitAnimation: '--plasma__private-drawer-exit-animation',
|
41
|
+
customEnterAnimation: '--plasma__private-drawer-custom-enter-animation',
|
42
|
+
customExitAnimation: '--plasma__private-drawer-custom-exit-animation'
|
43
|
+
};
|
32
44
|
var tokens = {
|
33
45
|
drawerOverlayWithBlurColor: '--plasma-drawer-overlay-with-blur-color',
|
34
46
|
drawerOverlayColor: '--plasma-drawer-overlay-color',
|
@@ -195,9 +195,7 @@ var textFieldRoot = function(Root) {
|
|
195
195
|
contentLeft = _param.contentLeft, contentRight = _param.contentRight, label = _param.label, labelPlacement = _param.labelPlacement, keepPlaceholder = _param.keepPlaceholder, textBefore = _param.textBefore, textAfter = _param.textAfter, placeholder = _param.placeholder, leftHelper = _param.leftHelper, _param_enumerationType = _param.enumerationType, enumerationType = _param_enumerationType === void 0 ? 'plain' : _param_enumerationType, _param_requiredPlacement = _param.requiredPlacement, requiredPlacement = _param_requiredPlacement === void 0 ? 'right' : _param_requiredPlacement, _param_hasRequiredIndicator = _param.hasRequiredIndicator, hasRequiredIndicator = _param_hasRequiredIndicator === void 0 ? true : _param_hasRequiredIndicator, titleCaption = _param.titleCaption, _param_chipView = _param.chipView, chipView = _param_chipView === void 0 ? 'default' : _param_chipView, chipValidator = _param.chipValidator, _param_hintTrigger = _param.// hint
|
196
196
|
hintTrigger, hintTrigger = _param_hintTrigger === void 0 ? 'hover' : _param_hintTrigger, hintText = _param.hintText, _param_hintView = _param.hintView, hintView = _param_hintView === void 0 ? 'default' : _param_hintView, _param_hintSize = _param.hintSize, hintSize = _param_hintSize === void 0 ? 'm' : _param_hintSize, hintTargetIcon = _param.hintTargetIcon, _param_hintTargetPlacement = _param.hintTargetPlacement, hintTargetPlacement = _param_hintTargetPlacement === void 0 ? 'outer' : _param_hintTargetPlacement, _param_hintPlacement = _param.hintPlacement, hintPlacement = _param_hintPlacement === void 0 ? 'auto' : _param_hintPlacement, hintHasArrow = _param.hintHasArrow, _param_hintOffset = _param.hintOffset, hintOffset = _param_hintOffset === void 0 ? HINT_DEFAULT_OFFSET : _param_hintOffset, hintWidth = _param.hintWidth, hintContentLeft = _param.hintContentLeft, // variations
|
197
197
|
view = _param.view, size = _param.size, _param_readOnly = _param.readOnly, readOnly = _param_readOnly === void 0 ? false : _param_readOnly, _param_disabled = _param.disabled, disabled = _param_disabled === void 0 ? false : _param_disabled, _param_required = _param.required, required = _param_required === void 0 ? false : _param_required, _param_clear = _param.clear, clear = _param_clear === void 0 ? false : _param_clear, optional = _param.optional, hasDivider = _param.hasDivider, // controlled
|
198
|
-
outerValue = _param.value, values = _param.chips, _param_chipType = _param.chipType, chipType = _param_chipType === void 0 ? 'default' : _param_chipType, //
|
199
|
-
_chips = _param._chips, // @ts-ignore
|
200
|
-
_onChipClick = _param._onChipClick, // events
|
198
|
+
outerValue = _param.value, values = _param.chips, _param_chipType = _param.chipType, chipType = _param_chipType === void 0 ? 'default' : _param_chipType, // events
|
201
199
|
onChange = _param.onChange, onChangeChips = _param.onChangeChips, onSearch = _param.onSearch, onKeyDown = _param.onKeyDown, onFocus = _param.onFocus, onBlur = _param.onBlur, onPaste = _param.onPaste, // Пропсы для внутреннего использования, не отдается наружу.
|
202
200
|
// @ts-ignore
|
203
201
|
_onEnterDisabled = _param._onEnterDisabled, // @ts-ignore
|
@@ -242,8 +240,6 @@ var textFieldRoot = function(Root) {
|
|
242
240
|
"value",
|
243
241
|
"chips",
|
244
242
|
"chipType",
|
245
|
-
"_chips",
|
246
|
-
"_onChipClick",
|
247
243
|
"onChange",
|
248
244
|
"onChangeChips",
|
249
245
|
"onSearch",
|
@@ -275,7 +271,7 @@ var textFieldRoot = function(Root) {
|
|
275
271
|
var helperTextId = (0, _utils.safeUseId)();
|
276
272
|
var isDefaultView = view === 'default' || readOnly || disabled;
|
277
273
|
var isChipEnumeration = enumerationType === 'chip';
|
278
|
-
var isChipsVisible = isChipEnumeration && Boolean(
|
274
|
+
var isChipsVisible = isChipEnumeration && Boolean(chips === null || chips === void 0 ? void 0 : chips.length);
|
279
275
|
var withHasChips = isChipsVisible ? _TextFieldtokens.classes.hasChips : undefined;
|
280
276
|
var hasLabelValue = Boolean(label);
|
281
277
|
var hasInnerLabel = size !== 'xs' && labelPlacement === 'inner' && !isChipsVisible && hasLabelValue;
|
@@ -530,15 +526,7 @@ var textFieldRoot = function(Root) {
|
|
530
526
|
ref: contentRef,
|
531
527
|
onKeyDown: handleContentKeyDown,
|
532
528
|
className: withHasChips
|
533
|
-
}, Boolean(textBefore && isChipEnumeration) && /*#__PURE__*/ _react.default.createElement(_TextFieldstyles.StyledTextBefore, null, textBefore), Boolean(
|
534
|
-
chips: _chips,
|
535
|
-
onChipClick: _onChipClick,
|
536
|
-
getRef: getRef,
|
537
|
-
handleChipKeyDown: handleChipKeyDown,
|
538
|
-
onChipClear: onChipClear,
|
539
|
-
view: view,
|
540
|
-
readOnly: readOnly
|
541
|
-
}), isChipEnumeration && Boolean(chips === null || chips === void 0 ? void 0 : chips.length) && /*#__PURE__*/ _react.default.createElement(_TextFieldstyles.StyledChips, {
|
529
|
+
}, Boolean(textBefore && isChipEnumeration) && /*#__PURE__*/ _react.default.createElement(_TextFieldstyles.StyledTextBefore, null, textBefore), isChipEnumeration && Boolean(chips === null || chips === void 0 ? void 0 : chips.length) && /*#__PURE__*/ _react.default.createElement(_TextFieldstyles.StyledChips, {
|
542
530
|
className: _TextFieldtokens.classes.chipsWrapper
|
543
531
|
}, chips === null || chips === void 0 ? void 0 : chips.map(function(param, index) {
|
544
532
|
var chipId = param.id, text = param.text;
|
@@ -2,19 +2,10 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
9
|
-
});
|
10
|
-
}
|
11
|
-
_export(exports, {
|
12
|
-
get TextFieldChip () {
|
5
|
+
Object.defineProperty(exports, "TextFieldChip", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
13
8
|
return _TextFieldChip.TextFieldChip;
|
14
|
-
},
|
15
|
-
get TextFieldChipNew () {
|
16
|
-
return _TextFieldChipNew.TextFieldChipNew;
|
17
9
|
}
|
18
10
|
});
|
19
11
|
var _TextFieldChip = require("./TextFieldChip/TextFieldChip");
|
20
|
-
var _TextFieldChipNew = require("./TextFieldChipNew/TextFieldChipNew");
|
@@ -99,10 +99,23 @@ var mergeConfig = function(baseConfig, userConfig) {
|
|
99
99
|
}
|
100
100
|
return res;
|
101
101
|
};
|
102
|
+
// INFO: Метод, который проводит слияние двух объектов
|
103
|
+
// INFO: если значение явно указанно как undefined/null/пустая строка, то будет взято значение указанное в default
|
104
|
+
function mergeWithoutNullable(defaults, componentProps) {
|
105
|
+
var props = Object.keys(defaults).reduce(function(acc, key) {
|
106
|
+
return _object_spread_props(_object_spread({}, acc), _define_property({}, key, [
|
107
|
+
null,
|
108
|
+
undefined,
|
109
|
+
''
|
110
|
+
].includes(componentProps[key]) ? defaults[key] : componentProps[key]));
|
111
|
+
}, {});
|
112
|
+
return _object_spread({}, componentProps, props);
|
113
|
+
}
|
102
114
|
function component(config) {
|
103
115
|
var Comp = config.layout((0, _styledcomponents._component)(config));
|
104
116
|
return /*#__PURE__*/ _react.default.forwardRef(function(props, ref) {
|
105
|
-
|
117
|
+
var mergedProps = mergeWithoutNullable(config === null || config === void 0 ? void 0 : config.defaults, props);
|
118
|
+
return /*#__PURE__*/ _react.default.createElement(Comp, _object_spread_props(_object_spread({}, mergedProps), {
|
106
119
|
ref: ref
|
107
120
|
}));
|
108
121
|
});
|
@@ -6,6 +6,9 @@ function _array_like_to_array(arr, len) {
|
|
6
6
|
function _array_with_holes(arr) {
|
7
7
|
if (Array.isArray(arr)) return arr;
|
8
8
|
}
|
9
|
+
function _array_without_holes(arr) {
|
10
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
11
|
+
}
|
9
12
|
function _define_property(obj, key, value) {
|
10
13
|
if (key in obj) {
|
11
14
|
Object.defineProperty(obj, key, {
|
@@ -19,6 +22,9 @@ function _define_property(obj, key, value) {
|
|
19
22
|
}
|
20
23
|
return obj;
|
21
24
|
}
|
25
|
+
function _iterable_to_array(iter) {
|
26
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
27
|
+
}
|
22
28
|
function _iterable_to_array_limit(arr, i) {
|
23
29
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
24
30
|
if (_i == null) return;
|
@@ -46,6 +52,9 @@ function _iterable_to_array_limit(arr, i) {
|
|
46
52
|
function _non_iterable_rest() {
|
47
53
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
48
54
|
}
|
55
|
+
function _non_iterable_spread() {
|
56
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
57
|
+
}
|
49
58
|
function _object_spread(target) {
|
50
59
|
for(var i = 1; i < arguments.length; i++){
|
51
60
|
var source = arguments[i] != null ? arguments[i] : {};
|
@@ -115,6 +124,9 @@ function _object_without_properties_loose(source, excluded) {
|
|
115
124
|
function _sliced_to_array(arr, i) {
|
116
125
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
117
126
|
}
|
127
|
+
function _to_consumable_array(arr) {
|
128
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
129
|
+
}
|
118
130
|
function _type_of(obj) {
|
119
131
|
"@swc/helpers - typeof";
|
120
132
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
@@ -135,7 +147,7 @@ import { sizeToIconSize } from "../../Select/utils";
|
|
135
147
|
import { classes } from "./Combobox.tokens";
|
136
148
|
import { FloatingPopover } from "./FloatingPopover";
|
137
149
|
import { useKeyNavigation, getItemByFocused } from "./hooks/useKeyboardNavigation";
|
138
|
-
import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, filterItems, getItemId, getTextValue } from "./utils";
|
150
|
+
import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, filterItems, getItemId, getRemovedElement, getTextValue } from "./utils";
|
139
151
|
import { Inner, StyledTextField, VirtualList, SelectAll } from "./ui";
|
140
152
|
import { pathReducer, focusedPathReducer } from "./reducers";
|
141
153
|
import { getPathMap, getTreeMaps } from "./hooks/getPathMaps";
|
@@ -206,7 +218,7 @@ import { Context } from "./Combobox.context";
|
|
206
218
|
return getTreeMaps(transformedItems);
|
207
219
|
}, [
|
208
220
|
items
|
209
|
-
]),
|
221
|
+
]), 3), valueToCheckedMap = _useMemo[0], valueToItemMap = _useMemo[1], labelToItemMap = _useMemo[2];
|
210
222
|
var _useState = _sliced_to_array(useState(getTextValue(multiple, outerValue, valueToItemMap, renderValue)), 2), textValue = _useState[0], setTextValue = _useState[1];
|
211
223
|
var _useState1 = _sliced_to_array(useState(multiple ? [] : ''), 2), internalValue = _useState1[0], setInternalValue = _useState1[1];
|
212
224
|
var value = outerValue !== null && outerValue !== undefined ? outerValue : internalValue;
|
@@ -294,14 +306,39 @@ import { Context } from "./Combobox.context";
|
|
294
306
|
}
|
295
307
|
};
|
296
308
|
// Обработчик чипов
|
297
|
-
var
|
309
|
+
var handleChipsChange = function(chipLabels) {
|
298
310
|
if (!Array.isArray(value)) return;
|
299
|
-
|
300
|
-
|
311
|
+
// TODO: #1564
|
312
|
+
// Из лейблов чипов получаем value у item и далее прокидываем его в onChange.
|
313
|
+
if (renderValue && !isTargetAmount) {
|
314
|
+
var resultValues = _to_consumable_array(value);
|
315
|
+
value.forEach(function(_, index) {
|
316
|
+
var _valueToItemMap_get;
|
317
|
+
var stringValue = value[index];
|
318
|
+
var label = (_valueToItemMap_get = valueToItemMap.get(stringValue)) === null || _valueToItemMap_get === void 0 ? void 0 : _valueToItemMap_get.label;
|
319
|
+
var labelAfterRenderValue = renderValue(label ? labelToItemMap.get(label) : {
|
320
|
+
value: stringValue,
|
321
|
+
label: stringValue.toString()
|
322
|
+
});
|
323
|
+
if (!chipLabels.includes(labelAfterRenderValue)) {
|
324
|
+
resultValues.splice(index, 1);
|
325
|
+
}
|
326
|
+
});
|
327
|
+
var removedItemValue = getRemovedElement(value, resultValues, isTargetAmount);
|
328
|
+
onChange(resultValues, removedItemValue ? valueToItemMap.get(removedItemValue) || {
|
329
|
+
value: removedItemValue,
|
330
|
+
label: removedItemValue.toString()
|
331
|
+
} : null);
|
301
332
|
} else {
|
302
|
-
|
303
|
-
|
304
|
-
|
333
|
+
var newValues = chipLabels.map(function(chipLabel) {
|
334
|
+
var _labelToItemMap_get;
|
335
|
+
return ((_labelToItemMap_get = labelToItemMap.get(chipLabel)) === null || _labelToItemMap_get === void 0 ? void 0 : _labelToItemMap_get.value) || chipLabel;
|
336
|
+
});
|
337
|
+
var removedItemValue1 = getRemovedElement(value, newValues, isTargetAmount);
|
338
|
+
onChange(newValues, removedItemValue1 ? valueToItemMap.get(removedItemValue1) || {
|
339
|
+
value: removedItemValue1,
|
340
|
+
label: removedItemValue1.toString()
|
341
|
+
} : null);
|
305
342
|
}
|
306
343
|
};
|
307
344
|
// Обработчик открытия/закрытия выпадающего списка
|
@@ -405,25 +442,20 @@ import { Context } from "./Combobox.context";
|
|
405
442
|
if (value.length === 0) return [];
|
406
443
|
if (isTargetAmount) {
|
407
444
|
return [
|
408
|
-
|
409
|
-
value: '_removeAll',
|
410
|
-
label: "Выбрано ".concat(targetAmount || value.length),
|
411
|
-
disabled: false
|
412
|
-
}
|
445
|
+
"Выбрано ".concat(targetAmount || value.length)
|
413
446
|
];
|
414
447
|
}
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
});
|
448
|
+
var renderValueMapper = renderValue && function(stringValue) {
|
449
|
+
return renderValue(valueToItemMap.get(stringValue) || {
|
450
|
+
value: stringValue,
|
451
|
+
label: stringValue.toString()
|
452
|
+
});
|
453
|
+
};
|
454
|
+
var valueToItemMapper = function(stringValue) {
|
455
|
+
var _valueToItemMap_get;
|
456
|
+
return ((_valueToItemMap_get = valueToItemMap.get(stringValue)) === null || _valueToItemMap_get === void 0 ? void 0 : _valueToItemMap_get.label) || stringValue.toString();
|
457
|
+
};
|
458
|
+
return value.map(renderValueMapper || valueToItemMapper);
|
427
459
|
}
|
428
460
|
return [];
|
429
461
|
};
|
@@ -580,8 +612,8 @@ import { Context } from "./Combobox.context";
|
|
580
612
|
keepPlaceholder: keepPlaceholder
|
581
613
|
}, multiple ? {
|
582
614
|
enumerationType: 'chip',
|
583
|
-
|
584
|
-
|
615
|
+
chips: getChips(),
|
616
|
+
onChangeChips: handleChipsChange
|
585
617
|
} : {
|
586
618
|
enumerationType: 'plain'
|
587
619
|
}, rest), {
|
@@ -24,14 +24,16 @@ export var getPathMap = function(items) {
|
|
24
24
|
export var getTreeMaps = function(items) {
|
25
25
|
var valueToCheckedMap = new Map();
|
26
26
|
var valueToItemMap = new Map();
|
27
|
+
var labelToItemMap = new Map();
|
27
28
|
var rec = function(items) {
|
28
29
|
var prevIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
|
29
30
|
items === null || items === void 0 ? void 0 : items.forEach(function(item, index) {
|
30
|
-
var value = item.value, innerItems = item.items;
|
31
|
+
var value = item.value, label = item.label, innerItems = item.items;
|
31
32
|
var currIndex = "".concat(prevIndex, "/").concat(index).replace(/^(\/)/, '');
|
32
33
|
valueToCheckedMap.set(value, false);
|
33
34
|
if (isEmpty(innerItems) || !innerItems) {
|
34
35
|
valueToItemMap.set(value, item);
|
36
|
+
labelToItemMap.set(label, item);
|
35
37
|
} else {
|
36
38
|
rec(innerItems, currIndex);
|
37
39
|
}
|
@@ -40,6 +42,7 @@ export var getTreeMaps = function(items) {
|
|
40
42
|
rec(items);
|
41
43
|
return [
|
42
44
|
valueToCheckedMap,
|
43
|
-
valueToItemMap
|
45
|
+
valueToItemMap,
|
46
|
+
labelToItemMap
|
44
47
|
];
|
45
48
|
};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
// Утилита для определения какой чип был удален
|
2
|
+
export var getRemovedElement = function(prevValues, newValues) {
|
3
|
+
var isTargetAmount = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
4
|
+
if (isTargetAmount) {
|
5
|
+
return null;
|
6
|
+
}
|
7
|
+
return prevValues.filter(function(item) {
|
8
|
+
return !newValues.includes(item);
|
9
|
+
})[0] || null;
|
10
|
+
};
|
@@ -5,4 +5,5 @@ export { updateSingleAncestors } from "./updateSingleAncestors";
|
|
5
5
|
export { sizeToIconSize } from "./sizeToIconSize";
|
6
6
|
export { filterItems } from "./filterItems";
|
7
7
|
export { getItemId } from "./getItemId";
|
8
|
+
export { getRemovedElement } from "./getRemovedElement";
|
8
9
|
export { getTextValue } from "./getTextValue";
|
@@ -54,8 +54,9 @@ function _object_without_properties_loose(source, excluded) {
|
|
54
54
|
return target;
|
55
55
|
}
|
56
56
|
import React, { forwardRef, useMemo } from "react";
|
57
|
+
import cls from "classnames";
|
57
58
|
import { useForkRef } from "@salutejs/plasma-core";
|
58
|
-
import {
|
59
|
+
import { getSizeValueFromProp, safeUseId } from "../../utils";
|
59
60
|
import { usePopupContext } from "../Popup";
|
60
61
|
import { Overlay } from "../Overlay";
|
61
62
|
import { DEFAULT_Z_INDEX } from "../Popup/utils";
|
@@ -70,7 +71,7 @@ import { useDrawer } from "./hooks";
|
|
70
71
|
// issue #823
|
71
72
|
export var drawerRoot = function(Root) {
|
72
73
|
return /*#__PURE__*/ forwardRef(function(_param, outerRef) {
|
73
|
-
var id = _param.id, zIndex = _param.zIndex, popupInfo = _param.popupInfo, withBlur = _param.withBlur, children = _param.children, view = _param.view, size = _param.size, width = _param.width, height = _param.height, isOpen = _param.isOpen, opened = _param.opened, initialFocusRef = _param.initialFocusRef, focusAfterRef = _param.focusAfterRef, className = _param.className, customBackgroundColor = _param.customBackgroundColor, customContentBackgroundColor = _param.customContentBackgroundColor, onClose = _param.onClose, onOverlayClick = _param.onOverlayClick, onEscKeyDown = _param.onEscKeyDown, offset = _param.offset, frame = _param.frame, _param_borderRadius = _param.borderRadius, borderRadius = _param_borderRadius === void 0 ? 'none' : _param_borderRadius, _param_placement = _param.placement, placement = _param_placement === void 0 ? 'right' : _param_placement, _param_closeOnEsc = _param.closeOnEsc, closeOnEsc = _param_closeOnEsc === void 0 ? true : _param_closeOnEsc, _param_closeOnOverlayClick = _param.closeOnOverlayClick, closeOnOverlayClick = _param_closeOnOverlayClick === void 0 ? true : _param_closeOnOverlayClick, _param_asModal = _param.asModal, asModal = _param_asModal === void 0 ? true : _param_asModal, draggable = _param.draggable, rest = _object_without_properties(_param, [
|
74
|
+
var id = _param.id, zIndex = _param.zIndex, popupInfo = _param.popupInfo, withBlur = _param.withBlur, children = _param.children, view = _param.view, size = _param.size, width = _param.width, height = _param.height, isOpen = _param.isOpen, opened = _param.opened, initialFocusRef = _param.initialFocusRef, focusAfterRef = _param.focusAfterRef, animationInfo = _param.animationInfo, className = _param.className, customBackgroundColor = _param.customBackgroundColor, customContentBackgroundColor = _param.customContentBackgroundColor, onClose = _param.onClose, onOverlayClick = _param.onOverlayClick, onEscKeyDown = _param.onEscKeyDown, offset = _param.offset, frame = _param.frame, _param_borderRadius = _param.borderRadius, borderRadius = _param_borderRadius === void 0 ? 'none' : _param_borderRadius, _param_placement = _param.placement, placement = _param_placement === void 0 ? 'right' : _param_placement, _param_closeOnEsc = _param.closeOnEsc, closeOnEsc = _param_closeOnEsc === void 0 ? true : _param_closeOnEsc, _param_closeOnOverlayClick = _param.closeOnOverlayClick, closeOnOverlayClick = _param_closeOnOverlayClick === void 0 ? true : _param_closeOnOverlayClick, _param_asModal = _param.asModal, asModal = _param_asModal === void 0 ? true : _param_asModal, draggable = _param.draggable, rest = _object_without_properties(_param, [
|
74
75
|
"id",
|
75
76
|
"zIndex",
|
76
77
|
"popupInfo",
|
@@ -84,6 +85,7 @@ export var drawerRoot = function(Root) {
|
|
84
85
|
"opened",
|
85
86
|
"initialFocusRef",
|
86
87
|
"focusAfterRef",
|
88
|
+
"animationInfo",
|
87
89
|
"className",
|
88
90
|
"customBackgroundColor",
|
89
91
|
"customContentBackgroundColor",
|
@@ -133,10 +135,11 @@ export var drawerRoot = function(Root) {
|
|
133
135
|
onClose();
|
134
136
|
}
|
135
137
|
};
|
138
|
+
var _obj;
|
136
139
|
return /*#__PURE__*/ React.createElement(StyledPopup, _object_spread({
|
137
140
|
id: innerId,
|
138
141
|
ref: asModal ? innerRef : outerRef,
|
139
|
-
className:
|
142
|
+
className: cls(placementClass, className, (_obj = {}, _define_property(_obj, classes.enterCustomAnimation, animationInfo === null || animationInfo === void 0 ? void 0 : animationInfo.enter), _define_property(_obj, classes.exitCustomAnimation, animationInfo === null || animationInfo === void 0 ? void 0 : animationInfo.exit), _obj)),
|
140
143
|
opened: innerIsOpen,
|
141
144
|
zIndex: zIndex,
|
142
145
|
placement: placement,
|
@@ -146,6 +149,7 @@ export var drawerRoot = function(Root) {
|
|
146
149
|
height: innerHeight,
|
147
150
|
offset: offset,
|
148
151
|
withAnimation: true,
|
152
|
+
drawerAnimationInfo: animationInfo,
|
149
153
|
overlay: asModal && /*#__PURE__*/ React.createElement(Root, {
|
150
154
|
view: view
|
151
155
|
}, /*#__PURE__*/ React.createElement(Overlay, {
|
@@ -158,6 +162,7 @@ export var drawerRoot = function(Root) {
|
|
158
162
|
onOverlayClick: onDrawerOverlayKeyDown
|
159
163
|
}))
|
160
164
|
}, rest), /*#__PURE__*/ React.createElement(Root, {
|
165
|
+
className: classes.panel,
|
161
166
|
view: view,
|
162
167
|
size: size,
|
163
168
|
style: {
|
@@ -169,8 +174,7 @@ export var drawerRoot = function(Root) {
|
|
169
174
|
width: innerWidth,
|
170
175
|
height: innerHeight,
|
171
176
|
customBackgroundColor: customBackgroundColor,
|
172
|
-
customContentBackgroundColor: customContentBackgroundColor
|
173
|
-
className: className
|
177
|
+
customContentBackgroundColor: customContentBackgroundColor
|
174
178
|
}, children)));
|
175
179
|
});
|
176
180
|
};
|
@@ -2,7 +2,7 @@ import styled from "styled-components";
|
|
2
2
|
import { component, mergeConfig } from "../../engines";
|
3
3
|
import { popupClasses, popupConfig } from "../Popup";
|
4
4
|
import { panelTokens, panelConfig } from "../Panel";
|
5
|
-
import { classes, tokens } from "./Drawer.tokens";
|
5
|
+
import { classes, privateTokens, tokens } from "./Drawer.tokens";
|
6
6
|
var mergedPanelConfig = mergeConfig(panelConfig);
|
7
7
|
var Panel = component(mergedPanelConfig);
|
8
8
|
var Popup = component(popupConfig);
|
@@ -59,7 +59,7 @@ var getAnimationStyles = function() {
|
|
59
59
|
};
|
60
60
|
export var StyledPanel = styled(Panel).withConfig({
|
61
61
|
displayName: "Drawer.styles__StyledPanel",
|
62
|
-
componentId: "sc-
|
62
|
+
componentId: "sc-5f1f6af-0"
|
63
63
|
})([
|
64
64
|
"",
|
65
65
|
":var(",
|
@@ -67,7 +67,7 @@ export var StyledPanel = styled(Panel).withConfig({
|
|
67
67
|
], panelTokens.closeColor, tokens.closeIconColor);
|
68
68
|
export var StyledPopup = styled(Popup).withConfig({
|
69
69
|
displayName: "Drawer.styles__StyledPopup",
|
70
|
-
componentId: "sc-
|
70
|
+
componentId: "sc-5f1f6af-1"
|
71
71
|
})([
|
72
72
|
"&&.",
|
73
73
|
"{animation:fadeIn 0.2s forwards;scrollbar-gutter:stable;}&&.",
|
@@ -77,11 +77,21 @@ export var StyledPopup = styled(Popup).withConfig({
|
|
77
77
|
" > div{width:",
|
78
78
|
";height:",
|
79
79
|
";}",
|
80
|
-
""
|
80
|
+
" &.",
|
81
|
+
"{&& .",
|
82
|
+
"{animation:",
|
83
|
+
";}}&.",
|
84
|
+
"{&&.",
|
85
|
+
" .",
|
86
|
+
"{animation:var(",
|
87
|
+
");}}"
|
81
88
|
], classes.overlay, popupClasses.endAnimation, classes.overlay, popupClasses.root, popupClasses.root, function(param) {
|
82
89
|
var width = param.width;
|
83
90
|
return width || 'auto';
|
84
91
|
}, function(param) {
|
85
92
|
var height = param.height;
|
86
93
|
return height || 'auto';
|
87
|
-
}, getAnimationStyles())
|
94
|
+
}, getAnimationStyles(), classes.enterCustomAnimation, popupClasses.root, function(param) {
|
95
|
+
var drawerAnimationInfo = param.drawerAnimationInfo;
|
96
|
+
return (drawerAnimationInfo === null || drawerAnimationInfo === void 0 ? void 0 : drawerAnimationInfo.enter) || "var(".concat(privateTokens.enterAnimation, ")");
|
97
|
+
}, classes.exitCustomAnimation, popupClasses.endAnimation, popupClasses.root, privateTokens.customExitAnimation);
|