@progress/kendo-angular-inputs 7.4.0-dev.202109021544 → 7.5.0-dev.202110261427

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 (60) hide show
  1. package/dist/cdn/js/kendo-angular-inputs.js +2 -2
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/colorpicker/color-gradient.component.js +19 -7
  4. package/dist/es/colorpicker/color-input.component.js +36 -8
  5. package/dist/es/colorpicker/color-palette.component.js +13 -11
  6. package/dist/es/colorpicker/constants.js +24 -0
  7. package/dist/es/colorpicker/contrast-validation.component.js +57 -0
  8. package/dist/es/colorpicker/contrast.component.js +72 -0
  9. package/dist/es/colorpicker/localization/messages.js +12 -0
  10. package/dist/es/colorpicker/models/rgb.js +4 -0
  11. package/dist/es/colorpicker/utils/color-parser.js +52 -0
  12. package/dist/es/colorpicker.module.js +5 -1
  13. package/dist/es/index.js +2 -0
  14. package/dist/es/numerictextbox/numerictextbox.component.js +2 -2
  15. package/dist/es/numerictextbox/utils.js +8 -0
  16. package/dist/es/package-metadata.js +1 -1
  17. package/dist/es2015/colorpicker/color-gradient.component.d.ts +9 -0
  18. package/dist/es2015/colorpicker/color-gradient.component.js +46 -15
  19. package/dist/es2015/colorpicker/color-input.component.d.ts +14 -6
  20. package/dist/es2015/colorpicker/color-input.component.js +123 -87
  21. package/dist/es2015/colorpicker/color-palette.component.d.ts +14 -5
  22. package/dist/es2015/colorpicker/color-palette.component.js +19 -16
  23. package/dist/es2015/colorpicker/constants.d.ts +25 -0
  24. package/dist/es2015/colorpicker/constants.js +24 -0
  25. package/dist/es2015/colorpicker/contrast-validation.component.d.ts +18 -0
  26. package/dist/es2015/colorpicker/contrast-validation.component.js +54 -0
  27. package/dist/es2015/colorpicker/contrast.component.d.ts +21 -0
  28. package/dist/es2015/colorpicker/contrast.component.js +72 -0
  29. package/dist/es2015/colorpicker/localization/messages.d.ts +12 -0
  30. package/dist/es2015/colorpicker/localization/messages.js +12 -0
  31. package/dist/es2015/colorpicker/models/rgb.d.ts +12 -0
  32. package/dist/es2015/colorpicker/models/rgb.js +4 -0
  33. package/dist/es2015/colorpicker/utils/color-parser.d.ts +25 -0
  34. package/dist/es2015/colorpicker/utils/color-parser.js +52 -0
  35. package/dist/es2015/colorpicker.module.js +5 -1
  36. package/dist/es2015/index.d.ts +2 -0
  37. package/dist/es2015/index.js +2 -0
  38. package/dist/es2015/index.metadata.json +1 -1
  39. package/dist/es2015/numerictextbox/numerictextbox.component.js +2 -2
  40. package/dist/es2015/numerictextbox/utils.d.ts +4 -0
  41. package/dist/es2015/numerictextbox/utils.js +8 -0
  42. package/dist/es2015/package-metadata.js +1 -1
  43. package/dist/fesm2015/index.js +394 -121
  44. package/dist/fesm5/index.js +276 -28
  45. package/dist/npm/colorpicker/color-gradient.component.js +24 -12
  46. package/dist/npm/colorpicker/color-input.component.js +35 -7
  47. package/dist/npm/colorpicker/color-palette.component.js +13 -11
  48. package/dist/npm/colorpicker/constants.js +26 -0
  49. package/dist/npm/colorpicker/contrast-validation.component.js +59 -0
  50. package/dist/npm/colorpicker/contrast.component.js +74 -0
  51. package/dist/npm/colorpicker/localization/messages.js +12 -0
  52. package/dist/npm/colorpicker/models/rgb.js +6 -0
  53. package/dist/npm/colorpicker/utils/color-parser.js +52 -0
  54. package/dist/npm/colorpicker.module.js +5 -1
  55. package/dist/npm/index.js +4 -0
  56. package/dist/npm/numerictextbox/numerictextbox.component.js +1 -1
  57. package/dist/npm/numerictextbox/utils.js +8 -0
  58. package/dist/npm/package-metadata.js +1 -1
  59. package/dist/systemjs/kendo-angular-inputs.js +1 -1
  60. package/package.json +4 -4
@@ -459,7 +459,7 @@ const packageMetadata = {
459
459
  name: '@progress/kendo-angular-inputs',
460
460
  productName: 'Kendo UI for Angular',
461
461
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
462
- publishDate: 1630597338,
462
+ publishDate: 1635258302,
463
463
  version: '',
464
464
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
465
465
  };
@@ -2939,6 +2939,14 @@ const extractSignificantNumericChars = (formattedString, separator) => {
2939
2939
  const significantCharacters = `${separator}0123456789-`;
2940
2940
  return formattedString.split('').reduce((acc, curr) => significantCharacters.includes(curr) ? ++acc : acc, 0);
2941
2941
  };
2942
+ /**
2943
+ * @hidden
2944
+ */
2945
+ const isRightClick = (event) => {
2946
+ const isRightClickIE = event.button && event.button === 2;
2947
+ const isRightClickOther = event.which && event.which === 3;
2948
+ return isRightClickIE || isRightClickOther;
2949
+ };
2942
2950
 
