import { SelectClassNameContract } from "@microsoft/fast-components-class-name-contracts-base"; import Foundation, { HandledProps } from "@microsoft/fast-components-foundation-react"; import React from "react"; import { ListboxItemProps } from "../listbox-item"; import { SelectHandledProps, SelectProps, SelectUnhandledProps } from "./select.props"; export interface SelectState { value: string | string[]; displayString: string; selectedItems: ListboxItemProps[]; isMenuOpen: boolean; selectedItemIndex: number; selectableItemCount: number; } declare class Select extends Foundation { static displayName: string; static defaultProps: Partial; private static idPropertyKey; private static triggerUniqueIdPrefix; /** * Handled props instantiation */ protected handledProps: HandledProps; private rootElement; private triggerId; /** * constructor */ constructor(props: SelectProps); componentDidUpdate(prevProps: SelectProps): void; componentDidMount(): void; /** * Renders the component */ render(): React.ReactElement; /** * Create class names */ protected generateClassNames(): string; /** * Determine menu state based on props */ private checkPropsForMenuState; /** * Renders a hidden select element which can interact with a * form hosting this component */ private renderHiddenSelectElement; /** * This exists only to suppress a build warning */ private onSelectValueChange; /** * Determine which function to use to render the trigger (ie. the part of the control that shows when the menu isn't open) * and invokes it */ private renderTrigger; /** * Determine which function to use to render the menu and invokes it */ private renderMenu; /** * Returns viewport positioner managedclasses for select */ private generateViewportPositionerClassNames; /** * Handles selection changes from menu */ private menuSelectionChange; /** * Updates selection state and associated values */ private updateSelection; /** * Updates selection state and associated values from props */ private updateSelectionFromProps; /** * Trims the selection for single item mode */ private trimSelection; /** * Extracts values in the correct format (string in single select and string[] in multi-select) from an array of items. */ private getValueFromSelection; /** * get the index of the provided selection * (excludes children that aren't valid options) */ private getSelectedItemPosInSet; /** * The default function that renders an unstyled content display */ private defaultTriggerRenderFunction; /** * The default function that formats the display string generated based on selection. * This implementation should match the default formatting a base html select control applies. * Developers can provide an alternate formatter if desired. */ private defaultDisplayStringFormatter; /** * Handles clicks */ private handleClick; /** * Handles key events */ private handleKeydown; /** * Increment selection */ private incrementSelectedOption; /** * Select a child in a range */ private selectItemInRange; /** * Toggles the menu */ private toggleMenu; /** * Validate desired menu state against props */ private validateMenuState; /** * handle menu blur */ private handleMenuBlur; /** * Determines what function needs to be called to format the result string and * calls it with the appropriate params */ private getFormattedDisplayString; /** * Return the first child of the select that is a non-disabled button */ private getTriggerButton; /** * Determines if a given element is a focusable button */ private isFocusableButton; /** * focus on the trigger button */ private focusTriggerElement; /** * get valid options */ private getValidOptions; } export default Select; export * from "./select.props"; export { SelectClassNameContract };