@progress/kendo-angular-inputs 10.1.1-dev.202210121020 → 10.1.1-dev.202210181135

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 (29) hide show
  1. package/bundles/kendo-angular-inputs.umd.js +1 -1
  2. package/colorpicker/color-gradient-numeric-label.directive.d.ts +20 -0
  3. package/colorpicker/color-gradient.component.d.ts +48 -5
  4. package/colorpicker/color-input.component.d.ts +14 -3
  5. package/colorpicker/color-palette.component.d.ts +16 -0
  6. package/colorpicker/colorpicker.component.d.ts +8 -2
  7. package/colorpicker/constants.d.ts +4 -0
  8. package/colorpicker/flatcolorpicker-actions.component.d.ts +4 -1
  9. package/colorpicker/flatcolorpicker-header.component.d.ts +4 -1
  10. package/colorpicker/flatcolorpicker.component.d.ts +40 -3
  11. package/colorpicker/localization/messages.d.ts +17 -1
  12. package/colorpicker/models/gradient-settings.d.ts +12 -0
  13. package/colorpicker.module.d.ts +14 -13
  14. package/esm2015/colorpicker/color-gradient-numeric-label.directive.js +29 -0
  15. package/esm2015/colorpicker/color-gradient.component.js +181 -34
  16. package/esm2015/colorpicker/color-input.component.js +71 -10
  17. package/esm2015/colorpicker/color-palette.component.js +49 -11
  18. package/esm2015/colorpicker/colorpicker.component.js +69 -11
  19. package/esm2015/colorpicker/constants.js +4 -0
  20. package/esm2015/colorpicker/flatcolorpicker-actions.component.js +20 -5
  21. package/esm2015/colorpicker/flatcolorpicker-header.component.js +36 -14
  22. package/esm2015/colorpicker/flatcolorpicker.component.js +206 -49
  23. package/esm2015/colorpicker/localization/messages.js +9 -1
  24. package/esm2015/colorpicker.module.js +4 -1
  25. package/esm2015/main.js +1 -0
  26. package/esm2015/package-metadata.js +1 -1
  27. package/fesm2015/kendo-angular-inputs.js +686 -153
  28. package/main.d.ts +1 -0
  29. package/package.json +1 -1
@@ -2,7 +2,7 @@
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 { Component, Input, Output, EventEmitter, ElementRef, HostBinding, ViewChild } from '@angular/core';
5
+ import { Component, Input, Output, EventEmitter, HostBinding, ViewChild } from '@angular/core';
6
6
  import { getRGBA, parseColor, getColorFromRGBA } from './utils';
7
7
  import { isPresent } from '../common/utils';
8
8
  import { guid, isDocumentAvailable } from '@progress/kendo-angular-common';
@@ -11,6 +11,7 @@ import * as i0 from "@angular/core";
11
11
  import * as i1 from "@progress/kendo-angular-l10n";
12
12
  import * as i2 from "../numerictextbox/numerictextbox.component";
13
13
  import * as i3 from "@angular/common";
14
+ import * as i4 from "./color-gradient-numeric-label.directive";
14
15
  /**
15
16
  * @hidden
16
17
  */
