{"version":3,"file":"koobiq-cdk-a11y.mjs","sources":["../../../packages/cdk/a11y/key-manager/list-key-manager.ts","../../../packages/cdk/a11y/key-manager/activedescendant-key-manager.ts","../../../packages/cdk/a11y/key-manager/focus-key-manager.ts","../../../packages/cdk/a11y/koobiq-cdk-a11y.ts"],"sourcesContent":["import { QueryList } from '@angular/core';\nimport { A, DOWN_ARROW, END, HOME, LEFT_ARROW, NINE, RIGHT_ARROW, TAB, UP_ARROW, Z, ZERO } from '@koobiq/cdk/keycodes';\nimport { Subject, Subscription } from 'rxjs';\nimport { debounceTime, filter, map, tap } from 'rxjs/operators';\n\n// This interface is for items that can be passed to a ListKeyManager.\nexport interface ListKeyManagerOption {\n    // Whether the option is disabled.\n    disabled?: boolean;\n\n    // Gets the label for this option.\n    getLabel?(): string;\n}\n\n/** Modifier keys handled by the ListKeyManager. */\nexport type ListKeyManagerModifierKey = 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey';\n\n/**\n * This class manages keyboard events for selectable lists. If you pass it a query list\n * of items, it will set the active item correctly when arrow events occur.\n */\nexport class ListKeyManager<T extends ListKeyManagerOption> {\n    /**\n     * Stream that emits any time the TAB key is pressed, so components can react\n     * when focus is shifted off of the list.\n     */\n    tabOut: Subject<void> = new Subject<void>();\n\n    /** Stream that emits whenever the active item of the list manager changes. */\n    change = new Subject<number>();\n\n    previousActiveItemIndex = -1;\n\n    // Index of the currently active item.\n    get activeItemIndex(): number {\n        return this._activeItemIndex;\n    }\n\n    private _activeItemIndex = -1;\n\n    // The active item.\n    get activeItem(): T | null {\n        return this._activeItem;\n    }\n\n    private _activeItem: T;\n\n    private wrap: boolean = false;\n    private letterKeyStream = new Subject<string>();\n    private typeaheadSubscription = Subscription.EMPTY;\n    private vertical = true;\n    private horizontal: 'ltr' | 'rtl' | null;\n\n    private scrollSize: number = 0;\n\n    // Buffer for the letters that the user has pressed when the typeahead option is turned on.\n    private pressedLetters: string[] = [];\n\n    private homeAndEnd = false;\n\n    private allowedModifierKeys: ListKeyManagerModifierKey[] = [];\n\n    constructor(private _items: QueryList<T>) {\n        if (_items instanceof QueryList) {\n            _items.changes.subscribe((newItems: QueryList<T>) => {\n                if (this._activeItem) {\n                    const itemArray = newItems.toArray();\n                    const newIndex = itemArray.indexOf(this._activeItem);\n\n                    if (newIndex > -1 && newIndex !== this._activeItemIndex) {\n                        this._activeItemIndex = newIndex;\n                    }\n                }\n            });\n        }\n    }\n\n    /** Gets whether the user is currently typing into the manager using the typeahead feature. */\n    isTyping(): boolean {\n        return this.pressedLetters.length > 0;\n    }\n\n    withScrollSize(scrollSize: number): this {\n        this.scrollSize = scrollSize;\n\n        return this;\n    }\n\n    /**\n     * Modifier keys which are allowed to be held down and whose default actions will be prevented\n     * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys.\n     */\n    withAllowedModifierKeys(keys: ListKeyManagerModifierKey[]): this {\n        this.allowedModifierKeys = keys;\n\n        return this;\n    }\n\n    /**\n     * Turns on wrapping mode, which ensures that the active item will wrap to\n     * the other end of list when there are no more items in the given direction.\n     */\n\n    withWrap(shouldWrap = true): this {\n        this.wrap = shouldWrap;\n\n        return this;\n    }\n\n    /**\n     * Sets the predicate function that determines which items should be skipped by the\n     * list key manager.\n     * @param predicate Function that determines whether the given item should be skipped.\n     */\n    skipPredicate(predicate: (item: T) => boolean): this {\n        this.skipPredicateFn = predicate;\n\n        return this;\n    }\n\n    /**\n     * Configures whether the key manager should be able to move the selection vertically.\n     * @param enabled Whether vertical selection should be enabled.\n     */\n    withVerticalOrientation(enabled: boolean = true): this {\n        this.vertical = enabled;\n\n        return this;\n    }\n\n    /**\n     * Configures the key manager to move the selection horizontally.\n     * Passing in `null` will disable horizontal movement.\n     * @param direction Direction in which the selection can be moved.\n     */\n    withHorizontalOrientation(direction: 'ltr' | 'rtl' | null): this {\n        this.horizontal = direction;\n\n        return this;\n    }\n\n    /**\n     * Turns on typeahead mode which allows users to set the active item by typing.\n     * @param searchLetterIndex letter index for incremental search, if is -1 search is disabled\n     * @param debounceInterval Time to wait after the last keystroke before setting the active item.\n     */\n    withTypeAhead(debounceInterval: number = 200, searchLetterIndex: number = 0): this {\n        if (this._items.length && this._items.some((item) => typeof item.getLabel !== 'function')) {\n            throw Error('ListKeyManager items in typeahead mode must implement the `getLabel` method.');\n        }\n\n        this.typeaheadSubscription.unsubscribe();\n\n        // Debounce the presses of non-navigational keys, collect the ones that correspond to letters and convert those\n        // letters back into a string. Afterwards find the first item that starts with that string and select it.\n        this.typeaheadSubscription = this.letterKeyStream\n            .pipe(\n                tap((keyCode) => this.pressedLetters.push(keyCode)),\n                debounceTime(debounceInterval),\n                filter(() => this.pressedLetters.length > 0),\n                map(() => this.pressedLetters.join(''))\n            )\n            .subscribe((inputString) => {\n                if (searchLetterIndex === -1) {\n                    this.pressedLetters = [];\n\n                    return;\n                }\n\n                const items = this._items.toArray();\n\n                // Start at 1 because we want to start searching at the item immediately\n                // following the current active item.\n                for (let i = 1; i < items.length + 1; i++) {\n                    const index = (this._activeItemIndex + i) % items.length;\n                    const item = items[index];\n\n                    if (\n                        !item.disabled &&\n                        item.getLabel!().toUpperCase().trim().indexOf(inputString) === searchLetterIndex\n                    ) {\n                        this.setActiveItem(index);\n                        break;\n                    }\n                }\n\n                this.pressedLetters = [];\n            });\n\n        return this;\n    }\n\n    /**\n     * Configures the key manager to activate the first and last items\n     * respectively when the Home or End key is pressed.\n     * @param enabled Whether pressing the Home or End key activates the first/last item.\n     */\n    withHomeAndEnd(enabled: boolean = true): this {\n        this.homeAndEnd = enabled;\n\n        return this;\n    }\n\n    /**\n     * Sets the active item to the item at the index specified.\n     * @param index The index of the item to be set as active or item The item to be set as active.\n     */\n    setActiveItem(index: number | T): void;\n\n    /**\n     * Sets the active item to the item at the index specified.\n     * @param item The index of the item to be set as active.\n     */\n    setActiveItem(item: any): void {\n        this.previousActiveItemIndex = this._activeItemIndex;\n\n        this.updateActiveItem(item);\n\n        if (this._activeItemIndex !== this.previousActiveItemIndex) {\n            this.change.next(this._activeItemIndex);\n        }\n    }\n\n    /**\n     * Sets the active item depending on the key event passed in.\n     * @param event Keyboard event to be used for determining which element should be active.\n     */\n    onKeydown(event: KeyboardEvent): void {\n        const keyCode = event.keyCode;\n\n        const modifiers: ListKeyManagerModifierKey[] = ['altKey', 'ctrlKey', 'metaKey', 'shiftKey'];\n        const isModifierAllowed = modifiers.every((modifier) => {\n            return !event[modifier] || this.allowedModifierKeys.indexOf(modifier) > -1;\n        });\n\n        switch (keyCode) {\n            case TAB:\n                this.tabOut.next();\n\n                return;\n\n            case DOWN_ARROW:\n                if (this.vertical) {\n                    this.setNextItemActive();\n                    break;\n                } else {\n                    return;\n                }\n\n            case UP_ARROW:\n                if (this.vertical) {\n                    this.setPreviousItemActive();\n                    break;\n                } else {\n                    return;\n                }\n\n            case RIGHT_ARROW:\n                if (this.horizontal === 'ltr') {\n                    this.setNextItemActive();\n                    break;\n                } else if (this.horizontal === 'rtl') {\n                    this.setPreviousItemActive();\n                    break;\n                } else {\n                    return;\n                }\n\n            case LEFT_ARROW:\n                if (this.horizontal === 'ltr') {\n                    this.setPreviousItemActive();\n                    break;\n                } else if (this.horizontal === 'rtl') {\n                    this.setNextItemActive();\n                    break;\n                } else {\n                    return;\n                }\n\n            case HOME:\n                if (this.homeAndEnd && isModifierAllowed) {\n                    this.setFirstItemActive();\n                    break;\n                } else {\n                    return;\n                }\n\n            case END:\n                if (this.homeAndEnd && isModifierAllowed) {\n                    this.setLastItemActive();\n                    break;\n                } else {\n                    return;\n                }\n\n            default:\n                // Attempt to use the `event.key` which also maps it to the user's keyboard language,\n                // otherwise fall back to resolving alphanumeric characters via the keyCode.\n                if (event.key && event.key.length === 1) {\n                    this.letterKeyStream.next(event.key.toLocaleUpperCase());\n                } else if ((keyCode >= A && keyCode <= Z) || (keyCode >= ZERO && keyCode <= NINE)) {\n                    this.letterKeyStream.next(String.fromCharCode(keyCode));\n                }\n\n                // Note that we return here, in order to avoid preventing\n                // the default action of non-navigational keys.\n                return;\n        }\n\n        this.pressedLetters = [];\n        event.preventDefault();\n    }\n\n    // Sets the active item to the first enabled item in the list.\n    setFirstItemActive(): void {\n        this.setActiveItemByIndex(0, 1);\n    }\n\n    // Sets the active item to the last enabled item in the list.\n    setLastItemActive(): void {\n        this.setActiveItemByIndex(this._items.length - 1, -1);\n    }\n\n    // Sets the active item to the next enabled item in the list.\n    setNextItemActive(): void {\n        this._activeItemIndex < 0 ? this.setFirstItemActive() : this.setActiveItemByDelta(1);\n    }\n\n    // Sets the active item to a previous enabled item in the list.\n    setPreviousItemActive(): void {\n        this._activeItemIndex < 0 && this.wrap ? this.setLastItemActive() : this.setActiveItemByDelta(-1);\n    }\n\n    setNextPageItemActive(delta: number = this.scrollSize): void {\n        const nextItemIndex = this._activeItemIndex + delta;\n\n        if (nextItemIndex >= this._items.length) {\n            this.setLastItemActive();\n        } else {\n            this.setActiveItemByDelta(delta);\n        }\n    }\n\n    setPreviousPageItemActive(delta: number = this.scrollSize): void {\n        const nextItemIndex = this._activeItemIndex - delta;\n\n        if (nextItemIndex <= 0) {\n            this.setFirstItemActive();\n        } else {\n            this.setActiveItemByDelta(-delta);\n        }\n    }\n\n    /**\n     * Allows setting the active without any other effects.\n     * @param index Index of the item to be set as active.\n     */\n    updateActiveItem(index: number): void;\n\n    /**\n     * Allows setting the active item without any other effects.\n     * @param item Item to be set as active or index Index of the item to be set as active..\n     */\n    updateActiveItem(item: number | T): void;\n\n    updateActiveItem(item: any): void {\n        const itemArray = this._items.toArray();\n        const index = typeof item === 'number' ? item : itemArray.indexOf(item);\n\n        this._activeItemIndex = index;\n        this._activeItem = itemArray[index];\n    }\n\n    /**\n     * Predicate function that can be used to check whether an item should be skipped\n     * by the key manager. By default, disabled items are skipped.\n     */\n    private skipPredicateFn = (item: T) => item.disabled;\n\n    /**\n     * This method sets the active item, given a list of items and the delta between the\n     * currently active item and the new active item. It will calculate differently\n     * depending on whether wrap mode is turned on.\n     */\n    private setActiveItemByDelta(delta: number): void {\n        this.wrap ? this.setActiveInWrapMode(delta) : this.setActiveInDefaultMode(delta);\n    }\n\n    /**\n     * Sets the active item properly given \"wrap\" mode. In other words, it will continue to move\n     * down the list until it finds an item that is not disabled, and it will wrap if it\n     * encounters either end of the list.\n     */\n    private setActiveInWrapMode(delta: number): void {\n        const items = this.getItemsArray();\n\n        for (let i = 1; i <= items.length; i++) {\n            const index = (this._activeItemIndex + delta * i + items.length) % items.length;\n            const item = items[index];\n\n            if (!this.skipPredicateFn(item)) {\n                this.setActiveItem(index);\n\n                return;\n            }\n        }\n    }\n\n    /**\n     * Sets the active item properly given the default mode. In other words, it will\n     * continue to move down the list until it finds an item that is not disabled. If\n     * it encounters either end of the list, it will stop and not wrap.\n     */\n    private setActiveInDefaultMode(delta: number): void {\n        this.setActiveItemByIndex(this._activeItemIndex + delta, delta);\n    }\n\n    /**\n     * Sets the active item to the first enabled item starting at the index specified. If the\n     * item is disabled, it will move in the fallbackDelta direction until it either\n     * finds an enabled item or encounters the end of the list.\n     */\n    private setActiveItemByIndex(index: number, fallbackDelta: number): void {\n        const items = this.getItemsArray();\n\n        if (!items[index]) {\n            return;\n        }\n\n        let curIndex = index;\n\n        while (this.skipPredicateFn(items[curIndex])) {\n            curIndex += fallbackDelta;\n\n            if (!items[curIndex]) {\n                return;\n            }\n        }\n\n        this.setActiveItem(curIndex);\n    }\n\n    /** Returns the items as an array. */\n    private getItemsArray(): T[] {\n        return this._items instanceof QueryList ? this._items.toArray() : this._items;\n    }\n}\n","import { ListKeyManager, ListKeyManagerOption } from './list-key-manager';\n\n/**\n * This is the interface for highlightable items (used by the ActiveDescendantKeyManager).\n * Each item must know how to style itself as active or inactive and whether or not it is\n * currently disabled.\n */\nexport interface Highlightable extends ListKeyManagerOption {\n    // Applies the styles for an active item to this item.\n    setActiveStyles(): void;\n\n    // Applies the styles for an inactive item to this item.\n    setInactiveStyles(): void;\n}\n\nexport class ActiveDescendantKeyManager<T> extends ListKeyManager<Highlightable & T> {\n    /**\n     * Sets the active item to the item at the specified index and adds the\n     * active styles to the newly active item. Also removes active styles\n     * from the previously active item.\n     * @param index Index of the item to be set as active.\n     */\n    setActiveItem(index: number): void;\n\n    /**\n     * Sets the active item to the item to the specified one and adds the\n     * active styles to the it. Also removes active styles from the\n     * previously active item.\n     * @param item Item to be set as active.\n     */\n    setActiveItem(item: T): void;\n\n    /**\n     * This method sets the active item to the item at the specified index.\n     * It also adds active styles to the newly active item and removes active\n     * styles from the previously active item.\n     */\n    setActiveItem(index: any): void {\n        if (this.activeItem) {\n            this.activeItem.setInactiveStyles();\n        }\n\n        super.setActiveItem(index);\n\n        if (this.activeItem) {\n            this.activeItem.setActiveStyles();\n        }\n    }\n}\n","import { FocusOrigin } from '@angular/cdk/a11y';\nimport { ListKeyManager, ListKeyManagerOption } from './list-key-manager';\n\n/**\n * This is the interface for focusable items (used by the FocusKeyManager).\n * Each item must know how to focus itself, whether or not it is currently disabled\n * and be able to supply it's label.\n */\nexport interface IFocusableOption extends ListKeyManagerOption {\n    // Focuses the `FocusableOption`. */\n    focus(origin?: FocusOrigin): void;\n}\n\nexport class FocusKeyManager<T> extends ListKeyManager<IFocusableOption & T> {\n    private origin: FocusOrigin = 'program';\n\n    /**\n     * Sets the active item or index to the item that is specified and focuses it.\n     * @param item Item to be set as active.\n     */\n    setActiveItem(item: number | T): void;\n\n    setActiveItem(item: any): void {\n        super.setActiveItem(item);\n\n        if (this.activeItem) {\n            this.activeItem.focus(this.origin);\n        }\n    }\n\n    /**\n     * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls.\n     * @param origin Focus origin to be used when focusing items.\n     */\n    setFocusOrigin(origin: FocusOrigin): this {\n        this.origin = origin;\n\n        return this;\n    }\n\n    getFocusOrigin(): FocusOrigin {\n        return this.origin;\n    }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAiBA;;;AAGG;MACU,cAAc,CAAA;;AAavB,IAAA,IAAI,eAAe,GAAA;QACf,OAAO,IAAI,C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