fix: improve autocomplete typings
This commit is contained in:
parent
9d0936ed54
commit
e0dadaf817
@ -32,7 +32,7 @@ export interface AutocompleteProps<T> {
|
||||
required?: boolean;
|
||||
displayValue: (item: T | T[] | null) => string;
|
||||
onQuery: (query: string) => void;
|
||||
onChange: AutocompleteChangeEventHandler<T | undefined>;
|
||||
onChange: (value: T | T[] | undefined) => void;
|
||||
}
|
||||
|
||||
const Autocomplete = function <T>(
|
||||
@ -135,9 +135,9 @@ const Autocomplete = function <T>(
|
||||
`,
|
||||
disabled &&
|
||||
`
|
||||
text-gray-300/75
|
||||
dark:text-gray-600/75
|
||||
`,
|
||||
text-gray-300/75
|
||||
dark:text-gray-600/75
|
||||
`,
|
||||
)}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
@ -153,9 +153,9 @@ const Autocomplete = function <T>(
|
||||
`,
|
||||
disabled &&
|
||||
`
|
||||
text-gray-300/75
|
||||
dark:text-gray-600/75
|
||||
`,
|
||||
text-gray-300/75
|
||||
dark:text-gray-600/75
|
||||
`,
|
||||
)}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
|
@ -296,7 +296,7 @@ const RelationControl: FC<WidgetControlProps<string | string[], RelationField>>
|
||||
const ref = useRef<HTMLButtonElement | null>(null);
|
||||
|
||||
const handleChange = useCallback(
|
||||
(newValue: string | string[] | null) => {
|
||||
(newValue: string | string[] | undefined) => {
|
||||
if (!newValue) {
|
||||
setInternalValue(newValue);
|
||||
onChange(newValue);
|
||||
|
Loading…
x
Reference in New Issue
Block a user