@progress/kendo-angular-buttons 6.4.1 → 7.0.0-dev.202201180832

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 (85) hide show
  1. package/LICENSE.md +1 -1
  2. package/NOTICE.txt +119 -79
  3. package/README.md +1 -1
  4. package/dist/cdn/js/kendo-angular-buttons.js +2 -2
  5. package/dist/cdn/main.js +1 -1
  6. package/dist/es/button/button.directive.js +236 -89
  7. package/dist/es/button/button.service.js +1 -5
  8. package/dist/es/buttongroup/buttongroup.component.js +11 -60
  9. package/dist/es/chip/chip-list.component.js +57 -7
  10. package/dist/es/chip/chip.component.js +175 -86
  11. package/dist/es/{chip/models/chip-look.js → common/models/fillmode.js} +0 -0
  12. package/dist/es/{chip/models/type.js → common/models/rounded.js} +0 -0
  13. package/dist/{es2015/button-look.js → es/common/models/styling-classes.js} +0 -0
  14. package/dist/es/{button-look.js → common/models.js} +0 -0
  15. package/dist/es/dropdownbutton/dropdownbutton.component.js +89 -36
  16. package/dist/es/floatingactionbutton/dial-item.component.js +1 -1
  17. package/dist/es/floatingactionbutton/floatingactionbutton.component.js +66 -41
  18. package/dist/es/focusable/focusable.directive.js +4 -4
  19. package/dist/es/listbutton/list-button.js +4 -1
  20. package/dist/es/listbutton/list.component.js +20 -1
  21. package/dist/es/package-metadata.js +1 -1
  22. package/dist/es/splitbutton/splitbutton.component.js +107 -37
  23. package/dist/es/util.js +52 -0
  24. package/dist/es2015/button/button.directive.d.ts +85 -22
  25. package/dist/es2015/button/button.directive.js +219 -85
  26. package/dist/es2015/button/button.service.d.ts +1 -4
  27. package/dist/es2015/button/button.service.js +1 -5
  28. package/dist/es2015/buttongroup/buttongroup.component.d.ts +0 -15
  29. package/dist/es2015/buttongroup/buttongroup.component.js +11 -48
  30. package/dist/es2015/chip/chip-list.component.d.ts +19 -3
  31. package/dist/es2015/chip/chip-list.component.js +52 -7
  32. package/dist/es2015/chip/chip.component.d.ts +67 -32
  33. package/dist/es2015/chip/chip.component.js +186 -97
  34. package/dist/es2015/common/models/fillmode.d.ts +12 -0
  35. package/dist/es2015/{chip/models/type.js → common/models/fillmode.js} +0 -0
  36. package/dist/es2015/common/models/rounded.d.ts +12 -0
  37. package/dist/es2015/common/models/rounded.js +4 -0
  38. package/dist/es2015/common/models/shape.d.ts +2 -9
  39. package/dist/es2015/common/models/size.d.ts +9 -6
  40. package/dist/es2015/common/models/styling-classes.d.ts +11 -0
  41. package/dist/es2015/common/models/styling-classes.js +4 -0
  42. package/dist/es2015/common/models/theme-color.d.ts +15 -4
  43. package/dist/es2015/common/models.d.ts +10 -0
  44. package/dist/es2015/{chip/models/chip-look.js → common/models.js} +0 -0
  45. package/dist/es2015/dropdownbutton/dropdownbutton.component.d.ts +59 -7
  46. package/dist/es2015/dropdownbutton/dropdownbutton.component.js +92 -31
  47. package/dist/es2015/floatingactionbutton/dial-item.component.js +1 -1
  48. package/dist/es2015/floatingactionbutton/floatingactionbutton.component.d.ts +28 -21
  49. package/dist/es2015/floatingactionbutton/floatingactionbutton.component.js +62 -42
  50. package/dist/es2015/focusable/focusable.directive.js +4 -4
  51. package/dist/es2015/index.metadata.json +1 -1
  52. package/dist/es2015/listbutton/list-button.js +4 -1
  53. package/dist/es2015/listbutton/list.component.d.ts +3 -0
  54. package/dist/es2015/listbutton/list.component.js +37 -20
  55. package/dist/es2015/main.d.ts +4 -4
  56. package/dist/es2015/package-metadata.js +1 -1
  57. package/dist/es2015/splitbutton/splitbutton.component.d.ts +59 -12
  58. package/dist/es2015/splitbutton/splitbutton.component.js +113 -33
  59. package/dist/es2015/util.d.ts +21 -0
  60. package/dist/es2015/util.js +52 -0
  61. package/dist/fesm2015/index.js +862 -409
  62. package/dist/fesm5/index.js +853 -405
  63. package/dist/npm/button/button.directive.js +236 -89
  64. package/dist/npm/button/button.service.js +0 -4
  65. package/dist/npm/buttongroup/buttongroup.component.js +11 -60
  66. package/dist/npm/chip/chip-list.component.js +55 -5
  67. package/dist/npm/chip/chip.component.js +173 -84
  68. package/dist/npm/{chip/models/chip-look.js → common/models/fillmode.js} +0 -0
  69. package/dist/npm/{chip/models/type.js → common/models/rounded.js} +0 -0
  70. package/dist/npm/common/models/styling-classes.js +6 -0
  71. package/dist/npm/{button-look.js → common/models.js} +0 -0
  72. package/dist/npm/dropdownbutton/dropdownbutton.component.js +89 -36
  73. package/dist/npm/floatingactionbutton/dial-item.component.js +1 -1
  74. package/dist/npm/floatingactionbutton/floatingactionbutton.component.js +66 -41
  75. package/dist/npm/focusable/focusable.directive.js +4 -4
  76. package/dist/npm/listbutton/list-button.js +4 -1
  77. package/dist/npm/listbutton/list.component.js +20 -1
  78. package/dist/npm/package-metadata.js +1 -1
  79. package/dist/npm/splitbutton/splitbutton.component.js +105 -35
  80. package/dist/npm/util.js +52 -0
  81. package/dist/systemjs/kendo-angular-buttons.js +1 -1
  82. package/package.json +14 -11
  83. package/dist/es2015/button-look.d.ts +0 -21
  84. package/dist/es2015/chip/models/chip-look.d.ts +0 -20
  85. package/dist/es2015/chip/models/type.d.ts +0 -21
