@oslokommune/punkt-elements
Version:
Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo
40 lines (39 loc) • 1.36 kB
TypeScript
/**
* Shared combobox keyboard navigation utility functions
* used by both Elements and React packages.
* Only framework-agnostic functions belong here.
*/
/**
* Scrolls an element into view and focuses it.
*/
export declare const focusAndScrollIntoView: (element: HTMLElement) => void;
/**
* Gets all selectable option elements from a container.
*/
export declare const getOptionElements: (container: HTMLElement) => HTMLElement[];
/**
* Focuses the next sibling option.
*/
export declare const focusNextOption: (currentTarget: HTMLElement) => void;
/**
* Focuses the previous sibling option.
* Falls back to search input if at first option and search is present.
*/
export declare const focusPreviousOption: (currentTarget: HTMLElement, container: HTMLElement, includeSearch: boolean) => void;
/**
* Focuses the first option in the list.
*/
export declare const focusFirstOption: (container: HTMLElement) => void;
/**
* Focuses the last option in the list.
*/
export declare const focusLastOption: (container: HTMLElement) => void;
/**
* Focuses the first selected option, or falls back to search/new-option/first option.
*/
export declare const focusFirstOrSelectedOption: (container: HTMLElement, config: {
disabled: boolean;
allowUserInput: boolean;
customUserInput: string | null;
includeSearch: boolean;
}) => void;