@@ -23,6 +24,10 @@ export class ColorInputComponent {
23
24
  * The id of the hex input.
24
25
  */
25
26
  this.focusableId = `k-${guid()}`;
27
+ /**
28
+ * The inputs tabindex.
29
+ */
30
+ this.tabindex = -1;
26
31
  /**
27
32
  * Sets whether the alpha slider will be shown.
28
33
  */
@@ -39,6 +44,10 @@ export class ColorInputComponent {
39
44
  * Emits a parsed rgba string color.
40
45
  */
41
46
  this.valueChange = new EventEmitter();
47
+ /**
48
+ * Emits when the user tabs out of the last focusable input.
49
+ */
50
+ this.tabOut = new EventEmitter();
42
51
  this.colorInputClass = true;
43
52
  /**
44
53
  * The rgba inputs values.
@@ -108,6 +117,14 @@ export class ColorInputComponent {
108
117
  handleHexInputBlur() {
109
118
  this.hex = parseColor(this.value, 'hex', this.opacity);
110
119
  }
120
+ focusLast() {
121
+ this.lastInput().focus();
122
+ }
123
+ onTab() {
124
+ if (this.opacity) {
125
+ return;
126
+ }
127
+ }
111
128
  toggleFormatView() {
112
129
  this.formatView = this.formatView === 'hex' ? 'rgba' : 'hex';
113
130
  }
@@ -117,14 +134,20 @@ export class ColorInputComponent {
117
134
  }
118
135
  this.subscriptions.add(this.renderer.listen(this.toggleFormatButton.nativeElement, 'click', () => this.toggleFormatView()));
119
136
  }
137
+ lastInput() {
138
+ var _a;
139
+ return ((_a = this.hexInput) === null || _a === void 0 ? void 0 : _a.nativeElement) || this.opacityInput || this.blueInput;
140
+ }
120
141
  }
121
142
  ColorInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ColorInputComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
122
- ColorInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ColorInputComponent, selector: "kendo-colorinput", inputs: { focusableId: "focusableId", formatView: "formatView", value: "value", opacity: "opacity", disabled: "disabled", readonly: "readonly" }, outputs: { valueChange: "valueChange" }, host: { properties: { "class.k-colorgradient-inputs": "this.colorInputClass", "class.k-hstack": "this.colorInputClass" } }, viewQueries: [{ propertyName: "opacityInput", first: true, predicate: ["opacityInput"], descendants: true }, { propertyName: "hexInput", first: true, predicate: ["hexInput"], descendants: true, read: ElementRef }, { propertyName: "blueInput", first: true, predicate: ["blueInput"], descendants: true, read: ElementRef }, { propertyName: "toggleFormatButton", first: true, predicate: ["toggleFormatButton"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
143
+ ColorInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ColorInputComponent, selector: "kendo-colorinput", inputs: { focusableId: "focusableId", formatView: "formatView", tabindex: "tabindex", value: "value", opacity: "opacity", disabled: "disabled", readonly: "readonly" }, outputs: { valueChange: "valueChange", tabOut: "tabOut" }, host: { properties: { "class.k-colorgradient-inputs": "this.colorInputClass", "class.k-hstack": "this.colorInputClass" } }, viewQueries: [{ propertyName: "opacityInput", first: true, predicate: ["opacityInput"], descendants: true }, { propertyName: "hexInput", first: true, predicate: ["hexInput"], descendants: true }, { propertyName: "blueInput", first: true, predicate: ["blueInput"], descendants: true }, { propertyName: "toggleFormatButton", first: true, predicate: ["toggleFormatButton"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
123
144
  <div class="k-vstack">
124
145
  <button #toggleFormatButton
125
146
  class="k-colorgradient-toggle-mode k-button k-button-md k-button-flat k-button-flat-base k-icon-button"
126
147
  [attr.aria-label]="formatButtonTitle"
127
148
  [attr.title]="formatButtonTitle"
149
+ [disabled]="disabled"
150
+ [tabindex]="tabindex.toString()"
128
151
  type="button"
129
152
  >
130
153
  <span class="k-button-icon k-icon k-i-caret-alt-expand"></span>
@@ -140,6 +163,8 @@ ColorInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
140
163
  [value]="hex || ''"
141
164
  (blur)="handleHexInputBlur()"
142
165
  (input)="handleHexValueChange(hexInput.value)"
166
+ [tabindex]="tabindex.toString()"
167
+ (keydown.tab)="$event.preventDefault(); tabOut.emit();"
143
168
  />
144
169
  <label [for]="focusableId" class="k-colorgradient-input-label">HEX</label>
145
170
  </div>
@@ -147,8 +172,11 @@ ColorInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
147
172
  <div class="k-vstack">
148
173
  <kendo-numerictextbox
149
174
  #red
175
+ kendoAdditionalNumericLabel="red"
176
+ [localizationService]="localizationService"
150
177
  [disabled]="disabled"
151
178
  [readonly]="readonly"
179
+ [tabindex]="tabindex"
152
180
  [min]="0"
153
181
  [max]="255"
154
182
  [(value)]="rgba.r"
@@ -164,8 +192,11 @@ ColorInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
164
192
  <div class="k-vstack">
165
193
  <kendo-numerictextbox
166
194
  #green
195
+ kendoAdditionalNumericLabel="green"
196
+ [localizationService]="localizationService"
167
197
  [disabled]="disabled"
168
198
  [readonly]="readonly"
199
+ [tabindex]="tabindex"
169
200
  [min]="0"
170
201
  [max]="255"
171
202
  [(value)]="rgba.g"
@@ -181,8 +212,11 @@ ColorInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
181
212
  <div class="k-vstack">
182
213
  <kendo-numerictextbox
183
214
  #blue
215
+ kendoAdditionalNumericLabel="blue"
216
+ [localizationService]="localizationService"
184
217
  [disabled]="disabled"
185
218
  [readonly]="readonly"
219
+ [tabindex]="tabindex"
186
220
  [min]="0"
187
221
  [max]="255"
188
222
  [(value)]="rgba.b"
@@ -191,15 +225,19 @@ ColorInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
191
225
  [format]="'n'"
192
226
  [decimals]="0"
193
227
  (blur)="handleRgbaInputBlur()"
194
- (valueChange)="handleRgbaValueChange()">
228
+ (valueChange)="handleRgbaValueChange()"
229
+ (keydown.tab)="onTab()">
195
230
  </kendo-numerictextbox>
196
231
  <label [for]="blue.focusableId" class="k-colorgradient-input-label">B</label>
197
232
  </div>
198
233
  <div class="k-vstack" *ngIf="opacity">
199
234
  <kendo-numerictextbox #opacityInput
200
235
  #alpha
236
+ kendoAdditionalNumericLabel="alpha"
237
+ [localizationService]="localizationService"
201
238
  [disabled]="disabled"
202
239
  [readonly]="readonly"
240
+ [tabindex]="tabindex"
203
241
  [min]="0"
204
242
  [max]="1"
205
243
  [(value)]="rgba.a"
@@ -209,12 +247,13 @@ ColorInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
209
247
  [format]="'n2'"
210
248
  [decimals]="2"
211
249
  (blur)="handleRgbaInputBlur()"
212
- (valueChange)="handleRgbaValueChange()">
250
+ (valueChange)="handleRgbaValueChange()"
251
+ (keydown.tab)="$event.preventDefault(); tabOut.emit();">
213
252
  </kendo-numerictextbox>
214
253
  <label [for]="alpha.focusableId" class="k-colorgradient-input-label">A</label>
215
254
  </div>
216
255
  </ng-container>
217
- `, isInline: true, components: [{ type: i2.NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: ["focusableId", "disabled", "readonly", "title", "autoCorrect", "format", "max", "min", "decimals", "placeholder", "step", "spinners", "rangeValidation", "tabindex", "tabIndex", "changeValueOnScroll", "selectOnFocus", "value", "maxlength", "size", "rounded", "fillMode"], outputs: ["valueChange", "focus", "blur"], exportAs: ["kendoNumericTextBox"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
256
+ `, isInline: true, components: [{ type: i2.NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: ["focusableId", "disabled", "readonly", "title", "autoCorrect", "format", "max", "min", "decimals", "placeholder", "step", "spinners", "rangeValidation", "tabindex", "tabIndex", "changeValueOnScroll", "selectOnFocus", "value", "maxlength", "size", "rounded", "fillMode"], outputs: ["valueChange", "focus", "blur"], exportAs: ["kendoNumericTextBox"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NumericLabelDirective, selector: "[kendoAdditionalNumericLabel]", inputs: ["kendoAdditionalNumericLabel", "localizationService"] }] });
218
257
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ColorInputComponent, decorators: [{
219
258
  type: Component,
220
259
  args: [{
@@ -225,6 +264,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
225
264
  class="k-colorgradient-toggle-mode k-button k-button-md k-button-flat k-button-flat-base k-icon-button"
226
265
  [attr.aria-label]="formatButtonTitle"
227
266
  [attr.title]="formatButtonTitle"
267
+ [disabled]="disabled"
268
+ [tabindex]="tabindex.toString()"
228
269
  type="button"
229
270
  >
230
271
  <span class="k-button-icon k-icon k-i-caret-alt-expand"></span>
@@ -240,6 +281,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
240
281
  [value]="hex || ''"
241
282
  (blur)="handleHexInputBlur()"
242
283
  (input)="handleHexValueChange(hexInput.value)"
284
+ [tabindex]="tabindex.toString()"
285
+ (keydown.tab)="$event.preventDefault(); tabOut.emit();"
243
286
  />
244
287
  <label [for]="focusableId" class="k-colorgradient-input-label">HEX</label>
245
288
  </div>
@@ -247,8 +290,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
247
290
  <div class="k-vstack">
248
291
  <kendo-numerictextbox
249
292
  #red
293
+ kendoAdditionalNumericLabel="red"
294
+ [localizationService]="localizationService"
250
295
  [disabled]="disabled"
251
296
  [readonly]="readonly"
297
+ [tabindex]="tabindex"
252
298
  [min]="0"
253
299
  [max]="255"
254
300
  [(value)]="rgba.r"
@@ -264,8 +310,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
264
310
  <div class="k-vstack">
265
311
  <kendo-numerictextbox
266
312
  #green
313
+ kendoAdditionalNumericLabel="green"
314
+ [localizationService]="localizationService"
267
315
  [disabled]="disabled"
268
316
  [readonly]="readonly"
317
+ [tabindex]="tabindex"
269
318
  [min]="0"
270
319
  [max]="255"
271
320
  [(value)]="rgba.g"
@@ -281,8 +330,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
281
330
  <div class="k-vstack">
282
331
  <kendo-numerictextbox
283
332
  #blue
333
+ kendoAdditionalNumericLabel="blue"
334
+ [localizationService]="localizationService"
284
335
  [disabled]="disabled"
285
336
  [readonly]="readonly"
337
+ [tabindex]="tabindex"
286
338
  [min]="0"
287
339
  [max]="255"
288
340
  [(value)]="rgba.b"
@@ -291,15 +343,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
291
343
  [format]="'n'"
292
344
  [decimals]="0"
293
345
  (blur)="handleRgbaInputBlur()"
294
- (valueChange)="handleRgbaValueChange()">
346
+ (valueChange)="handleRgbaValueChange()"
347
+ (keydown.tab)="onTab()">
295
348
  </kendo-numerictextbox>
296
349
  <label [for]="blue.focusableId" class="k-colorgradient-input-label">B</label>
297
350
  </div>
298
351
  <div class="k-vstack" *ngIf="opacity">
299
352
  <kendo-numerictextbox #opacityInput
300
353
  #alpha
354
+ kendoAdditionalNumericLabel="alpha"
355
+ [localizationService]="localizationService"
301
356
  [disabled]="disabled"
302
357
  [readonly]="readonly"
358
+ [tabindex]="tabindex"
303
359
  [min]="0"
304
360
  [max]="1"
305
361
  [(value)]="rgba.a"
@@ -309,7 +365,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
309
365
  [format]="'n2'"
310
366
  [decimals]="2"
311
367
  (blur)="handleRgbaInputBlur()"
312
- (valueChange)="handleRgbaValueChange()">
368
+ (valueChange)="handleRgbaValueChange()"
369
+ (keydown.tab)="$event.preventDefault(); tabOut.emit();">
313
370
  </kendo-numerictextbox>
314
371
  <label [for]="alpha.focusableId" class="k-colorgradient-input-label">A</label>
315
372
  </div>
@@ -320,6 +377,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
320
377
  type: Input
321
378
  }], formatView: [{
322
379
  type: Input
380
+ }], tabindex: [{
381
+ type: Input
323
382
  }], value: [{
324
383
  type: Input
325
384
  }], opacity: [{
@@ -330,6 +389,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
330
389
  type: Input
331
390
  }], valueChange: [{
332
391
  type: Output
392
+ }], tabOut: [{
393
+ type: Output
333
394
  }], colorInputClass: [{
334
395
  type: HostBinding,
335
396
  args: ['class.k-colorgradient-inputs']
@@ -338,13 +399,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
338
399
  args: ['class.k-hstack']
339
400
  }], opacityInput: [{
340
401
  type: ViewChild,
341
- args: ['opacityInput', { static: false }]
402
+ args: ['opacityInput']
342
403
  }], hexInput: [{
343
404
  type: ViewChild,
344
- args: ['hexInput', { read: ElementRef, static: false }]
405
+ args: ['hexInput']
345
406
  }], blueInput: [{
346
407
  type: ViewChild,
347
- args: ['blueInput', { read: ElementRef, static: false }]
408
+ args: ['blueInput']
348
409
  }], toggleFormatButton: [{
349
410
  type: ViewChild,
350
411
  args: ['toggleFormatButton', { static: false }]
@@ -36,6 +36,10 @@ export class ColorPaletteComponent {
36
36
  this.renderer = renderer;
37
37
  this.localizationService = localizationService;
38
38
  this.ngZone = ngZone;
39
+ /**
40
+ * @hidden
41
+ */
42
+ this.role = 'grid';
39
43
  /**
40
44
  * @hidden
41
45
  */
@@ -97,6 +101,13 @@ export class ColorPaletteComponent {
97
101
  this.direction = rtl ? 'rtl' : 'ltr';
98
102
  });
99
103
  }
