mirror of
https://github.com/logos-storage/logos-storage-marketplace-ui-components.git
synced 2026-01-02 13:33:09 +00:00
Update manualy the input invalid property
This commit is contained in:
parent
579ab4fbed
commit
52c659b9f3
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@codex-storage/marketplace-ui-components",
|
||||
"version": "0.0.51",
|
||||
"version": "0.0.52",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@codex-storage/marketplace-ui-components",
|
||||
"version": "0.0.51",
|
||||
"version": "0.0.52",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@codex-storage/sdk-js": "https://github.com/codex-storage/codex-js#feat/support-basic-auth",
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/codex-storage/codex-marketplace-ui-components"
|
||||
},
|
||||
"version": "0.0.51",
|
||||
"version": "0.0.52",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"prepack": "npm run build",
|
||||
|
||||
@ -3,6 +3,7 @@ import {
|
||||
ComponentType,
|
||||
forwardRef,
|
||||
InputHTMLAttributes,
|
||||
useEffect,
|
||||
useState,
|
||||
} from "react";
|
||||
import { attributes } from "../utils/attributes";
|
||||
@ -64,6 +65,12 @@ export const Input = forwardRef<HTMLInputElement, Props>(
|
||||
) => {
|
||||
const [invalid, setInvalid] = useState(isInvalid);
|
||||
|
||||
useEffect(() => {
|
||||
if (mode === "manual") {
|
||||
setInvalid(isInvalid);
|
||||
}
|
||||
}, [mode, isInvalid]);
|
||||
|
||||
const onInternalChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||
if (mode === "auto") {
|
||||
setInvalid(e.currentTarget.checkValidity() !== true);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user