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