104
+ /**
105
+ * @hidden
106
+ */
107
+ get activeDescendant() {
108
+ return this.activeCellId;
109
+ }
110
+ ;
100
111
  /**
101
112
  * @hidden
102
113
  */
@@ -237,6 +248,14 @@ export class ColorPaletteComponent {
237
248
  }
238
249
  event.preventDefault();
239
250
  }
251
+ /**
252
+ * @hidden
253
+ */
254
+ handleFocus() {
255
+ if (!this.focusInComponent) {
256
+ this.focus();
257
+ }
258
+ }
240
259
  /**
241
260
  * @hidden
242
261
  */
@@ -291,6 +310,18 @@ export class ColorPaletteComponent {
291
310
  this.cdr.markForCheck();
292
311
  this.disabled = isDisabled;
293
312
  }
313
+ /**
314
+ * @hidden
315
+ */
316
+ focus() {
317
+ this.host.nativeElement.focus();
318
+ if (!this.focusedCell && !this.readonly && !this.disabled) {
319
+ this.focusedCell = {
320
+ row: 0,
321
+ col: 0
322
+ };
323
+ }
324
+ }
294
325
  /**
295
326
  * @hidden
296
327
  * Used by the FloatingLabel to determine if the component is empty.
@@ -352,7 +383,7 @@ export class ColorPaletteComponent {
352
383
  }
353
384
  }
354
385
  ColorPaletteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ColorPaletteComponent, deps: [{ token: i0.ElementRef }, { token: i1.ColorPaletteService }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i2.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
355
- ColorPaletteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ColorPaletteComponent, selector: "kendo-colorpalette", inputs: { id: "id", format: "format", value: "value", columns: "columns", palette: "palette", tabindex: "tabindex", disabled: "disabled", readonly: "readonly", tileSize: "tileSize" }, outputs: { selectionChange: "selectionChange", valueChange: "valueChange", cellSelection: "cellSelection" }, host: { listeners: { "keydown": "handleKeydown($event)", "blur": "handleHostBlur()" }, properties: { "attr.dir": "this.direction", "attr.id": "this.paletteId", "attr.tabindex": "this.hostTabindex", "class.k-colorpalette": "this.hostClasses", "attr.aria-disabled": "this.disabledClass", "class.k-disabled": "this.disabledClass", "attr.aria-readonly": "this.readonlyAttribute" } }, providers: [
386
+ ColorPaletteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ColorPaletteComponent, selector: "kendo-colorpalette", inputs: { id: "id", format: "format", value: "value", columns: "columns", palette: "palette", tabindex: "tabindex", disabled: "disabled", readonly: "readonly", tileSize: "tileSize" }, outputs: { selectionChange: "selectionChange", valueChange: "valueChange", cellSelection: "cellSelection" }, host: { listeners: { "keydown": "handleKeydown($event)", "focus": "handleFocus($event)", "blur": "handleHostBlur()" }, properties: { "attr.dir": "this.direction", "attr.role": "this.role", "attr.aria-activedescendant": "this.activeDescendant", "attr.id": "this.paletteId", "attr.tabindex": "this.hostTabindex", "class.k-colorpalette": "this.hostClasses", "attr.aria-disabled": "this.disabledClass", "class.k-disabled": "this.disabledClass", "attr.aria-readonly": "this.readonlyAttribute" } }, providers: [
356
387
  {
357
388
  multi: true,
358
389
  provide: NG_VALUE_ACCESSOR,
@@ -376,13 +407,12 @@ ColorPaletteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
376
407
  i18n-colorPaletteNoColor="kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
377
408
  colorPaletteNoColor="Colorpalette no color chosen">
378
409
  </ng-container>
379
- <div role="listbox" class="k-colorpalette-table-wrap"
380
- [attr.aria-activedescendant]="activeCellId">
381
- <table class="k-colorpalette-table k-palette">
410
+ <div class="k-colorpalette-table-wrap">
411
+ <table role="presentation" class="k-colorpalette-table k-palette">
382
412
  <tbody>
383
- <tr *ngFor="let row of colorRows; let rowIndex = index">
413
+ <tr *ngFor="let row of colorRows; let rowIndex = index" role="row">
384
414
  <td *ngFor="let color of row; let colIndex = index"
385
- role="option"
415
+ role="gridcell"
386
416
  [class.k-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
387
417
  [class.k-focus]="focusInComponent && focusedCell?.row === rowIndex && focusedCell?.col === colIndex"
388
418
  [attr.aria-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
@@ -433,13 +463,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
433
463
  i18n-colorPaletteNoColor="kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
434
464
  colorPaletteNoColor="Colorpalette no color chosen">
435
465
  </ng-container>
436
- <div role="listbox" class="k-colorpalette-table-wrap"
437
- [attr.aria-activedescendant]="activeCellId">
438
- <table class="k-colorpalette-table k-palette">
466
+ <div class="k-colorpalette-table-wrap">
467
+ <table role="presentation" class="k-colorpalette-table k-palette">
439
468
  <tbody>
440
- <tr *ngFor="let row of colorRows; let rowIndex = index">
469
+ <tr *ngFor="let row of colorRows; let rowIndex = index" role="row">
441
470
  <td *ngFor="let color of row; let colIndex = index"
442
- role="option"
471
+ role="gridcell"
443
472
  [class.k-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
444
473
  [class.k-focus]="focusInComponent && focusedCell?.row === rowIndex && focusedCell?.col === colIndex"
445
474
  [attr.aria-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
@@ -464,6 +493,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
464
493
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ColorPaletteService }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }, { type: i2.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { direction: [{
465
494
  type: HostBinding,
466
495
  args: ['attr.dir']
496
+ }], role: [{
497
+ type: HostBinding,
498
+ args: ['attr.role']
499
+ }], activeDescendant: [{
500
+ type: HostBinding,
501
+ args: ['attr.aria-activedescendant']
467
502
  }], paletteId: [{
468
503
  type: HostBinding,
469
504
  args: ['attr.id']
@@ -509,6 +544,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
509
544
  }], handleKeydown: [{
510
545
  type: HostListener,
511
546
  args: ['keydown', ['$event']]
547
+ }], handleFocus: [{
548
+ type: HostListener,
549
+ args: ['focus', ['$event']]
512
550
  }], handleHostBlur: [{
513
551
  type: HostListener,
514
552
  args: ['blur']
@@ -4,7 +4,7 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { take } from 'rxjs/operators';
6
6
  import { Component, HostBinding, Input, Output, EventEmitter, ViewChild, ViewContainerRef, forwardRef } from '@angular/core';
7
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
7
+ import { NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
8
8
  import { Subscription } from 'rxjs';
9
9
  import { validatePackage } from '@progress/kendo-licensing';
10
10
  import { Keys, KendoInput, isChanged, closest, guid } from '@progress/kendo-angular-common';
@@ -26,6 +26,10 @@ const DOM_FOCUS_EVENTS = ['focus', 'blur'];
26
26
  const DEFAULT_SIZE = 'medium';
27
27
  const DEFAULT_ROUNDED = 'medium';
28
28
  const DEFAULT_FILL_MODE = 'solid';
29
+ /**
30
+ * @hidden
31
+ */
32
+ let nextColorPickerId = 0;
29
33
  /**
30
34
  * Represents the [Kendo UI ColorPicker component for Angular]({% slug overview_colorpicker %}).
31
35
  *
@@ -33,15 +37,17 @@ const DEFAULT_FILL_MODE = 'solid';
33
37
  * which are rendered in its popup. It supports previewing the selected color, reverting it to its previous state or clearing it completely.
34
38
  */
