Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8a72d3a
export typeahead utils
Michele-Masciave Apr 11, 2025
f8dc2b0
integrate placeholder fix and changelog
Michele-Masciave Apr 16, 2025
a857384
adjust typescript
Michele-Masciave Apr 16, 2025
e1267ef
prepare-pr
Michele-Masciave Apr 28, 2025
12211f1
fixed
Michele-Masciave Apr 30, 2025
92e5c21
Merge branch 'main' of https://github.com/Michele-Masciave/react-hook…
Michele-Masciave Apr 30, 2025
a9347da
Merge branch 'neolution-ch:main' into main
Michele-Masciave May 7, 2025
2987413
Merge branch 'neolution-ch:main' into main
Michele-Masciave Jun 3, 2025
acad69e
Merge branch 'main' of https://github.com/Michele-Masciave/react-hook…
Michele-Masciave Jun 13, 2025
de96e5c
Merge branch 'neolution-ch:main' into main
Michele-Masciave Jun 18, 2025
fbfcc8e
Merge branch 'neolution-ch:main' into main
Michele-Masciave Jun 25, 2025
b5c2533
Merge branch 'main' of https://github.com/Michele-Masciave/react-hook…
Michele-Masciave Jul 7, 2025
7843d38
Merge branch 'neolution-ch:main' into main
Michele-Masciave Jul 16, 2025
6b81771
Merge branch 'neolution-ch:main' into main
Michele-Masciave Sep 26, 2025
743acf1
Merge branch 'neolution-ch:main' into main
Michele-Masciave Sep 29, 2025
022db3c
Merge branch 'neolution-ch:main' into main
Michele-Masciave Oct 1, 2025
bbd78a7
Merge branch 'neolution-ch:main' into main
Michele-Masciave Oct 21, 2025
5d28ea3
Merge branch 'neolution-ch:main' into main
Michele-Masciave Dec 3, 2025
3e9f9a7
Merge branch 'neolution-ch:main' into main
Michele-Masciave Dec 10, 2025
814c18e
Merge branch 'neolution-ch:main' into main
Michele-Masciave Dec 15, 2025
a2108d9
Merge branch 'neolution-ch:main' into main
Michele-Masciave Jan 8, 2026
349cd68
Merge branch 'neolution-ch:main' into main
Michele-Masciave Jan 13, 2026
b94770b
Merge branch 'neolution-ch:main' into main
Michele-Masciave Feb 6, 2026
22cb448
Merge branch 'neolution-ch:main' into main
Michele-Masciave Feb 17, 2026
4a8cfb6
Merge branch 'neolution-ch:main' into main
Michele-Masciave Mar 3, 2026
9b0e9fd
solution
Michele-Masciave Mar 4, 2026
2e56ffa
fix log
Michele-Masciave Mar 4, 2026
0ea1b5f
fixed support also for input-change
Michele-Masciave Mar 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- `onChange` into `StaticTypeaheadInput` and `AsyncTypeaheadInput` to support async functions.
- `onInputChange` into `StaticTypeaheadInput` and `AsyncTypeaheadInput` to support async functions.
- `useDebounceHook` in order to expose the `queryRef` (which keeps track of the search input value)

## [4.0.0] - 2026-02-24

### Changed
Expand Down
4 changes: 2 additions & 2 deletions src/lib/AsyncTypeaheadInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const AsyncTypeaheadInput = <T extends FieldValues>(props: AsyncTypeaheadInputPr
const values = convertAutoCompleteOptionsToStringArray(optionsArray);
const finalValue = multiple ? values : values[0];
if (onChange) {
onChange(finalValue);
void (async () => await onChange(finalValue))();
}
field.onChange(finalValue);
}}
Expand All @@ -207,7 +207,7 @@ const AsyncTypeaheadInput = <T extends FieldValues>(props: AsyncTypeaheadInputPr
setDebounceSearch({ delay, query });
}
if (onInputChange) {
onInputChange(query, reason);
void (async () => await onInputChange(query, reason))();
}
}}
renderOption={highlightOptions ? renderHighlightedOptionFunction : undefined}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/StaticTypeaheadInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ const StaticTypeaheadInput = <T extends FieldValues>(props: StaticTypeaheadInput
const finalValue = multiple ? values : values[0];
clearErrors(field.name);
if (onChange) {
onChange(finalValue);
void (async () => await onChange(finalValue))();
}
field.onChange(finalValue);
}}
onInputChange={(_e, value, reason) => {
if (onInputChange) {
onInputChange(value, reason);
void (async () => await onInputChange(value, reason))();
}
}}
renderOption={highlightOptions ? renderHighlightedOptionFunction : undefined}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/hooks/useDebounceHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const useDebounceHook = (queryFn: (query: string) => Promise<TypeaheadOptions>,
return;
}, [queryFn, setOptions, debounceSearch]);

return { setDebounceSearch, isLoading };
return { setDebounceSearch, isLoading, queryRef };
};

export { useDebounceHook };
4 changes: 2 additions & 2 deletions src/lib/types/Typeahead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ interface CommonTypeaheadProps<T extends FieldValues> extends Omit<
innerRef?: RefObject<HTMLInputElement | null>;
fitMenuContent?: boolean;
getOptionDisabled?: (option: TypeaheadOption) => boolean;
onChange?: (selected: string | string[]) => void;
onInputChange?: (text: string, reason: AutocompleteInputChangeReason) => void;
onChange?: (selected: string | string[]) => void | Promise<void>;
onInputChange?: (text: string, reason: AutocompleteInputChangeReason) => void | Promise<void>;
onClose?: (event: SyntheticEvent, reason: AutocompleteCloseReason) => void;
onOpen?: (event: SyntheticEvent) => void;
onBlur?: () => void;
Expand Down
Loading