@salutejs/plasma-new-hope 0.174.0-canary.1505.11518120718.0 → 0.174.0-dev.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -27
- package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -9
- package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
- package/cjs/components/Drawer/Drawer.js +2 -1
- package/cjs/components/Drawer/Drawer.js.map +1 -1
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
- package/cjs/components/Select/Select.js +25 -13
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
- package/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/cjs/components/Select/utils/getButtonLabel.js.map +1 -1
- package/cjs/components/Select/utils/initialItemsTransform.js +6 -9
- package/cjs/components/Select/utils/initialItemsTransform.js.map +1 -1
- package/cjs/components/ViewContainer/ViewContainer.js +38 -0
- package/cjs/components/ViewContainer/ViewContainer.js.map +1 -0
- package/cjs/components/ViewContainer/ViewContainer_yiqfcb.css +1 -0
- package/cjs/components/ViewContainer/_view/base.js +9 -0
- package/cjs/components/ViewContainer/_view/base.js.map +1 -0
- package/cjs/components/ViewContainer/_view/base_x642ct.css +1 -0
- package/cjs/index.css +2 -0
- package/cjs/index.js +3 -0
- package/cjs/index.js.map +1 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -26
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/index.js +1 -8
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
- package/emotion/cjs/components/Drawer/Drawer.js +4 -3
- package/emotion/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/emotion/cjs/components/Select/Select.js +25 -12
- package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
- package/emotion/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/emotion/cjs/components/Select/utils/index.js +1 -8
- package/emotion/cjs/components/Select/utils/initialItemsTransform.js +6 -19
- package/emotion/cjs/components/ViewContainer/ViewContainer.js +49 -0
- package/emotion/cjs/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
- package/emotion/cjs/components/ViewContainer/_view/base.js +8 -0
- package/emotion/cjs/components/ViewContainer/_view/tokens.json +1 -0
- package/emotion/cjs/components/ViewContainer/index.js +18 -0
- package/emotion/cjs/examples/_helpers.js +3 -14
- package/emotion/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
- package/emotion/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +16 -0
- package/emotion/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +11 -0
- package/emotion/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/emotion/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
- package/emotion/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +16 -0
- package/emotion/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.js +11 -0
- package/emotion/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/emotion/cjs/index.js +11 -0
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +23 -27
- package/emotion/es/components/Combobox/ComboboxNew/utils/index.js +1 -2
- package/emotion/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
- package/emotion/es/components/Drawer/Drawer.js +2 -1
- package/emotion/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/emotion/es/components/Select/Select.js +26 -13
- package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
- package/emotion/es/components/Select/utils/getButtonLabel.js +1 -1
- package/emotion/es/components/Select/utils/index.js +1 -2
- package/emotion/es/components/Select/utils/initialItemsTransform.js +6 -19
- package/emotion/es/components/ViewContainer/ViewContainer.js +40 -0
- package/emotion/es/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
- package/emotion/es/components/ViewContainer/_view/base.js +2 -0
- package/emotion/es/components/ViewContainer/_view/tokens.json +1 -0
- package/emotion/es/components/ViewContainer/index.js +1 -0
- package/emotion/es/examples/_helpers.js +3 -14
- package/emotion/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
- package/emotion/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +10 -0
- package/emotion/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +5 -0
- package/emotion/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/emotion/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
- package/emotion/es/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +10 -0
- package/emotion/es/examples/plasma_web/components/ViewContainer/ViewContainer.js +5 -0
- package/emotion/es/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/emotion/es/index.js +2 -1
- package/es/components/Combobox/ComboboxNew/Combobox.js +22 -27
- package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -9
- package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
- package/es/components/Drawer/Drawer.js +2 -1
- package/es/components/Drawer/Drawer.js.map +1 -1
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
- package/es/components/Select/Select.js +26 -14
- package/es/components/Select/Select.js.map +1 -1
- package/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
- package/es/components/Select/utils/getButtonLabel.js +1 -1
- package/es/components/Select/utils/getButtonLabel.js.map +1 -1
- package/es/components/Select/utils/initialItemsTransform.js +6 -9
- package/es/components/Select/utils/initialItemsTransform.js.map +1 -1
- package/es/components/ViewContainer/ViewContainer.js +33 -0
- package/es/components/ViewContainer/ViewContainer.js.map +1 -0
- package/es/components/ViewContainer/ViewContainer_yiqfcb.css +1 -0
- package/es/components/ViewContainer/_view/base.js +5 -0
- package/es/components/ViewContainer/_view/base.js.map +1 -0
- package/es/components/ViewContainer/_view/base_x642ct.css +1 -0
- package/es/index.css +2 -0
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/package.json +3 -2
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -26
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/index.js +1 -8
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
- package/styled-components/cjs/components/Drawer/Drawer.js +4 -3
- package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/styled-components/cjs/components/Select/Select.js +25 -12
- package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/styled-components/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/styled-components/cjs/components/Select/utils/index.js +1 -8
- package/styled-components/cjs/components/Select/utils/initialItemsTransform.js +6 -19
- package/styled-components/cjs/components/ViewContainer/ViewContainer.js +40 -0
- package/styled-components/cjs/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
- package/styled-components/cjs/components/ViewContainer/_view/base.js +8 -0
- package/styled-components/cjs/components/ViewContainer/_view/tokens.json +1 -0
- package/styled-components/cjs/components/ViewContainer/index.js +18 -0
- package/styled-components/cjs/examples/_helpers.js +3 -14
- package/styled-components/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
- package/styled-components/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +16 -0
- package/styled-components/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +11 -0
- package/styled-components/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/styled-components/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
- package/styled-components/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +16 -0
- package/styled-components/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.js +11 -0
- package/styled-components/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/styled-components/cjs/index.js +11 -0
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +23 -27
- package/styled-components/es/components/Combobox/ComboboxNew/utils/index.js +1 -2
- package/styled-components/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
- package/styled-components/es/components/Drawer/Drawer.js +2 -1
- package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/styled-components/es/components/Select/Select.js +26 -13
- package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/styled-components/es/components/Select/utils/getButtonLabel.js +1 -1
- package/styled-components/es/components/Select/utils/index.js +1 -2
- package/styled-components/es/components/Select/utils/initialItemsTransform.js +6 -19
- package/styled-components/es/components/ViewContainer/ViewContainer.js +31 -0
- package/styled-components/es/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
- package/styled-components/es/components/ViewContainer/_view/base.js +2 -0
- package/styled-components/es/components/ViewContainer/_view/tokens.json +1 -0
- package/styled-components/es/components/ViewContainer/index.js +1 -0
- package/styled-components/es/examples/_helpers.js +3 -14
- package/styled-components/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
- package/styled-components/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +10 -0
- package/styled-components/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +5 -0
- package/styled-components/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/styled-components/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
- package/styled-components/es/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +10 -0
- package/styled-components/es/examples/plasma_web/components/ViewContainer/ViewContainer.js +5 -0
- package/styled-components/es/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
- package/styled-components/es/index.js +2 -1
- package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts +3 -14
- package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/utils/index.d.ts +0 -1
- package/types/components/Combobox/ComboboxNew/utils/index.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/utils/initialItemsTransform.d.ts.map +1 -1
- package/types/components/Drawer/Drawer.d.ts.map +1 -1
- package/types/components/Select/Select.d.ts.map +1 -1
- package/types/components/Select/Select.types.d.ts +0 -1
- package/types/components/Select/Select.types.d.ts.map +1 -1
- package/types/components/Select/hooks/useKeyboardNavigation.d.ts +2 -2
- package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
- package/types/components/Select/ui/Target/Target.types.d.ts +2 -2
- package/types/components/Select/ui/Target/Target.types.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts +4 -4
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
- package/types/components/Select/utils/index.d.ts +0 -1
- package/types/components/Select/utils/index.d.ts.map +1 -1
- package/types/components/Select/utils/initialItemsTransform.d.ts.map +1 -1
- package/types/components/ViewContainer/ViewContainer.d.ts +26 -0
- package/types/components/ViewContainer/ViewContainer.d.ts.map +1 -0
- package/types/components/ViewContainer/_view/base.d.ts +2 -0
- package/types/components/ViewContainer/_view/base.d.ts.map +1 -0
- package/types/components/ViewContainer/index.d.ts +2 -0
- package/types/components/ViewContainer/index.d.ts.map +1 -0
- package/types/examples/_helpers.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts +6 -30
- package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.d.ts +9 -0
- package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.d.ts +8 -0
- package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.d.ts.map +1 -0
- package/types/examples/plasma_web/components/Combobox/Combobox.d.ts +6 -30
- package/types/examples/plasma_web/components/Combobox/Combobox.d.ts.map +1 -1
- package/types/examples/plasma_web/components/ViewContainer/ViewContainer.config.d.ts +9 -0
- package/types/examples/plasma_web/components/ViewContainer/ViewContainer.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/ViewContainer/ViewContainer.d.ts +8 -0
- package/types/examples/plasma_web/components/ViewContainer/ViewContainer.d.ts.map +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -21
- package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +0 -1
- package/cjs/components/Select/utils/getInitialValue.js +0 -21
- package/cjs/components/Select/utils/getInitialValue.js.map +0 -1
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -20
- package/emotion/cjs/components/Select/utils/getInitialValue.js +0 -20
- package/emotion/cjs/examples/themes/declaration.d.ts +0 -4
- package/emotion/cjs/examples/themes/index.js +0 -15
- package/emotion/cjs/examples/themes/plasma_b2c.module.css +0 -984
- package/emotion/cjs/examples/themes/plasma_web.module.css +0 -984
- package/emotion/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -14
- package/emotion/es/components/Select/utils/getInitialValue.js +0 -14
- package/emotion/es/examples/themes/declaration.d.ts +0 -4
- package/emotion/es/examples/themes/index.js +0 -7
- package/emotion/es/examples/themes/plasma_b2c.module.css +0 -984
- package/emotion/es/examples/themes/plasma_web.module.css +0 -984
- package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -17
- package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +0 -1
- package/es/components/Select/utils/getInitialValue.js +0 -17
- package/es/components/Select/utils/getInitialValue.js.map +0 -1
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -20
- package/styled-components/cjs/components/Select/utils/getInitialValue.js +0 -20
- package/styled-components/cjs/examples/themes/declaration.d.ts +0 -4
- package/styled-components/cjs/examples/themes/index.js +0 -15
- package/styled-components/cjs/examples/themes/plasma_b2c.module.css +0 -984
- package/styled-components/cjs/examples/themes/plasma_web.module.css +0 -984
- package/styled-components/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -14
- package/styled-components/es/components/Select/utils/getInitialValue.js +0 -14
- package/styled-components/es/examples/themes/declaration.d.ts +0 -4
- package/styled-components/es/examples/themes/index.js +0 -7
- package/styled-components/es/examples/themes/plasma_b2c.module.css +0 -984
- package/styled-components/es/examples/themes/plasma_web.module.css +0 -984
- package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts +0 -4
- package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts.map +0 -1
- package/types/components/Select/utils/getInitialValue.d.ts +0 -4
- package/types/components/Select/utils/getInitialValue.d.ts.map +0 -1
- package/types/examples/themes/index.d.ts +0 -6
- package/types/examples/themes/index.d.ts.map +0 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["multiple", "value", "onChange", "isTargetAmount", "
|
1
|
+
var _excluded = ["multiple", "value", "onChange", "isTargetAmount", "items", "placement", "label", "placeholder", "helperText", "contentLeft", "textBefore", "textAfter", "variant", "listOverflow", "listHeight", "listWidth", "portal", "renderItem", "view", "size", "labelPlacement", "readOnly", "disabled", "alwaysOpened", "filter", "closeAfterSelect"];
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
4
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -16,7 +16,7 @@ import { sizeToIconSize } from '../../Select/utils';
|
|
16
16
|
import { classes } from './Combobox.tokens';
|
17
17
|
import { FloatingPopover } from './FloatingPopover';
|
18
18
|
import { useKeyNavigation, getItemByFocused } from './hooks/useKeyboardNavigation';
|
19
|
-
import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, filterItems, getItemId
|
19
|
+
import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, filterItems, getItemId } from './utils';
|
20
20
|
import { Inner, StyledTextField } from './ui';
|
21
21
|
import { pathReducer, focusedPathReducer } from './reducers';
|
22
22
|
import { getPathMap, getTreeMaps } from './hooks/getPathMaps';
|
@@ -35,7 +35,6 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
35
35
|
outerValue = props.value,
|
36
36
|
outerOnChange = props.onChange,
|
37
37
|
isTargetAmount = props.isTargetAmount,
|
38
|
-
targetAmount = props.targetAmount,
|
39
38
|
items = props.items,
|
40
39
|
_props$placement = props.placement,
|
41
40
|
placement = _props$placement === void 0 ? 'bottom-start' : _props$placement,
|
@@ -63,15 +62,10 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
63
62
|
alwaysOpened = _props$alwaysOpened === void 0 ? false : _props$alwaysOpened,
|
64
63
|
filter = props.filter,
|
65
64
|
outerCloseAfterSelect = props.closeAfterSelect,
|
66
|
-
renderValue = props.renderValue,
|
67
65
|
rest = _objectWithoutProperties(props, _excluded);
|
68
|
-
var transformedItems = useMemo(function () {
|
69
|
-
return initialItemsTransform(items || []);
|
70
|
-
}, [items]);
|
71
|
-
|
72
66
|
// Создаем структуры для быстрой работы с деревом
|
73
67
|
var _useMemo = useMemo(function () {
|
74
|
-
return getTreeMaps(
|
68
|
+
return getTreeMaps(items);
|
75
69
|
}, [items]),
|
76
70
|
_useMemo2 = _slicedToArray(_useMemo, 3),
|
77
71
|
valueToCheckedMap = _useMemo2[0],
|
@@ -85,11 +79,14 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
85
79
|
_useState4 = _slicedToArray(_useState3, 2),
|
86
80
|
internalValue = _useState4[0],
|
87
81
|
setInternalValue = _useState4[1];
|
88
|
-
var value = outerValue
|
82
|
+
var value = outerValue || internalValue;
|
89
83
|
var inputRef = useRef(null);
|
90
84
|
var floatingPopoverRef = useRef(null);
|
91
85
|
var inputForkRef = useForkRef(inputRef, ref);
|
92
86
|
var treeId = safeUseId();
|
87
|
+
var transformedItems = useMemo(function () {
|
88
|
+
return initialItemsTransform(items || []);
|
89
|
+
}, [items]);
|
93
90
|
var filteredItems = filterItems(transformedItems, textValue, (_valueToItemMap$get2 = valueToItemMap.get(value)) === null || _valueToItemMap$get2 === void 0 ? void 0 : _valueToItemMap$get2.label, filter);
|
94
91
|
var _useMemo3 = useMemo(function () {
|
95
92
|
return getPathMap(filteredItems);
|
@@ -256,7 +253,16 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
256
253
|
if (e) {
|
257
254
|
e.stopPropagation();
|
258
255
|
}
|
259
|
-
var
|
256
|
+
var checkedCopy = new Map(checked);
|
257
|
+
var isCurrentChecked = checkedCopy.get(item.value);
|
258
|
+
checkedCopy.forEach(function (_, key) {
|
259
|
+
checkedCopy.set(key, false);
|
260
|
+
});
|
261
|
+
if (!isCurrentChecked) {
|
262
|
+
checkedCopy.set(item.value, 'done');
|
263
|
+
updateSingleAncestors(item, checkedCopy, 'dot');
|
264
|
+
}
|
265
|
+
setTextValue(isCurrentChecked ? '' : item.label);
|
260
266
|
if (!alwaysOpened && closeAfterSelect) {
|
261
267
|
dispatchPath({
|
262
268
|
type: 'reset'
|
@@ -270,18 +276,14 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
270
276
|
}
|
271
277
|
};
|
272
278
|
var getChips = function getChips() {
|
273
|
-
if (multiple
|
279
|
+
if (multiple) {
|
274
280
|
if (value.length === 0) return [];
|
275
281
|
if (isTargetAmount) {
|
276
|
-
return ["\u0412\u044B\u0431\u0440\u0430\u043D\u043E ".concat(
|
282
|
+
return ["\u0412\u044B\u0431\u0440\u0430\u043D\u043E ".concat(value.length)];
|
277
283
|
}
|
278
|
-
|
279
|
-
return
|
280
|
-
};
|
281
|
-
var valueToItemMapper = function valueToItemMapper(stringValue) {
|
282
|
-
return valueToItemMap.get(stringValue).label;
|
283
|
-
};
|
284
|
-
return value.map(renderValueMapper || valueToItemMapper);
|
284
|
+
return value.map(function (value) {
|
285
|
+
return valueToItemMap.get(value).label;
|
286
|
+
});
|
285
287
|
}
|
286
288
|
return [];
|
287
289
|
};
|
@@ -309,7 +311,6 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
309
311
|
// В данном эффекте мы следим за изменениями value снаружи и вносим коррективы в дерево чекбоксов.
|
310
312
|
// Пример: когда юзер очистил value извне, тогда нужно пройтись по элементам и выключить все чекбоксы.
|
311
313
|
useLayoutEffect(function () {
|
312
|
-
var _valueToItemMap$get4;
|
313
314
|
var checkedCopy = new Map(checked);
|
314
315
|
checkedCopy.forEach(function (_, key) {
|
315
316
|
checkedCopy.set(key, false);
|
@@ -327,12 +328,7 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
327
328
|
}
|
328
329
|
}
|
329
330
|
setChecked(checkedCopy);
|
330
|
-
|
331
|
-
|
332
|
-
// В deps мы кладем именно outerValue и internalValue, а не просто value.
|
333
|
-
// Т.к. вначале нужно отфильтровать и провалидировать outerValue и результат положить в переменную.
|
334
|
-
// А переменную, содержащую сложные типы данных, нельзя помещать в deps.
|
335
|
-
}, [outerValue, internalValue, items]);
|
331
|
+
}, [value]);
|
336
332
|
return /*#__PURE__*/React.createElement(Root, {
|
337
333
|
size: size,
|
338
334
|
view: view,
|
@@ -4,5 +4,4 @@ export { updateAncestors } from './updateAncestors';
|
|
4
4
|
export { updateSingleAncestors } from './updateSingleAncestors';
|
5
5
|
export { sizeToIconSize } from './sizeToIconSize';
|
6
6
|
export { filterItems } from './filterItems';
|
7
|
-
export { getItemId } from './getItemId';
|
8
|
-
export { getInitialValue } from './getInitialValue';
|
7
|
+
export { getItemId } from './getItemId';
|
@@ -1,25 +1,11 @@
|
|
1
|
-
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); }
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
6
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
8
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
9
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
10
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
11
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
12
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
13
1
|
// Проходимся по массиву items и добавляем в каждый item ключ parent, который ссылается на item родителя.
|
14
2
|
// Дает возможность прохода к корневому элементу (снизу вверх).
|
15
|
-
// На выходе получаем глубокую копию исходного массива items.
|
16
3
|
export var initialItemsTransform = function initialItemsTransform(items, parent) {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
itemCopy.items = initialItemsTransform(itemCopy.items, itemCopy);
|
4
|
+
items.forEach(function (item) {
|
5
|
+
item.parent = parent;
|
6
|
+
if (item.items) {
|
7
|
+
item.items = initialItemsTransform(item.items, item);
|
22
8
|
}
|
23
|
-
return itemCopy;
|
24
9
|
});
|
10
|
+
return items;
|
25
11
|
};
|
@@ -3,13 +3,14 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
3
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
5
|
import React, { forwardRef, useMemo } from 'react';
|
6
|
-
import {
|
6
|
+
import { useForkRef, safeUseId } from '@salutejs/plasma-core';
|
7
7
|
import { component, mergeConfig } from '../../engines';
|
8
8
|
import { usePopupContext } from '../Popup';
|
9
9
|
import { Overlay } from '../Overlay';
|
10
10
|
import { DEFAULT_Z_INDEX } from '../Popup/utils';
|
11
11
|
import { panelConfig } from '../Panel';
|
12
12
|
import { cx, getSizeValueFromProp } from '../../utils';
|
13
|
+
import { useFocusTrap } from '../../hooks';
|
13
14
|
import { classes, tokens } from './Drawer.tokens';
|
14
15
|
import { base as viewCSS } from './variations/_view/base';
|
15
16
|
import { base as sizeCSS } from './variations/_size/base';
|
package/emotion/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js
CHANGED
@@ -17,8 +17,8 @@ export var PaginationSelectPerPage = function PaginationSelectPerPage(_ref) {
|
|
17
17
|
listWidth = _ref.listWidth,
|
18
18
|
rest = _objectWithoutProperties(_ref, _excluded);
|
19
19
|
var handleSelectChange = function handleSelectChange(newValue) {
|
20
|
-
if (newValue
|
21
|
-
onChangeValue(Number(newValue));
|
20
|
+
if (newValue) {
|
21
|
+
onChangeValue === null || onChangeValue === void 0 || onChangeValue(Number(newValue));
|
22
22
|
}
|
23
23
|
};
|
24
24
|
var transformedList = perPageList.map(function (num) {
|
@@ -12,7 +12,7 @@ import React, { forwardRef, useState, useReducer, useMemo, createContext, useLay
|
|
12
12
|
import { isEmpty, getPlacements } from '../../utils';
|
13
13
|
import { useOutsideClick } from '../../hooks';
|
14
14
|
import { useKeyNavigation } from './hooks/useKeyboardNavigation';
|
15
|
-
import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, getView
|
15
|
+
import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, getView } from './utils';
|
16
16
|
import { Inner, Target } from './ui';
|
17
17
|
import { pathReducer, focusedPathReducer, focusedChipIndexReducer } from './reducers';
|
18
18
|
import { usePathMaps } from './hooks/usePathMaps';
|
@@ -58,6 +58,17 @@ export var selectRoot = function selectRoot(Root) {
|
|
58
58
|
separator = props.separator,
|
59
59
|
outerCloseAfterSelect = props.closeAfterSelect,
|
60
60
|
rest = _objectWithoutProperties(props, _excluded);
|
61
|
+
var _useState = useState(outerValue || props.multiselect ? [] : ''),
|
62
|
+
_useState2 = _slicedToArray(_useState, 2),
|
63
|
+
internalValue = _useState2[0],
|
64
|
+
setInternalValue = _useState2[1];
|
65
|
+
var value = outerValue || internalValue;
|
66
|
+
var onChange = function onChange(e) {
|
67
|
+
if (outerOnChange) {
|
68
|
+
outerOnChange(e);
|
69
|
+
}
|
70
|
+
setInternalValue(e);
|
71
|
+
};
|
61
72
|
var transformedItems = useMemo(function () {
|
62
73
|
return initialItemsTransform(items || []);
|
63
74
|
}, [items]);
|
@@ -67,12 +78,6 @@ export var selectRoot = function selectRoot(Root) {
|
|
67
78
|
focusedToValueMap = _usePathMaps2[1],
|
68
79
|
valueToCheckedMap = _usePathMaps2[2],
|
69
80
|
valueToItemMap = _usePathMaps2[3];
|
70
|
-
var value = getInitialValue(outerValue, valueToItemMap);
|
71
|
-
var onChange = function onChange(e) {
|
72
|
-
if (outerOnChange) {
|
73
|
-
outerOnChange(e);
|
74
|
-
}
|
75
|
-
};
|
76
81
|
var _useReducer = useReducer(pathReducer, []),
|
77
82
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
78
83
|
path = _useReducer2[0],
|
@@ -85,10 +90,10 @@ export var selectRoot = function selectRoot(Root) {
|
|
85
90
|
_useReducer6 = _slicedToArray(_useReducer5, 2),
|
86
91
|
focusedChipIndex = _useReducer6[0],
|
87
92
|
dispatchFocusedChipIndex = _useReducer6[1];
|
88
|
-
var
|
89
|
-
|
90
|
-
checked =
|
91
|
-
setChecked =
|
93
|
+
var _useState3 = useState(valueToCheckedMap),
|
94
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
95
|
+
checked = _useState4[0],
|
96
|
+
setChecked = _useState4[1];
|
92
97
|
var closeAfterSelect = outerCloseAfterSelect !== null && outerCloseAfterSelect !== void 0 ? outerCloseAfterSelect : !props.multiselect;
|
93
98
|
var targetRef = useOutsideClick(function () {
|
94
99
|
if (focusedChipIndex != null) {
|
@@ -154,7 +159,15 @@ export var selectRoot = function selectRoot(Root) {
|
|
154
159
|
if (e) {
|
155
160
|
e.stopPropagation();
|
156
161
|
}
|
157
|
-
var
|
162
|
+
var checkedCopy = new Map(checked);
|
163
|
+
var isCurrentChecked = checkedCopy.get(item.value);
|
164
|
+
checkedCopy.forEach(function (_, key) {
|
165
|
+
checkedCopy.set(key, false);
|
166
|
+
});
|
167
|
+
if (!isCurrentChecked) {
|
168
|
+
checkedCopy.set(item.value, 'done');
|
169
|
+
updateSingleAncestors(item, checkedCopy, 'dot');
|
170
|
+
}
|
158
171
|
if (closeAfterSelect) {
|
159
172
|
dispatchPath({
|
160
173
|
type: 'reset'
|
@@ -226,7 +239,7 @@ export var selectRoot = function selectRoot(Root) {
|
|
226
239
|
}
|
227
240
|
}
|
228
241
|
setChecked(checkedCopy);
|
229
|
-
}, [
|
242
|
+
}, [value]);
|
230
243
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
231
244
|
ref: ref,
|
232
245
|
size: size,
|
@@ -153,7 +153,7 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
|
|
153
153
|
}
|
154
154
|
case keys.Backspace:
|
155
155
|
{
|
156
|
-
if (!multiselect
|
156
|
+
if (!multiselect) break;
|
157
157
|
if (focusedChipIndex !== null) {
|
158
158
|
var _currentItem = valueToItemMap.get(value[focusedChipIndex]);
|
159
159
|
handlePressDown(_currentItem);
|
@@ -34,7 +34,7 @@ var getLabel = function getLabel(_ref) {
|
|
34
34
|
text: renderValue ? renderValue(valueToItemMap.get(currentValue)) : itemLabel,
|
35
35
|
onClick: function onClick(e) {
|
36
36
|
e.stopPropagation();
|
37
|
-
onChipClick(currentValue
|
37
|
+
onChipClick(currentValue);
|
38
38
|
},
|
39
39
|
focused: focusedChipIndex === index
|
40
40
|
});
|