@wordpress/components
Version:
UI components for WordPress.
30 lines • 1.45 kB
TypeScript
import type { AutocompleteProps, UseAutocompleteProps } from './types';
export declare function useAutocomplete({ record, onChange, onReplace, completers, contentRef, }: UseAutocompleteProps): {
listBoxId: string | undefined;
activeId: string | null;
onKeyDown: (event: KeyboardEvent) => void;
popover: false | import("react").JSX.Element;
};
/**
* Tracks the last record whose value differed from the current one.
* Used to determine whether the user has actually typed something
*/
export declare function useLastDifferentValue(value: UseAutocompleteProps['record']): import("@wordpress/rich-text").RichTextValue & {
start: NonNullable<import("@wordpress/rich-text").RichTextValue["start"]>;
end: NonNullable<import("@wordpress/rich-text").RichTextValue["end"]>;
};
export declare function useAutocompleteProps(options: UseAutocompleteProps): {
ref: import("react").RefCallback<HTMLElement>;
children?: undefined;
'aria-autocomplete'?: undefined;
'aria-owns'?: undefined;
'aria-activedescendant'?: undefined;
} | {
ref: import("react").RefCallback<HTMLElement>;
children: false | import("react").JSX.Element;
'aria-autocomplete': string | undefined;
'aria-owns': string | undefined;
'aria-activedescendant': string | null;
};
export default function Autocomplete({ children, isSelected, ...options }: AutocompleteProps): import("react").JSX.Element;
//# sourceMappingURL=index.d.ts.map