dhre-component-lib 0.6.9 → 0.7.0
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/index.esm.js +15 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -9631,20 +9631,32 @@ function Dropdown(props) {
|
|
|
9631
9631
|
React__default.createElement(Typography, { variant: "B3", weight: "SEMI_BOLD" }, val.name)))))))));
|
|
9632
9632
|
}
|
|
9633
9633
|
|
|
9634
|
-
var css$8 = ".textArea {\n min-width: 70%;\n width: 100%;\n height: 8.875rem;\n border-radius: 0.5rem;\n padding: 1rem;\n font-size: 1rem;\n font-family: Meraas Aktiv;\n font-weight: 400;\n line-height: 1.4rem;\n text-align: left;\n outline: none;\n resize: none;\n overflow: auto;\n max-width: 100%;\n max-height: 100%;\n}\n.characters {\n color: #686868;\n}\n\n.textArea100 {\n height: 100%;\n width: 100%;\n
|
|
9634
|
+
var css$8 = ".textArea {\n min-width: 70%;\n width: 100%;\n height: 8.875rem;\n border-radius: 0.5rem;\n padding: 1rem;\n font-size: 1rem;\n font-family: Meraas Aktiv;\n font-weight: 400;\n line-height: 1.4rem;\n text-align: left;\n outline: none;\n resize: none;\n overflow: auto;\n max-width: 100%;\n max-height: 100%;\n}\n.inputTextAreaLabel {\n position: absolute;\n z-index: 1;\n top: -10px;\n left: 11px;\n background: #ffffff;\n padding: 0 6px;\n transition: all 0.3s ease-out;\n}\n\n.astreik {\n color: #eb0542;\n}\n\n.characters {\n color: #686868;\n}\n\n.textArea100 {\n height: 100%;\n width: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n}\n\n.positionRel {\n position: relative;\n z-index: 0;\n}\n\n.label {\n position: absolute;\n z-index: 1;\n top: -10px;\n left: 11px;\n background: #ffffff;\n padding: 0 6px;\n transition: all 0.3s ease-out;\n}\n\n.astreik {\n color: #eb0542;\n}\n\n.textArea::placeholder {\n font-family: Meraas Aktiv, sans-serif;\n font-size: 16px;\n font-weight: 400;\n line-height: 22.4px;\n text-align: left;\n color: #686868;\n}\n\n.maxLimit {\n color: #eb0542 !important;\n}\n\n.maxLimitArea {\n border: 1px solid #eb0542 !important;\n}";
|
|
9635
9635
|
n(css$8,{});
|
|
9636
9636
|
|
|
9637
9637
|
function TextArea(props) {
|
|
9638
9638
|
const { value, onChange, requiredLimit, placeholder, charText, property } = props;
|
|
9639
|
+
const [showLabelOnBorder, setShowLabelOnBorder] = useState(false);
|
|
9639
9640
|
const checkSpecialChar = (e) => {
|
|
9640
9641
|
if (!/[0-9a-zA-Z ]/.test(e.key)) {
|
|
9641
9642
|
e.preventDefault();
|
|
9642
9643
|
}
|
|
9643
9644
|
console.log('textAraea');
|
|
9644
9645
|
};
|
|
9645
|
-
|
|
9646
|
+
const checkFieldValue = (e) => {
|
|
9647
|
+
if (!e.key) {
|
|
9648
|
+
setShowLabelOnBorder(false);
|
|
9649
|
+
}
|
|
9650
|
+
};
|
|
9651
|
+
useEffect(() => {
|
|
9652
|
+
setShowLabelOnBorder(!!value);
|
|
9653
|
+
}, [value]);
|
|
9654
|
+
return (React__default.createElement("div", { className: "positionRel" },
|
|
9646
9655
|
React__default.createElement("div", { className: "textArea100" },
|
|
9647
|
-
|
|
9656
|
+
((placeholder && showLabelOnBorder) || (placeholder && value)) && React__default.createElement("label", { className: 'inputTextAreaLabel' },
|
|
9657
|
+
placeholder.replace("*", ""),
|
|
9658
|
+
placeholder.includes("*") && React__default.createElement("label", { className: 'astreik' }, "*")),
|
|
9659
|
+
React__default.createElement("textarea", { value: value, onChange: (event) => onChange(event, property), onKeyDown: checkSpecialChar, maxLength: Number(requiredLimit), className: `textArea ${value && value?.length > Number(requiredLimit) ? "maxLimitArea" : ""}`, placeholder: showLabelOnBorder ? "" : placeholder, onFocus: () => setShowLabelOnBorder(true), onBlur: checkFieldValue })),
|
|
9648
9660
|
React__default.createElement(Typography, { className: `characters ${value &&
|
|
9649
9661
|
value?.length > Number(requiredLimit) ? "maxLimit" : ""}`, variant: "L1", weight: "SEMI_BOLD" },
|
|
9650
9662
|
value?.length ?? 0,
|