import { default as React } from 'react'; import { SelectItemProps } from './SelectItem'; import { SelectActionProps } from './SelectAction'; import { SelectCategoryProps } from './SelectCategory'; type SelectItemElement = React.ReactElement; type SelectActionElement = React.ReactElement; type SelectChild = SelectItemElement | SelectActionElement; /** * @param item a Select.Item or Select.Action component * @returns true if the item is a Select.Action */ export declare const isAction: (item: React.ReactNode) => item is SelectActionElement; /** * Sets the selected value in the DropdownTrigger. * A Select.Action should _not_ display as selected in the button. * * @param item the currently selected Select.Item or Select.Action * @returns The value to display in the trigger button */ export declare const getSelectedItemDisplay: (item: SelectChild | "" | null | undefined) => React.ReactNode; /** * @param value `value` of the Select.Item to get * @param items Select.Item nodes * @returns the Select.Item element found or an empty string */ export declare const getItemByValue: (value: string, items: SelectChild[]) => SelectItemElement | ""; type IndexableItemElement = React.ReactElement<{ value?: string; searchValue?: string; onSelect?: () => void; }>; /** * @param item an item from `items` * @param items downshift index `items` * @returns index of item */ export declare const getItemIndex: (item: IndexableItemElement, items: IndexableItemElement[]) => number; /** * @param highlightedIndex index of currently highlight item * @param categoryChildren child items in a given category * @param items downshift `items` * @returns if the provided item is in the category */ export declare const isHighlightedInCategory: (highlightedIndex: number, categoryChildren: SelectItemElement[], items: SelectChild[]) => boolean; /** * @param selectedItem * @param categoryChildren child items in a given category * @returns if the selected item is in the given category children */ export declare const isSelectedItemInCategory: (selectedItem: SelectChild | "" | null, categoryChildren: SelectItemElement[]) => boolean; export interface SelectProps { /** * unique id attribute of the input (used for `htmlFor`). * Defaults to a value derived from `label`. */ id?: string; /** Label for the select control */ label?: string; /** Change callback. Called with value string from the selected item */ onChange?: (value: Value) => void; /** * Sets selected item by value and makes the Select **fully controlled**. * * When passing a `value`, you must provide an `onChange` handler to update it */ value?: Value; /** * Function with signature `(userInputValue, selectItemNode) => {}`, * used to customize typeahead filtering behavior. * See "Changing Typeahead Behavior" story for example. */ getTypeaheadString?: (userInput: string, selectItem: SelectItemElement) => string; /** * When `true`, selecting an action will clear any existing selection. */ clearSelectionOnAction?: boolean; /** * Use to set a default selection by passing the `value` prop * of one of the `` children. * The Select will remain uncontrolled. */ defaultValue?: Value; /** Open the dropdown on render if `true` */ defaultOpen?: boolean; /** * Error message. * When passed, this will cause the trigger to render in error state. */ errorText?: string; children?: React.ReactNode; /** Optional value for `data-testid` attribute */ testId?: string; /** * When true, Select renders a disabled button with the appearance * of a disabled input. User interaction is disabled. */ disabled?: boolean; } /** * Accessible custom select control for giving users the ability to select one option from a list of options. * `Select` also supports the ability to pass in a `` that acts as an option that only triggers a side effect. * Typeahead is enabled based on the `value` prop of `` elements passed in. */ declare function Select(props: SelectProps): React.JSX.Element; declare namespace Select { var Item: { ({ children }: SelectItemProps): React.JSX.Element; displayName: string; propTypes: { value: import("prop-types").Validator; searchValue: import("prop-types").Requireable; children: import("prop-types").Requireable>; }; }; var Action: { ({ children }: SelectActionProps): React.JSX.Element; displayName: string; propTypes: { onSelect: import("prop-types").Validator<(...args: any[]) => any>; children: import("prop-types").Requireable>; }; }; var Category: { ({ children }: SelectCategoryProps): React.JSX.Element; displayName: string; propTypes: { label: import("prop-types").Requireable; kind: import("prop-types").Requireable; children: import("prop-types").Requireable>; isFlat: import("prop-types").Requireable; }; }; } export default Select; //# sourceMappingURL=index.d.ts.map