@progress/kendo-angular-conversational-ui 19.3.0-develop.8 → 19.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/ai-prompt/aiprompt.component.d.ts +80 -13
  2. package/ai-prompt/aiprompt.module.d.ts +3 -1
  3. package/ai-prompt/common/aiprompt.service.d.ts +10 -0
  4. package/ai-prompt/common/output-card.component.d.ts +4 -0
  5. package/ai-prompt/localization/messages.d.ts +5 -1
  6. package/ai-prompt/models/ai-prompt-settings.d.ts +60 -0
  7. package/ai-prompt/models/index.d.ts +1 -0
  8. package/ai-prompt/templates/aiprompt-output-body-template.directive.d.ts +24 -0
  9. package/ai-prompt/templates/aiprompt-output-template.directive.d.ts +24 -0
  10. package/ai-prompt/views/output-view.component.d.ts +4 -0
  11. package/ai-prompt/views/prompt-view.component.d.ts +23 -1
  12. package/chat/message-attachments.component.d.ts +1 -1
  13. package/conversational-ui.module.d.ts +12 -7
  14. package/directives.d.ts +25 -2
  15. package/esm2022/ai-prompt/aiprompt.component.mjs +177 -25
  16. package/esm2022/ai-prompt/aiprompt.module.mjs +3 -1
  17. package/esm2022/ai-prompt/common/aiprompt.service.mjs +35 -0
  18. package/esm2022/ai-prompt/common/output-card.component.mjs +23 -5
  19. package/esm2022/ai-prompt/common/toolbar-focusable.directive.mjs +4 -3
  20. package/esm2022/ai-prompt/localization/messages.mjs +7 -1
  21. package/esm2022/ai-prompt/models/ai-prompt-settings.mjs +5 -0
  22. package/esm2022/ai-prompt/templates/aiprompt-output-body-template.directive.mjs +33 -0
  23. package/esm2022/ai-prompt/templates/aiprompt-output-template.directive.mjs +33 -0
  24. package/esm2022/ai-prompt/views/output-view.component.mjs +27 -11
  25. package/esm2022/ai-prompt/views/prompt-view.component.mjs +139 -21
  26. package/esm2022/chat/message-attachments.component.mjs +3 -2
  27. package/esm2022/chat/message-box.component.mjs +3 -3
  28. package/esm2022/chat/message-list.component.mjs +4 -2
  29. package/esm2022/chat/suggested-actions.component.mjs +2 -2
  30. package/esm2022/conversational-ui.module.mjs +13 -8
  31. package/esm2022/directives.mjs +32 -2
  32. package/esm2022/index.mjs +8 -0
  33. package/esm2022/inline-ai-prompt/inlineaiprompt-content.component.mjs +522 -0
  34. package/esm2022/inline-ai-prompt/inlineaiprompt.component.mjs +349 -0
  35. package/esm2022/inline-ai-prompt/inlineaiprompt.module.mjs +46 -0
  36. package/esm2022/inline-ai-prompt/inlineaiprompt.service.mjs +85 -0
  37. package/esm2022/inline-ai-prompt/localization/custom-messages.component.mjs +53 -0
  38. package/esm2022/inline-ai-prompt/localization/localized-messages.directive.mjs +39 -0
  39. package/esm2022/inline-ai-prompt/localization/messages.mjs +35 -0
  40. package/esm2022/inline-ai-prompt/models/command.interface.mjs +5 -0
  41. package/esm2022/inline-ai-prompt/models/index.mjs +5 -0
  42. package/esm2022/inline-ai-prompt/models/inlineaiprompt-popupsettings.mjs +5 -0
  43. package/esm2022/inline-ai-prompt/models/inlineaiprompt-settings.mjs +59 -0
  44. package/esm2022/inline-ai-prompt/models/messages.mjs +8 -0
  45. package/esm2022/inline-ai-prompt/models/output-action-click-event.mjs +5 -0
  46. package/esm2022/inline-ai-prompt/models/output-action.interface.mjs +5 -0
  47. package/esm2022/inline-ai-prompt/models/prompt-output.interface.mjs +5 -0
  48. package/esm2022/inline-ai-prompt/models/prompt-request-event.mjs +5 -0
  49. package/esm2022/inline-ai-prompt/output-template.directive.mjs +38 -0
  50. package/esm2022/inline-ai-prompt/utils.mjs +57 -0
  51. package/esm2022/package-metadata.mjs +2 -2
  52. package/fesm2022/progress-kendo-angular-conversational-ui.mjs +1768 -147
  53. package/index.d.ts +8 -0
  54. package/inline-ai-prompt/inlineaiprompt-content.component.d.ts +82 -0
  55. package/inline-ai-prompt/inlineaiprompt.component.d.ts +157 -0
  56. package/inline-ai-prompt/inlineaiprompt.module.d.ts +31 -0
  57. package/inline-ai-prompt/inlineaiprompt.service.d.ts +41 -0
  58. package/inline-ai-prompt/localization/custom-messages.component.d.ts +27 -0
  59. package/inline-ai-prompt/localization/localized-messages.directive.d.ts +16 -0
  60. package/inline-ai-prompt/localization/messages.d.ts +25 -0
  61. package/inline-ai-prompt/models/command.interface.d.ts +38 -0
  62. package/inline-ai-prompt/models/index.d.ts +12 -0
  63. package/inline-ai-prompt/models/inlineaiprompt-popupsettings.d.ts +10 -0
  64. package/inline-ai-prompt/models/inlineaiprompt-settings.d.ts +66 -0
  65. package/inline-ai-prompt/models/messages.d.ts +21 -0
  66. package/inline-ai-prompt/models/output-action-click-event.d.ts +19 -0
  67. package/inline-ai-prompt/models/output-action.interface.d.ts +52 -0
  68. package/inline-ai-prompt/models/prompt-output.interface.d.ts +25 -0
  69. package/inline-ai-prompt/models/prompt-request-event.d.ts +17 -0
  70. package/inline-ai-prompt/output-template.directive.d.ts +27 -0
  71. package/inline-ai-prompt/utils.d.ts +17 -0
  72. package/package.json +13 -12
