/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ /** * @module ai/aichat/ui/controls/aichatchipsoverflowmanager */ import { View, type BodyCollection, ButtonView } from "@ckeditor/ckeditor5-ui"; import { type Locale, Collection } from "@ckeditor/ckeditor5-utils"; import { type AIChatContextItemButtonView } from "./aichatcontextitembuttonview.js"; /** * Configuration interface for the chips overflow manager. */ export interface ChipsOverflowConfig { cssClasses: { showMoreButton: string; showMoreBalloon: string; overflowContainer: string; controlsButton?: string; calculationContainer?: string; }; maxVisibleRows?: number; /** * Tolerance for row detection in pixels. */ rowDetectionTolerance?: number; showMoreLabelPrefix?: string; viewportOffset?: { top: number; bottom: number; }; /** * Resolves the element the show more balloon must stay within, usually the container the chips are in. * * **Tip**: Resolve it by walking up from an element the consumer already holds (`Element#closest()`) rather than by * querying the document: a `document.querySelector()` call finds nothing when the chips live in a shadow root, * and the balloon silently stops being constrained to anything. * * The balloon is positioned without a limiter when this is not set or resolves to `null`. */ getLimiterElement?: () => HTMLElement | null; } /** * A reusable component for managing chips overflow with show more functionality. */ export declare class AIChatChipsOverflowManager { constructor(locale: Locale, visibleChips: Collection, config: ChipsOverflowConfig, bodyCollection: BodyCollection, parentView: View); /** * Sets the container element that holds the chips. */ setContainerElement(element: HTMLElement): void; /** * Gets the show more button view. */ get showMoreButtonView(): ButtonView | null; /** * Gets the overflow chips collection. */ get overflowChips(): Collection; /** * Reorganizes chips to handle overflow. */ reorganizeChips(): void; /** * Shows the show more balloon panel. */ showBalloonPanel(): void; /** * Hides the show more balloon panel. */ hideBalloonPanel(): void; /** * Clears all overflow chips and resets the overflow state. * This properly updates the show more button counter and hides it when no overflow items remain. */ clear(): void; /** * Destroys the overflow manager and cleans up resources. */ destroy(): void; }