@progress/kendo-angular-buttons 19.2.1-develop.4 → 19.3.0-develop.10

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.
@@ -4,11 +4,11 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as i0 from '@angular/core';
6
6
  import { Injectable, isDevMode, EventEmitter, Component, Optional, Input, Output, HostBinding, HostListener, ContentChildren, Directive, InjectionToken, Inject, ElementRef, ViewContainerRef, ViewChild, ContentChild, forwardRef, NgModule } from '@angular/core';
7
- import { Subject, Subscription, fromEvent, merge } from 'rxjs';
7
+ import { Subject, Subscription, fromEvent, merge, of, Observable, from } from 'rxjs';
8
8
  import * as i12 from '@progress/kendo-angular-common';
9
- import { isDocumentAvailable, isFirefox, isSafari, isChanged, hasObservers, Keys, TemplateContextDirective, MultiTabStop, guid, isPresent as isPresent$1, EventsOutsideAngularDirective, anyChanged, ToggleButtonTabStopDirective, ResizeBatchService, KENDO_TOGGLEBUTTONTABSTOP } from '@progress/kendo-angular-common';
9
+ import { isDocumentAvailable, isFirefox, isSafari, isChanged, hasObservers, Keys, TemplateContextDirective, MultiTabStop, guid, isPresent as isPresent$1, EventsOutsideAngularDirective, replaceMessagePlaceholder, anyChanged, ToggleButtonTabStopDirective, ResizeBatchService, KENDO_TOGGLEBUTTONTABSTOP } from '@progress/kendo-angular-common';
10
10
  export { ToggleButtonTabStopDirective } from '@progress/kendo-angular-common';
11
- import { caretAltDownIcon, xCircleIcon, moreVerticalIcon } from '@progress/kendo-svg-icons';
11
+ import { caretAltDownIcon, xCircleIcon, moreVerticalIcon, microphoneOutlineIcon, stopSmIcon } from '@progress/kendo-svg-icons';
12
12
  import * as i1 from '@progress/kendo-angular-l10n';
13
13
  import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
14
14
  import { validatePackage } from '@progress/kendo-licensing';
@@ -19,6 +19,7 @@ import * as i3 from '@progress/kendo-angular-popup';
19
19
  import { PopupService } from '@progress/kendo-angular-popup';
20
20
  import * as i4 from '@angular/animations';
21
21
  import { sequence, query, style, stagger, animate } from '@angular/animations';
22
+ import { KendoSpeechRecognition } from '@progress/kendo-webspeech-common';
22
23
 
23
24
  /**
24
25
  * @hidden
@@ -44,8 +45,8 @@ const packageMetadata = {
44
45
  productName: 'Kendo UI for Angular',
45
46
  productCode: 'KENDOUIANGULAR',
46
47
  productCodes: ['KENDOUIANGULAR'],
47
- publishDate: 1751639440,
48
- version: '19.2.1-develop.4',
48
+ publishDate: 1752738968,
49
+ version: '19.3.0-develop.10',
49
50
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
50
51
  };
51
52
 
@@ -85,10 +86,6 @@ function closest(element, selector) {
85
86
  node = node.parentNode;
86
87
  }
87
88
  }
88
- /**
89
- * @hidden
90
- */
91
- const replaceMessagePlaceholder = (message, name, value) => message.replace(new RegExp(`{\\s*${name}\\s*}`, 'g'), value);
92
89
  /**
93
90
  * @hidden
94
91
  */
@@ -140,6 +137,17 @@ const getThemeColorClasses = (componentType, prevFillMode, fillMode, previousVal
140
137
  toAdd: newValue !== 'none' ? `k-${componentType}-${fillMode}-${newValue}` : ''
141
138
  };
142
139
  };
140
+ /**
141
+ * @hidden
142
+ */
143
+ const toggleClass = (className, add, renderer, element) => {
144
+ if (add) {
145
+ renderer.addClass(element, className);
146
+ }
147
+ else {
148
+ renderer.removeClass(element, className);
149
+ }
150
+ };
143
151
  /**
144
152
  * @hidden
145
153
  *
@@ -147,10 +155,10 @@ const getThemeColorClasses = (componentType, prevFillMode, fillMode, previousVal
147
155
  */
148
156
  const isObjectEmpty = (obj) => obj && Object.keys(obj).length === 0 && obj.constructor === Object;
149
157
 
150
- const DEFAULT_ROUNDED$3 = 'medium';
151
- const DEFAULT_SIZE$2 = 'medium';
152
- const DEFAULT_THEME_COLOR$2 = 'base';
153
- const DEFAULT_FILL_MODE$3 = 'solid';
158
+ const DEFAULT_ROUNDED$4 = 'medium';
159
+ const DEFAULT_SIZE$3 = 'medium';
160
+ const DEFAULT_THEME_COLOR$3 = 'base';
161
+ const DEFAULT_FILL_MODE$4 = 'solid';
154
162
  /**
155
163
  * Represents the Kendo UI Button component for Angular.
156
164
  *
@@ -265,7 +273,7 @@ class ButtonComponent {
265
273
  * @default 'medium'
266
274
  */
267
275
  set size(size) {
268
- const newSize = size || DEFAULT_SIZE$2;
276
+ const newSize = size || DEFAULT_SIZE$3;
269
277
  this.handleClasses(newSize, 'size');
270
278
  this._size = newSize;
271
279
  }
