1 | import * as React from 'react';
|
2 | import { SelectOptionObject } from './SelectOption';
|
3 | import { SelectPosition } from './selectConstants';
|
4 | import { ChipGroupProps } from '../ChipGroup';
|
5 | import { OUIAProps, PickOptional } from '../../helpers';
|
6 | import { ToggleMenuBaseProps } from '../../helpers/Popper/Popper';
|
7 | export interface SelectViewMoreObject {
|
8 |
|
9 | text: string;
|
10 |
|
11 | onClick: (event: React.MouseEvent | React.ChangeEvent) => void;
|
12 | }
|
13 | export interface SelectProps extends ToggleMenuBaseProps, Omit<React.HTMLProps<HTMLDivElement>, 'onSelect' | 'ref' | 'checked' | 'selected'>, OUIAProps {
|
14 |
|
15 | children?: React.ReactElement[];
|
16 |
|
17 | className?: string;
|
18 |
|
19 | position?: SelectPosition | 'right' | 'left';
|
20 |
|
21 | direction?: 'up' | 'down';
|
22 |
|
23 | isOpen?: boolean;
|
24 |
|
25 | isGrouped?: boolean;
|
26 |
|
27 | isPlain?: boolean;
|
28 |
|
29 | isDisabled?: boolean;
|
30 |
|
31 | isCreatable?: boolean;
|
32 |
|
33 | hasPlaceholderStyle?: boolean;
|
34 |
|
35 | isCreateSelectOptionObject?: boolean;
|
36 | |
37 |
|
38 |
|
39 |
|
40 |
|
41 | validated?: 'success' | 'warning' | 'error' | 'default';
|
42 |
|
43 | loadingVariant?: 'spinner' | SelectViewMoreObject;
|
44 |
|
45 | createText?: string;
|
46 |
|
47 | placeholderText?: string | React.ReactNode;
|
48 |
|
49 | noResultsFoundText?: string;
|
50 |
|
51 | selections?: string | SelectOptionObject | (string | SelectOptionObject)[];
|
52 |
|
53 | isCheckboxSelectionBadgeHidden?: boolean;
|
54 |
|
55 | toggleId?: string;
|
56 |
|
57 | 'aria-label'?: string;
|
58 |
|
59 | 'aria-labelledby'?: string;
|
60 |
|
61 | 'aria-describedby'?: string;
|
62 |
|
63 | 'aria-invalid'?: boolean;
|
64 |
|
65 | typeAheadAriaLabel?: string;
|
66 |
|
67 | clearSelectionsAriaLabel?: string;
|
68 |
|
69 | toggleAriaLabel?: string;
|
70 |
|
71 | removeSelectionAriaLabel?: string;
|
72 |
|
73 | favorites?: string[];
|
74 |
|
75 | favoritesLabel?: string;
|
76 |
|
77 | onFavorite?: (itemId: string, isFavorite: boolean) => void;
|
78 |
|
79 | onSelect?: (event: React.MouseEvent | React.ChangeEvent, value: string | SelectOptionObject, isPlaceholder?: boolean) => void;
|
80 |
|
81 | onToggle: (isExpanded: boolean, event: React.MouseEvent | React.ChangeEvent | React.KeyboardEvent | Event) => void;
|
82 |
|
83 | onBlur?: (event?: any) => void;
|
84 |
|
85 | onClear?: (event: React.MouseEvent) => void;
|
86 |
|
87 | onFilter?: (e: React.ChangeEvent<HTMLInputElement> | null, value: string) => React.ReactElement[] | undefined;
|
88 |
|
89 | onCreateOption?: (newOptionValue: string) => void;
|
90 |
|
91 | onTypeaheadInputChanged?: (value: string) => void;
|
92 |
|
93 | variant?: 'single' | 'checkbox' | 'typeahead' | 'typeaheadmulti';
|
94 |
|
95 | width?: string | number;
|
96 |
|
97 | maxHeight?: string | number;
|
98 |
|
99 | toggleIcon?: React.ReactElement;
|
100 |
|
101 | customContent?: React.ReactNode;
|
102 |
|
103 | hasInlineFilter?: boolean;
|
104 |
|
105 | inlineFilterPlaceholderText?: string;
|
106 |
|
107 | customBadgeText?: string | number;
|
108 |
|
109 | inputIdPrefix?: string;
|
110 |
|
111 | inputAutoComplete?: string;
|
112 |
|
113 | chipGroupProps?: Omit<ChipGroupProps, 'children' | 'ref'>;
|
114 |
|
115 | chipGroupComponent?: React.ReactNode;
|
116 |
|
117 | isInputValuePersisted?: boolean;
|
118 |
|
119 | isInputFilterPersisted?: boolean;
|
120 |
|
121 | shouldResetOnSelect?: boolean;
|
122 |
|
123 | footer?: React.ReactNode;
|
124 | }
|
125 | export interface SelectState {
|
126 | focusFirstOption: boolean;
|
127 | typeaheadInputValue: string | null;
|
128 | typeaheadFilteredChildren: React.ReactNode[];
|
129 | favoritesGroup: React.ReactNode[];
|
130 | typeaheadCurrIndex: number;
|
131 | creatableValue: string;
|
132 | tabbedIntoFavoritesMenu: boolean;
|
133 | typeaheadStoredIndex: number;
|
134 | ouiaStateId: string;
|
135 | viewMoreNextIndex: number;
|
136 | }
|
137 | export declare class Select extends React.Component<SelectProps & OUIAProps, SelectState> {
|
138 | static displayName: string;
|
139 | private parentRef;
|
140 | private menuComponentRef;
|
141 | private filterRef;
|
142 | private clearRef;
|
143 | private inputRef;
|
144 | private refCollection;
|
145 | private optionContainerRefCollection;
|
146 | private footerRef;
|
147 | static defaultProps: PickOptional<SelectProps>;
|
148 | state: SelectState;
|
149 | getTypeaheadActiveChild: (typeaheadCurrIndex: number) => HTMLElement;
|
150 | componentDidUpdate: (prevProps: SelectProps, prevState: SelectState) => void;
|
151 | onEnter: () => void;
|
152 | onToggle: (isExpanded: boolean, e: React.MouseEvent | React.ChangeEvent | React.KeyboardEvent | Event) => void;
|
153 | onClose: () => void;
|
154 | onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
155 | updateTypeAheadFilteredChildren: (typeaheadInputValue: string, e: React.ChangeEvent<HTMLInputElement> | null) => void;
|
156 | onClick: (e: React.MouseEvent) => void;
|
157 | clearSelection: (_e: React.MouseEvent) => void;
|
158 | extendTypeaheadChildren(typeaheadCurrIndex: number, favoritesGroup?: React.ReactNode[]): React.ReactNode[];
|
159 | sendRef: (optionRef: React.ReactNode, favoriteRef: React.ReactNode, optionContainerRef: React.ReactNode, index: number) => void;
|
160 | handleMenuKeys: (index: number, innerIndex: number, position: string) => void;
|
161 | moveFocus: (nextIndex: number, updateCurrentIndex?: boolean) => void;
|
162 | switchFocusToFavoriteMenu: () => void;
|
163 | moveFocusToLastMenuItem: () => void;
|
164 | handleTypeaheadKeys: (position: string, shiftKey?: boolean) => void;
|
165 | onClickTypeaheadToggleButton: () => void;
|
166 | getDisplay: (value: string | SelectOptionObject, type?: 'node' | 'text') => any;
|
167 | findText: (item: React.ReactNode) => string;
|
168 | generateSelectedBadge: () => string | number;
|
169 | setVieMoreNextIndex: () => void;
|
170 | isLastOptionBeforeFooter: (index: any) => boolean;
|
171 | render(): JSX.Element;
|
172 | }
|
173 |
|
\ | No newline at end of file |