@progress/kendo-angular-inputs 7.5.2 → 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 (151) 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/es2015/colorpicker/color-contrast-svg.component.d.ts +26 -0
  39. package/dist/es2015/colorpicker/color-contrast-svg.component.js +97 -0
  40. package/dist/es2015/colorpicker/color-gradient.component.d.ts +32 -43
  41. package/dist/es2015/colorpicker/color-gradient.component.js +125 -92
  42. package/dist/es2015/colorpicker/color-input.component.d.ts +11 -4
  43. package/dist/es2015/colorpicker/color-input.component.js +52 -32
  44. package/dist/es2015/colorpicker/color-palette.component.d.ts +8 -3
  45. package/dist/es2015/colorpicker/color-palette.component.js +28 -18
  46. package/dist/es2015/colorpicker/colorpicker.component.d.ts +84 -24
  47. package/dist/es2015/colorpicker/colorpicker.component.js +195 -112
  48. package/dist/es2015/colorpicker/constants.d.ts +12 -0
  49. package/dist/es2015/colorpicker/constants.js +12 -0
  50. package/dist/es2015/colorpicker/contrast-validation.component.d.ts +1 -1
  51. package/dist/es2015/colorpicker/contrast-validation.component.js +16 -12
  52. package/dist/es2015/colorpicker/contrast.component.d.ts +1 -3
  53. package/dist/es2015/colorpicker/contrast.component.js +17 -17
  54. package/dist/es2015/colorpicker/{models → events}/active-color-click-event.d.ts +0 -0
  55. package/dist/es2015/colorpicker/{models → events}/active-color-click-event.js +0 -0
  56. package/dist/es2015/colorpicker/events/cancel-event.d.ts +15 -0
  57. package/dist/es2015/colorpicker/events/cancel-event.js +14 -0
  58. package/dist/es2015/colorpicker/events/close-event.d.ts +10 -0
  59. package/dist/es2015/colorpicker/events/close-event.js +10 -0
  60. package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.d.ts +0 -0
  61. package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.js +0 -0
  62. package/dist/es2015/colorpicker/events/open-event.d.ts +10 -0
  63. package/dist/es2015/colorpicker/events/open-event.js +10 -0
  64. package/dist/es2015/colorpicker/events.d.ts +8 -0
  65. package/dist/es2015/colorpicker/events.js +8 -0
  66. package/dist/es2015/colorpicker/flatcolorpicker-actions.component.d.ts +18 -0
  67. package/dist/es2015/colorpicker/flatcolorpicker-actions.component.js +60 -0
  68. package/dist/es2015/colorpicker/flatcolorpicker-header.component.d.ts +30 -0
  69. package/dist/es2015/colorpicker/flatcolorpicker-header.component.js +131 -0
  70. package/dist/es2015/colorpicker/flatcolorpicker.component.d.ts +214 -0
  71. package/dist/es2015/colorpicker/flatcolorpicker.component.js +593 -0
  72. package/dist/es2015/colorpicker/localization/colorgradient-localization.service.d.ts +3 -3
  73. package/dist/es2015/colorpicker/localization/colorgradient-localization.service.js +7 -7
  74. package/dist/es2015/colorpicker/localization/colorpalette-localization.service.d.ts +3 -3
  75. package/dist/es2015/colorpicker/localization/colorpalette-localization.service.js +7 -7
  76. package/dist/es2015/colorpicker/localization/custom-messages.component.js +1 -1
  77. package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.d.ts +14 -0
  78. package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.js +31 -0
  79. package/dist/es2015/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  80. package/dist/es2015/colorpicker/localization/messages.d.ts +36 -0
  81. package/dist/es2015/colorpicker/localization/messages.js +36 -0
  82. package/dist/es2015/colorpicker/models/actions-layout.d.ts +8 -0
  83. package/dist/es2015/colorpicker/models/actions-layout.js +4 -0
  84. package/dist/es2015/colorpicker/models/colorpicker-view.d.ts +8 -0
  85. package/dist/es2015/colorpicker/models/colorpicker-view.js +4 -0
  86. package/dist/es2015/colorpicker/models/gradient-settings.d.ts +4 -3
  87. package/dist/es2015/colorpicker/models/output-format.d.ts +0 -5
  88. package/dist/es2015/colorpicker/{utils → models}/palette-presets.d.ts +0 -0
  89. package/dist/es2015/colorpicker/{utils → models}/palette-presets.js +0 -0
  90. package/dist/es2015/colorpicker/models/palette-settings.d.ts +2 -3
  91. package/dist/es2015/colorpicker/models/tile-size.d.ts +1 -5
  92. package/dist/es2015/colorpicker/models.d.ts +10 -10
  93. package/dist/es2015/colorpicker/models.js +1 -2
  94. package/dist/es2015/colorpicker/{models/color-picker-view.d.ts → services/flatcolorpicker.service.d.ts} +6 -7
  95. package/dist/es2015/colorpicker/services/flatcolorpicker.service.js +38 -0
  96. package/dist/es2015/colorpicker/utils/color-parser.d.ts +8 -2
  97. package/dist/es2015/colorpicker/utils/color-parser.js +15 -5
  98. package/dist/es2015/colorpicker/utils/contrast-curve.d.ts +37 -0
  99. package/dist/es2015/colorpicker/utils/contrast-curve.js +85 -0
  100. package/dist/es2015/colorpicker/utils.d.ts +1 -1
  101. package/dist/es2015/colorpicker/utils.js +1 -1
  102. package/dist/es2015/colorpicker.module.js +9 -1
  103. package/dist/es2015/index.d.ts +5 -0
  104. package/dist/es2015/index.js +5 -0
  105. package/dist/es2015/index.metadata.json +1 -1
  106. package/dist/es2015/main.d.ts +4 -1
  107. package/dist/es2015/main.js +4 -1
  108. package/dist/es2015/package-metadata.js +1 -1
  109. package/dist/fesm2015/index.js +2207 -1043
  110. package/dist/fesm5/index.js +2010 -907
  111. package/dist/npm/colorpicker/color-contrast-svg.component.js +97 -0
  112. package/dist/npm/colorpicker/color-gradient.component.js +109 -81
  113. package/dist/npm/colorpicker/color-input.component.js +38 -17
  114. package/dist/npm/colorpicker/color-palette.component.js +29 -19
  115. package/dist/npm/colorpicker/colorpicker.component.js +177 -83
  116. package/dist/npm/colorpicker/constants.js +12 -0
  117. package/dist/npm/colorpicker/contrast-validation.component.js +8 -6
  118. package/dist/npm/colorpicker/contrast.component.js +6 -8
  119. package/dist/npm/colorpicker/{models → events}/active-color-click-event.js +0 -0
  120. package/dist/npm/colorpicker/events/cancel-event.js +21 -0
  121. package/dist/npm/colorpicker/events/close-event.js +19 -0
  122. package/dist/npm/colorpicker/{models → events}/kendo-drag-event.js +0 -0
  123. package/dist/npm/colorpicker/events/open-event.js +19 -0
  124. package/dist/npm/colorpicker/events.js +11 -0
  125. package/dist/npm/colorpicker/flatcolorpicker-actions.component.js +52 -0
  126. package/dist/npm/colorpicker/flatcolorpicker-header.component.js +96 -0
  127. package/dist/npm/colorpicker/flatcolorpicker.component.js +555 -0
  128. package/dist/npm/colorpicker/localization/colorgradient-localization.service.js +7 -7
  129. package/dist/npm/colorpicker/localization/colorpalette-localization.service.js +7 -7
  130. package/dist/npm/colorpicker/localization/custom-messages.component.js +1 -1
  131. package/dist/npm/colorpicker/localization/flatcolorpicker-localization.service.js +36 -0
  132. package/dist/npm/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  133. package/dist/npm/colorpicker/localization/messages.js +36 -0
  134. package/dist/npm/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
  135. package/dist/npm/colorpicker/models/colorpicker-view.js +6 -0
  136. package/dist/npm/colorpicker/{utils → models}/palette-presets.js +0 -0
  137. package/dist/npm/colorpicker/models.js +1 -2
  138. package/dist/npm/colorpicker/services/flatcolorpicker.service.js +43 -0
  139. package/dist/npm/colorpicker/utils/color-parser.js +18 -5
  140. package/dist/npm/colorpicker/utils/contrast-curve.js +93 -0
  141. package/dist/npm/colorpicker/utils.js +1 -1
  142. package/dist/npm/colorpicker.module.js +9 -1
  143. package/dist/npm/index.js +10 -0
  144. package/dist/npm/main.js +7 -2
  145. package/dist/npm/package-metadata.js +1 -1
  146. package/dist/systemjs/kendo-angular-inputs.js +1 -1
  147. package/package.json +3 -2
  148. package/dist/es/colorpicker/models/preventable-event.js +0 -29
  149. package/dist/es2015/colorpicker/models/preventable-event.d.ts +0 -21
  150. package/dist/es2015/colorpicker/models/preventable-event.js +0 -27
  151. package/dist/npm/colorpicker/models/preventable-event.js +0 -31
@@ -5,10 +5,10 @@
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
13
  import { browser, mobileOS, detectDesktopBrowser, detectMobileOS } from '@progress/kendo-common';
14
14
  import { IntlService } from '@progress/kendo-angular-intl';
@@ -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: 1637576485,
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
  };
