Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve type definitions #162

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
16 changes: 8 additions & 8 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type OptionSnapshot = {


export type DomProps = {
tabIndex:string
tabIndex?:number
onMouseDown:(event:MouseEvent) => void
onKeyDown:(event:KeyboardEvent) => void
onKeyPress:(event:KeyboardEvent) => void
Expand All @@ -48,7 +48,7 @@ export type DomProps = {
}

export type ValueProps = {
tabIndex:string
tabIndex?:number
readonly:boolean
onMouseDown:(event:MouseEvent) => void
onKeyDown:(event:KeyboardEvent) => void
Expand Down Expand Up @@ -84,10 +84,10 @@ export type SelectSearchProps = {
autoFocus?:boolean
fuse?:FuseOption|boolean
className?:((classes:string) => string)|string
onChange?:(selectedValue:SelectedOptionValue|SelectedOptionValue[], selectedOption:SelectedOption|SelectedOption[], optionSnapshot:SelectSearchProps) => void
onChange?:(selectedValue:string|string[], selectedOption:SelectedOption|SelectedOption[], optionSnapshot:SelectSearchProps) => void
printOptions?:PrintOptions
closeOnSelect?:boolean
renderOption?:(domProps:DomProps, option:SelectedOption, snapshot:OptionSnapshot, className:string) => React.ReactNode
renderOption?:(domProps:DomProps, option:SelectSearchOption, snapshot:OptionSnapshot, className:string) => React.ReactNode
renderValue?:(valueProps:ValueProps, snapshot:ValueSnapshot, className:string) => React.ReactNode
renderGroupHeader?:(name:string) => string
getOptions?: (query:string) => Promise<SelectSearchOption[]>
Expand All @@ -104,17 +104,17 @@ export function useSelect(Options: {
search?:boolean,
fuse?:FuseOption|boolean,
options?:SelectSearchOption[],
onChange?:(selectedValue:SelectedOptionValue|SelectedOptionValue[], selectedOption:SelectedOption|SelectedOption[], optionSnapshot:SelectSearchProps) => void,
onChange?:(selectedValue:string|string[], selectedOption:SelectedOption|SelectedOption[], optionSnapshot:SelectSearchProps) => void,
getOptions?:(query:string) => Promise<SelectSearchOption[]>,
allowEmpty?:boolean,
closeOnSelect?:boolean,
closable?:boolean,
}): [
ValueSnapshot,
{
tabIndex:string;
tabIndex?:number;
readOnly:boolean;
onChange:(selectedValue:SelectedOptionValue|SelectedOptionValue[], selectedOption:SelectedOption|SelectedOption[], optionSnapshot:SelectSearchProps) => void;
onChange:(selectedValue:string|string[], selectedOption:SelectedOption|SelectedOption[], optionSnapshot:SelectSearchProps) => void;
disabled:boolean;
onMouseDown:(event:MouseEvent) => void;
onKeyDown:(event:KeyboardEvent) => void;
Expand All @@ -125,7 +125,7 @@ export function useSelect(Options: {
ref:React.MutableRefObject<any>;
},
{
tabIndex:string;
tabIndex?:number;
onMouseDown:(event:MouseEvent) => void;
onKeyDown:(event:KeyboardEvent) => void;
onKeyPress:(event:KeyboardEvent) => void;
Expand Down