@@ -0,0 +1,522 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Component, ElementRef, EventEmitter, HostBinding, HostListener, Input, NgZone, Output, Renderer2, ViewChild, ViewContainerRef, Optional, SkipSelf, inject, TemplateRef } from '@angular/core';
6
+ import { NgIf, NgClass, NgTemplateOutlet, NgFor } from '@angular/common';
7
+ import { Subscription } from 'rxjs';
8
+ import { menuIcon, paperPlaneIcon, stopSmIcon } from '@progress/kendo-svg-icons';
9
+ import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
10
+ import { validatePackage } from '@progress/kendo-licensing';
11
+ import { KENDO_BUTTONS } from '@progress/kendo-angular-buttons';
12
+ import { packageMetadata } from '../package-metadata';
13
+ import { TextAreaComponent, KENDO_TEXTAREA } from '@progress/kendo-angular-inputs';
14
+ import { ContextMenuComponent, KENDO_CONTEXTMENU } from '@progress/kendo-angular-menu';
15
+ import { LocalizedMessagesDirective } from './localization/localized-messages.directive';
16
+ import { isDocumentAvailable, isPresent } from '@progress/kendo-angular-common';
17
+ import { calculateMeasurement, defaultOutputActions } from './utils';
18
+ import { KENDO_CARD } from '@progress/kendo-angular-layout';
19
+ import * as i0 from "@angular/core";
20
+ import * as i1 from "@progress/kendo-angular-l10n";
21
+ import * as i2 from "@progress/kendo-angular-buttons";
22
+ import * as i3 from "@progress/kendo-angular-inputs";
23
+ import * as i4 from "@progress/kendo-angular-menu";
24
+ import * as i5 from "@progress/kendo-angular-layout";
25
+ const TEXTAREA_MAX_ROWS = 5;
26
+ const TEXTAREA_INITIAL_ROWS = 1;
27
+ /**
28
+ * @hidden
29
+ */
30
+ export class InlineAIPromptContentComponent {
31
+ ngZone;
32
+ renderer;
33
+ element;
34
+ localization;
35
+ className = true;
36
+ get dirAttr() {
37
+ return this.direction;
38
+ }
39
+ get maxHeightStyle() {
40
+ return this.calculateMeasurement(this.maxHeight);
41
+ }
42
+ get widthStyle() {
43
+ return this.calculateMeasurement(this.width);
44
+ }
45
+ popupElement;
46
+ promptValue = "";
47
+ placeholder;
48
+ promptOutput;
49
+ enableSpeechToText = true;
50
+ streaming = false;
51
+ width = 550;
52
+ maxHeight;
53
+ appendTo;
54
+ defaultOutputActions = defaultOutputActions;
55
+ set outputActions(actions) {
56
+ this._outputActions = this.mergeWithDefaultActions(actions);
57
+ }
58
+ get outputActions() {
59
+ return this._outputActions;
60
+ }
61
+ set promptCommands(commands) {
62
+ this._promptCommands = commands || [];
63
+ this.commandMenuItems = this.transformCommands(commands || []);
64
+ }
65
+ get promptCommands() {
66
+ return this._promptCommands;
67
+ }
68
+ outputTemplate;
69
+ promptRequest = new EventEmitter();
70
+ commandExecute = new EventEmitter();
71
+ outputActionClick = new EventEmitter();
72
+ promptRequestCancel = new EventEmitter();
73
+ close = new EventEmitter();
74
+ promptValueChange = new EventEmitter();
75
+ onEscapeKey(event) {
76
+ if (event.key === 'Escape') {
77
+ if (this.streaming) {
78
+ event.stopPropagation();
79
+ this.promptRequestCancel.emit();
80
+ }
81
+ else {
82
+ this.close.emit();
83
+ }
84
+ }
85
+ }
86
+ textArea;
87
+ contextMenu;
88
+ calculateMeasurement = calculateMeasurement;
89
+ commandMenuIcon = menuIcon;
90
+ sendIcon = paperPlaneIcon;
91
+ stopGenerationIcon = stopSmIcon;
92
+ isListening = false;
93
+ commandMenuItems = [];
94
+ messages = {};
95
+ maxRows = TEXTAREA_MAX_ROWS;
96
+ initialRows = TEXTAREA_INITIAL_ROWS;
97
+ _outputActions = this.defaultOutputActions;
98
+ _promptCommands = [];
99
+ direction;
100
+ localizationSubs = new Subscription();
101
+ subs = new Subscription();
102
+ constructor(ngZone, renderer, element, localization) {
103
+ this.ngZone = ngZone;
104
+ this.renderer = renderer;
105
+ this.element = element;
106
+ this.localization = localization;
107
+ validatePackage(packageMetadata);
108
+ if (!this.localization) {
109
+ this.localization = inject(LocalizationService);
110
+ }
111
+ this.direction = this.localization?.rtl ? 'rtl' : 'ltr';
112
+ this.localizationSubs.add(this.localization.changes.subscribe(({ rtl }) => {
113
+ this.direction = rtl ? 'rtl' : 'ltr';
114
+ }));
115
+ }
116
+ ngAfterViewInit() {
117
+ this.ngZone.runOutsideAngular(() => {
118
+ if (!isDocumentAvailable()) {
119
+ return;
120
+ }
121
+ // add a delay to avoid catching the same click event that triggered the component opening
122
+ setTimeout(() => {
123
+ this.subs.add(this.renderer.listen('document', 'click', (e) => {
124
+ this.outsideClickClose(e);
125
+ }));
126
+ });
127
+ });
128
+ }
129
+ ngOnDestroy() {
130
+ this.subs.unsubscribe();
131
+ this.localizationSubs.unsubscribe();
132
+ this.contextMenu?.hide();
133
+ }
134
+ focus() {
135
+ if (this.textArea) {
136
+ this.textArea.focus();
137
+ }
138
+ }
139
+ onActionClick(event) {
140
+ const eventArgs = {
141
+ action: event,
142
+ output: this.promptOutput,
143
+ };
144
+ this.outputActionClick.emit(eventArgs);
145
+ this.handleDefaultActions(event);
146
+ }
147
+ handleDefaultActions(event) {
148
+ switch (event.name) {
149
+ case 'copy':
150
+ navigator.clipboard.writeText(this.promptOutput.output);
151
+ break;
152
+ case 'retry':
153
+ this.promptRequest.emit({
154
+ prompt: this.promptOutput?.prompt,
155
+ isRetry: true
156
+ });
157
+ break;
158
+ case 'discard':
159
+ this.close.emit();
160
+ break;
161
+ }
162
+ }
163
+ handleSpeechResult(event) {
164
+ if (event.alternatives && event.alternatives.length > 0) {
165
+ if (!isPresent(this.promptValue)) {
166
+ this.promptValue = '';
167
+ }
168
+ this.promptValue += event.alternatives[0].transcript + ' ';
169
+ }
170
+ }
171
+ onClick(action) {
172
+ this.commandExecute.next(action);
173
+ }
174
+ handlePromptValueChange(value) {
175
+ this.promptValue = value;
176
+ this.promptValueChange.emit(value);
177
+ }
178
+ handleTextAreaKeydown(event) {
179
+ if (event.key === 'Enter' && !event.shiftKey && !this.streaming) {
180
+ event.preventDefault();
181
+ this.handlePromptRequest();
182
+ }
183
+ }
184
+ onCommandButtonClick(event) {
185
+ event.preventDefault();
186
+ event.stopPropagation();
187
+ if (this.contextMenu) {
188
+ this.contextMenu.show(this.popupElement);
189
+ }
190
+ }
191
+ onCommandClick(event) {
192
+ // avoid triggering the document click listener to keep the popup open
193
+ if (event.originalEvent) {
194
+ event.originalEvent.stopPropagation();
195
+ event.originalEvent.preventDefault();
196
+ }
197
+ const eventArgs = {
198
+ ...event.item.originalCommand
199
+ };
200
+ this.commandExecute.emit(eventArgs);
201
+ }
202
+ messageFor(text) {
203
+ if (this.messages?.[text]) {
204
+ return this.messages[text];
205
+ }
206
+ return this.localization?.get(text);
207
+ }
208
+ handlePromptRequest() {
209
+ if (this.streaming) {
210
+ this.promptRequestCancel.emit();
211
+ return;
212
+ }
213
+ if (!this.promptValue) {
214
+ return;
215
+ }
216
+ const eventArgs = {
217
+ prompt: this.promptValue
218
+ };
219
+ this.promptRequest.emit(eventArgs);
220
+ }
221
+ mergeWithDefaultActions(userActions) {
222
+ if (!userActions || userActions.length === 0) {
223
+ return [];
224
+ }
225
+ return userActions.map(userAction => {
226
+ const defaultAction = defaultOutputActions.find(action => action.name === userAction?.name);
227
+ if (defaultAction) {
228
+ return { ...defaultAction, ...userAction };
229
+ }
230
+ return userAction;
231
+ });
232
+ }
233
+ transformCommands = (commands) => commands.map(command => ({
234
+ text: command.text,
235
+ icon: command.icon,
236
+ svgIcon: command.svgIcon,
237
+ disabled: command.disabled,
238
+ originalCommand: command,
239
+ items: command.children ? this.transformCommands(command.children) : undefined
240
+ }));
241
+ outsideClickClose(e) {
242
+ if (!this.element.nativeElement.contains(e.target)) {
243
+ this.ngZone.run(() => {
244
+ this.close.emit();
245
+ });
246
+ }
247
+ }
248
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptContentComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1.LocalizationService, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Component });
249
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InlineAIPromptContentComponent, isStandalone: true, selector: "kendo-inlineaiprompt-content", inputs: { popupElement: "popupElement", promptValue: "promptValue", placeholder: "placeholder", promptOutput: "promptOutput", enableSpeechToText: "enableSpeechToText", streaming: "streaming", width: "width", maxHeight: "maxHeight", appendTo: "appendTo", outputActions: "outputActions", promptCommands: "promptCommands", outputTemplate: "outputTemplate" }, outputs: { promptRequest: "promptRequest", commandExecute: "commandExecute", outputActionClick: "outputActionClick", promptRequestCancel: "promptRequestCancel", close: "close", promptValueChange: "promptValueChange" }, host: { listeners: { "keydown": "onEscapeKey($event)" }, properties: { "class.k-prompt": "this.className", "attr.dir": "this.dirAttr", "style.max-height": "this.maxHeightStyle", "style.width": "this.widthStyle" } }, providers: [
250
+ LocalizationService,
251
+ {
252
+ provide: L10N_PREFIX,
253
+ useValue: 'kendo.inlineaiprompt',
254
+ },
255
+ ], viewQueries: [{ propertyName: "textArea", first: true, predicate: TextAreaComponent, descendants: true }, { propertyName: "contextMenu", first: true, predicate: ["kendoContextMenu"], descendants: true }], exportAs: ["kendoInlineAIPromptContent"], ngImport: i0, template: `
256
+ <ng-container kendoInlineAIPromptLocalizedMessages
257
+ i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
258
+ commandsButtonTitle="Command Menu"
259
+ i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
260
+ generateButtonTitle="Generate"
261
+ i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
262
+ speechToTextButtonTitle="Speech to Text"
263
+ >
264
+ </ng-container>
265
+ <div class="k-prompt-content">
266
+ <div class="k-prompt-view">
267
+ <kendo-card *ngIf="promptOutput" width="100%">
268
+ <kendo-card-body>
269
+ <ng-container
270
+ *ngIf="outputTemplate"
271
+ [ngTemplateOutlet]="outputTemplate"
272
+ [ngTemplateOutletContext]="{ $implicit: promptOutput }"
273
+ >
274
+ </ng-container>
275
+ <ng-container *ngIf="!outputTemplate">{{promptOutput.output}}</ng-container>
276
+ </kendo-card-body>
277
+ <kendo-card-actions *ngIf="outputActions && outputActions.length > 0">
278
+ <ng-container *ngFor="let action of outputActions">
279
+ <button kendoButton *ngIf="action.type === 'button'"
280
+ [attr.title]="action?.title"
281
+ [fillMode]="action?.fillMode"
282
+ [themeColor]="action?.themeColor"
283
+ [rounded]="action?.rounded"
284
+ [icon]="action?.icon"
285
+ [svgIcon]="action?.svgIcon"
286
+ (click)="onActionClick(action)"
287
+ >{{action?.text}}</button>
288
+ <div *ngIf="action.type === 'spacer'" class="k-spacer"></div>
289
+ </ng-container>
290
+ </kendo-card-actions>
291
+ </kendo-card>
292
+ <kendo-textarea
293
+ [value]="promptValue ? promptValue : null"
294
+ (valueChange)="handlePromptValueChange($event)"
295
+ [rows]="initialRows"
296
+ resizable="auto"
297
+ flow="horizontal"
298
+ [placeholder]="placeholder"
299
+ [showPrefixSeparator]="true"
300
+ [selectOnFocus]="true"
301
+ [maxResizableRows]="maxRows"
302
+ (keydown)="handleTextAreaKeydown($event)"
303
+ >
304
+ <kendo-textarea-prefix>
305
+ <button
306
+ kendoButton
307
+ #commandMenuButton
308
+ *ngIf="promptCommands && promptCommands.length > 0"
309
+ [attr.title]="messageFor('commandsButtonTitle')"
310
+ fillMode="flat"
311
+ icon="menu"
312
+ [svgIcon]="commandMenuIcon"
313
+ (click)="onCommandButtonClick($event)"
314
+ ></button>
315
+ <button
316
+ kendoSpeechToTextButton
317
+ *ngIf="enableSpeechToText"
318
+ [attr.title]="messageFor('speechToTextButtonTitle')"
319
+ fillMode="flat"
320
+ (result)="handleSpeechResult($event)"
321
+ (start)="isListening = true"
322
+ (end)="isListening = false"
323
+ ></button>
324
+ </kendo-textarea-prefix>
325
+ <kendo-textarea-suffix>
326
+ <button
327
+ kendoButton
328
+ [attr.title]="messageFor('generateButtonTitle')"
329
+ fillMode="flat"
330
+ class="k-prompt-send"
331
+ [ngClass]="{ 'k-generating': streaming, 'k-active': streaming }"
332
+ (click)="handlePromptRequest()"
333
+ [disabled]="!streaming && (!promptValue?.trim() || isListening)"
334
+ [svgIcon]="streaming ? stopGenerationIcon : sendIcon"
335
+ [icon]="streaming ? 'stop-sm' : 'paper-plane'"
336
+ ></button>
337
+ </kendo-textarea-suffix>
338
+ </kendo-textarea>
339
+ </div>
340
+ </div>
341
+ <kendo-contextmenu
342
+ #kendoContextMenu
343
+ [alignToAnchor]="true"
344
+ [items]="commandMenuItems"
345
+ [appendTo]="appendTo"
346
+ class="k-hidden"
347
+ (select)="onCommandClick($event)">
348
+ </kendo-contextmenu>
349
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoInlineAIPromptLocalizedMessages]" }, { kind: "component", type: i2.ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "component", type: i2.SpeechToTextButtonComponent, selector: "button[kendoSpeechToTextButton]", inputs: ["disabled", "size", "rounded", "fillMode", "themeColor", "integrationMode", "lang", "continuous", "interimResults", "maxAlternatives"], outputs: ["start", "end", "result", "error", "click"], exportAs: ["kendoSpeechToTextButton"] }, { kind: "component", type: i3.TextAreaComponent, selector: "kendo-textarea", inputs: ["focusableId", "flow", "inputAttributes", "adornmentsOrientation", "rows", "cols", "maxlength", "maxResizableRows", "tabindex", "tabIndex", "resizable", "size", "rounded", "fillMode", "showPrefixSeparator", "showSuffixSeparator"], outputs: ["focus", "blur", "valueChange"], exportAs: ["kendoTextArea"] }, { kind: "component", type: i3.TextAreaPrefixComponent, selector: "kendo-textarea-prefix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaPrefix"] }, { kind: "component", type: i3.TextAreaSuffixComponent, selector: "kendo-textarea-suffix", inputs: ["flow", "orientation"], exportAs: ["kendoTextAreaSuffix"] }, { kind: "component", type: i4.ContextMenuComponent, selector: "kendo-contextmenu", inputs: ["showOn", "target", "filter", "alignToAnchor", "vertical", "popupAnimate", "popupAlign", "anchorAlign", "collision", "appendTo", "ariaLabel"], outputs: ["popupOpen", "popupClose", "select", "open", "close"], exportAs: ["kendoContextMenu"] }, { kind: "component", type: i5.CardComponent, selector: "kendo-card", inputs: ["orientation", "width"] }, { kind: "component", type: i5.CardActionsComponent, selector: "kendo-card-actions", inputs: ["orientation", "layout", "actions"], outputs: ["action"] }, { kind: "component", type: i5.CardBodyComponent, selector: "kendo-card-body" }] });
350
+ }
351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InlineAIPromptContentComponent, decorators: [{
352
+ type: Component,
353
+ args: [{
354
+ exportAs: 'kendoInlineAIPromptContent',
355
+ selector: 'kendo-inlineaiprompt-content',
356
+ providers: [
357
+ LocalizationService,
358
+ {
359
+ provide: L10N_PREFIX,
360
+ useValue: 'kendo.inlineaiprompt',
361
+ },
362
+ ],
363
+ template: `
364
+ <ng-container kendoInlineAIPromptLocalizedMessages
365
+ i18n-commandsButtonTitle="kendo.inlineaiprompt.commandsButtonTitle|Sets the Commands button title."
366
+ commandsButtonTitle="Command Menu"
367
+ i18n-generateButtonTitle="kendo.inlineaiprompt.generateButtonTitle|Sets the Generate button title."
368
+ generateButtonTitle="Generate"
369
+ i18n-speechToTextButtonTitle="kendo.inlineaiprompt.speechToTextButtonTitle|Sets the Speech to Text button title."
370
+ speechToTextButtonTitle="Speech to Text"
371
+ >
372
+ </ng-container>
373
+ <div class="k-prompt-content">
374
+ <div class="k-prompt-view">
375
+ <kendo-card *ngIf="promptOutput" width="100%">
376
+ <kendo-card-body>
377
+ <ng-container
378
+ *ngIf="outputTemplate"
379
+ [ngTemplateOutlet]="outputTemplate"
380
+ [ngTemplateOutletContext]="{ $implicit: promptOutput }"
381
+ >
382
+ </ng-container>
383
+ <ng-container *ngIf="!outputTemplate">{{promptOutput.output}}</ng-container>
384
+ </kendo-card-body>
385
+ <kendo-card-actions *ngIf="outputActions && outputActions.length > 0">
386
+ <ng-container *ngFor="let action of outputActions">
387
+ <button kendoButton *ngIf="action.type === 'button'"
388
+ [attr.title]="action?.title"
389
+ [fillMode]="action?.fillMode"
390
+ [themeColor]="action?.themeColor"
391
+ [rounded]="action?.rounded"
392
+ [icon]="action?.icon"
393
+ [svgIcon]="action?.svgIcon"
394
+ (click)="onActionClick(action)"
395
+ >{{action?.text}}</button>
396
+ <div *ngIf="action.type === 'spacer'" class="k-spacer"></div>
397
+ </ng-container>
398
+ </kendo-card-actions>
399
+ </kendo-card>
400
+ <kendo-textarea
401
+ [value]="promptValue ? promptValue : null"
402
+ (valueChange)="handlePromptValueChange($event)"
403
+ [rows]="initialRows"
404
+ resizable="auto"
405
+ flow="horizontal"
406
+ [placeholder]="placeholder"
407
+ [showPrefixSeparator]="true"
408
+ [selectOnFocus]="true"
409
+ [maxResizableRows]="maxRows"
410
+ (keydown)="handleTextAreaKeydown($event)"
411
+ >
412
+ <kendo-textarea-prefix>
413
+ <button
414
+ kendoButton
415
+ #commandMenuButton
416
+ *ngIf="promptCommands && promptCommands.length > 0"
417
+ [attr.title]="messageFor('commandsButtonTitle')"
418
+ fillMode="flat"
419
+ icon="menu"
420
+ [svgIcon]="commandMenuIcon"
421
+ (click)="onCommandButtonClick($event)"
422
+ ></button>
423
+ <button
424
+ kendoSpeechToTextButton
425
+ *ngIf="enableSpeechToText"
426
+ [attr.title]="messageFor('speechToTextButtonTitle')"
427
+ fillMode="flat"
428
+ (result)="handleSpeechResult($event)"
429
+ (start)="isListening = true"
430
+ (end)="isListening = false"
431
+ ></button>
432
+ </kendo-textarea-prefix>
433
+ <kendo-textarea-suffix>
434
+ <button
435
+ kendoButton
436
+ [attr.title]="messageFor('generateButtonTitle')"
437
+ fillMode="flat"
438
+ class="k-prompt-send"
439
+ [ngClass]="{ 'k-generating': streaming, 'k-active': streaming }"
440
+ (click)="handlePromptRequest()"
441
+ [disabled]="!streaming && (!promptValue?.trim() || isListening)"
442
+ [svgIcon]="streaming ? stopGenerationIcon : sendIcon"
443
+ [icon]="streaming ? 'stop-sm' : 'paper-plane'"
444
+ ></button>
445
+ </kendo-textarea-suffix>
446
+ </kendo-textarea>
447
+ </div>
448
+ </div>
449
+ <kendo-contextmenu
450
+ #kendoContextMenu
451
+ [alignToAnchor]="true"
452
+ [items]="commandMenuItems"
453
+ [appendTo]="appendTo"
454
+ class="k-hidden"
455
+ (select)="onCommandClick($event)">
456
+ </kendo-contextmenu>
457
+ `,
458
+ standalone: true,
459
+ imports: [NgClass, NgIf, NgFor, NgTemplateOutlet, LocalizedMessagesDirective, KENDO_BUTTONS, KENDO_TEXTAREA, KENDO_CONTEXTMENU, KENDO_CARD],
460
+ }]
461
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1.LocalizationService, decorators: [{
462
+ type: Optional
463
+ }, {
464
+ type: SkipSelf
465
+ }] }]; }, propDecorators: { className: [{
466
+ type: HostBinding,
467
+ args: ['class.k-prompt']
468
+ }], dirAttr: [{
469
+ type: HostBinding,
470
+ args: ['attr.dir']
471
+ }], maxHeightStyle: [{
472
+ type: HostBinding,
473
+ args: ['style.max-height']
474
+ }], widthStyle: [{
475
+ type: HostBinding,
476
+ args: ['style.width']
477
+ }], popupElement: [{
478
+ type: Input
479
+ }], promptValue: [{
480
+ type: Input
481
+ }], placeholder: [{
482
+ type: Input
483
+ }], promptOutput: [{
484
+ type: Input
485
+ }], enableSpeechToText: [{
486
+ type: Input
487
+ }], streaming: [{
488
+ type: Input
489
+ }], width: [{
490
+ type: Input
491
+ }], maxHeight: [{
492
+ type: Input
493
+ }], appendTo: [{
494
+ type: Input
495
+ }], outputActions: [{
496
+ type: Input
497
+ }], promptCommands: [{
498
+ type: Input
499
+ }], outputTemplate: [{
500
+ type: Input
501
+ }], promptRequest: [{
502
+ type: Output
503
+ }], commandExecute: [{
504
+ type: Output
505
+ }], outputActionClick: [{
506
+ type: Output
507
+ }], promptRequestCancel: [{
508
+ type: Output
509
+ }], close: [{
510
+ type: Output
511
+ }], promptValueChange: [{
512
+ type: Output
513
+ }], onEscapeKey: [{
514
+ type: HostListener,
515
+ args: ['keydown', ['$event']]
516
+ }], textArea: [{
517
+ type: ViewChild,
518
+ args: [TextAreaComponent]
519
+ }], contextMenu: [{
520
+ type: ViewChild,
521
+ args: ['kendoContextMenu']
522
+ }] } });