@@ -279,7 +287,7 @@ class ButtonComponent {
279
287
  * @default 'medium'
280
288
  */
281
289
  set rounded(rounded) {
282
- const newRounded = rounded || DEFAULT_ROUNDED$3;
290
+ const newRounded = rounded || DEFAULT_ROUNDED$4;
283
291
  this.handleClasses(newRounded, 'rounded');
284
292
  this._rounded = newRounded;
285
293
  }
@@ -293,7 +301,7 @@ class ButtonComponent {
293
301
  * @default 'solid'
294
302
  */
295
303
  set fillMode(fillMode) {
296
- const newFillMode = fillMode || DEFAULT_FILL_MODE$3;
304
+ const newFillMode = fillMode || DEFAULT_FILL_MODE$4;
297
305
  this.handleClasses(newFillMode, 'fillMode');
298
306
  this._fillMode = newFillMode;
299
307
  }
@@ -308,7 +316,7 @@ class ButtonComponent {
308
316
  * @default 'base'
309
317
  */
310
318
  set themeColor(themeColor) {
311
- const newThemeColor = themeColor || DEFAULT_THEME_COLOR$2;
319
+ const newThemeColor = themeColor || DEFAULT_THEME_COLOR$3;
312
320
  this.handleThemeColor(newThemeColor);
313
321
  this._themeColor = newThemeColor;
314
322
  }
@@ -339,10 +347,10 @@ class ButtonComponent {
339
347
  element;
340
348
  isDisabled = false;
341
349
  caretAltDownIcon = caretAltDownIcon;
342
- _size = DEFAULT_SIZE$2;
343
- _rounded = DEFAULT_ROUNDED$3;
344
- _fillMode = DEFAULT_FILL_MODE$3;
345
- _themeColor = DEFAULT_THEME_COLOR$2;
350
+ _size = DEFAULT_SIZE$3;
351
+ _rounded = DEFAULT_ROUNDED$4;
352
+ _fillMode = DEFAULT_FILL_MODE$4;
353
+ _themeColor = DEFAULT_THEME_COLOR$3;
346
354
  _focused = false;
347
355
  direction;
348
356
  _selected;
@@ -351,7 +359,7 @@ class ButtonComponent {
351
359
  _icon;
352
360
  _svgIcon;
353
361
  set isFocused(isFocused) {
354
- this.toggleClass('k-focus', isFocused);
362
+ toggleClass('k-focus', isFocused, this.renderer, this.element);
355
363
  this._focused = isFocused;
356
364
  }
357
365
  get isFocused() {
@@ -492,7 +500,7 @@ class ButtonComponent {
492
500
  const changed = this.selected !== value;
493
501
  this.selected = value;
494
502
  this.setAttribute('aria-pressed', this.selected.toString());
495
- this.toggleClass('k-selected', this.selected);
503
+ toggleClass('k-selected', this.selected, this.renderer, this.element);
496
504
  if (changed && hasObservers(this.selectedChange)) {
497
505
  this.ngZone.run(() => {
498
506
  this.selectedChange.emit(value);
@@ -510,14 +518,6 @@ class ButtonComponent {
510
518
  this.removeAttribute('aria-pressed');
511
519
  }
512
520
  }
513
- toggleClass(className, add) {
514
- if (add) {
515
- this.renderer.addClass(this.element, className);
516
- }
517
- else {
518
- this.renderer.removeClass(this.element, className);
519
- }
520
- }
521
521
  _onButtonClick() {
522
522
  if (!this.disabled && this.service) {
523
523
  this.ngZone.run(() => {
@@ -1022,10 +1022,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1022
1022
  args: ['attr.tabindex']
1023
1023
  }] } });
1024
1024
 
1025
- const DEFAULT_SIZE$1 = 'medium';
1026
- const DEFAULT_ROUNDED$2 = 'medium';
1027
- const DEFAULT_THEME_COLOR$1 = 'base';
1028
- const DEFAULT_FILL_MODE$2 = 'solid';
1025
+ const DEFAULT_SIZE$2 = 'medium';
1026
+ const DEFAULT_ROUNDED$3 = 'medium';
1027
+ const DEFAULT_THEME_COLOR$2 = 'base';
1028
+ const DEFAULT_FILL_MODE$3 = 'solid';
1029
1029
  /**
1030
1030
  * Displays a Chip that represents an input, attribute, or action.
1031
1031
  *
@@ -1112,7 +1112,7 @@ class ChipComponent {
1112
1112
  * @default 'medium'
1113
1113
  */
1114
1114
  set size(size) {
1115
- const newSize = size || DEFAULT_SIZE$1;
1115
+ const newSize = size || DEFAULT_SIZE$2;
1116
1116
  !this.sizeIsSet && (this.sizeIsSet = true);
1117
1117
  this.handleClasses(newSize, 'size');
1118
1118
  this._size = newSize;
@@ -1127,7 +1127,7 @@ class ChipComponent {
1127
1127
  * @default 'medium'
1128
1128
  */
1129
1129
  set rounded(rounded) {
1130
- const newRounded = rounded || DEFAULT_ROUNDED$2;
1130
+ const newRounded = rounded || DEFAULT_ROUNDED$3;
1131
1131
  this.handleClasses(newRounded, 'rounded');
1132
1132
  this._rounded = newRounded;
1133
1133
  }
@@ -1141,7 +1141,7 @@ class ChipComponent {
1141
1141
  * @default 'solid'
1142
1142
  */
1143
1143
  set fillMode(fillMode) {
1144
- const newFillMode = fillMode || DEFAULT_FILL_MODE$2;
1144
+ const newFillMode = fillMode || DEFAULT_FILL_MODE$3;
1145
1145
  this.handleClasses(newFillMode, 'fillMode');
1146
1146
  this._fillMode = newFillMode;
1147
1147
  }
@@ -1156,7 +1156,7 @@ class ChipComponent {
1156
1156
  * @default 'base'
1157
1157
  */
1158
1158
  set themeColor(themeColor) {
1159
- const newThemeColor = themeColor || DEFAULT_THEME_COLOR$1;
1159
+ const newThemeColor = themeColor || DEFAULT_THEME_COLOR$2;
1160
1160
  this.handleThemeColor(newThemeColor);
1161
1161
  this._themeColor = newThemeColor;
1162
1162
  }
@@ -1501,7 +1501,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1501
1501
  }
1502
1502
  ],
1503
1503
  standalone: true,
1504
- imports: [NgIf, NgStyle, IconWrapperComponent, NgClass]
1504
+ imports: [NgIf, NgStyle, IconWrapperComponent]
1505
1505
  }]
1506
1506
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i1.LocalizationService }]; }, propDecorators: { label: [{
1507
1507
  type: Input
@@ -2767,7 +2767,7 @@ const NAVIGATION_SETTINGS_PROVIDER$2 = {
2767
2767
  provide: NAVIGATION_CONFIG,
2768
2768
  useValue: NAVIGATION_SETTINGS$2
2769
2769
  };
2770
- const DEFAULT_FILL_MODE$1 = 'solid';
2770
+ const DEFAULT_FILL_MODE$2 = 'solid';
2771
2771
  /**
2772
2772
  * Represents the Kendo UI DropDownButton component for Angular.
2773
2773
  *
@@ -2895,7 +2895,7 @@ class DropDownButtonComponent extends ListButton {
2895
2895
  return this._active;
2896
2896
  }
2897
2897
  itemTemplate;
2898
- _fillMode = DEFAULT_FILL_MODE$1;
2898
+ _fillMode = DEFAULT_FILL_MODE$2;
2899
2899
  _buttonAttributes = null;
2900
2900
  documentMouseUpSub;
2901
2901
  /**
@@ -3596,9 +3596,9 @@ const FILLMODE_CLASS = 'k-fab-solid';
3596
3596
  const DEFAULT_DURATION = 180;
3597
3597
  const DEFAULT_ITEM_GAP = 90;
3598
3598
  const DEFAULT_OFFSET = '16px';
3599
- const DEFAULT_ROUNDED$1 = 'full';
3600
- const DEFAULT_SIZE = 'medium';
3601
- const DEFAULT_THEME_COLOR = 'primary';
3599
+ const DEFAULT_ROUNDED$2 = 'full';
3600
+ const DEFAULT_SIZE$1 = 'medium';
3601
+ const DEFAULT_THEME_COLOR$1 = 'primary';
3602
3602
  /**
3603
3603
  * Represents the Kendo UI FloatingActionButton component for Angular.
3604
3604
  * Use it to represent the primary or most common action in an application.
@@ -3637,7 +3637,7 @@ class FloatingActionButtonComponent {
3637
3637
  * @default "primary"
3638
3638
  */
3639
3639
  set themeColor(themeColor) {
3640
- const newThemeColor = themeColor || DEFAULT_THEME_COLOR;
3640
+ const newThemeColor = themeColor || DEFAULT_THEME_COLOR$1;
3641
3641
  this.handleClasses(newThemeColor, 'themeColor');
3642
3642
  this._themeColor = newThemeColor;
3643
3643
  }
@@ -3649,7 +3649,7 @@ class FloatingActionButtonComponent {
3649
3649
  * @default "medium"
3650
3650
  */
3651
3651
  set size(size) {
3652
- const newSize = size || DEFAULT_SIZE;
3652
+ const newSize = size || DEFAULT_SIZE$1;
3653
3653
  this.handleClasses(newSize, 'size');
3654
3654
  this._size = newSize;
3655
3655
  }
@@ -3662,7 +3662,7 @@ class FloatingActionButtonComponent {
3662
3662
  * @default "full"
3663
3663
  */
3664
3664
  set rounded(rounded) {
3665
- const newRounded = rounded || DEFAULT_ROUNDED$1;
3665
+ const newRounded = rounded || DEFAULT_ROUNDED$2;
3666
3666
  this.handleClasses(newRounded, 'rounded');
3667
3667
  this._rounded = newRounded;
3668
3668
  }
@@ -3781,9 +3781,9 @@ class FloatingActionButtonComponent {
3781
3781
  * @hidden
3782
3782
  */
3783
3783
  dialListId = `k-dial-list-${guid()}`;
3784
- _themeColor = DEFAULT_THEME_COLOR;
3785
- _size = DEFAULT_SIZE;
3786
- _rounded = DEFAULT_ROUNDED$1;
3784
+ _themeColor = DEFAULT_THEME_COLOR$1;
3785
+ _size = DEFAULT_SIZE$1;
3786
+ _rounded = DEFAULT_ROUNDED$2;
3787
3787
  _disabled = false;
3788
3788
  _align = { horizontal: 'end', vertical: 'bottom' };
3789
3789
  _offset = { x: DEFAULT_OFFSET, y: DEFAULT_OFFSET };
@@ -4588,8 +4588,8 @@ const NAVIGATION_SETTINGS_PROVIDER = {
4588
4588
  provide: NAVIGATION_CONFIG,
4589
4589
  useValue: NAVIGATION_SETTINGS
4590
4590
  };
4591
- const DEFAULT_ROUNDED = 'medium';
4592
- const DEFAULT_FILL_MODE = 'solid';
4591
+ const DEFAULT_ROUNDED$1 = 'medium';
4592
+ const DEFAULT_FILL_MODE$1 = 'solid';
4593
4593
  /**
4594
4594
  * Represents the Kendo UI SplitButton component for Angular.
4595
4595
  *
@@ -4658,7 +4658,7 @@ class SplitButtonComponent extends ListButton {
4658
4658
  * @default 'medium'
4659
4659
  */
4660
4660
  set rounded(rounded) {
4661
- const newRounded = rounded || DEFAULT_ROUNDED;
4661
+ const newRounded = rounded || DEFAULT_ROUNDED$1;
4662
4662
  this.handleClasses(newRounded, 'rounded');
4663
4663
  this._rounded = newRounded;
4664
4664
  }
@@ -4671,7 +4671,7 @@ class SplitButtonComponent extends ListButton {
4671
4671
  * @default 'solid'
4672
4672
  */
4673
4673
  set fillMode(fillMode) {
4674
- const newFillMode = fillMode || DEFAULT_FILL_MODE;
4674
+ const newFillMode = fillMode || DEFAULT_FILL_MODE$1;
4675
4675
  this._fillMode = fillMode === 'clear' ? 'flat' : newFillMode;
4676
4676
  }
4677
4677
  get fillMode() {
@@ -4798,8 +4798,8 @@ class SplitButtonComponent extends ListButton {
4798
4798
  }
4799
4799
  buttonText = '';
4800
4800
  arrowButtonClicked = false;
4801
- _rounded = DEFAULT_ROUNDED;
4802
- _fillMode = DEFAULT_FILL_MODE;
4801
+ _rounded = DEFAULT_ROUNDED$1;
4802
+ _fillMode = DEFAULT_FILL_MODE$1;
4803
4803
  _buttonAttributes = null;
4804
4804
  documentMouseUpSub;
4805
4805
  set isFocused(value) {
@@ -5305,6 +5305,509 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
5305
5305
  args: ['keyup', ['$event']]
5306
5306
  }] } });
5307
5307
 
5308
+ const DEFAULT_ROUNDED = 'medium';
5309
+ const DEFAULT_SIZE = 'medium';
5310
+ const DEFAULT_THEME_COLOR = 'base';
5311
+ const DEFAULT_FILL_MODE = 'solid';
5312
+ /**
5313
+ * Represents the Kendo UI SpeechToTextButton component for Angular.
5314
+ *
5315
+ * @example
5316
+ * ```html
5317
+ * <button kendoSpeechToTextButton></button>
5318
+ * ```
5319
+ */
5320
+ class SpeechToTextButtonComponent {
5321
+ renderer;
5322
+ ngZone;
5323
+ /**
5324
+ * When `true`, disables the SpeechToTextButton and prevents user interaction.
5325
+ *
5326
+ * @default false
5327
+ */
5328
+ set disabled(disabled) {
5329
+ //Required, because in FF focused buttons are not blurred on disabled
5330
+ if (disabled && isDocumentAvailable() && isFirefox(navigator.userAgent)) {
5331
+ this.blur();
5332
+ }
5333
+ this.isDisabled = disabled;
5334
+ this.renderer.setProperty(this.element, 'disabled', disabled);
5335
+ }
5336
+ get disabled() {
5337
+ return this.isDisabled;
5338
+ }
5339
+ /**
5340
+ * Sets the padding of the SpeechToTextButton.
5341
+ *
5342
+ * @default 'medium'
5343
+ */
5344
+ set size(size) {
5345
+ const newSize = size || DEFAULT_SIZE;
5346
+ this.handleClasses(newSize, 'size');
5347
+ this._size = newSize;
5348
+ }
5349
+ get size() {
5350
+ return this._size;
5351
+ }
5352
+ /**
5353
+ * Sets the border radius of the SpeechToTextButton.
5354
+ *
5355
+ * @default 'medium'
5356
+ */
5357
+ set rounded(rounded) {
5358
+ const newRounded = rounded || DEFAULT_ROUNDED;
5359
+ this.handleClasses(newRounded, 'rounded');
5360
+ this._rounded = newRounded;
5361
+ }
5362
+ get rounded() {
5363
+ return this._rounded;
5364
+ }
5365
+ /**
5366
+ * Sets the background and border styles of the SpeechToTextButton.
5367
+ *
5368
+ * @default 'solid'
5369
+ */
5370
+ set fillMode(fillMode) {
5371
+ const newFillMode = fillMode || DEFAULT_FILL_MODE;
5372
+ this.handleClasses(newFillMode, 'fillMode');
5373
+ this._fillMode = newFillMode;
5374
+ }
5375
+ get fillMode() {
5376
+ return this._fillMode;
5377
+ }
5378
+ /**
5379
+ * Sets a predefined theme color for the SpeechToTextButton.
5380
+ * The theme color applies as a background and border color and adjusts the text color.
5381
+ *
5382
+ * @default 'base'
5383
+ */
5384
+ set themeColor(themeColor) {
5385
+ const newThemeColor = themeColor || DEFAULT_THEME_COLOR;
5386
+ this.handleThemeColor(newThemeColor);
5387
+ this._themeColor = newThemeColor;
5388
+ }
5389
+ get themeColor() {
5390
+ return this._themeColor;
5391
+ }
5392
+ /**
5393
+ * Specifies which speech recognition engine or integration the component should use. Allows the component to operate in different environments or use alternative implementations.
5394
+ */
5395
+ integrationMode = 'webSpeech';
5396
+ /**
5397
+ * Specifies a `BCP 47` language tag (e.g., 'en-US', 'bg-BG') used for speech recognition.
5398
+ *
5399
+ * @default 'en-US'
5400
+ */
5401
+ lang = 'en-US';
5402
+ /**
5403
+ * Specifies whether continuous results are returned for each recognition, or only a single result once recognition stops.
5404
+ *
5405
+ * @default false
5406
+ */
5407
+ continuous = false;
5408
+ /**
5409
+ * Specifies whether interim results should be returned or not. Interim results are results that are not yet final.
5410
+ *
5411
+ * @default false
5412
+ */
5413
+ interimResults = false;
5414
+ /**
5415
+ * Represents the maximum number of alternative transcriptions to return for each result.
5416
+ *
5417
+ * @default 1
5418
+ */
5419
+ maxAlternatives = 1;
5420
+ /**
5421
+ * Fires when the speech recognition service has begun listening to incoming audio.
5422
+ */
5423
+ start = new EventEmitter();
5424
+ /**
5425
+ * Fires when the speech recognition service has disconnected.
5426
+ */
5427
+ end = new EventEmitter();
5428
+ /**
5429
+ * Fires when the speech recognition service returns a result - a word or phrase has been positively recognized.
5430
+ */
5431
+ result = new EventEmitter();
5432
+ /**
5433
+ * Fires when a speech recognition error occurs. The event argument is a string, containing the error message.
5434
+ */
5435
+ error = new EventEmitter();
5436
+ /**
5437
+ * Fires when the user clicks the SpeechToTextButton.
5438
+ */
5439
+ click = new EventEmitter();
5440
+ get iconButtonClass() {
5441
+ return !this.hasText;
5442
+ }
5443
+ get listeningClass() {
5444
+ return this.isListening;
5445
+ }
5446
+ speechToTextButtonClass = true;
5447
+ classButton = true;
5448
+ get classDisabled() {
5449
+ return this.isDisabled;
5450
+ }
5451
+ get getDirection() {
5452
+ return this.direction;
5453
+ }
5454
+ get ariaPressed() {
5455
+ return this.isListening;
5456
+ }
5457
+ /**
5458
+ * @hidden
5459
+ */
5460
+ onFocus() {
5461
+ this.isFocused = true;
5462
+ }
5463
+ /**
5464
+ * @hidden
5465
+ */
5466
+ onBlur() {
5467
+ this.isFocused = false;
5468
+ }
5469
+ /**
5470
+ * Focuses the SpeechToTextButton component.
5471
+ */
5472
+ focus() {
5473
+ if (isDocumentAvailable()) {
5474
+ this.element.focus();
5475
+ this.isFocused = true;
5476
+ }
5477
+ }
5478
+ /**
5479
+ * Removes focus from the SpeechToTextButton component.
5480
+ */
5481
+ blur() {
5482
+ if (isDocumentAvailable()) {
5483
+ this.element.blur();
5484
+ this.isFocused = false;
5485
+ }
5486
+ }
5487
+ ngOnInit() {
5488
+ this.ngZone.runOutsideAngular(() => {
5489
+ this.subs.add(this.renderer.listen(this.element, 'click', this.onClick.bind(this)));
5490
+ this.subs.add(this.renderer.listen(this.element, 'mousedown', (event) => {
5491
+ const isBrowserSafari = isDocumentAvailable() && isSafari(navigator.userAgent);
5492
+ if (!this.isDisabled && isBrowserSafari) {
5493
+ event.preventDefault();
5494
+ this.element.focus();
5495
+ }
5496
+ }));
5497
+ if (this.integrationMode !== 'webSpeech') {
5498
+ return;
5499
+ }
5500
+ this.createWebSpeech();
5501
+ });
5502
+ }
5503
+ ngOnChanges(changes) {
5504
+ if (isChanged("integrationMode", changes, false)) {
5505
+ if (this.integrationMode === 'webSpeech') {
5506
+ if (!this.speechRecognition) {
5507
+ this.ngZone.runOutsideAngular(() => {
5508
+ this.createWebSpeech();
5509
+ });
5510
+ }
5511
+ }
5512
+ else {
5513
+ this.destroyWebSpeech();
5514
+ }
5515
+ }
5516
+ if (anyChanged(['lang', 'interimResults', 'maxAlternatives', 'continuous'], changes)) {
5517
+ if (this.speechRecognition) {
5518
+ this.speechRecognition.setOptions({
5519
+ lang: this.lang,
5520
+ interimResults: this.interimResults,
5521
+ maxAlternatives: this.maxAlternatives,
5522
+ continuous: this.continuous
5523
+ });
5524
+ }
5525
+ }
5526
+ }
5527
+ ngAfterViewInit() {
5528
+ const stylingOptions = ['size', 'rounded', 'fillMode'];
5529
+ stylingOptions.forEach(input => {
5530
+ this.handleClasses(this[input], input);
5531
+ });
5532
+ }
5533
+ ngOnDestroy() {
5534
+ this.destroyWebSpeech();
5535
+ this.subs.unsubscribe();
5536
+ }
5537
+ constructor(element, renderer, localization, ngZone) {
5538
+ this.renderer = renderer;
5539
+ this.ngZone = ngZone;
5540
+ validatePackage(packageMetadata);
5541
+ this.direction = localization.rtl ? 'rtl' : 'ltr';
5542
+ this.subs.add(localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr')));
5543
+ this.element = element.nativeElement;
5544
+ }
5545
+ /**
5546
+ * Indicates whether the button is actively listening for incoming audio.
5547
+ */
5548
+ isListening = false;
5549
+ /**
5550
+ * Indicates whether web speech functionality is supported.
5551
+ */
5552
+ get isWebSpeechSupported() {
5553
+ return this.speechRecognition ? this.speechRecognition.isSupported() : false;
5554
+ }
5555
+ set isFocused(isFocused) {
5556
+ toggleClass('k-focus', isFocused, this.renderer, this.element);
5557
+ this._focused = isFocused;
5558
+ }
5559
+ get isFocused() {
5560
+ return this._focused;
5561
+ }
5562
+ /**
5563
+ * @hidden
5564
+ */
5565
+ get hasText() {
5566
+ return isDocumentAvailable() && this.element.textContent.trim().length > 0;
5567
+ }
5568
+ /**
5569
+ * @hidden
5570
+ */
5571
+ onClick() {
5572
+ if (this.isWebSpeechSupported && this.integrationMode === 'webSpeech') {
5573
+ this.ngZone.run(() => {
5574
+ this.isListening ? this.speechRecognition.stop() : this.speechRecognition.start();
5575
+ });
5576
+ }
5577
+ else if (this.integrationMode === 'none') {
5578
+ let asyncFactory = () => of(null);
5579
+ this.ngZone.run(() => {
5580
+ this.isListening ? this.end.emit(fn => asyncFactory = fn) : this.start.emit(fn => asyncFactory = fn);
5581
+ const result = asyncFactory();
5582
+ const observable = this.toObservable(result);
5583
+ observable.pipe(take(1)).subscribe(() => this.isListening = !this.isListening);
5584
+ });
5585
+ }
5586
+ }
5587
+ /**
5588
+ * @hidden
5589
+ */
5590
+ get buttonSvgIcon() {
5591
+ return this.isListening ? this.stopSvgIcon : this.microphoneSvgIcon;
5592
+ }
5593
+ /**
5594
+ * @hidden
5595
+ */
5596
+ get buttonIcon() {
5597
+ return this.isListening ? 'stop-sm' : 'microphone-outline';
5598
+ }
5599
+ /**
5600
+ * @hidden
5601
+ */
5602
+ setAttribute(attribute, value) {
5603
+ this.renderer.setAttribute(this.element, attribute, value);
5604
+ }
5605
+ /**
5606
+ * @hidden
5607
+ */
5608
+ element;
5609
+ /**
5610
+ * @hidden
5611
+ */
5612
+ isDisabled = false;
5613
+ /**
5614
+ * @hidden
5615
+ */
5616
+ subs = new Subscription();
5617
+ microphoneSvgIcon = microphoneOutlineIcon;
5618
+ stopSvgIcon = stopSmIcon;
5619
+ speechRecognition;
5620
+ _size = DEFAULT_SIZE;
5621
+ _rounded = DEFAULT_ROUNDED;
5622
+ _fillMode = DEFAULT_FILL_MODE;
5623
+ _themeColor = DEFAULT_THEME_COLOR;
5624
+ _focused = false;
5625
+ direction;
5626
+ handleClasses(value, input) {
5627
+ const elem = this.element;
5628
+ const classes = getStylingClasses('button', input, this[input], value);
5629
+ if (input === 'fillMode') {
5630
+ this.handleThemeColor(this.themeColor, this[input], value);
5631
+ }
5632
+ if (classes.toRemove) {
5633
+ this.renderer.removeClass(elem, classes.toRemove);
5634
+ }
5635
+ if (classes.toAdd) {
5636
+ this.renderer.addClass(elem, classes.toAdd);
5637
+ }
5638
+ }
5639
+ handleStart() {
5640
+ this.ngZone.run(() => {
5641
+ this.isListening = true;
5642
+ this.start.emit();
5643
+ });
5644
+ }
5645
+ handleEnd() {
5646
+ this.ngZone.run(() => {
5647
+ this.isListening = false;
5648
+ this.end.emit();
5649
+ });
5650
+ }
5651
+ handleResult(event) {
5652
+ const results = event.results;
5653
+ const lastResultIndex = results.length - 1;
5654
+ const lastResult = results[lastResultIndex];
5655
+ const alternatives = [];
5656
+ for (let i = 0; i < lastResult.length; i++) {
5657
+ alternatives.push({
5658
+ transcript: lastResult[i].transcript,
5659
+ confidence: lastResult[i].confidence
5660
+ });
5661
+ }
5662
+ const args = {
5663
+ isFinal: lastResult.isFinal,
5664
+ alternatives: alternatives,
5665
+ };
5666
+ this.ngZone.run(() => {
5667
+ this.result.emit(args);
5668
+ });
5669
+ }
5670
+ handleError(ev) {
5671
+ const errorMessage = ev.error || ev.message || 'Unknown error';
5672
+ this.ngZone.run(() => {
5673
+ this.error.emit({ errorMessage });
5674
+ });
5675
+ }
5676
+ toObservable(input) {
5677
+ return input instanceof Observable ? input : from(input);
5678
+ }
5679
+ handleThemeColor(value, prevFillMode, fillMode) {
5680
+ const elem = this.element;
5681
+ const removeFillMode = prevFillMode || this.fillMode;
5682
+ const addFillMode = fillMode || this.fillMode;
5683
+ const themeColorClass = getThemeColorClasses('button', removeFillMode, addFillMode, this.themeColor, value);
5684
+ this.renderer.removeClass(elem, themeColorClass.toRemove);
5685
+ if (addFillMode !== 'none' && fillMode !== 'none') {
5686
+ if (themeColorClass.toAdd) {
5687
+ this.renderer.addClass(elem, themeColorClass.toAdd);
5688
+ }
5689
+ }
5690
+ }
5691
+ destroyWebSpeech() {
5692
+ if (this.speechRecognition) {
5693
+ this.speechRecognition.stop();
5694
+ this.speechRecognition.destroy();
5695
+ this.speechRecognition = null;
5696
+ this.isListening = false;
5697
+ }
5698
+ }
5699
+ createWebSpeech() {
5700
+ this.speechRecognition = new KendoSpeechRecognition({
5701
+ lang: this.lang,
5702
+ interimResults: this.interimResults,
5703
+ maxAlternatives: this.maxAlternatives,
5704
+ continuous: this.continuous,
5705
+ events: {
5706
+ start: this.handleStart.bind(this),
5707
+ end: this.handleEnd.bind(this),
5708
+ result: this.handleResult.bind(this),
5709
+ error: this.handleError.bind(this)
5710
+ }
5711
+ });
5712
+ }
5713
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SpeechToTextButtonComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
5714
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SpeechToTextButtonComponent, isStandalone: true, selector: "button[kendoSpeechToTextButton]", inputs: { disabled: "disabled", size: "size", rounded: "rounded", fillMode: "fillMode", themeColor: "themeColor", integrationMode: "integrationMode", lang: "lang", continuous: "continuous", interimResults: "interimResults", maxAlternatives: "maxAlternatives" }, outputs: { start: "start", end: "end", result: "result", error: "error", click: "click" }, host: { listeners: { "focus": "onFocus()", "blur": "onBlur()" }, properties: { "class.k-icon-button": "this.iconButtonClass", "class.k-listening": "this.listeningClass", "class.k-speech-to-text-button": "this.speechToTextButtonClass", "class.k-button": "this.classButton", "class.k-disabled": "this.classDisabled", "attr.dir": "this.getDirection", "attr.aria-pressed": "this.ariaPressed" } }, providers: [
5715
+ LocalizationService,
5716
+ {
5717
+ provide: L10N_PREFIX,
5718
+ useValue: 'kendo.speechtotextbutton'
5719
+ }
5720
+ ], exportAs: ["kendoSpeechToTextButton"], usesOnChanges: true, ngImport: i0, template: `
5721
+ <kendo-icon-wrapper
5722
+ innerCssClass="k-button-icon"
5723
+ [name]="buttonIcon"
5724
+ [svgIcon]="buttonSvgIcon">
5725
+ </kendo-icon-wrapper>
5726
+ <span class="k-button-text"><ng-content></ng-content></span>
5727
+ `, isInline: true, dependencies: [{ kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }] });
5728
+ }
5729
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SpeechToTextButtonComponent, decorators: [{
5730
+ type: Component,
5731
+ args: [{
5732
+ exportAs: 'kendoSpeechToTextButton',
5733
+ providers: [
5734
+ LocalizationService,
5735
+ {
5736
+ provide: L10N_PREFIX,
5737
+ useValue: 'kendo.speechtotextbutton'
5738
+ }
5739
+ ],
5740
+ selector: 'button[kendoSpeechToTextButton]',
5741
+ template: `
5742
+ <kendo-icon-wrapper
5743
+ innerCssClass="k-button-icon"
5744
+ [name]="buttonIcon"
5745
+ [svgIcon]="buttonSvgIcon">
5746
+ </kendo-icon-wrapper>
5747
+ <span class="k-button-text"><ng-content></ng-content></span>
5748
+ `,
5749
+ standalone: true,
5750
+ imports: [IconWrapperComponent]
5751
+ }]
5752
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { disabled: [{
5753
+ type: Input
5754
+ }], size: [{
5755
+ type: Input
5756
+ }], rounded: [{
5757
+ type: Input
5758
+ }], fillMode: [{
5759
+ type: Input
5760
+ }], themeColor: [{
5761
+ type: Input
5762
+ }], integrationMode: [{
5763
+ type: Input
5764
+ }], lang: [{
5765
+ type: Input
5766
+ }], continuous: [{
5767
+ type: Input
5768
+ }], interimResults: [{
5769
+ type: Input
5770
+ }], maxAlternatives: [{
5771
+ type: Input
5772
+ }], start: [{
5773
+ type: Output
5774
+ }], end: [{
5775
+ type: Output
5776
+ }], result: [{
5777
+ type: Output
5778
+ }], error: [{
5779
+ type: Output
5780
+ }], click: [{
5781
+ type: Output
5782
+ }], iconButtonClass: [{
5783
+ type: HostBinding,
5784
+ args: ['class.k-icon-button']
5785
+ }], listeningClass: [{
5786
+ type: HostBinding,
5787
+ args: ['class.k-listening']
5788
+ }], speechToTextButtonClass: [{
5789
+ type: HostBinding,
5790
+ args: ['class.k-speech-to-text-button']
5791
+ }], classButton: [{
5792
+ type: HostBinding,
5793
+ args: ['class.k-button']
5794
+ }], classDisabled: [{
5795
+ type: HostBinding,
5796
+ args: ['class.k-disabled']
5797
+ }], getDirection: [{
5798
+ type: HostBinding,
5799
+ args: ['attr.dir']
5800
+ }], ariaPressed: [{
5801
+ type: HostBinding,
5802
+ args: ['attr.aria-pressed']
5803
+ }], onFocus: [{
5804
+ type: HostListener,
5805
+ args: ['focus']
5806
+ }], onBlur: [{
5807
+ type: HostListener,
5808
+ args: ['blur']
5809
+ }] } });
5810
+
5308
5811
  /**
5309
5812
  * Use the `KENDO_BUTTON` utility array to add all Button-related components and directives to a standalone Angular component.
5310
5813
  *
@@ -5425,6 +5928,22 @@ const KENDO_SPLITBUTTON = [
5425
5928
  ToggleButtonTabStopDirective,
5426
5929
  ButtonItemTemplateDirective
5427
5930
  ];
5931
+ /**
5932
+ * Use the `KENDO_SPEECHTOTEXTBUTTON` utility array to add all SpeechToTextButton-related components and directives to a standalone Angular component.
5933
+ *
5934
+ * @example
5935
+ * ```typescript
5936
+ * @Component({
5937
+ * standalone: true,
5938
+ * imports: [KENDO_SPEECHTOTEXTBUTTON],
5939
+ * // ...
5940
+ * })
5941
+ * export class MyComponent {}
5942
+ * ```
5943
+ */
5944
+ const KENDO_SPEECHTOTEXTBUTTON = [
5945
+ SpeechToTextButtonComponent
5946
+ ];
5428
5947
  /**
5429
5948
  * Use the `KENDO_BUTTONS` utility array to add all `@progress/kendo-angular-buttons`-related components and directives to a standalone Angular component.
5430
5949
  *
@@ -5445,7 +5964,8 @@ const KENDO_BUTTONS = [
5445
5964
  ...KENDO_CHIP,
5446
5965
  ...KENDO_CHIPLIST,
5447
5966
  ...KENDO_FLOATINGACTIONBUTTON,
5448
- ...KENDO_SPLITBUTTON
5967
+ ...KENDO_SPLITBUTTON,
5968
+ ...KENDO_SPEECHTOTEXTBUTTON
5449
5969
  ];
5450
5970
 
5451
5971
  //IMPORTANT: NgModule export kept for backwards compatibility
@@ -5548,8 +6068,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
5548
6068
  */
5549
6069
  class ButtonsModule {
5550
6070
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
5551
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ButtonsModule, imports: [ButtonComponent, ButtonComponent, ButtonGroupComponent, DropDownButtonComponent, ButtonItemTemplateDirective, ChipComponent, ChipComponent, ChipListComponent, FloatingActionButtonComponent, DialItemTemplateDirective, FloatingActionButtonTemplateDirective, SplitButtonComponent, SplitButtonCustomMessagesComponent, i12.ToggleButtonTabStopDirective, ButtonItemTemplateDirective, i12.ToggleButtonTabStopDirective], exports: [ButtonComponent, ButtonComponent, ButtonGroupComponent, DropDownButtonComponent, ButtonItemTemplateDirective, ChipComponent, ChipComponent, ChipListComponent, FloatingActionButtonComponent, DialItemTemplateDirective, FloatingActionButtonTemplateDirective, SplitButtonComponent, SplitButtonCustomMessagesComponent, i12.ToggleButtonTabStopDirective, ButtonItemTemplateDirective, i12.ToggleButtonTabStopDirective] });
5552
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonsModule, providers: [IconsService, PopupService, ResizeBatchService], imports: [ButtonComponent, ButtonComponent, DropDownButtonComponent, ChipComponent, ChipComponent, FloatingActionButtonComponent, SplitButtonComponent] });
6071
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ButtonsModule, imports: [ButtonComponent, ButtonComponent, ButtonGroupComponent, DropDownButtonComponent, ButtonItemTemplateDirective, ChipComponent, ChipComponent, ChipListComponent, FloatingActionButtonComponent, DialItemTemplateDirective, FloatingActionButtonTemplateDirective, SplitButtonComponent, SplitButtonCustomMessagesComponent, i12.ToggleButtonTabStopDirective, ButtonItemTemplateDirective, SpeechToTextButtonComponent, i12.ToggleButtonTabStopDirective], exports: [ButtonComponent, ButtonComponent, ButtonGroupComponent, DropDownButtonComponent, ButtonItemTemplateDirective, ChipComponent, ChipComponent, ChipListComponent, FloatingActionButtonComponent, DialItemTemplateDirective, FloatingActionButtonTemplateDirective, SplitButtonComponent, SplitButtonCustomMessagesComponent, i12.ToggleButtonTabStopDirective, ButtonItemTemplateDirective, SpeechToTextButtonComponent, i12.ToggleButtonTabStopDirective] });
6072
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonsModule, providers: [IconsService, PopupService, ResizeBatchService], imports: [ButtonComponent, ButtonComponent, DropDownButtonComponent, ChipComponent, ChipComponent, FloatingActionButtonComponent, SplitButtonComponent, SpeechToTextButtonComponent] });
5553
6073
  }
