/** * The **Toolbar** — the configurable top strip above the grid header. * * It owns two layout regions of the shared `.pg-grid__tools` strip: * - a **left region** holding a fully configurable, event-only **tab strip** * (e.g. Active / Inactive / Final Settlement) and, optionally, the global * **search** input when {@link ToolbarSearchPosition.Left} is configured; * - a **right region** holding the search input (when * {@link ToolbarSearchPosition.Right}) alongside the Filters/Import launchers * which dock in independently. * * Like {@link import('./filters-tool-panel').FiltersToolPanel} and * {@link import('./import-menu').ImportMenu} this is a **pure UI** component: it * holds no grid state and mutates nothing directly. Tab selection emits * {@link GridEventType.TOOLBAR_TAB_CHANGED}; the search input is wired to the * grid's quick-filter via {@link ToolbarDeps.onSearch} and additionally emits * {@link GridEventType.TOOLBAR_SEARCH_CHANGED}. * * Every visual is class-driven — all colors, spacing, radii and typography come * from theme CSS variables (see `toolbar.css.ts`); the component sets no inline * styles. * * @packageDocumentation */ import type { IconRenderer } from '../icons/icon-renderer'; import type { EventBus } from '../event-bus/event-bus'; import type { ToolbarConfig } from '../types/toolbar.types'; /** Collaborators the {@link Toolbar} needs from the grid, injected as a DI bag. */ export interface ToolbarDeps { /** Renders themed, registry-backed icons. */ readonly iconRenderer: IconRenderer; /** The grid event bus — used to emit toolbar events and observe quick-filter changes. */ readonly eventBus: EventBus; /** Applies the toolbar search query to the grid's quick-filter (the same seam the group-bar search uses). */ readonly onSearch: (query: string) => void; } /** * Configurable top toolbar. Opt-in via `GridOptions.toolbar.enabled`; mounted by * {@link import('./grid-renderer').GridRenderer} into the shared tools strip's * left/right regions. */ export declare class Toolbar { private readonly deps; private leftRegion; private rightRegion; private tabsEl; private readonly tabButtons; private readonly tabsById; private tabOrder; private activeTabId; private searchWrapEl; private searchInputEl; private searchClearEl; private searchDebounceMs; private searchDebounceTimer; private quickFilterUnsub; private readonly boundTabClick; private readonly boundTabKeydown; constructor(deps: ToolbarDeps); /** * Builds the tab strip and/or search input into the supplied regions. Call * once per grid instance. * * @param leftRegion - `.pg-grid__tools__left` — hosts the tabs and left-docked search. * @param rightRegion - `.pg-grid__tools__right` — hosts right-docked search + the Filters/Import launchers. * @param config - The resolved `GridOptions.toolbar` configuration. */ mount(leftRegion: HTMLElement, rightRegion: HTMLElement, config: ToolbarConfig): void; /** Returns the id of the currently active tab, or `null` when no tabs exist. */ getActiveTab(): string | null; /** * Programmatically selects a tab by id. No-op when the id is unknown, disabled * or already active. Emits {@link GridEventType.TOOLBAR_TAB_CHANGED} on change. */ setActiveTab(id: string): void; /** Tears down DOM, timers and listeners. */ destroy(): void; private buildTabs; private buildTab; private onTabClick; private onTabKeydown; /** * Selects a tab, updating roving tabindex + ARIA state and emitting * {@link GridEventType.TOOLBAR_TAB_CHANGED}. No-op for unknown, disabled or * already-active tabs. */ private selectTab; /** * Scrolls the tab strip so `id`'s button aligns to the leading (left) edge, * bringing the tab we acted on **and the tabs after it** into view. A no-op * when the strip does not overflow. Only the tab strip is scrolled — never the * page — and only along the inline axis. The browser clamps the target scroll * position, so aligning a tab near the end simply scrolls to the end. */ private ensureTabVisible; private buildSearch; private onSearchInput; private clearSearch; /** * Reflects an externally-applied quick-filter term into the input, without * re-dispatching (so it never loops) and without stomping on the user while * they are actively typing in this input. */ private syncFromQuickFilter; } //# sourceMappingURL=toolbar.d.ts.map