-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/1102 combo box typedefs (#1115)
* small progress * more progress * Almost completed types for EuiComboBox and related components * filled out combobox types * update @types/react versions to be the same * add combobox index.d.ts to components * changelog, updated yarn.lock
- Loading branch information
1 parent
b6eed6f
commit f67b408
Showing
5 changed files
with
95 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { ButtonHTMLAttributes, ReactNode, SFC } from 'react'; | ||
import { ListProps } from 'react-virtualized'; | ||
import { | ||
EuiComboBoxOption, | ||
EuiComboBoxOptionProps, | ||
EuiComboBoxOptionsListPosition, | ||
EuiComboBoxOptionsListProps, | ||
} from '@elastic/eui'; | ||
|
||
declare module '@elastic/eui' { | ||
export type EuiComboBoxOptionProps = ButtonHTMLAttributes<HTMLButtonElement> & { | ||
label: string, | ||
isGroupLabelOption: boolean, | ||
} | ||
|
||
export type EuiComboBoxOptionsListPosition = 'top' | 'bottom' | ||
|
||
export interface EuiComboBoxOption { | ||
option: EuiComboBoxOptionProps, | ||
children?: ReactNode, | ||
className?: string, | ||
optionRef?: RefCallback<HTMLButtonElement>, | ||
onClick: (option: EuiComboBoxOptionProps) => any, | ||
onEnterKey: (option: EuiComboBoxOptionProps) => any, | ||
disabled?: boolean, | ||
} | ||
|
||
export interface EuiComboBoxOptionsListProps { | ||
options?: Array<EuiComboBoxOptionProps>, | ||
isLoading?: boolean, | ||
selectedOptions?: Array<any>, | ||
onCreateOption?: any, | ||
searchValue?: string, | ||
matchingOptions?: Array<EuiComboBoxOptionProps>, | ||
optionRef?: EuiComboBoxOption['optionRef'], | ||
onOptionClick?: EuiComboBoxOption['onClick'], | ||
onOptionEnterKey?: EuiComboBoxOption['onEnterKey'], | ||
areAllOptionsSelected?: boolean, | ||
getSelectedOptionForSearchValue?: (searchValue: string, selectedOptions: Array<any>) => EuiComboBoxOptionProps, | ||
updatePosition: (parameter?: UIEvent | EuiPanelProps['panelRef']) => any, | ||
position?: EuiComboBoxOptionsListPosition, | ||
listRef: EuiPanelProps['panelRef'], | ||
renderOption?: (option: EuiComboBoxOptionProps, searchValue: string, OPTION_CONTENT_CLASSNAME: string) => ReactNode, | ||
width?: number, | ||
scrollToIndex?: number, | ||
onScroll?: ListProps['onScroll'], | ||
rowHeight?: number, | ||
fullWidth?: boolean, | ||
} | ||
export const EuiComboBoxOptionsList: SFC<EuiComboBoxOptionsListProps>; | ||
|
||
export interface EuiComboBoxProps { | ||
id?: string, | ||
isDisabled?: boolean, | ||
className?: string, | ||
placeholder?: string, | ||
isLoading?: boolean, | ||
async?: boolean, | ||
singleSelection?: boolean, | ||
noSuggestions?: boolean, | ||
options?: EuiComboBoxOptionsListProps['options'], | ||
selectedOptions?: EuiComboBoxOptionsListProps['selectedOptions'], | ||
onChange?: (options: Array<EuiComboBoxOptionProps>) => any, | ||
onSearchChange?: (searchValue: string) => any, | ||
onCreateOption?: EuiComboBoxOptionsListProps['onCreateOption'], | ||
renderOption?: EuiComboBoxOptionsListProps['renderOption'], | ||
isInvalid?: boolean, | ||
rowHeight?: number, | ||
isClearable?: boolean, | ||
fullWidth?: boolean, | ||
} | ||
export const EuiComboBox: SFC<EuiComboBoxProps>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters