@progress/kendo-angular-inputs 7.5.1-dev.202110280909 → 8.0.0-dev.202112161434

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 (158) 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-contrast-svg.component.js +95 -0
  4. package/dist/es/colorpicker/color-gradient.component.js +109 -81
  5. package/dist/es/colorpicker/color-input.component.js +39 -18
  6. package/dist/es/colorpicker/color-palette.component.js +28 -18
  7. package/dist/es/colorpicker/colorpicker.component.js +170 -76
  8. package/dist/es/colorpicker/constants.js +12 -0
  9. package/dist/es/colorpicker/contrast-validation.component.js +8 -6
  10. package/dist/es/colorpicker/contrast.component.js +6 -8
  11. package/dist/es/colorpicker/{models → events}/active-color-click-event.js +0 -0
  12. package/dist/es/colorpicker/events/cancel-event.js +19 -0
  13. package/dist/es/colorpicker/events/close-event.js +17 -0
  14. package/dist/es/colorpicker/{models → events}/kendo-drag-event.js +0 -0
  15. package/dist/es/colorpicker/events/open-event.js +17 -0
  16. package/dist/es/colorpicker/events.js +8 -0
  17. package/dist/es/colorpicker/flatcolorpicker-actions.component.js +50 -0
  18. package/dist/es/colorpicker/flatcolorpicker-header.component.js +94 -0
  19. package/dist/es/colorpicker/flatcolorpicker.component.js +553 -0
  20. package/dist/es/colorpicker/localization/colorgradient-localization.service.js +7 -7
  21. package/dist/es/colorpicker/localization/colorpalette-localization.service.js +7 -7
  22. package/dist/es/colorpicker/localization/custom-messages.component.js +1 -1
  23. package/dist/es/colorpicker/localization/flatcolorpicker-localization.service.js +34 -0
  24. package/dist/es/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  25. package/dist/es/colorpicker/localization/messages.js +36 -0
  26. package/dist/es/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
  27. package/dist/{es2015/colorpicker/models/color-picker-view.js → es/colorpicker/models/colorpicker-view.js} +0 -0
  28. package/dist/es/colorpicker/{utils → models}/palette-presets.js +0 -0
  29. package/dist/es/colorpicker/models.js +1 -2
  30. package/dist/es/colorpicker/services/flatcolorpicker.service.js +41 -0
  31. package/dist/es/colorpicker/utils/color-parser.js +18 -5
  32. package/dist/es/colorpicker/utils/contrast-curve.js +91 -0
  33. package/dist/es/colorpicker/utils.js +1 -1
  34. package/dist/es/colorpicker.module.js +9 -1
  35. package/dist/es/index.js +5 -0
  36. package/dist/es/main.js +4 -1
  37. package/dist/es/package-metadata.js +1 -1
  38. package/dist/es/shared/utils.js +23 -0
  39. package/dist/es/textbox/textbox.component.js +3 -1
  40. package/dist/es2015/colorpicker/color-contrast-svg.component.d.ts +26 -0
  41. package/dist/es2015/colorpicker/color-contrast-svg.component.js +97 -0
  42. package/dist/es2015/colorpicker/color-gradient.component.d.ts +32 -43
  43. package/dist/es2015/colorpicker/color-gradient.component.js +125 -92
  44. package/dist/es2015/colorpicker/color-input.component.d.ts +11 -4
  45. package/dist/es2015/colorpicker/color-input.component.js +52 -32
  46. package/dist/es2015/colorpicker/color-palette.component.d.ts +8 -3
  47. package/dist/es2015/colorpicker/color-palette.component.js +28 -18
  48. package/dist/es2015/colorpicker/colorpicker.component.d.ts +84 -24
  49. package/dist/es2015/colorpicker/colorpicker.component.js +195 -112
  50. package/dist/es2015/colorpicker/constants.d.ts +12 -0
  51. package/dist/es2015/colorpicker/constants.js +12 -0
  52. package/dist/es2015/colorpicker/contrast-validation.component.d.ts +1 -1
  53. package/dist/es2015/colorpicker/contrast-validation.component.js +16 -12
  54. package/dist/es2015/colorpicker/contrast.component.d.ts +1 -3
  55. package/dist/es2015/colorpicker/contrast.component.js +17 -17
  56. package/dist/es2015/colorpicker/{models → events}/active-color-click-event.d.ts +0 -0
  57. package/dist/es2015/colorpicker/{models → events}/active-color-click-event.js +0 -0
  58. package/dist/es2015/colorpicker/events/cancel-event.d.ts +15 -0
  59. package/dist/es2015/colorpicker/events/cancel-event.js +14 -0
  60. package/dist/es2015/colorpicker/events/close-event.d.ts +10 -0
  61. package/dist/es2015/colorpicker/events/close-event.js +10 -0
  62. package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.d.ts +0 -0
  63. package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.js +0 -0
  64. package/dist/es2015/colorpicker/events/open-event.d.ts +10 -0
  65. package/dist/es2015/colorpicker/events/open-event.js +10 -0
  66. package/dist/es2015/colorpicker/events.d.ts +8 -0
  67. package/dist/es2015/colorpicker/events.js +8 -0
  68. package/dist/es2015/colorpicker/flatcolorpicker-actions.component.d.ts +18 -0
  69. package/dist/es2015/colorpicker/flatcolorpicker-actions.component.js +60 -0
  70. package/dist/es2015/colorpicker/flatcolorpicker-header.component.d.ts +30 -0
  71. package/dist/es2015/colorpicker/flatcolorpicker-header.component.js +131 -0
  72. package/dist/es2015/colorpicker/flatcolorpicker.component.d.ts +214 -0
  73. package/dist/es2015/colorpicker/flatcolorpicker.component.js +593 -0
  74. package/dist/es2015/colorpicker/localization/colorgradient-localization.service.d.ts +3 -3
  75. package/dist/es2015/colorpicker/localization/colorgradient-localization.service.js +7 -7
  76. package/dist/es2015/colorpicker/localization/colorpalette-localization.service.d.ts +3 -3
  77. package/dist/es2015/colorpicker/localization/colorpalette-localization.service.js +7 -7
  78. package/dist/es2015/colorpicker/localization/custom-messages.component.js +1 -1
  79. package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.d.ts +14 -0
  80. package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.js +31 -0
  81. package/dist/es2015/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  82. package/dist/es2015/colorpicker/localization/messages.d.ts +36 -0
  83. package/dist/es2015/colorpicker/localization/messages.js +36 -0
  84. package/dist/es2015/colorpicker/models/actions-layout.d.ts +8 -0
  85. package/dist/es2015/colorpicker/models/actions-layout.js +4 -0
  86. package/dist/es2015/colorpicker/models/colorpicker-view.d.ts +8 -0
  87. package/dist/es2015/colorpicker/models/colorpicker-view.js +4 -0
  88. package/dist/es2015/colorpicker/models/gradient-settings.d.ts +4 -3
  89. package/dist/es2015/colorpicker/models/output-format.d.ts +0 -5
  90. package/dist/es2015/colorpicker/{utils → models}/palette-presets.d.ts +0 -0
  91. package/dist/es2015/colorpicker/{utils → models}/palette-presets.js +0 -0
  92. package/dist/es2015/colorpicker/models/palette-settings.d.ts +2 -3
  93. package/dist/es2015/colorpicker/models/tile-size.d.ts +1 -5
  94. package/dist/es2015/colorpicker/models.d.ts +10 -10
  95. package/dist/es2015/colorpicker/models.js +1 -2
  96. package/dist/es2015/colorpicker/services/flatcolorpicker.service.d.ts +12 -0
  97. package/dist/es2015/colorpicker/services/flatcolorpicker.service.js +38 -0
  98. package/dist/es2015/colorpicker/utils/color-parser.d.ts +8 -2
  99. package/dist/es2015/colorpicker/utils/color-parser.js +15 -5
  100. package/dist/es2015/colorpicker/utils/contrast-curve.d.ts +37 -0
  101. package/dist/es2015/colorpicker/utils/contrast-curve.js +85 -0
  102. package/dist/es2015/colorpicker/utils.d.ts +1 -1
  103. package/dist/es2015/colorpicker/utils.js +1 -1
  104. package/dist/es2015/colorpicker.module.js +9 -1
  105. package/dist/es2015/index.d.ts +5 -0
  106. package/dist/es2015/index.js +5 -0
  107. package/dist/es2015/index.metadata.json +1 -1
  108. package/dist/es2015/main.d.ts +4 -1
  109. package/dist/es2015/main.js +4 -1
  110. package/dist/es2015/package-metadata.js +1 -1
  111. package/dist/es2015/{colorpicker/models/color-picker-view.d.ts → shared/utils.d.ts} +9 -6
  112. package/dist/es2015/shared/utils.js +23 -0
  113. package/dist/es2015/textbox/textbox.component.js +3 -1
  114. package/dist/fesm2015/index.js +2229 -1046
  115. package/dist/fesm5/index.js +2026 -904
  116. package/dist/npm/colorpicker/color-contrast-svg.component.js +97 -0
  117. package/dist/npm/colorpicker/color-gradient.component.js +109 -81
  118. package/dist/npm/colorpicker/color-input.component.js +38 -17
  119. package/dist/npm/colorpicker/color-palette.component.js +29 -19
  120. package/dist/npm/colorpicker/colorpicker.component.js +177 -83
  121. package/dist/npm/colorpicker/constants.js +12 -0
  122. package/dist/npm/colorpicker/contrast-validation.component.js +8 -6
  123. package/dist/npm/colorpicker/contrast.component.js +6 -8
  124. package/dist/npm/colorpicker/{models → events}/active-color-click-event.js +0 -0
  125. package/dist/npm/colorpicker/events/cancel-event.js +21 -0
  126. package/dist/npm/colorpicker/events/close-event.js +19 -0
  127. package/dist/npm/colorpicker/{models → events}/kendo-drag-event.js +0 -0
  128. package/dist/npm/colorpicker/events/open-event.js +19 -0
  129. package/dist/npm/colorpicker/events.js +11 -0
  130. package/dist/npm/colorpicker/flatcolorpicker-actions.component.js +52 -0
  131. package/dist/npm/colorpicker/flatcolorpicker-header.component.js +96 -0
  132. package/dist/npm/colorpicker/flatcolorpicker.component.js +555 -0
  133. package/dist/npm/colorpicker/localization/colorgradient-localization.service.js +7 -7
  134. package/dist/npm/colorpicker/localization/colorpalette-localization.service.js +7 -7
  135. package/dist/npm/colorpicker/localization/custom-messages.component.js +1 -1
  136. package/dist/npm/colorpicker/localization/flatcolorpicker-localization.service.js +36 -0
  137. package/dist/npm/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  138. package/dist/npm/colorpicker/localization/messages.js +36 -0
  139. package/dist/npm/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
  140. package/dist/npm/colorpicker/models/colorpicker-view.js +6 -0
  141. package/dist/npm/colorpicker/{utils → models}/palette-presets.js +0 -0
  142. package/dist/npm/colorpicker/models.js +1 -2
  143. package/dist/npm/colorpicker/services/flatcolorpicker.service.js +43 -0
  144. package/dist/npm/colorpicker/utils/color-parser.js +18 -5
  145. package/dist/npm/colorpicker/utils/contrast-curve.js +93 -0
  146. package/dist/npm/colorpicker/utils.js +1 -1
  147. package/dist/npm/colorpicker.module.js +9 -1
  148. package/dist/npm/index.js +10 -0
  149. package/dist/npm/main.js +7 -2
  150. package/dist/npm/package-metadata.js +1 -1
  151. package/dist/npm/shared/utils.js +25 -0
  152. package/dist/npm/textbox/textbox.component.js +6 -4
  153. package/dist/systemjs/kendo-angular-inputs.js +1 -1
  154. package/package.json +10 -7
  155. package/dist/es/colorpicker/models/preventable-event.js +0 -29
  156. package/dist/es2015/colorpicker/models/preventable-event.d.ts +0 -21
  157. package/dist/es2015/colorpicker/models/preventable-event.js +0 -27
  158. package/dist/npm/colorpicker/models/preventable-event.js +0 -31
@@ -5,12 +5,12 @@
5
5
  import { __decorate, __param, __metadata } from 'tslib';
6
6
  import { isDevMode, Directive, Optional, TemplateRef, EventEmitter, Input, Output, HostBinding, ViewChild, ElementRef, ContentChild, Component, forwardRef, Injector, Renderer2, NgZone, ChangeDetectorRef, Inject, Injectable, HostListener, ViewChildren, QueryList, NgModule, ViewContainerRef, ContentChildren } from '@angular/core';
7
7
  import { NgControl, NG_VALUE_ACCESSOR, NG_VALIDATORS, RadioControlValueAccessor } from '@angular/forms';
8
- import { Subscription, fromEvent, interval, merge, Observable, Subject } from 'rxjs';
8
+ import { Subscription, fromEvent, interval, merge, Observable, BehaviorSubject, Subject } from 'rxjs';
9
9
  import { take, filter, concatMap, startWith, takeUntil, skip, debounceTime, throttleTime } from 'rxjs/operators';
10
10
  import { LocalizationService, L10N_PREFIX, RTL, ComponentMessages, MessageService } from '@progress/kendo-angular-l10n';
11
- import { Keys, guid, hasObservers, anyChanged, isDocumentAvailable, KendoInput, isChanged, DraggableModule, EventsModule, ResizeSensorModule } from '@progress/kendo-angular-common';
11
+ import { Keys, guid, hasObservers, anyChanged, isDocumentAvailable, KendoInput, isChanged, DraggableModule, EventsModule, ResizeSensorModule, PreventableEvent } from '@progress/kendo-angular-common';
12
12
  import { validatePackage } from '@progress/kendo-licensing';
13
- import { browser, mobileOS } from '@progress/kendo-common';
13
+ import { browser, mobileOS, detectDesktopBrowser, detectMobileOS } from '@progress/kendo-common';
14
14
  import { IntlService } from '@progress/kendo-angular-intl';
15
15
  import { CommonModule } from '@angular/common';
16
16
  import { PopupService, PopupModule } from '@progress/kendo-angular-popup';
@@ -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: 1635411998,
462
+ publishDate: 1639665048,
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
  };
@@ -5576,6 +5576,25 @@ MaskedTextBoxModule = __decorate([
5576
5576
  })
5577
5577
  ], MaskedTextBoxModule);
5578
5578
 
5579
+ /**
5580
+ * @hidden
5581
+ *
5582
+ * Returns true if the used browser is Safari.
5583
+ */
5584
+ const isSafari = (userAgent) => {
5585
+ return detectDesktopBrowser(userAgent).safari ||
5586
+ (detectMobileOS(userAgent) && detectMobileOS(userAgent).browser === 'mobilesafari');
5587
+ };
5588
+ /**
5589
+ * @hidden
5590
+ *
5591
+ * Checks if input is Japanese IME
5592
+ */
5593
+ const isJapanese = (input) => {
5594
+ const japaneseRegex = /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g;
5595
+ return japaneseRegex.test(input);
5596
+ };
5597
+
5579
5598
  /**
5580
5599
  * Specifies the adornments in the suffix container ([see examples]({% slug adornments_textbox %}#toc-suffixadornments)).
5581
5600
  * @example
@@ -5819,7 +5838,7 @@ let TextBoxComponent = TextBoxComponent_1 = class TextBoxComponent {
5819
5838
  * @hidden
5820
5839
  */
5821
5840
  this.handleInput = (ev) => {
5822
- let incomingValue = ev.target.value;
5841
+ let incomingValue = isSafari(navigator.userAgent) && isJapanese(ev.target.value) ? ev.data : ev.target.value;
5823
5842
  this.updateValue(incomingValue);
5824
5843
  };
5825
5844
  this.ngChange = (_) => { };
@@ -7177,25 +7196,183 @@ TextAreaModule = __decorate([
7177
7196
  /**
7178
7197
  * @hidden
7179
7198
  */
7180
- class PreventableEvent {
7181
- constructor() {
7182
- this.prevented = false;
7199
+ let ColorPickerLocalizationService = class ColorPickerLocalizationService extends LocalizationService {
7200
+ constructor(prefix, messageService, _rtl) {
7201
+ super(prefix, messageService, _rtl);
7183
7202
  }
7184
- /**
7185
- * Prevents the default action for a specified event.
7186
- * In this way, the source component suppresses the built-in behavior that follows the event.
7187
- */
7188
- preventDefault() {
7189
- this.prevented = true;
7203
+ };
7204
+ ColorPickerLocalizationService = __decorate([
7205
+ __param(0, Inject(L10N_PREFIX)),
7206
+ __param(1, Optional()),
7207
+ __param(2, Optional()), __param(2, Inject(RTL)),
7208
+ __metadata("design:paramtypes", [String, MessageService, Boolean])
7209
+ ], ColorPickerLocalizationService);
7210
+
7211
+ /**
7212
+ * @hidden
7213
+ */
7214
+ let FlatColorPickerLocalizationService = class FlatColorPickerLocalizationService extends LocalizationService {
7215
+ constructor(prefix, messageService, _rtl, colorPickerLocalization) {
7216
+ super(prefix, messageService, _rtl);
7217
+ this.colorPickerLocalization = colorPickerLocalization;
7190
7218
  }
7191
- /**
7192
- * If the event is prevented by any of its subscribers, returns `true`.
7193
- *
7194
- * @returns - `true` if the default action was prevented. Otherwise, returns `false`.
7195
- */
7196
- isDefaultPrevented() {
7197
- return this.prevented;
7219
+ get(shortKey) {
7220
+ if (this.colorPickerLocalization) {
7221
+ return this.colorPickerLocalization.get(shortKey);
7222
+ }
7223
+ return super.get(shortKey);
7224
+ }
7225
+ };
7226
+ FlatColorPickerLocalizationService = __decorate([
7227
+ __param(0, Inject(L10N_PREFIX)),
7228
+ __param(1, Optional()),
7229
+ __param(2, Optional()), __param(2, Inject(RTL)),
7230
+ __param(3, Optional()), __param(3, Inject(ColorPickerLocalizationService)),
7231
+ __metadata("design:paramtypes", [String, MessageService, Boolean, ColorPickerLocalizationService])
7232
+ ], FlatColorPickerLocalizationService);
7233
+
7234
+ /**
7235
+ * @hidden
7236
+ */
7237
+ const DEFAULT_OUTPUT_FORMAT = 'rgba';
7238
+ /**
7239
+ * @hidden
7240
+ */
7241
+ const DEFAULT_GRADIENT_BACKGROUND_COLOR = 'rgba(255, 0, 0, 1)';
7242
+ /**
7243
+ * @hidden
7244
+ */
7245
+ const DRAGHANDLE_MOVE_SPEED = 5;
7246
+ /**
7247
+ * @hidden
7248
+ */
7249
+ const AAA_RATIO = 7.0;
7250
+ /**
7251
+ * @hidden
7252
+ */
7253
+ const AA_RATIO = 4.5;
7254
+ /**
7255
+ * @hidden
7256
+ */
7257
+ const DEFAULT_PRESET = 'office';
7258
+ /**
7259
+ * @hidden
7260
+ */
7261
+ const DEFAULT_ACCESSIBLE_PRESET = 'accessible';
7262
+ /**
7263
+ * @hidden
7264
+ */
7265
+ const STEP_COUNT = 16;
7266
+
7267
+ // tslint:disable:max-line-length
7268
+ /**
7269
+ * @hidden
7270
+ */
7271
+ const PALETTEPRESETS = {
7272
+ basic: {
7273
+ colors: '000000,7f7f7f,880015,ed1c24,ff7f27,fff200,22b14c,00a2e8,3f48cc,a349a4,ffffff,c3c3c3,b97a57,ffaec9,ffc90e,efe4b0,b5e61d,99d9ea,7092be,c8bfe7',
7274
+ columns: 10
7275
+ },
7276
+ office: {
7277
+ colors: 'ffffff, 000000, e6e6e6, 435569, 4371c4, ed7e32, a5a4a5, febf04, 5a9bd5, 71ae48, f2f2f3, 7f7f7f, d1cece, d5dde3, dae1f4, fce5d4, deeded, fff2cc, deeaf6, e1efd9, d7d8d8, 585959, aeabab, adbaca, b4c5e7, f6caac, dbdbdb, ffe498, bcd6ee, c5e0b2, bfbfc0, 3f3f3f, 767070, 8595b1, 8fabdb, f5b183, c9c8c9, fed965, 9bc4e5, a8d08d, a5a5a6, 262625, 393939, 334050, 2e5496, c45a11, 7b7b7a, bf9000, 2f75b5, 548235, 7f7f7f, 0b0c0c, 161616, 222a34, 203764, 843d0b, 525252, 7f6000, 1d4d79, 375623',
7278
+ columns: 10
7279
+ },
7280
+ apex: {
7281
+ colors: 'ffffff, 000000, c9c2d1, 69676d, ceb966, 9cb084, 6bb1c9, 6585cf, 7e6bc9, a379bb, f2f2f2, 7f7f7f, f4f2f5, e0e0e2, f5f1e0, ebefe6, e1eff4, e0e6f5, e5e1f4, ece4f1, d8d8d8, 595959, e9e6ec, c2c1c5, ebe3c1, d7dfcd, c3dfe9, c1ceeb, cbc3e9, dac9e3, bfbfbf, 3f3f3f, dedae3, a4a3a8, e1d5a3, c3cfb5, a6d0de, a2b5e2, b1a6de, c7aed6, a5a5a5, 262626, 9688a5, 4e4d51, ae9638, 758c5a, 3d8da9, 365bb0, 533da9, 7d4d99, 7f7f7f, 0c0c0c, 635672, 343336, 746425, 4e5d3c, 295e70, 243c75, 372970, 533366',
7282
+ columns: 10
7283
+ },
7284
+ austin: {
7285
+ colors: 'ffffff, 000000, caf278, 3e3d2d, 94c600, 71685a, ff6700, 909465, 956b43, fea022, f2f2f2, 7f7f7f, f4fce4, dddcd0, efffc0, e3e1dc, ffe0cb, e8e9df, ece1d6, feecd2, d8d8d8, 595959, e9f9c9, bbb9a1, dfff82, c8c3ba, ffc299, d2d4c0, dac3ad, fed9a6, bfbfbf, 3f3f3f, dff7ae, ada598, cfff43, ada598, ffa365, bcbfa1, c8a585, fec67a, a5a5a5, 262626, a9ea25, 2e2d21, 6f9400, 544e43, bf4d00, 6c6f4b, 6f5032, d77b00, 7f7f7f, 0c0c0c, 74a50f, 1f1e16, 4a6300, 38342d, 7f3300, 484a32, 4a3521, 8f5200',
7286
+ columns: 10
7287
+ },
7288
+ clarity: {
7289
+ colors: 'ffffff, 292934, f3f2dc, d2533c, 93a299, ad8f67, 726056, 4c5a6a, 808da0, 79463d, f2f2f2, e7e7ec, e7e5b9, f6dcd8, e9ecea, eee8e0, e4dedb, d8dde3, e5e8ec, e9d6d3, d8d8d8, c4c4d1, d5d185, edbab1, d3d9d6, ded2c2, c9beb8, b2bcc8, ccd1d9, d3aea7, bfbfbf, 8a8aa3, aca73b, e4978a, bec7c1, cdbba3, af9e94, 8c9bac, b2bac6, bd857c, a5a5a5, 56566e, 56531d, a43925, 6b7c72, 866b48, 554840, 39434f, 5c697b, 5a342d, 7f7f7f, 3b3b4b, 22210b, 6d2619, 47534c, 594730, 39302b, 262d35, 3d4652, 3c231e',
7290
+ columns: 10
7291
+ },
7292
+ slipstream: {
7293
+ colors: 'ffffff, 000000, b4dcfa, 212745, 4e67c8, 5eccf3, a7ea52, 5dceaf, ff8021, f14124, f2f2f2, 7f7f7f, 8bc9f7, c7cce4, dbe0f4, def4fc, edfadc, def5ef, ffe5d2, fcd9d3, d8d8d8, 595959, 4facf3, 909aca, b8c2e9, beeafa, dbf6b9, beebdf, ffcca6, f9b3a7, bfbfbf, 3f3f3f, 0d78c9, 5967af, 94a3de, 9ee0f7, caf297, 9de1cf, ffb279, f68d7b, a5a5a5, 262626, 063c64, 181d33, 31479f, 11b2eb, 81d319, 34ac8b, d85c00, c3260c, 7f7f7f, 0c0c0c, 021828, 101322, 202f6a, 0b769c, 568c11, 22725c, 903d00, 821908',
7294
+ columns: 10
7295
+ },
7296
+ metro: {
7297
+ colors: 'ffffff, 000000, d6ecff, 4e5b6f, 7fd13b, ea157a, feb80a, 00addc, 738ac8, 1ab39f, f2f2f2, 7f7f7f, a7d6ff, d9dde4, e5f5d7, fad0e4, fef0cd, c5f2ff, e2e7f4, c9f7f1, d8d8d8, 595959, 60b5ff, b3bcca, cbecb0, f6a1c9, fee29c, 8be6ff, c7d0e9, 94efe3, bfbfbf, 3f3f3f, 007dea, 8d9baf, b2e389, f272af, fed46b, 51d9ff, aab8de, 5fe7d5, a5a5a5, 262626, 003e75, 3a4453, 5ea226, af0f5b, c58c00, 0081a5, 425ea9, 138677, 7f7f7f, 0c0c0c, 00192e, 272d37, 3f6c19, 750a3d, 835d00, 00566e, 2c3f71, 0c594f',
7298
+ columns: 10
7299
+ },
7300
+ flow: {
7301
+ colors: 'ffffff, 000000, dbf5f9, 04617b, 0f6fc6, 009dd9, 0bd0d9, 10cf9b, 7cca62, a5c249, f2f2f2, 7f7f7f, b2e9f2, b4ecfc, c7e2fa, c4eeff, c9fafc, c9faed, e4f4df, edf2da, d8d8d8, 595959, 76d9e8, 6adafa, 90c6f6, 89deff, 93f5f9, 94f6db, cae9c0, dbe6b6, bfbfbf, 3f3f3f, 21b2c8, 20c8f7, 59a9f2, 4fceff, 5df0f6, 5ff2ca, b0dfa0, c9da91, a5a5a5, 262626, 105964, 02485c, 0b5394, 0075a2, 089ca2, 0b9b74, 54a838, 7e9532, 7f7f7f, 0c0c0c, 062328, 01303d, 073763, 004e6c, 05686c, 07674d, 387025, 546321',
7302
+ columns: 10
7303
+ },
7304
+ hardcover: {
7305
+ colors: 'ffffff, 000000, ece9c6, 895d1d, 873624, d6862d, d0be40, 877f6c, 972109, aeb795, f2f2f2, 7f7f7f, e1dca5, f2e0c6, f0d0c9, f6e6d5, f5f2d8, e7e5e1, fbc7bc, eef0e9, d8d8d8, 595959, d0c974, e6c28d, e2a293, eeceaa, ece5b2, cfccc3, f78f7a, dee2d4, bfbfbf, 3f3f3f, a29a36, daa454, d4735e, e6b681, e2d88c, b7b2a5, f35838, ced3bf, a5a5a5, 262626, 514d1b, 664515, 65281a, a2641f, a39428, 655f50, 711806, 879464, 7f7f7f, 0c0c0c, 201e0a, 442e0e, 431b11, 6c4315, 6d621a, 433f35, 4b1004, 5a6243',
7306
+ columns: 10
7307
+ },
7308
+ trek: {
7309
+ colors: 'ffffff, 000000, fbeec9, 4e3b30, f0a22e, a5644e, b58b80, c3986d, a19574, c17529, f2f2f2, 7f7f7f, f7e09e, e1d6cf, fcecd5, eddfda, f0e7e5, f3eae1, ece9e3, f5e3d1, d8d8d8, 595959, f3cc5f, c4ad9f, f9d9ab, dcc0b6, e1d0cc, e7d5c4, d9d4c7, ebc7a3, bfbfbf, 3f3f3f, d29f0f, a78470, f6c781, cba092, d2b9b2, dbc1a7, c6bfab, e1ac76, a5a5a5, 262626, 694f07, 3a2c24, c87d0e, 7b4b3a, 926255, a17242, 7b7153, 90571e, 7f7f7f, 0c0c0c, 2a1f03, 271d18, 855309, 523226, 614138, 6b4c2c, 524b37, 603a14',
7310
+ columns: 10
7311
+ },
7312
+ verve: {
7313
+ colors: 'ffffff, 000000, d2d2d2, 666666, ff388c, e40059, 9c007f, 68007f, 005bd3, 00349e, f2f2f2, 7f7f7f, bdbdbd, e0e0e0, ffd7e8, ffc6dc, ffb8f1, f1b2ff, c3dcff, b8cfff, d8d8d8, 595959, 9d9d9d, c1c1c1, ffafd1, ff8eba, ff71e4, e365ff, 87baff, 72a0ff, bfbfbf, 3f3f3f, 696969, a3a3a3, ff87ba, ff5597, ff2ad7, d519ff, 4b98ff, 2b71ff, a5a5a5, 262626, 343434, 4c4c4c, e90062, ab0042, 75005f, 4e005f, 00449e, 002676, 7f7f7f, 0c0c0c, 151515, 333333, 9b0041, 72002c, 4e003f, 34003f, 002d69, 00194f',
7314
+ columns: 10
7315
+ },
7316
+ monochrome: {
7317
+ colors: '000000, 1a1a1a, 333333, 4d4d4d, 666666, 808080, 999999, b3b3b3, cccccc, e6e6e6, f2f2f2, ffffff',
7318
+ columns: 12
7319
+ },
7320
+ accessible: {
7321
+ colors: 'black, grey, darkred, red, darkorange, gold, green, blue, darkblue, purple, white, darkgrey, saddlebrown, pink, orange, yellow, lightgreen, lightskyblue, lightblue, mediumpurple',
7322
+ columns: 10
7323
+ }
7324
+ };
7325
+
7326
+ /**
7327
+ * @hidden
7328
+ */
7329
+ let FlatColorPickerService = class FlatColorPickerService {
7330
+ getPaletteSettings(settings, format) {
7331
+ const defaultPreset = (format !== 'name') ? DEFAULT_PRESET : DEFAULT_ACCESSIBLE_PRESET;
7332
+ const settingsPalette = settings.palette;
7333
+ const presetColumns = typeof settingsPalette === 'string' && PALETTEPRESETS[settingsPalette] ?
7334
+ PALETTEPRESETS[settingsPalette].columns :
7335
+ undefined;
7336
+ return {
7337
+ palette: settingsPalette || defaultPreset,
7338
+ tileSize: settings.tileSize || 24,
7339
+ columns: settings.columns || presetColumns || 10
7340
+ };
7341
+ }
7342
+ paletteTileLayout(tileSize) {
7343
+ if (typeof tileSize === 'number') {
7344
+ return { width: tileSize, height: tileSize };
7345
+ }
7346
+ return {
7347
+ width: tileSize.width ? tileSize.width : tileSize.height,
7348
+ height: tileSize.height ? tileSize.height : tileSize.width
7349
+ };
7198
7350
  }
7351
+ };
7352
+ FlatColorPickerService = __decorate([
7353
+ Injectable()
7354
+ ], FlatColorPickerService);
7355
+
7356
+ /**
7357
+ * Arguments for the `cancel` event of the ColorPicker and FlatColorPicker components.
7358
+ */
7359
+ class ColorPickerCancelEvent extends PreventableEvent {
7360
+ constructor(originalEvent) {
7361
+ super();
7362
+ this.originalEvent = originalEvent;
7363
+ }
7364
+ }
7365
+
7366
+ /**
7367
+ * Arguments for the `close` event of the ColorPicker component.
7368
+ */
7369
+ class ColorPickerCloseEvent extends PreventableEvent {
7370
+ }
7371
+
7372
+ /**
7373
+ * Arguments for the `open` event of the ColorPicker component.
7374
+ */
7375
+ class ColorPickerOpenEvent extends PreventableEvent {
7199
7376
  }
7200
7377
 
7201
7378
  /**
@@ -7258,7 +7435,7 @@ class ActiveColorClickEvent {
7258
7435
  *
7259
7436
  * Returns the hex or rgba string representation of the color.
7260
7437
  */
7261
- const parseColor$1 = (value, format, safe = true) => {
7438
+ const parseColor$1 = (value, format, opacityEnabled = false, safe = true) => {
7262
7439
  const allowedFormats = ['hex', 'rgba', 'name'];
7263
7440
  if (allowedFormats.indexOf(format) === -1) {
7264
7441
  throw new Error(`Unsupported color output format '${format}'. The available options are 'hex', 'rgba' or 'name'.`);
@@ -7273,7 +7450,8 @@ const parseColor$1 = (value, format, safe = true) => {
7273
7450
  if (!isPresent(parsedColor)) {
7274
7451
  return;
7275
7452
  }
7276
- return format === 'hex' ? parsedColor.toCss() : parsedColor.toCssRgba();
7453
+ const parsedColorResult = format === 'hex' ? getHexValue(parsedColor, opacityEnabled) : parsedColor.toCssRgba();
7454
+ return parsedColorResult;
7277
7455
  };
7278
7456
  /**
7279
7457
  * @hidden
@@ -7304,12 +7482,21 @@ const getRGBA = (value, safe = true) => {
7304
7482
  *
7305
7483
  * Returns the RGBA string representation of the color.
7306
7484
  */
7307
- const getColorFromHSV = (hsva) => {
7485
+ const getColorFromHSV = (hsva, format = 'rgba', opacityEnabled = false) => {
7308
7486
  const hue = fitIntoBounds(hsva.h, 0, 359.9);
7309
7487
  const saturation = fitIntoBounds(hsva.s, 0, 1);
7310
7488
  const value = fitIntoBounds(hsva.v, 0, 1);
7311
7489
  const alpha = fitIntoBounds(hsva.a, 0, 1);
7312
- return Color.fromHSV(hue, saturation, value, alpha).toCssRgba();
7490
+ const color = Color.fromHSV(hue, saturation, value, alpha);
7491
+ return format === 'hex' ? getHexValue(color, opacityEnabled) : color.toCssRgba();
7492
+ };
7493
+ /**
7494
+ * @hidden
7495
+ *
7496
+ * Returns the HEX value.
7497
+ */
7498
+ const getHexValue = (color, opacity) => {
7499
+ return opacity && color.a < 1 ? color.toCss({ alpha: true }) : color.toCss();
7313
7500
  };
7314
7501
  /**
7315
7502
  * @hidden
@@ -7345,7 +7532,7 @@ function nameFormat(value, safe) {
7345
7532
  }
7346
7533
  const key = Object.keys(namedColors).find(key => namedColors[key] === value);
7347
7534
  if (!key && !safe) {
7348
- throw new Error(`The provided color ${value} is not supported for 'format="name"' property.To display ${value} color, the component 'format' property shoud be set to 'hex' or 'rgba' `);
7535
+ throw new Error(`The provided color ${value} is not supported for 'format="name"' property.To display ${value} color, the component 'format' property should be set to 'hex' or 'rgba' `);
7349
7536
  }
7350
7537
  return key;
7351
7538
  }
@@ -7402,91 +7589,84 @@ const getContrastFromTwoRGBAs = (a, b) => {
7402
7589
  return getContrast(getLuminance(getRGBFromRGBA(a, b)), getLuminance(getRGBFromRGBA(b, { r: 0, g: 0, b: 0, a: 1 })));
7403
7590
  };
7404
7591
 
7405
- // tslint:disable:max-line-length
7406
7592
  /**
7407
7593
  * @hidden
7408
7594
  */
7409
- const PALETTEPRESETS = {
7410
- basic: {
7411
- colors: '000000,7f7f7f,880015,ed1c24,ff7f27,fff200,22b14c,00a2e8,3f48cc,a349a4,ffffff,c3c3c3,b97a57,ffaec9,ffc90e,efe4b0,b5e61d,99d9ea,7092be,c8bfe7',
7412
- columns: 10
7413
- },
7414
- office: {
7415
- colors: 'ffffff, 000000, e6e6e6, 435569, 4371c4, ed7e32, a5a4a5, febf04, 5a9bd5, 71ae48, f2f2f3, 7f7f7f, d1cece, d5dde3, dae1f4, fce5d4, deeded, fff2cc, deeaf6, e1efd9, d7d8d8, 585959, aeabab, adbaca, b4c5e7, f6caac, dbdbdb, ffe498, bcd6ee, c5e0b2, bfbfc0, 3f3f3f, 767070, 8595b1, 8fabdb, f5b183, c9c8c9, fed965, 9bc4e5, a8d08d, a5a5a6, 262625, 393939, 334050, 2e5496, c45a11, 7b7b7a, bf9000, 2f75b5, 548235, 7f7f7f, 0b0c0c, 161616, 222a34, 203764, 843d0b, 525252, 7f6000, 1d4d79, 375623',
7416
- columns: 10
7417
- },
7418
- apex: {
7419
- colors: 'ffffff, 000000, c9c2d1, 69676d, ceb966, 9cb084, 6bb1c9, 6585cf, 7e6bc9, a379bb, f2f2f2, 7f7f7f, f4f2f5, e0e0e2, f5f1e0, ebefe6, e1eff4, e0e6f5, e5e1f4, ece4f1, d8d8d8, 595959, e9e6ec, c2c1c5, ebe3c1, d7dfcd, c3dfe9, c1ceeb, cbc3e9, dac9e3, bfbfbf, 3f3f3f, dedae3, a4a3a8, e1d5a3, c3cfb5, a6d0de, a2b5e2, b1a6de, c7aed6, a5a5a5, 262626, 9688a5, 4e4d51, ae9638, 758c5a, 3d8da9, 365bb0, 533da9, 7d4d99, 7f7f7f, 0c0c0c, 635672, 343336, 746425, 4e5d3c, 295e70, 243c75, 372970, 533366',
7420
- columns: 10
7421
- },
7422
- austin: {
7423
- colors: 'ffffff, 000000, caf278, 3e3d2d, 94c600, 71685a, ff6700, 909465, 956b43, fea022, f2f2f2, 7f7f7f, f4fce4, dddcd0, efffc0, e3e1dc, ffe0cb, e8e9df, ece1d6, feecd2, d8d8d8, 595959, e9f9c9, bbb9a1, dfff82, c8c3ba, ffc299, d2d4c0, dac3ad, fed9a6, bfbfbf, 3f3f3f, dff7ae, ada598, cfff43, ada598, ffa365, bcbfa1, c8a585, fec67a, a5a5a5, 262626, a9ea25, 2e2d21, 6f9400, 544e43, bf4d00, 6c6f4b, 6f5032, d77b00, 7f7f7f, 0c0c0c, 74a50f, 1f1e16, 4a6300, 38342d, 7f3300, 484a32, 4a3521, 8f5200',
7424
- columns: 10
7425
- },
7426
- clarity: {
7427
- colors: 'ffffff, 292934, f3f2dc, d2533c, 93a299, ad8f67, 726056, 4c5a6a, 808da0, 79463d, f2f2f2, e7e7ec, e7e5b9, f6dcd8, e9ecea, eee8e0, e4dedb, d8dde3, e5e8ec, e9d6d3, d8d8d8, c4c4d1, d5d185, edbab1, d3d9d6, ded2c2, c9beb8, b2bcc8, ccd1d9, d3aea7, bfbfbf, 8a8aa3, aca73b, e4978a, bec7c1, cdbba3, af9e94, 8c9bac, b2bac6, bd857c, a5a5a5, 56566e, 56531d, a43925, 6b7c72, 866b48, 554840, 39434f, 5c697b, 5a342d, 7f7f7f, 3b3b4b, 22210b, 6d2619, 47534c, 594730, 39302b, 262d35, 3d4652, 3c231e',
7428
- columns: 10
7429
- },
7430
- slipstream: {
7431
- colors: 'ffffff, 000000, b4dcfa, 212745, 4e67c8, 5eccf3, a7ea52, 5dceaf, ff8021, f14124, f2f2f2, 7f7f7f, 8bc9f7, c7cce4, dbe0f4, def4fc, edfadc, def5ef, ffe5d2, fcd9d3, d8d8d8, 595959, 4facf3, 909aca, b8c2e9, beeafa, dbf6b9, beebdf, ffcca6, f9b3a7, bfbfbf, 3f3f3f, 0d78c9, 5967af, 94a3de, 9ee0f7, caf297, 9de1cf, ffb279, f68d7b, a5a5a5, 262626, 063c64, 181d33, 31479f, 11b2eb, 81d319, 34ac8b, d85c00, c3260c, 7f7f7f, 0c0c0c, 021828, 101322, 202f6a, 0b769c, 568c11, 22725c, 903d00, 821908',
7432
- columns: 10
7433
- },
7434
- metro: {
7435
- colors: 'ffffff, 000000, d6ecff, 4e5b6f, 7fd13b, ea157a, feb80a, 00addc, 738ac8, 1ab39f, f2f2f2, 7f7f7f, a7d6ff, d9dde4, e5f5d7, fad0e4, fef0cd, c5f2ff, e2e7f4, c9f7f1, d8d8d8, 595959, 60b5ff, b3bcca, cbecb0, f6a1c9, fee29c, 8be6ff, c7d0e9, 94efe3, bfbfbf, 3f3f3f, 007dea, 8d9baf, b2e389, f272af, fed46b, 51d9ff, aab8de, 5fe7d5, a5a5a5, 262626, 003e75, 3a4453, 5ea226, af0f5b, c58c00, 0081a5, 425ea9, 138677, 7f7f7f, 0c0c0c, 00192e, 272d37, 3f6c19, 750a3d, 835d00, 00566e, 2c3f71, 0c594f',
7436
- columns: 10
7437
- },
7438
- flow: {
7439
- colors: 'ffffff, 000000, dbf5f9, 04617b, 0f6fc6, 009dd9, 0bd0d9, 10cf9b, 7cca62, a5c249, f2f2f2, 7f7f7f, b2e9f2, b4ecfc, c7e2fa, c4eeff, c9fafc, c9faed, e4f4df, edf2da, d8d8d8, 595959, 76d9e8, 6adafa, 90c6f6, 89deff, 93f5f9, 94f6db, cae9c0, dbe6b6, bfbfbf, 3f3f3f, 21b2c8, 20c8f7, 59a9f2, 4fceff, 5df0f6, 5ff2ca, b0dfa0, c9da91, a5a5a5, 262626, 105964, 02485c, 0b5394, 0075a2, 089ca2, 0b9b74, 54a838, 7e9532, 7f7f7f, 0c0c0c, 062328, 01303d, 073763, 004e6c, 05686c, 07674d, 387025, 546321',
7440
- columns: 10
7441
- },
7442
- hardcover: {
7443
- colors: 'ffffff, 000000, ece9c6, 895d1d, 873624, d6862d, d0be40, 877f6c, 972109, aeb795, f2f2f2, 7f7f7f, e1dca5, f2e0c6, f0d0c9, f6e6d5, f5f2d8, e7e5e1, fbc7bc, eef0e9, d8d8d8, 595959, d0c974, e6c28d, e2a293, eeceaa, ece5b2, cfccc3, f78f7a, dee2d4, bfbfbf, 3f3f3f, a29a36, daa454, d4735e, e6b681, e2d88c, b7b2a5, f35838, ced3bf, a5a5a5, 262626, 514d1b, 664515, 65281a, a2641f, a39428, 655f50, 711806, 879464, 7f7f7f, 0c0c0c, 201e0a, 442e0e, 431b11, 6c4315, 6d621a, 433f35, 4b1004, 5a6243',
7444
- columns: 10
7445
- },
7446
- trek: {
7447
- colors: 'ffffff, 000000, fbeec9, 4e3b30, f0a22e, a5644e, b58b80, c3986d, a19574, c17529, f2f2f2, 7f7f7f, f7e09e, e1d6cf, fcecd5, eddfda, f0e7e5, f3eae1, ece9e3, f5e3d1, d8d8d8, 595959, f3cc5f, c4ad9f, f9d9ab, dcc0b6, e1d0cc, e7d5c4, d9d4c7, ebc7a3, bfbfbf, 3f3f3f, d29f0f, a78470, f6c781, cba092, d2b9b2, dbc1a7, c6bfab, e1ac76, a5a5a5, 262626, 694f07, 3a2c24, c87d0e, 7b4b3a, 926255, a17242, 7b7153, 90571e, 7f7f7f, 0c0c0c, 2a1f03, 271d18, 855309, 523226, 614138, 6b4c2c, 524b37, 603a14',
7448
- columns: 10
7449
- },
7450
- verve: {
7451
- colors: 'ffffff, 000000, d2d2d2, 666666, ff388c, e40059, 9c007f, 68007f, 005bd3, 00349e, f2f2f2, 7f7f7f, bdbdbd, e0e0e0, ffd7e8, ffc6dc, ffb8f1, f1b2ff, c3dcff, b8cfff, d8d8d8, 595959, 9d9d9d, c1c1c1, ffafd1, ff8eba, ff71e4, e365ff, 87baff, 72a0ff, bfbfbf, 3f3f3f, 696969, a3a3a3, ff87ba, ff5597, ff2ad7, d519ff, 4b98ff, 2b71ff, a5a5a5, 262626, 343434, 4c4c4c, e90062, ab0042, 75005f, 4e005f, 00449e, 002676, 7f7f7f, 0c0c0c, 151515, 333333, 9b0041, 72002c, 4e003f, 34003f, 002d69, 00194f',
7452
- columns: 10
7453
- },
7454
- monochrome: {
7455
- colors: '000000, 1a1a1a, 333333, 4d4d4d, 666666, 808080, 999999, b3b3b3, cccccc, e6e6e6, f2f2f2, ffffff',
7456
- columns: 12
7457
- },
7458
- accessible: {
7459
- colors: 'black, grey, darkred, red, darkorange, gold, green, blue, darkblue, purple, white, darkgrey, saddlebrown, pink, orange, yellow, lightgreen, lightskyblue, lightblue, mediumpurple',
7460
- columns: 10
7461
- }
7595
+ const bezierCommand = (controlPointCalc) => (point, i, a) => {
7596
+ // start control point
7597
+ const [cpsX, cpsY] = controlPointCalc(a[i - 1], a[i - 2], point);
7598
+ // end control point
7599
+ const [cpeX, cpeY] = controlPointCalc(point, a[i - 1], a[i + 1], true);
7600
+ return `C ${cpsX},${cpsY} ${cpeX},${cpeY} ${point[0]},${point[1]}`;
7462
7601
  };
7463
-
7464
7602
  /**
7465
7603
  * @hidden
7466
7604
  */
7467
- let ColorPickerLocalizationService = class ColorPickerLocalizationService extends LocalizationService {
7468
- constructor(prefix, messageService, _rtl) {
7469
- super(prefix, messageService, _rtl);
7605
+ const controlPoint = (lineCalc) => (current, previous, next, reverse) => {
7606
+ // when 'current' is the first or last point of the array
7607
+ // 'previous' and 'next' are undefined
7608
+ // replace with 'current'
7609
+ const p = previous || current;
7610
+ const n = next || current;
7611
+ const smooth = 0.1;
7612
+ // properties of the line between previous and next
7613
+ const l = lineCalc(p, n);
7614
+ // If is end-control-point, add PI to the angle to go backward
7615
+ const angle = l.angle + (reverse ? Math.PI : 0);
7616
+ const length = l.length * smooth;
7617
+ // The control point position is relative to the current point
7618
+ const x = current[0] + Math.cos(angle) * length;
7619
+ const y = current[1] + Math.sin(angle) * length;
7620
+ return [x, y];
7621
+ };
7622
+ /**
7623
+ * @hidden
7624
+ */
7625
+ const line = (pointA, pointB) => {
7626
+ const lengthX = pointB[0] - pointA[0];
7627
+ const lengthY = pointB[1] - pointA[1];
7628
+ return {
7629
+ length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),
7630
+ angle: Math.atan2(lengthY, lengthX)
7631
+ };
7632
+ };
7633
+ /**
7634
+ * @hidden
7635
+ *
7636
+ * Render the svg <path> element.
7637
+ *
7638
+ * @param points (array) Represents the points coordinates as an array of tuples.
7639
+ * @param command (function) The command that is used (bezierCommand, lineCommand).
7640
+ * @param point (array) [x,y] Represents the current point coordinates.
7641
+ * @param i (integer) Represents the index of 'point' in the array 'a'.
7642
+ * @param a (array) Represents the complete array of points coordinates.
7643
+ * @output (string) a svg path command.
7644
+ * @output (string) a Svg <path> element
7645
+ */
7646
+ const svgPath = (points, command) => {
7647
+ if (points.length === 0) {
7648
+ return '';
7470
7649
  }
7650
+ // build the d attributes by looping over the points
7651
+ const d = points.reduce((acc, point, i, a) => i === 0 ?
7652
+ // if first point
7653
+ `M ${point[0]},${point[1]}` :
7654
+ // else
7655
+ `${acc} ${command(point, i, a)}`, '');
7656
+ return d;
7471
7657
  };
7472
- ColorPickerLocalizationService = __decorate([
7473
- __param(0, Inject(L10N_PREFIX)),
7474
- __param(1, Optional()),
7475
- __param(2, Optional()), __param(2, Inject(RTL)),
7476
- __metadata("design:paramtypes", [String, MessageService, Boolean])
7477
- ], ColorPickerLocalizationService);
7478
7658
 
7479
7659
  /**
7480
7660
  * @hidden
7481
7661
  */
7482
7662
  let ColorGradientLocalizationService = class ColorGradientLocalizationService extends LocalizationService {
7483
- constructor(prefix, messageService, _rtl, colorPickerLocalization) {
7663
+ constructor(prefix, messageService, _rtl, flatColorPickerLocalization) {
7484
7664
  super(prefix, messageService, _rtl);
7485
- this.colorPickerLocalization = colorPickerLocalization;
7665
+ this.flatColorPickerLocalization = flatColorPickerLocalization;
7486
7666
  }
7487
7667
  get(shortKey) {
7488
- if (this.colorPickerLocalization) {
7489
- return this.colorPickerLocalization.get(shortKey);
7668
+ if (this.flatColorPickerLocalization) {
7669
+ return this.flatColorPickerLocalization.get(shortKey);
7490
7670
  }
7491
7671
  return super.get(shortKey);
7492
7672
  }
@@ -7495,18 +7675,22 @@ ColorGradientLocalizationService = __decorate([
7495
7675
  __param(0, Inject(L10N_PREFIX)),
7496
7676
  __param(1, Optional()),
7497
7677
  __param(2, Optional()), __param(2, Inject(RTL)),
7498
- __param(3, Optional()), __param(3, Inject(ColorPickerLocalizationService)),
7499
- __metadata("design:paramtypes", [String, MessageService, Boolean, ColorPickerLocalizationService])
7678
+ __param(3, Optional()), __param(3, Inject(FlatColorPickerLocalizationService)),
7679
+ __metadata("design:paramtypes", [String, MessageService, Boolean, FlatColorPickerLocalizationService])
7500
7680
  ], ColorGradientLocalizationService);
7501
7681
 
7502
7682
  /**
7503
7683
  * @hidden
7504
7684
  */
7505
7685
  let ColorInputComponent = class ColorInputComponent {
7506
- constructor(localization, host, renderer) {
7507
- this.localization = localization;
7686
+ constructor(host, renderer, localizationService) {
7508
7687
  this.host = host;
7509
7688
  this.renderer = renderer;
7689
+ this.localizationService = localizationService;
7690
+ /**
7691
+ * The id of the hex input.
7692
+ */
7693
+ this.focusableId = `k-${guid()}`;
7510
7694
  /**
7511
7695
  * Sets whether the alpha slider will be shown.
7512
7696
  */
@@ -7556,11 +7740,14 @@ let ColorInputComponent = class ColorInputComponent {
7556
7740
  }
7557
7741
  ngOnChanges(changes) {
7558
7742
  if (isPresent(changes.value) && !this.isFocused) {
7559
- this.hex = parseColor$1(this.value, 'hex');
7743
+ this.hex = parseColor$1(this.value, 'hex', this.opacity);
7560
7744
  this.rgba = getRGBA(this.value);
7561
- this.rgba.a = parseColor$1(this.value, 'rgba') ? this.rgba.a : 1;
7745
+ this.rgba.a = parseColor$1(this.value, 'rgba', this.opacity) ? this.rgba.a : 1;
7562
7746
  }
7563
7747
  }
7748
+ get formatButtonTitle() {
7749
+ return this.localizationService.get('formatButton');
7750
+ }
7564
7751
  handleRgbaValueChange() {
7565
7752
  const color = getColorFromRGBA(this.rgba);
7566
7753
  if (!this.rgbaInputValid || color === this.value) {
@@ -7568,12 +7755,12 @@ let ColorInputComponent = class ColorInputComponent {
7568
7755
  }
7569
7756
  this.value = color;
7570
7757
  this.rgba = getRGBA(this.value);
7571
- this.hex = parseColor$1(color, 'hex');
7758
+ this.hex = parseColor$1(color, 'hex', this.opacity);
7572
7759
  this.valueChange.emit(color);
7573
7760
  }
7574
7761
  handleHexValueChange(hex) {
7575
7762
  this.hex = hex;
7576
- const color = parseColor$1(hex, 'rgba');
7763
+ const color = parseColor$1(hex, 'rgba', this.opacity);
7577
7764
  if (!isPresent(color) || color === this.value) {
7578
7765
  return;
7579
7766
  }
@@ -7587,10 +7774,7 @@ let ColorInputComponent = class ColorInputComponent {
7587
7774
  }
7588
7775
  }
7589
7776
  handleHexInputBlur() {
7590
- this.hex = parseColor$1(this.value, 'hex');
7591
- }
7592
- textFor(key) {
7593
- return this.localization.get(key);
7777
+ this.hex = parseColor$1(this.value, 'hex', this.opacity);
7594
7778
  }
7595
7779
  toggleFormatView() {
7596
7780
  this.formatView = this.formatView === 'hex' ? 'rgba' : 'hex';
@@ -7602,6 +7786,10 @@ let ColorInputComponent = class ColorInputComponent {
7602
7786
  this.subscriptions.add(this.renderer.listen(this.toggleFormatButton.nativeElement, 'click', () => this.toggleFormatView()));
7603
7787
  }
7604
7788
  };
7789
+ __decorate([
7790
+ Input(),
7791
+ __metadata("design:type", String)
7792
+ ], ColorInputComponent.prototype, "focusableId", void 0);
7605
7793
  __decorate([
7606
7794
  Input(),
7607
7795
  __metadata("design:type", String)
@@ -7632,9 +7820,17 @@ __decorate([
7632
7820
  __metadata("design:type", Boolean)
7633
7821
  ], ColorInputComponent.prototype, "colorInputClass", void 0);
7634
7822
  __decorate([
7635
- ViewChild('opacityInput', { read: ElementRef, static: false }),
7636
- __metadata("design:type", ElementRef)
7823
+ ViewChild('opacityInput', { static: false }),
7824
+ __metadata("design:type", NumericTextBoxComponent)
7637
7825
  ], ColorInputComponent.prototype, "opacityInput", void 0);
7826
+ __decorate([
7827
+ ViewChild('hexInput', { read: ElementRef, static: false }),
7828
+ __metadata("design:type", ElementRef)
7829
+ ], ColorInputComponent.prototype, "hexInput", void 0);
7830
+ __decorate([
7831
+ ViewChild('blueInput', { read: ElementRef, static: false }),
7832
+ __metadata("design:type", ElementRef)
7833
+ ], ColorInputComponent.prototype, "blueInput", void 0);
7638
7834
  __decorate([
7639
7835
  ViewChild('toggleFormatButton', { static: false }),
7640
7836
  __metadata("design:type", ElementRef)
@@ -7644,20 +7840,27 @@ ColorInputComponent = __decorate([
7644
7840
  selector: 'kendo-colorinput',
7645
7841
  template: `
7646
7842
  <div class="k-vstack">
7647
- <button class="k-colorgradient-toggle-mode k-button k-icon-button k-flat" #toggleFormatButton>
7843
+ <button #toggleFormatButton
7844
+ class="k-colorgradient-toggle-mode k-button k-icon-button k-flat"
7845
+ [attr.aria-label]="formatButtonTitle"
7846
+ [attr.title]="formatButtonTitle"
7847
+ >
7648
7848
  <span class="k-button-icon k-icon k-i-arrows-kpi"></span>
7649
7849
  </button>
7650
7850
  </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
- />
7851
+ <div *ngIf="formatView === 'hex'" class="k-vstack">
7852
+ <input
7853
+ #hexInput
7854
+ [id]="focusableId"
7855
+ class="k-textbox k-hex-value"
7856
+ [disabled]="disabled"
7857
+ [readonly]="readonly"
7858
+ [value]="hex || ''"
7859
+ (blur)="handleHexInputBlur()"
7860
+ (input)="handleHexValueChange(hexInput.value)"
7861
+ />
7862
+ <label [for]="focusableId" class="k-colorgradient-input-label">HEX</label>
7863
+ </div>
7661
7864
  <ng-container *ngIf="formatView === 'rgba'">
7662
7865
  <div class="k-vstack">
7663
7866
  <kendo-numerictextbox
@@ -7666,7 +7869,6 @@ ColorInputComponent = __decorate([
7666
7869
  [readonly]="readonly"
7667
7870
  [min]="0"
7668
7871
  [max]="255"
7669
- [placeholder]="textFor('redInputPlaceholder')"
7670
7872
  [(value)]="rgba.r"
7671
7873
  [autoCorrect]="true"
7672
7874
  [spinners]="false"
@@ -7684,7 +7886,6 @@ ColorInputComponent = __decorate([
7684
7886
  [readonly]="readonly"
7685
7887
  [min]="0"
7686
7888
  [max]="255"
7687
- [placeholder]="textFor('greenInputPlaceholder')"
7688
7889
  [(value)]="rgba.g"
7689
7890
  [autoCorrect]="true"
7690
7891
  [spinners]="false"
@@ -7702,7 +7903,6 @@ ColorInputComponent = __decorate([
7702
7903
  [readonly]="readonly"
7703
7904
  [min]="0"
7704
7905
  [max]="255"
7705
- [placeholder]="textFor('blueInputPlaceholder')"
7706
7906
  [(value)]="rgba.b"
7707
7907
  [autoCorrect]="true"
7708
7908
  [spinners]="false"
@@ -7720,7 +7920,6 @@ ColorInputComponent = __decorate([
7720
7920
  [readonly]="readonly"
7721
7921
  [min]="0"
7722
7922
  [max]="1"
7723
- [placeholder]="textFor('alphaInputPlaceholder')"
7724
7923
  [(value)]="rgba.a"
7725
7924
  [autoCorrect]="true"
7726
7925
  [spinners]="false"
@@ -7735,32 +7934,11 @@ ColorInputComponent = __decorate([
7735
7934
  </ng-container>
7736
7935
  `
7737
7936
  }),
7738
- __metadata("design:paramtypes", [LocalizationService,
7739
- ElementRef,
7740
- Renderer2])
7937
+ __metadata("design:paramtypes", [ElementRef,
7938
+ Renderer2,
7939
+ LocalizationService])
7741
7940
  ], ColorInputComponent);
7742
7941
 
7743
- /**
7744
- * @hidden
7745
- */
7746
- const DEFAULT_OUTPUT_FORMAT = 'rgba';
7747
- /**
7748
- * @hidden
7749
- */
7750
- const DEFAULT_GRADIENT_BACKGROUND_COLOR = 'rgba(255, 0, 0, 1)';
7751
- /**
7752
- * @hidden
7753
- */
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
7942
  var ColorGradientComponent_1;
7765
7943
  let serial = 0;
7766
7944
  /**
@@ -7774,9 +7952,6 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7774
7952
  this.renderer = renderer;
7775
7953
  this.cdr = cdr;
7776
7954
  this.localizationService = localizationService;
7777
- /**
7778
- * @hidden
7779
- */
7780
7955
  this.hostClasses = true;
7781
7956
  /**
7782
7957
  * @hidden
@@ -7784,18 +7959,26 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7784
7959
  this.id = `k-colorgradient-${serial++}`;
7785
7960
  /**
7786
7961
  * Defines whether the alpha slider will be displayed.
7962
+ *
7963
+ * @default true
7787
7964
  */
7788
7965
  this.opacity = true;
7789
7966
  /**
7790
7967
  * Sets the disabled state of the ColorGradient.
7968
+ *
7969
+ * @default false
7791
7970
  */
7792
7971
  this.disabled = false;
7793
7972
  /**
7794
7973
  * Sets the read-only state of the ColorGradient.
7974
+ *
7975
+ * @default false
7795
7976
  */
7796
7977
  this.readonly = false;
7797
7978
  /**
7798
7979
  * Specifies whether the ColorGradient should display a 'Clear color' button.
7980
+ *
7981
+ * @default false
7799
7982
  */
7800
7983
  this.clearButton = false;
7801
7984
  /**
@@ -7804,6 +7987,16 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7804
7987
  * @default 0
7805
7988
  */
7806
7989
  this.delay = 0;
7990
+ /**
7991
+ * Specifies the output format of the ColorGradientComponent.
7992
+ * The input value may be in a different format, but it will be parsed into the output `format`
7993
+ * after the component processes it.
7994
+ *
7995
+ * The supported values are:
7996
+ * * (Default) `rgba`
7997
+ * * `hex`
7998
+ */
7999
+ this.format = DEFAULT_OUTPUT_FORMAT;
7807
8000
  /**
7808
8001
  * Fires each time the user selects a new color.
7809
8002
  */
@@ -7819,17 +8012,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7819
8012
  * The values are initially set in `ngOnInit` or in `ngOnChanges` and are
7820
8013
  * updated on moving the drag handle or the sliders.
7821
8014
  */
7822
- this.hsva = {};
7823
- /**
7824
- * Specifies the output format of the ColorGradientComponent.
7825
- * The input value may be in a different format. However, it will be parsed into the output `format`
7826
- * after the component processes it.
7827
- *
7828
- * The supported values are:
7829
- * * (Default) `rgba`
7830
- * * `hex`
7831
- */
7832
- this.format = DEFAULT_OUTPUT_FORMAT;
8015
+ this.hsva = new BehaviorSubject({});
7833
8016
  this._tabindex = 0;
7834
8017
  this.listeners = [];
7835
8018
  this.updateValues = new Subject();
@@ -7839,46 +8022,51 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7839
8022
  this.direction = rtl ? 'rtl' : 'ltr';
7840
8023
  });
7841
8024
  }
7842
- /**
7843
- * @hidden
7844
- */
7845
8025
  get readonlyAttribute() {
7846
8026
  return this.readonly;
7847
8027
  }
7848
- /**
7849
- * @hidden
7850
- */
7851
8028
  get disabledClass() {
7852
8029
  return this.disabled;
7853
8030
  }
7854
- /**
7855
- * @hidden
7856
- */
7857
- get hostTabindex() {
7858
- return this.tabindex;
7859
- }
7860
- /**
7861
- * @hidden
7862
- */
7863
8031
  get gradientId() {
7864
8032
  return this.id;
7865
8033
  }
8034
+ get hostTabindex() {
8035
+ return this.tabindex;
8036
+ }
7866
8037
  /**
7867
8038
  * Specifies the value of the initially selected color.
7868
8039
  */
7869
8040
  set value(value) {
7870
- this._value = parseColor$1(value, this.format);
8041
+ this._value = parseColor$1(value, this.format, this.opacity);
7871
8042
  }
7872
8043
  get value() {
7873
8044
  return this._value;
7874
8045
  }
8046
+ /**
8047
+ * Enables the color contrast tool. Accepts the background color that will be compared to the selected value.
8048
+ * The tool will calculate the contrast ratio between the two colors.
8049
+ */
8050
+ set contrastTool(value) {
8051
+ this._contrastTool = parseColor$1(value, this.format, this.opacity);
8052
+ }
8053
+ get contrastTool() {
8054
+ return this._contrastTool;
8055
+ }
7875
8056
  /**
7876
8057
  * Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
8058
+ *
8059
+ * @default 0
7877
8060
  */
7878
8061
  set tabindex(value) {
7879
- const tabindex = Number(value);
7880
- const defaultValue = 0;
7881
- this._tabindex = !isNaN(tabindex) ? tabindex : defaultValue;
8062
+ if (isPresent(value)) {
8063
+ const tabindex = Number(value);
8064
+ this._tabindex = !isNaN(tabindex) ? tabindex : 0;
8065
+ }
8066
+ else {
8067
+ // Allows removal of the tabindex attribute
8068
+ this._tabindex = value;
8069
+ }
7882
8070
  }
7883
8071
  get tabindex() {
7884
8072
  return !this.disabled ? this._tabindex : undefined;
@@ -7897,10 +8085,10 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7897
8085
  */
7898
8086
  get alphaSliderValue() {
7899
8087
  // setting the initial value to undefined to force the slider to recalculate the height of the slider track on the next cdr run
7900
- if (!(isPresent(this.hsva) && isPresent(this.hsva.a))) {
8088
+ if (!(isPresent(this.hsva.value) && isPresent(this.hsva.value.a))) {
7901
8089
  return;
7902
8090
  }
7903
- return this.hsva.a * 100;
8091
+ return this.hsva.value.a * 100;
7904
8092
  }
7905
8093
  get gradientRect() {
7906
8094
  return this.gradientWrapper.nativeElement.getBoundingClientRect();
@@ -7909,7 +8097,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7909
8097
  * @hidden
7910
8098
  */
7911
8099
  get contrastToolVisible() {
7912
- return typeof this.contrastTool === 'string' && this.contrastTool !== '';
8100
+ return this.contrastTool && this.contrastTool.length > 0;
7913
8101
  }
7914
8102
  ngAfterViewInit() {
7915
8103
  this.updateUI();
@@ -7940,7 +8128,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7940
8128
  if (this.disabled) {
7941
8129
  return;
7942
8130
  }
7943
- this.host.nativeElement.focus();
8131
+ this.gradientDragHandle.nativeElement.focus();
7944
8132
  }
7945
8133
  /**
7946
8134
  * @hidden
@@ -7978,7 +8166,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7978
8166
  return;
7979
8167
  }
7980
8168
  this.renderer.removeClass(this.gradientWrapper.nativeElement, 'k-dragging');
7981
- this.handleValueChange(getColorFromHSV(this.hsva));
8169
+ this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
7982
8170
  }
7983
8171
  /**
7984
8172
  * @hidden
@@ -8023,15 +8211,19 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
8023
8211
  return;
8024
8212
  }
8025
8213
  this.gradientDragHandle.nativeElement.focus();
8026
- const newX = position.clientX - this.gradientRect.left;
8027
- const newY = position.clientY - this.gradientRect.top;
8214
+ const gradientRect = this.gradientRect;
8215
+ const newX = position.clientX - gradientRect.left;
8216
+ const newY = position.clientY - gradientRect.top;
8028
8217
  this.ngZone.run(() => this.moveDragHandle(newX, newY));
8029
8218
  }
8030
8219
  /**
8031
8220
  * @hidden
8032
8221
  */
8033
8222
  handleHueSliderChange(hue) {
8034
- this.handleValueChange(getColorFromHSV(this.hsva));
8223
+ const hsva = this.hsva.value;
8224
+ hsva.h = hue;
8225
+ this.hsva.next(hsva);
8226
+ this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
8035
8227
  this.backgroundColor = getColorFromHue(hue);
8036
8228
  this.setAlphaSliderBackground(this.backgroundColor);
8037
8229
  }
@@ -8039,14 +8231,16 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
8039
8231
  * @hidden
8040
8232
  */
8041
8233
  handleAlphaSliderChange(alpha) {
8042
- this.hsva.a = alpha / 100;
8043
- this.handleValueChange(getColorFromHSV(this.hsva));
8234
+ const hsva = this.hsva.value;
8235
+ hsva.a = alpha / 100;
8236
+ this.hsva.next(hsva);
8237
+ this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
8044
8238
  }
8045
8239
  /**
8046
8240
  * @hidden
8047
8241
  */
8048
8242
  handleInputsValueChange(color) {
8049
- const parsed = parseColor$1(color, this.format);
8243
+ const parsed = parseColor$1(color, this.format, this.opacity);
8050
8244
  if (this.value !== parsed) {
8051
8245
  this.handleValueChange(parsed);
8052
8246
  this.updateUI();
@@ -8090,7 +8284,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
8090
8284
  * @hidden
8091
8285
  */
8092
8286
  get colorGradientHandleAriaLabel() {
8093
- const parsed = parseColor$1(this.value, this.format);
8287
+ const parsed = parseColor$1(this.value, this.format, this.opacity);
8094
8288
  return `${this.value ? parsed : this.localizationService.get('colorGradientHandle')}`;
8095
8289
  }
8096
8290
  /**
@@ -8113,29 +8307,35 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
8113
8307
  }
8114
8308
  /**
8115
8309
  * @hidden
8116
- * Used by the TextBoxContainer to determine if the component is empty.
8310
+ * Used by the FloatingLabel to determine if the component is empty.
8117
8311
  */
8118
8312
  isEmpty() {
8119
8313
  return false;
8120
8314
  }
8121
8315
  moveDragHandle(positionX, positionY) {
8122
- const top = fitIntoBounds(positionY, 0, this.gradientRect.height);
8123
- const left = fitIntoBounds(positionX, 0, this.gradientRect.width);
8316
+ const gradientRect = this.gradientRect;
8317
+ const gradientRectWidth = gradientRect.width;
8318
+ const gradientRectHeight = gradientRect.height;
8319
+ const top = fitIntoBounds(positionY, 0, gradientRectHeight);
8320
+ const left = fitIntoBounds(positionX, 0, gradientRectWidth);
8124
8321
  this.setDragHandleElementPosition(top, left);
8125
- this.hsva.s = left / this.gradientRect.width;
8126
- this.hsva.v = 1 - top / this.gradientRect.height;
8127
- this.updateValues.next(getColorFromHSV(this.hsva));
8128
- this.setAlphaSliderBackground(getColorFromHSV(Object.assign({}, this.hsva, { a: 1 })));
8322
+ const hsva = this.hsva.value;
8323
+ hsva.s = left / gradientRectWidth;
8324
+ hsva.v = 1 - top / gradientRectHeight;
8325
+ this.hsva.next(hsva);
8326
+ this.updateValues.next(getColorFromHSV(this.hsva.value, this.format, this.opacity));
8327
+ this.setAlphaSliderBackground(getColorFromHSV(Object.assign({}, this.hsva.value, { a: 1 }), this.format, this.opacity));
8129
8328
  }
8130
8329
  updateUI() {
8131
8330
  if (!isDocumentAvailable()) {
8132
8331
  return;
8133
8332
  }
8134
- this.hsva = this.value ? getHSV(this.value) : { h: 0, s: 0, v: 1, a: 1 };
8135
- const top = (1 - this.hsva.v) * this.gradientRect.height;
8136
- const left = this.hsva.s * this.gradientRect.width;
8333
+ this.hsva.next(this.value ? getHSV(this.value) : { h: 0, s: 0, v: 1, a: 1 });
8334
+ const gradientRect = this.gradientRect;
8335
+ const top = (1 - this.hsva.value.v) * gradientRect.height;
8336
+ const left = this.hsva.value.s * gradientRect.width;
8137
8337
  this.setDragHandleElementPosition(top, left);
8138
- this.backgroundColor = getColorFromHue(this.hsva.h);
8338
+ this.backgroundColor = getColorFromHue(this.hsva.value.h);
8139
8339
  this.setAlphaSliderBackground(this.backgroundColor);
8140
8340
  this.setHostElementAriaLabel();
8141
8341
  }
@@ -8161,7 +8361,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
8161
8361
  this.renderer.setStyle(sliderTrack, 'background', `linear-gradient(to top, transparent, ${backgroundColor})`);
8162
8362
  }
8163
8363
  setHostElementAriaLabel() {
8164
- const parsed = parseColor$1(this.value, this.format);
8364
+ const parsed = parseColor$1(this.value, this.format, this.opacity);
8165
8365
  this.renderer.setAttribute(this.host.nativeElement, 'aria-label', `${this.value ? parsed : this.localizationService.get('colorGradientNoColor')}`);
8166
8366
  }
8167
8367
  addEventListeners() {
@@ -8177,7 +8377,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
8177
8377
  const keyupListener = this.renderer.listen(this.gradientDragHandle.nativeElement, 'keyup', () => {
8178
8378
  this.renderer.removeClass(this.gradientWrapper.nativeElement, 'k-dragging');
8179
8379
  if (!this.readonly && !this.disabled) {
8180
- this.ngZone.run(() => this.handleValueChange(getColorFromHSV(this.hsva)));
8380
+ this.ngZone.run(() => this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity)));
8181
8381
  }
8182
8382
  });
8183
8383
  const dragHandleFocusInListener = this.renderer.listen(this.gradientDragHandle.nativeElement, 'focusin', () => {
@@ -8214,24 +8414,24 @@ __decorate([
8214
8414
  __metadata("design:type", Boolean),
8215
8415
  __metadata("design:paramtypes", [])
8216
8416
  ], ColorGradientComponent.prototype, "disabledClass", null);
8217
- __decorate([
8218
- HostBinding('attr.tabindex'),
8219
- __metadata("design:type", Number),
8220
- __metadata("design:paramtypes", [])
8221
- ], ColorGradientComponent.prototype, "hostTabindex", null);
8222
8417
  __decorate([
8223
8418
  HostBinding('attr.id'),
8224
8419
  __metadata("design:type", String),
8225
8420
  __metadata("design:paramtypes", [])
8226
8421
  ], ColorGradientComponent.prototype, "gradientId", null);
8227
- __decorate([
8228
- Input(),
8229
- __metadata("design:type", String)
8230
- ], ColorGradientComponent.prototype, "id", void 0);
8231
8422
  __decorate([
8232
8423
  HostBinding('attr.dir'),
8233
8424
  __metadata("design:type", String)
8234
8425
  ], ColorGradientComponent.prototype, "direction", void 0);
8426
+ __decorate([
8427
+ HostBinding('attr.tabindex'),
8428
+ __metadata("design:type", Number),
8429
+ __metadata("design:paramtypes", [])
8430
+ ], ColorGradientComponent.prototype, "hostTabindex", null);
8431
+ __decorate([
8432
+ Input(),
8433
+ __metadata("design:type", String)
8434
+ ], ColorGradientComponent.prototype, "id", void 0);
8235
8435
  __decorate([
8236
8436
  Input(),
8237
8437
  __metadata("design:type", Boolean)
@@ -8259,21 +8459,22 @@ __decorate([
8259
8459
  ], ColorGradientComponent.prototype, "value", null);
8260
8460
  __decorate([
8261
8461
  Input(),
8262
- __metadata("design:type", String)
8263
- ], ColorGradientComponent.prototype, "contrastTool", void 0);
8462
+ __metadata("design:type", String),
8463
+ __metadata("design:paramtypes", [String])
8464
+ ], ColorGradientComponent.prototype, "contrastTool", null);
8264
8465
  __decorate([
8265
8466
  Input(),
8266
8467
  __metadata("design:type", Number),
8267
8468
  __metadata("design:paramtypes", [Number])
8268
8469
  ], ColorGradientComponent.prototype, "tabindex", null);
8269
- __decorate([
8270
- Output(),
8271
- __metadata("design:type", EventEmitter)
8272
- ], ColorGradientComponent.prototype, "valueChange", void 0);
8273
8470
  __decorate([
8274
8471
  Input(),
8275
8472
  __metadata("design:type", String)
8276
8473
  ], ColorGradientComponent.prototype, "format", void 0);
8474
+ __decorate([
8475
+ Output(),
8476
+ __metadata("design:type", EventEmitter)
8477
+ ], ColorGradientComponent.prototype, "valueChange", void 0);
8277
8478
  __decorate([
8278
8479
  ViewChild('gradientDragHandle', { read: ElementRef, static: false }),
8279
8480
  __metadata("design:type", ElementRef)
@@ -8292,6 +8493,7 @@ __decorate([
8292
8493
  ], ColorGradientComponent.prototype, "gradientWrapper", void 0);
8293
8494
  ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8294
8495
  Component({
8496
+ exportAs: 'kendoColorGradient',
8295
8497
  selector: 'kendo-colorgradient',
8296
8498
  providers: [
8297
8499
  {
@@ -8325,22 +8527,14 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8325
8527
  hueSliderHandle="Set hue"
8326
8528
  i18n-opacitySliderHandle="kendo.colorgradient.opacitySliderHandle|The title for the opacity slider handle."
8327
8529
  opacitySliderHandle="Set opacity"
8328
- i18n-hexInputPlaceholder="kendo.colorgradient.hexInputPlaceholder|The placeholder for the HEX color input."
8329
- hexInputPlaceholder="HEX Color"
8330
- i18n-redInputPlaceholder="kendo.colorgradient.redInputPlaceholder|The placeholder for the red color input."
8331
- redInputPlaceholder="Red"
8332
- i18n-greenInputPlaceholder="kendo.colorgradient.greenInputPlaceholder|The placeholder for the green color input."
8333
- greenInputPlaceholder="Green"
8334
- i18n-blueInputPlaceholder="kendo.colorgradient.blueInputPlaceholder|The placeholder for the blue color input."
8335
- blueInputPlaceholder="Blue"
8336
- i18n-alphaInputPlaceholder="kendo.colorgradient.alphaInputPlaceholder|The placeholder for the alpha input."
8337
- alphaInputPlaceholder="Alpha"
8338
8530
  i18n-passContrast="kendo.colorgradient.passContrast|The pass message for the contrast tool."
8339
8531
  passContrast="Pass"
8340
8532
  i18n-failContrast="kendo.colorgradient.failContrast|The fail message for the contrast tool."
8341
8533
  failContrast="Fail"
8342
8534
  i18n-contrastRatio="kendo.colorgradient.contrastRatio|The contrast ratio message for the contrast tool."
8343
- contrastRatio="Contrast ratio">
8535
+ contrastRatio="Contrast ratio"
8536
+ i18n-formatButton="kendo.colorgradient.formatButton|The message for the input format toggle button."
8537
+ formatButton="Change color format">
8344
8538
  </ng-container>
8345
8539
  <div class="k-colorgradient-canvas k-hstack">
8346
8540
  <div class="k-hsv-rectangle" [style.background]="backgroundColor">
@@ -8361,6 +8555,14 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8361
8555
  >
8362
8556
  </div>
8363
8557
  </div>
8558
+ <svg kendoColorContrastSvg
8559
+ *ngIf="contrastToolVisible && gradientWrapper"
8560
+ class="k-color-contrast-svg"
8561
+ xmlns="http://www.w3.org/2000/svg"
8562
+ [wrapper]="gradientWrapper ? gradientWrapper : undefined"
8563
+ [hsva]="hsva"
8564
+ [backgroundColor]="contrastTool">
8565
+ </svg>
8364
8566
  </div>
8365
8567
  <div class="k-hsv-controls k-hstack {{ clearButton ? 'k-sliders-wrap-clearable' : '' }}">
8366
8568
  <span class="k-clear-color k-button k-flat k-button-icon"
@@ -8386,12 +8588,12 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8386
8588
  [max]="360"
8387
8589
  [smallStep]="5"
8388
8590
  [largeStep]="10"
8389
- [(value)]="hsva.h"
8591
+ [value]="hsva.value.h"
8390
8592
  (valueChange)="handleHueSliderChange($event)"
8391
8593
  >
8392
8594
  </kendo-slider>
8393
8595
  <kendo-slider
8394
- *ngIf="opacity && format === 'rgba'"
8596
+ *ngIf="opacity"
8395
8597
  #alphaSlider
8396
8598
  [ngClass]="{'k-align-self-end': clearButton}"
8397
8599
  class="k-alpha-slider k-colorgradient-slider"
@@ -8429,12 +8631,21 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8429
8631
  styles: [`
8430
8632
  .k-clear-color {
8431
8633
  position: absolute;
8634
+ top: 0;
8432
8635
  left: 50%;
8433
8636
  transform: translateX(-50%);
8434
8637
  }
8435
- .k-align-self-end {
8638
+ .k-colorgradient-slider.k-align-self-end {
8436
8639
  height: 140px;
8437
8640
  }
8641
+
8642
+ .k-color-contrast-svg {
8643
+ position: absolute;
8644
+ overflow: visible;
8645
+ pointer-events: none;
8646
+ left: 0px;
8647
+ top: 0px;
8648
+ }
8438
8649
  `]
8439
8650
  }),
8440
8651
  __metadata("design:paramtypes", [ElementRef,
@@ -8444,93 +8655,174 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8444
8655
  LocalizationService])
8445
8656
  ], ColorGradientComponent);
8446
8657
 
8447
- var ColorPickerComponent_1;
8448
- const DEFAULT_PRESET = 'office';
8449
- const DEFAULT_ACCESSIBLE_PRESET = 'accessible';
8658
+ /**
8659
+ * @hidden
8660
+ */
8661
+ let ColorPaletteService = class ColorPaletteService {
8662
+ /**
8663
+ * @hidden
8664
+ */
8665
+ constructor() {
8666
+ this.colorRows = [];
8667
+ }
8668
+ setColorMatrix(palette, columns) {
8669
+ this.colorRows = [];
8670
+ if (!(isPresent(palette) && palette.length)) {
8671
+ return;
8672
+ }
8673
+ columns = columns || palette.length;
8674
+ for (let start = 0; start < palette.length; start += columns) {
8675
+ const row = palette.slice(start, columns + start);
8676
+ this.colorRows.push(row);
8677
+ }
8678
+ }
8679
+ getCellCoordsFor(color) {
8680
+ if (!isPresent(color)) {
8681
+ return;
8682
+ }
8683
+ for (let row = 0; row < this.colorRows.length; row++) {
8684
+ for (let col = 0; col < this.colorRows[row].length; col++) {
8685
+ if (this.colorRows[row][col] === color) {
8686
+ return { row, col };
8687
+ }
8688
+ }
8689
+ }
8690
+ }
8691
+ getColorAt(cellCoords) {
8692
+ if (!(isPresent(cellCoords) && isPresent(this.colorRows[cellCoords.row]))) {
8693
+ return;
8694
+ }
8695
+ return this.colorRows[cellCoords.row][cellCoords.col];
8696
+ }
8697
+ getNextCell(current, horizontalStep, verticalStep) {
8698
+ if (!(isPresent(current) && isPresent(current.row) && isPresent(current.col))) {
8699
+ return { row: 0, col: 0 };
8700
+ }
8701
+ const row = this.clampIndex(current.row + verticalStep, this.colorRows.length - 1);
8702
+ const col = this.clampIndex(current.col + horizontalStep, this.colorRows[row].length - 1);
8703
+ return { row, col };
8704
+ }
8705
+ clampIndex(index, max) {
8706
+ const minArrayIndex = 0;
8707
+ if (index < minArrayIndex) {
8708
+ return minArrayIndex;
8709
+ }
8710
+ if (index > max) {
8711
+ return max;
8712
+ }
8713
+ return index;
8714
+ }
8715
+ };
8716
+ ColorPaletteService = __decorate([
8717
+ Injectable()
8718
+ ], ColorPaletteService);
8719
+
8720
+ /**
8721
+ * @hidden
8722
+ */
8723
+ let ColorPaletteLocalizationService = class ColorPaletteLocalizationService extends LocalizationService {
8724
+ constructor(prefix, messageService, _rtl, flatColorPickerLocalization) {
8725
+ super(prefix, messageService, _rtl);
8726
+ this.flatColorPickerLocalization = flatColorPickerLocalization;
8727
+ }
8728
+ get(shortKey) {
8729
+ if (this.flatColorPickerLocalization) {
8730
+ return this.flatColorPickerLocalization.get(shortKey);
8731
+ }
8732
+ return super.get(shortKey);
8733
+ }
8734
+ };
8735
+ ColorPaletteLocalizationService = __decorate([
8736
+ __param(0, Inject(L10N_PREFIX)),
8737
+ __param(1, Optional()),
8738
+ __param(2, Optional()), __param(2, Inject(RTL)),
8739
+ __param(3, Optional()), __param(3, Inject(FlatColorPickerLocalizationService)),
8740
+ __metadata("design:paramtypes", [String, MessageService, Boolean, FlatColorPickerLocalizationService])
8741
+ ], ColorPaletteLocalizationService);
8742
+
8743
+ var ColorPaletteComponent_1;
8744
+ const DEFAULT_TILE_SIZE = 24;
8745
+ const DEFAULT_COLUMNS_COUNT = 10;
8746
+ const DEFAULT_PRESET$1 = 'office';
8747
+ const DEFAULT_ACCESSIBLE_PRESET$1 = 'accessible';
8450
8748
  let serial$1 = 0;
8451
8749
  /**
8452
- * Represents the [Kendo UI ColorPicker component for Angular]({% slug overview_colorpicker %}).
8453
- * Designed to replace the `<input type="color">` HTML5 tag which is not widely supported in browsers.
8750
+ * The ColorPalette component provides a set of predefined palette presets and enables you to implement a custom color palette.
8751
+ * The ColorPalette is independently used by `kendo-colorpicker` and can be directly added to the page.
8454
8752
  */
8455
- let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
8456
- constructor(popupService, cdr, localizationService, ngZone) {
8457
- this.popupService = popupService;
8753
+ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponent {
8754
+ constructor(host, service, cdr, renderer, localizationService) {
8755
+ this.host = host;
8756
+ this.service = service;
8458
8757
  this.cdr = cdr;
8758
+ this.renderer = renderer;
8459
8759
  this.localizationService = localizationService;
8460
- this.ngZone = ngZone;
8461
8760
  /**
8462
8761
  * @hidden
8463
8762
  */
8464
- this.hostClasses = true;
8763
+ this.id = `k-colorpalette-${serial$1++}`;
8465
8764
  /**
8466
- * @hidden
8765
+ * Specifies the output format of the ColorPaletteComponent.
8766
+ * The input value may be in a different format. However, it will be parsed into the output `format`
8767
+ * after the component processes it.
8768
+ *
8769
+ * The supported values are:
8770
+ * * (Default) `hex`
8771
+ * * `rgba`
8772
+ * * `name`
8467
8773
  */
8468
- this.focusableId = `k-colorpicker-${serial$1++}`;
8774
+ this.format = 'hex';
8469
8775
  /**
8470
- * Sets what view the ColorPicker will render in the popup.
8776
+ * Sets the disabled state of the ColorPalette.
8471
8777
  */
8472
- this.view = 'gradient';
8778
+ this.disabled = false;
8473
8779
  /**
8474
- * Sets the read-only state of the ColorPicker.
8780
+ * Sets the read-only state of the ColorPalette.
8475
8781
  */
8476
8782
  this.readonly = false;
8477
8783
  /**
8478
- * Sets the disabled state of the ColorPicker.
8784
+ * Specifies the size of a color cell.
8785
+ *
8786
+ * The possible values are:
8787
+ * * (Default) `tileSize = 24`
8788
+ * * `{ width: number, height: number }`
8479
8789
  */
8480
- this.disabled = false;
8790
+ this.tileSize = { width: DEFAULT_TILE_SIZE, height: DEFAULT_TILE_SIZE };
8481
8791
  /**
8482
- * Specifies the output format of the ColorPicker.
8483
- * The input value may be in a different format. However, it will be parsed into the output `format`
8484
- * after the component processes it.
8485
- *
8486
- * If the `gradient` view is used with the `opacity` option set to true, this setting will be ignored and `rgba` will be used instead.
8487
- *
8488
- * The supported values are:
8489
- * * `rgba` (default)
8490
- * * `hex`
8491
- * * [name](https://www.w3.org/wiki/CSS/Properties/color/keywords)
8792
+ * Fires each time the color selection is changed.
8492
8793
  */
8493
- this.format = 'rgba';
8794
+ this.selectionChange = new EventEmitter();
8494
8795
  /**
8495
8796
  * Fires each time the value is changed.
8496
8797
  */
8497
8798
  this.valueChange = new EventEmitter();
8498
8799
  /**
8499
- * Fires each time the popup is about to open.
8500
- * This event is preventable. If you cancel it, the popup will remain closed.
8501
- */
8502
- this.open = new EventEmitter();
8503
- /**
8504
- * Fires each time the popup is about to close.
8505
- * This event is preventable. If you cancel it, the popup will remain open.
8506
- */
8507
- this.close = new EventEmitter();
8508
- /**
8509
- * Fires each time ColorPicker is focused.
8800
+ * Fires each time the user selects a cell with the mouse or presses `Enter`.
8801
+ *
8802
+ * @hidden
8510
8803
  */
8511
- this.onFocus = new EventEmitter();
8804
+ this.cellSelection = new EventEmitter();
8512
8805
  /**
8513
- * Fires each time the ColorPicker is blurred.
8806
+ * @hidden
8514
8807
  */
8515
- this.onBlur = new EventEmitter();
8808
+ this.hostClasses = true;
8516
8809
  /**
8517
- * Fires each time the left side of the ColorPicker wrapper is clicked.
8518
- * The event is triggered regardless of whether a ColorPicker icon is set or not.
8519
- *
8520
- * The [ActiveColorClickEvent]({% slug api_inputs_activecolorclickevent %}) event provides the option to prevent the popup opening.
8810
+ * @hidden
8521
8811
  */
8522
- this.activeColorClick = new EventEmitter();
8812
+ this.uniqueId = guid();
8523
8813
  this._tabindex = 0;
8524
- this._popupSettings = { animate: true };
8525
- this._paletteSettings = {};
8526
- this._gradientSettings = { opacity: true, clearButton: false, delay: 0 };
8527
8814
  this.notifyNgTouched = () => { };
8528
8815
  this.notifyNgChanged = () => { };
8529
- validatePackage(packageMetadata);
8530
- this.dynamicRTLSubscription = this.localizationService.changes.subscribe(({ rtl }) => {
8816
+ this.dynamicRTLSubscription = localizationService.changes.subscribe(({ rtl }) => {
8531
8817
  this.direction = rtl ? 'rtl' : 'ltr';
8532
8818
  });
8533
8819
  }
8820
+ /**
8821
+ * @hidden
8822
+ */
8823
+ get paletteId() {
8824
+ return this.id;
8825
+ }
8534
8826
  /**
8535
8827
  * Specifies the value of the initially selected color.
8536
8828
  */
@@ -8541,31 +8833,37 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
8541
8833
  return this._value;
8542
8834
  }
8543
8835
  /**
8544
- * Configures the popup of the ColorPicker.
8545
- */
8546
- set popupSettings(value) {
8547
- this._popupSettings = Object.assign(this._popupSettings, value);
8548
- }
8549
- get popupSettings() {
8550
- return this._popupSettings;
8551
- }
8552
- /**
8553
- * Configures the palette that is displayed in the ColorPicker popup.
8836
+ * Specifies the number of columns that will be displayed.
8837
+ * Defaults to `10`.
8554
8838
  */
8555
- set paletteSettings(value) {
8556
- this._paletteSettings = Object.assign(this._paletteSettings, value);
8839
+ set columns(value) {
8840
+ const minColumnsCount = 1;
8841
+ this._columns = value > minColumnsCount ? value : minColumnsCount;
8557
8842
  }
8558
- get paletteSettings() {
8559
- return this._paletteSettings;
8843
+ get columns() {
8844
+ return this._columns;
8560
8845
  }
8561
8846
  /**
8562
- * Configures the gradient that is displayed in the ColorPicker popup.
8847
+ * The color palette that will be displayed.
8848
+ *
8849
+ * The supported values are:
8850
+ * * The name of the predefined palette preset (for example, `office`, `basic`, and `apex`).
8851
+ * * A string with comma-separated colors.
8852
+ * * A string array.
8563
8853
  */
8564
- set gradientSettings(value) {
8565
- this._gradientSettings = Object.assign(this._gradientSettings, value);
8854
+ set palette(value) {
8855
+ if (!isPresent(value)) {
8856
+ value = DEFAULT_PRESET$1;
8857
+ }
8858
+ if (typeof value === 'string' && isPresent(PALETTEPRESETS[value])) {
8859
+ this.columns = this.columns || PALETTEPRESETS[value].columns;
8860
+ value = PALETTEPRESETS[value].colors;
8861
+ }
8862
+ const colors = (typeof value === 'string') ? value.split(',') : value;
8863
+ this._palette = colors.map(color => parseColor$1(color, this.format, false, false));
8566
8864
  }
8567
- get gradientSettings() {
8568
- return this._gradientSettings;
8865
+ get palette() {
8866
+ return this._palette;
8569
8867
  }
8570
8868
  /**
8571
8869
  * Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
@@ -8579,710 +8877,1265 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
8579
8877
  return !this.disabled ? this._tabindex : undefined;
8580
8878
  }
8581
8879
  /**
8582
- * Indicates whether the ColorPicker popup is open.
8880
+ * @hidden
8583
8881
  */
8584
- get isOpen() {
8585
- return isPresent(this.popupRef);
8882
+ get tileLayout() {
8883
+ if (typeof this.tileSize !== 'number') {
8884
+ return this.tileSize;
8885
+ }
8886
+ return { width: this.tileSize, height: this.tileSize };
8586
8887
  }
8587
8888
  /**
8588
8889
  * @hidden
8589
8890
  */
8590
- get iconStyles() {
8591
- if (this.iconClass) {
8592
- return this.iconClass;
8593
- }
8594
- if (this.icon) {
8595
- return `k-icon k-i-${this.icon}`;
8596
- }
8891
+ get colorRows() {
8892
+ return this.service.colorRows;
8597
8893
  }
8894
+ /**
8895
+ * @hidden
8896
+ */
8897
+ get hostTabindex() { return this.tabindex; }
8898
+ /**
8899
+ * @hidden
8900
+ */
8901
+ get disabledClass() { return this.disabled; }
8902
+ /**
8903
+ * @hidden
8904
+ */
8905
+ get readonlyAttribute() { return this.readonly; }
8598
8906
  ngOnInit() {
8599
- const defaultPreset = (this.format !== 'name') ? DEFAULT_PRESET : DEFAULT_ACCESSIBLE_PRESET;
8600
- const settingsPalette = this._paletteSettings.palette;
8601
- const presetColumns = typeof settingsPalette === 'string' && PALETTEPRESETS[settingsPalette] ?
8602
- PALETTEPRESETS[settingsPalette].columns :
8603
- undefined;
8604
- this._paletteSettings = {
8605
- palette: settingsPalette || defaultPreset,
8606
- tileSize: this._paletteSettings.tileSize || 24,
8607
- columns: this._paletteSettings.columns || presetColumns || 10
8608
- };
8609
- }
8610
- ngOnChanges(changes) {
8611
- if (changes.format && changes.format.currentValue === 'name') {
8612
- this.view = 'palette';
8613
- }
8614
- if (this.view === 'gradient' && this.gradientSettings.opacity) {
8615
- this.format = 'rgba';
8616
- this.value = parseColor$1(this.value, this.format);
8907
+ if (this.colorRows.length === 0) {
8908
+ const defaultPreset = (this.format !== 'name') ? DEFAULT_PRESET$1 : DEFAULT_ACCESSIBLE_PRESET$1;
8909
+ this.palette = this.palette || defaultPreset;
8910
+ this.setRows();
8911
+ this.focusedCell = this.service.getCellCoordsFor(this.value);
8617
8912
  }
8618
8913
  }
8914
+ ngAfterViewInit() {
8915
+ this.setHostElementAriaLabel();
8916
+ }
8619
8917
  ngOnDestroy() {
8620
- this.closePopup();
8621
8918
  if (this.dynamicRTLSubscription) {
8622
8919
  this.dynamicRTLSubscription.unsubscribe();
8623
8920
  }
8624
8921
  }
8922
+ ngOnChanges(changes) {
8923
+ if (changes.palette || changes.columns) {
8924
+ this.setRows();
8925
+ }
8926
+ if (changes.palette || changes.value || changes.columns) {
8927
+ this.focusedCell = this.service.getCellCoordsFor(this.value);
8928
+ this.setHostElementAriaLabel();
8929
+ }
8930
+ }
8625
8931
  /**
8626
8932
  * @hidden
8627
8933
  */
8628
- handleWrapperClick() {
8629
- this.toggleWithEvents(!this.isOpen);
8630
- this.focus();
8934
+ handleKeydown(event) {
8935
+ const isRTL = this.direction === 'rtl';
8936
+ switch (event.keyCode) {
8937
+ case Keys.ArrowDown:
8938
+ this.handleCellNavigation(0, 1);
8939
+ break;
8940
+ case Keys.ArrowUp:
8941
+ this.handleCellNavigation(0, -1);
8942
+ break;
8943
+ case Keys.ArrowRight:
8944
+ this.handleCellNavigation(isRTL ? -1 : 1, 0);
8945
+ break;
8946
+ case Keys.ArrowLeft:
8947
+ this.handleCellNavigation(isRTL ? 1 : -1, 0);
8948
+ break;
8949
+ case Keys.Enter:
8950
+ this.handleEnter();
8951
+ break;
8952
+ default: return;
8953
+ }
8954
+ event.preventDefault();
8631
8955
  }
8632
8956
  /**
8633
8957
  * @hidden
8634
8958
  */
8635
- handleActiveColorClick() {
8636
- this.focus();
8637
- const event = new ActiveColorClickEvent(this.value);
8638
- this.activeColorClick.emit(event);
8639
- if (!event.isOpenPrevented() || this.isOpen) {
8640
- this.handleWrapperClick();
8641
- }
8959
+ handleHostBlur() {
8960
+ this.notifyNgTouched();
8961
+ this.handleCellFocusOnBlur();
8642
8962
  }
8643
8963
  /**
8644
- * Focuses the wrapper of the ColorPicker.
8964
+ * @hidden
8645
8965
  */
8646
- focus() {
8647
- if (this.disabled) {
8966
+ handleCellSelection(value, focusedCell) {
8967
+ if (this.readonly) {
8648
8968
  return;
8649
8969
  }
8650
- this.wrapper.nativeElement.focus();
8970
+ this.selectedCell = focusedCell;
8971
+ this.focusedCell = this.selectedCell;
8972
+ this.focusInComponent = true;
8973
+ const parsedColor = parseColor$1(value, this.format, false, false);
8974
+ this.cellSelection.emit(parsedColor);
8975
+ this.handleValueChange(parsedColor);
8976
+ if (this.selection !== parsedColor) {
8977
+ this.selection = parsedColor;
8978
+ this.selectionChange.emit(parsedColor);
8979
+ }
8980
+ if (focusedCell) {
8981
+ this.activeCellId = `k-${this.selectedCell.row}-${this.selectedCell.col}-${this.uniqueId}`;
8982
+ }
8651
8983
  }
8652
8984
  /**
8653
8985
  * @hidden
8654
8986
  */
8655
- handleWrapperFocus() {
8656
- if (isPresent(this.palette)) {
8657
- this.palette.nativeElement.focus();
8658
- }
8659
- if (this.isFocused) {
8660
- return;
8661
- }
8662
- this.isFocused = true;
8663
- this.onFocus.emit();
8987
+ writeValue(value) {
8988
+ this.value = value;
8989
+ this.focusedCell = this.service.getCellCoordsFor(this.value);
8664
8990
  }
8665
8991
  /**
8666
- * Blurs the ColorPicker.
8992
+ * @hidden
8667
8993
  */
8668
- blur() {
8669
- this.wrapper.nativeElement.blur();
8994
+ registerOnChange(fn) {
8995
+ this.notifyNgChanged = fn;
8670
8996
  }
8671
8997
  /**
8672
8998
  * @hidden
8673
8999
  */
8674
- handleWrapperBlur() {
8675
- if (this.isOpen) {
8676
- return;
8677
- }
8678
- this.isFocused = false;
8679
- this.onBlur.emit();
8680
- this.notifyNgTouched();
9000
+ registerOnTouched(fn) {
9001
+ this.notifyNgTouched = fn;
8681
9002
  }
8682
9003
  /**
8683
- * Clears the color value of the ColorPicker.
9004
+ * @hidden
8684
9005
  */
8685
- reset() {
8686
- if (!isPresent(this.value)) {
8687
- return;
8688
- }
8689
- this._value = undefined;
8690
- this.notifyNgChanged(undefined);
9006
+ setDisabledState(isDisabled) {
9007
+ this.cdr.markForCheck();
9008
+ this.disabled = isDisabled;
8691
9009
  }
8692
9010
  /**
8693
- * Toggles the popup of the ColorPicker.
8694
- * Does not trigger the `open` and `close` events of the component.
8695
- *
8696
- * @param open An optional parameter. Specifies whether the popup will be opened or closed.
9011
+ * @hidden
9012
+ * Used by the FloatingLabel to determine if the component is empty.
8697
9013
  */
8698
- toggle(open) {
8699
- if (this.disabled || this.readonly) {
8700
- return;
8701
- }
8702
- this.closePopup();
8703
- open = isPresent(open) ? open : !this.isOpen;
8704
- if (open) {
8705
- this.openPopup();
8706
- }
9014
+ isEmpty() {
9015
+ return false;
8707
9016
  }
8708
9017
  /**
8709
- * @hidden
9018
+ * Clears the color value of the ColorPalette.
8710
9019
  */
8711
- handleValueChange(color, closePopup) {
8712
- const parsedColor = parseColor$1(color, this.format);
8713
- const valueChange = parsedColor !== this.value;
8714
- if (closePopup) {
8715
- this.toggleWithEvents(false);
8716
- this.focus();
8717
- }
8718
- if (valueChange) {
8719
- this.value = parsedColor;
8720
- this.valueChange.emit(parsedColor);
8721
- this.notifyNgChanged(parsedColor);
9020
+ reset() {
9021
+ this.focusedCell = null;
9022
+ if (isPresent(this.value)) {
9023
+ this.handleValueChange(undefined);
8722
9024
  }
9025
+ this.selectedCell = undefined;
8723
9026
  }
8724
- /**
8725
- * @hidden
8726
- */
8727
- handlePopupBlur(event) {
8728
- const focusInPopupElement = this.popupRef.popupElement.contains(event.relatedTarget);
8729
- const wrapperClicked = event.relatedTarget === this.wrapper.nativeElement;
8730
- if (!this.isFocused || wrapperClicked || focusInPopupElement) {
9027
+ handleValueChange(color) {
9028
+ if (this.value === color) {
8731
9029
  return;
8732
9030
  }
8733
- this.isFocused = false;
8734
- this.onBlur.emit();
8735
- this.notifyNgTouched();
8736
- this.toggleWithEvents(false);
8737
- }
8738
- /**
8739
- * @hidden
8740
- */
8741
- writeValue(value) {
8742
- this.value = value;
8743
- }
8744
- /**
8745
- * @hidden
8746
- */
8747
- registerOnChange(fn) {
8748
- this.notifyNgChanged = fn;
8749
- }
8750
- /**
8751
- * @hidden
8752
- */
8753
- registerOnTouched(fn) {
8754
- this.notifyNgTouched = fn;
8755
- }
8756
- /**
8757
- * @hidden
8758
- */
8759
- setDisabledState(isDisabled) {
8760
- this.cdr.markForCheck();
8761
- this.disabled = isDisabled;
9031
+ this.value = color;
9032
+ this.valueChange.emit(color);
9033
+ this.notifyNgChanged(color);
9034
+ this.setHostElementAriaLabel();
8762
9035
  }
8763
- /**
8764
- * @hidden
8765
- */
8766
- handleWrapperKeyDown(event) {
8767
- if (event.keyCode === Keys.ArrowDown || event.keyCode === Keys.Enter) {
8768
- event.preventDefault();
8769
- this.toggleWithEvents(true);
8770
- }
9036
+ handleCellFocusOnBlur() {
9037
+ this.focusInComponent = false;
9038
+ this.focusedCell = this.selectedCell;
8771
9039
  }
8772
- /**
8773
- * @hidden
8774
- */
8775
- handlePopupKeyDown(event) {
8776
- if (event.keyCode === Keys.Escape) {
8777
- this.toggleWithEvents(false);
8778
- this.wrapper.nativeElement.focus();
8779
- }
8780
- if (event.keyCode === Keys.Tab) {
8781
- const firstElement = this.colorGradient ? this.colorGradient.gradientDragHandle.nativeElement : this.palette.nativeElement;
8782
- const lastElement = this.palette ? this.palette.nativeElement :
8783
- this.colorGradient.inputs.opacityInput.nativeElement.childNodes[1].children[0];
8784
- if (event.shiftKey) {
8785
- if (event.target === firstElement) {
8786
- event.preventDefault();
8787
- lastElement.focus();
8788
- return;
8789
- }
8790
- }
8791
- else {
8792
- if (event.target === lastElement) {
8793
- event.preventDefault();
8794
- firstElement.focus();
8795
- return;
8796
- }
8797
- }
9040
+ setRows() {
9041
+ if (!isPresent(this.palette)) {
9042
+ return;
8798
9043
  }
9044
+ this.columns = this.columns || DEFAULT_COLUMNS_COUNT;
9045
+ this.service.setColorMatrix(this.palette, this.columns);
8799
9046
  }
8800
- /**
8801
- * @hidden
8802
- * Used by the TextBoxContainer to determine if the component is empty.
8803
- */
8804
- isEmpty() {
8805
- return false;
8806
- }
8807
- toggleWithEvents(open) {
8808
- const sameState = this.isOpen === open;
8809
- if (this.disabled || this.readonly || sameState) {
9047
+ handleCellNavigation(horizontalStep, verticalStep) {
9048
+ if (this.readonly) {
8810
9049
  return;
8811
9050
  }
8812
- const eventArgs = new PreventableEvent();
8813
- open ? this.open.emit(eventArgs) : this.close.emit(eventArgs);
8814
- if (!eventArgs.isDefaultPrevented()) {
8815
- this.toggle(open);
8816
- }
8817
- if (open) {
8818
- this.ngZone.runOutsideAngular(() => {
8819
- setTimeout(() => {
8820
- if (this.colorGradient) {
8821
- this.colorGradient.gradientDragHandle.nativeElement.focus();
8822
- }
8823
- });
8824
- });
8825
- }
9051
+ this.focusedCell = this.service.getNextCell(this.focusedCell, horizontalStep, verticalStep);
9052
+ this.focusInComponent = true;
8826
9053
  }
8827
- openPopup() {
8828
- const horizontalAlign = this.direction === "rtl" ? "right" : "left";
8829
- const anchorPosition = { horizontal: horizontalAlign, vertical: "bottom" };
8830
- const popupPosition = { horizontal: horizontalAlign, vertical: "top" };
8831
- this.popupRef = this.popupService.open({
8832
- anchor: this.wrapper,
8833
- animate: this.popupSettings.animate,
8834
- appendTo: this.popupSettings.appendTo,
8835
- popupAlign: popupPosition,
8836
- anchorAlign: anchorPosition,
8837
- popupClass: 'k-colorpicker-popup',
8838
- content: this.popupTemplate,
8839
- positionMode: 'absolute'
8840
- });
8841
- this.popupRef.popupAnchorViewportLeave.subscribe(() => {
8842
- this.toggleWithEvents(false);
8843
- if (!this.isOpen) {
8844
- this.wrapper.nativeElement.focus({
8845
- preventScroll: true
8846
- });
8847
- }
8848
- });
9054
+ setHostElementAriaLabel() {
9055
+ const parsed = parseColor$1(this.value, this.format);
9056
+ this.renderer.setAttribute(this.host.nativeElement, 'aria-label', `${this.value ? parsed : this.localizationService.get('colorPaletteNoColor')}`);
8849
9057
  }
8850
- closePopup() {
8851
- if (!this.isOpen) {
9058
+ handleEnter() {
9059
+ if (!isPresent(this.focusedCell)) {
8852
9060
  return;
8853
9061
  }
8854
- this.popupRef.close();
8855
- this.popupRef = null;
8856
- this.palette = null;
9062
+ const selectedColor = this.service.getColorAt(this.focusedCell);
9063
+ this.handleCellSelection(selectedColor, this.focusedCell);
8857
9064
  }
8858
9065
  };
8859
- __decorate([
8860
- HostBinding('class.k-widget'),
8861
- HostBinding('class.k-colorpicker'),
8862
- __metadata("design:type", Boolean)
8863
- ], ColorPickerComponent.prototype, "hostClasses", void 0);
8864
9066
  __decorate([
8865
9067
  HostBinding('attr.dir'),
8866
9068
  __metadata("design:type", String)
8867
- ], ColorPickerComponent.prototype, "direction", void 0);
9069
+ ], ColorPaletteComponent.prototype, "direction", void 0);
8868
9070
  __decorate([
8869
- Input(),
8870
- __metadata("design:type", String)
8871
- ], ColorPickerComponent.prototype, "focusableId", void 0);
9071
+ HostBinding('attr.id'),
9072
+ __metadata("design:type", String),
9073
+ __metadata("design:paramtypes", [])
9074
+ ], ColorPaletteComponent.prototype, "paletteId", null);
8872
9075
  __decorate([
8873
9076
  Input(),
8874
9077
  __metadata("design:type", String)
8875
- ], ColorPickerComponent.prototype, "view", void 0);
8876
- __decorate([
8877
- Input(),
8878
- __metadata("design:type", Boolean)
8879
- ], ColorPickerComponent.prototype, "readonly", void 0);
8880
- __decorate([
8881
- Input(),
8882
- __metadata("design:type", Boolean)
8883
- ], ColorPickerComponent.prototype, "disabled", void 0);
9078
+ ], ColorPaletteComponent.prototype, "id", void 0);
8884
9079
  __decorate([
8885
9080
  Input(),
8886
9081
  __metadata("design:type", String)
8887
- ], ColorPickerComponent.prototype, "format", void 0);
9082
+ ], ColorPaletteComponent.prototype, "format", void 0);
8888
9083
  __decorate([
8889
9084
  Input(),
8890
9085
  __metadata("design:type", String),
8891
9086
  __metadata("design:paramtypes", [String])
8892
- ], ColorPickerComponent.prototype, "value", null);
9087
+ ], ColorPaletteComponent.prototype, "value", null);
8893
9088
  __decorate([
8894
9089
  Input(),
8895
- __metadata("design:type", Object),
8896
- __metadata("design:paramtypes", [Object])
8897
- ], ColorPickerComponent.prototype, "popupSettings", null);
9090
+ __metadata("design:type", Number),
9091
+ __metadata("design:paramtypes", [Number])
9092
+ ], ColorPaletteComponent.prototype, "columns", null);
8898
9093
  __decorate([
8899
9094
  Input(),
8900
9095
  __metadata("design:type", Object),
8901
9096
  __metadata("design:paramtypes", [Object])
8902
- ], ColorPickerComponent.prototype, "paletteSettings", null);
9097
+ ], ColorPaletteComponent.prototype, "palette", null);
8903
9098
  __decorate([
8904
9099
  Input(),
8905
- __metadata("design:type", Object),
8906
- __metadata("design:paramtypes", [Object])
8907
- ], ColorPickerComponent.prototype, "gradientSettings", null);
9100
+ __metadata("design:type", Number),
9101
+ __metadata("design:paramtypes", [Number])
9102
+ ], ColorPaletteComponent.prototype, "tabindex", null);
8908
9103
  __decorate([
8909
9104
  Input(),
8910
- __metadata("design:type", String)
8911
- ], ColorPickerComponent.prototype, "icon", void 0);
9105
+ __metadata("design:type", Boolean)
9106
+ ], ColorPaletteComponent.prototype, "disabled", void 0);
8912
9107
  __decorate([
8913
9108
  Input(),
8914
- __metadata("design:type", Object)
8915
- ], ColorPickerComponent.prototype, "iconClass", void 0);
9109
+ __metadata("design:type", Boolean)
9110
+ ], ColorPaletteComponent.prototype, "readonly", void 0);
8916
9111
  __decorate([
8917
9112
  Input(),
8918
- __metadata("design:type", Number),
8919
- __metadata("design:paramtypes", [Number])
8920
- ], ColorPickerComponent.prototype, "tabindex", null);
9113
+ __metadata("design:type", Object)
9114
+ ], ColorPaletteComponent.prototype, "tileSize", void 0);
8921
9115
  __decorate([
8922
9116
  Output(),
8923
9117
  __metadata("design:type", EventEmitter)
8924
- ], ColorPickerComponent.prototype, "valueChange", void 0);
9118
+ ], ColorPaletteComponent.prototype, "selectionChange", void 0);
8925
9119
  __decorate([
8926
9120
  Output(),
8927
9121
  __metadata("design:type", EventEmitter)
8928
- ], ColorPickerComponent.prototype, "open", void 0);
9122
+ ], ColorPaletteComponent.prototype, "valueChange", void 0);
8929
9123
  __decorate([
8930
9124
  Output(),
8931
9125
  __metadata("design:type", EventEmitter)
8932
- ], ColorPickerComponent.prototype, "close", void 0);
8933
- __decorate([
8934
- Output('focus'),
8935
- __metadata("design:type", EventEmitter)
8936
- ], ColorPickerComponent.prototype, "onFocus", void 0);
8937
- __decorate([
8938
- Output('blur'),
8939
- __metadata("design:type", EventEmitter)
8940
- ], ColorPickerComponent.prototype, "onBlur", void 0);
9126
+ ], ColorPaletteComponent.prototype, "cellSelection", void 0);
8941
9127
  __decorate([
8942
- Output(),
8943
- __metadata("design:type", EventEmitter)
8944
- ], ColorPickerComponent.prototype, "activeColorClick", void 0);
9128
+ HostBinding('attr.tabindex'),
9129
+ __metadata("design:type", Number),
9130
+ __metadata("design:paramtypes", [])
9131
+ ], ColorPaletteComponent.prototype, "hostTabindex", null);
8945
9132
  __decorate([
8946
- ViewChild('container', { read: ViewContainerRef, static: true }),
8947
- __metadata("design:type", ViewContainerRef)
8948
- ], ColorPickerComponent.prototype, "container", void 0);
9133
+ HostBinding('class.k-colorpalette'),
9134
+ __metadata("design:type", Boolean)
9135
+ ], ColorPaletteComponent.prototype, "hostClasses", void 0);
8949
9136
  __decorate([
8950
- ViewChild('wrapper', { static: true }),
8951
- __metadata("design:type", ElementRef)
8952
- ], ColorPickerComponent.prototype, "wrapper", void 0);
9137
+ HostBinding('attr.aria-disabled'),
9138
+ HostBinding('class.k-state-disabled'),
9139
+ __metadata("design:type", Boolean),
9140
+ __metadata("design:paramtypes", [])
9141
+ ], ColorPaletteComponent.prototype, "disabledClass", null);
8953
9142
  __decorate([
8954
- ViewChild('popupTemplate', { static: true }),
8955
- __metadata("design:type", TemplateRef)
8956
- ], ColorPickerComponent.prototype, "popupTemplate", void 0);
9143
+ HostBinding('attr.aria-readonly'),
9144
+ __metadata("design:type", Boolean),
9145
+ __metadata("design:paramtypes", [])
9146
+ ], ColorPaletteComponent.prototype, "readonlyAttribute", null);
8957
9147
  __decorate([
8958
- ViewChild('palette', { read: ElementRef, static: false }),
8959
- __metadata("design:type", ElementRef)
8960
- ], ColorPickerComponent.prototype, "palette", void 0);
9148
+ HostListener('keydown', ['$event']),
9149
+ __metadata("design:type", Function),
9150
+ __metadata("design:paramtypes", [Object]),
9151
+ __metadata("design:returntype", void 0)
9152
+ ], ColorPaletteComponent.prototype, "handleKeydown", null);
8961
9153
  __decorate([
8962
- ViewChild('colorGradient', { static: false }),
8963
- __metadata("design:type", ColorGradientComponent)
8964
- ], ColorPickerComponent.prototype, "colorGradient", void 0);
8965
- ColorPickerComponent = ColorPickerComponent_1 = __decorate([
8966
- Component({
8967
- selector: 'kendo-colorpicker',
8968
- providers: [{
8969
- multi: true,
9154
+ HostListener('blur'),
9155
+ __metadata("design:type", Function),
9156
+ __metadata("design:paramtypes", []),
9157
+ __metadata("design:returntype", void 0)
9158
+ ], ColorPaletteComponent.prototype, "handleHostBlur", null);
9159
+ ColorPaletteComponent = ColorPaletteComponent_1 = __decorate([
9160
+ Component({
9161
+ exportAs: 'kendoColorPalette',
9162
+ selector: 'kendo-colorpalette',
9163
+ providers: [
9164
+ {
9165
+ multi: true,
8970
9166
  provide: NG_VALUE_ACCESSOR,
8971
- useExisting: forwardRef(() => ColorPickerComponent_1)
9167
+ useExisting: forwardRef(() => ColorPaletteComponent_1) // tslint:disable-line:no-forward-ref
8972
9168
  }, {
8973
9169
  provide: KendoInput,
8974
- useExisting: forwardRef(() => ColorPickerComponent_1)
9170
+ useExisting: forwardRef(() => ColorPaletteComponent_1)
8975
9171
  },
8976
- ColorPickerLocalizationService,
9172
+ ColorPaletteService,
9173
+ ColorPaletteLocalizationService,
8977
9174
  {
8978
9175
  provide: LocalizationService,
8979
- useExisting: ColorPickerLocalizationService
9176
+ useExisting: ColorPaletteLocalizationService
8980
9177
  },
8981
9178
  {
8982
9179
  provide: L10N_PREFIX,
8983
- useValue: 'kendo.colorpicker'
9180
+ useValue: 'kendo.colorpalette'
8984
9181
  }
8985
9182
  ],
8986
9183
  template: `
8987
- <ng-container kendoColorPickerLocalizedMessages
8988
- i18n-colorGradient="kendo.colorpicker.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty."
8989
- colorGradientNoColor="Colorgradient no color chosen"
8990
- i18n-colorGradient="kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
8991
- colorPaletteNoColor="Colorpalette no color chosen"
8992
- i18n-colorGradientHandle="kendo.colorpicker.colorGradientHandle|The title for the gradient color drag handle chooser."
8993
- colorGradientHandle="Choose color"
8994
- i18n-clearButton="kendo.colorpicker.clearButton|The title for the clear button."
8995
- clearButton="Clear value"
8996
- i18n-hueSliderHandle="kendo.colorpicker.hueSliderHandle|The title for the hue slider handle."
8997
- hueSliderHandle="Set hue"
8998
- i18n-opacitySliderHandle="kendo.colorpicker.opacitySliderHandle|The title for the opacity slider handle."
8999
- opacitySliderHandle="Set opacity"
9000
- i18n-hexInputPlaceholder="kendo.colorpicker.hexInputPlaceholder|The placeholder for the HEX color input."
9001
- hexInputPlaceholder="HEX Color"
9002
- i18n-redInputPlaceholder="kendo.colorpicker.redInputPlaceholder|The placeholder for the red color input."
9003
- redInputPlaceholder="Red"
9004
- i18n-greenInputPlaceholder="kendo.colorpicker.greenInputPlaceholder|The placeholder for the green color input."
9005
- greenInputPlaceholder="Green"
9006
- i18n-blueInputPlaceholder="kendo.colorpicker.blueInputPlaceholder|The placeholder for the blue color input."
9007
- blueInputPlaceholder="Blue"
9008
- i18n-alphaInputPlaceholder="kendo.colorpicker.alphaInputPlaceholder|The placeholder for the alpha input."
9009
- alphaInputPlaceholder="Alpha">
9184
+ <ng-container kendoColorPaletteLocalizedMessages
9185
+ i18n-colorPaletteNoColor="kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
9186
+ colorPaletteNoColor="Colorpalette no color chosen">
9010
9187
  </ng-container>
9011
- <span
9012
- #wrapper
9013
- [ngClass]="{
9014
- 'k-picker-wrap': true,
9015
- 'k-state-disabled': this.disabled,
9016
- 'k-state-focused': this.isFocused
9017
- }"
9018
- role="listbox"
9019
- [attr.aria-expanded]="isOpen"
9020
- [attr.aria-readonly]="readonly"
9021
- [attr.aria-disabled]="disabled"
9022
- [attr.aria-label]="value"
9023
- [id]="focusableId"
9024
- [attr.tabindex]="tabindex"
9025
- (focus)="handleWrapperFocus()"
9026
- (blur)="handleWrapperBlur()"
9027
- (mousedown)="$event.preventDefault()"
9028
- (keydown)="handleWrapperKeyDown($event)"
9029
- >
9030
- <span *ngIf="!iconStyles" class="k-selected-color" [style.background-color]="value" (click)="handleActiveColorClick()">
9031
- <span class="k-icon k-i-line" *ngIf="!value"></span>
9032
- </span>
9033
- <span *ngIf="iconStyles" class="k-tool-icon" [ngClass]="iconStyles" (click)="handleActiveColorClick()">
9034
- <span class="k-selected-color" [style.background-color]="value"></span>
9035
- </span>
9036
- <span class="k-select" (click)="handleWrapperClick()">
9037
- <span class="k-icon k-i-arrow-s"></span>
9038
- </span>
9039
- </span>
9040
- <ng-template #popupTemplate>
9041
- <kendo-colorgradient #colorGradient
9042
- *ngIf="view === 'gradient' || view === 'combo'"
9043
- [value]="value"
9044
- [format]="format"
9045
- [opacity]="gradientSettings.opacity"
9046
- [clearButton]="gradientSettings.clearButton"
9047
- [delay]="gradientSettings.delay"
9048
- (focusout)="handlePopupBlur($event)"
9049
- (valueChange)="handleValueChange($event, false)"
9050
- (keydown)="handlePopupKeyDown($event)"
9051
- >
9052
- </kendo-colorgradient>
9053
- <kendo-colorpalette
9054
- #palette
9055
- *ngIf="view === 'palette' || view === 'combo'"
9056
- kendoFocusOnDomReady
9057
- [palette]="paletteSettings.palette"
9058
- [columns]="paletteSettings.columns"
9059
- [tileSize]="paletteSettings.tileSize"
9060
- [format]="format"
9061
- [value]="value"
9062
- (blur)="handlePopupBlur($event)"
9063
- (cellSelection)="handleValueChange($event, true)"
9064
- (mousedown)="$event.preventDefault()"
9065
- (keydown)="handlePopupKeyDown($event)"
9066
- >
9067
- </kendo-colorpalette>
9068
- </ng-template>
9069
- <ng-container #container></ng-container>
9188
+ <div role="listbox" class="k-colorpalette-table-wrap"
9189
+ [attr.aria-activedescendant]="activeCellId">
9190
+ <table class="k-colorpalette-table k-palette">
9191
+ <tbody>
9192
+ <tr *ngFor="let row of colorRows; let rowIndex = index">
9193
+ <td *ngFor="let color of row; let colIndex = index"
9194
+ role="option"
9195
+ [class.k-state-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
9196
+ [class.k-state-focus]="focusInComponent && focusedCell?.row === rowIndex && focusedCell?.col === colIndex"
9197
+ [attr.aria-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
9198
+ [attr.aria-label]="color"
9199
+ class="k-colorpalette-tile"
9200
+ [id]="'k-' + rowIndex + '-' + colIndex + '-' + uniqueId"
9201
+ [attr.value]="color"
9202
+ (click)="handleCellSelection(color, { row: rowIndex, col: colIndex })"
9203
+ [ngStyle]="{
9204
+ backgroundColor: color,
9205
+ width: tileLayout.width + 'px',
9206
+ height: tileLayout.height + 'px',
9207
+ minWidth: tileLayout.width + 'px'
9208
+ }">
9209
+ </td>
9210
+ </tr>
9211
+ </tbody>
9212
+ </table>
9213
+ </div>
9070
9214
  `
9071
9215
  }),
9072
- __metadata("design:paramtypes", [PopupService,
9216
+ __metadata("design:paramtypes", [ElementRef,
9217
+ ColorPaletteService,
9073
9218
  ChangeDetectorRef,
9074
- LocalizationService,
9075
- NgZone])
9076
- ], ColorPickerComponent);
9219
+ Renderer2,
9220
+ LocalizationService])
9221
+ ], ColorPaletteComponent);
9077
9222
 
9078
9223
  /**
9079
9224
  * @hidden
9080
9225
  */
9081
- let ColorPaletteService = class ColorPaletteService {
9082
- /**
9083
- * @hidden
9084
- */
9085
- constructor() {
9086
- this.colorRows = [];
9087
- }
9088
- setColorMatrix(palette, columns) {
9089
- this.colorRows = [];
9090
- if (!(isPresent(palette) && palette.length)) {
9091
- return;
9092
- }
9093
- columns = columns || palette.length;
9094
- for (let start = 0; start < palette.length; start += columns) {
9095
- const row = palette.slice(start, columns + start);
9096
- this.colorRows.push(row);
9097
- }
9226
+ let FlatColorPickerHeaderComponent = class FlatColorPickerHeaderComponent {
9227
+ constructor(localizationService) {
9228
+ this.localizationService = localizationService;
9229
+ this.hostClasses = true;
9230
+ this.viewChange = new EventEmitter();
9231
+ this.valuePaneClick = new EventEmitter();
9232
+ this.clearButtonClick = new EventEmitter();
9098
9233
  }
9099
- getCellCoordsFor(color) {
9100
- if (!isPresent(color)) {
9101
- return;
9102
- }
9103
- for (let row = 0; row < this.colorRows.length; row++) {
9104
- for (let col = 0; col < this.colorRows[row].length; col++) {
9105
- if (this.colorRows[row][col] === color) {
9106
- return { row, col };
9107
- }
9108
- }
9109
- }
9234
+ onViewButtonClick(view) {
9235
+ this.activeView = view;
9236
+ this.viewChange.emit(view);
9110
9237
  }
9111
- getColorAt(cellCoords) {
9112
- if (!(isPresent(cellCoords) && isPresent(this.colorRows[cellCoords.row]))) {
9113
- return;
9114
- }
9115
- return this.colorRows[cellCoords.row][cellCoords.col];
9238
+ get viewButtons() {
9239
+ return this.views && this.views.indexOf('gradient') >= 0 && this.views.indexOf('palette') >= 0;
9116
9240
  }
9117
- getNextCell(current, horizontalStep, verticalStep) {
9118
- if (!(isPresent(current) && isPresent(current.row) && isPresent(current.col))) {
9119
- return { row: 0, col: 0 };
9120
- }
9121
- const row = this.clampIndex(current.row + verticalStep, this.colorRows.length - 1);
9122
- const col = this.clampIndex(current.col + horizontalStep, this.colorRows[row].length - 1);
9123
- return { row, col };
9241
+ getViewButtonIcon(view) {
9242
+ return view === 'gradient' ? 'k-i-color-canvas' : 'k-i-palette';
9124
9243
  }
9125
- clampIndex(index, max) {
9126
- const minArrayIndex = 0;
9127
- if (index < minArrayIndex) {
9128
- return minArrayIndex;
9129
- }
9130
- if (index > max) {
9131
- return max;
9132
- }
9133
- return index;
9244
+ getText(text) {
9245
+ return this.localizationService.get(text);
9134
9246
  }
9135
9247
  };
9136
- ColorPaletteService = __decorate([
9137
- Injectable()
9138
- ], ColorPaletteService);
9248
+ __decorate([
9249
+ HostBinding('class.k-coloreditor-header'),
9250
+ HostBinding('class.k-hstack'),
9251
+ __metadata("design:type", Boolean)
9252
+ ], FlatColorPickerHeaderComponent.prototype, "hostClasses", void 0);
9253
+ __decorate([
9254
+ Input(),
9255
+ __metadata("design:type", Boolean)
9256
+ ], FlatColorPickerHeaderComponent.prototype, "clearButton", void 0);
9257
+ __decorate([
9258
+ Input(),
9259
+ __metadata("design:type", String)
9260
+ ], FlatColorPickerHeaderComponent.prototype, "activeView", void 0);
9261
+ __decorate([
9262
+ Input(),
9263
+ __metadata("design:type", Array)
9264
+ ], FlatColorPickerHeaderComponent.prototype, "views", void 0);
9265
+ __decorate([
9266
+ Input(),
9267
+ __metadata("design:type", Boolean)
9268
+ ], FlatColorPickerHeaderComponent.prototype, "preview", void 0);
9269
+ __decorate([
9270
+ Input(),
9271
+ __metadata("design:type", String)
9272
+ ], FlatColorPickerHeaderComponent.prototype, "value", void 0);
9273
+ __decorate([
9274
+ Input(),
9275
+ __metadata("design:type", String)
9276
+ ], FlatColorPickerHeaderComponent.prototype, "selection", void 0);
9277
+ __decorate([
9278
+ Output(),
9279
+ __metadata("design:type", EventEmitter)
9280
+ ], FlatColorPickerHeaderComponent.prototype, "viewChange", void 0);
9281
+ __decorate([
9282
+ Output(),
9283
+ __metadata("design:type", EventEmitter)
9284
+ ], FlatColorPickerHeaderComponent.prototype, "valuePaneClick", void 0);
9285
+ __decorate([
9286
+ Output(),
9287
+ __metadata("design:type", EventEmitter)
9288
+ ], FlatColorPickerHeaderComponent.prototype, "clearButtonClick", void 0);
9289
+ __decorate([
9290
+ ViewChildren('viewButtons', { read: ElementRef }),
9291
+ __metadata("design:type", QueryList)
9292
+ ], FlatColorPickerHeaderComponent.prototype, "viewButtonsCollection", void 0);
9293
+ __decorate([
9294
+ ViewChild('clearButton', { read: ElementRef, static: false }),
9295
+ __metadata("design:type", ElementRef)
9296
+ ], FlatColorPickerHeaderComponent.prototype, "clearButtonElement", void 0);
9297
+ FlatColorPickerHeaderComponent = __decorate([
9298
+ Component({
9299
+ selector: '[kendoFlatColorPickerHeader]',
9300
+ template: `
9301
+ <div class="k-coloreditor-header-actions k-hstack">
9302
+ <div *ngIf="viewButtons" class="k-button-group k-button-group-flat">
9303
+ <button *ngFor="let view of views"
9304
+ #viewButtons
9305
+ (click)="onViewButtonClick(view)"
9306
+ class="k-button k-icon-button k-flat"
9307
+ [attr.title]="getText(view === 'gradient' ? 'gradientView' : 'paletteView')"
9308
+ [attr.aria-label]="getText(view === 'gradient' ? 'gradientView' : 'paletteView')"
9309
+ [attr.aria-pressed]="activeView === view"
9310
+ [ngClass]="activeView === view ? 'k-state-selected' : ''"
9311
+ >
9312
+ <span
9313
+ class="k-button-icon k-icon"
9314
+ [ngClass]="getViewButtonIcon(view)">
9315
+ </span>
9316
+ </button>
9317
+ </div>
9318
+ </div>
9319
+ <div class="k-spacer"></div>
9320
+ <div class="k-coloreditor-header-actions k-hstack">
9321
+ <button *ngIf="clearButton"
9322
+ #clearButton
9323
+ class="k-button k-icon-button k-flat k-coloreditor-reset"
9324
+ [attr.aria-label]="getText('clearButton')"
9325
+ [attr.title]="getText('clearButton')"
9326
+ (click)="clearButtonClick.emit()">
9327
+ <span class="k-button-icon k-icon k-i-reset-color"></span>
9328
+ </button>
9329
+ <div class="k-coloreditor-preview k-vstack" *ngIf="preview">
9330
+ <span
9331
+ class="k-coloreditor-preview-color k-color-preview"
9332
+ [attr.title]="getText('previewColor')"
9333
+ [style.background-color]="selection">
9334
+ </span>
9335
+ <span class="k-coloreditor-current-color k-color-preview"
9336
+ [style.background-color]="value"
9337
+ [attr.title]="getText('revertSelection')"
9338
+ (click)="valuePaneClick.emit($event)">
9339
+ </span>
9340
+ </div>
9341
+ </div>
9342
+ `
9343
+ }),
9344
+ __metadata("design:paramtypes", [LocalizationService])
9345
+ ], FlatColorPickerHeaderComponent);
9139
9346
 
9140
9347
  /**
9141
9348
  * @hidden
9142
9349
  */
9143
- let ColorPaletteLocalizationService = class ColorPaletteLocalizationService extends LocalizationService {
9144
- constructor(prefix, messageService, _rtl, colorPickerLocalization) {
9145
- super(prefix, messageService, _rtl);
9146
- this.colorPickerLocalization = colorPickerLocalization;
9350
+ let FlatColorPickerActionButtonsComponent = class FlatColorPickerActionButtonsComponent {
9351
+ constructor(localizationService) {
9352
+ this.localizationService = localizationService;
9353
+ this.hostClasses = true;
9354
+ this.actionButtonClick = new EventEmitter();
9147
9355
  }
9148
- get(shortKey) {
9149
- if (this.colorPickerLocalization) {
9150
- return this.colorPickerLocalization.get(shortKey);
9151
- }
9152
- return super.get(shortKey);
9356
+ getText(text) {
9357
+ return this.localizationService.get(text);
9358
+ }
9359
+ onActionButtonClick(type, ev) {
9360
+ let args = {
9361
+ target: type,
9362
+ originalEvent: ev
9363
+ };
9364
+ this.actionButtonClick.emit(args);
9153
9365
  }
9154
9366
  };
9155
- ColorPaletteLocalizationService = __decorate([
9156
- __param(0, Inject(L10N_PREFIX)),
9157
- __param(1, Optional()),
9158
- __param(2, Optional()), __param(2, Inject(RTL)),
9159
- __param(3, Optional()), __param(3, Inject(ColorPickerLocalizationService)),
9160
- __metadata("design:paramtypes", [String, MessageService, Boolean, ColorPickerLocalizationService])
9161
- ], ColorPaletteLocalizationService);
9367
+ __decorate([
9368
+ HostBinding('class.k-coloreditor-footer'),
9369
+ HostBinding('class.k-actions'),
9370
+ HostBinding('class.k-hstack'),
9371
+ __metadata("design:type", Boolean)
9372
+ ], FlatColorPickerActionButtonsComponent.prototype, "hostClasses", void 0);
9373
+ __decorate([
9374
+ Output(),
9375
+ __metadata("design:type", EventEmitter)
9376
+ ], FlatColorPickerActionButtonsComponent.prototype, "actionButtonClick", void 0);
9377
+ __decorate([
9378
+ ViewChild('last', { read: ElementRef, static: false }),
9379
+ __metadata("design:type", ElementRef)
9380
+ ], FlatColorPickerActionButtonsComponent.prototype, "lastButton", void 0);
9381
+ FlatColorPickerActionButtonsComponent = __decorate([
9382
+ Component({
9383
+ selector: '[kendoFlatColorPickerActionButtons]',
9384
+ template: `
9385
+ <button
9386
+ class="k-coloreditor-cancel k-button"
9387
+ [attr.title]="getText('cancelButton')"
9388
+ (click)="onActionButtonClick('cancel', $event)"
9389
+ >{{getText('cancelButton')}}</button>
9390
+ <button #last
9391
+ class="k-coloreditor-apply k-button k-primary"
9392
+ [attr.title]="getText('applyButton')"
9393
+ (click)="onActionButtonClick('apply', $event)"
9394
+ >{{getText('applyButton')}}</button>
9395
+ `
9396
+ }),
9397
+ __metadata("design:paramtypes", [LocalizationService])
9398
+ ], FlatColorPickerActionButtonsComponent);
9399
+
9400
+ var FlatColorPickerComponent_1;
9401
+ /**
9402
+ * Represents the [Kendo UI FlatColorPicker component for Angular]({% slug overview_flatcolorpicker %}).
9403
+ *
9404
+ * The FlatColorPicker is a powerful tool which allows the user to choose colors through palettes with predefined sets of colors and
9405
+ * through a gradient that renders an hsv canvas. It supports previewing the selected color, reverting it to its previous state or clearing it completely.
9406
+ */
9407
+ let FlatColorPickerComponent = FlatColorPickerComponent_1 = class FlatColorPickerComponent {
9408
+ constructor(service, host, localizationService, cdr, renderer, ngZone) {
9409
+ this.service = service;
9410
+ this.host = host;
9411
+ this.localizationService = localizationService;
9412
+ this.cdr = cdr;
9413
+ this.renderer = renderer;
9414
+ this.ngZone = ngZone;
9415
+ this.hostClasses = true;
9416
+ /**
9417
+ * Sets the read-only state of the FlatColorPicker.
9418
+ *
9419
+ * @default false
9420
+ */
9421
+ this.readonly = false;
9422
+ /**
9423
+ * Sets the disabled state of the FlatColorPicker.
9424
+ *
9425
+ * @default false
9426
+ */
9427
+ this.disabled = false;
9428
+ /**
9429
+ * Specifies the output format of the FlatColorPicker.
9430
+ *
9431
+ * If the input value is in a different format, it will be parsed into the specified output `format`.
9432
+ *
9433
+ * The supported values are:
9434
+ * * `rgba` (default)
9435
+ * * `hex`
9436
+ */
9437
+ this.format = 'rgba';
9438
+ /**
9439
+ * Specifies whether the FlatColorPicker should display a 'Clear color' button.
9440
+ *
9441
+ * @default true
9442
+ */
9443
+ this.clearButton = true;
9444
+ /**
9445
+ * Displays `Apply` and `Cancel` action buttons and a color preview pane.
9446
+ *
9447
+ * When enabled, the component value will not change immediately upon
9448
+ * color selection, but only after the `Apply` button is clicked.
9449
+ *
9450
+ * The `Cancel` button reverts the current selection to its
9451
+ * initial state i.e. to the current value.
9452
+ *
9453
+ * @default true
9454
+ */
9455
+ this.preview = true;
9456
+ /**
9457
+ * Configures the layout of the `Apply` and `Cancel` action buttons.
9458
+ * * `start`
9459
+ * * `center`
9460
+ * * `end` (default)
9461
+ * * `stretch`
9462
+ */
9463
+ this.actionsLayout = 'end';
9464
+ /**
9465
+ * Specifies the views that will be rendered. Default value is gradient and palette.
9466
+ */
9467
+ this.views = ['gradient', 'palette'];
9468
+ /**
9469
+ * Fires each time the component value is changed.
9470
+ */
9471
+ this.valueChange = new EventEmitter();
9472
+ /**
9473
+ * Fires when the user cancels the current color selection.
9474
+ *
9475
+ * The event is emitted on preview pane or on 'Cancel' button click.
9476
+ */
9477
+ this.cancel = new EventEmitter();
9478
+ /**
9479
+ * Fires each time the view is about to change.
9480
+ * Used to provide a two-way binding for the `activeView` property.
9481
+ */
9482
+ this.activeViewChange = new EventEmitter();
9483
+ /**
9484
+ * @hidden
9485
+ */
9486
+ this.actionButtonClick = new EventEmitter();
9487
+ this._tabindex = 0;
9488
+ this._gradientSettings = { opacity: true, delay: 0 };
9489
+ this._paletteSettings = {};
9490
+ this.subscriptions = new Subscription();
9491
+ this.notifyNgChanged = () => { };
9492
+ this.notifyNgTouched = () => { };
9493
+ this.dynamicRTLSubscription = this.localizationService.changes.subscribe(({ rtl }) => {
9494
+ this.direction = rtl ? 'rtl' : 'ltr';
9495
+ });
9496
+ }
9497
+ get disabledClass() {
9498
+ return this.disabled;
9499
+ }
9500
+ get ariaReadonly() {
9501
+ return this.readonly;
9502
+ }
9503
+ get hostTabindex() {
9504
+ return this.tabindex;
9505
+ }
9506
+ /**
9507
+ * Specifies the initially selected color.
9508
+ */
9509
+ set value(value) {
9510
+ this._value = parseColor$1(value, this.format, this.gradientSettings.opacity);
9511
+ }
9512
+ get value() {
9513
+ return this._value;
9514
+ }
9515
+ /**
9516
+ * Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
9517
+ *
9518
+ * @default 0
9519
+ */
9520
+ set tabindex(value) {
9521
+ const tabindex = Number(value);
9522
+ const defaultValue = 0;
9523
+ this._tabindex = !isNaN(tabindex) ? tabindex : defaultValue;
9524
+ }
9525
+ get tabindex() {
9526
+ return !this.disabled ? this._tabindex : undefined;
9527
+ }
9528
+ /**
9529
+ * Configures the gradient view.
9530
+ */
9531
+ set gradientSettings(value) {
9532
+ Object.assign(this._gradientSettings, value);
9533
+ }
9534
+ get gradientSettings() {
9535
+ return this._gradientSettings;
9536
+ }
9537
+ /**
9538
+ * Configures the palette view.
9539
+ */
9540
+ set paletteSettings(value) {
9541
+ Object.assign(this._paletteSettings, value);
9542
+ }
9543
+ get paletteSettings() {
9544
+ return this._paletteSettings;
9545
+ }
9546
+ ngOnInit() {
9547
+ this.selection = this.value;
9548
+ this._paletteSettings = this.service.getPaletteSettings(this._paletteSettings, this.format);
9549
+ this.setActiveView();
9550
+ }
9551
+ ngAfterViewInit() {
9552
+ this.setHostElementAriaLabel();
9553
+ this.initDomEvents();
9554
+ this.setSizingVariables();
9555
+ }
9556
+ ngOnChanges(changes) {
9557
+ if (isChanged('value', changes)) {
9558
+ this.setHostElementAriaLabel();
9559
+ }
9560
+ if (isChanged('paletteSettings', changes)) {
9561
+ this.setSizingVariables();
9562
+ }
9563
+ }
9564
+ ngOnDestroy() {
9565
+ if (this.dynamicRTLSubscription) {
9566
+ this.dynamicRTLSubscription.unsubscribe();
9567
+ }
9568
+ this.subscriptions.unsubscribe();
9569
+ }
9570
+ /**
9571
+ * @hidden
9572
+ */
9573
+ get headerHasContent() {
9574
+ return this.preview || this.views.length > 1 || this.clearButton;
9575
+ }
9576
+ /**
9577
+ * @hidden
9578
+ * Used by the FloatingLabel to determine if the component is empty.
9579
+ */
9580
+ isEmpty() {
9581
+ return false;
9582
+ }
9583
+ /**
9584
+ * Focuses the wrapper of the FlatColorPicker.
9585
+ */
9586
+ focus() {
9587
+ if (this.disabled && this.focused) {
9588
+ return;
9589
+ }
9590
+ this.host.nativeElement.focus();
9591
+ this.focused = true;
9592
+ }
9593
+ /**
9594
+ * Blurs the wrapper of the FlatColorPicker.
9595
+ */
9596
+ blur() {
9597
+ if (!this.focused) {
9598
+ return;
9599
+ }
9600
+ this.notifyNgTouched();
9601
+ this.host.nativeElement.blur();
9602
+ this.focused = false;
9603
+ }
9604
+ /**
9605
+ * Clears the value of the FlatColorPicker.
9606
+ */
9607
+ reset() {
9608
+ if (!isPresent(this.value)) {
9609
+ return;
9610
+ }
9611
+ this.value = undefined;
9612
+ this.notifyNgChanged(undefined);
9613
+ this.setHostElementAriaLabel();
9614
+ }
9615
+ /**
9616
+ * @hidden
9617
+ */
9618
+ onViewChange(view) {
9619
+ if (this.activeView === view) {
9620
+ return;
9621
+ }
9622
+ this.activeView = view;
9623
+ this.activeViewChange.emit(view);
9624
+ if (this.activeView === 'gradient') {
9625
+ this.ngZone.runOutsideAngular(() => {
9626
+ setTimeout(() => {
9627
+ this.gradient.gradientDragHandle.nativeElement.focus();
9628
+ });
9629
+ });
9630
+ }
9631
+ }
9632
+ /**
9633
+ * @hidden
9634
+ */
9635
+ onClearButtonClick() {
9636
+ this.resetInnerComponentValue();
9637
+ this.host.nativeElement.focus();
9638
+ }
9639
+ /**
9640
+ * @hidden
9641
+ */
9642
+ handleValueChange(color) {
9643
+ if (this.value === color) {
9644
+ return;
9645
+ }
9646
+ if (this.preview) {
9647
+ this.changeCurrentValue(color);
9648
+ }
9649
+ else {
9650
+ this.setFlatColorPickerValue(color);
9651
+ }
9652
+ }
9653
+ /**
9654
+ * @hidden
9655
+ */
9656
+ onAction(ev) {
9657
+ ev.target === 'apply' ? this.setFlatColorPickerValue(this.selection) : this.resetSelection(ev.originalEvent);
9658
+ this.actionButtonClick.emit();
9659
+ }
9660
+ /**
9661
+ * @hidden
9662
+ */
9663
+ writeValue(value) {
9664
+ this.value = value;
9665
+ }
9666
+ /**
9667
+ * @hidden
9668
+ */
9669
+ registerOnChange(fn) {
9670
+ this.notifyNgChanged = fn;
9671
+ }
9672
+ /**
9673
+ * @hidden
9674
+ */
9675
+ registerOnTouched(fn) {
9676
+ this.notifyNgTouched = fn;
9677
+ }
9678
+ /**
9679
+ * @hidden
9680
+ */
9681
+ setDisabledState(isDisabled) {
9682
+ this.cdr.markForCheck();
9683
+ this.disabled = isDisabled;
9684
+ }
9685
+ /**
9686
+ * @hidden
9687
+ */
9688
+ resetSelection(ev) {
9689
+ const eventArgs = new ColorPickerCancelEvent(ev);
9690
+ this.cancel.emit(eventArgs);
9691
+ if (!eventArgs.isDefaultPrevented()) {
9692
+ this.selection = this.value;
9693
+ }
9694
+ this.notifyNgTouched();
9695
+ }
9696
+ setHostElementAriaLabel() {
9697
+ const parsed = parseColor$1(this.value, this.format, this.gradientSettings.opacity);
9698
+ const ariaLabelValue = `${this.value ? parsed : this.localizationService.get('flatColorPickerNoColor')}`;
9699
+ this.renderer.setAttribute(this.host.nativeElement, 'aria-label', ariaLabelValue);
9700
+ }
9701
+ setSizingVariables() {
9702
+ const paletteTileSize = this.service.paletteTileLayout(this.paletteSettings.tileSize);
9703
+ const value = `--kendo-color-preview-columns: ${this.paletteSettings.columns};
9704
+ --kendo-color-preview-width: ${paletteTileSize.width}px;
9705
+ --kendo-color-preview-height: ${paletteTileSize.height}px;`;
9706
+ this.host.nativeElement.querySelector('.k-coloreditor-views.k-vstack').setAttribute('style', value);
9707
+ }
9708
+ changeCurrentValue(color) {
9709
+ this.selection = color;
9710
+ this.notifyNgTouched();
9711
+ }
9712
+ resetInnerComponentValue() {
9713
+ this.selection = null;
9714
+ if (this.gradient) {
9715
+ this.gradient.reset();
9716
+ return;
9717
+ }
9718
+ this.palette.reset();
9719
+ }
9720
+ setFlatColorPickerValue(color) {
9721
+ if (this.value === color) {
9722
+ return;
9723
+ }
9724
+ this.value = color;
9725
+ this.valueChange.emit(color);
9726
+ this.notifyNgChanged(color);
9727
+ this.setHostElementAriaLabel();
9728
+ }
9729
+ setActiveView() {
9730
+ if (!isPresent(this.activeView)) {
9731
+ this.activeView = this.views[0];
9732
+ return;
9733
+ }
9734
+ if (isDevMode() && this.views.indexOf(this.activeView) === -1) {
9735
+ throw new Error("Invalid configuration: The current activeView is not present in the views collection");
9736
+ }
9737
+ }
9738
+ initDomEvents() {
9739
+ if (!this.host) {
9740
+ return;
9741
+ }
9742
+ let hostElement = this.host.nativeElement;
9743
+ this.ngZone.runOutsideAngular(() => {
9744
+ this.subscriptions.add(this.renderer.listen(hostElement, 'focus', () => {
9745
+ this.focused = true;
9746
+ }));
9747
+ this.subscriptions.add(this.renderer.listen(hostElement, 'blur', () => {
9748
+ this.focused = false;
9749
+ this.notifyNgTouched();
9750
+ }));
9751
+ });
9752
+ }
9753
+ };
9754
+ __decorate([
9755
+ HostBinding('class.k-flatcolorpicker'),
9756
+ HostBinding('class.k-coloreditor'),
9757
+ __metadata("design:type", Boolean)
9758
+ ], FlatColorPickerComponent.prototype, "hostClasses", void 0);
9759
+ __decorate([
9760
+ HostBinding('class.k-state-disabled'),
9761
+ HostBinding('attr.aria-disabled'),
9762
+ __metadata("design:type", Boolean),
9763
+ __metadata("design:paramtypes", [])
9764
+ ], FlatColorPickerComponent.prototype, "disabledClass", null);
9765
+ __decorate([
9766
+ HostBinding('attr.aria-readonly'),
9767
+ __metadata("design:type", Boolean),
9768
+ __metadata("design:paramtypes", [])
9769
+ ], FlatColorPickerComponent.prototype, "ariaReadonly", null);
9770
+ __decorate([
9771
+ HostBinding('attr.dir'),
9772
+ __metadata("design:type", String)
9773
+ ], FlatColorPickerComponent.prototype, "direction", void 0);
9774
+ __decorate([
9775
+ HostBinding('attr.tabindex'),
9776
+ __metadata("design:type", Number),
9777
+ __metadata("design:paramtypes", [])
9778
+ ], FlatColorPickerComponent.prototype, "hostTabindex", null);
9779
+ __decorate([
9780
+ Input(),
9781
+ __metadata("design:type", Boolean)
9782
+ ], FlatColorPickerComponent.prototype, "readonly", void 0);
9783
+ __decorate([
9784
+ Input(),
9785
+ __metadata("design:type", Boolean)
9786
+ ], FlatColorPickerComponent.prototype, "disabled", void 0);
9787
+ __decorate([
9788
+ Input(),
9789
+ __metadata("design:type", String)
9790
+ ], FlatColorPickerComponent.prototype, "format", void 0);
9791
+ __decorate([
9792
+ Input(),
9793
+ __metadata("design:type", String),
9794
+ __metadata("design:paramtypes", [String])
9795
+ ], FlatColorPickerComponent.prototype, "value", null);
9796
+ __decorate([
9797
+ Input(),
9798
+ __metadata("design:type", Number),
9799
+ __metadata("design:paramtypes", [Number])
9800
+ ], FlatColorPickerComponent.prototype, "tabindex", null);
9801
+ __decorate([
9802
+ Input(),
9803
+ __metadata("design:type", Boolean)
9804
+ ], FlatColorPickerComponent.prototype, "clearButton", void 0);
9805
+ __decorate([
9806
+ Input(),
9807
+ __metadata("design:type", Boolean)
9808
+ ], FlatColorPickerComponent.prototype, "preview", void 0);
9809
+ __decorate([
9810
+ Input(),
9811
+ __metadata("design:type", String)
9812
+ ], FlatColorPickerComponent.prototype, "actionsLayout", void 0);
9813
+ __decorate([
9814
+ Input(),
9815
+ __metadata("design:type", String)
9816
+ ], FlatColorPickerComponent.prototype, "activeView", void 0);
9817
+ __decorate([
9818
+ Input(),
9819
+ __metadata("design:type", Array)
9820
+ ], FlatColorPickerComponent.prototype, "views", void 0);
9821
+ __decorate([
9822
+ Input(),
9823
+ __metadata("design:type", Object),
9824
+ __metadata("design:paramtypes", [Object])
9825
+ ], FlatColorPickerComponent.prototype, "gradientSettings", null);
9826
+ __decorate([
9827
+ Input(),
9828
+ __metadata("design:type", Object),
9829
+ __metadata("design:paramtypes", [Object])
9830
+ ], FlatColorPickerComponent.prototype, "paletteSettings", null);
9831
+ __decorate([
9832
+ Output(),
9833
+ __metadata("design:type", EventEmitter)
9834
+ ], FlatColorPickerComponent.prototype, "valueChange", void 0);
9835
+ __decorate([
9836
+ Output(),
9837
+ __metadata("design:type", EventEmitter)
9838
+ ], FlatColorPickerComponent.prototype, "cancel", void 0);
9839
+ __decorate([
9840
+ Output(),
9841
+ __metadata("design:type", EventEmitter)
9842
+ ], FlatColorPickerComponent.prototype, "activeViewChange", void 0);
9843
+ __decorate([
9844
+ Output(),
9845
+ __metadata("design:type", EventEmitter)
9846
+ ], FlatColorPickerComponent.prototype, "actionButtonClick", void 0);
9847
+ __decorate([
9848
+ ViewChild('header', { static: false }),
9849
+ __metadata("design:type", FlatColorPickerHeaderComponent)
9850
+ ], FlatColorPickerComponent.prototype, "header", void 0);
9851
+ __decorate([
9852
+ ViewChild('gradient', { static: false }),
9853
+ __metadata("design:type", ColorGradientComponent)
9854
+ ], FlatColorPickerComponent.prototype, "gradient", void 0);
9855
+ __decorate([
9856
+ ViewChild('palette', { static: false }),
9857
+ __metadata("design:type", ColorPaletteComponent)
9858
+ ], FlatColorPickerComponent.prototype, "palette", void 0);
9859
+ __decorate([
9860
+ ViewChild('footer', { static: false }),
9861
+ __metadata("design:type", FlatColorPickerActionButtonsComponent)
9862
+ ], FlatColorPickerComponent.prototype, "footer", void 0);
9863
+ FlatColorPickerComponent = FlatColorPickerComponent_1 = __decorate([
9864
+ Component({
9865
+ exportAs: 'kendoFlatColorPicker',
9866
+ selector: 'kendo-flatcolorpicker',
9867
+ providers: [
9868
+ {
9869
+ multi: true,
9870
+ provide: NG_VALUE_ACCESSOR,
9871
+ useExisting: forwardRef(() => FlatColorPickerComponent_1)
9872
+ },
9873
+ {
9874
+ provide: KendoInput,
9875
+ useExisting: forwardRef(() => FlatColorPickerComponent_1)
9876
+ },
9877
+ FlatColorPickerService,
9878
+ FlatColorPickerLocalizationService,
9879
+ {
9880
+ provide: LocalizationService,
9881
+ useExisting: FlatColorPickerLocalizationService
9882
+ },
9883
+ {
9884
+ provide: L10N_PREFIX,
9885
+ useValue: 'kendo.flatcolorpicker'
9886
+ }
9887
+ ],
9888
+ template: `
9889
+ <ng-container kendoFlatColorPickerLocalizedMessages
9890
+ i18n-flatColorPickerNoColor="kendo.flatcolorpicker.flatColorPickerNoColor|The aria-label applied to the FlatColorPicker component when the value is empty."
9891
+ flatColorPickerNoColor="Flatcolorpicker no color chosen"
9892
+ i18n-colorGradientNoColor="kendo.flatcolorpicker.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty."
9893
+ colorGradientNoColor="Colorgradient no color chosen"
9894
+ i18n-colorPaletteNoColor="kendo.flatcolorpicker.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
9895
+ colorPaletteNoColor="Colorpalette no color chosen"
9896
+ i18n-colorGradientHandle="kendo.flatcolorpicker.colorGradientHandle|The title for the gradient color drag handle chooser."
9897
+ colorGradientHandle="Choose color"
9898
+ i18n-clearButton="kendo.flatcolorpicker.clearButton|The title for the clear button."
9899
+ clearButton="Clear value"
9900
+ i18n-hueSliderHandle="kendo.flatcolorpicker.hueSliderHandle|The title for the hue slider handle."
9901
+ hueSliderHandle="Set hue"
9902
+ i18n-opacitySliderHandle="kendo.flatcolorpicker.opacitySliderHandle|The title for the opacity slider handle."
9903
+ opacitySliderHandle="Set opacity"
9904
+ i18n-contrastRatio="kendo.flatcolorpicker.contrastRatio|The contrast ratio message for the contrast tool."
9905
+ contrastRatio="Contrast ratio"
9906
+ i18n-previewColor="kendo.flatcolorpicker.previewColor|The message for the color preview pane."
9907
+ previewColor="Color preview"
9908
+ i18n-revertSelection="kendo.flatcolorpicker.revertSelection|The message for the selected color pane."
9909
+ revertSelection="Revert selection"
9910
+ i18n-gradientView="kendo.flatcolorpicker.gradientView|The message for the gradient view button."
9911
+ gradientView="Gradient view"
9912
+ i18n-paletteView="kendo.flatcolorpicker.paletteView|The message for the palette view button."
9913
+ paletteView="Palette view"
9914
+ i18n-formatButton="kendo.flatcolorpicker.formatButton|The message for the input format toggle button."
9915
+ formatButton="Change color format"
9916
+ i18n-applyButton="kendo.flatcolorpicker.applyButton|The message for the Apply action button."
9917
+ applyButton="Apply"
9918
+ i18n-cancelButton="kendo.flatcolorpicker.cancelButton|The message for the Cancel action button."
9919
+ cancelButton="Cancel">
9920
+ </ng-container>
9921
+ <div kendoFlatColorPickerHeader
9922
+ *ngIf="headerHasContent"
9923
+ #header
9924
+ [clearButton]="clearButton"
9925
+ [activeView]="activeView"
9926
+ [views]="views"
9927
+ [value]="value"
9928
+ [selection]="selection"
9929
+ [preview]="preview"
9930
+ (clearButtonClick)="onClearButtonClick()"
9931
+ (viewChange)="onViewChange($event)"
9932
+ (valuePaneClick)="resetSelection($event)">
9933
+ </div>
9934
+ <div class="k-coloreditor-views k-vstack">
9935
+ <kendo-colorgradient #gradient
9936
+ *ngIf="activeView === 'gradient'"
9937
+ [tabindex]="null"
9938
+ [value]="selection"
9939
+ [format]="format"
9940
+ [opacity]="gradientSettings.opacity"
9941
+ [delay]="gradientSettings.delay"
9942
+ [contrastTool]="gradientSettings.contrastTool"
9943
+ [readonly]="readonly"
9944
+ (valueChange)="handleValueChange($event)"
9945
+ >
9946
+ </kendo-colorgradient>
9947
+ <kendo-colorpalette #palette
9948
+ *ngIf="activeView === 'palette'"
9949
+ kendoFocusOnDomReady
9950
+ [palette]="paletteSettings.palette"
9951
+ [columns]="paletteSettings.columns"
9952
+ [tileSize]="paletteSettings.tileSize"
9953
+ [format]="format"
9954
+ [value]="selection"
9955
+ (valueChange)="handleValueChange($event)"
9956
+ >
9957
+ </kendo-colorpalette>
9958
+ </div>
9959
+ <div kendoFlatColorPickerActionButtons *ngIf="preview"
9960
+ #footer
9961
+ [ngClass]="'k-justify-content-' + actionsLayout"
9962
+ (actionButtonClick)="onAction($event)">
9963
+ </div>
9964
+ `
9965
+ }),
9966
+ __metadata("design:paramtypes", [FlatColorPickerService,
9967
+ ElementRef,
9968
+ LocalizationService,
9969
+ ChangeDetectorRef,
9970
+ Renderer2,
9971
+ NgZone])
9972
+ ], FlatColorPickerComponent);
9162
9973
 
9163
- var ColorPaletteComponent_1;
9164
- const DEFAULT_TILE_SIZE = 24;
9165
- const DEFAULT_COLUMNS_COUNT = 10;
9166
- const DEFAULT_PRESET$1 = 'office';
9167
- const DEFAULT_ACCESSIBLE_PRESET$1 = 'accessible';
9974
+ var ColorPickerComponent_1;
9168
9975
  let serial$2 = 0;
9169
9976
  /**
9170
- * The ColorPalette component provides a set of predefined palette presets and enables you to implement a custom color palette.
9171
- * The ColorPalette is independently used by `kendo-colorpicker` and can be directly added to the page.
9977
+ * Represents the [Kendo UI ColorPicker component for Angular]({% slug overview_colorpicker %}).
9978
+ *
9979
+ * The ColorPicker is a powerful tool for choosing colors from Gradient and Palette views
9980
+ * which are rendered in its popup. It supports previewing the selected color, reverting it to its previous state or clearing it completely.
9172
9981
  */
9173
- let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponent {
9174
- constructor(host, service, cdr, renderer, localizationService) {
9175
- this.host = host;
9176
- this.service = service;
9982
+ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
9983
+ constructor(popupService, cdr, localizationService, ngZone) {
9984
+ this.popupService = popupService;
9177
9985
  this.cdr = cdr;
9178
- this.renderer = renderer;
9179
9986
  this.localizationService = localizationService;
9987
+ this.ngZone = ngZone;
9988
+ this.hostClasses = true;
9180
9989
  /**
9181
9990
  * @hidden
9182
9991
  */
9183
- this.id = `k-colorpalette-${serial$2++}`;
9992
+ this.focusableId = `k-colorpicker-${serial$2++}`;
9184
9993
  /**
9185
- * Specifies the output format of the ColorPaletteComponent.
9186
- * The input value may be in a different format. However, it will be parsed into the output `format`
9187
- * after the component processes it.
9994
+ * Specifies the views that will be rendered in the popup.
9995
+ * By default both the gradient and palette views will be rendered.
9996
+ */
9997
+ this.views = ['gradient', 'palette'];
9998
+ /**
9999
+ * Sets the read-only state of the ColorPicker.
9188
10000
  *
9189
- * The supported values are:
9190
- * * (Default) `hex`
9191
- * * `rgba`
9192
- * * `name`
10001
+ * @default false
9193
10002
  */
9194
- this.format = 'hex';
10003
+ this.readonly = false;
9195
10004
  /**
9196
- * Sets the disabled state of the ColorPalette.
10005
+ * Sets the disabled state of the ColorPicker.
10006
+ *
10007
+ * @default false
9197
10008
  */
9198
10009
  this.disabled = false;
9199
10010
  /**
9200
- * Sets the read-only state of the ColorPalette.
10011
+ * Specifies the output format of the ColorPicker.
10012
+ *
10013
+ * If the input value is in a different format, it will be parsed into the specified output `format`.
10014
+ *
10015
+ * The supported values are:
10016
+ * * `rgba` (default)
10017
+ * * `hex`
9201
10018
  */
9202
- this.readonly = false;
10019
+ this.format = 'rgba';
9203
10020
  /**
9204
- * Specifies the size of a color cell.
10021
+ * Specifies whether the ColorPicker should display a 'Clear color' button.
9205
10022
  *
9206
- * The possible values are:
9207
- * * (Default) `tileSize = 24`
9208
- * * `{ width: number, height: number }`
10023
+ * @default true
9209
10024
  */
9210
- this.tileSize = { width: DEFAULT_TILE_SIZE, height: DEFAULT_TILE_SIZE };
10025
+ this.clearButton = true;
9211
10026
  /**
9212
- * Fires each time the color selection is changed.
10027
+ * Displays `Apply` and `Cancel` action buttons and color preview panes.
10028
+ *
10029
+ * When enabled, the component value will not change immediately upon
10030
+ * color selection, but only after the `Apply` button is clicked.
10031
+ *
10032
+ * The `Cancel` button reverts the current selection to its
10033
+ * previous state i.e. to the current value.
10034
+ *
10035
+ * @default false
9213
10036
  */
9214
- this.selectionChange = new EventEmitter();
10037
+ this.preview = false;
10038
+ /**
10039
+ * Configures the layout of the `Apply` and `Cancel` action buttons.
10040
+ *
10041
+ * The possible values are:
10042
+ * * `start`
10043
+ * * `center`
10044
+ * * `end` (default)
10045
+ * * `stretch`
10046
+ */
10047
+ this.actionsLayout = 'end';
9215
10048
  /**
9216
10049
  * Fires each time the value is changed.
9217
10050
  */
9218
10051
  this.valueChange = new EventEmitter();
9219
10052
  /**
9220
- * Fires each time the user selects a cell with the mouse or presses `Enter`.
10053
+ * Fires each time the popup is about to open.
10054
+ * This event is preventable. If you cancel it, the popup will remain closed.
10055
+ */
10056
+ this.open = new EventEmitter();
10057
+ /**
10058
+ * Fires each time the popup is about to close.
10059
+ * This event is preventable. If you cancel it, the popup will remain open.
10060
+ */
10061
+ this.close = new EventEmitter();
10062
+ /**
10063
+ * Fires each time ColorPicker is focused.
10064
+ */
10065
+ this.onFocus = new EventEmitter();
10066
+ /**
10067
+ * Fires each time the ColorPicker is blurred.
10068
+ */
10069
+ this.onBlur = new EventEmitter();
10070
+ /**
10071
+ * Fires when the user cancels the current color selection.
9221
10072
  *
9222
- * @hidden
10073
+ * Fires on preview pane or 'Cancel' button click.
9223
10074
  */
9224
- this.cellSelection = new EventEmitter();
10075
+ this.cancel = new EventEmitter();
9225
10076
  /**
9226
- * @hidden
10077
+ * Fires each time the left side of the ColorPicker wrapper is clicked.
10078
+ * The event is triggered regardless of whether a ColorPicker icon is set or not.
10079
+ *
10080
+ * The [ActiveColorClickEvent]({% slug api_inputs_activecolorclickevent %}) event provides the option to prevent the popup opening.
9227
10081
  */
9228
- this.hostClasses = true;
10082
+ this.activeColorClick = new EventEmitter();
10083
+ /**
10084
+ * Fires each time the view is about to change.
10085
+ * Used to provide a two-way binding for the `activeView` property.
10086
+ */
10087
+ this.activeViewChange = new EventEmitter();
9229
10088
  this._tabindex = 0;
10089
+ this._popupSettings = { animate: true };
10090
+ this._paletteSettings = {};
10091
+ this._gradientSettings = { opacity: true, delay: 0 };
9230
10092
  this.notifyNgTouched = () => { };
9231
10093
  this.notifyNgChanged = () => { };
9232
- this.dynamicRTLSubscription = localizationService.changes.subscribe(({ rtl }) => {
10094
+ validatePackage(packageMetadata);
10095
+ this.dynamicRTLSubscription = this.localizationService.changes.subscribe(({ rtl }) => {
9233
10096
  this.direction = rtl ? 'rtl' : 'ltr';
9234
10097
  });
9235
10098
  }
9236
- /**
9237
- * @hidden
9238
- */
9239
- get paletteId() {
9240
- return this.id;
9241
- }
9242
10099
  /**
9243
10100
  * Specifies the value of the initially selected color.
9244
10101
  */
9245
10102
  set value(value) {
9246
- this._value = parseColor$1(value, this.format);
10103
+ this._value = parseColor$1(value, this.format, this.gradientSettings.opacity);
9247
10104
  }
9248
10105
  get value() {
9249
10106
  return this._value;
9250
10107
  }
9251
10108
  /**
9252
- * Specifies the number of columns that will be displayed.
9253
- * Defaults to `10`.
10109
+ * Configures the popup of the ColorPicker.
9254
10110
  */
9255
- set columns(value) {
9256
- const minColumnsCount = 1;
9257
- this._columns = value > minColumnsCount ? value : minColumnsCount;
10111
+ set popupSettings(value) {
10112
+ this._popupSettings = Object.assign(this._popupSettings, value);
9258
10113
  }
9259
- get columns() {
9260
- return this._columns;
10114
+ get popupSettings() {
10115
+ return this._popupSettings;
9261
10116
  }
9262
10117
  /**
9263
- * The color palette that will be displayed.
9264
- *
9265
- * The supported values are:
9266
- * * The name of the predefined palette preset (for example, `office`, `basic`, and `apex`).
9267
- * * A string with comma-separated colors.
9268
- * * A string array.
10118
+ * Configures the palette that is displayed in the ColorPicker popup.
9269
10119
  */
9270
- set palette(value) {
9271
- if (!isPresent(value)) {
9272
- value = DEFAULT_PRESET$1;
9273
- }
9274
- if (typeof value === 'string' && isPresent(PALETTEPRESETS[value])) {
9275
- this.columns = this.columns || PALETTEPRESETS[value].columns;
9276
- value = PALETTEPRESETS[value].colors;
9277
- }
9278
- const colors = (typeof value === 'string') ? value.split(',') : value;
9279
- this._palette = colors.map(color => parseColor$1(color, this.format, false));
10120
+ set paletteSettings(value) {
10121
+ this._paletteSettings = Object.assign(this._paletteSettings, value);
9280
10122
  }
9281
- get palette() {
9282
- return this._palette;
10123
+ get paletteSettings() {
10124
+ return this._paletteSettings;
10125
+ }
10126
+ /**
10127
+ * Configures the gradient that is displayed in the ColorPicker popup.
10128
+ */
10129
+ set gradientSettings(value) {
10130
+ this._gradientSettings = Object.assign(this._gradientSettings, value);
10131
+ }
10132
+ get gradientSettings() {
10133
+ return this._gradientSettings;
9283
10134
  }
9284
10135
  /**
9285
10136
  * Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
10137
+ *
10138
+ * @default 0
9286
10139
  */
9287
10140
  set tabindex(value) {
9288
10141
  const tabindex = Number(value);
@@ -9292,122 +10145,171 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
9292
10145
  get tabindex() {
9293
10146
  return !this.disabled ? this._tabindex : undefined;
9294
10147
  }
10148
+ /**
10149
+ * Indicates whether the ColorPicker popup is open.
10150
+ */
10151
+ get isOpen() {
10152
+ return isPresent(this.popupRef);
10153
+ }
9295
10154
  /**
9296
10155
  * @hidden
9297
10156
  */
9298
- get tileLayout() {
9299
- if (typeof this.tileSize !== 'number') {
9300
- return this.tileSize;
10157
+ get iconStyles() {
10158
+ if (this.iconClass) {
10159
+ return this.iconClass;
10160
+ }
10161
+ if (this.icon) {
10162
+ return `k-icon k-i-${this.icon}`;
10163
+ }
10164
+ }
10165
+ ngOnInit() {
10166
+ const defaultPreset = (this.format !== 'name') ? DEFAULT_PRESET : DEFAULT_ACCESSIBLE_PRESET;
10167
+ const settingsPalette = this._paletteSettings.palette;
10168
+ const presetColumns = typeof settingsPalette === 'string' && PALETTEPRESETS[settingsPalette] ?
10169
+ PALETTEPRESETS[settingsPalette].columns :
10170
+ undefined;
10171
+ this._paletteSettings = {
10172
+ palette: settingsPalette || defaultPreset,
10173
+ tileSize: this._paletteSettings.tileSize || 24,
10174
+ columns: this._paletteSettings.columns || presetColumns || 10
10175
+ };
10176
+ }
10177
+ ngOnChanges(changes) {
10178
+ if (changes.format && changes.format.currentValue === 'name') {
10179
+ this.activeView = 'palette';
10180
+ }
10181
+ if (this.activeView === 'gradient' && this.gradientSettings.opacity) {
10182
+ this.format = 'rgba';
10183
+ this.value = parseColor$1(this.value, this.format, this.gradientSettings.opacity);
10184
+ }
10185
+ }
10186
+ ngOnDestroy() {
10187
+ this.closePopup();
10188
+ if (this.dynamicRTLSubscription) {
10189
+ this.dynamicRTLSubscription.unsubscribe();
9301
10190
  }
9302
- return { width: this.tileSize, height: this.tileSize };
9303
10191
  }
9304
10192
  /**
9305
10193
  * @hidden
9306
10194
  */
9307
- get colorRows() {
9308
- return this.service.colorRows;
10195
+ get colorPickerAriaLabel() {
10196
+ return this.value ? this.value : this.localizationService.get('colorPickerNoColor');
10197
+ }
10198
+ /**
10199
+ * @hidden
10200
+ */
10201
+ handleCancelEvent(ev) {
10202
+ this.cancel.emit(ev);
10203
+ }
10204
+ /**
10205
+ * @hidden
10206
+ */
10207
+ togglePopup() {
10208
+ this.toggleWithEvents(!this.isOpen);
10209
+ this.focus();
10210
+ }
10211
+ /**
10212
+ * @hidden
10213
+ */
10214
+ handleActiveColorClick() {
10215
+ this.focus();
10216
+ const event = new ActiveColorClickEvent(this.value);
10217
+ this.activeColorClick.emit(event);
10218
+ if (!event.isOpenPrevented() || this.isOpen) {
10219
+ this.togglePopup();
10220
+ }
10221
+ }
10222
+ /**
10223
+ * Focuses the wrapper of the ColorPicker.
10224
+ */
10225
+ focus() {
10226
+ if (this.disabled) {
10227
+ return;
10228
+ }
10229
+ this.wrapper.nativeElement.focus();
9309
10230
  }
9310
10231
  /**
9311
10232
  * @hidden
9312
10233
  */
9313
- get hostTabindex() { return this.tabindex; }
10234
+ handleWrapperFocus() {
10235
+ if (this.isFocused) {
10236
+ return;
10237
+ }
10238
+ this.isFocused = true;
10239
+ this.onFocus.emit();
10240
+ }
9314
10241
  /**
9315
- * @hidden
10242
+ * Blurs the ColorPicker.
9316
10243
  */
9317
- get disabledClass() { return this.disabled; }
10244
+ blur() {
10245
+ this.wrapper.nativeElement.blur();
10246
+ }
9318
10247
  /**
9319
10248
  * @hidden
9320
10249
  */
9321
- get readonlyAttribute() { return this.readonly; }
9322
- ngOnInit() {
9323
- if (this.colorRows.length === 0) {
9324
- const defaultPreset = (this.format !== 'name') ? DEFAULT_PRESET$1 : DEFAULT_ACCESSIBLE_PRESET$1;
9325
- this.palette = this.palette || defaultPreset;
9326
- this.setRows();
9327
- this.focusedCell = this.service.getCellCoordsFor(this.value);
9328
- }
9329
- }
9330
- ngAfterViewInit() {
9331
- this.setHostElementAriaLabel();
9332
- }
9333
- ngOnDestroy() {
9334
- if (this.dynamicRTLSubscription) {
9335
- this.dynamicRTLSubscription.unsubscribe();
9336
- }
9337
- }
9338
- ngOnChanges(changes) {
9339
- if (changes.palette || changes.columns) {
9340
- this.setRows();
9341
- }
9342
- if (changes.palette || changes.value || changes.columns) {
9343
- this.focusedCell = this.service.getCellCoordsFor(this.value);
9344
- this.setHostElementAriaLabel();
10250
+ handleWrapperBlur() {
10251
+ if (this.isOpen) {
10252
+ return;
9345
10253
  }
10254
+ this.isFocused = false;
10255
+ this.onBlur.emit();
10256
+ this.notifyNgTouched();
9346
10257
  }
9347
10258
  /**
9348
- * @hidden
10259
+ * Clears the value of the ColorPicker.
9349
10260
  */
9350
- handleKeydown(event) {
9351
- const isRTL = this.direction === 'rtl';
9352
- switch (event.keyCode) {
9353
- case Keys.ArrowDown:
9354
- this.handleCellNavigation(0, 1);
9355
- break;
9356
- case Keys.ArrowUp:
9357
- this.handleCellNavigation(0, -1);
9358
- break;
9359
- case Keys.ArrowRight:
9360
- this.handleCellNavigation(isRTL ? -1 : 1, 0);
9361
- break;
9362
- case Keys.ArrowLeft:
9363
- this.handleCellNavigation(isRTL ? 1 : -1, 0);
9364
- break;
9365
- case Keys.Enter:
9366
- this.handleEnter();
9367
- break;
9368
- default: return;
10261
+ reset() {
10262
+ if (!isPresent(this.value)) {
10263
+ return;
9369
10264
  }
9370
- event.preventDefault();
10265
+ this._value = undefined;
10266
+ this.notifyNgChanged(undefined);
9371
10267
  }
9372
10268
  /**
9373
- * @hidden
10269
+ * Toggles the popup of the ColorPicker.
10270
+ * Does not trigger the `open` and `close` events of the component.
10271
+ *
10272
+ * @param open An optional parameter. Specifies whether the popup will be opened or closed.
9374
10273
  */
9375
- handleHostBlur() {
9376
- this.notifyNgTouched();
9377
- this.handleCellFocusOnBlur();
10274
+ toggle(open) {
10275
+ if (this.disabled || this.readonly) {
10276
+ return;
10277
+ }
10278
+ this.closePopup();
10279
+ open = isPresent(open) ? open : !this.isOpen;
10280
+ if (open) {
10281
+ this.openPopup();
10282
+ }
9378
10283
  }
9379
10284
  /**
9380
10285
  * @hidden
9381
10286
  */
9382
- handleCellSelection(value, cell) {
9383
- if (this.readonly) {
9384
- return;
9385
- }
9386
- this.selectedCell = cell;
9387
- this.focusedCell = this.selectedCell;
9388
- this.focusInComponent = true;
9389
- const parsedColor = parseColor$1(value, this.format, false);
9390
- this.cellSelection.emit(parsedColor);
9391
- if (this.value !== parsedColor) {
10287
+ handleValueChange(color) {
10288
+ const parsedColor = parseColor$1(color, this.format, this.gradientSettings.opacity);
10289
+ const valueChange = parsedColor !== this.value;
10290
+ if (valueChange) {
9392
10291
  this.value = parsedColor;
9393
10292
  this.valueChange.emit(parsedColor);
9394
10293
  this.notifyNgChanged(parsedColor);
9395
- this.setHostElementAriaLabel();
9396
- }
9397
- if (this.selection !== parsedColor) {
9398
- this.selection = parsedColor;
9399
- this.selectionChange.emit(parsedColor);
9400
10294
  }
9401
- if (cell) {
9402
- this.activeCellId = `${this.selectedCell.row}-${this.selectedCell.col}`;
10295
+ }
10296
+ /**
10297
+ * @hidden
10298
+ */
10299
+ handlePopupBlur(event) {
10300
+ if (this.popupBlurInvalid(event)) {
10301
+ return;
9403
10302
  }
10303
+ this.isFocused = false;
10304
+ this.onBlur.emit();
10305
+ this.notifyNgTouched();
10306
+ this.toggleWithEvents(false);
9404
10307
  }
9405
10308
  /**
9406
10309
  * @hidden
9407
10310
  */
9408
10311
  writeValue(value) {
9409
10312
  this.value = value;
9410
- this.focusedCell = this.service.getCellCoordsFor(this.value);
9411
10313
  }
9412
10314
  /**
9413
10315
  * @hidden
@@ -9430,206 +10332,357 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
9430
10332
  }
9431
10333
  /**
9432
10334
  * @hidden
9433
- * Used by the TextBoxContainer to determine if the component is empty.
9434
10335
  */
9435
- isEmpty() {
9436
- return false;
10336
+ handleWrapperKeyDown(event) {
10337
+ if (event.keyCode === Keys.ArrowDown || event.keyCode === Keys.Enter) {
10338
+ event.preventDefault();
10339
+ this.toggleWithEvents(true);
10340
+ }
9437
10341
  }
9438
10342
  /**
9439
- * Clears the color value of the ColorPalette.
10343
+ * @hidden
9440
10344
  */
9441
- reset() {
9442
- this.focusedCell = null;
9443
- if (isPresent(this.value)) {
9444
- this._value = undefined;
9445
- this.notifyNgChanged(undefined);
10345
+ handlePopupKeyDown(event) {
10346
+ if (event.keyCode === Keys.Escape) {
10347
+ this.toggleWithEvents(false);
10348
+ this.wrapper.nativeElement.focus();
10349
+ }
10350
+ if (event.keyCode === Keys.Tab) {
10351
+ const currentElement = event.shiftKey ? this.firstFocusableElement.nativeElement : this.lastFocusableElement.nativeElement;
10352
+ const nextElement = event.shiftKey ? this.lastFocusableElement.nativeElement : this.firstFocusableElement.nativeElement;
10353
+ if (event.target === currentElement) {
10354
+ event.preventDefault();
10355
+ nextElement.nativeElement.focus();
10356
+ }
9446
10357
  }
9447
10358
  }
9448
- handleCellFocusOnBlur() {
9449
- this.focusInComponent = false;
9450
- this.focusedCell = this.selectedCell;
10359
+ /**
10360
+ * @hidden
10361
+ * Used by the FloatingLabel to determine if the component is empty.
10362
+ */
10363
+ isEmpty() {
10364
+ return false;
9451
10365
  }
9452
- setRows() {
9453
- if (!isPresent(this.palette)) {
10366
+ popupBlurInvalid(ev) {
10367
+ const focusInPopupElement = this.popupRef.popupElement.contains(ev.relatedTarget);
10368
+ const wrapperClicked = ev.relatedTarget === this.wrapper.nativeElement;
10369
+ return !this.isFocused || wrapperClicked || focusInPopupElement;
10370
+ }
10371
+ toggleWithEvents(open) {
10372
+ const sameState = this.isOpen === open;
10373
+ if (this.disabled || this.readonly || sameState) {
9454
10374
  return;
9455
10375
  }
9456
- this.columns = this.columns || DEFAULT_COLUMNS_COUNT;
9457
- this.service.setColorMatrix(this.palette, this.columns);
10376
+ let eventArgs;
10377
+ if (open) {
10378
+ eventArgs = new ColorPickerOpenEvent();
10379
+ this.open.emit(eventArgs);
10380
+ }
10381
+ else {
10382
+ eventArgs = new ColorPickerCloseEvent();
10383
+ this.close.emit(eventArgs);
10384
+ }
10385
+ if (!eventArgs.isDefaultPrevented()) {
10386
+ this.toggle(open);
10387
+ }
10388
+ if (open) {
10389
+ this.focusFirstElement();
10390
+ }
9458
10391
  }
9459
- handleCellNavigation(horizontalStep, verticalStep) {
9460
- if (this.readonly) {
10392
+ focusFirstElement() {
10393
+ this.ngZone.runOutsideAngular(() => {
10394
+ setTimeout(() => {
10395
+ const elementToFocus = this.flatColorPicker.gradient ? this.flatColorPicker.gradient.gradientDragHandle :
10396
+ this.flatColorPicker.palette.host;
10397
+ elementToFocus.nativeElement.focus();
10398
+ });
10399
+ });
10400
+ }
10401
+ openPopup() {
10402
+ const horizontalAlign = this.direction === "rtl" ? "right" : "left";
10403
+ const anchorPosition = { horizontal: horizontalAlign, vertical: "bottom" };
10404
+ const popupPosition = { horizontal: horizontalAlign, vertical: "top" };
10405
+ this.popupRef = this.popupService.open({
10406
+ anchor: this.wrapper,
10407
+ animate: this.popupSettings.animate,
10408
+ appendTo: this.popupSettings.appendTo,
10409
+ popupAlign: popupPosition,
10410
+ anchorAlign: anchorPosition,
10411
+ popupClass: 'k-colorpicker-popup',
10412
+ content: this.popupTemplate,
10413
+ positionMode: 'absolute'
10414
+ });
10415
+ this.popupRef.popupAnchorViewportLeave.subscribe(() => {
10416
+ this.toggleWithEvents(false);
10417
+ if (!this.isOpen) {
10418
+ this.wrapper.nativeElement.focus({
10419
+ preventScroll: true
10420
+ });
10421
+ }
10422
+ });
10423
+ }
10424
+ closePopup() {
10425
+ if (!this.isOpen) {
9461
10426
  return;
9462
10427
  }
9463
- this.focusedCell = this.service.getNextCell(this.focusedCell, horizontalStep, verticalStep);
9464
- this.focusInComponent = true;
10428
+ this.popupRef.close();
10429
+ this.popupRef = null;
9465
10430
  }
9466
- setHostElementAriaLabel() {
9467
- const parsed = parseColor$1(this.value, this.format);
9468
- this.renderer.setAttribute(this.host.nativeElement, 'aria-label', `${this.value ? parsed : this.localizationService.get('colorPaletteNoColor')}`);
10431
+ get firstFocusableElement() {
10432
+ if (!this.flatColorPicker.header || (this.views.length <= 1 && !this.flatColorPicker.clearButton)) {
10433
+ return this.flatColorPicker.gradient ? this.flatColorPicker.gradient.gradientDragHandle : this.flatColorPicker.palette.host;
10434
+ }
10435
+ return this.views.length > 1 ? this.flatColorPicker.header.viewButtonsCollection.toArray()[0] : this.flatColorPicker.header.clearButtonElement;
9469
10436
  }
9470
- handleEnter() {
9471
- if (!isPresent(this.focusedCell)) {
9472
- return;
10437
+ get lastFocusableElement() {
10438
+ if (this.preview) {
10439
+ return this.flatColorPicker.footer.lastButton;
9473
10440
  }
9474
- const selectedColor = this.service.getColorAt(this.focusedCell);
9475
- this.handleCellSelection(selectedColor, this.focusedCell);
10441
+ if (this.flatColorPicker.palette) {
10442
+ return this.flatColorPicker.palette.host;
10443
+ }
10444
+ return this.gradientSettings.opacity ? this.flatColorPicker.gradient.inputs.opacityInput.numericInput : this.flatColorPicker.gradient.inputs.blueInput;
9476
10445
  }
9477
10446
  };
10447
+ __decorate([
10448
+ HostBinding('class.k-colorpicker'),
10449
+ __metadata("design:type", Boolean)
10450
+ ], ColorPickerComponent.prototype, "hostClasses", void 0);
9478
10451
  __decorate([
9479
10452
  HostBinding('attr.dir'),
9480
10453
  __metadata("design:type", String)
9481
- ], ColorPaletteComponent.prototype, "direction", void 0);
10454
+ ], ColorPickerComponent.prototype, "direction", void 0);
9482
10455
  __decorate([
9483
- HostBinding('attr.id'),
9484
- __metadata("design:type", String),
9485
- __metadata("design:paramtypes", [])
9486
- ], ColorPaletteComponent.prototype, "paletteId", null);
10456
+ Input(),
10457
+ __metadata("design:type", String)
10458
+ ], ColorPickerComponent.prototype, "focusableId", void 0);
10459
+ __decorate([
10460
+ Input(),
10461
+ __metadata("design:type", Array)
10462
+ ], ColorPickerComponent.prototype, "views", void 0);
9487
10463
  __decorate([
9488
10464
  Input(),
9489
10465
  __metadata("design:type", String)
9490
- ], ColorPaletteComponent.prototype, "id", void 0);
10466
+ ], ColorPickerComponent.prototype, "activeView", void 0);
10467
+ __decorate([
10468
+ Input(),
10469
+ __metadata("design:type", Boolean)
10470
+ ], ColorPickerComponent.prototype, "readonly", void 0);
10471
+ __decorate([
10472
+ Input(),
10473
+ __metadata("design:type", Boolean)
10474
+ ], ColorPickerComponent.prototype, "disabled", void 0);
9491
10475
  __decorate([
9492
10476
  Input(),
9493
10477
  __metadata("design:type", String)
9494
- ], ColorPaletteComponent.prototype, "format", void 0);
10478
+ ], ColorPickerComponent.prototype, "format", void 0);
9495
10479
  __decorate([
9496
10480
  Input(),
9497
10481
  __metadata("design:type", String),
9498
10482
  __metadata("design:paramtypes", [String])
9499
- ], ColorPaletteComponent.prototype, "value", null);
10483
+ ], ColorPickerComponent.prototype, "value", null);
9500
10484
  __decorate([
9501
10485
  Input(),
9502
- __metadata("design:type", Number),
9503
- __metadata("design:paramtypes", [Number])
9504
- ], ColorPaletteComponent.prototype, "columns", null);
10486
+ __metadata("design:type", Object),
10487
+ __metadata("design:paramtypes", [Object])
10488
+ ], ColorPickerComponent.prototype, "popupSettings", null);
10489
+ __decorate([
10490
+ Input(),
10491
+ __metadata("design:type", Object),
10492
+ __metadata("design:paramtypes", [Object])
10493
+ ], ColorPickerComponent.prototype, "paletteSettings", null);
10494
+ __decorate([
10495
+ Input(),
10496
+ __metadata("design:type", Object),
10497
+ __metadata("design:paramtypes", [Object])
10498
+ ], ColorPickerComponent.prototype, "gradientSettings", null);
10499
+ __decorate([
10500
+ Input(),
10501
+ __metadata("design:type", String)
10502
+ ], ColorPickerComponent.prototype, "icon", void 0);
10503
+ __decorate([
10504
+ Input(),
10505
+ __metadata("design:type", Object)
10506
+ ], ColorPickerComponent.prototype, "iconClass", void 0);
9505
10507
  __decorate([
9506
10508
  Input(),
9507
- __metadata("design:type", Object),
9508
- __metadata("design:paramtypes", [Object])
9509
- ], ColorPaletteComponent.prototype, "palette", null);
10509
+ __metadata("design:type", Boolean)
10510
+ ], ColorPickerComponent.prototype, "clearButton", void 0);
9510
10511
  __decorate([
9511
10512
  Input(),
9512
10513
  __metadata("design:type", Number),
9513
10514
  __metadata("design:paramtypes", [Number])
9514
- ], ColorPaletteComponent.prototype, "tabindex", null);
10515
+ ], ColorPickerComponent.prototype, "tabindex", null);
9515
10516
  __decorate([
9516
10517
  Input(),
9517
10518
  __metadata("design:type", Boolean)
9518
- ], ColorPaletteComponent.prototype, "disabled", void 0);
10519
+ ], ColorPickerComponent.prototype, "preview", void 0);
9519
10520
  __decorate([
9520
10521
  Input(),
9521
- __metadata("design:type", Boolean)
9522
- ], ColorPaletteComponent.prototype, "readonly", void 0);
10522
+ __metadata("design:type", String)
10523
+ ], ColorPickerComponent.prototype, "actionsLayout", void 0);
9523
10524
  __decorate([
9524
- Input(),
9525
- __metadata("design:type", Object)
9526
- ], ColorPaletteComponent.prototype, "tileSize", void 0);
10525
+ Output(),
10526
+ __metadata("design:type", EventEmitter)
10527
+ ], ColorPickerComponent.prototype, "valueChange", void 0);
9527
10528
  __decorate([
9528
10529
  Output(),
9529
10530
  __metadata("design:type", EventEmitter)
9530
- ], ColorPaletteComponent.prototype, "selectionChange", void 0);
10531
+ ], ColorPickerComponent.prototype, "open", void 0);
9531
10532
  __decorate([
9532
10533
  Output(),
9533
10534
  __metadata("design:type", EventEmitter)
9534
- ], ColorPaletteComponent.prototype, "valueChange", void 0);
10535
+ ], ColorPickerComponent.prototype, "close", void 0);
10536
+ __decorate([
10537
+ Output('focus'),
10538
+ __metadata("design:type", EventEmitter)
10539
+ ], ColorPickerComponent.prototype, "onFocus", void 0);
10540
+ __decorate([
10541
+ Output('blur'),
10542
+ __metadata("design:type", EventEmitter)
10543
+ ], ColorPickerComponent.prototype, "onBlur", void 0);
9535
10544
  __decorate([
9536
10545
  Output(),
9537
10546
  __metadata("design:type", EventEmitter)
9538
- ], ColorPaletteComponent.prototype, "cellSelection", void 0);
10547
+ ], ColorPickerComponent.prototype, "cancel", void 0);
9539
10548
  __decorate([
9540
- HostBinding('attr.tabindex'),
9541
- __metadata("design:type", Number),
9542
- __metadata("design:paramtypes", [])
9543
- ], ColorPaletteComponent.prototype, "hostTabindex", null);
10549
+ Output(),
10550
+ __metadata("design:type", EventEmitter)
10551
+ ], ColorPickerComponent.prototype, "activeColorClick", void 0);
9544
10552
  __decorate([
9545
- HostBinding('class.k-colorpalette'),
9546
- __metadata("design:type", Boolean)
9547
- ], ColorPaletteComponent.prototype, "hostClasses", void 0);
10553
+ Output(),
10554
+ __metadata("design:type", EventEmitter)
10555
+ ], ColorPickerComponent.prototype, "activeViewChange", void 0);
9548
10556
  __decorate([
9549
- HostBinding('attr.aria-disabled'),
9550
- HostBinding('class.k-state-disabled'),
9551
- __metadata("design:type", Boolean),
9552
- __metadata("design:paramtypes", [])
9553
- ], ColorPaletteComponent.prototype, "disabledClass", null);
10557
+ ViewChild('container', { read: ViewContainerRef, static: true }),
10558
+ __metadata("design:type", ViewContainerRef)
10559
+ ], ColorPickerComponent.prototype, "container", void 0);
9554
10560
  __decorate([
9555
- HostBinding('attr.aria-readonly'),
9556
- __metadata("design:type", Boolean),
9557
- __metadata("design:paramtypes", [])
9558
- ], ColorPaletteComponent.prototype, "readonlyAttribute", null);
10561
+ ViewChild('wrapper', { static: true }),
10562
+ __metadata("design:type", ElementRef)
10563
+ ], ColorPickerComponent.prototype, "wrapper", void 0);
9559
10564
  __decorate([
9560
- HostListener('keydown', ['$event']),
9561
- __metadata("design:type", Function),
9562
- __metadata("design:paramtypes", [Object]),
9563
- __metadata("design:returntype", void 0)
9564
- ], ColorPaletteComponent.prototype, "handleKeydown", null);
10565
+ ViewChild('popupTemplate', { static: true }),
10566
+ __metadata("design:type", TemplateRef)
10567
+ ], ColorPickerComponent.prototype, "popupTemplate", void 0);
9565
10568
  __decorate([
9566
- HostListener('blur'),
9567
- __metadata("design:type", Function),
9568
- __metadata("design:paramtypes", []),
9569
- __metadata("design:returntype", void 0)
9570
- ], ColorPaletteComponent.prototype, "handleHostBlur", null);
9571
- ColorPaletteComponent = ColorPaletteComponent_1 = __decorate([
10569
+ ViewChild('flatColorPicker', { static: false }),
10570
+ __metadata("design:type", FlatColorPickerComponent)
10571
+ ], ColorPickerComponent.prototype, "flatColorPicker", void 0);
10572
+ ColorPickerComponent = ColorPickerComponent_1 = __decorate([
9572
10573
  Component({
9573
- selector: 'kendo-colorpalette',
9574
- providers: [
9575
- {
10574
+ exportAs: 'kendoColorPicker',
10575
+ selector: 'kendo-colorpicker',
10576
+ providers: [{
9576
10577
  multi: true,
9577
10578
  provide: NG_VALUE_ACCESSOR,
9578
- useExisting: forwardRef(() => ColorPaletteComponent_1) // tslint:disable-line:no-forward-ref
10579
+ useExisting: forwardRef(() => ColorPickerComponent_1)
9579
10580
  }, {
9580
10581
  provide: KendoInput,
9581
- useExisting: forwardRef(() => ColorPaletteComponent_1)
10582
+ useExisting: forwardRef(() => ColorPickerComponent_1)
9582
10583
  },
9583
- ColorPaletteService,
9584
- ColorPaletteLocalizationService,
10584
+ ColorPickerLocalizationService,
9585
10585
  {
9586
10586
  provide: LocalizationService,
9587
- useExisting: ColorPaletteLocalizationService
10587
+ useExisting: ColorPickerLocalizationService
9588
10588
  },
9589
10589
  {
9590
10590
  provide: L10N_PREFIX,
9591
- useValue: 'kendo.colorpalette'
10591
+ useValue: 'kendo.colorpicker'
9592
10592
  }
9593
10593
  ],
9594
10594
  template: `
9595
- <ng-container kendoColorPaletteLocalizedMessages
9596
- i18n-colorPaletteNoColor="kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
9597
- colorPaletteNoColor="Colorpalette no color chosen">
10595
+ <ng-container kendoColorPickerLocalizedMessages
10596
+ i18n-colorPickerNoColor="kendo.colorpicker.colorPickerNoColor|The aria-label applied to the ColorPicker component when the value is empty."
10597
+ colorPickerNoColor="Colorpicker no color chosen"
10598
+ i18n-flatColorPickerNoColor="kendo.colorpicker.flatColorPickerNoColor|The aria-label applied to the FlatColorPicker component when the value is empty."
10599
+ flatColorPickerNoColor="Flatcolorpicker no color chosen"
10600
+ i18n-colorGradientNoColor="kendo.colorpicker.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty."
10601
+ colorGradientNoColor="Colorgradient no color chosen"
10602
+ i18n-colorPaletteNoColor="kendo.colorpicker.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
10603
+ colorPaletteNoColor="Colorpalette no color chosen"
10604
+ i18n-colorGradientHandle="kendo.colorpicker.colorGradientHandle|The title for the gradient color drag handle chooser."
10605
+ colorGradientHandle="Choose color"
10606
+ i18n-clearButton="kendo.colorpicker.clearButton|The title for the clear button."
10607
+ clearButton="Clear value"
10608
+ i18n-hueSliderHandle="kendo.colorpicker.hueSliderHandle|The title for the hue slider handle."
10609
+ hueSliderHandle="Set hue"
10610
+ i18n-opacitySliderHandle="kendo.colorpicker.opacitySliderHandle|The title for the opacity slider handle."
10611
+ opacitySliderHandle="Set opacity"
10612
+ i18n-contrastRatio="kendo.colorpicker.contrastRatio|The contrast ratio message for the contrast tool."
10613
+ contrastRatio="Contrast ratio"
10614
+ i18n-previewColor="kendo.colorpicker.previewColor|The message for the color preview pane."
10615
+ previewColor="Color preview"
10616
+ i18n-revertSelection="kendo.colorpicker.revertSelection|The message for the selected color pane."
10617
+ revertSelection="Revert selection"
10618
+ i18n-gradientView="kendo.colorpicker.gradientView|The message for the gradient view button."
10619
+ gradientView="Gradient view"
10620
+ i18n-paletteView="kendo.colorpicker.paletteView|The message for the palette view button."
10621
+ paletteView="Palette view"
10622
+ i18n-formatButton="kendo.colorpicker.formatButton|The message for the input format toggle button."
10623
+ formatButton="Change color format"
10624
+ i18n-applyButton="kendo.colorpicker.applyButton|The message for the Apply action button."
10625
+ applyButton="Apply"
10626
+ i18n-cancelButton="kendo.colorpicker.cancelButton|The message for the Cancel action button."
10627
+ cancelButton="Cancel">
9598
10628
  </ng-container>
9599
- <div role="listbox" class="k-colorpalette-table-wrap"
9600
- [attr.aria-activedescendant]="activeCellId">
9601
- <table class="k-colorpalette-table k-palette">
9602
- <tbody>
9603
- <tr *ngFor="let row of colorRows; let rowIndex = index">
9604
- <td *ngFor="let color of row; let colIndex = index"
9605
- role="option"
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"
9609
- [attr.aria-label]="color"
9610
- class="k-colorpalette-tile"
9611
- [id]="rowIndex + '-' + colIndex"
9612
- [attr.value]="color"
9613
- (click)="handleCellSelection(color, { row: rowIndex, col: colIndex })"
9614
- [ngStyle]="{
9615
- backgroundColor: color,
9616
- width: tileLayout.width + 'px',
9617
- height: tileLayout.height + 'px',
9618
- minWidth: tileLayout.width + 'px'
9619
- }">
9620
- </td>
9621
- </tr>
9622
- </tbody>
9623
- </table>
9624
- </div>
10629
+ <span
10630
+ #wrapper
10631
+ [ngClass]="{
10632
+ 'k-picker-wrap': true,
10633
+ 'k-state-disabled': this.disabled,
10634
+ 'k-state-focused': this.isFocused
10635
+ }"
10636
+ role="listbox"
10637
+ [attr.aria-expanded]="isOpen"
10638
+ [attr.aria-readonly]="readonly"
10639
+ [attr.aria-disabled]="disabled"
10640
+ [attr.aria-label]="colorPickerAriaLabel"
10641
+ [id]="focusableId"
10642
+ [attr.tabindex]="tabindex"
10643
+ (focus)="handleWrapperFocus()"
10644
+ (blur)="handleWrapperBlur()"
10645
+ (mousedown)="$event.preventDefault()"
10646
+ (keydown)="handleWrapperKeyDown($event)"
10647
+ >
10648
+ <span *ngIf="!iconStyles" class="k-selected-color" [style.background]="value" (click)="handleActiveColorClick()">
10649
+ <span class="k-icon k-i-line" *ngIf="!value"></span>
10650
+ </span>
10651
+ <span *ngIf="iconStyles" class="k-tool-icon" [ngClass]="iconStyles" (click)="handleActiveColorClick()">
10652
+ <span class="k-selected-color" [style.background-color]="value"></span>
10653
+ </span>
10654
+ <span class="k-select" (click)="togglePopup()">
10655
+ <span class="k-icon k-i-arrow-s"></span>
10656
+ </span>
10657
+ </span>
10658
+ <ng-template #popupTemplate>
10659
+ <kendo-flatcolorpicker
10660
+ #flatColorPicker
10661
+ [value]="value"
10662
+ [format]="format"
10663
+ [views]="views"
10664
+ [activeView]="activeView"
10665
+ [actionsLayout]="actionsLayout"
10666
+ [preview]="preview"
10667
+ [gradientSettings]="gradientSettings"
10668
+ [paletteSettings]="paletteSettings"
10669
+ [clearButton]="clearButton"
10670
+ (focusout)="handlePopupBlur($event)"
10671
+ (cancel)="handleCancelEvent($event)"
10672
+ (valueChange)="handleValueChange($event)"
10673
+ (keydown)="handlePopupKeyDown($event)"
10674
+ (activeViewChange)="activeViewChange.emit($event)"
10675
+ (actionButtonClick)="togglePopup()">
10676
+ </kendo-flatcolorpicker>
10677
+ </ng-template>
10678
+ <ng-container #container></ng-container>
9625
10679
  `
9626
10680
  }),
9627
- __metadata("design:paramtypes", [ElementRef,
9628
- ColorPaletteService,
10681
+ __metadata("design:paramtypes", [PopupService,
9629
10682
  ChangeDetectorRef,
9630
- Renderer2,
9631
- LocalizationService])
9632
- ], ColorPaletteComponent);
10683
+ LocalizationService,
10684
+ NgZone])
10685
+ ], ColorPickerComponent);
9633
10686
 
9634
10687
  /**
9635
10688
  * @hidden
@@ -9644,6 +10697,14 @@ __decorate([
9644
10697
  Input(),
9645
10698
  __metadata("design:type", String)
9646
10699
  ], ColorPickerMessages.prototype, "colorGradientNoColor", void 0);
10700
+ __decorate([
10701
+ Input(),
10702
+ __metadata("design:type", String)
10703
+ ], ColorPickerMessages.prototype, "flatColorPickerNoColor", void 0);
10704
+ __decorate([
10705
+ Input(),
10706
+ __metadata("design:type", String)
10707
+ ], ColorPickerMessages.prototype, "colorPickerNoColor", void 0);
9647
10708
  __decorate([
9648
10709
  Input(),
9649
10710
  __metadata("design:type", String)
@@ -9692,6 +10753,34 @@ __decorate([
9692
10753
  Input(),
9693
10754
  __metadata("design:type", String)
9694
10755
  ], ColorPickerMessages.prototype, "contrastRatio", void 0);
10756
+ __decorate([
10757
+ Input(),
10758
+ __metadata("design:type", String)
10759
+ ], ColorPickerMessages.prototype, "previewColor", void 0);
10760
+ __decorate([
10761
+ Input(),
10762
+ __metadata("design:type", String)
10763
+ ], ColorPickerMessages.prototype, "revertSelection", void 0);
10764
+ __decorate([
10765
+ Input(),
10766
+ __metadata("design:type", String)
10767
+ ], ColorPickerMessages.prototype, "gradientView", void 0);
10768
+ __decorate([
10769
+ Input(),
10770
+ __metadata("design:type", String)
10771
+ ], ColorPickerMessages.prototype, "paletteView", void 0);
10772
+ __decorate([
10773
+ Input(),
10774
+ __metadata("design:type", String)
10775
+ ], ColorPickerMessages.prototype, "formatButton", void 0);
10776
+ __decorate([
10777
+ Input(),
10778
+ __metadata("design:type", String)
10779
+ ], ColorPickerMessages.prototype, "applyButton", void 0);
10780
+ __decorate([
10781
+ Input(),
10782
+ __metadata("design:type", String)
10783
+ ], ColorPickerMessages.prototype, "cancelButton", void 0);
9695
10784
 
9696
10785
  var ColorPickerCustomMessagesComponent_1;
9697
10786
  /**
@@ -9714,7 +10803,7 @@ ColorPickerCustomMessagesComponent = ColorPickerCustomMessagesComponent_1 = __de
9714
10803
  useExisting: forwardRef(() => ColorPickerCustomMessagesComponent_1) // tslint:disable-line:no-forward-ref
9715
10804
  }
9716
10805
  ],
9717
- selector: 'kendo-colorpicker-messages, kendo-colorgradient-messages, kendo-colorpalette-messages',
10806
+ selector: 'kendo-colorpicker-messages, kendo-flatcolorpicker-messages, kendo-colorgradient-messages, kendo-colorpalette-messages',
9718
10807
  template: ``
9719
10808
  }),
9720
10809
  __metadata("design:paramtypes", [LocalizationService])
@@ -9738,7 +10827,7 @@ LocalizedColorPickerMessagesDirective = LocalizedColorPickerMessagesDirective_1
9738
10827
  useExisting: forwardRef(() => LocalizedColorPickerMessagesDirective_1) // tslint:disable-line:no-forward-ref
9739
10828
  }
9740
10829
  ],
9741
- selector: '[kendoColorPickerLocalizedMessages], [kendoColorGradientLocalizedMessages], [kendoColorPaletteLocalizedMessages]'
10830
+ selector: '[kendoColorPickerLocalizedMessages], [kendoFlatColorPickerLocalizedMessages], [kendoColorGradientLocalizedMessages], [kendoColorPaletteLocalizedMessages]'
9742
10831
  }),
9743
10832
  __metadata("design:paramtypes", [LocalizationService])
9744
10833
  ], LocalizedColorPickerMessagesDirective);
@@ -9780,34 +10869,37 @@ let ContrastValidationComponent = class ContrastValidationComponent {
9780
10869
  return this.localization.get('failContrast');
9781
10870
  }
9782
10871
  get contrastText() {
9783
- return `${this.type}: ${this.ratio.toFixed(1)}`;
10872
+ let ratio = this.type === 'AA' ? AA_RATIO : AAA_RATIO;
10873
+ return `${this.type}: ${ratio.toFixed(1)}`;
9784
10874
  }
9785
10875
  };
9786
10876
  __decorate([
9787
10877
  Input(),
9788
10878
  __metadata("design:type", String)
9789
10879
  ], ContrastValidationComponent.prototype, "type", void 0);
9790
- __decorate([
9791
- Input(),
9792
- __metadata("design:type", Number)
9793
- ], ContrastValidationComponent.prototype, "ratio", void 0);
9794
10880
  __decorate([
9795
10881
  Input(),
9796
10882
  __metadata("design:type", Boolean)
9797
10883
  ], ContrastValidationComponent.prototype, "pass", void 0);
10884
+ __decorate([
10885
+ Input(),
10886
+ __metadata("design:type", String)
10887
+ ], ContrastValidationComponent.prototype, "value", void 0);
9798
10888
  ContrastValidationComponent = __decorate([
9799
10889
  Component({
9800
10890
  selector: '[kendoContrastValidation]',
9801
10891
  template: `
9802
10892
  <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}}
10893
+ <ng-container *ngIf="value">
10894
+ <span class="k-contrast-validation k-text-success" *ngIf="pass">
10895
+ {{passMessage}}
10896
+ <span class="k-icon k-i-check"></span>
10897
+ </span>
10898
+ <span class="k-contrast-validation k-text-error" *ngIf="!pass">
10899
+ {{failMessage}}
9809
10900
  <span class="k-icon k-i-close"></span>
9810
- </span>
10901
+ </span>
10902
+ </ng-container>
9811
10903
  `
9812
10904
  }),
9813
10905
  __metadata("design:paramtypes", [LocalizationService])
@@ -9819,20 +10911,18 @@ ContrastValidationComponent = __decorate([
9819
10911
  let ContrastComponent = class ContrastComponent {
9820
10912
  constructor(localization) {
9821
10913
  this.localization = localization;
9822
- this.aaRatio = AA_RATIO;
9823
- this.aaaRatio = AAA_RATIO;
9824
10914
  }
9825
10915
  get formatedRatio() {
9826
10916
  return this.contrastRatio.toFixed(2);
9827
10917
  }
9828
- get contrastRatioMessage() {
9829
- return this.localization.get('contrastRatio');
10918
+ get contrastRatioText() {
10919
+ return `${this.localization.get('contrastRatio')}: ${this.value ? this.formatedRatio : 'n/a'}`;
9830
10920
  }
9831
10921
  get satisfiesAACondition() {
9832
- return this.contrastRatio >= this.aaRatio;
10922
+ return this.contrastRatio >= AA_RATIO;
9833
10923
  }
9834
10924
  get satisfiesAAACondition() {
9835
- return this.contrastRatio >= this.aaaRatio;
10925
+ return this.contrastRatio >= AAA_RATIO;
9836
10926
  }
9837
10927
  get contrastRatio() {
9838
10928
  let contrast = getContrastFromTwoRGBAs(getRGBA(this.value), getRGBA(this.ratio));
@@ -9852,23 +10942,25 @@ ContrastComponent = __decorate([
9852
10942
  selector: '[kendoContrastTool]',
9853
10943
  template: `
9854
10944
  <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>
10945
+ <span class="k-contrast-ratio-text">{{contrastRatioText}}</span>
10946
+ <ng-container *ngIf="value">
10947
+ <span class="k-contrast-validation k-text-success" *ngIf="satisfiesAACondition">
10948
+ <span class="k-icon k-i-check"></span>
10949
+ <span class="k-icon k-i-check" *ngIf="satisfiesAAACondition"></span>
10950
+ </span>
10951
+ <span class="k-contrast-validation k-text-error" *ngIf="!satisfiesAACondition">
10952
+ <span class="k-icon k-i-close"></span>
10953
+ </span>
10954
+ </ng-container>
9863
10955
  </div>
9864
10956
  <div kendoContrastValidation
9865
10957
  type="AA"
9866
- [ratio]="aaaRatio"
10958
+ [value]="value"
9867
10959
  [pass]="satisfiesAACondition">
9868
10960
  </div>
9869
10961
  <div kendoContrastValidation
9870
10962
  type="AAA"
9871
- [ratio]="aaaRatio"
10963
+ [value]="value"
9872
10964
  [pass]="satisfiesAAACondition">
9873
10965
  </div>
9874
10966
  `
@@ -9876,10 +10968,98 @@ ContrastComponent = __decorate([
9876
10968
  __metadata("design:paramtypes", [LocalizationService])
9877
10969
  ], ContrastComponent);
9878
10970
 
10971
+ /**
10972
+ * @hidden
10973
+ */
10974
+ let ColorContrastSvgComponent = class ColorContrastSvgComponent {
10975
+ /**
10976
+ * @hidden
10977
+ */
10978
+ constructor() {
10979
+ this.hostClass = true;
10980
+ }
10981
+ ngAfterViewInit() {
10982
+ this.metrics = this.wrapper.getBoundingClientRect();
10983
+ this.oldA = this.hsva.value.a;
10984
+ this.oldH = this.hsva.value.h;
10985
+ this.hsva.subscribe((value) => {
10986
+ if (value.h !== this.oldH || value.a !== this.oldA) {
10987
+ this.oldH = value.h;
10988
+ this.oldA = value.a;
10989
+ this.setPaths();
10990
+ }
10991
+ });
10992
+ }
10993
+ ngOnChanges(changes) {
10994
+ if (isPresent(changes.backgroundColor) && this.metrics) {
10995
+ this.setPaths();
10996
+ }
10997
+ }
10998
+ setPaths() {
10999
+ const bezierCommandCalc = bezierCommand(controlPoint(line));
11000
+ this.paths = [svgPath(this.getPaths(AA_RATIO, STEP_COUNT), bezierCommandCalc),
11001
+ svgPath(this.getPaths(AA_RATIO, STEP_COUNT, true), bezierCommandCalc),
11002
+ svgPath(this.getPaths(AAA_RATIO, STEP_COUNT), bezierCommandCalc),
11003
+ svgPath(this.getPaths(AAA_RATIO, STEP_COUNT, true), bezierCommandCalc)];
11004
+ }
11005
+ findValue(contrast, saturation, low, high, comparer) {
11006
+ const mid = (low + high) / 2;
11007
+ const hsva = Object.assign({}, this.hsva.value, { s: saturation / this.metrics.width, v: 1 - mid / this.metrics.height });
11008
+ const currentContrast = getContrastFromTwoRGBAs(getRGBA(getColorFromHSV(hsva)), getRGBA(this.backgroundColor || ''));
11009
+ if (low + 0.5 > high) {
11010
+ if (currentContrast < contrast + 1 && currentContrast > contrast - 1) {
11011
+ return mid;
11012
+ }
11013
+ else {
11014
+ return null;
11015
+ }
11016
+ }
11017
+ if (comparer(currentContrast, contrast)) {
11018
+ return this.findValue(contrast, saturation, low, high - (high - low) / 2, comparer);
11019
+ }
11020
+ return this.findValue(contrast, saturation, low + (high - low) / 2, high, comparer);
11021
+ }
11022
+ getPaths(contrast, stepCount, reversed = false) {
11023
+ const points = [];
11024
+ for (let i = 0; i <= this.metrics.width; i += this.metrics.width / stepCount) {
11025
+ const value = this.findValue(contrast, i, 0, this.metrics.height, reversed ? ((a, b) => a < b) : ((a, b) => a > b));
11026
+ if (value !== null) {
11027
+ points.push([i, value]);
11028
+ }
11029
+ }
11030
+ return points;
11031
+ }
11032
+ };
11033
+ __decorate([
11034
+ HostBinding('class.k-color-contrast-svg'),
11035
+ __metadata("design:type", Boolean)
11036
+ ], ColorContrastSvgComponent.prototype, "hostClass", void 0);
11037
+ __decorate([
11038
+ Input(),
11039
+ __metadata("design:type", Object)
11040
+ ], ColorContrastSvgComponent.prototype, "wrapper", void 0);
11041
+ __decorate([
11042
+ Input(),
11043
+ __metadata("design:type", BehaviorSubject)
11044
+ ], ColorContrastSvgComponent.prototype, "hsva", void 0);
11045
+ __decorate([
11046
+ Input(),
11047
+ __metadata("design:type", String)
11048
+ ], ColorContrastSvgComponent.prototype, "backgroundColor", void 0);
11049
+ ColorContrastSvgComponent = __decorate([
11050
+ Component({
11051
+ selector: '[kendoColorContrastSvg]',
11052
+ template: `
11053
+ <svg:path *ngFor="let path of paths" [attr.d]="path" fill="none" stroke="white" stroke-width="1"></svg:path>
11054
+ `
11055
+ })
11056
+ ], ColorContrastSvgComponent);
11057
+
9879
11058
  const PUBLIC_DIRECTIVES = [
9880
11059
  ColorPickerComponent,
9881
11060
  ColorPaletteComponent,
9882
11061
  ColorGradientComponent,
11062
+ FlatColorPickerComponent,
9883
11063
  LocalizedColorPickerMessagesDirective,
9884
11064
  ColorPickerCustomMessagesComponent
9885
11065
  ];
@@ -9887,7 +11067,10 @@ const INTERNAL_DIRECTIVES = [
9887
11067
  ColorInputComponent,
9888
11068
  FocusOnDomReadyDirective,
9889
11069
  ContrastComponent,
9890
- ContrastValidationComponent
11070
+ ContrastValidationComponent,
11071
+ FlatColorPickerHeaderComponent,
11072
+ FlatColorPickerActionButtonsComponent,
11073
+ ColorContrastSvgComponent
9891
11074
  ];
9892
11075
  /**
9893
11076
  * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
@@ -10554,4 +11737,4 @@ InputsModule = __decorate([
10554
11737
  * Generated bundle index. Do not edit.
10555
11738
  */
10556
11739
 
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 };
11740
+ export { CheckBoxModule, ColorContrastSvgComponent, ColorInputComponent, ContrastValidationComponent, ContrastComponent, FlatColorPickerActionButtonsComponent, FlatColorPickerHeaderComponent, FocusOnDomReadyDirective, ColorGradientLocalizationService, ColorPaletteLocalizationService, ColorPickerLocalizationService, ColorPickerCustomMessagesComponent, FlatColorPickerLocalizationService, ColorPickerMessages, ColorPaletteService, FlatColorPickerService, 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, FlatColorPickerComponent, ColorPickerCancelEvent, CheckBoxDirective, RadioButtonDirective, HintComponent, ErrorComponent, FormFieldComponent, FormFieldModule, TextBoxComponent, TextBoxPrefixTemplateDirective, TextBoxSuffixTemplateDirective, TextAreaComponent, TextAreaSuffixComponent, InputSeparatorComponent, SharedModule, LocalizedColorPickerMessagesDirective, LocalizedNumericTextBoxMessagesDirective, LocalizedTextBoxMessagesDirective, LocalizedSliderMessagesDirective, LocalizedRangeSliderMessagesDirective, LocalizedSwitchMessagesDirective, ColorPickerCloseEvent, ColorPickerOpenEvent, ActiveColorClickEvent };