5554
6074
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonsModule, decorators: [{
5555
6075
  type: NgModule,
@@ -5694,9 +6214,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
5694
6214
  }]
5695
6215
  }] });
5696
6216
 
6217
+ // IMPORTANT: NgModule export kept for backwards compatibility.
6218
+ /**
6219
+ * Represents the exported package module.
6220
+ *
6221
+ * Required for adding SpeechToTextButton features in NgModule-based Angular applications.
6222
+ *
6223
+ * The package exports:
6224
+ * - `SpeechToTextButtonComponent`&mdash;The SpeechToTextButton component class.
6225
+ */
6226
+ class SpeechToTextButtonModule {
6227
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SpeechToTextButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
6228
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: SpeechToTextButtonModule, imports: [SpeechToTextButtonComponent], exports: [SpeechToTextButtonComponent] });
6229
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SpeechToTextButtonModule, providers: [IconsService], imports: [KENDO_SPEECHTOTEXTBUTTON] });
6230
+ }
6231
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SpeechToTextButtonModule, decorators: [{
6232
+ type: NgModule,
6233
+ args: [{
6234
+ exports: [...KENDO_SPEECHTOTEXTBUTTON],
6235
+ imports: [...KENDO_SPEECHTOTEXTBUTTON],
6236
+ providers: [IconsService]
6237
+ }]
6238
+ }] });
6239
+
5697
6240
  /**
5698
6241
  * Generated bundle index. Do not edit.
5699
6242
  */
