/** @packageDocumentation
* @module Filtering
*/
import "./FilteringInput.scss";
import * as React from "react";
import { CommonProps } from "@bentley/ui-core";
import { ResultSelectorProps } from "./ResultSelector";
/** [[FilteringInput]] React Component state
* @internal
*/
interface FilteringInputState {
/** A string which will be used for search */
searchText: string;
/**
* Tells the component if the search was started.
* Gets reset to false if search is canceled/cleared or searchText is changed.
*/
searchStarted: boolean;
resultSelectorKey: number;
/**
* Parameter used to remember `props.filteringInProgress`.
* Used in getDerivedStateFromProps to compare previous `props.filteringInProgress`
* with current `props.filteringInProgress`.
* Used for supporting deprecated usage of [[FilteringInput]] component
*/
prevFilteringInProgress?: boolean;
}
/** [[FilteringInput]] React Component properties
* @public
* @deprecated
*/
export interface DEPRECATED_FilteringInputProps extends CommonProps {
/** Filtering should start */
onFilterStart: (searchText: string) => void;
/** Filtering is canceled while still in progress */
onFilterCancel: () => void;
/** Filtering is cleared after everything's loaded */
onFilterClear: () => void;
/**
* Tells the component if parent component is still handling the filtering.
* @deprecated use `status` to provide information about filtering status instead.
*/
filteringInProgress: boolean;
/** [[ResultSelector]] React Component properties */
resultSelectorProps?: ResultSelectorProps;
/** Specify that the element should automatically get focus */
autoFocus?: boolean;
}
/**
* [[FilteringInput]] React Component properties
* @public
*/
export interface NEW_FilteringInputProps extends CommonProps {
/** Filtering should start */
onFilterStart: (searchText: string) => void;
/** Filtering is canceled while still in progress */
onFilterCancel: () => void;
/** Filtering is cleared after everything's loaded */
onFilterClear: () => void;
/**
* Tells the component what is the status of filtering.
* @beta
*/
status: FilteringInputStatus;
/**
* [[ResultSelector]] React Component properties.
* Attribute should be memoized and updated when [[ResultSelector]] state needs to be reset.
* This allows resetting the selected active match index back to 0.
*/
resultSelectorProps?: ResultSelectorProps;
/** Specify that the element should automatically get focus */
autoFocus?: boolean;
}
/**
* Props type for [[FilteringInput]]
* @public
*/
export declare type FilteringInputProps = DEPRECATED_FilteringInputProps | NEW_FilteringInputProps;
/**
* Enumeration of possible component contexts
* @beta
*/
export declare enum FilteringInputStatus {
/** Component is ready to filter */
ReadyToFilter = 0,
/** Component's parent is currently filtering */
FilteringInProgress = 1,
/** Component's parent has finished filtering */
FilteringFinished = 2
}
/** A helper component for filtering trees and stepping through results
* @public
*/
export declare class FilteringInput extends React.PureComponent {
private _inputElement;
private _searchLabel;
private _cancelLabel;
private _clearLabel;
constructor(props: FilteringInputProps);
private focus;
private _onSearchButtonClick;
private _onCancelButtonClick;
private _onClearButtonClick;
private _onFilterKeyDown;
private _onInputChanged;
/** @internal */
componentDidUpdate(prevProps: FilteringInputProps): void;
static getDerivedStateFromProps(nextProps: FilteringInputProps, prevState: FilteringInputState): {
searchStarted: boolean;
} | null;
private static isDeprecatedProps;
private getStatus;
render(): JSX.Element;
}
export {};
//# sourceMappingURL=FilteringInput.d.ts.map