@@ -7196,27 +7196,185 @@ TextAreaModule = __decorate([
7196
7196
  /**
7197
7197
  * @hidden
7198
7198
  */
7199
- class PreventableEvent {
7200
- constructor() {
7201
- this.prevented = false;
7199
+ let ColorPickerLocalizationService = class ColorPickerLocalizationService extends LocalizationService {
7200
+ constructor(prefix, messageService, _rtl) {
7201
+ super(prefix, messageService, _rtl);
7202
7202
  }
7203
- /**
7204
- * Prevents the default action for a specified event.
7205
- * In this way, the source component suppresses the built-in behavior that follows the event.
7206
- */
7207
- preventDefault() {
7208
- 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;
7209
7218
  }
7210
- /**
7211
- * If the event is prevented by any of its subscribers, returns `true`.
7212
- *
7213
- * @returns - `true` if the default action was prevented. Otherwise, returns `false`.
7214
- */
7215
- isDefaultPrevented() {
7216
- 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
+ };
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;
7217
7363
  }
7218
7364
  }
7219
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 {
7376
+ }
7377
+
7220
7378
  /**
7221
7379
  * Fires each time the left side of the ColorPicker wrapper is clicked.
7222
7380
  * The event is triggered regardless of whether a ColorPicker icon is set or not.
@@ -7277,7 +7435,7 @@ class ActiveColorClickEvent {
7277
7435
  *
7278
7436
  * Returns the hex or rgba string representation of the color.
7279
7437
  */
7280
- const parseColor$1 = (value, format, safe = true) => {
7438
+ const parseColor$1 = (value, format, opacityEnabled = false, safe = true) => {
7281
7439
  const allowedFormats = ['hex', 'rgba', 'name'];
7282
7440
  if (allowedFormats.indexOf(format) === -1) {
7283
7441
  throw new Error(`Unsupported color output format '${format}'. The available options are 'hex', 'rgba' or 'name'.`);
@@ -7292,7 +7450,8 @@ const parseColor$1 = (value, format, safe = true) => {
7292
7450
  if (!isPresent(parsedColor)) {
7293
7451
  return;
7294
7452
  }
7295
- return format === 'hex' ? parsedColor.toCss() : parsedColor.toCssRgba();
7453
+ const parsedColorResult = format === 'hex' ? getHexValue(parsedColor, opacityEnabled) : parsedColor.toCssRgba();
7454
+ return parsedColorResult;
7296
7455
  };
7297
7456
  /**
7298
7457
  * @hidden
@@ -7323,12 +7482,21 @@ const getRGBA = (value, safe = true) => {
7323
7482
  *
7324
7483
  * Returns the RGBA string representation of the color.
7325
7484
  */
7326
- const getColorFromHSV = (hsva) => {
7485
+ const getColorFromHSV = (hsva, format = 'rgba', opacityEnabled = false) => {
7327
7486
  const hue = fitIntoBounds(hsva.h, 0, 359.9);
7328
7487
  const saturation = fitIntoBounds(hsva.s, 0, 1);
7329
7488
  const value = fitIntoBounds(hsva.v, 0, 1);
7330
7489
  const alpha = fitIntoBounds(hsva.a, 0, 1);
7331
- 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();
7332
7500
  };
7333
7501
  /**
7334
7502
  * @hidden
@@ -7364,7 +7532,7 @@ function nameFormat(value, safe) {
7364
7532
  }
7365
7533
  const key = Object.keys(namedColors).find(key => namedColors[key] === value);
7366
7534
  if (!key && !safe) {
7367
- 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' `);
7368
7536
  }
7369
7537
  return key;
7370
7538
  }
@@ -7421,91 +7589,84 @@ const getContrastFromTwoRGBAs = (a, b) => {
7421
7589
  return getContrast(getLuminance(getRGBFromRGBA(a, b)), getLuminance(getRGBFromRGBA(b, { r: 0, g: 0, b: 0, a: 1 })));
7422
7590
  };
7423
7591
 
7424
- // tslint:disable:max-line-length
7425
7592
  /**
7426
7593
  * @hidden
7427
7594
  */
7428
- const PALETTEPRESETS = {
7429
- basic: {
7430
- colors: '000000,7f7f7f,880015,ed1c24,ff7f27,fff200,22b14c,00a2e8,3f48cc,a349a4,ffffff,c3c3c3,b97a57,ffaec9,ffc90e,efe4b0,b5e61d,99d9ea,7092be,c8bfe7',
7431
- columns: 10
7432
- },
7433
- office: {
7434
- 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',
7435
- columns: 10
7436
- },
7437
- apex: {
7438
- 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',
7439
- columns: 10
7440
- },
7441
- austin: {
7442
- 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',
7443
- columns: 10
7444
- },
7445
- clarity: {
7446
- 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',
7447
- columns: 10
7448
- },
7449
- slipstream: {
7450
- 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',
7451
- columns: 10
7452
- },
7453
- metro: {
7454
- 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',
7455
- columns: 10
7456
- },
7457
- flow: {
7458
- 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',
7459
- columns: 10
7460
- },
7461
- hardcover: {
7462
- 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',
7463
- columns: 10
7464
- },
7465
- trek: {
7466
- 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',
7467
- columns: 10
7468
- },
7469
- verve: {
7470
- 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',
7471
- columns: 10
7472
- },
7473
- monochrome: {
7474
- colors: '000000, 1a1a1a, 333333, 4d4d4d, 666666, 808080, 999999, b3b3b3, cccccc, e6e6e6, f2f2f2, ffffff',
7475
- columns: 12
7476
- },
7477
- accessible: {
7478
- colors: 'black, grey, darkred, red, darkorange, gold, green, blue, darkblue, purple, white, darkgrey, saddlebrown, pink, orange, yellow, lightgreen, lightskyblue, lightblue, mediumpurple',
7479
- columns: 10
7480
- }
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]}`;
7481
7601
  };
7482
-
7483
7602
  /**
7484
7603
  * @hidden
7485
7604
  */
7486
- let ColorPickerLocalizationService = class ColorPickerLocalizationService extends LocalizationService {
7487
- constructor(prefix, messageService, _rtl) {
7488
- 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 '';
7489
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;
7490
7657
  };
7491
- ColorPickerLocalizationService = __decorate([
7492
- __param(0, Inject(L10N_PREFIX)),
7493
- __param(1, Optional()),
7494
- __param(2, Optional()), __param(2, Inject(RTL)),
7495
- __metadata("design:paramtypes", [String, MessageService, Boolean])
7496
- ], ColorPickerLocalizationService);
7497
7658
 
7498
7659
  /**
7499
7660
  * @hidden
7500
7661
  */
7501
7662
  let ColorGradientLocalizationService = class ColorGradientLocalizationService extends LocalizationService {
7502
- constructor(prefix, messageService, _rtl, colorPickerLocalization) {
7663
+ constructor(prefix, messageService, _rtl, flatColorPickerLocalization) {
7503
7664
  super(prefix, messageService, _rtl);
7504
- this.colorPickerLocalization = colorPickerLocalization;
7665
+ this.flatColorPickerLocalization = flatColorPickerLocalization;
7505
7666
  }
7506
7667
  get(shortKey) {
7507
- if (this.colorPickerLocalization) {
7508
- return this.colorPickerLocalization.get(shortKey);
7668
+ if (this.flatColorPickerLocalization) {
7669
+ return this.flatColorPickerLocalization.get(shortKey);
7509
7670
  }
7510
7671
  return super.get(shortKey);
7511
7672
  }
@@ -7514,18 +7675,22 @@ ColorGradientLocalizationService = __decorate([
7514
7675
  __param(0, Inject(L10N_PREFIX)),
7515
7676
  __param(1, Optional()),
7516
7677
  __param(2, Optional()), __param(2, Inject(RTL)),
7517
- __param(3, Optional()), __param(3, Inject(ColorPickerLocalizationService)),
7518
- __metadata("design:paramtypes", [String, MessageService, Boolean, ColorPickerLocalizationService])
7678
+ __param(3, Optional()), __param(3, Inject(FlatColorPickerLocalizationService)),
7679
+ __metadata("design:paramtypes", [String, MessageService, Boolean, FlatColorPickerLocalizationService])
7519
7680
  ], ColorGradientLocalizationService);
7520
7681
 
7521
7682
  /**
7522
7683
  * @hidden
7523
7684
  */
7524
7685
  let ColorInputComponent = class ColorInputComponent {
7525
- constructor(localization, host, renderer) {
7526
- this.localization = localization;
7686
+ constructor(host, renderer, localizationService) {
7527
7687
  this.host = host;
7528
7688
  this.renderer = renderer;
7689
+ this.localizationService = localizationService;
7690
+ /**
7691
+ * The id of the hex input.
7692
+ */
7693
+ this.focusableId = `k-${guid()}`;
7529
7694
  /**
7530
7695
  * Sets whether the alpha slider will be shown.
7531
7696
  */
@@ -7575,11 +7740,14 @@ let ColorInputComponent = class ColorInputComponent {
7575
7740
  }
7576
7741
  ngOnChanges(changes) {
7577
7742
  if (isPresent(changes.value) && !this.isFocused) {
7578
- this.hex = parseColor$1(this.value, 'hex');
7743
+ this.hex = parseColor$1(this.value, 'hex', this.opacity);
7579
7744
  this.rgba = getRGBA(this.value);
7580
- 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;
7581
7746
  }
7582
7747
  }
7748
+ get formatButtonTitle() {
7749
+ return this.localizationService.get('formatButton');
7750
+ }
7583
7751
  handleRgbaValueChange() {
7584
7752
  const color = getColorFromRGBA(this.rgba);
7585
7753
  if (!this.rgbaInputValid || color === this.value) {
@@ -7587,12 +7755,12 @@ let ColorInputComponent = class ColorInputComponent {
7587
7755
  }
7588
7756
  this.value = color;
7589
7757
  this.rgba = getRGBA(this.value);
7590
- this.hex = parseColor$1(color, 'hex');
7758
+ this.hex = parseColor$1(color, 'hex', this.opacity);
7591
7759
  this.valueChange.emit(color);
7592
7760
  }
7593
7761
  handleHexValueChange(hex) {
7594
7762
  this.hex = hex;
7595
- const color = parseColor$1(hex, 'rgba');
7763
+ const color = parseColor$1(hex, 'rgba', this.opacity);
7596
7764
  if (!isPresent(color) || color === this.value) {
7597
7765
  return;
7598
7766
  }
@@ -7606,10 +7774,7 @@ let ColorInputComponent = class ColorInputComponent {
7606
7774
  }
7607
7775
  }
7608
7776
  handleHexInputBlur() {
7609
- this.hex = parseColor$1(this.value, 'hex');
7610
- }
7611
- textFor(key) {
7612
- return this.localization.get(key);
7777
+ this.hex = parseColor$1(this.value, 'hex', this.opacity);
7613
7778
  }
7614
7779
  toggleFormatView() {
7615
7780
  this.formatView = this.formatView === 'hex' ? 'rgba' : 'hex';
@@ -7621,6 +7786,10 @@ let ColorInputComponent = class ColorInputComponent {
7621
7786
  this.subscriptions.add(this.renderer.listen(this.toggleFormatButton.nativeElement, 'click', () => this.toggleFormatView()));
7622
7787
  }
7623
7788
  };
7789
+ __decorate([
7790
+ Input(),
7791
+ __metadata("design:type", String)
7792
+ ], ColorInputComponent.prototype, "focusableId", void 0);
7624
7793
  __decorate([
7625
7794
  Input(),
7626
7795
  __metadata("design:type", String)
@@ -7651,11 +7820,19 @@ __decorate([
7651
7820
  __metadata("design:type", Boolean)
7652
7821
  ], ColorInputComponent.prototype, "colorInputClass", void 0);
7653
7822
  __decorate([
7654
- ViewChild('opacityInput', { read: ElementRef, static: false }),
7655
- __metadata("design:type", ElementRef)
7823
+ ViewChild('opacityInput', { static: false }),
7824
+ __metadata("design:type", NumericTextBoxComponent)
7656
7825
  ], ColorInputComponent.prototype, "opacityInput", void 0);
7657
7826
  __decorate([
7658
- ViewChild('toggleFormatButton', { static: false }),
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);
7834
+ __decorate([
7835
+ ViewChild('toggleFormatButton', { static: false }),
7659
7836
  __metadata("design:type", ElementRef)
7660
7837
  ], ColorInputComponent.prototype, "toggleFormatButton", void 0);
7661
7838
  ColorInputComponent = __decorate([
@@ -7663,20 +7840,27 @@ ColorInputComponent = __decorate([
7663
7840
  selector: 'kendo-colorinput',
7664
7841
  template: `
7665
7842
  <div class="k-vstack">
7666
- <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
+ >
7667
7848
  <span class="k-button-icon k-icon k-i-arrows-kpi"></span>
7668
7849
  </button>
7669
7850
  </div>
7670
- <input *ngIf="formatView === 'hex'"
7671
- #hexInput
7672
- class="k-textbox k-hex-value"
7673
- [disabled]="disabled"
7674
- [readonly]="readonly"
7675
- [value]="hex || ''"
7676
- [placeholder]="textFor('hexInputPlaceholder')"
7677
- (blur)="handleHexInputBlur()"
7678
- (input)="handleHexValueChange(hexInput.value)"
7679
- />
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>
7680
7864
  <ng-container *ngIf="formatView === 'rgba'">
7681
7865
  <div class="k-vstack">
7682
7866
  <kendo-numerictextbox
@@ -7685,7 +7869,6 @@ ColorInputComponent = __decorate([
7685
7869
  [readonly]="readonly"
7686
7870
  [min]="0"
7687
7871
  [max]="255"
7688
- [placeholder]="textFor('redInputPlaceholder')"
7689
7872
  [(value)]="rgba.r"
7690
7873
  [autoCorrect]="true"
7691
7874
  [spinners]="false"
@@ -7703,7 +7886,6 @@ ColorInputComponent = __decorate([
7703
7886
  [readonly]="readonly"
7704
7887
  [min]="0"
7705
7888
  [max]="255"
7706
- [placeholder]="textFor('greenInputPlaceholder')"
7707
7889
  [(value)]="rgba.g"
7708
7890
  [autoCorrect]="true"
7709
7891
  [spinners]="false"
@@ -7721,7 +7903,6 @@ ColorInputComponent = __decorate([
7721
7903
  [readonly]="readonly"
7722
7904
  [min]="0"
7723
7905
  [max]="255"
7724
- [placeholder]="textFor('blueInputPlaceholder')"
7725
7906
  [(value)]="rgba.b"
7726
7907
  [autoCorrect]="true"
7727
7908
  [spinners]="false"
@@ -7739,7 +7920,6 @@ ColorInputComponent = __decorate([
7739
7920
  [readonly]="readonly"
7740
7921
  [min]="0"
7741
7922
  [max]="1"
7742
- [placeholder]="textFor('alphaInputPlaceholder')"
7743
7923
  [(value)]="rgba.a"
7744
7924
  [autoCorrect]="true"
7745
7925
  [spinners]="false"
@@ -7754,32 +7934,11 @@ ColorInputComponent = __decorate([
7754
7934
  </ng-container>
7755
7935
  `
7756
7936
  }),
7757
- __metadata("design:paramtypes", [LocalizationService,
7758
- ElementRef,
7759
- Renderer2])
7937
+ __metadata("design:paramtypes", [ElementRef,
7938
+ Renderer2,
7939
+ LocalizationService])
7760
7940
  ], ColorInputComponent);
7761
7941
 
7762
- /**
7763
- * @hidden
7764
- */
7765
- const DEFAULT_OUTPUT_FORMAT = 'rgba';
7766
- /**
7767
- * @hidden
7768
- */
7769
- const DEFAULT_GRADIENT_BACKGROUND_COLOR = 'rgba(255, 0, 0, 1)';
7770
- /**
7771
- * @hidden
7772
- */
7773
- const DRAGHANDLE_MOVE_SPEED = 5;
7774
- /**
7775
- * @hidden
7776
- */
7777
- const AAA_RATIO = 7.0;
7778
- /**
7779
- * @hidden
7780
- */
7781
- const AA_RATIO = 4.5;
7782
-
7783
7942
  var ColorGradientComponent_1;
7784
7943
  let serial = 0;
7785
7944
  /**
@@ -7793,9 +7952,6 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7793
7952
  this.renderer = renderer;
7794
7953
  this.cdr = cdr;
7795
7954
  this.localizationService = localizationService;
7796
- /**
7797
- * @hidden
7798
- */
7799
7955
  this.hostClasses = true;
7800
7956
  /**
7801
7957
  * @hidden
@@ -7803,18 +7959,26 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7803
7959
  this.id = `k-colorgradient-${serial++}`;
7804
7960
  /**
7805
7961
  * Defines whether the alpha slider will be displayed.
7962
+ *
7963
+ * @default true
7806
7964
  */
7807
7965
  this.opacity = true;
7808
7966
  /**
7809
7967
  * Sets the disabled state of the ColorGradient.
7968
+ *
7969
+ * @default false
7810
7970
  */
7811
7971
  this.disabled = false;
7812
7972
  /**
7813
7973
  * Sets the read-only state of the ColorGradient.
7974
+ *
7975
+ * @default false
7814
7976
  */
7815
7977
  this.readonly = false;
7816
7978
  /**
7817
7979
  * Specifies whether the ColorGradient should display a 'Clear color' button.
7980
+ *
7981
+ * @default false
7818
7982
  */
7819
7983
  this.clearButton = false;
7820
7984
  /**
@@ -7823,6 +7987,16 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7823
7987
  * @default 0
7824
7988
  */
7825
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;
7826
8000
  /**
7827
8001
  * Fires each time the user selects a new color.
7828
8002
  */
@@ -7838,17 +8012,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7838
8012
  * The values are initially set in `ngOnInit` or in `ngOnChanges` and are
7839
8013
  * updated on moving the drag handle or the sliders.
7840
8014
  */
7841
- this.hsva = {};
7842
- /**
7843
- * Specifies the output format of the ColorGradientComponent.
7844
- * The input value may be in a different format. However, it will be parsed into the output `format`
7845
- * after the component processes it.
7846
- *
7847
- * The supported values are:
7848
- * * (Default) `rgba`
7849
- * * `hex`
7850
- */
7851
- this.format = DEFAULT_OUTPUT_FORMAT;
8015
+ this.hsva = new BehaviorSubject({});
7852
8016
  this._tabindex = 0;
7853
8017
  this.listeners = [];
7854
8018
  this.updateValues = new Subject();
@@ -7858,46 +8022,51 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7858
8022
  this.direction = rtl ? 'rtl' : 'ltr';
7859
8023
  });
7860
8024
  }
7861
- /**
7862
- * @hidden
7863
- */
7864
8025
  get readonlyAttribute() {
7865
8026
  return this.readonly;
7866
8027
  }
7867
- /**
7868
- * @hidden
7869
- */
7870
8028
  get disabledClass() {
7871
8029
  return this.disabled;
7872
8030
  }
7873
- /**
7874
- * @hidden
7875
- */
7876
- get hostTabindex() {
7877
- return this.tabindex;
7878
- }
7879
- /**
7880
- * @hidden
7881
- */
7882
8031
  get gradientId() {
7883
8032
  return this.id;
7884
8033
  }
8034
+ get hostTabindex() {
8035
+ return this.tabindex;
8036
+ }
7885
8037
  /**
7886
8038
  * Specifies the value of the initially selected color.
7887
8039
  */
7888
8040
  set value(value) {
7889
- this._value = parseColor$1(value, this.format);
8041
+ this._value = parseColor$1(value, this.format, this.opacity);
7890
8042
  }
7891
8043
  get value() {
7892
8044
  return this._value;
7893
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
+ }
7894
8056
  /**
7895
8057
  * Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
8058
+ *
8059
+ * @default 0
7896
8060
  */
7897
8061
  set tabindex(value) {
7898
- const tabindex = Number(value);
7899
- const defaultValue = 0;
7900
- 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
+ }
7901
8070
  }
7902
8071
  get tabindex() {
7903
8072
  return !this.disabled ? this._tabindex : undefined;
@@ -7916,10 +8085,10 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7916
8085
  */
7917
8086
  get alphaSliderValue() {
7918
8087
  // setting the initial value to undefined to force the slider to recalculate the height of the slider track on the next cdr run
7919
- if (!(isPresent(this.hsva) && isPresent(this.hsva.a))) {
8088
+ if (!(isPresent(this.hsva.value) && isPresent(this.hsva.value.a))) {
7920
8089
  return;
7921
8090
  }
7922
- return this.hsva.a * 100;
8091
+ return this.hsva.value.a * 100;
7923
8092
  }
7924
8093
  get gradientRect() {
7925
8094
  return this.gradientWrapper.nativeElement.getBoundingClientRect();
@@ -7928,7 +8097,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7928
8097
  * @hidden
7929
8098
  */
7930
8099
  get contrastToolVisible() {
7931
- return typeof this.contrastTool === 'string' && this.contrastTool !== '';
8100
+ return this.contrastTool && this.contrastTool.length > 0;
7932
8101
  }
7933
8102
  ngAfterViewInit() {
7934
8103
  this.updateUI();
@@ -7959,7 +8128,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7959
8128
  if (this.disabled) {
7960
8129
  return;
7961
8130
  }
7962
- this.host.nativeElement.focus();
8131
+ this.gradientDragHandle.nativeElement.focus();
7963
8132
  }
7964
8133
  /**
7965
8134
  * @hidden
@@ -7997,7 +8166,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
7997
8166
  return;
7998
8167
  }
7999
8168
  this.renderer.removeClass(this.gradientWrapper.nativeElement, 'k-dragging');
8000
- this.handleValueChange(getColorFromHSV(this.hsva));
8169
+ this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
8001
8170
  }
8002
8171
  /**
8003
8172
  * @hidden
@@ -8042,15 +8211,19 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
8042
8211
  return;
8043
8212
  }
8044
8213
  this.gradientDragHandle.nativeElement.focus();
8045
- const newX = position.clientX - this.gradientRect.left;
8046
- 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;
8047
8217
  this.ngZone.run(() => this.moveDragHandle(newX, newY));
8048
8218
  }
8049
8219
  /**
8050
8220
  * @hidden
8051
8221
  */
8052
8222
  handleHueSliderChange(hue) {
8053
- 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));
8054
8227
  this.backgroundColor = getColorFromHue(hue);
8055
8228
  this.setAlphaSliderBackground(this.backgroundColor);
8056
8229
  }
@@ -8058,14 +8231,16 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
8058
8231
  * @hidden
8059
8232
  */
8060
8233
  handleAlphaSliderChange(alpha) {
8061
- this.hsva.a = alpha / 100;
8062
- 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));
8063
8238
  }
8064
8239
  /**
8065
8240
  * @hidden
8066
8241
  */
8067
8242
  handleInputsValueChange(color) {
8068
- const parsed = parseColor$1(color, this.format);
8243
+ const parsed = parseColor$1(color, this.format, this.opacity);
8069
8244
  if (this.value !== parsed) {
8070
8245
  this.handleValueChange(parsed);
8071
8246
  this.updateUI();
@@ -8109,7 +8284,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
8109
8284
  * @hidden
8110
8285
  */
8111
8286
  get colorGradientHandleAriaLabel() {
8112
- const parsed = parseColor$1(this.value, this.format);
8287
+ const parsed = parseColor$1(this.value, this.format, this.opacity);
8113
8288
  return `${this.value ? parsed : this.localizationService.get('colorGradientHandle')}`;
8114
8289
  }
8115
8290
  /**
@@ -8132,29 +8307,35 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
8132
8307
  }
8133
8308
  /**
8134
8309
  * @hidden
8135
- * Used by the TextBoxContainer to determine if the component is empty.
8310
+ * Used by the FloatingLabel to determine if the component is empty.
8136
8311
  */
8137
8312
  isEmpty() {
8138
8313
  return false;
8139
8314
  }
8140
8315
  moveDragHandle(positionX, positionY) {
8141
- const top = fitIntoBounds(positionY, 0, this.gradientRect.height);
8142
- 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);
8143
8321
  this.setDragHandleElementPosition(top, left);
8144
- this.hsva.s = left / this.gradientRect.width;
8145
- this.hsva.v = 1 - top / this.gradientRect.height;
8146
- this.updateValues.next(getColorFromHSV(this.hsva));
8147
- 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));
8148
8328
  }
8149
8329
  updateUI() {
8150
8330
  if (!isDocumentAvailable()) {
8151
8331
  return;
8152
8332
  }
8153
- this.hsva = this.value ? getHSV(this.value) : { h: 0, s: 0, v: 1, a: 1 };
8154
- const top = (1 - this.hsva.v) * this.gradientRect.height;
8155
- 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;
8156
8337
  this.setDragHandleElementPosition(top, left);
8157
- this.backgroundColor = getColorFromHue(this.hsva.h);
8338
+ this.backgroundColor = getColorFromHue(this.hsva.value.h);
8158
8339
  this.setAlphaSliderBackground(this.backgroundColor);
8159
8340
  this.setHostElementAriaLabel();
8160
8341
  }
@@ -8180,7 +8361,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
8180
8361
  this.renderer.setStyle(sliderTrack, 'background', `linear-gradient(to top, transparent, ${backgroundColor})`);
8181
8362
  }
8182
8363
  setHostElementAriaLabel() {
8183
- const parsed = parseColor$1(this.value, this.format);
8364
+ const parsed = parseColor$1(this.value, this.format, this.opacity);
8184
8365
  this.renderer.setAttribute(this.host.nativeElement, 'aria-label', `${this.value ? parsed : this.localizationService.get('colorGradientNoColor')}`);
8185
8366
  }
8186
8367
  addEventListeners() {
@@ -8196,7 +8377,7 @@ let ColorGradientComponent = ColorGradientComponent_1 = class ColorGradientCompo
8196
8377
  const keyupListener = this.renderer.listen(this.gradientDragHandle.nativeElement, 'keyup', () => {
8197
8378
  this.renderer.removeClass(this.gradientWrapper.nativeElement, 'k-dragging');
8198
8379
  if (!this.readonly && !this.disabled) {
8199
- this.ngZone.run(() => this.handleValueChange(getColorFromHSV(this.hsva)));
8380
+ this.ngZone.run(() => this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity)));
8200
8381
  }
8201
8382
  });
8202
8383
  const dragHandleFocusInListener = this.renderer.listen(this.gradientDragHandle.nativeElement, 'focusin', () => {
@@ -8233,24 +8414,24 @@ __decorate([
8233
8414
  __metadata("design:type", Boolean),
8234
8415
  __metadata("design:paramtypes", [])
8235
8416
  ], ColorGradientComponent.prototype, "disabledClass", null);
8236
- __decorate([
8237
- HostBinding('attr.tabindex'),
8238
- __metadata("design:type", Number),
8239
- __metadata("design:paramtypes", [])
8240
- ], ColorGradientComponent.prototype, "hostTabindex", null);
8241
8417
  __decorate([
8242
8418
  HostBinding('attr.id'),
8243
8419
  __metadata("design:type", String),
8244
8420
  __metadata("design:paramtypes", [])
8245
8421
  ], ColorGradientComponent.prototype, "gradientId", null);
8246
- __decorate([
8247
- Input(),
8248
- __metadata("design:type", String)
8249
- ], ColorGradientComponent.prototype, "id", void 0);
8250
8422
  __decorate([
8251
8423
  HostBinding('attr.dir'),
8252
8424
  __metadata("design:type", String)
8253
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);
8254
8435
  __decorate([
8255
8436
  Input(),
8256
8437
  __metadata("design:type", Boolean)
@@ -8278,21 +8459,22 @@ __decorate([
8278
8459
  ], ColorGradientComponent.prototype, "value", null);
8279
8460
  __decorate([
8280
8461
  Input(),
8281
- __metadata("design:type", String)
8282
- ], ColorGradientComponent.prototype, "contrastTool", void 0);
8462
+ __metadata("design:type", String),
8463
+ __metadata("design:paramtypes", [String])
8464
+ ], ColorGradientComponent.prototype, "contrastTool", null);
8283
8465
  __decorate([
8284
8466
  Input(),
8285
8467
  __metadata("design:type", Number),
8286
8468
  __metadata("design:paramtypes", [Number])
8287
8469
  ], ColorGradientComponent.prototype, "tabindex", null);
8288
- __decorate([
8289
- Output(),
8290
- __metadata("design:type", EventEmitter)
8291
- ], ColorGradientComponent.prototype, "valueChange", void 0);
8292
8470
  __decorate([
8293
8471
  Input(),
8294
8472
  __metadata("design:type", String)
8295
8473
  ], ColorGradientComponent.prototype, "format", void 0);
8474
+ __decorate([
8475
+ Output(),
8476
+ __metadata("design:type", EventEmitter)
8477
+ ], ColorGradientComponent.prototype, "valueChange", void 0);
8296
8478
  __decorate([
8297
8479
  ViewChild('gradientDragHandle', { read: ElementRef, static: false }),
8298
8480
  __metadata("design:type", ElementRef)
@@ -8311,6 +8493,7 @@ __decorate([
8311
8493
  ], ColorGradientComponent.prototype, "gradientWrapper", void 0);
8312
8494
  ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8313
8495
  Component({
8496
+ exportAs: 'kendoColorGradient',
8314
8497
  selector: 'kendo-colorgradient',
8315
8498
  providers: [
8316
8499
  {
@@ -8344,22 +8527,14 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8344
8527
  hueSliderHandle="Set hue"
8345
8528
  i18n-opacitySliderHandle="kendo.colorgradient.opacitySliderHandle|The title for the opacity slider handle."
8346
8529
  opacitySliderHandle="Set opacity"
8347
- i18n-hexInputPlaceholder="kendo.colorgradient.hexInputPlaceholder|The placeholder for the HEX color input."
8348
- hexInputPlaceholder="HEX Color"
8349
- i18n-redInputPlaceholder="kendo.colorgradient.redInputPlaceholder|The placeholder for the red color input."
8350
- redInputPlaceholder="Red"
8351
- i18n-greenInputPlaceholder="kendo.colorgradient.greenInputPlaceholder|The placeholder for the green color input."
8352
- greenInputPlaceholder="Green"
8353
- i18n-blueInputPlaceholder="kendo.colorgradient.blueInputPlaceholder|The placeholder for the blue color input."
8354
- blueInputPlaceholder="Blue"
8355
- i18n-alphaInputPlaceholder="kendo.colorgradient.alphaInputPlaceholder|The placeholder for the alpha input."
8356
- alphaInputPlaceholder="Alpha"
8357
8530
  i18n-passContrast="kendo.colorgradient.passContrast|The pass message for the contrast tool."
8358
8531
  passContrast="Pass"
8359
8532
  i18n-failContrast="kendo.colorgradient.failContrast|The fail message for the contrast tool."
8360
8533
  failContrast="Fail"
8361
8534
  i18n-contrastRatio="kendo.colorgradient.contrastRatio|The contrast ratio message for the contrast tool."
8362
- 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">
8363
8538
  </ng-container>
8364
8539
  <div class="k-colorgradient-canvas k-hstack">
8365
8540
  <div class="k-hsv-rectangle" [style.background]="backgroundColor">
@@ -8380,6 +8555,14 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8380
8555
  >
8381
8556
  </div>
8382
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>
8383
8566
  </div>
8384
8567
  <div class="k-hsv-controls k-hstack {{ clearButton ? 'k-sliders-wrap-clearable' : '' }}">
8385
8568
  <span class="k-clear-color k-button k-flat k-button-icon"
@@ -8405,12 +8588,12 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8405
8588
  [max]="360"
8406
8589
  [smallStep]="5"
8407
8590
  [largeStep]="10"
8408
- [(value)]="hsva.h"
8591
+ [value]="hsva.value.h"
8409
8592
  (valueChange)="handleHueSliderChange($event)"
8410
8593
  >
8411
8594
  </kendo-slider>
8412
8595
  <kendo-slider
8413
- *ngIf="opacity && format === 'rgba'"
8596
+ *ngIf="opacity"
8414
8597
  #alphaSlider
8415
8598
  [ngClass]="{'k-align-self-end': clearButton}"
8416
8599
  class="k-alpha-slider k-colorgradient-slider"
@@ -8448,12 +8631,21 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8448
8631
  styles: [`
8449
8632
  .k-clear-color {
8450
8633
  position: absolute;
8634
+ top: 0;
8451
8635
  left: 50%;
8452
8636
  transform: translateX(-50%);
8453
8637
  }
8454
- .k-align-self-end {
8638
+ .k-colorgradient-slider.k-align-self-end {
8455
8639
  height: 140px;
8456
8640
  }
8641
+
8642
+ .k-color-contrast-svg {
8643
+ position: absolute;
8644
+ overflow: visible;
8645
+ pointer-events: none;
8646
+ left: 0px;
8647
+ top: 0px;
8648
+ }
8457
8649
  `]
8458
8650
  }),
8459
8651
  __metadata("design:paramtypes", [ElementRef,
@@ -8463,93 +8655,174 @@ ColorGradientComponent = ColorGradientComponent_1 = __decorate([
8463
8655
  LocalizationService])
8464
8656
  ], ColorGradientComponent);
8465
8657
 
8466
- var ColorPickerComponent_1;
8467
- const DEFAULT_PRESET = 'office';
8468
- 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';
8469
8748
  let serial$1 = 0;
8470
8749
  /**
8471
- * Represents the [Kendo UI ColorPicker component for Angular]({% slug overview_colorpicker %}).
8472
- * 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.
8473
8752
  */
8474
- let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
8475
- constructor(popupService, cdr, localizationService, ngZone) {
8476
- 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;
8477
8757
  this.cdr = cdr;
8758
+ this.renderer = renderer;
8478
8759
  this.localizationService = localizationService;
8479
- this.ngZone = ngZone;
8480
8760
  /**
8481
8761
  * @hidden
8482
8762
  */
8483
- this.hostClasses = true;
8763
+ this.id = `k-colorpalette-${serial$1++}`;
8484
8764
  /**
8485
- * @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`
8486
8773
  */
8487
- this.focusableId = `k-colorpicker-${serial$1++}`;
8774
+ this.format = 'hex';
8488
8775
  /**
8489
- * Sets what view the ColorPicker will render in the popup.
8776
+ * Sets the disabled state of the ColorPalette.
8490
8777
  */
8491
- this.view = 'gradient';
8778
+ this.disabled = false;
8492
8779
  /**
8493
- * Sets the read-only state of the ColorPicker.
8780
+ * Sets the read-only state of the ColorPalette.
8494
8781
  */
8495
8782
  this.readonly = false;
8496
8783
  /**
8497
- * 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 }`
8498
8789
  */
8499
- this.disabled = false;
8790
+ this.tileSize = { width: DEFAULT_TILE_SIZE, height: DEFAULT_TILE_SIZE };
8500
8791
  /**
8501
- * Specifies the output format of the ColorPicker.
8502
- * The input value may be in a different format. However, it will be parsed into the output `format`
8503
- * after the component processes it.
8504
- *
8505
- * If the `gradient` view is used with the `opacity` option set to true, this setting will be ignored and `rgba` will be used instead.
8506
- *
8507
- * The supported values are:
8508
- * * `rgba` (default)
8509
- * * `hex`
8510
- * * [name](https://www.w3.org/wiki/CSS/Properties/color/keywords)
8792
+ * Fires each time the color selection is changed.
8511
8793
  */
8512
- this.format = 'rgba';
8794
+ this.selectionChange = new EventEmitter();
8513
8795
  /**
8514
8796
  * Fires each time the value is changed.
8515
8797
  */
8516
8798
  this.valueChange = new EventEmitter();
8517
8799
  /**
8518
- * Fires each time the popup is about to open.
8519
- * This event is preventable. If you cancel it, the popup will remain closed.
8520
- */
8521
- this.open = new EventEmitter();
8522
- /**
8523
- * Fires each time the popup is about to close.
8524
- * This event is preventable. If you cancel it, the popup will remain open.
8525
- */
8526
- this.close = new EventEmitter();
8527
- /**
8528
- * Fires each time ColorPicker is focused.
8800
+ * Fires each time the user selects a cell with the mouse or presses `Enter`.
8801
+ *
8802
+ * @hidden
8529
8803
  */
8530
- this.onFocus = new EventEmitter();
8804
+ this.cellSelection = new EventEmitter();
8531
8805
  /**
8532
- * Fires each time the ColorPicker is blurred.
8806
+ * @hidden
8533
8807
  */
8534
- this.onBlur = new EventEmitter();
8808
+ this.hostClasses = true;
8535
8809
  /**
8536
- * Fires each time the left side of the ColorPicker wrapper is clicked.
8537
- * The event is triggered regardless of whether a ColorPicker icon is set or not.
8538
- *
8539
- * The [ActiveColorClickEvent]({% slug api_inputs_activecolorclickevent %}) event provides the option to prevent the popup opening.
8810
+ * @hidden
8540
8811
  */
8541
- this.activeColorClick = new EventEmitter();
8812
+ this.uniqueId = guid();
8542
8813
  this._tabindex = 0;
8543
- this._popupSettings = { animate: true };
8544
- this._paletteSettings = {};
8545
- this._gradientSettings = { opacity: true, clearButton: false, delay: 0 };
8546
8814
  this.notifyNgTouched = () => { };
8547
8815
  this.notifyNgChanged = () => { };
8548
- validatePackage(packageMetadata);
8549
- this.dynamicRTLSubscription = this.localizationService.changes.subscribe(({ rtl }) => {
8816
+ this.dynamicRTLSubscription = localizationService.changes.subscribe(({ rtl }) => {
8550
8817
  this.direction = rtl ? 'rtl' : 'ltr';
8551
8818
  });
8552
8819
  }
8820
+ /**
8821
+ * @hidden
8822
+ */
8823
+ get paletteId() {
8824
+ return this.id;
8825
+ }
8553
8826
  /**
8554
8827
  * Specifies the value of the initially selected color.
8555
8828
  */
@@ -8560,31 +8833,37 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
8560
8833
  return this._value;
8561
8834
  }
8562
8835
  /**
8563
- * Configures the popup of the ColorPicker.
8564
- */
8565
- set popupSettings(value) {
8566
- this._popupSettings = Object.assign(this._popupSettings, value);
8567
- }
8568
- get popupSettings() {
8569
- return this._popupSettings;
8570
- }
8571
- /**
8572
- * Configures the palette that is displayed in the ColorPicker popup.
8836
+ * Specifies the number of columns that will be displayed.
8837
+ * Defaults to `10`.
8573
8838
  */
8574
- set paletteSettings(value) {
8575
- this._paletteSettings = Object.assign(this._paletteSettings, value);
8839
+ set columns(value) {
8840
+ const minColumnsCount = 1;
8841
+ this._columns = value > minColumnsCount ? value : minColumnsCount;
8576
8842
  }
8577
- get paletteSettings() {
8578
- return this._paletteSettings;
8843
+ get columns() {
8844
+ return this._columns;
8579
8845
  }
8580
8846
  /**
8581
- * 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.
8582
8853
  */
8583
- set gradientSettings(value) {
8584
- 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));
8585
8864
  }
8586
- get gradientSettings() {
8587
- return this._gradientSettings;
8865
+ get palette() {
8866
+ return this._palette;
8588
8867
  }
8589
8868
  /**
8590
8869
  * Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
@@ -8598,710 +8877,1265 @@ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
8598
8877
  return !this.disabled ? this._tabindex : undefined;
8599
8878
  }
8600
8879
  /**
8601
- * Indicates whether the ColorPicker popup is open.
8880
+ * @hidden
8602
8881
  */
8603
- get isOpen() {
8604
- 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 };
8605
8887
  }
8606
8888
  /**
8607
8889
  * @hidden
8608
8890
  */
8609
- get iconStyles() {
8610
- if (this.iconClass) {
8611
- return this.iconClass;
8612
- }
8613
- if (this.icon) {
8614
- return `k-icon k-i-${this.icon}`;
8615
- }
8891
+ get colorRows() {
8892
+ return this.service.colorRows;
8616
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; }
8617
8906
  ngOnInit() {
8618
- const defaultPreset = (this.format !== 'name') ? DEFAULT_PRESET : DEFAULT_ACCESSIBLE_PRESET;
8619
- const settingsPalette = this._paletteSettings.palette;
8620
- const presetColumns = typeof settingsPalette === 'string' && PALETTEPRESETS[settingsPalette] ?
8621
- PALETTEPRESETS[settingsPalette].columns :
8622
- undefined;
8623
- this._paletteSettings = {
8624
- palette: settingsPalette || defaultPreset,
8625
- tileSize: this._paletteSettings.tileSize || 24,
8626
- columns: this._paletteSettings.columns || presetColumns || 10
8627
- };
8628
- }
8629
- ngOnChanges(changes) {
8630
- if (changes.format && changes.format.currentValue === 'name') {
8631
- this.view = 'palette';
8632
- }
8633
- if (this.view === 'gradient' && this.gradientSettings.opacity) {
8634
- this.format = 'rgba';
8635
- 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);
8636
8912
  }
8637
8913
  }
8914
+ ngAfterViewInit() {
8915
+ this.setHostElementAriaLabel();
8916
+ }
8638
8917
  ngOnDestroy() {
8639
- this.closePopup();
8640
8918
  if (this.dynamicRTLSubscription) {
8641
8919
  this.dynamicRTLSubscription.unsubscribe();
8642
8920
  }
8643
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
+ }
8644
8931
  /**
8645
8932
  * @hidden
8646
8933
  */
8647
- handleWrapperClick() {
8648
- this.toggleWithEvents(!this.isOpen);
8649
- 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();
8650
8955
  }
8651
8956
  /**
8652
8957
  * @hidden
8653
8958
  */
8654
- handleActiveColorClick() {
8655
- this.focus();
8656
- const event = new ActiveColorClickEvent(this.value);
8657
- this.activeColorClick.emit(event);
8658
- if (!event.isOpenPrevented() || this.isOpen) {
8659
- this.handleWrapperClick();
8660
- }
8959
+ handleHostBlur() {
8960
+ this.notifyNgTouched();
8961
+ this.handleCellFocusOnBlur();
8661
8962
  }
8662
8963
  /**
8663
- * Focuses the wrapper of the ColorPicker.
8964
+ * @hidden
8664
8965
  */
8665
- focus() {
8666
- if (this.disabled) {
8966
+ handleCellSelection(value, focusedCell) {
8967
+ if (this.readonly) {
8667
8968
  return;
8668
8969
  }
8669
- 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
+ }
8670
8983
  }
8671
8984
  /**
8672
8985
  * @hidden
8673
8986
  */
8674
- handleWrapperFocus() {
8675
- if (isPresent(this.palette)) {
8676
- this.palette.nativeElement.focus();
8677
- }
8678
- if (this.isFocused) {
8679
- return;
8680
- }
8681
- this.isFocused = true;
8682
- this.onFocus.emit();
8987
+ writeValue(value) {
8988
+ this.value = value;
8989
+ this.focusedCell = this.service.getCellCoordsFor(this.value);
8683
8990
  }
8684
8991
  /**
8685
- * Blurs the ColorPicker.
8992
+ * @hidden
8686
8993
  */
8687
- blur() {
8688
- this.wrapper.nativeElement.blur();
8994
+ registerOnChange(fn) {
8995
+ this.notifyNgChanged = fn;
8689
8996
  }
8690
8997
  /**
8691
8998
  * @hidden
8692
8999
  */
8693
- handleWrapperBlur() {
8694
- if (this.isOpen) {
8695
- return;
8696
- }
8697
- this.isFocused = false;
8698
- this.onBlur.emit();
8699
- this.notifyNgTouched();
9000
+ registerOnTouched(fn) {
9001
+ this.notifyNgTouched = fn;
8700
9002
  }
8701
9003
  /**
8702
- * Clears the color value of the ColorPicker.
9004
+ * @hidden
8703
9005
  */
8704
- reset() {
8705
- if (!isPresent(this.value)) {
8706
- return;
8707
- }
8708
- this._value = undefined;
8709
- this.notifyNgChanged(undefined);
9006
+ setDisabledState(isDisabled) {
9007
+ this.cdr.markForCheck();
9008
+ this.disabled = isDisabled;
8710
9009
  }
8711
9010
  /**
8712
- * Toggles the popup of the ColorPicker.
8713
- * Does not trigger the `open` and `close` events of the component.
8714
- *
8715
- * @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.
8716
9013
  */
8717
- toggle(open) {
8718
- if (this.disabled || this.readonly) {
8719
- return;
8720
- }
8721
- this.closePopup();
8722
- open = isPresent(open) ? open : !this.isOpen;
8723
- if (open) {
8724
- this.openPopup();
8725
- }
9014
+ isEmpty() {
9015
+ return false;
8726
9016
  }
8727
9017
  /**
8728
- * @hidden
9018
+ * Clears the color value of the ColorPalette.
8729
9019
  */
8730
- handleValueChange(color, closePopup) {
8731
- const parsedColor = parseColor$1(color, this.format);
8732
- const valueChange = parsedColor !== this.value;
8733
- if (closePopup) {
8734
- this.toggleWithEvents(false);
8735
- this.focus();
8736
- }
8737
- if (valueChange) {
8738
- this.value = parsedColor;
8739
- this.valueChange.emit(parsedColor);
8740
- this.notifyNgChanged(parsedColor);
9020
+ reset() {
9021
+ this.focusedCell = null;
9022
+ if (isPresent(this.value)) {
9023
+ this.handleValueChange(undefined);
8741
9024
  }
9025
+ this.selectedCell = undefined;
8742
9026
  }
8743
- /**
8744
- * @hidden
8745
- */
8746
- handlePopupBlur(event) {
8747
- const focusInPopupElement = this.popupRef.popupElement.contains(event.relatedTarget);
8748
- const wrapperClicked = event.relatedTarget === this.wrapper.nativeElement;
8749
- if (!this.isFocused || wrapperClicked || focusInPopupElement) {
9027
+ handleValueChange(color) {
9028
+ if (this.value === color) {
8750
9029
  return;
8751
9030
  }
8752
- this.isFocused = false;
8753
- this.onBlur.emit();
8754
- this.notifyNgTouched();
8755
- this.toggleWithEvents(false);
8756
- }
8757
- /**
8758
- * @hidden
8759
- */
8760
- writeValue(value) {
8761
- this.value = value;
8762
- }
8763
- /**
8764
- * @hidden
8765
- */
8766
- registerOnChange(fn) {
8767
- this.notifyNgChanged = fn;
8768
- }
8769
- /**
8770
- * @hidden
8771
- */
8772
- registerOnTouched(fn) {
8773
- this.notifyNgTouched = fn;
8774
- }
8775
- /**
8776
- * @hidden
8777
- */
8778
- setDisabledState(isDisabled) {
8779
- this.cdr.markForCheck();
8780
- this.disabled = isDisabled;
9031
+ this.value = color;
9032
+ this.valueChange.emit(color);
9033
+ this.notifyNgChanged(color);
9034
+ this.setHostElementAriaLabel();
8781
9035
  }
8782
- /**
8783
- * @hidden
8784
- */
8785
- handleWrapperKeyDown(event) {
8786
- if (event.keyCode === Keys.ArrowDown || event.keyCode === Keys.Enter) {
8787
- event.preventDefault();
8788
- this.toggleWithEvents(true);
8789
- }
9036
+ handleCellFocusOnBlur() {
9037
+ this.focusInComponent = false;
9038
+ this.focusedCell = this.selectedCell;
8790
9039
  }
8791
- /**
8792
- * @hidden
8793
- */
8794
- handlePopupKeyDown(event) {
8795
- if (event.keyCode === Keys.Escape) {
8796
- this.toggleWithEvents(false);
8797
- this.wrapper.nativeElement.focus();
8798
- }
8799
- if (event.keyCode === Keys.Tab) {
8800
- const firstElement = this.colorGradient ? this.colorGradient.gradientDragHandle.nativeElement : this.palette.nativeElement;
8801
- const lastElement = this.palette ? this.palette.nativeElement :
8802
- this.colorGradient.inputs.opacityInput.nativeElement.childNodes[1].children[0];
8803
- if (event.shiftKey) {
8804
- if (event.target === firstElement) {
8805
- event.preventDefault();
8806
- lastElement.focus();
8807
- return;
8808
- }
8809
- }
8810
- else {
8811
- if (event.target === lastElement) {
8812
- event.preventDefault();
8813
- firstElement.focus();
8814
- return;
8815
- }
8816
- }
9040
+ setRows() {
9041
+ if (!isPresent(this.palette)) {
9042
+ return;
8817
9043
  }
9044
+ this.columns = this.columns || DEFAULT_COLUMNS_COUNT;
9045
+ this.service.setColorMatrix(this.palette, this.columns);
8818
9046
  }
8819
- /**
8820
- * @hidden
8821
- * Used by the TextBoxContainer to determine if the component is empty.
8822
- */
8823
- isEmpty() {
8824
- return false;
8825
- }
8826
- toggleWithEvents(open) {
8827
- const sameState = this.isOpen === open;
8828
- if (this.disabled || this.readonly || sameState) {
9047
+ handleCellNavigation(horizontalStep, verticalStep) {
9048
+ if (this.readonly) {
8829
9049
  return;
8830
9050
  }
8831
- const eventArgs = new PreventableEvent();
8832
- open ? this.open.emit(eventArgs) : this.close.emit(eventArgs);
8833
- if (!eventArgs.isDefaultPrevented()) {
8834
- this.toggle(open);
8835
- }
8836
- if (open) {
8837
- this.ngZone.runOutsideAngular(() => {
8838
- setTimeout(() => {
8839
- if (this.colorGradient) {
8840
- this.colorGradient.gradientDragHandle.nativeElement.focus();
8841
- }
8842
- });
8843
- });
8844
- }
9051
+ this.focusedCell = this.service.getNextCell(this.focusedCell, horizontalStep, verticalStep);
9052
+ this.focusInComponent = true;
8845
9053
  }
8846
- openPopup() {
8847
- const horizontalAlign = this.direction === "rtl" ? "right" : "left";
8848
- const anchorPosition = { horizontal: horizontalAlign, vertical: "bottom" };
8849
- const popupPosition = { horizontal: horizontalAlign, vertical: "top" };
8850
- this.popupRef = this.popupService.open({
8851
- anchor: this.wrapper,
8852
- animate: this.popupSettings.animate,
8853
- appendTo: this.popupSettings.appendTo,
8854
- popupAlign: popupPosition,
8855
- anchorAlign: anchorPosition,
8856
- popupClass: 'k-colorpicker-popup',
8857
- content: this.popupTemplate,
8858
- positionMode: 'absolute'
8859
- });
8860
- this.popupRef.popupAnchorViewportLeave.subscribe(() => {
8861
- this.toggleWithEvents(false);
8862
- if (!this.isOpen) {
8863
- this.wrapper.nativeElement.focus({
8864
- preventScroll: true
8865
- });
8866
- }
8867
- });
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')}`);
8868
9057
  }
8869
- closePopup() {
8870
- if (!this.isOpen) {
9058
+ handleEnter() {
9059
+ if (!isPresent(this.focusedCell)) {
8871
9060
  return;
8872
9061
  }
8873
- this.popupRef.close();
8874
- this.popupRef = null;
8875
- this.palette = null;
9062
+ const selectedColor = this.service.getColorAt(this.focusedCell);
9063
+ this.handleCellSelection(selectedColor, this.focusedCell);
8876
9064
  }
8877
9065
  };
8878
- __decorate([
8879
- HostBinding('class.k-widget'),
8880
- HostBinding('class.k-colorpicker'),
8881
- __metadata("design:type", Boolean)
8882
- ], ColorPickerComponent.prototype, "hostClasses", void 0);
8883
9066
  __decorate([
8884
9067
  HostBinding('attr.dir'),
8885
9068
  __metadata("design:type", String)
8886
- ], ColorPickerComponent.prototype, "direction", void 0);
9069
+ ], ColorPaletteComponent.prototype, "direction", void 0);
8887
9070
  __decorate([
8888
- Input(),
8889
- __metadata("design:type", String)
8890
- ], ColorPickerComponent.prototype, "focusableId", void 0);
9071
+ HostBinding('attr.id'),
9072
+ __metadata("design:type", String),
9073
+ __metadata("design:paramtypes", [])
9074
+ ], ColorPaletteComponent.prototype, "paletteId", null);
8891
9075
  __decorate([
8892
9076
  Input(),
8893
9077
  __metadata("design:type", String)
8894
- ], ColorPickerComponent.prototype, "view", void 0);
8895
- __decorate([
8896
- Input(),
8897
- __metadata("design:type", Boolean)
8898
- ], ColorPickerComponent.prototype, "readonly", void 0);
8899
- __decorate([
8900
- Input(),
8901
- __metadata("design:type", Boolean)
8902
- ], ColorPickerComponent.prototype, "disabled", void 0);
9078
+ ], ColorPaletteComponent.prototype, "id", void 0);
8903
9079
  __decorate([
8904
9080
  Input(),
8905
9081
  __metadata("design:type", String)
8906
- ], ColorPickerComponent.prototype, "format", void 0);
9082
+ ], ColorPaletteComponent.prototype, "format", void 0);
8907
9083
  __decorate([
8908
9084
  Input(),
8909
9085
  __metadata("design:type", String),
8910
9086
  __metadata("design:paramtypes", [String])
8911
- ], ColorPickerComponent.prototype, "value", null);
9087
+ ], ColorPaletteComponent.prototype, "value", null);
8912
9088
  __decorate([
8913
9089
  Input(),
8914
- __metadata("design:type", Object),
8915
- __metadata("design:paramtypes", [Object])
8916
- ], ColorPickerComponent.prototype, "popupSettings", null);
9090
+ __metadata("design:type", Number),
9091
+ __metadata("design:paramtypes", [Number])
9092
+ ], ColorPaletteComponent.prototype, "columns", null);
8917
9093
  __decorate([
8918
9094
  Input(),
8919
9095
  __metadata("design:type", Object),
8920
9096
  __metadata("design:paramtypes", [Object])
8921
- ], ColorPickerComponent.prototype, "paletteSettings", null);
9097
+ ], ColorPaletteComponent.prototype, "palette", null);
8922
9098
  __decorate([
8923
9099
  Input(),
8924
- __metadata("design:type", Object),
8925
- __metadata("design:paramtypes", [Object])
8926
- ], ColorPickerComponent.prototype, "gradientSettings", null);
9100
+ __metadata("design:type", Number),
9101
+ __metadata("design:paramtypes", [Number])
9102
+ ], ColorPaletteComponent.prototype, "tabindex", null);
8927
9103
  __decorate([
8928
9104
  Input(),
8929
- __metadata("design:type", String)
8930
- ], ColorPickerComponent.prototype, "icon", void 0);
9105
+ __metadata("design:type", Boolean)
9106
+ ], ColorPaletteComponent.prototype, "disabled", void 0);
8931
9107
  __decorate([
8932
9108
  Input(),
8933
- __metadata("design:type", Object)
8934
- ], ColorPickerComponent.prototype, "iconClass", void 0);
9109
+ __metadata("design:type", Boolean)
9110
+ ], ColorPaletteComponent.prototype, "readonly", void 0);
8935
9111
  __decorate([
8936
9112
  Input(),
8937
- __metadata("design:type", Number),
8938
- __metadata("design:paramtypes", [Number])
8939
- ], ColorPickerComponent.prototype, "tabindex", null);
9113
+ __metadata("design:type", Object)
9114
+ ], ColorPaletteComponent.prototype, "tileSize", void 0);
8940
9115
  __decorate([
8941
9116
  Output(),
8942
9117
  __metadata("design:type", EventEmitter)
8943
- ], ColorPickerComponent.prototype, "valueChange", void 0);
9118
+ ], ColorPaletteComponent.prototype, "selectionChange", void 0);
8944
9119
  __decorate([
8945
9120
  Output(),
8946
9121
  __metadata("design:type", EventEmitter)
8947
- ], ColorPickerComponent.prototype, "open", void 0);
9122
+ ], ColorPaletteComponent.prototype, "valueChange", void 0);
8948
9123
  __decorate([
8949
9124
  Output(),
8950
9125
  __metadata("design:type", EventEmitter)
8951
- ], ColorPickerComponent.prototype, "close", void 0);
8952
- __decorate([
8953
- Output('focus'),
8954
- __metadata("design:type", EventEmitter)
8955
- ], ColorPickerComponent.prototype, "onFocus", void 0);
8956
- __decorate([
8957
- Output('blur'),
8958
- __metadata("design:type", EventEmitter)
8959
- ], ColorPickerComponent.prototype, "onBlur", void 0);
9126
+ ], ColorPaletteComponent.prototype, "cellSelection", void 0);
8960
9127
  __decorate([
8961
- Output(),
8962
- __metadata("design:type", EventEmitter)
8963
- ], ColorPickerComponent.prototype, "activeColorClick", void 0);
9128
+ HostBinding('attr.tabindex'),
9129
+ __metadata("design:type", Number),
9130
+ __metadata("design:paramtypes", [])
9131
+ ], ColorPaletteComponent.prototype, "hostTabindex", null);
8964
9132
  __decorate([
8965
- ViewChild('container', { read: ViewContainerRef, static: true }),
8966
- __metadata("design:type", ViewContainerRef)
8967
- ], ColorPickerComponent.prototype, "container", void 0);
9133
+ HostBinding('class.k-colorpalette'),
9134
+ __metadata("design:type", Boolean)
9135
+ ], ColorPaletteComponent.prototype, "hostClasses", void 0);
8968
9136
  __decorate([
8969
- ViewChild('wrapper', { static: true }),
8970
- __metadata("design:type", ElementRef)
8971
- ], 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);
8972
9142
  __decorate([
8973
- ViewChild('popupTemplate', { static: true }),
8974
- __metadata("design:type", TemplateRef)
8975
- ], ColorPickerComponent.prototype, "popupTemplate", void 0);
9143
+ HostBinding('attr.aria-readonly'),
9144
+ __metadata("design:type", Boolean),
9145
+ __metadata("design:paramtypes", [])
9146
+ ], ColorPaletteComponent.prototype, "readonlyAttribute", null);
8976
9147
  __decorate([
8977
- ViewChild('palette', { read: ElementRef, static: false }),
8978
- __metadata("design:type", ElementRef)
8979
- ], 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);
8980
9153
  __decorate([
8981
- ViewChild('colorGradient', { static: false }),
8982
- __metadata("design:type", ColorGradientComponent)
8983
- ], ColorPickerComponent.prototype, "colorGradient", void 0);
8984
- ColorPickerComponent = ColorPickerComponent_1 = __decorate([
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([
8985
9160
  Component({
8986
- selector: 'kendo-colorpicker',
8987
- providers: [{
9161
+ exportAs: 'kendoColorPalette',
9162
+ selector: 'kendo-colorpalette',
9163
+ providers: [
9164
+ {
8988
9165
  multi: true,
8989
9166
  provide: NG_VALUE_ACCESSOR,
8990
- useExisting: forwardRef(() => ColorPickerComponent_1)
9167
+ useExisting: forwardRef(() => ColorPaletteComponent_1) // tslint:disable-line:no-forward-ref
8991
9168
  }, {
8992
9169
  provide: KendoInput,
8993
- useExisting: forwardRef(() => ColorPickerComponent_1)
9170
+ useExisting: forwardRef(() => ColorPaletteComponent_1)
8994
9171
  },
8995
- ColorPickerLocalizationService,
9172
+ ColorPaletteService,
9173
+ ColorPaletteLocalizationService,
8996
9174
  {
8997
9175
  provide: LocalizationService,
8998
- useExisting: ColorPickerLocalizationService
9176
+ useExisting: ColorPaletteLocalizationService
8999
9177
  },
9000
9178
  {
9001
9179
  provide: L10N_PREFIX,
9002
- useValue: 'kendo.colorpicker'
9180
+ useValue: 'kendo.colorpalette'
9003
9181
  }
9004
9182
  ],
9005
9183
  template: `
9006
- <ng-container kendoColorPickerLocalizedMessages
9007
- i18n-colorGradient="kendo.colorpicker.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty."
9008
- colorGradientNoColor="Colorgradient no color chosen"
9009
- i18n-colorGradient="kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
9010
- colorPaletteNoColor="Colorpalette no color chosen"
9011
- i18n-colorGradientHandle="kendo.colorpicker.colorGradientHandle|The title for the gradient color drag handle chooser."
9012
- colorGradientHandle="Choose color"
9013
- i18n-clearButton="kendo.colorpicker.clearButton|The title for the clear button."
9014
- clearButton="Clear value"
9015
- i18n-hueSliderHandle="kendo.colorpicker.hueSliderHandle|The title for the hue slider handle."
9016
- hueSliderHandle="Set hue"
9017
- i18n-opacitySliderHandle="kendo.colorpicker.opacitySliderHandle|The title for the opacity slider handle."
9018
- opacitySliderHandle="Set opacity"
9019
- i18n-hexInputPlaceholder="kendo.colorpicker.hexInputPlaceholder|The placeholder for the HEX color input."
9020
- hexInputPlaceholder="HEX Color"
9021
- i18n-redInputPlaceholder="kendo.colorpicker.redInputPlaceholder|The placeholder for the red color input."
9022
- redInputPlaceholder="Red"
9023
- i18n-greenInputPlaceholder="kendo.colorpicker.greenInputPlaceholder|The placeholder for the green color input."
9024
- greenInputPlaceholder="Green"
9025
- i18n-blueInputPlaceholder="kendo.colorpicker.blueInputPlaceholder|The placeholder for the blue color input."
9026
- blueInputPlaceholder="Blue"
9027
- i18n-alphaInputPlaceholder="kendo.colorpicker.alphaInputPlaceholder|The placeholder for the alpha input."
9028
- 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">
9029
9187
  </ng-container>
9030
- <span
9031
- #wrapper
9032
- [ngClass]="{
9033
- 'k-picker-wrap': true,
9034
- 'k-state-disabled': this.disabled,
9035
- 'k-state-focused': this.isFocused
9036
- }"
9037
- role="listbox"
9038
- [attr.aria-expanded]="isOpen"
9039
- [attr.aria-readonly]="readonly"
9040
- [attr.aria-disabled]="disabled"
9041
- [attr.aria-label]="value"
9042
- [id]="focusableId"
9043
- [attr.tabindex]="tabindex"
9044
- (focus)="handleWrapperFocus()"
9045
- (blur)="handleWrapperBlur()"
9046
- (mousedown)="$event.preventDefault()"
9047
- (keydown)="handleWrapperKeyDown($event)"
9048
- >
9049
- <span *ngIf="!iconStyles" class="k-selected-color" [style.background-color]="value" (click)="handleActiveColorClick()">
9050
- <span class="k-icon k-i-line" *ngIf="!value"></span>
9051
- </span>
9052
- <span *ngIf="iconStyles" class="k-tool-icon" [ngClass]="iconStyles" (click)="handleActiveColorClick()">
9053
- <span class="k-selected-color" [style.background-color]="value"></span>
9054
- </span>
9055
- <span class="k-select" (click)="handleWrapperClick()">
9056
- <span class="k-icon k-i-arrow-s"></span>
9057
- </span>
9058
- </span>
9059
- <ng-template #popupTemplate>
9060
- <kendo-colorgradient #colorGradient
9061
- *ngIf="view === 'gradient' || view === 'combo'"
9062
- [value]="value"
9063
- [format]="format"
9064
- [opacity]="gradientSettings.opacity"
9065
- [clearButton]="gradientSettings.clearButton"
9066
- [delay]="gradientSettings.delay"
9067
- (focusout)="handlePopupBlur($event)"
9068
- (valueChange)="handleValueChange($event, false)"
9069
- (keydown)="handlePopupKeyDown($event)"
9070
- >
9071
- </kendo-colorgradient>
9072
- <kendo-colorpalette
9073
- #palette
9074
- *ngIf="view === 'palette' || view === 'combo'"
9075
- kendoFocusOnDomReady
9076
- [palette]="paletteSettings.palette"
9077
- [columns]="paletteSettings.columns"
9078
- [tileSize]="paletteSettings.tileSize"
9079
- [format]="format"
9080
- [value]="value"
9081
- (blur)="handlePopupBlur($event)"
9082
- (cellSelection)="handleValueChange($event, true)"
9083
- (mousedown)="$event.preventDefault()"
9084
- (keydown)="handlePopupKeyDown($event)"
9085
- >
9086
- </kendo-colorpalette>
9087
- </ng-template>
9088
- <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>
9089
9214
  `
9090
9215
  }),
9091
- __metadata("design:paramtypes", [PopupService,
9216
+ __metadata("design:paramtypes", [ElementRef,
9217
+ ColorPaletteService,
9092
9218
  ChangeDetectorRef,
9093
- LocalizationService,
9094
- NgZone])
9095
- ], ColorPickerComponent);
9219
+ Renderer2,
9220
+ LocalizationService])
9221
+ ], ColorPaletteComponent);
9096
9222
 
9097
9223
  /**
9098
9224
  * @hidden
9099
9225
  */
9100
- let ColorPaletteService = class ColorPaletteService {
9101
- /**
9102
- * @hidden
9103
- */
9104
- constructor() {
9105
- this.colorRows = [];
9106
- }
9107
- setColorMatrix(palette, columns) {
9108
- this.colorRows = [];
9109
- if (!(isPresent(palette) && palette.length)) {
9110
- return;
9111
- }
9112
- columns = columns || palette.length;
9113
- for (let start = 0; start < palette.length; start += columns) {
9114
- const row = palette.slice(start, columns + start);
9115
- this.colorRows.push(row);
9116
- }
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();
9117
9233
  }
9118
- getCellCoordsFor(color) {
9119
- if (!isPresent(color)) {
9120
- return;
9121
- }
9122
- for (let row = 0; row < this.colorRows.length; row++) {
9123
- for (let col = 0; col < this.colorRows[row].length; col++) {
9124
- if (this.colorRows[row][col] === color) {
9125
- return { row, col };
9126
- }
9127
- }
9128
- }
9234
+ onViewButtonClick(view) {
9235
+ this.activeView = view;
9236
+ this.viewChange.emit(view);
9129
9237
  }
9130
- getColorAt(cellCoords) {
9131
- if (!(isPresent(cellCoords) && isPresent(this.colorRows[cellCoords.row]))) {
9132
- return;
9133
- }
9134
- return this.colorRows[cellCoords.row][cellCoords.col];
9238
+ get viewButtons() {
9239
+ return this.views && this.views.indexOf('gradient') >= 0 && this.views.indexOf('palette') >= 0;
9135
9240
  }
9136
- getNextCell(current, horizontalStep, verticalStep) {
9137
- if (!(isPresent(current) && isPresent(current.row) && isPresent(current.col))) {
9138
- return { row: 0, col: 0 };
9139
- }
9140
- const row = this.clampIndex(current.row + verticalStep, this.colorRows.length - 1);
9141
- const col = this.clampIndex(current.col + horizontalStep, this.colorRows[row].length - 1);
9142
- return { row, col };
9241
+ getViewButtonIcon(view) {
9242
+ return view === 'gradient' ? 'k-i-color-canvas' : 'k-i-palette';
9143
9243
  }
9144
- clampIndex(index, max) {
9145
- const minArrayIndex = 0;
9146
- if (index < minArrayIndex) {
9147
- return minArrayIndex;
9148
- }
9149
- if (index > max) {
9150
- return max;
9151
- }
9152
- return index;
9244
+ getText(text) {
9245
+ return this.localizationService.get(text);
9153
9246
  }
9154
9247
  };
9155
- ColorPaletteService = __decorate([
9156
- Injectable()
9157
- ], 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);
9158
9346
 
9159
9347
  /**
9160
9348
  * @hidden
9161
9349
  */
9162
- let ColorPaletteLocalizationService = class ColorPaletteLocalizationService extends LocalizationService {
9163
- constructor(prefix, messageService, _rtl, colorPickerLocalization) {
9164
- super(prefix, messageService, _rtl);
9165
- this.colorPickerLocalization = colorPickerLocalization;
9350
+ let FlatColorPickerActionButtonsComponent = class FlatColorPickerActionButtonsComponent {
9351
+ constructor(localizationService) {
9352
+ this.localizationService = localizationService;
9353
+ this.hostClasses = true;
9354
+ this.actionButtonClick = new EventEmitter();
9166
9355
  }
9167
- get(shortKey) {
9168
- if (this.colorPickerLocalization) {
9169
- return this.colorPickerLocalization.get(shortKey);
9170
- }
9171
- 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);
9172
9365
  }
9173
9366
  };
9174
- ColorPaletteLocalizationService = __decorate([
9175
- __param(0, Inject(L10N_PREFIX)),
9176
- __param(1, Optional()),
9177
- __param(2, Optional()), __param(2, Inject(RTL)),
9178
- __param(3, Optional()), __param(3, Inject(ColorPickerLocalizationService)),
9179
- __metadata("design:paramtypes", [String, MessageService, Boolean, ColorPickerLocalizationService])
9180
- ], 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);
9181
9973
 
9182
- var ColorPaletteComponent_1;
9183
- const DEFAULT_TILE_SIZE = 24;
9184
- const DEFAULT_COLUMNS_COUNT = 10;
9185
- const DEFAULT_PRESET$1 = 'office';
9186
- const DEFAULT_ACCESSIBLE_PRESET$1 = 'accessible';
9974
+ var ColorPickerComponent_1;
9187
9975
  let serial$2 = 0;
9188
9976
  /**
9189
- * The ColorPalette component provides a set of predefined palette presets and enables you to implement a custom color palette.
9190
- * 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.
9191
9981
  */
9192
- let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponent {
9193
- constructor(host, service, cdr, renderer, localizationService) {
9194
- this.host = host;
9195
- this.service = service;
9982
+ let ColorPickerComponent = ColorPickerComponent_1 = class ColorPickerComponent {
9983
+ constructor(popupService, cdr, localizationService, ngZone) {
9984
+ this.popupService = popupService;
9196
9985
  this.cdr = cdr;
9197
- this.renderer = renderer;
9198
9986
  this.localizationService = localizationService;
9987
+ this.ngZone = ngZone;
9988
+ this.hostClasses = true;
9199
9989
  /**
9200
9990
  * @hidden
9201
9991
  */
9202
- this.id = `k-colorpalette-${serial$2++}`;
9992
+ this.focusableId = `k-colorpicker-${serial$2++}`;
9203
9993
  /**
9204
- * Specifies the output format of the ColorPaletteComponent.
9205
- * The input value may be in a different format. However, it will be parsed into the output `format`
9206
- * 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.
9207
10000
  *
9208
- * The supported values are:
9209
- * * (Default) `hex`
9210
- * * `rgba`
9211
- * * `name`
10001
+ * @default false
9212
10002
  */
9213
- this.format = 'hex';
10003
+ this.readonly = false;
9214
10004
  /**
9215
- * Sets the disabled state of the ColorPalette.
10005
+ * Sets the disabled state of the ColorPicker.
10006
+ *
10007
+ * @default false
9216
10008
  */
9217
10009
  this.disabled = false;
9218
10010
  /**
9219
- * 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`
9220
10018
  */
9221
- this.readonly = false;
10019
+ this.format = 'rgba';
9222
10020
  /**
9223
- * Specifies the size of a color cell.
10021
+ * Specifies whether the ColorPicker should display a 'Clear color' button.
9224
10022
  *
9225
- * The possible values are:
9226
- * * (Default) `tileSize = 24`
9227
- * * `{ width: number, height: number }`
10023
+ * @default true
9228
10024
  */
9229
- this.tileSize = { width: DEFAULT_TILE_SIZE, height: DEFAULT_TILE_SIZE };
10025
+ this.clearButton = true;
9230
10026
  /**
9231
- * 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
9232
10036
  */
9233
- 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';
9234
10048
  /**
9235
10049
  * Fires each time the value is changed.
9236
10050
  */
9237
10051
  this.valueChange = new EventEmitter();
9238
10052
  /**
9239
- * 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.
9240
10072
  *
9241
- * @hidden
10073
+ * Fires on preview pane or 'Cancel' button click.
9242
10074
  */
9243
- this.cellSelection = new EventEmitter();
10075
+ this.cancel = new EventEmitter();
9244
10076
  /**
9245
- * @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.
9246
10081
  */
9247
- 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();
9248
10088
  this._tabindex = 0;
10089
+ this._popupSettings = { animate: true };
10090
+ this._paletteSettings = {};
10091
+ this._gradientSettings = { opacity: true, delay: 0 };
9249
10092
  this.notifyNgTouched = () => { };
9250
10093
  this.notifyNgChanged = () => { };
9251
- this.dynamicRTLSubscription = localizationService.changes.subscribe(({ rtl }) => {
10094
+ validatePackage(packageMetadata);
10095
+ this.dynamicRTLSubscription = this.localizationService.changes.subscribe(({ rtl }) => {
9252
10096
  this.direction = rtl ? 'rtl' : 'ltr';
9253
10097
  });
9254
10098
  }
9255
- /**
9256
- * @hidden
9257
- */
9258
- get paletteId() {
9259
- return this.id;
9260
- }
9261
10099
  /**
9262
10100
  * Specifies the value of the initially selected color.
9263
10101
  */
9264
10102
  set value(value) {
9265
- this._value = parseColor$1(value, this.format);
10103
+ this._value = parseColor$1(value, this.format, this.gradientSettings.opacity);
9266
10104
  }
9267
10105
  get value() {
9268
10106
  return this._value;
9269
10107
  }
9270
10108
  /**
9271
- * Specifies the number of columns that will be displayed.
9272
- * Defaults to `10`.
10109
+ * Configures the popup of the ColorPicker.
9273
10110
  */
9274
- set columns(value) {
9275
- const minColumnsCount = 1;
9276
- this._columns = value > minColumnsCount ? value : minColumnsCount;
10111
+ set popupSettings(value) {
10112
+ this._popupSettings = Object.assign(this._popupSettings, value);
9277
10113
  }
9278
- get columns() {
9279
- return this._columns;
10114
+ get popupSettings() {
10115
+ return this._popupSettings;
9280
10116
  }
9281
10117
  /**
9282
- * The color palette that will be displayed.
9283
- *
9284
- * The supported values are:
9285
- * * The name of the predefined palette preset (for example, `office`, `basic`, and `apex`).
9286
- * * A string with comma-separated colors.
9287
- * * A string array.
10118
+ * Configures the palette that is displayed in the ColorPicker popup.
9288
10119
  */
9289
- set palette(value) {
9290
- if (!isPresent(value)) {
9291
- value = DEFAULT_PRESET$1;
9292
- }
9293
- if (typeof value === 'string' && isPresent(PALETTEPRESETS[value])) {
9294
- this.columns = this.columns || PALETTEPRESETS[value].columns;
9295
- value = PALETTEPRESETS[value].colors;
9296
- }
9297
- const colors = (typeof value === 'string') ? value.split(',') : value;
9298
- this._palette = colors.map(color => parseColor$1(color, this.format, false));
10120
+ set paletteSettings(value) {
10121
+ this._paletteSettings = Object.assign(this._paletteSettings, value);
9299
10122
  }
9300
- get palette() {
9301
- 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;
9302
10134
  }
9303
10135
  /**
9304
10136
  * Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
10137
+ *
10138
+ * @default 0
9305
10139
  */
9306
10140
  set tabindex(value) {
9307
10141
  const tabindex = Number(value);
@@ -9311,122 +10145,171 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
9311
10145
  get tabindex() {
9312
10146
  return !this.disabled ? this._tabindex : undefined;
9313
10147
  }
10148
+ /**
10149
+ * Indicates whether the ColorPicker popup is open.
10150
+ */
10151
+ get isOpen() {
10152
+ return isPresent(this.popupRef);
10153
+ }
9314
10154
  /**
9315
10155
  * @hidden
9316
10156
  */
9317
- get tileLayout() {
9318
- if (typeof this.tileSize !== 'number') {
9319
- 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();
9320
10190
  }
9321
- return { width: this.tileSize, height: this.tileSize };
9322
10191
  }
9323
10192
  /**
9324
10193
  * @hidden
9325
10194
  */
9326
- get colorRows() {
9327
- 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();
9328
10230
  }
9329
10231
  /**
9330
10232
  * @hidden
9331
10233
  */
9332
- get hostTabindex() { return this.tabindex; }
10234
+ handleWrapperFocus() {
10235
+ if (this.isFocused) {
10236
+ return;
10237
+ }
10238
+ this.isFocused = true;
10239
+ this.onFocus.emit();
10240
+ }
9333
10241
  /**
9334
- * @hidden
10242
+ * Blurs the ColorPicker.
9335
10243
  */
9336
- get disabledClass() { return this.disabled; }
10244
+ blur() {
10245
+ this.wrapper.nativeElement.blur();
10246
+ }
9337
10247
  /**
9338
10248
  * @hidden
9339
10249
  */
9340
- get readonlyAttribute() { return this.readonly; }
9341
- ngOnInit() {
9342
- if (this.colorRows.length === 0) {
9343
- const defaultPreset = (this.format !== 'name') ? DEFAULT_PRESET$1 : DEFAULT_ACCESSIBLE_PRESET$1;
9344
- this.palette = this.palette || defaultPreset;
9345
- this.setRows();
9346
- this.focusedCell = this.service.getCellCoordsFor(this.value);
9347
- }
9348
- }
9349
- ngAfterViewInit() {
9350
- this.setHostElementAriaLabel();
9351
- }
9352
- ngOnDestroy() {
9353
- if (this.dynamicRTLSubscription) {
9354
- this.dynamicRTLSubscription.unsubscribe();
9355
- }
9356
- }
9357
- ngOnChanges(changes) {
9358
- if (changes.palette || changes.columns) {
9359
- this.setRows();
9360
- }
9361
- if (changes.palette || changes.value || changes.columns) {
9362
- this.focusedCell = this.service.getCellCoordsFor(this.value);
9363
- this.setHostElementAriaLabel();
10250
+ handleWrapperBlur() {
10251
+ if (this.isOpen) {
10252
+ return;
9364
10253
  }
10254
+ this.isFocused = false;
10255
+ this.onBlur.emit();
10256
+ this.notifyNgTouched();
9365
10257
  }
9366
10258
  /**
9367
- * @hidden
10259
+ * Clears the value of the ColorPicker.
9368
10260
  */
9369
- handleKeydown(event) {
9370
- const isRTL = this.direction === 'rtl';
9371
- switch (event.keyCode) {
9372
- case Keys.ArrowDown:
9373
- this.handleCellNavigation(0, 1);
9374
- break;
9375
- case Keys.ArrowUp:
9376
- this.handleCellNavigation(0, -1);
9377
- break;
9378
- case Keys.ArrowRight:
9379
- this.handleCellNavigation(isRTL ? -1 : 1, 0);
9380
- break;
9381
- case Keys.ArrowLeft:
9382
- this.handleCellNavigation(isRTL ? 1 : -1, 0);
9383
- break;
9384
- case Keys.Enter:
9385
- this.handleEnter();
9386
- break;
9387
- default: return;
10261
+ reset() {
10262
+ if (!isPresent(this.value)) {
10263
+ return;
9388
10264
  }
9389
- event.preventDefault();
10265
+ this._value = undefined;
10266
+ this.notifyNgChanged(undefined);
9390
10267
  }
9391
10268
  /**
9392
- * @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.
9393
10273
  */
9394
- handleHostBlur() {
9395
- this.notifyNgTouched();
9396
- 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
+ }
9397
10283
  }
9398
10284
  /**
9399
10285
  * @hidden
9400
10286
  */
9401
- handleCellSelection(value, cell) {
9402
- if (this.readonly) {
9403
- return;
9404
- }
9405
- this.selectedCell = cell;
9406
- this.focusedCell = this.selectedCell;
9407
- this.focusInComponent = true;
9408
- const parsedColor = parseColor$1(value, this.format, false);
9409
- this.cellSelection.emit(parsedColor);
9410
- 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) {
9411
10291
  this.value = parsedColor;
9412
10292
  this.valueChange.emit(parsedColor);
9413
10293
  this.notifyNgChanged(parsedColor);
9414
- this.setHostElementAriaLabel();
9415
- }
9416
- if (this.selection !== parsedColor) {
9417
- this.selection = parsedColor;
9418
- this.selectionChange.emit(parsedColor);
9419
10294
  }
9420
- if (cell) {
9421
- this.activeCellId = `${this.selectedCell.row}-${this.selectedCell.col}`;
10295
+ }
10296
+ /**
10297
+ * @hidden
10298
+ */
10299
+ handlePopupBlur(event) {
10300
+ if (this.popupBlurInvalid(event)) {
10301
+ return;
9422
10302
  }
10303
+ this.isFocused = false;
10304
+ this.onBlur.emit();
10305
+ this.notifyNgTouched();
10306
+ this.toggleWithEvents(false);
9423
10307
  }
9424
10308
  /**
9425
10309
  * @hidden
9426
10310
  */
9427
10311
  writeValue(value) {
9428
10312
  this.value = value;
9429
- this.focusedCell = this.service.getCellCoordsFor(this.value);
9430
10313
  }
9431
10314
  /**
9432
10315
  * @hidden
@@ -9449,206 +10332,357 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
9449
10332
  }
9450
10333
  /**
9451
10334
  * @hidden
9452
- * Used by the TextBoxContainer to determine if the component is empty.
9453
10335
  */
9454
- isEmpty() {
9455
- return false;
10336
+ handleWrapperKeyDown(event) {
10337
+ if (event.keyCode === Keys.ArrowDown || event.keyCode === Keys.Enter) {
10338
+ event.preventDefault();
10339
+ this.toggleWithEvents(true);
10340
+ }
9456
10341
  }
9457
10342
  /**
9458
- * Clears the color value of the ColorPalette.
10343
+ * @hidden
9459
10344
  */
9460
- reset() {
9461
- this.focusedCell = null;
9462
- if (isPresent(this.value)) {
9463
- this._value = undefined;
9464
- 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
+ }
9465
10357
  }
9466
10358
  }
9467
- handleCellFocusOnBlur() {
9468
- this.focusInComponent = false;
9469
- 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;
9470
10365
  }
9471
- setRows() {
9472
- 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) {
9473
10374
  return;
9474
10375
  }
9475
- this.columns = this.columns || DEFAULT_COLUMNS_COUNT;
9476
- 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
+ }
9477
10391
  }
9478
- handleCellNavigation(horizontalStep, verticalStep) {
9479
- 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) {
9480
10426
  return;
9481
10427
  }
9482
- this.focusedCell = this.service.getNextCell(this.focusedCell, horizontalStep, verticalStep);
9483
- this.focusInComponent = true;
10428
+ this.popupRef.close();
10429
+ this.popupRef = null;
9484
10430
  }
9485
- setHostElementAriaLabel() {
9486
- const parsed = parseColor$1(this.value, this.format);
9487
- 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;
9488
10436
  }
9489
- handleEnter() {
9490
- if (!isPresent(this.focusedCell)) {
9491
- return;
10437
+ get lastFocusableElement() {
10438
+ if (this.preview) {
10439
+ return this.flatColorPicker.footer.lastButton;
9492
10440
  }
9493
- const selectedColor = this.service.getColorAt(this.focusedCell);
9494
- 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;
9495
10445
  }
9496
10446
  };
10447
+ __decorate([
10448
+ HostBinding('class.k-colorpicker'),
10449
+ __metadata("design:type", Boolean)
10450
+ ], ColorPickerComponent.prototype, "hostClasses", void 0);
9497
10451
  __decorate([
9498
10452
  HostBinding('attr.dir'),
9499
10453
  __metadata("design:type", String)
9500
- ], ColorPaletteComponent.prototype, "direction", void 0);
10454
+ ], ColorPickerComponent.prototype, "direction", void 0);
9501
10455
  __decorate([
9502
- HostBinding('attr.id'),
9503
- __metadata("design:type", String),
9504
- __metadata("design:paramtypes", [])
9505
- ], 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);
9506
10463
  __decorate([
9507
10464
  Input(),
9508
10465
  __metadata("design:type", String)
9509
- ], 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);
9510
10475
  __decorate([
9511
10476
  Input(),
9512
10477
  __metadata("design:type", String)
9513
- ], ColorPaletteComponent.prototype, "format", void 0);
10478
+ ], ColorPickerComponent.prototype, "format", void 0);
9514
10479
  __decorate([
9515
10480
  Input(),
9516
10481
  __metadata("design:type", String),
9517
10482
  __metadata("design:paramtypes", [String])
9518
- ], ColorPaletteComponent.prototype, "value", null);
10483
+ ], ColorPickerComponent.prototype, "value", null);
9519
10484
  __decorate([
9520
10485
  Input(),
9521
- __metadata("design:type", Number),
9522
- __metadata("design:paramtypes", [Number])
9523
- ], 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);
9524
10507
  __decorate([
9525
10508
  Input(),
9526
- __metadata("design:type", Object),
9527
- __metadata("design:paramtypes", [Object])
9528
- ], ColorPaletteComponent.prototype, "palette", null);
10509
+ __metadata("design:type", Boolean)
10510
+ ], ColorPickerComponent.prototype, "clearButton", void 0);
9529
10511
  __decorate([
9530
10512
  Input(),
9531
10513
  __metadata("design:type", Number),
9532
10514
  __metadata("design:paramtypes", [Number])
9533
- ], ColorPaletteComponent.prototype, "tabindex", null);
10515
+ ], ColorPickerComponent.prototype, "tabindex", null);
9534
10516
  __decorate([
9535
10517
  Input(),
9536
10518
  __metadata("design:type", Boolean)
9537
- ], ColorPaletteComponent.prototype, "disabled", void 0);
10519
+ ], ColorPickerComponent.prototype, "preview", void 0);
9538
10520
  __decorate([
9539
10521
  Input(),
9540
- __metadata("design:type", Boolean)
9541
- ], ColorPaletteComponent.prototype, "readonly", void 0);
10522
+ __metadata("design:type", String)
10523
+ ], ColorPickerComponent.prototype, "actionsLayout", void 0);
9542
10524
  __decorate([
9543
- Input(),
9544
- __metadata("design:type", Object)
9545
- ], ColorPaletteComponent.prototype, "tileSize", void 0);
10525
+ Output(),
10526
+ __metadata("design:type", EventEmitter)
10527
+ ], ColorPickerComponent.prototype, "valueChange", void 0);
9546
10528
  __decorate([
9547
10529
  Output(),
9548
10530
  __metadata("design:type", EventEmitter)
9549
- ], ColorPaletteComponent.prototype, "selectionChange", void 0);
10531
+ ], ColorPickerComponent.prototype, "open", void 0);
9550
10532
  __decorate([
9551
10533
  Output(),
9552
10534
  __metadata("design:type", EventEmitter)
9553
- ], 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);
9554
10544
  __decorate([
9555
10545
  Output(),
9556
10546
  __metadata("design:type", EventEmitter)
9557
- ], ColorPaletteComponent.prototype, "cellSelection", void 0);
10547
+ ], ColorPickerComponent.prototype, "cancel", void 0);
9558
10548
  __decorate([
9559
- HostBinding('attr.tabindex'),
9560
- __metadata("design:type", Number),
9561
- __metadata("design:paramtypes", [])
9562
- ], ColorPaletteComponent.prototype, "hostTabindex", null);
10549
+ Output(),
10550
+ __metadata("design:type", EventEmitter)
10551
+ ], ColorPickerComponent.prototype, "activeColorClick", void 0);
9563
10552
  __decorate([
9564
- HostBinding('class.k-colorpalette'),
9565
- __metadata("design:type", Boolean)
9566
- ], ColorPaletteComponent.prototype, "hostClasses", void 0);
10553
+ Output(),
10554
+ __metadata("design:type", EventEmitter)
10555
+ ], ColorPickerComponent.prototype, "activeViewChange", void 0);
9567
10556
  __decorate([
9568
- HostBinding('attr.aria-disabled'),
9569
- HostBinding('class.k-state-disabled'),
9570
- __metadata("design:type", Boolean),
9571
- __metadata("design:paramtypes", [])
9572
- ], ColorPaletteComponent.prototype, "disabledClass", null);
10557
+ ViewChild('container', { read: ViewContainerRef, static: true }),
10558
+ __metadata("design:type", ViewContainerRef)
10559
+ ], ColorPickerComponent.prototype, "container", void 0);
9573
10560
  __decorate([
9574
- HostBinding('attr.aria-readonly'),
9575
- __metadata("design:type", Boolean),
9576
- __metadata("design:paramtypes", [])
9577
- ], ColorPaletteComponent.prototype, "readonlyAttribute", null);
10561
+ ViewChild('wrapper', { static: true }),
10562
+ __metadata("design:type", ElementRef)
10563
+ ], ColorPickerComponent.prototype, "wrapper", void 0);
9578
10564
  __decorate([
9579
- HostListener('keydown', ['$event']),
9580
- __metadata("design:type", Function),
9581
- __metadata("design:paramtypes", [Object]),
9582
- __metadata("design:returntype", void 0)
9583
- ], ColorPaletteComponent.prototype, "handleKeydown", null);
10565
+ ViewChild('popupTemplate', { static: true }),
10566
+ __metadata("design:type", TemplateRef)
10567
+ ], ColorPickerComponent.prototype, "popupTemplate", void 0);
9584
10568
  __decorate([
9585
- HostListener('blur'),
9586
- __metadata("design:type", Function),
9587
- __metadata("design:paramtypes", []),
9588
- __metadata("design:returntype", void 0)
9589
- ], ColorPaletteComponent.prototype, "handleHostBlur", null);
9590
- 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([
9591
10573
  Component({
9592
- selector: 'kendo-colorpalette',
9593
- providers: [
9594
- {
10574
+ exportAs: 'kendoColorPicker',
10575
+ selector: 'kendo-colorpicker',
10576
+ providers: [{
9595
10577
  multi: true,
9596
10578
  provide: NG_VALUE_ACCESSOR,
9597
- useExisting: forwardRef(() => ColorPaletteComponent_1) // tslint:disable-line:no-forward-ref
10579
+ useExisting: forwardRef(() => ColorPickerComponent_1)
9598
10580
  }, {
9599
10581
  provide: KendoInput,
9600
- useExisting: forwardRef(() => ColorPaletteComponent_1)
10582
+ useExisting: forwardRef(() => ColorPickerComponent_1)
9601
10583
  },
9602
- ColorPaletteService,
9603
- ColorPaletteLocalizationService,
10584
+ ColorPickerLocalizationService,
9604
10585
  {
9605
10586
  provide: LocalizationService,
9606
- useExisting: ColorPaletteLocalizationService
10587
+ useExisting: ColorPickerLocalizationService
9607
10588
  },
9608
10589
  {
9609
10590
  provide: L10N_PREFIX,
9610
- useValue: 'kendo.colorpalette'
10591
+ useValue: 'kendo.colorpicker'
9611
10592
  }
9612
10593
  ],
9613
10594
  template: `
9614
- <ng-container kendoColorPaletteLocalizedMessages
9615
- i18n-colorPaletteNoColor="kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty."
9616
- 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">
9617
10628
  </ng-container>
9618
- <div role="listbox" class="k-colorpalette-table-wrap"
9619
- [attr.aria-activedescendant]="activeCellId">
9620
- <table class="k-colorpalette-table k-palette">
9621
- <tbody>
9622
- <tr *ngFor="let row of colorRows; let rowIndex = index">
9623
- <td *ngFor="let color of row; let colIndex = index"
9624
- role="option"
9625
- [class.k-state-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
9626
- [class.k-state-focus]="focusInComponent && focusedCell?.row === rowIndex && focusedCell?.col === colIndex"
9627
- [attr.aria-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
9628
- [attr.aria-label]="color"
9629
- class="k-colorpalette-tile"
9630
- [id]="rowIndex + '-' + colIndex"
9631
- [attr.value]="color"
9632
- (click)="handleCellSelection(color, { row: rowIndex, col: colIndex })"
9633
- [ngStyle]="{
9634
- backgroundColor: color,
9635
- width: tileLayout.width + 'px',
9636
- height: tileLayout.height + 'px',
9637
- minWidth: tileLayout.width + 'px'
9638
- }">
9639
- </td>
9640
- </tr>
9641
- </tbody>
9642
- </table>
9643
- </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>
9644
10679
  `
9645
10680
  }),
9646
- __metadata("design:paramtypes", [ElementRef,
9647
- ColorPaletteService,
10681
+ __metadata("design:paramtypes", [PopupService,
9648
10682
  ChangeDetectorRef,
9649
- Renderer2,
9650
- LocalizationService])
9651
- ], ColorPaletteComponent);
10683
+ LocalizationService,
10684
+ NgZone])
10685
+ ], ColorPickerComponent);
9652
10686
 