5700
6243
 
5701
- export { ButtonComponent as Button, ButtonComponent, ButtonComponent as ButtonDirective, ButtonGroupComponent as ButtonGroup, ButtonGroupComponent, ButtonGroupModule, ButtonItemTemplateDirective, ButtonModule, ButtonsModule, ChipComponent, ChipListComponent, ChipModule, DialItemTemplateDirective, DropDownButtonComponent as DropDownButton, DropDownButtonComponent, DropDownButtonModule, FloatingActionButtonComponent, FloatingActionButtonModule, FloatingActionButtonTemplateDirective, FocusableDirective, KENDO_BUTTON, KENDO_BUTTONGROUP, KENDO_BUTTONS, KENDO_CHIP, KENDO_CHIPLIST, KENDO_DROPDOWNBUTTON, KENDO_FLOATINGACTIONBUTTON, KENDO_SPLITBUTTON, ListComponent, LocalizedSplitButtonMessagesDirective, PreventableEvent, SplitButtonComponent as SplitButton, SplitButtonComponent, SplitButtonCustomMessagesComponent, SplitButtonModule };
6244
+ export { ButtonComponent as Button, ButtonComponent, ButtonComponent as ButtonDirective, ButtonGroupComponent as ButtonGroup, ButtonGroupComponent, ButtonGroupModule, ButtonItemTemplateDirective, ButtonModule, ButtonsModule, ChipComponent, ChipListComponent, ChipModule, DialItemTemplateDirective, DropDownButtonComponent as DropDownButton, DropDownButtonComponent, DropDownButtonModule, FloatingActionButtonComponent, FloatingActionButtonModule, FloatingActionButtonTemplateDirective, FocusableDirective, KENDO_BUTTON, KENDO_BUTTONGROUP, KENDO_BUTTONS, KENDO_CHIP, KENDO_CHIPLIST, KENDO_DROPDOWNBUTTON, KENDO_FLOATINGACTIONBUTTON, KENDO_SPEECHTOTEXTBUTTON, KENDO_SPLITBUTTON, ListComponent, LocalizedSplitButtonMessagesDirective, PreventableEvent, SpeechToTextButtonComponent, SpeechToTextButtonModule, SplitButtonComponent as SplitButton, SplitButtonComponent, SplitButtonCustomMessagesComponent, SplitButtonModule };
5702
6245