ehscan-react-components 0.1.20 → 0.1.22
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.js +2 -2
- package/dist/style/input.css +6 -6
- package/package.json +1 -1
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 }) => {
|
|
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: "ext-textarea-wrapper", 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",
|
|
43
|
+
return (_jsxs("div", { className: "ext-textarea-wrapper", 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
|
@@ -122,7 +122,7 @@ input:-webkit-autofill:active {
|
|
|
122
122
|
|
|
123
123
|
.ext-textarea {
|
|
124
124
|
font-size: var(--ext-textarea-input-txt-size, 14px);
|
|
125
|
-
background-color: var(--ext-textarea-input-bck-clr,
|
|
125
|
+
background-color: var(--ext-textarea-input-bck-clr, white);
|
|
126
126
|
color: var(--ext-textarea-input-clr, red);
|
|
127
127
|
font-weight: var(--ext-textarea-d-font-weight, 400);
|
|
128
128
|
border-radius: var(--ext-textarea-border-radius, 20px);
|
|
@@ -140,8 +140,8 @@ input:-webkit-autofill:active {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
.ext-textarea:focus{
|
|
143
|
-
background-color: var(--ext-textarea-focus-bck-clr);
|
|
144
|
-
border-radius: var(--ext-textarea-border-radius);
|
|
143
|
+
background-color: var(--ext-textarea-focus-bck-clr, lavender);
|
|
144
|
+
border-radius: var(--ext-textarea-border-radius, 20px);
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
input[type="text"],
|
|
@@ -167,14 +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;
|
|
174
|
+
border-radius: var(--ext-textarea-border-radius, 50px);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
.ext-textarea-svg-close:hover{
|
|
178
178
|
cursor: pointer;
|
|
179
|
-
background-color:
|
|
179
|
+
background-color: var(--ext-textarea-svg-close-hover-bck-clr, lightgrey);
|
|
180
180
|
}
|