ehscan-react-components 0.1.32 → 0.1.34
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/TextAreaDropDown.js
CHANGED
|
@@ -98,13 +98,14 @@ export const TextAreaDropDown = ({ id, tabIndex, alwaysOpenDropDown, closeComman
|
|
|
98
98
|
useEffect(() => {
|
|
99
99
|
if (searchTerm === undefined)
|
|
100
100
|
return;
|
|
101
|
+
if (searchTerm !== "")
|
|
102
|
+
setOpenDropDown(true); //if closed on !alwaysOpenDropDown
|
|
101
103
|
if (dropdownValue.includes(searchTerm)) {
|
|
102
104
|
setNewBtn(false);
|
|
105
|
+
return;
|
|
103
106
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
setNewBtn(true);
|
|
107
|
-
}
|
|
107
|
+
if (searchTerm !== '')
|
|
108
|
+
setNewBtn(true);
|
|
108
109
|
}, [searchTerm]);
|
|
109
110
|
useEffect(() => {
|
|
110
111
|
if (!closeCommand)
|
|
@@ -112,12 +113,22 @@ export const TextAreaDropDown = ({ id, tabIndex, alwaysOpenDropDown, closeComman
|
|
|
112
113
|
setOpenDropDown(false);
|
|
113
114
|
}, [closeCommand]);
|
|
114
115
|
const focusInput = () => {
|
|
115
|
-
if (alwaysOpenDropDown
|
|
116
|
+
if (alwaysOpenDropDown) {
|
|
116
117
|
setOpenDropDown(true);
|
|
118
|
+
return;
|
|
117
119
|
}
|
|
120
|
+
console.log(searchTerm);
|
|
121
|
+
if (searchTerm) {
|
|
122
|
+
setOpenDropDown(true);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const blurInput = () => {
|
|
126
|
+
setOpenDropDown(false);
|
|
127
|
+
setNewBtn(false);
|
|
128
|
+
setSearchTerm('');
|
|
118
129
|
};
|
|
119
130
|
if (!tags)
|
|
120
131
|
return null;
|
|
121
|
-
return (_jsxs("div", { className: `ext-textarea-wrapper-dropdown ${addClass}`, ref: textareaRef, children: [label && (_jsxs("div", { className: "ext-textarea-label", children: [_jsxs("label", { className: "ext-textarea-label-title", htmlFor: textareaId, children: [label, " ", required && _jsx("span", { className: "required", children: "*" })] }), _jsxs("div", { className: "ext-textarea-label-btns", children: [editable && charCount > 0 && (_jsxs("div", { className: "form-container-count", children: [charCount, " / ", maxLength] })), editable && charCount > 0 && (_jsx("div", { className: "ext-textarea-svg-close", "aria-label": `Clear ${label !== null && label !== void 0 ? label : "text area"}` }))] })] })), _jsx("div", { className: `ext-textarea-box-dropdown${openDropDown ? ' open' : ''}`, onClick: () =>
|
|
132
|
+
return (_jsxs("div", { className: `ext-textarea-wrapper-dropdown ${addClass}`, ref: textareaRef, children: [label && (_jsxs("div", { className: "ext-textarea-label", children: [_jsxs("label", { className: "ext-textarea-label-title", htmlFor: textareaId, children: [label, " ", required && _jsx("span", { className: "required", children: "*" })] }), _jsxs("div", { className: "ext-textarea-label-btns", children: [editable && charCount > 0 && (_jsxs("div", { className: "form-container-count", children: [charCount, " / ", maxLength] })), editable && charCount > 0 && (_jsx("div", { className: "ext-textarea-svg-close", "aria-label": `Clear ${label !== null && label !== void 0 ? label : "text area"}` }))] })] })), _jsx("div", { className: `ext-textarea-box-dropdown${openDropDown ? ' open' : ''}`, onClick: () => focusInput(), children: _jsxs("div", { className: "ext-textarea-dropdown-inner", children: [tags.map((item, index) => (_jsxs("div", { className: "textarea-tag loop", children: [_jsx("div", { children: item }), _jsx("div", { className: "textarea-tag-erase", onClick: () => removeTag(tags[index]), children: _jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("line", { x1: "8", y1: "8", x2: "16", y2: "16", stroke: "#333", strokeWidth: "1", strokeLinecap: "round" }), _jsx("line", { x1: "16", y1: "8", x2: "8", y2: "16", stroke: "#333", strokeWidth: "1", strokeLinecap: "round" })] }) })] }, index))), _jsx("div", { className: "search-x-wrapper", children: _jsxs("div", { className: "search-x", children: [_jsx("div", { className: "search-x-input", children: _jsx("input", { type: "text", tabIndex: tabIndex, ref: searchInput, onFocus: () => focusInput(), onBlur: () => blurInput(), placeholder: placeholder, value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), onKeyDown: handleKeyDown }) }), _jsx("div", { className: `search-x-btn${newBtn ? ' show' : ''}`, onClick: () => createItem(), children: newBtn && 'create new one' })] }) })] }) }), _jsx(DropDown, { ref: childRef, maxDropDownHeight: maxDropDownHeight, openDropDown: openDropDown, display: filterItems, addItem: addItem, maxDropDownEntries: maxDropDownEntries, searchTerm: searchTerm })] }));
|
|
122
133
|
};
|
|
123
134
|
export default TextAreaDropDown;
|
|
@@ -317,7 +317,7 @@ input:-webkit-autofill:active {
|
|
|
317
317
|
float: left;
|
|
318
318
|
margin: 3px;
|
|
319
319
|
margin: 3px;
|
|
320
|
-
background-color: var(--textarea-
|
|
320
|
+
background-color: var(--textarea-searchtag-bck-clr, transparent);
|
|
321
321
|
gap: 10px;
|
|
322
322
|
flex: 1 1 auto;
|
|
323
323
|
}
|