tdesign-react
Version:
TDesign Component for React
27 lines (26 loc) • 1.21 kB
TypeScript
import type { SelectOption, SelectValue, SelectValueChangeTrigger, TdOptionProps, TdSelectProps } from '../type';
export type useKeyboardControlType = {
max: number;
multiple: boolean;
keys: TdSelectProps['keys'];
value: SelectValue<SelectOption>;
valueType: TdSelectProps['valueType'];
handleChange: (value: SelectValue, context: {
e: React.KeyboardEvent<HTMLInputElement>;
trigger: SelectValueChangeTrigger;
}) => void;
innerPopupVisible: boolean;
handlePopupVisibleChange: (visible: boolean, ctx: {
e: React.KeyboardEvent<HTMLInputElement>;
}) => void;
displayOptions: TdOptionProps[];
onCheckAllChange: (checkAll: boolean, e?: React.KeyboardEvent<HTMLInputElement>) => void;
selectInputRef: any;
toggleIsScrolling: (isScrolling: boolean) => void;
};
export default function useKeyboardControl({ max, multiple, keys, value, valueType, handleChange, innerPopupVisible, handlePopupVisibleChange, displayOptions, onCheckAllChange, selectInputRef, toggleIsScrolling, }: useKeyboardControlType): {
hoverIndex: number;
handleKeyDown: (_value: string, { e }: {
e: React.KeyboardEvent<HTMLInputElement>;
}) => void;
};