@progress/kendo-angular-buttons 19.2.1-develop.3 → 19.3.0-develop.1

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