UNPKG

@wordpress/components

Version:
35 lines • 1.73 kB
import type { RichTextValue } from '@wordpress/rich-text'; import type { AutocompleteProps, UseAutocompleteProps } from './types'; export declare function useAutocomplete<TReplacement = RichTextValue>({ record, onChange, onReplace, completers, contentRef, }: UseAutocompleteProps<TReplacement>): { 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']): RichTextValue & { start: NonNullable<RichTextValue['start']>; end: NonNullable<RichTextValue['end']>; }; export declare function useAutocompleteProps<TReplacement = RichTextValue>(options: Omit<UseAutocompleteProps<TReplacement>, 'contentRef'>): { ref: import("react").RefCallback<HTMLElement>; children?: undefined; 'aria-autocomplete'?: undefined; 'aria-haspopup'?: undefined; 'aria-controls'?: undefined; 'aria-owns'?: undefined; 'aria-activedescendant'?: undefined; } | { ref: import("react").RefCallback<HTMLElement>; children: false | import("react").JSX.Element; 'aria-autocomplete': "list" | undefined; 'aria-haspopup': "listbox" | undefined; 'aria-controls': string | undefined; 'aria-owns': string | undefined; 'aria-activedescendant': string | undefined; }; export default function Autocomplete<TReplacement = RichTextValue>({ children, isSelected, ...options }: AutocompleteProps<TReplacement>): import("react").JSX.Element; //# sourceMappingURL=index.d.ts.map