9653
10687
  /**
9654
10688
  * @hidden
@@ -9663,6 +10697,14 @@ __decorate([
9663
10697
  Input(),
9664
10698
  __metadata("design:type", String)
9665
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);
9666
10708
  __decorate([
9667
10709
  Input(),
9668
10710
  __metadata("design:type", String)
@@ -9711,6 +10753,34 @@ __decorate([
9711
10753
  Input(),
9712
10754
  __metadata("design:type", String)
9713
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);
9714
10784
 
9715
10785
  var ColorPickerCustomMessagesComponent_1;
9716
10786
  /**
@@ -9733,7 +10803,7 @@ ColorPickerCustomMessagesComponent = ColorPickerCustomMessagesComponent_1 = __de
9733
10803
  useExisting: forwardRef(() => ColorPickerCustomMessagesComponent_1) // tslint:disable-line:no-forward-ref
9734
10804
  }
9735
10805
  ],
9736
- selector: 'kendo-colorpicker-messages, kendo-colorgradient-messages, kendo-colorpalette-messages',
10806
+ selector: 'kendo-colorpicker-messages, kendo-flatcolorpicker-messages, kendo-colorgradient-messages, kendo-colorpalette-messages',
9737
10807
  template: ``
9738
10808
  }),
9739
10809
  __metadata("design:paramtypes", [LocalizationService])
@@ -9757,7 +10827,7 @@ LocalizedColorPickerMessagesDirective = LocalizedColorPickerMessagesDirective_1
9757
10827
  useExisting: forwardRef(() => LocalizedColorPickerMessagesDirective_1) // tslint:disable-line:no-forward-ref
9758
10828
  }
9759
10829
  ],
9760
- selector: '[kendoColorPickerLocalizedMessages], [kendoColorGradientLocalizedMessages], [kendoColorPaletteLocalizedMessages]'
10830
+ selector: '[kendoColorPickerLocalizedMessages], [kendoFlatColorPickerLocalizedMessages], [kendoColorGradientLocalizedMessages], [kendoColorPaletteLocalizedMessages]'
9761
10831
  }),
9762
10832
  __metadata("design:paramtypes", [LocalizationService])
9763
10833
  ], LocalizedColorPickerMessagesDirective);
@@ -9799,34 +10869,37 @@ let ContrastValidationComponent = class ContrastValidationComponent {
9799
10869
  return this.localization.get('failContrast');
9800
10870
  }
9801
10871
  get contrastText() {
9802
- return `${this.type}: ${this.ratio.toFixed(1)}`;
10872
+ let ratio = this.type === 'AA' ? AA_RATIO : AAA_RATIO;
10873
+ return `${this.type}: ${ratio.toFixed(1)}`;
9803
10874
  }
9804
10875
  };
9805
10876
  __decorate([
9806
10877
  Input(),
9807
10878
  __metadata("design:type", String)
9808
10879
  ], ContrastValidationComponent.prototype, "type", void 0);
9809
- __decorate([
9810
- Input(),
9811
- __metadata("design:type", Number)
9812
- ], ContrastValidationComponent.prototype, "ratio", void 0);
9813
10880
  __decorate([
9814
10881
  Input(),
9815
10882
  __metadata("design:type", Boolean)
9816
10883
  ], ContrastValidationComponent.prototype, "pass", void 0);
10884
+ __decorate([
10885
+ Input(),
10886
+ __metadata("design:type", String)
10887
+ ], ContrastValidationComponent.prototype, "value", void 0);
9817
10888
  ContrastValidationComponent = __decorate([
9818
10889
  Component({
9819
10890
  selector: '[kendoContrastValidation]',
9820
10891
  template: `
9821
10892
  <span>{{contrastText}}</span>
9822
- <span class="k-contrast-validation k-text-success" *ngIf="pass">
9823
- {{passMessage}}
9824
- <span class="k-icon k-i-check"></span>
9825
- </span>
9826
- <span class="k-contrast-validation k-text-error" *ngIf="!pass">
9827
- {{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}}
9828
10900
  <span class="k-icon k-i-close"></span>
9829
- </span>
10901
+ </span>
10902
+ </ng-container>
9830
10903
  `
9831
10904
  }),
9832
10905
  __metadata("design:paramtypes", [LocalizationService])
@@ -9838,20 +10911,18 @@ ContrastValidationComponent = __decorate([
9838
10911
  let ContrastComponent = class ContrastComponent {
9839
10912
  constructor(localization) {
9840
10913
  this.localization = localization;
9841
- this.aaRatio = AA_RATIO;
9842
- this.aaaRatio = AAA_RATIO;
9843
10914
  }
9844
10915
  get formatedRatio() {
9845
10916
  return this.contrastRatio.toFixed(2);
9846
10917
  }
9847
- get contrastRatioMessage() {
9848
- return this.localization.get('contrastRatio');
10918
+ get contrastRatioText() {
10919
+ return `${this.localization.get('contrastRatio')}: ${this.value ? this.formatedRatio : 'n/a'}`;
9849
10920
  }
9850
10921
  get satisfiesAACondition() {
9851
- return this.contrastRatio >= this.aaRatio;
10922
+ return this.contrastRatio >= AA_RATIO;
9852
10923
  }
9853
10924
  get satisfiesAAACondition() {
9854
- return this.contrastRatio >= this.aaaRatio;
10925
+ return this.contrastRatio >= AAA_RATIO;
9855
10926
  }
9856
10927
  get contrastRatio() {
9857
10928
  let contrast = getContrastFromTwoRGBAs(getRGBA(this.value), getRGBA(this.ratio));
@@ -9871,23 +10942,25 @@ ContrastComponent = __decorate([
9871
10942
  selector: '[kendoContrastTool]',
9872
10943
  template: `
9873
10944
  <div class="k-contrast-ratio">
9874
- <span class="k-contrast-ratio-text">{{contrastRatioMessage}}: {{formatedRatio}}</span>
9875
- <span class="k-contrast-validation k-text-success" *ngIf="satisfiesAACondition">
9876
- <span class="k-icon k-i-check"></span>
9877
- <span class="k-icon k-i-check" *ngIf="satisfiesAAACondition"></span>
9878
- </span>
9879
- <span class="k-contrast-validation k-text-error" *ngIf="!satisfiesAACondition">
9880
- <span class="k-icon k-i-close"></span>
9881
- </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>
9882
10955
  </div>
9883
10956
  <div kendoContrastValidation
9884
10957
  type="AA"
9885
- [ratio]="aaaRatio"
10958
+ [value]="value"
9886
10959
  [pass]="satisfiesAACondition">
9887
10960
  </div>
9888
10961
  <div kendoContrastValidation
9889
10962
  type="AAA"
9890
- [ratio]="aaaRatio"
10963
+ [value]="value"
9891
10964
  [pass]="satisfiesAAACondition">
9892
10965
  </div>
9893
10966
  `
@@ -9895,10 +10968,98 @@ ContrastComponent = __decorate([
9895
10968
  __metadata("design:paramtypes", [LocalizationService])
9896
10969
  ], ContrastComponent);
9897
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
+
9898
11058
  const PUBLIC_DIRECTIVES = [
9899
11059
  ColorPickerComponent,
9900
11060
  ColorPaletteComponent,
9901
11061
  ColorGradientComponent,
11062
+ FlatColorPickerComponent,
9902
11063
  LocalizedColorPickerMessagesDirective,
9903
11064
  ColorPickerCustomMessagesComponent
9904
11065
  ];
@@ -9906,7 +11067,10 @@ const INTERNAL_DIRECTIVES = [
9906
11067
  ColorInputComponent,
9907
11068
  FocusOnDomReadyDirective,
9908
11069
  ContrastComponent,
9909
- ContrastValidationComponent
11070
+ ContrastValidationComponent,
11071
+ FlatColorPickerHeaderComponent,
11072
+ FlatColorPickerActionButtonsComponent,
11073
+ ColorContrastSvgComponent
9910
11074
  ];
9911
11075
  /**
9912
11076
  * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
@@ -10573,4 +11737,4 @@ InputsModule = __decorate([
10573
11737
  * Generated bundle index. Do not edit.
10574
11738
  */
10575
11739
 
10576
- 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 };