UNPKG

3.54 kBTypeScriptView Raw
1import * as React from 'react';
2export interface SelectOptionObject {
3 /** Function returns a string to represent the select option object */
4 toString(): string;
5 /** Function returns a true if the passed in select option is equal to this select option object, false otherwise */
6 compareTo?(selectOption: any): boolean;
7}
8export interface SelectOptionProps extends Omit<React.HTMLProps<HTMLElement>, 'type' | 'ref' | 'value'> {
9 /** Optional alternate display for the option */
10 children?: React.ReactNode;
11 /** Additional classes added to the Select Option */
12 className?: string;
13 /** Description of the item for single and both typeahead select variants */
14 description?: React.ReactNode;
15 /** Number of items matching the option */
16 itemCount?: number;
17 /** @hide Internal index of the option */
18 index?: number;
19 /** Indicates which component will be used as select item */
20 component?: React.ReactNode;
21 /** The value for the option, can be a string or select option object */
22 value: string | SelectOptionObject;
23 /** Flag indicating if the option is disabled */
24 isDisabled?: boolean;
25 /** Flag indicating if the option acts as a placeholder */
26 isPlaceholder?: boolean;
27 /** Flag indicating if the option acts as a "no results" indicator */
28 isNoResultsOption?: boolean;
29 /** @hide Internal flag indicating if the option is selected */
30 isSelected?: boolean;
31 /** @hide Internal flag indicating if the option is checked */
32 isChecked?: boolean;
33 /** Flag forcing the focused state */
34 isFocused?: boolean;
35 /** @hide Internal callback for ref tracking */
36 sendRef?: (ref: React.ReactNode, favoriteRef: React.ReactNode, optionContainerRef: React.ReactNode, index: number) => void;
37 /** @hide Internal callback for keyboard navigation */
38 keyHandler?: (index: number, innerIndex: number, position: string) => void;
39 /** Optional callback for click event */
40 onClick?: (event: React.MouseEvent | React.ChangeEvent) => void;
41 /** Id of the checkbox input */
42 inputId?: string;
43 /** @hide Internal Flag indicating if the option is favorited */
44 isFavorite?: boolean;
45 /** Aria label text for favoritable button when favorited */
46 ariaIsFavoriteLabel?: string;
47 /** Aria label text for favoritable button when not favorited */
48 ariaIsNotFavoriteLabel?: string;
49 /** ID of the item. Required for tracking favorites */
50 id?: string;
51 /** @hide Internal flag to apply the load styling to view more option */
52 isLoad?: boolean;
53 /** @hide Internal flag to apply the loading styling to spinner */
54 isLoading?: boolean;
55 /** @hide Internal callback for the setting the index of the next item to focus after view more is clicked */
56 setViewMoreNextIndex?: () => void;
57 /** @hide Flag indicating this is the last option when there is a footer */
58 isLastOptionBeforeFooter?: (index: number) => boolean;
59 /** @hide Flag indicating that the the option loading variant is in a grouped select */
60 isGrouped?: boolean;
61}
62export declare class SelectOption extends React.Component<SelectOptionProps> {
63 static displayName: string;
64 private ref;
65 private liRef;
66 private favoriteRef;
67 static defaultProps: SelectOptionProps;
68 componentDidMount(): void;
69 componentDidUpdate(): void;
70 onKeyDown: (event: React.KeyboardEvent, innerIndex: number, onEnter?: any, isCheckbox?: boolean) => void;
71 render(): JSX.Element;
72}
73//# sourceMappingURL=SelectOption.d.ts.map
\No newline at end of file