ehscan-react-components 0.1.21 → 0.1.23
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/TextArea.d.ts +1 -0
- package/dist/TextArea.js +2 -2
- package/dist/style/input.css +3 -4
- package/package.json +1 -1
package/dist/TextArea.d.ts
CHANGED
package/dist/TextArea.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLayoutEffect, useRef, useState, useCallback, useId } from "react";
|
|
3
3
|
import './style/input.css';
|
|
4
|
-
export const TextArea = ({ id, tabIndex, label, value, editable = true, required = false, onChange, placeholder, maxLength = 500, }) => {
|
|
4
|
+
export const TextArea = ({ id, tabIndex, label, value, editable = true, required = false, onChange, placeholder, maxLength = 500, addClass }) => {
|
|
5
5
|
const textareaRef = useRef(null);
|
|
6
6
|
const [charCount, setCharCount] = useState(value.length);
|
|
7
7
|
const generatedId = useId(); // unique fallback for aria linking
|
|
@@ -40,5 +40,5 @@ export const TextArea = ({ id, tabIndex, label, value, editable = true, required
|
|
|
40
40
|
textareaRef.current.style.height = "auto";
|
|
41
41
|
}
|
|
42
42
|
}, [onChange]);
|
|
43
|
-
return (_jsxs("div", { className:
|
|
43
|
+
return (_jsxs("div", { className: `ext-textarea-wrapper ${addClass}`, 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", onClick: clear, "aria-label": `Clear ${label !== null && label !== void 0 ? label : "text area"}`, 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: "2", strokeLinecap: "round" }), _jsx("line", { x1: "16", y1: "8", x2: "8", y2: "16", stroke: "#333", strokeWidth: "2", strokeLinecap: "round" })] }) }))] })] })), _jsx("div", { className: "ext-textarea-box", children: _jsx("textarea", { id: textareaId, tabIndex: tabIndex, ref: textareaRef, value: value !== null && value !== void 0 ? value : "", placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "...", maxLength: maxLength, onChange: handleInputChange, onFocus: handleFocus, onBlur: setHeight, className: `ext-textarea${required && value === "" ? " highlight" : ""}`, rows: 1, spellCheck: false, readOnly: !editable, "aria-required": required, "aria-label": label }) })] }));
|
|
44
44
|
};
|
package/dist/style/input.css
CHANGED
|
@@ -167,15 +167,14 @@ textarea {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
.ext-textarea-svg-close{
|
|
170
|
-
background-color:
|
|
171
|
-
border-radius: 50px;
|
|
170
|
+
background-color: var(--ext-textarea-svg-close-bck-clr, transparent);
|
|
172
171
|
display: flex;
|
|
173
172
|
align-items: center;
|
|
174
173
|
justify-content: center;
|
|
175
|
-
border-radius: var(--ext-textarea-border-radius);
|
|
174
|
+
border-radius: var(--ext-textarea-border-radius, 50px);
|
|
176
175
|
}
|
|
177
176
|
|
|
178
177
|
.ext-textarea-svg-close:hover{
|
|
179
178
|
cursor: pointer;
|
|
180
|
-
background-color:
|
|
179
|
+
background-color: var(--ext-textarea-svg-close-hover-bck-clr, lightgrey);
|
|
181
180
|
}
|