35
39
  export class ColorPickerComponent {
36
- constructor(host, popupService, cdr, localizationService, ngZone, renderer) {
40
+ constructor(host, popupService, cdr, localizationService, ngZone, renderer, injector) {
37
41
  this.host = host;
38
42
  this.popupService = popupService;
39
43
  this.cdr = cdr;
40
44
  this.localizationService = localizationService;
41
45
  this.ngZone = ngZone;
42
46
  this.renderer = renderer;
47
+ this.injector = injector;
43
48
  this.hostClasses = true;
44
- this.role = 'listbox';
49
+ this.role = 'combobox';
50
+ this.hasPopup = 'dialog';
45
51
  /**
46
52
  * Specifies the views that will be rendered in the popup.
47
53
  * By default both the gradient and palette views will be rendered.
@@ -149,6 +155,7 @@ export class ColorPickerComponent {
149
155
  this._rounded = 'medium';
150
156
  this._fillMode = 'solid';
151
157
  this.subscriptions = new Subscription();
158
+ this.popupSubs = new Subscription();
152
159
  this.notifyNgTouched = () => { };
153
160
  this.notifyNgChanged = () => { };
154
161
  this.domFocusListener = (event) => event.stopImmediatePropagation();
@@ -156,6 +163,7 @@ export class ColorPickerComponent {
156
163
  this.dynamicRTLSubscription = this.localizationService.changes.subscribe(({ rtl }) => {
157
164
  this.direction = rtl ? 'rtl' : 'ltr';
158
165
  });
166
+ this.colorPickerId = nextColorPickerId++;
159
167
  }
160
168
  get focusedClass() {
161
169
  return this.isFocused;
@@ -172,6 +180,10 @@ export class ColorPickerComponent {
172
180
  get hostTabindex() {
173
181
  return this.tabindex;
174
182
  }
183
+ get isControlInvalid() {
184
+ var _a, _b;
185
+ return (_b = ((_a = this.control) === null || _a === void 0 ? void 0 : _a.invalid)) === null || _b === void 0 ? void 0 : _b.toString();
186
+ }
175
187
  /**
176
188
  * @hidden
177
189
  */
@@ -314,6 +326,8 @@ export class ColorPickerComponent {
314
326
  columns: this._paletteSettings.columns || presetColumns || 10
315
327
  };
316
328
  this.handleHostId();
329
+ this.renderer.setAttribute(this.host.nativeElement, 'aria-controls', `k-colorpicker-popup-${this.colorPickerId}`);
330
+ this.control = this.injector.get(NgControl, null);
317
331
  }
318
332
  ngAfterViewInit() {
319
333
  const stylingInputs = ['size', 'rounded', 'fillMode'];
@@ -590,19 +604,21 @@ export class ColorPickerComponent {
590
604
  content: this.popupTemplate,
591
605
  positionMode: 'absolute'
592
606
  });
593
- this.popupRef.popupAnchorViewportLeave.subscribe(() => {
607
+ this.renderer.setAttribute(this.popupRef.popupElement.querySelector('.k-colorpicker-popup'), 'id', `k-colorpicker-popup-${this.colorPickerId}`);
608
+ this.popupSubs.add(this.popupRef.popupAnchorViewportLeave.subscribe(() => {
594
609
  this.toggleWithEvents(false);
595
610
  if (!this.isOpen) {
596
611
  this.host.nativeElement.focus({
597
612
  preventScroll: true
598
613
  });
599
614
  }
600
- });
615
+ }));
601
616
  }
602
617
  closePopup() {
603
618
  if (!this.isOpen) {
604
619
  return;
605
620
  }
621
+ this.popupSubs.unsubscribe();
606
622
  this.popupRef.close();
607
623
  this.popupRef = null;
608
624
  }
@@ -625,7 +641,7 @@ export class ColorPickerComponent {
625
641
  if (gradient && inputs && inputs.formatView === 'hex') {
626
642
  return inputs.hexInput;
627
643
  }
628
- return this.gradientSettings.opacity ? inputs.opacityInput.numericInput : inputs.blueInput;
644
+ return this.gradientSettings.opacity ? inputs.opacityInput.numericInput : inputs.blueInput.numericInput;
629
645
  }
630
646
  handleDomEvents(action, events) {
631
647
  const hostElement = this.host.nativeElement;
@@ -673,8 +689,8 @@ export class ColorPickerComponent {
673
689
  }
674
690
  }
675
691
  }
