@salutejs/plasma-new-hope 0.339.0-canary.2286.18651387499.0 → 0.339.0-canary.2286.18719037766.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/Select/ui/TreeList/ui/Item/Item.js +76 -17
- package/cjs/components/Select/ui/TreeList/ui/Item/Item.js.map +1 -1
- package/emotion/cjs/components/Select/ui/TreeList/ui/Item/Item.js +66 -17
- package/emotion/cjs/examples/components/Combobox/Combobox.js +15 -0
- package/emotion/es/components/Select/ui/TreeList/ui/Item/Item.js +67 -18
- package/emotion/es/examples/components/Combobox/Combobox.js +0 -7
- package/es/components/Select/ui/TreeList/ui/Item/Item.js +77 -18
- package/es/components/Select/ui/TreeList/ui/Item/Item.js.map +1 -1
- package/package.json +4 -4
- package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/Item.js +66 -17
- package/styled-components/cjs/examples/components/Combobox/Combobox.js +0 -15
- package/styled-components/es/components/Select/ui/TreeList/ui/Item/Item.js +67 -18
- package/styled-components/es/examples/components/Combobox/Combobox.js +0 -7
- package/types/components/Select/ui/TreeList/ui/Item/Item.d.ts.map +1 -1
- package/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js +0 -89
- package/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js.map +0 -1
- package/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js +0 -89
- package/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js.map +0 -1
- package/emotion/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js +0 -112
- package/emotion/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js +0 -112
- package/emotion/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js +0 -61
- package/emotion/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js +0 -61
- package/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js +0 -81
- package/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js.map +0 -1
- package/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js +0 -81
- package/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js.map +0 -1
- package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js +0 -112
- package/styled-components/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js +0 -112
- package/styled-components/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.js +0 -61
- package/styled-components/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js +0 -61
- package/types/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.d.ts +0 -4
- package/types/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.d.ts.map +0 -1
- package/types/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.d.ts +0 -4
- package/types/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.d.ts.map +0 -1
package/emotion/cjs/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "ItemArrowRight", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return ItemArrowRight;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
-
var _utils = require("../../../../../../utils");
|
|
13
|
-
var _Selectcontext = require("../../../../../../Select.context");
|
|
14
|
-
var _Selecttokens = require("../../../../../../Select.tokens");
|
|
15
|
-
var _Itemstyles = require("../../Item.styles");
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
17
|
-
if (typeof WeakMap !== "function") return null;
|
|
18
|
-
var cacheBabelInterop = new WeakMap();
|
|
19
|
-
var cacheNodeInterop = new WeakMap();
|
|
20
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
21
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
22
|
-
})(nodeInterop);
|
|
23
|
-
}
|
|
24
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
25
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
26
|
-
return obj;
|
|
27
|
-
}
|
|
28
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
29
|
-
return {
|
|
30
|
-
default: obj
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
34
|
-
if (cache && cache.has(obj)) {
|
|
35
|
-
return cache.get(obj);
|
|
36
|
-
}
|
|
37
|
-
var newObj = {
|
|
38
|
-
__proto__: null
|
|
39
|
-
};
|
|
40
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
|
-
for(var key in obj){
|
|
42
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
43
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
44
|
-
if (desc && (desc.get || desc.set)) {
|
|
45
|
-
Object.defineProperty(newObj, key, desc);
|
|
46
|
-
} else {
|
|
47
|
-
newObj[key] = obj[key];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
newObj.default = obj;
|
|
52
|
-
if (cache) {
|
|
53
|
-
cache.set(obj, newObj);
|
|
54
|
-
}
|
|
55
|
-
return newObj;
|
|
56
|
-
}
|
|
57
|
-
var ItemArrowRight = function(param) {
|
|
58
|
-
var item = param.item, index = param.index, onClick = param.onClick, onChange = param.onChange, isCurrentLevelOpened = param.isCurrentLevelOpened;
|
|
59
|
-
var _valueToPathMap_get;
|
|
60
|
-
var label = item.label, disabled = item.disabled, isDisabled = item.isDisabled, contentLeft = item.contentLeft, contentRight = item.contentRight;
|
|
61
|
-
var isLeaf = !(item === null || item === void 0 ? void 0 : item.items);
|
|
62
|
-
var _useContext = (0, _react.useContext)(_Selectcontext.Context), checked = _useContext.checked, multiselect = _useContext.multiselect, size = _useContext.size, variant = _useContext.variant, renderItem = _useContext.renderItem, // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
63
|
-
// @ts-ignore
|
|
64
|
-
_checkboxAppearance = _useContext._checkboxAppearance, focusedPath = _useContext.focusedPath, valueToPathMap = _useContext.valueToPathMap;
|
|
65
|
-
var itemDisabled = Boolean(disabled || isDisabled);
|
|
66
|
-
var currentItemDepth = (((_valueToPathMap_get = valueToPathMap.get(item.value.toString())) === null || _valueToPathMap_get === void 0 ? void 0 : _valueToPathMap_get.length) || 0) - 1;
|
|
67
|
-
var withArrowInverse = isCurrentLevelOpened ? _Selecttokens.classes.arrowInverse : undefined;
|
|
68
|
-
var focusedClass = currentItemDepth === focusedPath.length - 1 && index === (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[currentItemDepth]) ? _Selecttokens.classes.dropdownItemIsFocused : undefined;
|
|
69
|
-
return /*#__PURE__*/ _react.default.createElement(_Itemstyles.Wrapper, {
|
|
70
|
-
className: focusedClass,
|
|
71
|
-
onClick: onClick,
|
|
72
|
-
variant: variant,
|
|
73
|
-
role: "treeitem"
|
|
74
|
-
}, /*#__PURE__*/ _react.default.createElement(_Itemstyles.Offset, {
|
|
75
|
-
depth: currentItemDepth
|
|
76
|
-
}), multiselect && /*#__PURE__*/ _react.default.createElement(_Itemstyles.IconWrapper, {
|
|
77
|
-
variant: variant
|
|
78
|
-
}, /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledCheckboxWrapper, {
|
|
79
|
-
onClick: function(e) {
|
|
80
|
-
return e.stopPropagation();
|
|
81
|
-
}
|
|
82
|
-
}, /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledCheckbox, {
|
|
83
|
-
disabled: itemDisabled,
|
|
84
|
-
checked: Boolean(checked.get(item.value)),
|
|
85
|
-
indeterminate: checked.get(item.value) === 'indeterminate',
|
|
86
|
-
onChange: onChange,
|
|
87
|
-
appearance: _checkboxAppearance !== null && _checkboxAppearance !== void 0 ? _checkboxAppearance : 'default'
|
|
88
|
-
}))), !multiselect && /*#__PURE__*/ _react.default.createElement(_Itemstyles.IconWrapper, {
|
|
89
|
-
variant: variant
|
|
90
|
-
}, checked.get(item.value) === 'dot' && /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledIndicator, {
|
|
91
|
-
size: "s",
|
|
92
|
-
view: "default"
|
|
93
|
-
}), checked.get(item.value) === 'done' && /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledIconDone, {
|
|
94
|
-
size: (0, _utils.sizeToIconSize)(size, variant),
|
|
95
|
-
color: "inherit"
|
|
96
|
-
})), renderItem ? /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledText, null, renderItem(item)) : /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledWrapper, {
|
|
97
|
-
disabled: itemDisabled
|
|
98
|
-
}, /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledCell, {
|
|
99
|
-
contentLeft: contentLeft,
|
|
100
|
-
contentRight: contentRight,
|
|
101
|
-
// TODO: #1548
|
|
102
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
103
|
-
// @ts-ignore
|
|
104
|
-
title: /*#__PURE__*/ _react.default.createElement("span", null, label)
|
|
105
|
-
})), /*#__PURE__*/ _react.default.createElement(_Itemstyles.DisclosureIconWrapper, {
|
|
106
|
-
visibility: isLeaf ? 'hidden' : 'visible'
|
|
107
|
-
}, /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledArrowRight, {
|
|
108
|
-
size: (0, _utils.sizeToIconSize)(size, variant),
|
|
109
|
-
color: "inherit",
|
|
110
|
-
className: withArrowInverse
|
|
111
|
-
})));
|
|
112
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from "react";
|
|
2
|
-
import { sizeToIconSize } from "../../../../../../utils";
|
|
3
|
-
import { Context } from "../../../../../../Select.context";
|
|
4
|
-
import { classes } from "../../../../../../Select.tokens";
|
|
5
|
-
import { DisclosureIconWrapper, IconWrapper, StyledArrowLeft, StyledCell, StyledCheckbox, StyledCheckboxWrapper, StyledIconDone, StyledIndicator, StyledText, StyledWrapper, Wrapper, Offset } from "../../Item.styles";
|
|
6
|
-
export var ItemArrowLeft = function(param) {
|
|
7
|
-
var item = param.item, index = param.index, onClick = param.onClick, onChange = param.onChange, isCurrentLevelOpened = param.isCurrentLevelOpened;
|
|
8
|
-
var _valueToPathMap_get;
|
|
9
|
-
var label = item.label, disabled = item.disabled, isDisabled = item.isDisabled, contentLeft = item.contentLeft, contentRight = item.contentRight;
|
|
10
|
-
var isLeaf = !(item === null || item === void 0 ? void 0 : item.items);
|
|
11
|
-
var _useContext = useContext(Context), checked = _useContext.checked, multiselect = _useContext.multiselect, size = _useContext.size, variant = _useContext.variant, renderItem = _useContext.renderItem, // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
_checkboxAppearance = _useContext._checkboxAppearance, focusedPath = _useContext.focusedPath, valueToPathMap = _useContext.valueToPathMap;
|
|
14
|
-
var itemDisabled = Boolean(disabled || isDisabled);
|
|
15
|
-
var currentItemDepth = (((_valueToPathMap_get = valueToPathMap.get(item.value.toString())) === null || _valueToPathMap_get === void 0 ? void 0 : _valueToPathMap_get.length) || 0) - 1;
|
|
16
|
-
var withArrowInverse = isCurrentLevelOpened ? classes.arrowInverse : undefined;
|
|
17
|
-
var focusedClass = currentItemDepth === focusedPath.length - 1 && index === (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[currentItemDepth]) ? classes.dropdownItemIsFocused : undefined;
|
|
18
|
-
return /*#__PURE__*/ React.createElement(Wrapper, {
|
|
19
|
-
className: focusedClass,
|
|
20
|
-
onClick: onClick,
|
|
21
|
-
variant: variant,
|
|
22
|
-
role: "treeitem"
|
|
23
|
-
}, /*#__PURE__*/ React.createElement(Offset, {
|
|
24
|
-
depth: currentItemDepth
|
|
25
|
-
}), /*#__PURE__*/ React.createElement(DisclosureIconWrapper, {
|
|
26
|
-
visibility: isLeaf ? 'hidden' : 'visible'
|
|
27
|
-
}, /*#__PURE__*/ React.createElement(StyledArrowLeft, {
|
|
28
|
-
size: sizeToIconSize(size, variant),
|
|
29
|
-
color: "inherit",
|
|
30
|
-
className: withArrowInverse
|
|
31
|
-
})), multiselect && /*#__PURE__*/ React.createElement(IconWrapper, {
|
|
32
|
-
variant: variant
|
|
33
|
-
}, /*#__PURE__*/ React.createElement(StyledCheckboxWrapper, {
|
|
34
|
-
onClick: function(e) {
|
|
35
|
-
return e.stopPropagation();
|
|
36
|
-
}
|
|
37
|
-
}, /*#__PURE__*/ React.createElement(StyledCheckbox, {
|
|
38
|
-
disabled: itemDisabled,
|
|
39
|
-
checked: Boolean(checked.get(item.value)),
|
|
40
|
-
indeterminate: checked.get(item.value) === 'indeterminate',
|
|
41
|
-
onChange: onChange,
|
|
42
|
-
appearance: _checkboxAppearance !== null && _checkboxAppearance !== void 0 ? _checkboxAppearance : 'default'
|
|
43
|
-
}))), renderItem ? /*#__PURE__*/ React.createElement(StyledText, null, renderItem(item)) : /*#__PURE__*/ React.createElement(StyledWrapper, {
|
|
44
|
-
disabled: itemDisabled
|
|
45
|
-
}, /*#__PURE__*/ React.createElement(StyledCell, {
|
|
46
|
-
contentLeft: contentLeft,
|
|
47
|
-
contentRight: contentRight,
|
|
48
|
-
// TODO: #1548
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
title: /*#__PURE__*/ React.createElement("span", null, label)
|
|
52
|
-
})), !multiselect && /*#__PURE__*/ React.createElement(IconWrapper, {
|
|
53
|
-
variant: variant
|
|
54
|
-
}, checked.get(item.value) === 'dot' && /*#__PURE__*/ React.createElement(StyledIndicator, {
|
|
55
|
-
size: "s",
|
|
56
|
-
view: "default"
|
|
57
|
-
}), checked.get(item.value) === 'done' && /*#__PURE__*/ React.createElement(StyledIconDone, {
|
|
58
|
-
size: sizeToIconSize(size, variant),
|
|
59
|
-
color: "inherit"
|
|
60
|
-
})));
|
|
61
|
-
};
|
package/emotion/es/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from "react";
|
|
2
|
-
import { sizeToIconSize } from "../../../../../../utils";
|
|
3
|
-
import { Context } from "../../../../../../Select.context";
|
|
4
|
-
import { classes } from "../../../../../../Select.tokens";
|
|
5
|
-
import { DisclosureIconWrapper, IconWrapper, StyledArrowRight, StyledCell, StyledCheckbox, StyledCheckboxWrapper, StyledIconDone, StyledIndicator, StyledText, StyledWrapper, Wrapper, Offset } from "../../Item.styles";
|
|
6
|
-
export var ItemArrowRight = function(param) {
|
|
7
|
-
var item = param.item, index = param.index, onClick = param.onClick, onChange = param.onChange, isCurrentLevelOpened = param.isCurrentLevelOpened;
|
|
8
|
-
var _valueToPathMap_get;
|
|
9
|
-
var label = item.label, disabled = item.disabled, isDisabled = item.isDisabled, contentLeft = item.contentLeft, contentRight = item.contentRight;
|
|
10
|
-
var isLeaf = !(item === null || item === void 0 ? void 0 : item.items);
|
|
11
|
-
var _useContext = useContext(Context), checked = _useContext.checked, multiselect = _useContext.multiselect, size = _useContext.size, variant = _useContext.variant, renderItem = _useContext.renderItem, // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
_checkboxAppearance = _useContext._checkboxAppearance, focusedPath = _useContext.focusedPath, valueToPathMap = _useContext.valueToPathMap;
|
|
14
|
-
var itemDisabled = Boolean(disabled || isDisabled);
|
|
15
|
-
var currentItemDepth = (((_valueToPathMap_get = valueToPathMap.get(item.value.toString())) === null || _valueToPathMap_get === void 0 ? void 0 : _valueToPathMap_get.length) || 0) - 1;
|
|
16
|
-
var withArrowInverse = isCurrentLevelOpened ? classes.arrowInverse : undefined;
|
|
17
|
-
var focusedClass = currentItemDepth === focusedPath.length - 1 && index === (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[currentItemDepth]) ? classes.dropdownItemIsFocused : undefined;
|
|
18
|
-
return /*#__PURE__*/ React.createElement(Wrapper, {
|
|
19
|
-
className: focusedClass,
|
|
20
|
-
onClick: onClick,
|
|
21
|
-
variant: variant,
|
|
22
|
-
role: "treeitem"
|
|
23
|
-
}, /*#__PURE__*/ React.createElement(Offset, {
|
|
24
|
-
depth: currentItemDepth
|
|
25
|
-
}), multiselect && /*#__PURE__*/ React.createElement(IconWrapper, {
|
|
26
|
-
variant: variant
|
|
27
|
-
}, /*#__PURE__*/ React.createElement(StyledCheckboxWrapper, {
|
|
28
|
-
onClick: function(e) {
|
|
29
|
-
return e.stopPropagation();
|
|
30
|
-
}
|
|
31
|
-
}, /*#__PURE__*/ React.createElement(StyledCheckbox, {
|
|
32
|
-
disabled: itemDisabled,
|
|
33
|
-
checked: Boolean(checked.get(item.value)),
|
|
34
|
-
indeterminate: checked.get(item.value) === 'indeterminate',
|
|
35
|
-
onChange: onChange,
|
|
36
|
-
appearance: _checkboxAppearance !== null && _checkboxAppearance !== void 0 ? _checkboxAppearance : 'default'
|
|
37
|
-
}))), !multiselect && /*#__PURE__*/ React.createElement(IconWrapper, {
|
|
38
|
-
variant: variant
|
|
39
|
-
}, checked.get(item.value) === 'dot' && /*#__PURE__*/ React.createElement(StyledIndicator, {
|
|
40
|
-
size: "s",
|
|
41
|
-
view: "default"
|
|
42
|
-
}), checked.get(item.value) === 'done' && /*#__PURE__*/ React.createElement(StyledIconDone, {
|
|
43
|
-
size: sizeToIconSize(size, variant),
|
|
44
|
-
color: "inherit"
|
|
45
|
-
})), renderItem ? /*#__PURE__*/ React.createElement(StyledText, null, renderItem(item)) : /*#__PURE__*/ React.createElement(StyledWrapper, {
|
|
46
|
-
disabled: itemDisabled
|
|
47
|
-
}, /*#__PURE__*/ React.createElement(StyledCell, {
|
|
48
|
-
contentLeft: contentLeft,
|
|
49
|
-
contentRight: contentRight,
|
|
50
|
-
// TODO: #1548
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
52
|
-
// @ts-ignore
|
|
53
|
-
title: /*#__PURE__*/ React.createElement("span", null, label)
|
|
54
|
-
})), /*#__PURE__*/ React.createElement(DisclosureIconWrapper, {
|
|
55
|
-
visibility: isLeaf ? 'hidden' : 'visible'
|
|
56
|
-
}, /*#__PURE__*/ React.createElement(StyledArrowRight, {
|
|
57
|
-
size: sizeToIconSize(size, variant),
|
|
58
|
-
color: "inherit",
|
|
59
|
-
className: withArrowInverse
|
|
60
|
-
})));
|
|
61
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import { Context } from '../../../../../../Select.context.js';
|
|
3
|
-
import { classes } from '../../../../../../Select.tokens.js';
|
|
4
|
-
import { Wrapper, Offset, DisclosureIconWrapper, StyledArrowLeft, IconWrapper, StyledCheckboxWrapper, StyledCheckbox, StyledText, StyledWrapper, StyledCell, StyledIndicator, StyledIconDone } from '../../Item.styles.js';
|
|
5
|
-
import { sizeToIconSize } from '../../../../../../utils/sizeToIconSize.js';
|
|
6
|
-
|
|
7
|
-
var _StyledIndicator;
|
|
8
|
-
var ItemArrowLeft = function ItemArrowLeft(_ref) {
|
|
9
|
-
var _valueToPathMap$get;
|
|
10
|
-
var item = _ref.item,
|
|
11
|
-
index = _ref.index,
|
|
12
|
-
onClick = _ref.onClick,
|
|
13
|
-
onChange = _ref.onChange,
|
|
14
|
-
isCurrentLevelOpened = _ref.isCurrentLevelOpened;
|
|
15
|
-
var label = item.label,
|
|
16
|
-
disabled = item.disabled,
|
|
17
|
-
isDisabled = item.isDisabled,
|
|
18
|
-
contentLeft = item.contentLeft,
|
|
19
|
-
contentRight = item.contentRight;
|
|
20
|
-
var isLeaf = !(item !== null && item !== void 0 && item.items);
|
|
21
|
-
var _useContext = useContext(Context),
|
|
22
|
-
checked = _useContext.checked,
|
|
23
|
-
multiselect = _useContext.multiselect,
|
|
24
|
-
size = _useContext.size,
|
|
25
|
-
variant = _useContext.variant,
|
|
26
|
-
renderItem = _useContext.renderItem,
|
|
27
|
-
_checkboxAppearance = _useContext._checkboxAppearance,
|
|
28
|
-
focusedPath = _useContext.focusedPath,
|
|
29
|
-
valueToPathMap = _useContext.valueToPathMap;
|
|
30
|
-
var itemDisabled = Boolean(disabled || isDisabled);
|
|
31
|
-
var currentItemDepth = (((_valueToPathMap$get = valueToPathMap.get(item.value.toString())) === null || _valueToPathMap$get === void 0 ? void 0 : _valueToPathMap$get.length) || 0) - 1;
|
|
32
|
-
var withArrowInverse = isCurrentLevelOpened ? classes.arrowInverse : undefined;
|
|
33
|
-
var focusedClass = currentItemDepth === focusedPath.length - 1 && index === (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[currentItemDepth]) ? classes.dropdownItemIsFocused : undefined;
|
|
34
|
-
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
35
|
-
className: focusedClass,
|
|
36
|
-
onClick: onClick,
|
|
37
|
-
variant: variant,
|
|
38
|
-
role: "treeitem"
|
|
39
|
-
}, /*#__PURE__*/React.createElement(Offset, {
|
|
40
|
-
depth: currentItemDepth
|
|
41
|
-
}), /*#__PURE__*/React.createElement(DisclosureIconWrapper, {
|
|
42
|
-
visibility: isLeaf ? 'hidden' : 'visible'
|
|
43
|
-
}, /*#__PURE__*/React.createElement(StyledArrowLeft, {
|
|
44
|
-
size: sizeToIconSize(size, variant),
|
|
45
|
-
color: "inherit",
|
|
46
|
-
className: withArrowInverse
|
|
47
|
-
})), multiselect && /*#__PURE__*/React.createElement(IconWrapper, {
|
|
48
|
-
variant: variant
|
|
49
|
-
}, /*#__PURE__*/React.createElement(StyledCheckboxWrapper, {
|
|
50
|
-
onClick: function onClick(e) {
|
|
51
|
-
return e.stopPropagation();
|
|
52
|
-
}
|
|
53
|
-
}, /*#__PURE__*/React.createElement(StyledCheckbox, {
|
|
54
|
-
disabled: itemDisabled,
|
|
55
|
-
checked: Boolean(checked.get(item.value)),
|
|
56
|
-
indeterminate: checked.get(item.value) === 'indeterminate',
|
|
57
|
-
onChange: onChange,
|
|
58
|
-
appearance: _checkboxAppearance !== null && _checkboxAppearance !== void 0 ? _checkboxAppearance : 'default'
|
|
59
|
-
}))), renderItem ? /*#__PURE__*/React.createElement(StyledText, null, renderItem(item)) : /*#__PURE__*/React.createElement(StyledWrapper, {
|
|
60
|
-
disabled: itemDisabled
|
|
61
|
-
}, /*#__PURE__*/React.createElement(StyledCell, {
|
|
62
|
-
contentLeft: contentLeft,
|
|
63
|
-
contentRight: contentRight
|
|
64
|
-
// TODO: #1548
|
|
65
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
66
|
-
// @ts-ignore
|
|
67
|
-
,
|
|
68
|
-
title: /*#__PURE__*/React.createElement("span", null, label)
|
|
69
|
-
})), !multiselect && /*#__PURE__*/React.createElement(IconWrapper, {
|
|
70
|
-
variant: variant
|
|
71
|
-
}, checked.get(item.value) === 'dot' && (_StyledIndicator || (_StyledIndicator = /*#__PURE__*/React.createElement(StyledIndicator, {
|
|
72
|
-
size: "s",
|
|
73
|
-
view: "default"
|
|
74
|
-
}))), checked.get(item.value) === 'done' && /*#__PURE__*/React.createElement(StyledIconDone, {
|
|
75
|
-
size: sizeToIconSize(size, variant),
|
|
76
|
-
color: "inherit"
|
|
77
|
-
})));
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export { ItemArrowLeft };
|
|
81
|
-
//# sourceMappingURL=ItemArrowLeft.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ItemArrowLeft.js","sources":["../../../../../../../../../src/components/Select/ui/TreeList/ui/Item/ui/ItemArrowLeft/ItemArrowLeft.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport type { FC } from 'react';\nimport { sizeToIconSize } from 'src/components/Select/utils';\nimport { Context } from 'src/components/Select/Select.context';\nimport { classes } from 'src/components/Select/Select.tokens';\n\nimport {\n DisclosureIconWrapper,\n IconWrapper,\n StyledArrowLeft,\n StyledCell,\n StyledCheckbox,\n StyledCheckboxWrapper,\n StyledIconDone,\n StyledIndicator,\n StyledText,\n StyledWrapper,\n Wrapper,\n Offset,\n} from '../../Item.styles';\nimport { ItemArrowProps } from '../../Item.types';\n\nexport const ItemArrowLeft: FC<ItemArrowProps> = ({ item, index, onClick, onChange, isCurrentLevelOpened }) => {\n const { label, disabled, isDisabled, contentLeft, contentRight } = item;\n\n const isLeaf = !item?.items;\n\n const {\n checked,\n multiselect,\n size,\n variant,\n renderItem,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n _checkboxAppearance,\n focusedPath,\n valueToPathMap,\n } = useContext(Context);\n\n const itemDisabled = Boolean(disabled || isDisabled);\n\n const currentItemDepth = (valueToPathMap.get(item.value.toString())?.length || 0) - 1;\n\n const withArrowInverse = isCurrentLevelOpened ? classes.arrowInverse : undefined;\n\n const focusedClass =\n currentItemDepth === focusedPath.length - 1 && index === focusedPath?.[currentItemDepth]\n ? classes.dropdownItemIsFocused\n : undefined;\n\n return (\n <Wrapper className={focusedClass} onClick={onClick} variant={variant} role=\"treeitem\">\n <Offset depth={currentItemDepth} />\n\n <DisclosureIconWrapper visibility={isLeaf ? 'hidden' : 'visible'}>\n <StyledArrowLeft size={sizeToIconSize(size, variant)} color=\"inherit\" className={withArrowInverse} />\n </DisclosureIconWrapper>\n\n {multiselect && (\n <IconWrapper variant={variant}>\n <StyledCheckboxWrapper onClick={(e) => e.stopPropagation()}>\n <StyledCheckbox\n disabled={itemDisabled}\n checked={Boolean(checked.get(item.value))}\n indeterminate={checked.get(item.value) === 'indeterminate'}\n onChange={onChange}\n appearance={_checkboxAppearance ?? 'default'}\n />\n </StyledCheckboxWrapper>\n </IconWrapper>\n )}\n\n {renderItem ? (\n <StyledText>{renderItem(item)}</StyledText>\n ) : (\n <StyledWrapper disabled={itemDisabled}>\n <StyledCell\n contentLeft={contentLeft}\n contentRight={contentRight}\n // TODO: #1548\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n title={<span>{label}</span>}\n />\n </StyledWrapper>\n )}\n\n {!multiselect && (\n <IconWrapper variant={variant}>\n {checked.get(item.value) === 'dot' && <StyledIndicator size=\"s\" view=\"default\" />}\n\n {checked.get(item.value) === 'done' && (\n <StyledIconDone size={sizeToIconSize(size, variant)} color=\"inherit\" />\n )}\n </IconWrapper>\n )}\n </Wrapper>\n );\n};\n"],"names":["ItemArrowLeft","_ref","_valueToPathMap$get","item","index","onClick","onChange","isCurrentLevelOpened","label","disabled","isDisabled","contentLeft","contentRight","isLeaf","items","_useContext","useContext","Context","checked","multiselect","size","variant","renderItem","_checkboxAppearance","focusedPath","valueToPathMap","itemDisabled","Boolean","currentItemDepth","get","value","toString","length","withArrowInverse","classes","arrowInverse","undefined","focusedClass","dropdownItemIsFocused","React","createElement","Wrapper","className","role","Offset","depth","DisclosureIconWrapper","visibility","StyledArrowLeft","sizeToIconSize","color","IconWrapper","StyledCheckboxWrapper","e","stopPropagation","StyledCheckbox","indeterminate","appearance","StyledText","StyledWrapper","StyledCell","title","_StyledIndicator","StyledIndicator","view","StyledIconDone"],"mappings":";;;;;;;IAsBaA,aAAiC,GAAG,SAApCA,aAAiCA,CAAAC,IAAA,EAAiE;AAAA,EAAA,IAAAC,mBAAA,CAAA;AAAA,EAAA,IAA3DC,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I,EAAC,SAAA;AAAS,GAAE,CAAC,CAEhF9C,CAAAA,EAAAA,OAAO,CAACW,GAAG,CAAC1B,IAAI,CAAC2B,KAAK,CAAC,KAAK,MAAM,iBAC/BS,KAAA,CAAAC,aAAA,CAACyB,cAAc,EAAA;AAAC7C,IAAAA,IAAI,EAAE6B,cAAc,CAAC7B,IAAI,EAAEC,OAAO,CAAE;AAAC6B,IAAAA,KAAK,EAAC,SAAA;GAAW,CAEjE,CAEZ,CAAC,CAAA;AAElB;;;;"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import { Context } from '../../../../../../Select.context.js';
|
|
3
|
-
import { classes } from '../../../../../../Select.tokens.js';
|
|
4
|
-
import { Wrapper, Offset, IconWrapper, StyledCheckboxWrapper, StyledCheckbox, StyledIndicator, StyledIconDone, StyledText, StyledWrapper, StyledCell, DisclosureIconWrapper, StyledArrowRight } from '../../Item.styles.js';
|
|
5
|
-
import { sizeToIconSize } from '../../../../../../utils/sizeToIconSize.js';
|
|
6
|
-
|
|
7
|
-
var _StyledIndicator;
|
|
8
|
-
var ItemArrowRight = function ItemArrowRight(_ref) {
|
|
9
|
-
var _valueToPathMap$get;
|
|
10
|
-
var item = _ref.item,
|
|
11
|
-
index = _ref.index,
|
|
12
|
-
onClick = _ref.onClick,
|
|
13
|
-
onChange = _ref.onChange,
|
|
14
|
-
isCurrentLevelOpened = _ref.isCurrentLevelOpened;
|
|
15
|
-
var label = item.label,
|
|
16
|
-
disabled = item.disabled,
|
|
17
|
-
isDisabled = item.isDisabled,
|
|
18
|
-
contentLeft = item.contentLeft,
|
|
19
|
-
contentRight = item.contentRight;
|
|
20
|
-
var isLeaf = !(item !== null && item !== void 0 && item.items);
|
|
21
|
-
var _useContext = useContext(Context),
|
|
22
|
-
checked = _useContext.checked,
|
|
23
|
-
multiselect = _useContext.multiselect,
|
|
24
|
-
size = _useContext.size,
|
|
25
|
-
variant = _useContext.variant,
|
|
26
|
-
renderItem = _useContext.renderItem,
|
|
27
|
-
_checkboxAppearance = _useContext._checkboxAppearance,
|
|
28
|
-
focusedPath = _useContext.focusedPath,
|
|
29
|
-
valueToPathMap = _useContext.valueToPathMap;
|
|
30
|
-
var itemDisabled = Boolean(disabled || isDisabled);
|
|
31
|
-
var currentItemDepth = (((_valueToPathMap$get = valueToPathMap.get(item.value.toString())) === null || _valueToPathMap$get === void 0 ? void 0 : _valueToPathMap$get.length) || 0) - 1;
|
|
32
|
-
var withArrowInverse = isCurrentLevelOpened ? classes.arrowInverse : undefined;
|
|
33
|
-
var focusedClass = currentItemDepth === focusedPath.length - 1 && index === (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[currentItemDepth]) ? classes.dropdownItemIsFocused : undefined;
|
|
34
|
-
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
35
|
-
className: focusedClass,
|
|
36
|
-
onClick: onClick,
|
|
37
|
-
variant: variant,
|
|
38
|
-
role: "treeitem"
|
|
39
|
-
}, /*#__PURE__*/React.createElement(Offset, {
|
|
40
|
-
depth: currentItemDepth
|
|
41
|
-
}), multiselect && /*#__PURE__*/React.createElement(IconWrapper, {
|
|
42
|
-
variant: variant
|
|
43
|
-
}, /*#__PURE__*/React.createElement(StyledCheckboxWrapper, {
|
|
44
|
-
onClick: function onClick(e) {
|
|
45
|
-
return e.stopPropagation();
|
|
46
|
-
}
|
|
47
|
-
}, /*#__PURE__*/React.createElement(StyledCheckbox, {
|
|
48
|
-
disabled: itemDisabled,
|
|
49
|
-
checked: Boolean(checked.get(item.value)),
|
|
50
|
-
indeterminate: checked.get(item.value) === 'indeterminate',
|
|
51
|
-
onChange: onChange,
|
|
52
|
-
appearance: _checkboxAppearance !== null && _checkboxAppearance !== void 0 ? _checkboxAppearance : 'default'
|
|
53
|
-
}))), !multiselect && /*#__PURE__*/React.createElement(IconWrapper, {
|
|
54
|
-
variant: variant
|
|
55
|
-
}, checked.get(item.value) === 'dot' && (_StyledIndicator || (_StyledIndicator = /*#__PURE__*/React.createElement(StyledIndicator, {
|
|
56
|
-
size: "s",
|
|
57
|
-
view: "default"
|
|
58
|
-
}))), checked.get(item.value) === 'done' && /*#__PURE__*/React.createElement(StyledIconDone, {
|
|
59
|
-
size: sizeToIconSize(size, variant),
|
|
60
|
-
color: "inherit"
|
|
61
|
-
})), renderItem ? /*#__PURE__*/React.createElement(StyledText, null, renderItem(item)) : /*#__PURE__*/React.createElement(StyledWrapper, {
|
|
62
|
-
disabled: itemDisabled
|
|
63
|
-
}, /*#__PURE__*/React.createElement(StyledCell, {
|
|
64
|
-
contentLeft: contentLeft,
|
|
65
|
-
contentRight: contentRight
|
|
66
|
-
// TODO: #1548
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
68
|
-
// @ts-ignore
|
|
69
|
-
,
|
|
70
|
-
title: /*#__PURE__*/React.createElement("span", null, label)
|
|
71
|
-
})), /*#__PURE__*/React.createElement(DisclosureIconWrapper, {
|
|
72
|
-
visibility: isLeaf ? 'hidden' : 'visible'
|
|
73
|
-
}, /*#__PURE__*/React.createElement(StyledArrowRight, {
|
|
74
|
-
size: sizeToIconSize(size, variant),
|
|
75
|
-
color: "inherit",
|
|
76
|
-
className: withArrowInverse
|
|
77
|
-
})));
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export { ItemArrowRight };
|
|
81
|
-
//# sourceMappingURL=ItemArrowRight.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ItemArrowRight.js","sources":["../../../../../../../../../src/components/Select/ui/TreeList/ui/Item/ui/ItemArrowRight/ItemArrowRight.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport type { FC } from 'react';\nimport { sizeToIconSize } from 'src/components/Select/utils';\nimport { Context } from 'src/components/Select/Select.context';\nimport { classes } from 'src/components/Select/Select.tokens';\n\nimport {\n DisclosureIconWrapper,\n IconWrapper,\n StyledArrowRight,\n StyledCell,\n StyledCheckbox,\n StyledCheckboxWrapper,\n StyledIconDone,\n StyledIndicator,\n StyledText,\n StyledWrapper,\n Wrapper,\n Offset,\n} from '../../Item.styles';\nimport { ItemArrowProps } from '../../Item.types';\n\nexport const ItemArrowRight: FC<ItemArrowProps> = ({ item, index, onClick, onChange, isCurrentLevelOpened }) => {\n const { label, disabled, isDisabled, contentLeft, contentRight } = item;\n\n const isLeaf = !item?.items;\n\n const {\n checked,\n multiselect,\n size,\n variant,\n renderItem,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n _checkboxAppearance,\n focusedPath,\n valueToPathMap,\n } = useContext(Context);\n\n const itemDisabled = Boolean(disabled || isDisabled);\n\n const currentItemDepth = (valueToPathMap.get(item.value.toString())?.length || 0) - 1;\n\n const withArrowInverse = isCurrentLevelOpened ? classes.arrowInverse : undefined;\n\n const focusedClass =\n currentItemDepth === focusedPath.length - 1 && index === focusedPath?.[currentItemDepth]\n ? classes.dropdownItemIsFocused\n : undefined;\n\n return (\n <Wrapper className={focusedClass} onClick={onClick} variant={variant} role=\"treeitem\">\n <Offset depth={currentItemDepth} />\n\n {multiselect && (\n <IconWrapper variant={variant}>\n <StyledCheckboxWrapper onClick={(e) => e.stopPropagation()}>\n <StyledCheckbox\n disabled={itemDisabled}\n checked={Boolean(checked.get(item.value))}\n indeterminate={checked.get(item.value) === 'indeterminate'}\n onChange={onChange}\n appearance={_checkboxAppearance ?? 'default'}\n />\n </StyledCheckboxWrapper>\n </IconWrapper>\n )}\n\n {!multiselect && (\n <IconWrapper variant={variant}>\n {checked.get(item.value) === 'dot' && <StyledIndicator size=\"s\" view=\"default\" />}\n\n {checked.get(item.value) === 'done' && (\n <StyledIconDone size={sizeToIconSize(size, variant)} color=\"inherit\" />\n )}\n </IconWrapper>\n )}\n\n {renderItem ? (\n <StyledText>{renderItem(item)}</StyledText>\n ) : (\n <StyledWrapper disabled={itemDisabled}>\n <StyledCell\n contentLeft={contentLeft}\n contentRight={contentRight}\n // TODO: #1548\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n title={<span>{label}</span>}\n />\n </StyledWrapper>\n )}\n\n <DisclosureIconWrapper visibility={isLeaf ? 'hidden' : 'visible'}>\n <StyledArrowRight size={sizeToIconSize(size, variant)} color=\"inherit\" className={withArrowInverse} />\n </DisclosureIconWrapper>\n </Wrapper>\n );\n};\n"],"names":["ItemArrowRight","_ref","_valueToPathMap$get","item","index","onClick","onChange","isCurrentLevelOpened","label","disabled","isDisabled","contentLeft","contentRight","isLeaf","items","_useContext","useContext","Context","checked","multiselect","size","variant","renderItem","_checkboxAppearance","focusedPath","valueToPathMap","itemDisabled","Boolean","currentItemDepth","get","value","toString","length","withArrowInverse","classes","arrowInverse","undefined","focusedClass","dropdownItemIsFocused","React","createElement","Wrapper","className","role","Offset","depth","IconWrapper","StyledCheckboxWrapper","e","stopPropagation","StyledCheckbox","indeterminate","appearance","_StyledIndicator","StyledIndicator","view","StyledIconDone","sizeToIconSize","color","StyledText","StyledWrapper","StyledCell","title","DisclosureIconWrapper","visibility","StyledArrowRight"],"mappings":";;;;;;;IAsBaA,cAAkC,GAAG,SAArCA,cAAkCA,CAAAC,IAAA,EAAiE;AAAA,EAAA,IAAAC,mBAAA,CAAA;AAAA,EAAA,IAA3DC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IAAEC,KAAK,GAAAH,IAAA,CAALG,KAAK;IAAEC,OAAO,GAAAJ,IAAA,CAAPI,OAAO;IAAEC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAEC,oBAAoB,GAAAN,IAAA,CAApBM,oBAAoB,CAAA;AACrG,EAAA,IAAQC,KAAK,GAAsDL,IAAI,CAA/DK,KAAK;IAAEC,QAAQ,GAA4CN,IAAI,CAAxDM,QAAQ;IAAEC,UAAU,GAAgCP,IAAI,CAA9CO,UAAU;IAAEC,WAAW,GAAmBR,IAAI,CAAlCQ,WAAW;IAAEC,YAAY,GAAKT,IAAI,CAArBS,YAAY,CAAA;EAE9D,IAAMC,MAAM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emArrowLeft", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return ItemArrowLeft;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
-
var _utils = require("../../../../../../utils");
|
|
13
|
-
var _Selectcontext = require("../../../../../../Select.context");
|
|
14
|
-
var _Selecttokens = require("../../../../../../Select.tokens");
|
|
15
|
-
var _Itemstyles = require("../../Item.styles");
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
17
|
-
if (typeof WeakMap !== "function") return null;
|
|
18
|
-
var cacheBabelInterop = new WeakMap();
|
|
19
|
-
var cacheNodeInterop = new WeakMap();
|
|
20
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
21
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
22
|
-
})(nodeInterop);
|
|
23
|
-
}
|
|
24
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
25
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
26
|
-
return obj;
|
|
27
|
-
}
|
|
28
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
29
|
-
return {
|
|
30
|
-
default: obj
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
34
|
-
if (cache && cache.has(obj)) {
|
|
35
|
-
return cache.get(obj);
|
|
36
|
-
}
|
|
37
|
-
var newObj = {
|
|
38
|
-
__proto__: null
|
|
39
|
-
};
|
|
40
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
|
-
for(var key in obj){
|
|
42
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
43
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
44
|
-
if (desc && (desc.get || desc.set)) {
|
|
45
|
-
Object.defineProperty(newObj, key, desc);
|
|
46
|
-
} else {
|
|
47
|
-
newObj[key] = obj[key];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
newObj.default = obj;
|
|
52
|
-
if (cache) {
|
|
53
|
-
cache.set(obj, newObj);
|
|
54
|
-
}
|
|
55
|
-
return newObj;
|
|
56
|
-
}
|
|
57
|
-
var ItemArrowLeft = function(param) {
|
|
58
|
-
var item = param.item, index = param.index, onClick = param.onClick, onChange = param.onChange, isCurrentLevelOpened = param.isCurrentLevelOpened;
|
|
59
|
-
var _valueToPathMap_get;
|
|
60
|
-
var label = item.label, disabled = item.disabled, isDisabled = item.isDisabled, contentLeft = item.contentLeft, contentRight = item.contentRight;
|
|
61
|
-
var isLeaf = !(item === null || item === void 0 ? void 0 : item.items);
|
|
62
|
-
var _useContext = (0, _react.useContext)(_Selectcontext.Context), checked = _useContext.checked, multiselect = _useContext.multiselect, size = _useContext.size, variant = _useContext.variant, renderItem = _useContext.renderItem, // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
63
|
-
// @ts-ignore
|
|
64
|
-
_checkboxAppearance = _useContext._checkboxAppearance, focusedPath = _useContext.focusedPath, valueToPathMap = _useContext.valueToPathMap;
|
|
65
|
-
var itemDisabled = Boolean(disabled || isDisabled);
|
|
66
|
-
var currentItemDepth = (((_valueToPathMap_get = valueToPathMap.get(item.value.toString())) === null || _valueToPathMap_get === void 0 ? void 0 : _valueToPathMap_get.length) || 0) - 1;
|
|
67
|
-
var withArrowInverse = isCurrentLevelOpened ? _Selecttokens.classes.arrowInverse : undefined;
|
|
68
|
-
var focusedClass = currentItemDepth === focusedPath.length - 1 && index === (focusedPath === null || focusedPath === void 0 ? void 0 : focusedPath[currentItemDepth]) ? _Selecttokens.classes.dropdownItemIsFocused : undefined;
|
|
69
|
-
return /*#__PURE__*/ _react.default.createElement(_Itemstyles.Wrapper, {
|
|
70
|
-
className: focusedClass,
|
|
71
|
-
onClick: onClick,
|
|
72
|
-
variant: variant,
|
|
73
|
-
role: "treeitem"
|
|
74
|
-
}, /*#__PURE__*/ _react.default.createElement(_Itemstyles.Offset, {
|
|
75
|
-
depth: currentItemDepth
|
|
76
|
-
}), /*#__PURE__*/ _react.default.createElement(_Itemstyles.DisclosureIconWrapper, {
|
|
77
|
-
visibility: isLeaf ? 'hidden' : 'visible'
|
|
78
|
-
}, /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledArrowLeft, {
|
|
79
|
-
size: (0, _utils.sizeToIconSize)(size, variant),
|
|
80
|
-
color: "inherit",
|
|
81
|
-
className: withArrowInverse
|
|
82
|
-
})), multiselect && /*#__PURE__*/ _react.default.createElement(_Itemstyles.IconWrapper, {
|
|
83
|
-
variant: variant
|
|
84
|
-
}, /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledCheckboxWrapper, {
|
|
85
|
-
onClick: function(e) {
|
|
86
|
-
return e.stopPropagation();
|
|
87
|
-
}
|
|
88
|
-
}, /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledCheckbox, {
|
|
89
|
-
disabled: itemDisabled,
|
|
90
|
-
checked: Boolean(checked.get(item.value)),
|
|
91
|
-
indeterminate: checked.get(item.value) === 'indeterminate',
|
|
92
|
-
onChange: onChange,
|
|
93
|
-
appearance: _checkboxAppearance !== null && _checkboxAppearance !== void 0 ? _checkboxAppearance : 'default'
|
|
94
|
-
}))), renderItem ? /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledText, null, renderItem(item)) : /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledWrapper, {
|
|
95
|
-
disabled: itemDisabled
|
|
96
|
-
}, /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledCell, {
|
|
97
|
-
contentLeft: contentLeft,
|
|
98
|
-
contentRight: contentRight,
|
|
99
|
-
// TODO: #1548
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
title: /*#__PURE__*/ _react.default.createElement("span", null, label)
|
|
103
|
-
})), !multiselect && /*#__PURE__*/ _react.default.createElement(_Itemstyles.IconWrapper, {
|
|
104
|
-
variant: variant
|
|
105
|
-
}, checked.get(item.value) === 'dot' && /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledIndicator, {
|
|
106
|
-
size: "s",
|
|
107
|
-
view: "default"
|
|
108
|
-
}), checked.get(item.value) === 'done' && /*#__PURE__*/ _react.default.createElement(_Itemstyles.StyledIconDone, {
|
|
109
|
-
size: (0, _utils.sizeToIconSize)(size, variant),
|
|
110
|
-
color: "inherit"
|
|
111
|
-
})));
|
|
112
|
-
};
|