Fix/input undefined value (#1369)

* fix(input): undefined value uncontrolled

* fix(input): undefined value uncontrolled
This commit is contained in:
Junior Garcia 2023-08-11 14:54:29 -03:00 committed by GitHub
parent e6c3747153
commit abe1ba58de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -0,0 +1,5 @@
---
"@nextui-org/input": patch
---
fix #1332 undefined value removed from input value

View File

@ -13,12 +13,12 @@ const removeIgnoredFiles = async (files) => {
};
module.exports = {
"**/*.{cjs,mjs,js,ts,jsx,tsx}": async (files) => {
"**/*.{js,ts,jsx,tsx}": async (files) => {
const filesToLint = await removeIgnoredFiles(files);
return [`eslint -c .eslintrc.json --max-warnings=0 --fix ${filesToLint}`];
},
"**/*.{css,json,md}": async (files) => {
"**/*.css": async (files) => {
const filesToLint = await removeIgnoredFiles(files);
return [`prettier --config .prettierrc.json --ignore-path --write ${filesToLint}`];

View File

@ -94,8 +94,8 @@ export function useInput<T extends HTMLInputElement | HTMLTextAreaElement = HTML
);
const [inputValue, setInputValue] = useControlledState<string | undefined>(
props.value ?? undefined,
props.defaultValue ?? undefined,
props.value,
props.defaultValue,
handleValueChange,
);
@ -125,7 +125,7 @@ export function useInput<T extends HTMLInputElement | HTMLTextAreaElement = HTML
originalProps?.placeholder,
),
inputElementType: isMultiline ? "textarea" : "input",
value: inputValue,
value: inputValue ?? "",
onChange: setInputValue,
},
domRef,