@fremtind/jkl-text-input-react
Advanced tools
Comparing version 15.1.1 to 15.1.2
@@ -36,3 +36,2 @@ "use strict"; | ||
const BaseTextArea = (0, import_react.forwardRef)((props, ref) => { | ||
var _a; | ||
const { | ||
@@ -50,4 +49,14 @@ autoExpand, | ||
"aria-invalid": ariaInvalid, | ||
onChange, | ||
...rest | ||
} = props; | ||
const [counterCurrent, setCounterCurrent] = (0, import_react.useState)(() => { | ||
if (typeof value === "undefined") { | ||
return 0; | ||
} else if (typeof value === "number") { | ||
return String(value).length; | ||
} else { | ||
return value.length; | ||
} | ||
}); | ||
const [textAreaFocused, setTextAreaFocused] = (0, import_react.useState)(false); | ||
@@ -83,3 +92,8 @@ const internalRef = (0, import_react.useRef)(null); | ||
} | ||
const counterCurrent = ((_a = textAreaRef.current) == null ? void 0 : _a.value.length) || 0; | ||
function handleOnChange(e) { | ||
setCounterCurrent(e.target.value.length); | ||
if (onChange) { | ||
onChange(e); | ||
} | ||
} | ||
const counterTotal = (counter == null ? void 0 : counter.maxLength) || 0; | ||
@@ -106,2 +120,3 @@ const progressCurrent = counterTotal - counterCurrent; | ||
onFocus: handleOnFocus, | ||
onChange: handleOnChange, | ||
ref: textAreaRef, | ||
@@ -108,0 +123,0 @@ style: { ...style, ...overflowStyle }, |
@@ -70,4 +70,3 @@ "use strict"; | ||
"jkl-text-area--start-open": startOpen, | ||
"jkl-text-area--auto-expand": autoExpand, | ||
"jkl-text-area--with-counter": typeof counter !== "undefined" | ||
"jkl-text-area--auto-expand": autoExpand | ||
}), | ||
@@ -74,0 +73,0 @@ "data-testid": "jkl-text-area", |
@@ -8,3 +8,2 @@ import React, { | ||
const BaseTextArea = forwardRef((props, ref) => { | ||
var _a; | ||
const { | ||
@@ -22,4 +21,14 @@ autoExpand, | ||
"aria-invalid": ariaInvalid, | ||
onChange, | ||
...rest | ||
} = props; | ||
const [counterCurrent, setCounterCurrent] = useState(() => { | ||
if (typeof value === "undefined") { | ||
return 0; | ||
} else if (typeof value === "number") { | ||
return String(value).length; | ||
} else { | ||
return value.length; | ||
} | ||
}); | ||
const [textAreaFocused, setTextAreaFocused] = useState(false); | ||
@@ -55,3 +64,8 @@ const internalRef = useRef(null); | ||
} | ||
const counterCurrent = ((_a = textAreaRef.current) == null ? void 0 : _a.value.length) || 0; | ||
function handleOnChange(e) { | ||
setCounterCurrent(e.target.value.length); | ||
if (onChange) { | ||
onChange(e); | ||
} | ||
} | ||
const counterTotal = (counter == null ? void 0 : counter.maxLength) || 0; | ||
@@ -78,2 +92,3 @@ const progressCurrent = counterTotal - counterCurrent; | ||
onFocus: handleOnFocus, | ||
onChange: handleOnChange, | ||
ref: textAreaRef, | ||
@@ -80,0 +95,0 @@ style: { ...style, ...overflowStyle }, |
@@ -37,4 +37,3 @@ import { InputGroup } from "@fremtind/jkl-input-group-react"; | ||
"jkl-text-area--start-open": startOpen, | ||
"jkl-text-area--auto-expand": autoExpand, | ||
"jkl-text-area--with-counter": typeof counter !== "undefined" | ||
"jkl-text-area--auto-expand": autoExpand | ||
}), | ||
@@ -41,0 +40,0 @@ "data-testid": "jkl-text-area", |
{ | ||
"name": "@fremtind/jkl-text-input-react", | ||
"version": "15.1.1", | ||
"version": "15.1.2", | ||
"publishConfig": { | ||
@@ -50,3 +50,3 @@ "access": "public" | ||
"@fremtind/jkl-react-hooks": "^12.0.11", | ||
"@fremtind/jkl-text-input": "^12.1.9", | ||
"@fremtind/jkl-text-input": "^12.1.10", | ||
"@fremtind/jkl-tooltip-react": "^4.2.21", | ||
@@ -70,3 +70,3 @@ "classnames": "^2.3.2", | ||
}, | ||
"gitHead": "5f90697a5d4cb29b5b404f40b4a0eadf66367299" | ||
"gitHead": "be217592ea30de0b16860a9941fad4750bccdd71" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
130814
1607