intelicoreact 1.0.97 → 1.0.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +7 -4
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +10 -4
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +22 -3
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.scss +11 -0
- package/package.json +1 -1
|
@@ -143,7 +143,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
143
143
|
}).filter(function (item) {
|
|
144
144
|
var _item$label;
|
|
145
145
|
|
|
146
|
-
return item === null || item === void 0 ? void 0 : (_item$label = item.label) === null || _item$label === void 0 ? void 0 : _item$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || '');
|
|
146
|
+
return (item === null || item === void 0 ? void 0 : (_item$label = item.label) === null || _item$label === void 0 ? void 0 : _item$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || '')) || !(item !== null && item !== void 0 && item.value) || (item === null || item === void 0 ? void 0 : item.value) === '';
|
|
147
147
|
});
|
|
148
148
|
var filteredOptions = [].concat((0, _toConsumableArray2.default)(filteredItems), (0, _toConsumableArray2.default)(filteredGroups));
|
|
149
149
|
var modalBtnTrigger = entity && entity !== '' && typeof entity === 'string';
|
|
@@ -218,7 +218,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
218
218
|
var getMarkupForElement = function getMarkupForElement(item, index, optTestId) {
|
|
219
219
|
var _item$label2, _item$label2$toLowerC, _item$label2$toLowerC2, _item$label2$toLowerC3, _searchValue$toLowerC, _item$value, _item$value$toString, _item$value2, _item$value2$toString, _cn;
|
|
220
220
|
|
|
221
|
-
return item !== null && item !== void 0 && (_item$label2 = item.label) !== null && _item$label2 !== void 0 && (_item$label2$toLowerC = _item$label2.toLowerCase) !== null && _item$label2$toLowerC !== void 0 && (_item$label2$toLowerC2 = _item$label2$toLowerC.call(_item$label2)) !== null && _item$label2$toLowerC2 !== void 0 && (_item$label2$toLowerC3 = _item$label2$toLowerC2.includes) !== null && _item$label2$toLowerC3 !== void 0 && _item$label2$toLowerC3.call(_item$label2$toLowerC2, (searchValue === null || searchValue === void 0 ? void 0 : (_searchValue$toLowerC = searchValue.toLowerCase) === null || _searchValue$toLowerC === void 0 ? void 0 : _searchValue$toLowerC.call(searchValue)) || '') ? /*#__PURE__*/_react.default.createElement("button", {
|
|
221
|
+
return item !== null && item !== void 0 && (_item$label2 = item.label) !== null && _item$label2 !== void 0 && (_item$label2$toLowerC = _item$label2.toLowerCase) !== null && _item$label2$toLowerC !== void 0 && (_item$label2$toLowerC2 = _item$label2$toLowerC.call(_item$label2)) !== null && _item$label2$toLowerC2 !== void 0 && (_item$label2$toLowerC3 = _item$label2$toLowerC2.includes) !== null && _item$label2$toLowerC3 !== void 0 && _item$label2$toLowerC3.call(_item$label2$toLowerC2, (searchValue === null || searchValue === void 0 ? void 0 : (_searchValue$toLowerC = searchValue.toLowerCase) === null || _searchValue$toLowerC === void 0 ? void 0 : _searchValue$toLowerC.call(searchValue)) || '') || !(item !== null && item !== void 0 && item.value) || (item === null || item === void 0 ? void 0 : item.value) === '' || (item === null || item === void 0 ? void 0 : item.value) === 'open_modal' ? /*#__PURE__*/_react.default.createElement("button", {
|
|
222
222
|
"data-testid": "dropdown--button--key-".concat(optTestId || (item === null || item === void 0 ? void 0 : (_item$value = item.value) === null || _item$value === void 0 ? void 0 : (_item$value$toString = _item$value.toString()) === null || _item$value$toString === void 0 ? void 0 : _item$value$toString.replace(/\s/, '-')) || (item === null || item === void 0 ? void 0 : item.key) || 'item', "--option"),
|
|
223
223
|
key: (_item$value2 = item.value) === null || _item$value2 === void 0 ? void 0 : (_item$value2$toString = _item$value2.toString()) === null || _item$value2$toString === void 0 ? void 0 : _item$value2$toString.replace(/ /g, '_'),
|
|
224
224
|
onClick: function onClick() {
|
|
@@ -324,14 +324,17 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
324
324
|
var newData = (0, _toConsumableArray2.default)(data);
|
|
325
325
|
|
|
326
326
|
if (sortAlphabetical) {
|
|
327
|
-
var _newData, _newData2;
|
|
327
|
+
var _newData, _newData2, _newData3;
|
|
328
328
|
|
|
329
329
|
newData = [].concat((0, _toConsumableArray2.default)((_newData = newData) === null || _newData === void 0 ? void 0 : _newData.filter(function (_ref4) {
|
|
330
330
|
var value = _ref4.value;
|
|
331
331
|
return value === 'open_modal';
|
|
332
332
|
})), (0, _toConsumableArray2.default)((_newData2 = newData) === null || _newData2 === void 0 ? void 0 : _newData2.filter(function (_ref5) {
|
|
333
333
|
var value = _ref5.value;
|
|
334
|
-
return value
|
|
334
|
+
return value === '';
|
|
335
|
+
})), (0, _toConsumableArray2.default)((_newData3 = newData) === null || _newData3 === void 0 ? void 0 : _newData3.filter(function (_ref6) {
|
|
336
|
+
var value = _ref6.value;
|
|
337
|
+
return value !== 'open_modal' && value !== '';
|
|
335
338
|
}).sort(_utils.compareAlphabetical))).map(function (item) {
|
|
336
339
|
if (item !== null && item !== void 0 && item.items) {
|
|
337
340
|
item.items = (0, _toConsumableArray2.default)(item.items).sort(_utils.compareAlphabetical);
|
|
@@ -186,12 +186,17 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
186
186
|
return document.removeEventListener('click', handleClickOutside, true);
|
|
187
187
|
};
|
|
188
188
|
}, [value]);
|
|
189
|
+
(0, _react.useEffect)(function () {
|
|
190
|
+
if (options.length === 1 && searchValue === options[0].label) {
|
|
191
|
+
setSearchValue(options[0].label);
|
|
192
|
+
onChange(options[0].value);
|
|
193
|
+
}
|
|
194
|
+
}, [options]);
|
|
189
195
|
|
|
190
196
|
var searchableInputFocus = function searchableInputFocus(e) {
|
|
191
197
|
if (!isOpen) {
|
|
192
198
|
e.preventDefault();
|
|
193
199
|
e.stopPropagation();
|
|
194
|
-
return;
|
|
195
200
|
}
|
|
196
201
|
};
|
|
197
202
|
|
|
@@ -207,6 +212,7 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
207
212
|
|
|
208
213
|
if (searchValue && !e.target.value) {
|
|
209
214
|
onChange('');
|
|
215
|
+
setSearchValue('');
|
|
210
216
|
setIsValueDeleted(true);
|
|
211
217
|
} else setIsValueDeleted(false);
|
|
212
218
|
}
|
|
@@ -273,14 +279,14 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
273
279
|
}, isSearchable ? /*#__PURE__*/_react.default.createElement("input", {
|
|
274
280
|
ref: searchInputRef,
|
|
275
281
|
className: "".concat(RC, "__input"),
|
|
276
|
-
value: searchValue
|
|
282
|
+
value: isOpen ? searchValue : labelByValue,
|
|
277
283
|
onChange: handle.onInputChange,
|
|
278
284
|
placeholder: placeholder,
|
|
279
285
|
onFocus: searchableInputFocus,
|
|
280
286
|
onClick: handle.onInputClick
|
|
281
|
-
}) : /*#__PURE__*/_react.default.createElement(
|
|
287
|
+
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
282
288
|
className: "text"
|
|
283
|
-
}, labelByValue || placeholder)
|
|
289
|
+
}, labelByValue || placeholder), /*#__PURE__*/_react.default.createElement("span", {
|
|
284
290
|
className: (0, _classnames.default)("".concat(RC, "__arrow"), (0, _defineProperty2.default)({}, "".concat(RC, "__arrow_active"), isOpen)),
|
|
285
291
|
onClick: function onClick() {
|
|
286
292
|
return setIsOpen(!isOpen);
|
|
@@ -17,6 +17,8 @@ var _utils = require("../../../Functions/utils");
|
|
|
17
17
|
|
|
18
18
|
require("./FileLoaderLocal.scss");
|
|
19
19
|
|
|
20
|
+
var DEFAULT_LABEL_PREFIX = 'Please attach';
|
|
21
|
+
|
|
20
22
|
var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
21
23
|
var id = _ref.id,
|
|
22
24
|
label = _ref.label,
|
|
@@ -27,7 +29,9 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
|
27
29
|
className = _ref.className,
|
|
28
30
|
value = _ref.value,
|
|
29
31
|
isNoTrashIcon = _ref.isNoTrashIcon,
|
|
30
|
-
maxItemSizeBytes = _ref.maxItemSizeBytes
|
|
32
|
+
maxItemSizeBytes = _ref.maxItemSizeBytes,
|
|
33
|
+
titleDescription = _ref.titleDescription,
|
|
34
|
+
testId = _ref.testId;
|
|
31
35
|
|
|
32
36
|
var getFileName = function getFileName(value) {
|
|
33
37
|
var result = value.match(/[^\\]+$/);
|
|
@@ -85,7 +89,22 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
|
85
89
|
});
|
|
86
90
|
}
|
|
87
91
|
};
|
|
88
|
-
|
|
92
|
+
|
|
93
|
+
var renderLabel = function renderLabel() {
|
|
94
|
+
if (!titleDescription) return null;
|
|
95
|
+
var acceptExtensionsList = accept === null || accept === void 0 ? void 0 : accept.split(',');
|
|
96
|
+
var concatedAcceptList = (acceptExtensionsList === null || acceptExtensionsList === void 0 ? void 0 : acceptExtensionsList.map(function (item, i) {
|
|
97
|
+
return item.replace('.', '').toUpperCase().concat("".concat(acceptExtensionsList.length - 1 !== i ? ',' : ''));
|
|
98
|
+
})) || '';
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
100
|
+
className: "file-loader-local__top-label"
|
|
101
|
+
}, DEFAULT_LABEL_PREFIX, " ", titleDescription, ' ', /*#__PURE__*/_react.default.createElement("span", {
|
|
102
|
+
className: "file-loader-local__top-label-extension"
|
|
103
|
+
}, "(", concatedAcceptList, "):"));
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderLabel(), /*#__PURE__*/_react.default.createElement("div", {
|
|
107
|
+
"data-testid": "input--file-loader-local--key-".concat(testId),
|
|
89
108
|
className: (0, _classnames.default)('file-loader-local', className)
|
|
90
109
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
91
110
|
onChange: handle.change,
|
|
@@ -119,7 +138,7 @@ var FileLoaderLocal = function FileLoaderLocal(_ref) {
|
|
|
119
138
|
id: id
|
|
120
139
|
});
|
|
121
140
|
}
|
|
122
|
-
}), renderRequiredLabel()));
|
|
141
|
+
}), renderRequiredLabel())));
|
|
123
142
|
};
|
|
124
143
|
|
|
125
144
|
var _default = FileLoaderLocal;
|
|
@@ -8,6 +8,17 @@
|
|
|
8
8
|
border-radius: 8px;
|
|
9
9
|
box-shadow: 0px 2px 8px rgb(39 73 113 / 15%);
|
|
10
10
|
|
|
11
|
+
&__top-label {
|
|
12
|
+
margin-bottom: 16px;
|
|
13
|
+
font-weight: 400;
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
line-height: 20px;
|
|
16
|
+
letter-spacing: 0.2px;
|
|
17
|
+
&-extension {
|
|
18
|
+
color: #757F8C;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
11
22
|
&__file-input {
|
|
12
23
|
width: 0.1px;
|
|
13
24
|
height: 0.1px;
|