lucid-ui
Version:
A UI component library from Xandr.
31 lines (27 loc) • 643 B
text/typescript
import * as DropMenu from '../DropMenu/DropMenu.reducers';
import { ISearchableSelectState } from './SearchableSelect';
export function onSelect(
state: ISearchableSelectState,
selectedIndex: number
): ISearchableSelectState {
return {
...state,
selectedIndex,
DropMenu: DropMenu.onSelect(state.DropMenu, selectedIndex),
};
}
export function onSearch(
state: ISearchableSelectState,
searchText: string,
firstVisibleIndex: number
): ISearchableSelectState {
return {
...state,
searchText,
selectedIndex: null,
DropMenu: {
...DropMenu.onFocusOption(state.DropMenu, firstVisibleIndex),
},
};
}
export { DropMenu };