import * as _angular_core from '@angular/core'; import { ElementRef } from '@angular/core'; import { BooleanInput } from '@angular/cdk/coercion'; import { WrIconName } from 'ngwr/icon'; /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** A single action / page entry in {@link WrCommandPalette}. */ interface WrCommandItem { /** Stable identifier — used for `track $index` and option focus. */ readonly id: string; /** Primary visible label. */ readonly label: string; /** Secondary text shown under the label. */ readonly description?: string; /** Optional group title (items with the same group are bucketed). */ readonly group?: string; /** Optional icon shown on the left. */ readonly icon?: WrIconName; /** Extra search terms — added to the haystack alongside label + description. */ readonly keywords?: readonly string[]; /** Visual hint shown on the right (e.g. `'⌘K'`, `'G H'`). */ readonly shortcut?: string; /** Imperative callback fired when this item is picked. */ readonly action?: () => void; } /** Flat list of items grouped under a single header — convenience type. */ interface WrCommandGroup { readonly title: string; readonly items: readonly WrCommandItem[]; } interface Bucket { readonly title: string | null; readonly items: readonly WrCommandItem[]; } /** * `⌘K`-style command palette — a centred modal with a search input and * filtered list of actions. Items can be grouped, have icons, descriptions, * and visual shortcut hints. * * Drop one at the root of the app, pass it the list of commands, and bind * a global hotkey (default `'mod+k'`). Use `[(open)]` for controlled * visibility, or let it manage itself. * * @example * ```html * * ``` * * @see https://ngwr.dev/components/command-palette */ declare class WrCommandPalette { /** Items shown in the palette. */ readonly items: _angular_core.InputSignal; /** Controlled open state (two-way bindable). @default false */ readonly open: _angular_core.ModelSignal; /** Global hotkey that opens the palette. `null` disables auto-binding. @default 'mod+k' */ readonly trigger: _angular_core.InputSignal; /** Search input placeholder. Falls back to `commandPalette.placeholder`. */ readonly placeholder: _angular_core.InputSignal; /** Text shown when no items match. Falls back to `commandPalette.noResults`. */ readonly emptyText: _angular_core.InputSignal; protected readonly resolvedPlaceholder: _angular_core.Signal; protected readonly resolvedEmpty: _angular_core.Signal; /** Auto-close on `(picked)`. Set false to keep open. @default true */ readonly closeOnPick: _angular_core.InputSignalWithTransform; /** * Present the palette full-screen on small viewports instead of a centred * modal. `undefined` follows the app-wide `provideWrResponsiveOverlays()` * setting; `true`/`false` overrides it. The palette docks to the top (it * auto-focuses its input, so the on-screen keyboard stays clear). * @default undefined */ readonly responsive: _angular_core.InputSignalWithTransform; /** Fires when the user commits an item (Enter / click). */ readonly picked: _angular_core.OutputEmitterRef; protected readonly query: _angular_core.WritableSignal; protected readonly activeIndex: _angular_core.WritableSignal; /** Whether the current opening is presented full-screen. Decided on open. */ protected readonly presentAsSheet: _angular_core.WritableSignal; protected readonly inputEl: _angular_core.Signal | undefined>; protected readonly panelEl: _angular_core.Signal | undefined>; /** Listbox id (referenced by the input's `aria-controls`). */ protected readonly listboxId: string; /** @internal Build a stable option id for a given flat index. */ protected optionId(i: number): string; /** Id of the active option for `aria-activedescendant`. */ protected readonly activeOptionId: _angular_core.Signal; private readonly hotkeys; private readonly responsiveConfig; private readonly destroyRef; private readonly focusTrapFactory; private readonly isBrowser; private bindingHandle; private focusTrap; private previouslyFocused; /** Flat filtered list — what keyboard navigation walks. */ protected readonly filtered: _angular_core.Signal; /** Grouped view — what the template renders. */ protected readonly buckets: _angular_core.Signal; constructor(); protected onQueryInput(event: Event): void; protected onKeydown(event: KeyboardEvent): void; protected onBackdropClick(): void; protected onItemClick(item: WrCommandItem, event: MouseEvent): void; protected onItemHover(item: WrCommandItem): void; /** Flat index of an item within the filtered list — for highlight checks. */ protected indexOf(item: WrCommandItem): number; /** Open the palette. */ show(): void; /** Close the palette. */ close(): void; private commit; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } export { WrCommandPalette }; export type { WrCommandGroup, WrCommandItem };