2943
2951
  /**
2944
2952
  * @hidden
@@ -3421,7 +3429,7 @@ let NumericTextBoxComponent = NumericTextBoxComponent_1 = class NumericTextBoxCo
3421
3429
  }
3422
3430
  arrowPress(direction, e) {
3423
3431
  e.preventDefault();
3424
- if (this.isDisabled) {
3432
+ if (this.isDisabled || isRightClick(e)) {
3425
3433
  return;
3426
3434
  }
3427
3435
  if (!mobileOS) {
@@ -7341,6 +7349,58 @@ function nameFormat(value, safe) {
7341
7349
  }
7342
7350
  return key;
7343
7351
  }
7352
+ /**
7353
+ * @hidden
7354
+ *
7355
+ * Returns the RGB object representation of the color based on the background color.
7356
+ */
7357
+ const getRGBFromRGBA = (foregroundColor, backgroundColor) => {
7358
+ const r1 = fitIntoBounds(foregroundColor.r, 0, 255);
7359
+ const g1 = fitIntoBounds(foregroundColor.g, 0, 255);
7360
+ const b1 = fitIntoBounds(foregroundColor.b, 0, 255);
7361
+ const a1 = fitIntoBounds(foregroundColor.a, 0, 1);
7362
+ const r2 = fitIntoBounds(backgroundColor.r, 0, 255);
7363
+ const g2 = fitIntoBounds(backgroundColor.g, 0, 255);
7364
+ const b2 = fitIntoBounds(backgroundColor.b, 0, 255);
7365
+ return {
7366
+ r: Math.round(((1 - a1) * r2) + (a1 * r1)),
7367
+ g: Math.round(((1 - a1) * g2) + (a1 * g1)),
7368
+ b: Math.round(((1 - a1) * b2) + (a1 * b1))
7369
+ };
7370
+ };
7371
+ /**
7372
+ * @hidden
7373
+ *
7374
+ * Returns the relative luminance.
7375
+ */
7376
+ const getLuminance = (rgb) => {
7377
+ let a = [rgb.r, rgb.g, rgb.b].map(function (v) {
7378
+ v /= 255;
7379
+ return v <= 0.03928
7380
+ ? v / 12.92
7381
+ : Math.pow((v + 0.055) / 1.055, 2.4);
7382
+ });
7383
+ return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
7384
+ };
7385
+ /**
7386
+ * @hidden
7387
+ *
7388
+ * Returns the color contrast.
7389
+ */
7390
+ const getContrast = (luminance1, luminance2) => {
7391
+ const brightest = Math.max(luminance1, luminance2);
7392
+ const darkest = Math.min(luminance1, luminance2);
7393
+ return (brightest + 0.05)
7394
+ / (darkest + 0.05);
7395
+ };
7396
+ /**
7397
+ * @hidden
7398
+ *
7399
+ * Returns the color contrast from two RGBA colors.
7400
+ */
7401
+ const getContrastFromTwoRGBAs = (a, b) => {
7402
+ return getContrast(getLuminance(getRGBFromRGBA(a, b)), getLuminance(getRGBFromRGBA(b, { r: 0, g: 0, b: 0, a: 1 })));
7403
+ };
7344
7404
 
7345
7405
  // tslint:disable:max-line-length
7346
7406
  /**
@@ -7443,9 +7503,10 @@ ColorGradientLocalizationService = __decorate([
7443
7503
  * @hidden
7444
7504
  */
