Skip to content

Commit

Permalink
add clear callback
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcfaul committed Sep 23, 2022
1 parent bb543d0 commit 444fde7
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export interface DualListSelectorPaneProps {
onSearch?: (event: React.ChangeEvent<HTMLInputElement>) => void;
/** @hide A callback for when the search input value for changes. To be used when isSearchable is true. */
onSearchInputChanged?: (value: string, event: React.FormEvent<HTMLInputElement>) => void;
/** @hide Callback for search input clear button */
onSearchInputClear?: (event: React.SyntheticEvent<HTMLButtonElement>) => void;
/** @hide Filter function for custom filtering based on search string. To be used when isSearchable is true. */
filterOption?: (option: React.ReactNode, input: string) => boolean;
/** @hide Accessible label for the search input. To be used when isSearchable is true. */
Expand All @@ -81,6 +83,7 @@ export const DualListSelectorPane: React.FunctionComponent<DualListSelectorPaneP
searchInputAriaLabel = '',
onFilterUpdate,
onSearchInputChanged,
onSearchInputClear,
filterOption,
id = getUniqueId('dual-list-selector-pane'),
isDisabled = false,
Expand Down Expand Up @@ -161,6 +164,9 @@ export const DualListSelectorPane: React.FunctionComponent<DualListSelectorPaneP
) : (
<SearchInput
onChange={isDisabled ? undefined : onChange}
onClear={
onSearchInputClear ? onSearchInputClear : e => onChange('', e as React.FormEvent<HTMLInputElement>)
}
isDisabled={isDisabled}
aria-label={searchInputAriaLabel}
type="search"
Expand Down

0 comments on commit 444fde7

Please sign in to comment.