676
- ColorPickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ColorPickerComponent, deps: [{ token: i0.ElementRef }, { token: i1.PopupService }, { token: i0.ChangeDetectorRef }, { token: i2.LocalizationService }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
677
- ColorPickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ColorPickerComponent, selector: "kendo-colorpicker", inputs: { views: "views", view: "view", activeView: "activeView", readonly: "readonly", disabled: "disabled", format: "format", value: "value", popupSettings: "popupSettings", paletteSettings: "paletteSettings", gradientSettings: "gradientSettings", icon: "icon", iconClass: "iconClass", clearButton: "clearButton", tabindex: "tabindex", preview: "preview", actionsLayout: "actionsLayout", size: "size", rounded: "rounded", fillMode: "fillMode" }, outputs: { valueChange: "valueChange", open: "open", close: "close", onFocus: "focus", onBlur: "blur", cancel: "cancel", activeColorClick: "activeColorClick", activeViewChange: "activeViewChange" }, host: { properties: { "class.k-colorpicker": "this.hostClasses", "class.k-icon-picker": "this.hostClasses", "class.k-picker": "this.hostClasses", "class.k-focus": "this.focusedClass", "attr.aria-disabled": "this.disabledClass", "class.k-disabled": "this.disabledClass", "attr.aria-readonly": "this.ariaReadonly", "attr.aria-expanded": "this.ariaExpanded", "attr.tabindex": "this.hostTabindex", "attr.dir": "this.direction", "attr.role": "this.role" } }, providers: [{
692
+ ColorPickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ColorPickerComponent, deps: [{ token: i0.ElementRef }, { token: i1.PopupService }, { token: i0.ChangeDetectorRef }, { token: i2.LocalizationService }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
693
+ ColorPickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ColorPickerComponent, selector: "kendo-colorpicker", inputs: { views: "views", view: "view", activeView: "activeView", readonly: "readonly", disabled: "disabled", format: "format", value: "value", popupSettings: "popupSettings", paletteSettings: "paletteSettings", gradientSettings: "gradientSettings", icon: "icon", iconClass: "iconClass", clearButton: "clearButton", tabindex: "tabindex", preview: "preview", actionsLayout: "actionsLayout", size: "size", rounded: "rounded", fillMode: "fillMode" }, outputs: { valueChange: "valueChange", open: "open", close: "close", onFocus: "focus", onBlur: "blur", cancel: "cancel", activeColorClick: "activeColorClick", activeViewChange: "activeViewChange" }, host: { properties: { "class.k-colorpicker": "this.hostClasses", "class.k-icon-picker": "this.hostClasses", "class.k-picker": "this.hostClasses", "class.k-focus": "this.focusedClass", "attr.aria-disabled": "this.disabledClass", "class.k-disabled": "this.disabledClass", "attr.aria-readonly": "this.ariaReadonly", "attr.aria-expanded": "this.ariaExpanded", "attr.tabindex": "this.hostTabindex", "attr.dir": "this.direction", "attr.role": "this.role", "attr.aria-haspopup": "this.hasPopup", "attr.aria-invalid": "this.isControlInvalid" } }, providers: [{
678
694
  multi: true,
679
695
  provide: NG_VALUE_ACCESSOR,
680
696
  useExisting: forwardRef(() => ColorPickerComponent)
@@ -724,7 +740,23 @@ ColorPickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
724
740
  i18n-applyButton="kendo.colorpicker.applyButton|The message for the Apply action button."
725
741
  applyButton="Apply"
726
742
  i18n-cancelButton="kendo.colorpicker.cancelButton|The message for the Cancel action button."
727
- cancelButton="Cancel">
743
+ cancelButton="Cancel"
744
+ i18n-redChannelLabel="kendo.colorpicker.redChannelLabel|The label of the NumericTextBox representing the red color channel."
745
+ redChannelLabel="Red channel"
746
+ i18n-greenChannelLabel="kendo.colorpicker.greenChannelLabel|The label of the NumericTextBox representing the green color channel."
747
+ greenChannelLabel="Green channel"
748
+ i18n-blueChannelLabel="kendo.colorpicker.blueChannelLabel|The label of the NumericTextBox representing the blue color channel."
749
+ blueChannelLabel="Blue channel"
750
+ i18n-alphaChannelLabel="kendo.colorpicker.alphaChannelLabel|The label of the NumericTextBox representing the alpha color channel."
751
+ alphaChannelLabel="Alpha channel"
752
+ i18n-redInputPlaceholder="kendo.colorpicker.redInputPlaceholder|The placeholder for the red color input."
753
+ redChannelLabel="R"
754
+ i18n-greenInputPlaceholder="kendo.colorpicker.greenInputPlaceholder|The placeholder for the green color input."
755
+ greenInputPlaceholder="G"
756
+ i18n-blueInputPlaceholder="kendo.colorpicker.blueInputPlaceholder|The placeholder for the blue color input."
757
+ blueInputPlaceholder="B"
758
+ i18n-hexInputPlaceholder="kendo.colorpicker.hexInputPlaceholder|The placeholder for the HEX color input."
759
+ hexInputPlaceholder="HEX">
728
760
  </ng-container>
729
761
  <span #activeColor class="k-input-inner">
730
762
  <span
@@ -737,6 +769,8 @@ ColorPickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
737
769
  <button
738
770
  tabindex="-1"
739
771
  type="button"
772
+ role="none"
773
+ aria-hidden="true"
740
774
  class="k-input-button k-button k-button-md k-button-solid k-button-solid-base k-icon-button">
741
775
  <span class="k-button-icon k-icon k-i-caret-alt-down"></span>
742
776
  </button>
@@ -817,7 +851,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
817
851
  i18n-applyButton="kendo.colorpicker.applyButton|The message for the Apply action button."
818
852
  applyButton="Apply"
819
853
  i18n-cancelButton="kendo.colorpicker.cancelButton|The message for the Cancel action button."
820
- cancelButton="Cancel">
854
+ cancelButton="Cancel"
855
+ i18n-redChannelLabel="kendo.colorpicker.redChannelLabel|The label of the NumericTextBox representing the red color channel."
856
+ redChannelLabel="Red channel"
857
+ i18n-greenChannelLabel="kendo.colorpicker.greenChannelLabel|The label of the NumericTextBox representing the green color channel."
858
+ greenChannelLabel="Green channel"
859
+ i18n-blueChannelLabel="kendo.colorpicker.blueChannelLabel|The label of the NumericTextBox representing the blue color channel."
860
+ blueChannelLabel="Blue channel"
861
+ i18n-alphaChannelLabel="kendo.colorpicker.alphaChannelLabel|The label of the NumericTextBox representing the alpha color channel."
862
+ alphaChannelLabel="Alpha channel"
863
+ i18n-redInputPlaceholder="kendo.colorpicker.redInputPlaceholder|The placeholder for the red color input."
864
+ redChannelLabel="R"
865
+ i18n-greenInputPlaceholder="kendo.colorpicker.greenInputPlaceholder|The placeholder for the green color input."
866
+ greenInputPlaceholder="G"
867
+ i18n-blueInputPlaceholder="kendo.colorpicker.blueInputPlaceholder|The placeholder for the blue color input."
868
+ blueInputPlaceholder="B"
869
+ i18n-hexInputPlaceholder="kendo.colorpicker.hexInputPlaceholder|The placeholder for the HEX color input."
870
+ hexInputPlaceholder="HEX">
821
871
  </ng-container>
822
872
  <span #activeColor class="k-input-inner">
823
873
  <span
@@ -830,6 +880,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
830
880
  <button
831
881
  tabindex="-1"
832
882
  type="button"
883
+ role="none"
884
+ aria-hidden="true"
833
885
  class="k-input-button k-button k-button-md k-button-solid k-button-solid-base k-icon-button">
834
886
  <span class="k-button-icon k-icon k-i-caret-alt-down"></span>
835
887
  </button>
@@ -856,7 +908,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
856
908
  <ng-container #container></ng-container>
857
909
  `
858
910
  }]
859
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.PopupService }, { type: i0.ChangeDetectorRef }, { type: i2.LocalizationService }, { type: i0.NgZone }, { type: i0.Renderer2 }]; }, propDecorators: { hostClasses: [{
911
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.PopupService }, { type: i0.ChangeDetectorRef }, { type: i2.LocalizationService }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.Injector }]; }, propDecorators: { hostClasses: [{
860
912
  type: HostBinding,
861
913
  args: ['class.k-colorpicker']
862
914
  }, {
@@ -889,6 +941,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
889
941
  }], role: [{
890
942
  type: HostBinding,
891
943
  args: ['attr.role']
944
+ }], hasPopup: [{
945
+ type: HostBinding,
946
+ args: ['attr.aria-haspopup']
947
+ }], isControlInvalid: [{
948
+ type: HostBinding,
949
+ args: ['attr.aria-invalid']
892
950
  }], views: [{
893
951
  type: Input
894
952
  }], view: [{
@@ -14,6 +14,10 @@ export const DEFAULT_GRADIENT_BACKGROUND_COLOR = 'rgba(255, 0, 0, 1)';
14
14
  * @hidden
15
15
  */
16
16
  export const DRAGHANDLE_MOVE_SPEED = 5;
17
+ /**
18
+ * @hidden
19
+ */
20
+ export const DRAGHANDLE_MOVE_SPEED_SMALL_STEP = 2;
17
21
  /**
18
22
  * @hidden
19
23
  */