@@ -2,14 +2,14 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { SimpleChanges, ElementRef, EventEmitter, Renderer2 as Renderer, OnDestroy, NgZone } from '@angular/core';
5
+ import { SimpleChanges, ElementRef, EventEmitter, Renderer2 as Renderer, OnDestroy, NgZone, AfterViewInit } from '@angular/core';
6
6
  import { KendoButtonService } from './button.service';
7
- import { ButtonLook } from '../button-look';
8
7
  import { LocalizationService } from '@progress/kendo-angular-l10n';
8
+ import { ButtonFillMode, ButtonRounded, ButtonShape, ButtonSize, ButtonThemeColor } from '../common/models';
9
9
  /**
10
10
  * Represents the Kendo UI Button component for Angular.
11
11
  */
12
- export declare class ButtonDirective implements OnDestroy {
12
+ export declare class ButtonDirective implements OnDestroy, AfterViewInit {
13
13
  private service;
14
14
  private ngZone;
15
15
  /**
@@ -26,19 +26,6 @@ export declare class ButtonDirective implements OnDestroy {
26
26
  * @hidden
27
27
  */
28
28
  togglable: boolean;
29
- /**
30
- * Adds visual weight to the Button and makes it primary.
31
- */
32
- primary: boolean;
33
- /**
34
- * Changes the visual appearance by using alternative styling options
35
- * ([more information and examples]({% slug appearance_button %})).
36
- *
37
- * The available values are:
38
- * * [`ButtonLook`]({% slug api_buttons_buttonlook %}) = `flat` | `outline`
39
- * * `clear`
40
- */
41
- look: ButtonLook | 'clear';
42
29
  /**
43
30
  * Sets the selected state of the Button.
44
31
  */
@@ -66,6 +53,69 @@ export declare class ButtonDirective implements OnDestroy {
66
53
  * If set to `true`, it disables the Button.
67
54
  */
68
55
  disabled: boolean;
56
+ /**
57
+ * The size property specifies the width and height of the Button
58
+ * ([see example]({% slug appearance_buttondirective %}#toc-size)).
59
+ *
60
+ * The possible values are:
61
+ * * `'small'`
62
+ * * `'medium'` (default)
63
+ * * `'large'`
64
+ * * `null`
65
+ */
66
+ size: ButtonSize;
67
+ /**
68
+ * The rounded property specifies the border radius of the Button
69
+ * ([see example]({% slug appearance_buttondirective %}#toc-rounded)).
70
+ *
71
+ * The possible values are:
72
+ * * `'small'`
73
+ * * `'medium'` (default)
74
+ * * `'large'`
75
+ * * `'full'`
76
+ * * `null`
77
+ */
78
+ rounded: ButtonRounded;
79
+ /**
80
+ * The fillMode property specifies the background and border styles of the Button
81
+ * ([see example]({% slug appearance_buttondirective %}#toc-fillMode)).
82
+ *
83
+ * The possible values are:
84
+ * * `'flat'`
85
+ * * `'solid'` (default)
86
+ * * `'outline'`
87
+ * * `'link'`
88
+ * * `null`
89
+ */
90
+ fillMode: ButtonFillMode;
91
+ /**
92
+ * The Button allows you to specify predefined theme colors.
93
+ * The theme color will be applied as a background and border color while also amending the text color accordingly
94
+ * ([see example]({% slug appearance_buttondirective %}#toc-themeColor)).
95
+ *
96
+ * The possible values are:
97
+ * * `'base'` (default)
98
+ * * `'primary'`
99
+ * * `'secondary'`
100
+ * * `'tertiary'`
101
+ * * `'info'`
102
+ * * `'success'`
103
+ * * `'warning'`
104
+ * * `'error'`
105
+ * * `'dark'`
106
+ * * `'light`'
107
+ * * `'inverse'`
108
+ */
109
+ themeColor: ButtonThemeColor;
110
+ /**
111
+ * The shape property specifies if the Button will form a rectangle or square.
112
+ * ([see example]({% slug appearance_buttondirective %}#toc-shape)).
113
+ *
114
+ * The possible values are:
115
+ * * `'square'`
116
+ * * `'rectangle'` (default)
117
+ */
118
+ shape: ButtonShape;
69
119
  /**
70
120
  * @hidden
71
121
  */
@@ -87,8 +137,13 @@ export declare class ButtonDirective implements OnDestroy {
87
137
  isIconClass: boolean;
88
138
  imageNode: HTMLImageElement;
89
139
  iconNode: HTMLElement;
140
+ iconSpanNode: HTMLElement;
141
+ private _size;
142
+ private _rounded;
143
+ private _shape;
144
+ private _fillMode;
145
+ private _themeColor;
90
146
  private localizationChangeSubscription;
91
- private buttonLookChangeSubscription;
92
147
  private _focused;
93
148
  private direction;
94
149
  private _selected;
@@ -96,12 +151,7 @@ export declare class ButtonDirective implements OnDestroy {
96
151
  private domEvents;
97
152
  isFocused: boolean;
98
153
  readonly classButton: boolean;
99
- readonly classPrimary: boolean;
100
154
  readonly isToggleable: boolean;
101
- readonly isFlat: boolean;
102
- readonly isBare: boolean;
103
- readonly isOutline: boolean;
104
- readonly isClear: boolean;
105
155
  readonly roleSetter: string;
106
156
  readonly classDisabled: boolean;
107
157
  readonly classActive: boolean;
@@ -114,9 +164,18 @@ export declare class ButtonDirective implements OnDestroy {
114
164
  * @hidden
115
165
  */
116
166
  onBlur(): void;
167
+ /**
168
+ * @hidden
169
+ */
170
+ primary: boolean;
171
+ /**
172
+ * @hidden
173
+ */
174
+ look: 'flat' | 'outline' | 'clear' | 'default';
117
175
  constructor(element: ElementRef, renderer: Renderer, service: KendoButtonService, localization: LocalizationService, ngZone: NgZone);
118
176
  ngOnInit(): void;
119
177
  ngOnChanges(change: SimpleChanges): void;
178
+ ngAfterViewInit(): void;
120
179
  ngAfterViewChecked(): void;
121
180
  ngOnDestroy(): void;
122
181
  /**
@@ -143,8 +202,10 @@ export declare class ButtonDirective implements OnDestroy {
143
202
  setSelected(value: boolean): void;
144
203
  private toggleAriaPressed;
145
204
  private hasText;
205
+ private readonly text;
146
206
  private addImgIcon;
147
207
  private addIcon;
208
+ private addTextSpan;
148
209
  private prependChild;
149
210
  private defer;
150
211
  private iconSetter;
@@ -154,4 +215,6 @@ export declare class ButtonDirective implements OnDestroy {
154
215
  private setIconTextClasses;
155
216
  private toggleClass;
156
217
  private _onButtonClick;
218
+ private handleClasses;
219
+ private handleThemeColor;
157
220
  }
@@ -7,9 +7,9 @@ import { Directive, ElementRef, EventEmitter, HostBinding, HostListener, Input,
7
7
  import { KendoButtonService } from './button.service';
8
8
  import { isDocumentAvailable, isChanged, hasObservers, Keys } from '@progress/kendo-angular-common';
9
9
  import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
10
- import { filter } from 'rxjs/operators';
11
10
  import { validatePackage } from '@progress/kendo-licensing';
12
11
  import { packageMetadata } from '../package-metadata';
12
+ import { getStylingClasses, getThemeColorClasses } from '../util';
13
13
  const SPAN_TAG_NAME = 'SPAN';
14
14
  /**
15
15
  * Represents the Kendo UI Button component for Angular.
@@ -23,19 +23,6 @@ let ButtonDirective = class ButtonDirective {
23
23
  * By default, `toggleable` is set to `false`.
24
24
  */
25
25
  this.toggleable = false;
26
- /**
27
- * Adds visual weight to the Button and makes it primary.
28
- */
29
- this.primary = false;
30
- /**
31
- * Changes the visual appearance by using alternative styling options
32
- * ([more information and examples]({% slug appearance_button %})).
33
- *
34
- * The available values are:
35
- * * [`ButtonLook`]({% slug api_buttons_buttonlook %}) = `flat` | `outline`
36
- * * `clear`
37
- */
38
- this.look = 'default';
39
26
  /**
40
27
  * @hidden
41
28
  */
@@ -53,12 +40,16 @@ let ButtonDirective = class ButtonDirective {
53
40
  this.isDisabled = false;
54
41
  this.isIcon = false;
55
42
  this.isIconClass = false;
43
+ this._size = 'medium';
44
+ this._rounded = 'medium';
45
+ this._shape = 'rectangle';
46
+ this._fillMode = 'solid';
47
+ this._themeColor = 'base';
56
48
  this._focused = false;
57
49
  this.domEvents = [];
58
50
  validatePackage(packageMetadata);
59
51
  this.direction = localization.rtl ? 'rtl' : 'ltr';
60
- this.localizationChangeSubscription = localization.changes
61
- .subscribe(({ rtl }) => this.direction = rtl ? 'rtl' : 'ltr');
52
+ this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => (this.direction = rtl ? 'rtl' : 'ltr'));
62
53
  this.element = element.nativeElement;
63
54
  this.renderer = renderer;
64
55
  }
@@ -102,7 +93,7 @@ let ButtonDirective = class ButtonDirective {
102
93
  if (icon) {
103
94
  this.iconSetter(icon, () => {
104
95
  this.isIcon = true;
105
- const classes = 'k-icon k-i-' + icon;
96
+ const classes = 'k-button-icon k-icon k-i-' + icon;
106
97
  this.addIcon(classes);
107
98
  });
108
99
  }
@@ -119,7 +110,8 @@ let ButtonDirective = class ButtonDirective {
119
110
  if (iconClassName) {
120
111
  this.iconSetter(iconClassName, () => {
121
112
  this.isIconClass = true;
122
- this.addIcon(iconClassName);
113
+ const classes = 'k-button-icon k-icon ' + iconClassName;
114
+ this.addIcon(classes);
123
115
  });
124
116
  }
125
117
  else {
@@ -149,8 +141,101 @@ let ButtonDirective = class ButtonDirective {
149
141
  get disabled() {
150
142
  return this.isDisabled;
151
143
  }
144
+ /**
145
+ * The size property specifies the width and height of the Button
146
+ * ([see example]({% slug appearance_buttondirective %}#toc-size)).
147
+ *
148
+ * The possible values are:
149
+ * * `'small'`
150
+ * * `'medium'` (default)
151
+ * * `'large'`
152
+ * * `null`
153
+ */
154
+ set size(size) {
155
+ this.handleClasses(size, 'size');
156
+ this._size = size;
157
+ }
158
+ get size() {
159
+ return this._size;
160
+ }
161
+ /**
162
+ * The rounded property specifies the border radius of the Button
163
+ * ([see example]({% slug appearance_buttondirective %}#toc-rounded)).
164
+ *
165
+ * The possible values are:
166
+ * * `'small'`
167
+ * * `'medium'` (default)
168
+ * * `'large'`
169
+ * * `'full'`
170
+ * * `null`
171
+ */
172
+ set rounded(rounded) {
173
+ this.handleClasses(rounded, 'rounded');
174
+ this._rounded = rounded;
175
+ }
176
+ get rounded() {
177
+ return this._rounded;
178
+ }
179
+ /**
180
+ * The fillMode property specifies the background and border styles of the Button
181
+ * ([see example]({% slug appearance_buttondirective %}#toc-fillMode)).
182
+ *
183
+ * The possible values are:
184
+ * * `'flat'`
185
+ * * `'solid'` (default)
186
+ * * `'outline'`
187
+ * * `'link'`
188
+ * * `null`
189
+ */
190
+ set fillMode(fillMode) {
191
+ this.handleClasses(fillMode, 'fillMode');
192
+ this._fillMode = fillMode;
193
+ }
194
+ get fillMode() {
195
+ return this._fillMode;
196
+ }
197
+ /**
198
+ * The Button allows you to specify predefined theme colors.
199
+ * The theme color will be applied as a background and border color while also amending the text color accordingly
200
+ * ([see example]({% slug appearance_buttondirective %}#toc-themeColor)).
201
+ *
202
+ * The possible values are:
203
+ * * `'base'` (default)
204
+ * * `'primary'`
205
+ * * `'secondary'`
206
+ * * `'tertiary'`
207
+ * * `'info'`
208
+ * * `'success'`
209
+ * * `'warning'`
210
+ * * `'error'`
211
+ * * `'dark'`
212
+ * * `'light`'
213
+ * * `'inverse'`
214
+ */
215
+ set themeColor(themeColor) {
216
+ this.handleThemeColor(themeColor);
217
+ this._themeColor = themeColor;
218
+ }
219
+ get themeColor() {
220
+ return this._themeColor;
221
+ }
222
+ /**
223
+ * The shape property specifies if the Button will form a rectangle or square.
224
+ * ([see example]({% slug appearance_buttondirective %}#toc-shape)).
225
+ *
226
+ * The possible values are:
227
+ * * `'square'`
228
+ * * `'rectangle'` (default)
229
+ */
230
+ set shape(shape) {
231
+ this.handleClasses(shape, 'shape');
232
+ this._shape = shape;
233
+ }
234
+ get shape() {
235
+ return this._shape;
236
+ }
152
237
  set isFocused(isFocused) {
153
- this.toggleClass('k-state-focused', isFocused);
238
+ this.toggleClass('k-focus', isFocused);
154
239
  this._focused = isFocused;
155
240
  }
156
241
  get isFocused() {
@@ -159,24 +244,9 @@ let ButtonDirective = class ButtonDirective {
159
244
  get classButton() {
160
245
  return true;
161
246
  }
162
- get classPrimary() {
163
- return this.primary;
164
- }
165
247
  get isToggleable() {
166
248
  return this.toggleable;
167
249
  }
168
- get isFlat() {
169
- return this.look === 'flat';
170
- }
171
- get isBare() {
172
- return this.look === 'bare';
173
- }
174
- get isOutline() {
175
- return this.look === 'outline';
176
- }
177
- get isClear() {
178
- return this.look === 'clear';
179
- }
180
250
  get roleSetter() {
181
251
  return this.role;
182
252
  }
@@ -201,13 +271,28 @@ let ButtonDirective = class ButtonDirective {
201
271
  onBlur() {
202
272
  this.isFocused = false;
203
273
  }
274
+ /**
275
+ * @hidden
276
+ */
277
+ set primary(value) {
278
+ this.themeColor = value ? 'primary' : 'base';
279
+ }
280
+ /**
281
+ * @hidden
282
+ */
283
+ set look(value) {
284
+ switch (value) {
285
+ case 'default':
286
+ this.fillMode = 'solid';
287
+ break;
288
+ default:
289
+ this.fillMode = value;
290
+ break;
291
+ }
292
+ }
204
293
  ngOnInit() {
205
294
  const isSpan = this.element.tagName === SPAN_TAG_NAME;
206
- if (this.service) {
207
- this.buttonLookChangeSubscription = this.service.buttonLookChange
208
- .pipe(filter((look) => look !== 'default'))
209
- .subscribe((look) => this.look = look);
210
- }
295
+ this.addTextSpan();
211
296
  if (!this.element.hasAttribute('role') && this.togglable) {
212
297
  this.toggleAriaPressed(this.toggleable);
213
298
  }
@@ -217,7 +302,8 @@ let ButtonDirective = class ButtonDirective {
217
302
  this.ngZone.runOutsideAngular(() => {
218
303
  this.domEvents.push(this.renderer.listen(this.element, 'click', this._onButtonClick.bind(this)));
219
304
  this.domEvents.push(this.renderer.listen(this.element, 'keydown', (event) => {
220
- if (isSpan && (event.keyCode === Keys.Space || event.keyCode === Keys.Enter)) {
305
+ const isSpaceOrEnter = event.keyCode === Keys.Space || event.keyCode === Keys.Enter;
306
+ if (isSpan && isSpaceOrEnter) {
221
307
  this.click.emit(event);
222
308
  this._onButtonClick();
223
309
  }
@@ -229,17 +315,21 @@ let ButtonDirective = class ButtonDirective {
229
315
  this.toggleAriaPressed(this.toggleable);
230
316
  }
231
317
  }
318
+ ngAfterViewInit() {
319
+ const stylingOptions = ['size', 'rounded', 'shape', 'fillMode'];
320
+ stylingOptions.forEach(input => {
321
+ this.handleClasses(this[input], input);
322
+ });
323
+ }
232
324
  ngAfterViewChecked() {
233
325
  this.setIconTextClasses();
234
326
  }
235
327
  ngOnDestroy() {
236
328
  this.imageNode = null;
237
329
  this.iconNode = null;
330
+ this.iconSpanNode = null;
238
331
  this.renderer = null;
239
332
  this.localizationChangeSubscription.unsubscribe();
240
- if (this.service && this.buttonLookChangeSubscription) {
241
- this.buttonLookChangeSubscription.unsubscribe();
242
- }
243
333
  clearTimeout(this.deferTimeout);
244
334
  this.domEvents.forEach(unbindHandler => unbindHandler());
245
335
  }
@@ -282,7 +372,7 @@ let ButtonDirective = class ButtonDirective {
282
372
  const changed = this.selected !== value;
283
373
  this.selected = value;
284
374
  this.setAttribute('aria-pressed', this.selected.toString());
285
- this.toggleClass('k-state-selected', this.selected);
375
+ this.toggleClass('k-selected', this.selected);
286
376
  if (changed && hasObservers(this.selectedChange)) {
287
377
  this.ngZone.run(() => {
288
378
  this.selectedChange.emit(value);
@@ -302,14 +392,21 @@ let ButtonDirective = class ButtonDirective {
302
392
  }
303
393
  hasText() {
304
394
  if (isDocumentAvailable()) {
305
- return String(this.element.textContent).trim().length > 0;
395
+ return this.element.textContent.trim().length > 0;
306
396
  }
307
397
  else {
308
398
  return false;
309
399
  }
310
400
  }
401
+ get text() {
402
+ if (isDocumentAvailable()) {
403
+ return this.element.innerHTML.trim();
404
+ }
405
+ }
311
406
  addImgIcon(imageUrl) {
312
407
  let renderer = this.renderer;
408
+ this.iconSpanNode = renderer.createElement('span');
409
+ renderer.setProperty(this.iconSpanNode, 'className', 'k-button-icon k-icon');
313
410
  if (this.imageNode) {
314
411
  renderer.setProperty(this.imageNode, 'src', imageUrl);
315
412
  }
@@ -318,8 +415,9 @@ let ButtonDirective = class ButtonDirective {
318
415
  renderer.setProperty(this.imageNode, 'src', imageUrl);
319
416
  renderer.setProperty(this.imageNode, 'className', 'k-image');
320
417
  renderer.setAttribute(this.imageNode, 'role', 'presentation');
321
- this.prependChild(this.imageNode);
322
418
  }
419
+ this.iconSpanNode.appendChild(this.imageNode);
420
+ this.prependChild(this.iconSpanNode);
323
421
  }
324
422
  addIcon(classNames) {
325
423
  let renderer = this.renderer;
@@ -333,6 +431,11 @@ let ButtonDirective = class ButtonDirective {
333
431
  this.prependChild(this.iconNode);
334
432
  }
335
433
  }
434
+ addTextSpan() {
435
+ if (isDocumentAvailable() && this.hasText()) {
436
+ this.element.innerHTML = `<span class='k-button-text'>${this.text}</span>`;
437
+ }
438
+ }
336
439
  prependChild(node) {
337
440
  this.defer(() => {
338
441
  if (this.renderer && node !== this.element.firstChild) {
@@ -354,7 +457,9 @@ let ButtonDirective = class ButtonDirective {
354
457
  removeImageNode() {
355
458
  if (this.imageNode && this.renderer.parentNode(this.imageNode)) {
356
459
  this.renderer.removeChild(this.element, this.imageNode);
460
+ this.renderer.removeChild(this.element, this.iconSpanNode);
357
461
  this.imageNode = null;
462
+ this.iconSpanNode = null;
358
463
  }
359
464
  }
360
465
  removeIconNode() {
@@ -362,6 +467,10 @@ let ButtonDirective = class ButtonDirective {
362
467
  this.renderer.removeChild(this.element, this.iconNode);
363
468
  this.iconNode = null;
364
469
  }
470
+ if (this.iconSpanNode) {
471
+ this.renderer.removeChild(this.element, this.iconSpanNode);
472
+ this.iconSpanNode = null;
473
+ }
365
474
  }
366
475
  updateIconNode() {
367
476
  if (!this.isIcon && !this.isIconClass) {
@@ -370,9 +479,7 @@ let ButtonDirective = class ButtonDirective {
370
479
  }
371
480
  setIconTextClasses() {
372
481
  const hasIcon = this.isIcon || this.isIconClass || this.imageNode;
373
- const hasText = this.hasText();
374
- this.toggleClass('k-button-icon', hasIcon && !hasText);
375
- this.toggleClass('k-button-icontext', hasIcon && hasText);
482
+ this.toggleClass('k-icon-button', hasIcon && !this.hasText());
376
483
  }
377
484
  toggleClass(className, add) {
378
485
  if (add) {
@@ -392,6 +499,31 @@ let ButtonDirective = class ButtonDirective {
392
499
  this.setSelected(!this.selected);
393
500
  }
394
501
  }
502
+ handleClasses(value, input) {
503
+ const elem = this.element;
504
+ const classes = getStylingClasses('button', input, this[input], value);
505
+ if (input === 'fillMode') {
506
+ this.handleThemeColor(this.themeColor, this[input], value);
507
+ }
508
+ if (classes.toRemove) {
509
+ this.renderer.removeClass(elem, classes.toRemove);
510
+ }
511
+ if (classes.toAdd) {
512
+ this.renderer.addClass(elem, classes.toAdd);
513
+ }
514
+ }
515
+ handleThemeColor(value, prevFillMode, fillMode) {
516
+ const elem = this.element;
517
+ const removeFillMode = prevFillMode ? prevFillMode : this.fillMode;
518
+ const addFillMode = fillMode ? fillMode : this.fillMode;
519
+ const themeColorClass = getThemeColorClasses('button', removeFillMode, addFillMode, this.themeColor, value);
520
+ this.renderer.removeClass(elem, themeColorClass.toRemove);
521
+ if (addFillMode !== null && fillMode !== null) {
522
+ if (themeColorClass.toAdd) {
523
+ this.renderer.addClass(elem, themeColorClass.toAdd);
524
+ }
525
+ }
526
+ }
395
527
  };
396
528
  tslib_1.__decorate([
397
529
  Input(),
@@ -402,14 +534,6 @@ tslib_1.__decorate([
402
534
  tslib_1.__metadata("design:type", Boolean),
403
535
  tslib_1.__metadata("design:paramtypes", [Boolean])
404
536
  ], ButtonDirective.prototype, "togglable", null);
405
- tslib_1.__decorate([
406
- Input(),
407
- tslib_1.__metadata("design:type", Boolean)
408
- ], ButtonDirective.prototype, "primary", void 0);
409
- tslib_1.__decorate([
410
- Input(),
411
- tslib_1.__metadata("design:type", String)
412
- ], ButtonDirective.prototype, "look", void 0);
413
537
  tslib_1.__decorate([
414
538
  Input(),
415
539
  tslib_1.__metadata("design:type", Boolean),
@@ -440,6 +564,31 @@ tslib_1.__decorate([
440
564
  tslib_1.__metadata("design:type", Boolean),
441
565
  tslib_1.__metadata("design:paramtypes", [Boolean])
442
566
  ], ButtonDirective.prototype, "disabled", null);
567
+ tslib_1.__decorate([
568
+ Input(),
569
+ tslib_1.__metadata("design:type", String),
570
+ tslib_1.__metadata("design:paramtypes", [String])
571
+ ], ButtonDirective.prototype, "size", null);
572
+ tslib_1.__decorate([
573
+ Input(),
574
+ tslib_1.__metadata("design:type", String),
575
+ tslib_1.__metadata("design:paramtypes", [String])
576
+ ], ButtonDirective.prototype, "rounded", null);
577
+ tslib_1.__decorate([
578
+ Input(),
579
+ tslib_1.__metadata("design:type", String),
580
+ tslib_1.__metadata("design:paramtypes", [String])
581
+ ], ButtonDirective.prototype, "fillMode", null);
582
+ tslib_1.__decorate([
583
+ Input(),
584
+ tslib_1.__metadata("design:type", String),
585
+ tslib_1.__metadata("design:paramtypes", [String])
586
+ ], ButtonDirective.prototype, "themeColor", null);
587
+ tslib_1.__decorate([
588
+ Input(),
589
+ tslib_1.__metadata("design:type", String),
590
+ tslib_1.__metadata("design:paramtypes", [String])
591
+ ], ButtonDirective.prototype, "shape", null);
443
592
  tslib_1.__decorate([
444
593
  Input(),
445
594
  tslib_1.__metadata("design:type", String)
@@ -457,36 +606,11 @@ tslib_1.__decorate([
457
606
  tslib_1.__metadata("design:type", Boolean),
458
607
  tslib_1.__metadata("design:paramtypes", [])
459
608
  ], ButtonDirective.prototype, "classButton", null);
460
- tslib_1.__decorate([
461
- HostBinding('class.k-primary'),
462
- tslib_1.__metadata("design:type", Boolean),
463
- tslib_1.__metadata("design:paramtypes", [])
464
- ], ButtonDirective.prototype, "classPrimary", null);
465
609
  tslib_1.__decorate([
466
610
  HostBinding('class.k-toggle-button'),
467
611
  tslib_1.__metadata("design:type", Boolean),
468
612
  tslib_1.__metadata("design:paramtypes", [])
469
613
  ], ButtonDirective.prototype, "isToggleable", null);
470
- tslib_1.__decorate([
471
- HostBinding('class.k-flat'),
472
- tslib_1.__metadata("design:type", Boolean),
473
- tslib_1.__metadata("design:paramtypes", [])
474
- ], ButtonDirective.prototype, "isFlat", null);
475
- tslib_1.__decorate([
476
- HostBinding('class.k-bare'),
477
- tslib_1.__metadata("design:type", Boolean),
478
- tslib_1.__metadata("design:paramtypes", [])
479
- ], ButtonDirective.prototype, "isBare", null);
480
- tslib_1.__decorate([
481
- HostBinding('class.k-outline'),
482
- tslib_1.__metadata("design:type", Boolean),
483
- tslib_1.__metadata("design:paramtypes", [])
484
- ], ButtonDirective.prototype, "isOutline", null);
485
- tslib_1.__decorate([
486
- HostBinding('class.k-button-clear'),
487
- tslib_1.__metadata("design:type", Boolean),
488
- tslib_1.__metadata("design:paramtypes", [])
489
- ], ButtonDirective.prototype, "isClear", null);
490
614
  tslib_1.__decorate([
491
615
  HostBinding('attr.role'),
492
616
  tslib_1.__metadata("design:type", String),
@@ -494,12 +618,12 @@ tslib_1.__decorate([
494
618
  ], ButtonDirective.prototype, "roleSetter", null);
495
619
  tslib_1.__decorate([
496
620
  HostBinding('attr.aria-disabled'),
497
- HostBinding('class.k-state-disabled'),
621
+ HostBinding('class.k-disabled'),
498
622
  tslib_1.__metadata("design:type", Boolean),
499
623
  tslib_1.__metadata("design:paramtypes", [])
500
624
  ], ButtonDirective.prototype, "classDisabled", null);
501
625
  tslib_1.__decorate([
502
- HostBinding('class.k-state-selected'),
626
+ HostBinding('class.k-selected'),
503
627
  tslib_1.__metadata("design:type", Boolean),
504
628
  tslib_1.__metadata("design:paramtypes", [])
505
629
  ], ButtonDirective.prototype, "classActive", null);
@@ -520,6 +644,16 @@ tslib_1.__decorate([
520
644
  tslib_1.__metadata("design:paramtypes", []),
521
645
  tslib_1.__metadata("design:returntype", void 0)
522
646
  ], ButtonDirective.prototype, "onBlur", null);
647
+ tslib_1.__decorate([
648
+ Input(),
649
+ tslib_1.__metadata("design:type", Boolean),
650
+ tslib_1.__metadata("design:paramtypes", [Boolean])
651
+ ], ButtonDirective.prototype, "primary", null);
652
+ tslib_1.__decorate([
653
+ Input(),
654
+ tslib_1.__metadata("design:type", String),
655
+ tslib_1.__metadata("design:paramtypes", [String])
656
+ ], ButtonDirective.prototype, "look", null);
523
657
  ButtonDirective = tslib_1.__decorate([
524
658
  Directive({
525
659
  exportAs: 'kendoButton',
@@ -530,7 +664,7 @@ ButtonDirective = tslib_1.__decorate([
530
664
  useValue: 'kendo.button'
531
665
  }
532
666
  ],
533
- selector: 'button[kendoButton], span[kendoButton]' // tslint:disable-line
667
+ selector: 'button[kendoButton], span[kendoButton]',
534
668
  }),
535
669
  tslib_1.__param(2, Optional()),
536
670
  tslib_1.__metadata("design:paramtypes", [ElementRef,
@@ -2,16 +2,13 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { Observable, BehaviorSubject, Subject } from 'rxjs';
5
+ import { Observable, Subject } from 'rxjs';
6
6
  import { ButtonDirective } from "./button.directive";
7
- import { ButtonLook } from '../button-look';
8
7
  /**
9
8
  * @hidden
10
9
  */
11
10
  export declare class KendoButtonService {
12
- buttonLookChange: BehaviorSubject<ButtonLook>;
13
11
  buttonClicked: Subject<ButtonDirective>;
14
12
  buttonClicked$: Observable<ButtonDirective>;
15
13
  click(button: ButtonDirective): void;
16
- setButtonLook(look: ButtonLook): void;
17
14
  }