UNPKG

@progress/kendo-angular-conversational-ui

Version:

Kendo UI for Angular Conversational UI components

387 lines (386 loc) 12.4 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, Renderer2 } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { SpeechToTextButtonSettings, SpeechToTextErrorEvent, SpeechToTextResultEvent } from '@progress/kendo-angular-buttons'; import { LocalizationService } from '@progress/kendo-angular-l10n'; import { FileInfo, SelectEvent } from '@progress/kendo-angular-upload'; import { PromptBoxEndAffixComponent } from './affixes/promptbox-end-affix.component'; import { PromptBoxStartAffixComponent } from './affixes/promptbox-start-affix.component'; import { PromptBoxTopAffixComponent } from './affixes/promptbox-top-affix.component'; import { PromptBoxHeaderTemplateDirective } from './common/header-template.directive'; import { ActionButtonEvent, ActionButtonSettings, FileSelectButtonSettings } from './common/models'; import { PromptBoxMode } from './common/models/promptbox-mode'; import * as i0 from "@angular/core"; /** * Represents the Kendo UI PromptBox component for Angular. * * @example * ```html * <kendo-promptbox placeholder="Ask a question..."></kendo-promptbox> * ``` * * @remarks * Supported children components are: {@link PromptBoxCustomMessagesComponent}, {@link PromptBoxStartAffixComponent}, {@link PromptBoxEndAffixComponent}, {@link PromptBoxTopAffixComponent}, {@link PromptBoxSpeechToTextButtonComponent}, {@link PromptBoxActionButtonComponent}, {@link PromptBoxFileSelectButtonComponent}. * */ export declare class PromptBoxComponent implements ControlValueAccessor, AfterViewInit { private changeDetector; private renderer; private ngZone; private localization; hostElement: ElementRef; hostClasses: string; get hostSinglelineClass(): boolean; get hostMultilineClass(): boolean; get hostDisabledClass(): boolean; /** * Enables or disables the PromptBox. * * @default false */ disabled: boolean; /** * @hidden */ focusableId: string; /** * Sets the loading state of the **Action** button. * * @default false */ loading: boolean; /** * Sets the placeholder text displayed in the PromptBox when it is empty. * * @default '' */ placeholder: string; /** * Sets the read-only state of the PromptBox. When set to `true`, the PromptBox content cannot be modified but remains accessible. * * @default false */ readonly: boolean; /** * Sets the title attribute of the input or textarea element. * * @default '' * * @remarks * This property is related to accessibility. */ title: string; /** * Sets the mode of the PromptBox. [See example](slug:modes_promptbox). * @default 'auto' */ set mode(promptBoxMode: PromptBoxMode); get mode(): PromptBoxMode; /** * Sets the number of visible text lines in the textarea. Applies only when the `mode` is set to `multi`. */ set rows(value: number); get rows(): number; /** * Sets the maximum height of the textarea in pixels. * The textarea resizes automatically until it reaches this height. When the content exceeds this height, a scrollbar appears. */ set maxTextAreaHeight(value: number); get maxTextAreaHeight(): number; /** * Sets the value of the PromptBox. */ set value(value: string); get value(): string; /** * Controls the visibility and configuration of the **Action** button in the end affix. * * @default true */ set actionButton(settings: boolean | ActionButtonSettings); get actionButton(): boolean | ActionButtonSettings; /** * Controls the visibility and configuration of the **File Select** button in the end affix. * * @default false */ set fileSelectButton(settings: boolean | FileSelectButtonSettings); get fileSelectButton(): boolean | FileSelectButtonSettings; /** * Controls the visibility and configuration of the **Speech to Text** button in the end affix. * * @default true */ set speechToTextButton(settings: boolean | SpeechToTextButtonSettings); get speechToTextButton(): boolean | SpeechToTextButtonSettings; /** * Fires each time the value of the PromptBox changes. */ valueChange: EventEmitter<string>; /** * Fires each time the PromptBox is focused. */ onFocus: EventEmitter<void>; /** * Fires each time the PromptBox gets blurred. */ onBlur: EventEmitter<void>; /** * Fires each time the internal input element is focused. */ inputFocus: EventEmitter<void>; /** * Fires each time the internal input element is blurred. */ inputBlur: EventEmitter<void>; /** * Fires each time you click the **Action** button. */ promptAction: EventEmitter<ActionButtonEvent>; /** * Fires each time you select files using the **File Select** button. */ selectAttachments: EventEmitter<SelectEvent>; /** * Fires each time you remove a file from the PromptBox. */ fileRemove: EventEmitter<FileInfo>; /** * Fires each time you click the **Speech to Text** button. */ speechToTextClick: EventEmitter<any>; /** * Fires each time the speech recognition service begins listening to incoming audio. */ speechToTextStart: EventEmitter<any>; /** * Fires each time the speech recognition service disconnects. */ speechToTextEnd: EventEmitter<any>; /** * Fires when a speech recognition error occurs. */ speechToTextError: EventEmitter<SpeechToTextErrorEvent>; /** * Fires when the speech recognition service returns a result. */ speechToTextResult: EventEmitter<SpeechToTextResultEvent>; /** * @hidden */ inputElement: ElementRef<HTMLInputElement>; /** * @hidden */ textareaElement: ElementRef<HTMLTextAreaElement>; /** * @hidden */ filesList: ElementRef<HTMLUListElement>; /** * @hidden */ headerTemplate: PromptBoxHeaderTemplateDirective; /** * @hidden */ startAffix: PromptBoxStartAffixComponent; /** * @hidden */ endAffix: PromptBoxEndAffixComponent; /** * @hidden */ topAffix: PromptBoxTopAffixComponent; /** * @hidden */ private speechToTextButtonComponent; /** * @hidden */ private actionButtonComponent; /** * @hidden */ private fileSelectButtonComponent; /** * @hidden */ get hasEndAffixContent(): boolean; /** * @hidden */ get isActionButtonDisabled(): boolean; /** * @hidden */ get actionButtonSettings(): ActionButtonSettings; /** * @hidden */ get fileSelectButtonSettings(): FileSelectButtonSettings; /** * @hidden */ get speechToTextButtonSettings(): SpeechToTextButtonSettings; /** * @hidden */ get effectiveRows(): number; /** * @hidden */ hasExpanded: boolean; /** * @hidden */ isListening: boolean; /** * Provides the currently attached files in the PromptBox component. */ attachments: FileInfo[]; /** * @hidden */ filesListScrollAtStart: boolean; /** * @hidden */ filesListScrollAtEnd: boolean; /** * @hidden */ hasFilesOverflow: boolean; private _value; private _mode; private _rows; private initialHeight; private singleRowHeight; private singleLineWidth; private _maxTextAreaHeight; private _actionButtonSettings; private _fileSelectButtonSettings; private _speechToTextButtonSettings; private hostWidthAtCapture; private minMultiRowHeight; private resizeSubscription; private speechToTextSubscription; private actionButtonSubscription; private fileSelectSubscription; private focusChangedProgrammatically; private ngTouched; private ngChange; constructor(changeDetector: ChangeDetectorRef, renderer: Renderer2, ngZone: NgZone, localization: LocalizationService, hostElement: ElementRef); ngAfterViewInit(): void; ngOnDestroy(): void; /** * Focuses the PromptBox. */ focus(): void; /** * Blurs the PromptBox. */ blur(): void; /** * Clears all attached files from the PromptBox. */ clearAttachments(): void; /** * @hidden */ writeValue(value: string): void; /** * @hidden */ registerOnChange(fn: (value: string) => void): void; /** * @hidden */ registerOnTouched(fn: () => void): void; /** * @hidden */ handleInput: (event: Event) => void; /** * @hidden */ handleInputFocus: () => void; /** * @hidden */ handleInputBlur: () => void; /** * @hidden */ handleKeydown: (event: KeyboardEvent) => void; /** * @hidden */ handlePromptAction(event: ActionButtonEvent): void; /** * @hidden */ handleFileSelectAttachments(event: SelectEvent): void; /** * @hidden */ removeFile(index: number): void; /** * @hidden */ onFilesListScroll(filesList: HTMLDivElement): void; /** * @hidden */ handleSpeechToTextClick(event: any): void; /** * @hidden */ handleSpeechToTextStart(event: any): void; /** * @hidden */ handleSpeechToTextEnd(event: any): void; /** * @hidden */ handleSpeechToTextError(event: SpeechToTextErrorEvent): void; /** * @hidden */ handleSpeechToTextResult(event: SpeechToTextResultEvent): void; /** * @hidden */ textFor(key: string): string; /** * @hidden */ private handleFocus; /** * @hidden */ private handleBlur; private attachResizeHandler; private captureInitialDimensions; private resize; private resizeMultiMode; private resizeAutoMode; private updateHeight; private shouldCollapse; private calculateHeight; private resetTextArea; private checkFilesListScroll; private update; private updateComponentSettings; private subscribeToSpeechToTextButton; private subscribeToActionButton; private subscribeToFileSelectButton; static ɵfac: i0.ɵɵFactoryDeclaration<PromptBoxComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<PromptBoxComponent, "kendo-promptbox", ["kendoPromptBox"], { "disabled": { "alias": "disabled"; "required": false; }; "focusableId": { "alias": "focusableId"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "title": { "alias": "title"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "rows": { "alias": "rows"; "required": false; }; "maxTextAreaHeight": { "alias": "maxTextAreaHeight"; "required": false; }; "value": { "alias": "value"; "required": false; }; "actionButton": { "alias": "actionButton"; "required": false; }; "fileSelectButton": { "alias": "fileSelectButton"; "required": false; }; "speechToTextButton": { "alias": "speechToTextButton"; "required": false; }; }, { "valueChange": "valueChange"; "onFocus": "focus"; "onBlur": "blur"; "inputFocus": "inputFocus"; "inputBlur": "inputBlur"; "promptAction": "promptAction"; "selectAttachments": "selectAttachments"; "fileRemove": "fileRemove"; "speechToTextClick": "speechToTextClick"; "speechToTextStart": "speechToTextStart"; "speechToTextEnd": "speechToTextEnd"; "speechToTextError": "speechToTextError"; "speechToTextResult": "speechToTextResult"; }, ["headerTemplate", "startAffix", "endAffix", "topAffix", "speechToTextButtonComponent", "actionButtonComponent", "fileSelectButtonComponent"], never, true, never>; }