7445
7505
  let ColorInputComponent = class ColorInputComponent {
7446
- constructor(localization, host) {
7506
+ constructor(localization, host, renderer) {
7447
7507
  this.localization = localization;
7448
7508
  this.host = host;
7509
+ this.renderer = renderer;
7449
7510
  /**
7450
7511
  * Sets whether the alpha slider will be shown.
7451
7512
  */
@@ -7467,6 +7528,7 @@ let ColorInputComponent = class ColorInputComponent {
7467
7528
  * The rgba inputs values.
7468
7529
  */
7469
7530
  this.rgba = {};
7531
+ this.subscriptions = new Subscription();
7470
7532
  }
7471
7533
  /**
7472
7534
  * Indicates whether any of the inputs are focused.
@@ -7484,6 +7546,14 @@ let ColorInputComponent = class ColorInputComponent {
7484
7546
  get rgbaInputValid() {
7485
7547
  return Object.keys(this.rgba).every(key => isPresent(this.rgba[key]));
7486
7548
  }
7549
+ ngAfterViewInit() {
7550
+ this.initDomEvents();
7551
+ }
7552
+ ngOnDestroy() {
7553
+ if (this.subscriptions) {
7554
+ this.subscriptions.unsubscribe();
7555
+ }
7556
+ }
7487
7557
  ngOnChanges(changes) {
7488
7558
  if (isPresent(changes.value) && !this.isFocused) {
7489
7559
  this.hex = parseColor$1(this.value, 'hex');
@@ -7519,13 +7589,23 @@ let ColorInputComponent = class ColorInputComponent {
7519
7589
  handleHexInputBlur() {
7520
7590
  this.hex = parseColor$1(this.value, 'hex');
7521
7591
  }
7522
- /**
7523
- * @hidden
7524
- */
7525
7592
  textFor(key) {
7526
7593
  return this.localization.get(key);
7527
7594
  }
7595
+ toggleFormatView() {
7596
+ this.formatView = this.formatView === 'hex' ? 'rgba' : 'hex';
7597
+ }
7598
+ initDomEvents() {
7599
+ if (!this.host) {
7600
+ return;
7601
+ }
7602
+ this.subscriptions.add(this.renderer.listen(this.toggleFormatButton.nativeElement, 'click', () => this.toggleFormatView()));
7603
+ }
7528
7604
  };
7605
+ __decorate([
7606
+ Input(),
7607
+ __metadata("design:type", String)
7608
+ ], ColorInputComponent.prototype, "formatView", void 0);
7529
7609
  __decorate([
7530
7610
  Input(),
7531
7611
  __metadata("design:type", String)
@@ -7547,109 +7627,142 @@ __decorate([
7547
7627
  __metadata("design:type", EventEmitter)
7548
7628
  ], ColorInputComponent.prototype, "valueChange", void 0);
7549
7629
  __decorate([
7550
- HostBinding('class.k-colorinputs'),
7630
+ HostBinding('class.k-colorgradient-inputs'),
7631
+ HostBinding('class.k-hstack'),
7551
7632
  __metadata("design:type", Boolean)
7552
7633
  ], ColorInputComponent.prototype, "colorInputClass", void 0);
7553
7634
  __decorate([
7554
7635
  ViewChild('opacityInput', { read: ElementRef, static: false }),
7555
7636
  __metadata("design:type", ElementRef)
7556
7637
  ], ColorInputComponent.prototype, "opacityInput", void 0);
7638
+ __decorate([
7639
+ ViewChild('toggleFormatButton', { static: false }),
7640
+ __metadata("design:type", ElementRef)
7641
+ ], ColorInputComponent.prototype, "toggleFormatButton", void 0);
7557
7642
  ColorInputComponent = __decorate([
7558
7643
  Component({
7559
7644
  selector: 'kendo-colorinput',
7560
7645
  template: `
7561
- <div class="k-hbox k-gradient-values">
7562
- <input
7563
- #hexInput
7564
- class="k-textbox k-hex-value"
7565
- [disabled]="disabled"
7566
- [readonly]="readonly"
7567
- [value]="hex || ''"
7568
- [placeholder]="textFor('hexInputPlaceholder')"
7569
- (blur)="handleHexInputBlur()"
7570
- (input)="handleHexValueChange(hexInput.value)"
7571
- />
7572
- <kendo-numerictextbox
7573
- [disabled]="disabled"
7574
- [readonly]="readonly"
7575
- [min]="0"
7576
- [max]="255"
7577
- [placeholder]="textFor('redInputPlaceholder')"
7578
- [(value)]="rgba.r"
7579
- [autoCorrect]="true"
7580
- [spinners]="false"
7581
- [format]="'n'"
7582
- [decimals]="0"
7583
- (blur)="handleRgbaInputBlur()"
7584
- (valueChange)="handleRgbaValueChange()"
7585
- >
7586
- </kendo-numerictextbox>
7587
- <kendo-numerictextbox
7588
- [disabled]="disabled"
7589
- [readonly]="readonly"
7590
- [min]="0"
7591
- [max]="255"
7592
- [placeholder]="textFor('greenInputPlaceholder')"
7593
- [(value)]="rgba.g"
7594
- [autoCorrect]="true"
7595
- [spinners]="false"
7596
- [format]="'n'"
7597
- [decimals]="0"
7598
- (blur)="handleRgbaInputBlur()"
7599
- (valueChange)="handleRgbaValueChange()"
7600
- >
7601
- </kendo-numerictextbox>
7602
- <kendo-numerictextbox
7603
- [disabled]="disabled"
7604
- [readonly]="readonly"
7605
- [min]="0"
7606
- [max]="255"
7607
- [placeholder]="textFor('blueInputPlaceholder')"
7608
- [(value)]="rgba.b"
7609
- [autoCorrect]="true"
7610
- [spinners]="false"
7611
- [format]="'n'"
7612
- [decimals]="0"
7613
- (blur)="handleRgbaInputBlur()"
7614
- (valueChange)="handleRgbaValueChange()"
7615
- >
7616
- </kendo-numerictextbox>
7617
- <kendo-numerictextbox #opacityInput
7618
- *ngIf="opacity"
7619
- [disabled]="disabled"
7620
- [readonly]="readonly"
7621
- [min]="0"
7622
- [max]="1"
7623
- [placeholder]="textFor('alphaInputPlaceholder')"
7624
- [(value)]="rgba.a"
7625
- [autoCorrect]="true"
7626
- [spinners]="false"
7627
- [step]="0.01"
7628
- [format]="'n2'"
7629
- [decimals]="2"
7630
- (blur)="handleRgbaInputBlur()"
7631
- (valueChange)="handleRgbaValueChange()"
7632
- >
7633
- </kendo-numerictextbox>
7634
- </div>
7635
- <div class="k-hbox k-gradient-values">
7636
- <div class="k-hex-value">hex</div>
7637
- <div>r</div>
7638
- <div>g</div>
7639
- <div>b</div>
7640
- <div *ngIf="opacity">a</div>
7646
+ <div class="k-vstack">
7647
+ <button class="k-colorgradient-toggle-mode k-button k-icon-button k-flat" #toggleFormatButton>
7648
+ <span class="k-button-icon k-icon k-i-arrows-kpi"></span>
7649
+ </button>
7641
7650
  </div>
7651
+ <input *ngIf="formatView === 'hex'"
7652
+ #hexInput
7653
+ class="k-textbox k-hex-value"
7654
+ [disabled]="disabled"
7655
+ [readonly]="readonly"
7656
+ [value]="hex || ''"
7657
+ [placeholder]="textFor('hexInputPlaceholder')"
7658
+ (blur)="handleHexInputBlur()"
7659
+ (input)="handleHexValueChange(hexInput.value)"
7660
+ />
7661
+ <ng-container *ngIf="formatView === 'rgba'">
7662
+ <div class="k-vstack">
7663
+ <kendo-numerictextbox
7664
+ #red
7665
+ [disabled]="disabled"
7666
+ [readonly]="readonly"
7667
+ [min]="0"
7668
+ [max]="255"
7669
+ [placeholder]="textFor('redInputPlaceholder')"
7670
+ [(value)]="rgba.r"
7671
+ [autoCorrect]="true"
7672
+ [spinners]="false"
7673
+ [format]="'n'"
7674
+ [decimals]="0"
7675
+ (blur)="handleRgbaInputBlur()"
7676
+ (valueChange)="handleRgbaValueChange()">
7677
+ </kendo-numerictextbox>
7678
+ <label [for]="red.focusableId" class="k-colorgradient-input-label">R</label>
7679
+ </div>
7680
+ <div class="k-vstack">
7681
+ <kendo-numerictextbox
7682
+ #green
7683
+ [disabled]="disabled"
7684
+ [readonly]="readonly"
7685
+ [min]="0"
7686
+ [max]="255"
7687
+ [placeholder]="textFor('greenInputPlaceholder')"
7688
+ [(value)]="rgba.g"
7689
+ [autoCorrect]="true"
7690
+ [spinners]="false"
7691
+ [format]="'n'"
7692
+ [decimals]="0"
7693
+ (blur)="handleRgbaInputBlur()"
7694
+ (valueChange)="handleRgbaValueChange()">
7695
+ </kendo-numerictextbox>
7696
+ <label [for]="green.focusableId" class="k-colorgradient-input-label">G</label>
7697
+ </div>
7698
+ <div class="k-vstack">
7699
+ <kendo-numerictextbox
7700
+ #blue
7701
+ [disabled]="disabled"
7702
+ [readonly]="readonly"
7703
+ [min]="0"
7704
+ [max]="255"
7705
+ [placeholder]="textFor('blueInputPlaceholder')"
7706
+ [(value)]="rgba.b"
7707
+ [autoCorrect]="true"
7708
+ [spinners]="false"
7709
+ [format]="'n'"
7710
+ [decimals]="0"
7711
+ (blur)="handleRgbaInputBlur()"
7712
+ (valueChange)="handleRgbaValueChange()">
7713
+ </kendo-numerictextbox>
7714
+ <label [for]="blue.focusableId" class="k-colorgradient-input-label">B</label>
7715
+ </div>
7716
+ <div class="k-vstack" *ngIf="opacity">
7717
+ <kendo-numerictextbox #opacityInput
7718
+ #alpha
7719
+ [disabled]="disabled"
7720
+ [readonly]="readonly"
7721
+ [min]="0"
7722
+ [max]="1"
7723
+ [placeholder]="textFor('alphaInputPlaceholder')"
7724
+ [(value)]="rgba.a"
7725
+ [autoCorrect]="true"
7726
+ [spinners]="false"
7727
+ [step]="0.01"
7728
+ [format]="'n2'"
7729
+ [decimals]="2"
7730
+ (blur)="handleRgbaInputBlur()"
7731
+ (valueChange)="handleRgbaValueChange()">
7732
+ </kendo-numerictextbox>
7733
+ <label [for]="alpha.focusableId" class="k-colorgradient-input-label">A</label>
7734
+ </div>
7735
+ </ng-container>
7642
7736
  `
7643
7737
  }),
7644
7738
  __metadata("design:paramtypes", [LocalizationService,
7645
- ElementRef])
7739
+ ElementRef,
7740
+ Renderer2])
7646
7741
  ], ColorInputComponent);
7647
7742
 
7648
- var ColorGradientComponent_1;
7743
+ /**
7744
+ * @hidden
7745
+ */
7649
7746
  const DEFAULT_OUTPUT_FORMAT = 'rgba';
7650
- const DEFAULT_BACKGROUND_COLOR = 'rgba(255, 0, 0, 1)';
7651
- let serial = 0;
7747
+ /**
7748
+ * @hidden
7749
+ */
7750
+ const DEFAULT_GRADIENT_BACKGROUND_COLOR = 'rgba(255, 0, 0, 1)';
7751
+ /**
7752
+ * @hidden
7753
+ */
7652
7754
  const DRAGHANDLE_MOVE_SPEED = 5;
7755
+ /**
7756
+ * @hidden
7757
+ */
7758
+ const AAA_RATIO = 7.0;
7759
+ /**
7760
+ * @hidden
7761
+ */
7762
+ const AA_RATIO = 4.5;
7763
+
7764
+ var ColorGradientComponent_1;
7765
+ let serial = 0;
7653
7766
  /**
7654
7767
  * The ColorGradient component enables smooth color transitions and provides options for selecting specific colors over the drag handle.
7655
7768
  * The ColorGradient is independently used by `kendo-colorpicker` and can be directly added to the page.
@@ -7698,7 +7811,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7698
7811
  /**
7699
7812
  * @hidden
7700
7813
  */
7701
- this.backgroundColor = DEFAULT_BACKGROUND_COLOR;
7814
+ this.backgroundColor = DEFAULT_GRADIENT_BACKGROUND_COLOR;
7702
7815
  /**
7703
7816
  * @hidden
7704
7817
  *
@@ -7792,6 +7905,12 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7792
7905
  get gradientRect() {
7793
7906
  return this.gradientWrapper.nativeElement.getBoundingClientRect();
7794
7907
  }
7908
+ /**
7909
+ * @hidden
7910
+ */
7911
+ get contrastToolVisible() {
7912
+ return typeof this.contrastTool === 'string' && this.contrastTool !== '';
7913
+ }
7795
7914
  ngAfterViewInit() {
7796
7915
  this.updateUI();
7797
7916
  this.cdr.detectChanges();
@@ -8082,8 +8201,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
8082
8201
  }
8083
8202
  };
8084
8203
  __decorate([
8085
- HostBinding('class.k-widget'),
8086
- HostBinding('class.k-flatcolorpicker'),
8204
+ HostBinding('class.k-colorgradient'),
8087
8205
  __metadata("design:type", Boolean)
8088
8206
  ], ColorGradientComponent.prototype, "hostClasses", void 0);
8089
8207
  __decorate([
@@ -8139,6 +8257,10 @@ __decorate([
8139
8257
  __metadata("design:type", String),
8140
8258
  __metadata("design:paramtypes", [String])
8141
8259
  ], ColorGradientComponent.prototype, "value", null);
8260
+ __decorate([
8261
+ Input(),
8262
+ __metadata("design:type", String)
8263
+ ], ColorGradientComponent.prototype, "contrastTool", void 0);
8142
8264
  __decorate([
8143
8265
  Input(),
8144
8266
  __metadata("design:type", Number),
@@ -8212,10 +8334,16 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8212
8334
  i18n-blueInputPlaceholder="kendo.colorgradient.blueInputPlaceholder|The placeholder for the blue color input."
8213
8335
  blueInputPlaceholder="Blue"
8214
8336
  i18n-alphaInputPlaceholder="kendo.colorgradient.alphaInputPlaceholder|The placeholder for the alpha input."
8215
- alphaInputPlaceholder="Alpha">
8337
+ alphaInputPlaceholder="Alpha"
8338
+ i18n-passContrast="kendo.colorgradient.passContrast|The pass message for the contrast tool."
8339
+ passContrast="Pass"
8340
+ i18n-failContrast="kendo.colorgradient.failContrast|The fail message for the contrast tool."
8341
+ failContrast="Fail"
8342
+ i18n-contrastRatio="kendo.colorgradient.contrastRatio|The contrast ratio message for the contrast tool."
8343
+ contrastRatio="Contrast ratio">
8216
8344
  </ng-container>
8217
- <div class="k-hbox k-hsv-wrap">
8218
- <div class="k-hsv-rectangle" [style.background-color]="backgroundColor">
8345
+ <div class="k-colorgradient-canvas k-hstack">
8346
+ <div class="k-hsv-rectangle" [style.background]="backgroundColor">
8219
8347
  <div
8220
8348
  #gradientWrapper
8221
8349
  kendoDraggable
@@ -8226,7 +8354,7 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8226
8354
  (kendoRelease)="onHandleRelease()">
8227
8355
  <div
8228
8356
  #gradientDragHandle
8229
- class="k-draghandle"
8357
+ class="k-hsv-draghandle k-draghandle"
8230
8358
  tabindex="0"
8231
8359
  [attr.title]="colorGradientHandleTitle"
8232
8360
  [attr.aria-label]="colorGradientHandleAriaLabel"
@@ -8234,8 +8362,8 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8234
8362
  </div>
8235
8363
  </div>
8236
8364
  </div>
8237
- <div class="k-hbox k-sliders-wrap {{ clearButton ? 'k-sliders-wrap-clearable' : '' }}">
8238
- <span class="k-clear-color k-button k-bare k-button-icon"
8365
+ <div class="k-hsv-controls k-hstack {{ clearButton ? 'k-sliders-wrap-clearable' : '' }}">
8366
+ <span class="k-clear-color k-button k-flat k-button-icon"
8239
8367
  *ngIf="clearButton"
8240
8368
  (click)="reset()"
8241
8369
  (keydown.enter)="reset()"
@@ -8246,7 +8374,8 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8246
8374
  <span class="k-icon k-i-reset-color"></span>
8247
8375
  </span>
8248
8376
  <kendo-slider
8249
- class="k-hue-slider"
8377
+ [ngClass]="{'k-align-self-end': clearButton}"
8378
+ class="k-hue-slider k-colorgradient-slider"
8250
8379
  [dragHandleTitle]="hueSliderTitle"
8251
8380
  [disabled]="disabled"
8252
8381
  [readonly]="readonly"
@@ -8264,7 +8393,8 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8264
8393
  <kendo-slider
8265
8394
  *ngIf="opacity && format === 'rgba'"
8266
8395
  #alphaSlider
8267
- class="k-alpha-slider"
8396
+ [ngClass]="{'k-align-self-end': clearButton}"
8397
+ class="k-alpha-slider k-colorgradient-slider"
8268
8398
  [dragHandleTitle]="opacitySliderTitle"
8269
8399
  [disabled]="disabled"
8270
8400
  [readonly]="readonly"
@@ -8283,13 +8413,29 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8283
8413
  </div>
8284
8414
  <kendo-colorinput #inputs
8285
8415
  [opacity]="opacity"
8416
+ [formatView]="format"
8286
8417
  [value]="value"
8287
8418
  [disabled]="disabled"
8288
8419
  [readonly]="readonly"
8289
8420
  (valueChange)="handleInputsValueChange($event)"
8290
8421
  >
8291
8422
  </kendo-colorinput>
8292
- `
8423
+ <div class="k-colorgradient-color-contrast k-vbox" *ngIf="contrastToolVisible"
8424
+ kendoContrastTool
8425
+ [value]="value"
8426
+ [ratio]="contrastTool">
8427
+ </div>
8428
+ `,
8429
+ styles: [`
8430
+ .k-clear-color {
8431
+ position: absolute;
8432
+ left: 50%;
8433
+ transform: translateX(-50%);
8434
+ }
8435
+ .k-align-self-end {
8436
+ height: 140px;
8437
+ }
8438
+ `]
8293
8439
  }),
8294
8440
  __metadata("design:paramtypes", [ElementRef,
8295
8441
  NgZone,
@@ -9228,15 +9374,18 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
9228
9374
  */
9229
9375
  handleHostBlur() {
9230
9376
  this.notifyNgTouched();
9377
+ this.handleCellFocusOnBlur();
9231
9378
  }
9232
9379
  /**
9233
9380
  * @hidden
9234
9381
  */
9235
- handleCellSelection(value, focusedCell) {
9382
+ handleCellSelection(value, cell) {
9236
9383
  if (this.readonly) {
9237
9384
  return;
9238
9385
  }
9239
- this.focusedCell = focusedCell;
9386
+ this.selectedCell = cell;
9387
+ this.focusedCell = this.selectedCell;
9388
+ this.focusInComponent = true;
9240
9389
  const parsedColor = parseColor$1(value, this.format, false);
9241
9390
  this.cellSelection.emit(parsedColor);
9242
9391
  if (this.value !== parsedColor) {
@@ -9249,8 +9398,8 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
9249
9398
  this.selection = parsedColor;
9250
9399
  this.selectionChange.emit(parsedColor);
9251
9400
  }
9252
- if (focusedCell) {
9253
- this.activeCellId = `${this.focusedCell.row}${this.focusedCell.col}`;
9401
+ if (cell) {
9402
+ this.activeCellId = `${this.selectedCell.row}-${this.selectedCell.col}`;
9254
9403
  }
9255
9404
  }
9256
9405
  /**
@@ -9296,6 +9445,10 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
9296
9445
  this.notifyNgChanged(undefined);
9297
9446
  }
9298
9447
  }
9448
+ handleCellFocusOnBlur() {
9449
+ this.focusInComponent = false;
9450
+ this.focusedCell = this.selectedCell;
9451
+ }
9299
9452
  setRows() {
9300
9453
  if (!isPresent(this.palette)) {
9301
9454
  return;
@@ -9308,11 +9461,7 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
9308
9461
  return;
9309
9462
  }
9310
9463
  this.focusedCell = this.service.getNextCell(this.focusedCell, horizontalStep, verticalStep);
9311
- const selection = this.service.getColorAt(this.focusedCell);
9312
- if (this.selection !== selection) {
9313
- this.selection = selection;
9314
- this.selectionChange.emit(selection);
9315
- }
9464
+ this.focusInComponent = true;
9316
9465
  }
9317
9466
  setHostElementAriaLabel() {
9318
9467
  const parsed = parseColor$1(this.value, this.format);
@@ -9393,7 +9542,6 @@ __decorate([
9393
9542
  __metadata("design:paramtypes", [])
9394
9543
  ], ColorPaletteComponent.prototype, "hostTabindex", null);
9395
9544
  __decorate([
9396
- HostBinding('class.k-widget'),
9397
9545
  HostBinding('class.k-colorpalette'),
9398
9546
  __metadata("design:type", Boolean)
9399
9547
  ], ColorPaletteComponent.prototype, "hostClasses", void 0);
@@ -9448,18 +9596,19 @@ ColorPaletteComponent = ColorPaletteComponent_1 = __decorate([
9448
9596
  i18n-colorPaletteNoColor="kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
9449
9597
  colorPaletteNoColor="Colorpalette no color chosen">
9450
9598
  </ng-container>
9451
- <div role="listbox"
9599
+ <div role="listbox" class="k-colorpalette-table-wrap"
9452
9600
  [attr.aria-activedescendant]="activeCellId">
9453
- <table class="k-palette k-reset">
9601
+ <table class="k-colorpalette-table k-palette">
9454
9602
  <tbody>
9455
9603
  <tr *ngFor="let row of colorRows; let rowIndex = index">
9456
9604
  <td *ngFor="let color of row; let colIndex = index"
9457
9605
  role="option"
9458
- [class.k-state-selected]="focusedCell?.row === rowIndex && focusedCell?.col === colIndex"
9459
- [attr.aria-selected]="focusedCell?.row === rowIndex && focusedCell?.col === colIndex"
9606
+ [class.k-state-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
9607
+ [class.k-state-focus]="focusInComponent && focusedCell?.row === rowIndex && focusedCell?.col === colIndex"
9608
+ [attr.aria-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
9460
9609
  [attr.aria-label]="color"
9461
- class="k-item"
9462
- [id]="rowIndex + '' + colIndex"
9610
+ class="k-colorpalette-tile"
9611
+ [id]="rowIndex + '-' + colIndex"
9463
9612
  [attr.value]="color"
9464
9613
  (click)="handleCellSelection(color, { row: rowIndex, col: colIndex })"
9465
9614
  [ngStyle]="{
@@ -9531,6 +9680,18 @@ __decorate([
9531
9680
  Input(),
9532
9681
  __metadata("design:type", String)
9533
9682
  ], ColorPickerMessages.prototype, "alphaInputPlaceholder", void 0);
9683
+ __decorate([
9684
+ Input(),
9685
+ __metadata("design:type", String)
9686
+ ], ColorPickerMessages.prototype, "passContrast", void 0);
9687
+ __decorate([
9688
+ Input(),
9689
+ __metadata("design:type", String)
9690
+ ], ColorPickerMessages.prototype, "failContrast", void 0);
9691
+ __decorate([
9692
+ Input(),
9693
+ __metadata("design:type", String)
9694
+ ], ColorPickerMessages.prototype, "contrastRatio", void 0);
9534
9695
 
9535
9696
  var ColorPickerCustomMessagesComponent_1;
9536
9697
  /**
@@ -9605,6 +9766,116 @@ FocusOnDomReadyDirective = __decorate([
9605
9766
  NgZone])
9606
9767
  ], FocusOnDomReadyDirective);
9607
9768
 
9769
+ /**
9770
+ * @hidden
9771
+ */
9772
+ let ContrastValidationComponent = class ContrastValidationComponent {
9773
+ constructor(localization) {
9774
+ this.localization = localization;
9775
+ }
9776
+ get passMessage() {
9777
+ return this.localization.get('passContrast');
9778
+ }
9779
+ get failMessage() {
9780
+ return this.localization.get('failContrast');
9781
+ }
9782
+ get contrastText() {
9783
+ return `${this.type}: ${this.ratio.toFixed(1)}`;
9784
+ }
9785
+ };
9786
+ __decorate([
9787
+ Input(),
9788
+ __metadata("design:type", String)
9789
+ ], ContrastValidationComponent.prototype, "type", void 0);
9790
+ __decorate([
9791
+ Input(),
9792
+ __metadata("design:type", Number)
9793
+ ], ContrastValidationComponent.prototype, "ratio", void 0);
9794
+ __decorate([
9795
+ Input(),
9796
+ __metadata("design:type", Boolean)
9797
+ ], ContrastValidationComponent.prototype, "pass", void 0);
9798
+ ContrastValidationComponent = __decorate([
9799
+ Component({
9800
+ selector: '[kendoContrastValidation]',
9801
+ template: `
9802
+ <span>{{contrastText}}</span>
9803
+ <span class="k-contrast-validation k-text-success" *ngIf="pass">
9804
+ {{passMessage}}
9805
+ <span class="k-icon k-i-check"></span>
9806
+ </span>
9807
+ <span class="k-contrast-validation k-text-error" *ngIf="!pass">
9808
+ {{failMessage}}
9809
+ <span class="k-icon k-i-close"></span>
9810
+ </span>
9811
+ `
9812
+ }),
9813
+ __metadata("design:paramtypes", [LocalizationService])
9814
+ ], ContrastValidationComponent);
9815
+
9816
+ /**
9817
+ * @hidden
9818
+ */
9819
+ let ContrastComponent = class ContrastComponent {
9820
+ constructor(localization) {
9821
+ this.localization = localization;
9822
+ this.aaRatio = AA_RATIO;
9823
+ this.aaaRatio = AAA_RATIO;
9824
+ }
9825
+ get formatedRatio() {
9826
+ return this.contrastRatio.toFixed(2);
9827
+ }
9828
+ get contrastRatioMessage() {
9829
+ return this.localization.get('contrastRatio');
9830
+ }
9831
+ get satisfiesAACondition() {
9832
+ return this.contrastRatio >= this.aaRatio;
9833
+ }
9834
+ get satisfiesAAACondition() {
9835
+ return this.contrastRatio >= this.aaaRatio;
9836
+ }
9837
+ get contrastRatio() {
9838
+ let contrast = getContrastFromTwoRGBAs(getRGBA(this.value), getRGBA(this.ratio));
9839
+ return contrast;
9840
+ }
9841
+ };
9842
+ __decorate([
9843
+ Input(),
9844
+ __metadata("design:type", String)
9845
+ ], ContrastComponent.prototype, "value", void 0);
9846
+ __decorate([
9847
+ Input(),
9848
+ __metadata("design:type", String)
9849
+ ], ContrastComponent.prototype, "ratio", void 0);
9850
+ ContrastComponent = __decorate([
9851
+ Component({
9852
+ selector: '[kendoContrastTool]',
9853
+ template: `
9854
+ <div class="k-contrast-ratio">
9855
+ <span class="k-contrast-ratio-text">{{contrastRatioMessage}}: {{formatedRatio}}</span>
9856
+ <span class="k-contrast-validation k-text-success" *ngIf="satisfiesAACondition">
9857
+ <span class="k-icon k-i-check"></span>
9858
+ <span class="k-icon k-i-check" *ngIf="satisfiesAAACondition"></span>
9859
+ </span>
9860
+ <span class="k-contrast-validation k-text-error" *ngIf="!satisfiesAACondition">
9861
+ <span class="k-icon k-i-close"></span>
9862
+ </span>
9863
+ </div>
9864
+ <div kendoContrastValidation
9865
+ type="AA"
9866
+ [ratio]="aaaRatio"
9867
+ [pass]="satisfiesAACondition">
9868
+ </div>
9869
+ <div kendoContrastValidation
9870
+ type="AAA"
9871
+ [ratio]="aaaRatio"
9872
+ [pass]="satisfiesAAACondition">
9873
+ </div>
9874
+ `
9875
+ }),
9876
+ __metadata("design:paramtypes", [LocalizationService])
9877
+ ], ContrastComponent);
9878
+
9608
9879
  const PUBLIC_DIRECTIVES = [
9609
9880
  ColorPickerComponent,
9610
9881
  ColorPaletteComponent,
@@ -9614,7 +9885,9 @@ const PUBLIC_DIRECTIVES = [
9614
9885
  ];
9615
9886
  const INTERNAL_DIRECTIVES = [
9616
9887
  ColorInputComponent,
9617
- FocusOnDomReadyDirective
9888
+ FocusOnDomReadyDirective,
9889
+ ContrastComponent,
9890
+ ContrastValidationComponent
9618
9891
  ];
9619
9892
  /**
9620
9893
  * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
@@ -10281,4 +10554,4 @@ InputsModule = __decorate([
10281
10554
  * Generated bundle index. Do not edit.
10282
10555
  */
10283
10556
 
10284
- export { CheckBoxModule, ColorInputComponent, FocusOnDomReadyDirective, ColorGradientLocalizationService, ColorPaletteLocalizationService, ColorPickerLocalizationService, ColorPickerCustomMessagesComponent, ColorPickerMessages, ColorPaletteService, MaskingService, NumericTextBoxMessages, RadioButtonModule, RangeSliderCustomMessagesComponent, RangeSliderMessages, SHARED_DIRECTIVES, SliderCustomMessagesComponent, SliderMessages, SliderBase, SlidersCommonModule, SwitchCustomMessagesComponent, Messages, TextFieldsBase, TextBoxCustomMessagesComponent, TextBoxMessages, SliderComponent, RangeSliderComponent, LabelTemplateDirective, SwitchComponent, TextBoxContainerComponent, TextBoxDirective, TextAreaDirective, NumericTextBoxComponent, NumericTextBoxCustomMessagesComponent, MaskedTextBoxComponent, InputsModule, SliderTicksComponent, SliderModule, RangeSliderModule, SwitchModule, NumericTextBoxModule, MaskedTextBoxModule, TextBoxModule, TextAreaModule, ColorPickerComponent, ColorPaletteComponent, ColorGradientComponent, ColorPickerModule, ActiveColorClickEvent, CheckBoxDirective, RadioButtonDirective, HintComponent, ErrorComponent, FormFieldComponent, FormFieldModule, TextBoxComponent, TextBoxPrefixTemplateDirective, TextBoxSuffixTemplateDirective, TextAreaComponent, TextAreaSuffixComponent, InputSeparatorComponent, SharedModule, LocalizedColorPickerMessagesDirective, LocalizedNumericTextBoxMessagesDirective, LocalizedTextBoxMessagesDirective, LocalizedSliderMessagesDirective, LocalizedRangeSliderMessagesDirective, LocalizedSwitchMessagesDirective };
10557
+ export { CheckBoxModule, ColorInputComponent, ContrastValidationComponent, ContrastComponent, FocusOnDomReadyDirective, ColorGradientLocalizationService, ColorPaletteLocalizationService, ColorPickerLocalizationService, ColorPickerCustomMessagesComponent, ColorPickerMessages, ColorPaletteService, MaskingService, NumericTextBoxMessages, RadioButtonModule, RangeSliderCustomMessagesComponent, RangeSliderMessages, SHARED_DIRECTIVES, SliderCustomMessagesComponent, SliderMessages, SliderBase, SlidersCommonModule, SwitchCustomMessagesComponent, Messages, TextFieldsBase, TextBoxCustomMessagesComponent, TextBoxMessages, SliderComponent, RangeSliderComponent, LabelTemplateDirective, SwitchComponent, TextBoxContainerComponent, TextBoxDirective, TextAreaDirective, NumericTextBoxComponent, NumericTextBoxCustomMessagesComponent, MaskedTextBoxComponent, InputsModule, SliderTicksComponent, SliderModule, RangeSliderModule, SwitchModule, NumericTextBoxModule, MaskedTextBoxModule, TextBoxModule, TextAreaModule, ColorPickerComponent, ColorPaletteComponent, ColorGradientComponent, ColorPickerModule, ActiveColorClickEvent, CheckBoxDirective, RadioButtonDirective, HintComponent, ErrorComponent, FormFieldComponent, FormFieldModule, TextBoxComponent, TextBoxPrefixTemplateDirective, TextBoxSuffixTemplateDirective, TextAreaComponent, TextAreaSuffixComponent, InputSeparatorComponent, SharedModule, LocalizedColorPickerMessagesDirective, LocalizedNumericTextBoxMessagesDirective, LocalizedTextBoxMessagesDirective, LocalizedSliderMessagesDirective, LocalizedRangeSliderMessagesDirective, LocalizedSwitchMessagesDirective };