intelicoreact 0.2.91 → 0.2.92
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.
|
@@ -21,6 +21,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
21
21
|
|
|
22
22
|
var _reactFeather = require("react-feather");
|
|
23
23
|
|
|
24
|
+
var _TagList = _interopRequireDefault(require("../../UI/TagList/TagList"));
|
|
25
|
+
|
|
24
26
|
var _Tag = _interopRequireDefault(require("../../UI/Tag/Tag"));
|
|
25
27
|
|
|
26
28
|
var _Label = _interopRequireDefault(require("../Label/Label"));
|
|
@@ -51,7 +53,9 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
51
53
|
disabled = _ref.disabled,
|
|
52
54
|
isValuesInTags = _ref.isValuesInTags,
|
|
53
55
|
_ref$isNotValidateASC = _ref.isNotValidateASCII,
|
|
54
|
-
isNotValidateASCII = _ref$isNotValidateASC === void 0 ? false : _ref$isNotValidateASC
|
|
56
|
+
isNotValidateASCII = _ref$isNotValidateASC === void 0 ? false : _ref$isNotValidateASC,
|
|
57
|
+
_ref$noTagsWrap = _ref.noTagsWrap,
|
|
58
|
+
noTagsWrap = _ref$noTagsWrap === void 0 ? false : _ref$noTagsWrap;
|
|
55
59
|
|
|
56
60
|
var _useState = (0, _react.useState)(false),
|
|
57
61
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -134,10 +138,22 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
134
138
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
135
139
|
className: "".concat(RC, "__trigger"),
|
|
136
140
|
onClick: function onClick(e) {
|
|
137
|
-
if (e.target.className === "".concat(RC, "__trigger") || e.target.className === "tags-dropdown__arrow" || e.target.tagName === 'svg' && e.target.parentNode.className !== 'tag__button') setIsOpen(!isOpen);else if (e.target.tagName === 'INPUT') setIsOpen(true);
|
|
141
|
+
if (e.target.className.indexOf('tag__label') !== -1 || e.target.className.indexOf('tag-list_wrapper') !== -1 || e.target.className === "".concat(RC, "__trigger") || e.target.className === "tags-dropdown__arrow" || e.target.tagName === 'svg' && e.target.parentNode.className !== 'tag__button') setIsOpen(!isOpen);else if (e.target.tagName === 'INPUT') setIsOpen(true);
|
|
138
142
|
}
|
|
139
|
-
},
|
|
140
|
-
|
|
143
|
+
}, noTagsWrap ? /*#__PURE__*/_react.default.createElement(_TagList.default, {
|
|
144
|
+
items: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.map(function (value, i) {
|
|
145
|
+
var tag = singleLevelOptions === null || singleLevelOptions === void 0 ? void 0 : singleLevelOptions.find(function (el) {
|
|
146
|
+
return el.value === value;
|
|
147
|
+
});
|
|
148
|
+
var label = isValuesInTags ? tag === null || tag === void 0 ? void 0 : tag.value : (tag === null || tag === void 0 ? void 0 : tag.label) || (tag === null || tag === void 0 ? void 0 : tag.name) || (tag === null || tag === void 0 ? void 0 : tag.title);
|
|
149
|
+
return {
|
|
150
|
+
value: value,
|
|
151
|
+
label: label,
|
|
152
|
+
id: i
|
|
153
|
+
};
|
|
154
|
+
}),
|
|
155
|
+
disableShowMore: true
|
|
156
|
+
}) : chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.map(function (value) {
|
|
141
157
|
var tag = singleLevelOptions === null || singleLevelOptions === void 0 ? void 0 : singleLevelOptions.find(function (el) {
|
|
142
158
|
return el.value === value;
|
|
143
159
|
});
|
|
@@ -150,17 +166,17 @@ var TagsDropdown = function TagsDropdown(_ref) {
|
|
|
150
166
|
return deleteChosen(value);
|
|
151
167
|
}
|
|
152
168
|
});
|
|
153
|
-
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
169
|
+
}), chosenOptions.length === 0 || !noTagsWrap ? /*#__PURE__*/_react.default.createElement("input", {
|
|
154
170
|
className: "".concat(RC, "__input"),
|
|
155
171
|
value: searchValue,
|
|
156
172
|
onChange: function onChange(e) {
|
|
157
173
|
return onSearchHandler(e.target.value);
|
|
158
174
|
},
|
|
159
|
-
placeholder: placeholder ||
|
|
175
|
+
placeholder: placeholder || 'Select from list',
|
|
160
176
|
onKeyDown: function onKeyDown(e) {
|
|
161
177
|
return onKeyPress(e, searchValue);
|
|
162
178
|
}
|
|
163
|
-
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
179
|
+
}) : '', /*#__PURE__*/_react.default.createElement("span", {
|
|
164
180
|
className: (0, _classnames.default)("".concat(RC, "__arrow"), (0, _defineProperty2.default)({}, "".concat(RC, "__arrow_active"), isOpen))
|
|
165
181
|
}, /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, {
|
|
166
182
|
className: "color--text"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@import "../../../scss/vars";
|
|
2
2
|
|
|
3
3
|
.tags-dropdown {
|
|
4
|
-
display:
|
|
4
|
+
display: flex;
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
position: relative;
|
|
7
7
|
width: 100%;
|
|
@@ -144,6 +144,13 @@
|
|
|
144
144
|
cursor: auto;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
.tag-list_wrapper {
|
|
148
|
+
box-sizing: border-box;
|
|
149
|
+
background-color: rgba(0,0,0,0);
|
|
150
|
+
padding: 0;
|
|
151
|
+
width: auto;
|
|
152
|
+
}
|
|
153
|
+
|
|
147
154
|
&_arrow-static {
|
|
148
155
|
.tags-dropdown__trigger {
|
|
149
156
|
position: static;
|
|
@@ -48,6 +48,8 @@ var TagList = function TagList(_ref) {
|
|
|
48
48
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
49
49
|
_ref$withToggle = _ref.withToggle,
|
|
50
50
|
withToggle = _ref$withToggle === void 0 ? true : _ref$withToggle,
|
|
51
|
+
_ref$disableShowMore = _ref.disableShowMore,
|
|
52
|
+
disableShowMore = _ref$disableShowMore === void 0 ? false : _ref$disableShowMore,
|
|
51
53
|
_ref$shownItemsCount = _ref.shownItemsCount,
|
|
52
54
|
shownItemsCount = _ref$shownItemsCount === void 0 ? 'auto' : _ref$shownItemsCount,
|
|
53
55
|
_ref$testId = _ref.testId,
|
|
@@ -199,7 +201,7 @@ var TagList = function TagList(_ref) {
|
|
|
199
201
|
return /*#__PURE__*/_react.default.createElement(_Tag.default, {
|
|
200
202
|
label: "+".concat(restItems),
|
|
201
203
|
className: "tag-list_wrapper_render-more",
|
|
202
|
-
onClick: function
|
|
204
|
+
onClick: disableShowMore ? function () {} : function (e) {
|
|
203
205
|
return cancelDefault(e, function () {
|
|
204
206
|
return setRenderAll(true);
|
|
205
207
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
.tag-list_wrapper{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
flex-wrap: wrap;
|
|
8
|
-
}
|
|
1
|
+
// .tag-list_wrapper{
|
|
2
|
+
// width: 25%!important;
|
|
3
|
+
// background-color: #fbf9f9;
|
|
4
|
+
// padding: 25px;
|
|
5
|
+
// flex-wrap: wrap;
|
|
6
|
+
// }
|