@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
@@ -7,23 +7,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  var tslib_1 = require("tslib");
8
8
  var core_1 = require("@angular/core");
9
9
  var forms_1 = require("@angular/forms");
10
+ var flatcolorpicker_component_1 = require("./flatcolorpicker.component");
10
11
  var kendo_angular_popup_1 = require("@progress/kendo-angular-popup");
11
12
  var kendo_licensing_1 = require("@progress/kendo-licensing");
12
- var package_metadata_1 = require("../package-metadata");
13
- var models_1 = require("./models");
14
- var color_parser_1 = require("./utils/color-parser");
15
- var utils_1 = require("../common/utils");
16
13
  var kendo_angular_common_1 = require("@progress/kendo-angular-common");
17
14
  var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
18
- var palette_presets_1 = require("./utils/palette-presets");
15
+ var package_metadata_1 = require("../package-metadata");
16
+ var models_1 = require("./models");
17
+ var events_1 = require("./events");
18
+ var utils_1 = require("./utils");
19
+ var utils_2 = require("../common/utils");
19
20
  var colorpicker_localization_service_1 = require("./localization/colorpicker-localization.service");
20
- var color_gradient_component_1 = require("./color-gradient.component");
21
- var DEFAULT_PRESET = 'office';
22
- var DEFAULT_ACCESSIBLE_PRESET = 'accessible';
21
+ var constants_1 = require("./constants");
23
22
  var serial = 0;
24
23
  /**
25
24
  * Represents the [Kendo UI ColorPicker component for Angular]({% slug overview_colorpicker %}).
26
- * Designed to replace the `<input type="color">` HTML5 tag which is not widely supported in browsers.
25
+ *
26
+ * The ColorPicker is a powerful tool for choosing colors from Gradient and Palette views
27
+ * which are rendered in its popup. It supports previewing the selected color, reverting it to its previous state or clearing it completely.
27
28
  */
28
29
  var ColorPickerComponent = /** @class */ (function () {
29
30
  function ColorPickerComponent(popupService, cdr, localizationService, ngZone) {
@@ -32,39 +33,66 @@ var ColorPickerComponent = /** @class */ (function () {
32
33
  this.cdr = cdr;
33
34
  this.localizationService = localizationService;
34
35
  this.ngZone = ngZone;
35
- /**
36
- * @hidden
37
- */
38
36
  this.hostClasses = true;
39
37
  /**
40
38
  * @hidden
41
39
  */
42
40
  this.focusableId = "k-colorpicker-" + serial++;
43
41
  /**
44
- * Sets what view the ColorPicker will render in the popup.
42
+ * Specifies the views that will be rendered in the popup.
43
+ * By default both the gradient and palette views will be rendered.
45
44
  */
46
- this.view = 'gradient';
45
+ this.views = ['gradient', 'palette'];
47
46
  /**
48
47
  * Sets the read-only state of the ColorPicker.
48
+ *
49
+ * @default false
49
50
  */
50
51
  this.readonly = false;
51
52
  /**
52
53
  * Sets the disabled state of the ColorPicker.
54
+ *
55
+ * @default false
53
56
  */
54
57
  this.disabled = false;
55
58
  /**
56
59
  * Specifies the output format of the ColorPicker.
57
- * The input value may be in a different format. However, it will be parsed into the output `format`
58
- * after the component processes it.
59
60
  *
60
- * If the `gradient` view is used with the `opacity` option set to true, this setting will be ignored and `rgba` will be used instead.
61
+ * If the input value is in a different format, it will be parsed into the specified output `format`.
61
62
  *
62
63
  * The supported values are:
63
64
  * * `rgba` (default)
64
65
  * * `hex`
65
- * * [name](https://www.w3.org/wiki/CSS/Properties/color/keywords)
66
66
  */
67
67
  this.format = 'rgba';
68
+ /**
69
+ * Specifies whether the ColorPicker should display a 'Clear color' button.
70
+ *
71
+ * @default true
72
+ */
73
+ this.clearButton = true;
74
+ /**
75
+ * Displays `Apply` and `Cancel` action buttons and color preview panes.
76
+ *
77
+ * When enabled, the component value will not change immediately upon
78
+ * color selection, but only after the `Apply` button is clicked.
79
+ *
80
+ * The `Cancel` button reverts the current selection to its
81
+ * previous state i.e. to the current value.
82
+ *
83
+ * @default false
84
+ */
85
+ this.preview = false;
86
+ /**
87
+ * Configures the layout of the `Apply` and `Cancel` action buttons.
88
+ *
89
+ * The possible values are:
90
+ * * `start`
91
+ * * `center`
92
+ * * `end` (default)
93
+ * * `stretch`
94
+ */
95
+ this.actionsLayout = 'end';
68
96
  /**
69
97
  * Fires each time the value is changed.
70
98
  */
@@ -87,6 +115,12 @@ var ColorPickerComponent = /** @class */ (function () {
87
115
  * Fires each time the ColorPicker is blurred.
88
116
  */
89
117
  this.onBlur = new core_1.EventEmitter();
118
+ /**
119
+ * Fires when the user cancels the current color selection.
120
+ *
121
+ * Fires on preview pane or 'Cancel' button click.
122
+ */
123
+ this.cancel = new core_1.EventEmitter();
90
124
  /**
91
125
  * Fires each time the left side of the ColorPicker wrapper is clicked.
92
126
  * The event is triggered regardless of whether a ColorPicker icon is set or not.
@@ -94,10 +128,15 @@ var ColorPickerComponent = /** @class */ (function () {
94
128
  * The [ActiveColorClickEvent]({% slug api_inputs_activecolorclickevent %}) event provides the option to prevent the popup opening.
95
129
  */
96
130
  this.activeColorClick = new core_1.EventEmitter();
131
+ /**
132
+ * Fires each time the view is about to change.
133
+ * Used to provide a two-way binding for the `activeView` property.
134
+ */
135
+ this.activeViewChange = new core_1.EventEmitter();
97
136
  this._tabindex = 0;
98
137
  this._popupSettings = { animate: true };
99
138
  this._paletteSettings = {};
100
- this._gradientSettings = { opacity: true, clearButton: false, delay: 0 };
139
+ this._gradientSettings = { opacity: true, delay: 0 };
101
140
  this.notifyNgTouched = function () { };
102
141
  this.notifyNgChanged = function () { };
103
142
  kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
@@ -115,7 +154,7 @@ var ColorPickerComponent = /** @class */ (function () {
115
154
  * Specifies the value of the initially selected color.
116
155
  */
117
156
  set: function (value) {
118
- this._value = color_parser_1.parseColor(value, this.format);
157
+ this._value = utils_1.parseColor(value, this.format, this.gradientSettings.opacity);
119
158
  },
120
159
  enumerable: true,
121
160
  configurable: true
@@ -165,6 +204,8 @@ var ColorPickerComponent = /** @class */ (function () {
165
204
  },
166
205
  /**
167
206
  * Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
207
+ *
208
+ * @default 0
168
209
  */
169
210
  set: function (value) {
170
211
  var tabindex = Number(value);
@@ -179,7 +220,7 @@ var ColorPickerComponent = /** @class */ (function () {
179
220
  * Indicates whether the ColorPicker popup is open.
180
221
  */
181
222
  get: function () {
182
- return utils_1.isPresent(this.popupRef);
223
+ return utils_2.isPresent(this.popupRef);
183
224
  },
184
225
  enumerable: true,
185
226
  configurable: true
@@ -200,10 +241,10 @@ var ColorPickerComponent = /** @class */ (function () {
200
241
  configurable: true
201
242
  });
202
243
  ColorPickerComponent.prototype.ngOnInit = function () {
203
- var defaultPreset = (this.format !== 'name') ? DEFAULT_PRESET : DEFAULT_ACCESSIBLE_PRESET;
244
+ var defaultPreset = (this.format !== 'name') ? constants_1.DEFAULT_PRESET : constants_1.DEFAULT_ACCESSIBLE_PRESET;
204
245
  var settingsPalette = this._paletteSettings.palette;
205
- var presetColumns = typeof settingsPalette === 'string' && palette_presets_1.PALETTEPRESETS[settingsPalette] ?
206
- palette_presets_1.PALETTEPRESETS[settingsPalette].columns :
246
+ var presetColumns = typeof settingsPalette === 'string' && models_1.PALETTEPRESETS[settingsPalette] ?
247
+ models_1.PALETTEPRESETS[settingsPalette].columns :
207
248
  undefined;
208
249
  this._paletteSettings = {
209
250
  palette: settingsPalette || defaultPreset,
@@ -213,11 +254,11 @@ var ColorPickerComponent = /** @class */ (function () {
213
254
  };
214
255
  ColorPickerComponent.prototype.ngOnChanges = function (changes) {
215
256
  if (changes.format && changes.format.currentValue === 'name') {
216
- this.view = 'palette';
257
+ this.activeView = 'palette';
217
258
  }
218
- if (this.view === 'gradient' && this.gradientSettings.opacity) {
259
+ if (this.activeView === 'gradient' && this.gradientSettings.opacity) {
219
260
  this.format = 'rgba';
220
- this.value = color_parser_1.parseColor(this.value, this.format);
261
+ this.value = utils_1.parseColor(this.value, this.format, this.gradientSettings.opacity);
221
262
  }
222
263
  };
223
264
  ColorPickerComponent.prototype.ngOnDestroy = function () {
@@ -226,10 +267,26 @@ var ColorPickerComponent = /** @class */ (function () {
226
267
  this.dynamicRTLSubscription.unsubscribe();
227
268
  }
228
269
  };
270
+ Object.defineProperty(ColorPickerComponent.prototype, "colorPickerAriaLabel", {
271
+ /**
272
+ * @hidden
273
+ */
274
+ get: function () {
275
+ return this.value ? this.value : this.localizationService.get('colorPickerNoColor');
276
+ },
277
+ enumerable: true,
278
+ configurable: true
279
+ });
280
+ /**
281
+ * @hidden
282
+ */
283
+ ColorPickerComponent.prototype.handleCancelEvent = function (ev) {
284
+ this.cancel.emit(ev);
285
+ };
229
286
  /**
230
287
  * @hidden
231
288
  */
232
- ColorPickerComponent.prototype.handleWrapperClick = function () {
289
+ ColorPickerComponent.prototype.togglePopup = function () {
233
290
  this.toggleWithEvents(!this.isOpen);
234
291
  this.focus();
235
292
  };
@@ -238,10 +295,10 @@ var ColorPickerComponent = /** @class */ (function () {
238
295
  */
239
296
  ColorPickerComponent.prototype.handleActiveColorClick = function () {
240
297
  this.focus();
241
- var event = new models_1.ActiveColorClickEvent(this.value);
298
+ var event = new events_1.ActiveColorClickEvent(this.value);
242
299
  this.activeColorClick.emit(event);
243
300
  if (!event.isOpenPrevented() || this.isOpen) {
244
- this.handleWrapperClick();
301
+ this.togglePopup();
245
302
  }
246
303
  };
247
304
  /**
@@ -257,9 +314,6 @@ var ColorPickerComponent = /** @class */ (function () {
257
314
  * @hidden
258
315
  */
259
316
  ColorPickerComponent.prototype.handleWrapperFocus = function () {
260
- if (utils_1.isPresent(this.palette)) {
261
- this.palette.nativeElement.focus();
262
- }
263
317
  if (this.isFocused) {
264
318
  return;
265
319
  }
@@ -284,10 +338,10 @@ var ColorPickerComponent = /** @class */ (function () {
284
338
  this.notifyNgTouched();
285
339
  };
286
340
  /**
287
- * Clears the color value of the ColorPicker.
341
+ * Clears the value of the ColorPicker.
288
342
  */
289
343
  ColorPickerComponent.prototype.reset = function () {
290
- if (!utils_1.isPresent(this.value)) {
344
+ if (!utils_2.isPresent(this.value)) {
291
345
  return;
292
346
  }
293
347
  this._value = undefined;
@@ -304,7 +358,7 @@ var ColorPickerComponent = /** @class */ (function () {
304
358
  return;
305
359
  }
306
360
  this.closePopup();
307
- open = utils_1.isPresent(open) ? open : !this.isOpen;
361
+ open = utils_2.isPresent(open) ? open : !this.isOpen;
308
362
  if (open) {
309
363
  this.openPopup();
310
364
  }
@@ -312,13 +366,9 @@ var ColorPickerComponent = /** @class */ (function () {
312
366
  /**
313
367
  * @hidden
314
368
  */
315
- ColorPickerComponent.prototype.handleValueChange = function (color, closePopup) {
316
- var parsedColor = color_parser_1.parseColor(color, this.format);
369
+ ColorPickerComponent.prototype.handleValueChange = function (color) {
370
+ var parsedColor = utils_1.parseColor(color, this.format, this.gradientSettings.opacity);
317
371
  var valueChange = parsedColor !== this.value;
318
- if (closePopup) {
319
- this.toggleWithEvents(false);
320
- this.focus();
321
- }
322
372
  if (valueChange) {
323
373
  this.value = parsedColor;
324
374
  this.valueChange.emit(parsedColor);
@@ -329,9 +379,7 @@ var ColorPickerComponent = /** @class */ (function () {
329
379
  * @hidden
330
380
  */
331
381
  ColorPickerComponent.prototype.handlePopupBlur = function (event) {
332
- var focusInPopupElement = this.popupRef.popupElement.contains(event.relatedTarget);
333
- var wrapperClicked = event.relatedTarget === this.wrapper.nativeElement;
334
- if (!this.isFocused || wrapperClicked || focusInPopupElement) {
382
+ if (this.popupBlurInvalid(event)) {
335
383
  return;
336
384
  }
337
385
  this.isFocused = false;
@@ -382,53 +430,57 @@ var ColorPickerComponent = /** @class */ (function () {
382
430
  this.wrapper.nativeElement.focus();
383
431
  }
384
432
  if (event.keyCode === kendo_angular_common_1.Keys.Tab) {
385
- var firstElement = this.colorGradient ? this.colorGradient.gradientDragHandle.nativeElement : this.palette.nativeElement;
386
- var lastElement = this.palette ? this.palette.nativeElement :
387
- this.colorGradient.inputs.opacityInput.nativeElement.childNodes[1].children[0];
388
- if (event.shiftKey) {
389
- if (event.target === firstElement) {
390
- event.preventDefault();
391
- lastElement.focus();
392
- return;
393
- }
394
- }
395
- else {
396
- if (event.target === lastElement) {
397
- event.preventDefault();
398
- firstElement.focus();
399
- return;
400
- }
433
+ var currentElement = event.shiftKey ? this.firstFocusableElement.nativeElement : this.lastFocusableElement.nativeElement;
434
+ var nextElement = event.shiftKey ? this.lastFocusableElement.nativeElement : this.firstFocusableElement.nativeElement;
435
+ if (event.target === currentElement) {
436
+ event.preventDefault();
437
+ nextElement.nativeElement.focus();
401
438
  }
402
439
  }
403
440
  };
404
441
  /**
405
442
  * @hidden
406
- * Used by the TextBoxContainer to determine if the component is empty.
443
+ * Used by the FloatingLabel to determine if the component is empty.
407
444
  */
408
445
  ColorPickerComponent.prototype.isEmpty = function () {
409
446
  return false;
410
447
  };
448
+ ColorPickerComponent.prototype.popupBlurInvalid = function (ev) {
449
+ var focusInPopupElement = this.popupRef.popupElement.contains(ev.relatedTarget);
450
+ var wrapperClicked = ev.relatedTarget === this.wrapper.nativeElement;
451
+ return !this.isFocused || wrapperClicked || focusInPopupElement;
452
+ };
411
453
  ColorPickerComponent.prototype.toggleWithEvents = function (open) {
412
- var _this = this;
413
454
  var sameState = this.isOpen === open;
414
455
  if (this.disabled || this.readonly || sameState) {
415
456
  return;
416
457
  }
417
- var eventArgs = new models_1.PreventableEvent();
418
- open ? this.open.emit(eventArgs) : this.close.emit(eventArgs);
458
+ var eventArgs;
459
+ if (open) {
460
+ eventArgs = new events_1.ColorPickerOpenEvent();
461
+ this.open.emit(eventArgs);
462
+ }
463
+ else {
464
+ eventArgs = new events_1.ColorPickerCloseEvent();
465
+ this.close.emit(eventArgs);
466
+ }
419
467
  if (!eventArgs.isDefaultPrevented()) {
420
468
  this.toggle(open);
421
469
  }
422
470
  if (open) {
423
- this.ngZone.runOutsideAngular(function () {
424
- setTimeout(function () {
425
- if (_this.colorGradient) {
426
- _this.colorGradient.gradientDragHandle.nativeElement.focus();
427
- }
428
- });
429
- });
471
+ this.focusFirstElement();
430
472
  }
431
473
  };
474
+ ColorPickerComponent.prototype.focusFirstElement = function () {
475
+ var _this = this;
476
+ this.ngZone.runOutsideAngular(function () {
477
+ setTimeout(function () {
478
+ var elementToFocus = _this.flatColorPicker.gradient ? _this.flatColorPicker.gradient.gradientDragHandle :
479
+ _this.flatColorPicker.palette.host;
480
+ elementToFocus.nativeElement.focus();
481
+ });
482
+ });
483
+ };
432
484
  ColorPickerComponent.prototype.openPopup = function () {
433
485
  var _this = this;
434
486
  var horizontalAlign = this.direction === "rtl" ? "right" : "left";
@@ -459,11 +511,32 @@ var ColorPickerComponent = /** @class */ (function () {
459
511
  }
460
512
  this.popupRef.close();
461
513
  this.popupRef = null;
462
- this.palette = null;
463
514
  };
515
+ Object.defineProperty(ColorPickerComponent.prototype, "firstFocusableElement", {
516
+ get: function () {
517
+ if (!this.flatColorPicker.header || (this.views.length <= 1 && !this.flatColorPicker.clearButton)) {
518
+ return this.flatColorPicker.gradient ? this.flatColorPicker.gradient.gradientDragHandle : this.flatColorPicker.palette.host;
519
+ }
520
+ return this.views.length > 1 ? this.flatColorPicker.header.viewButtonsCollection.toArray()[0] : this.flatColorPicker.header.clearButtonElement;
521
+ },
522
+ enumerable: true,
523
+ configurable: true
524
+ });
525
+ Object.defineProperty(ColorPickerComponent.prototype, "lastFocusableElement", {
526
+ get: function () {
527
+ if (this.preview) {
528
+ return this.flatColorPicker.footer.lastButton;
529
+ }
530
+ if (this.flatColorPicker.palette) {
531
+ return this.flatColorPicker.palette.host;
532
+ }
533
+ return this.gradientSettings.opacity ? this.flatColorPicker.gradient.inputs.opacityInput.numericInput : this.flatColorPicker.gradient.inputs.blueInput;
534
+ },
535
+ enumerable: true,
536
+ configurable: true
537
+ });
464
538
  var ColorPickerComponent_1;
465
539
  tslib_1.__decorate([
466
- core_1.HostBinding('class.k-widget'),
467
540
  core_1.HostBinding('class.k-colorpicker'),
468
541
  tslib_1.__metadata("design:type", Boolean)
469
542
  ], ColorPickerComponent.prototype, "hostClasses", void 0);
@@ -475,10 +548,14 @@ var ColorPickerComponent = /** @class */ (function () {
475
548
  core_1.Input(),
476
549
  tslib_1.__metadata("design:type", String)
477
550
  ], ColorPickerComponent.prototype, "focusableId", void 0);
551
+ tslib_1.__decorate([
552
+ core_1.Input(),
553
+ tslib_1.__metadata("design:type", Array)
554
+ ], ColorPickerComponent.prototype, "views", void 0);
478
555
  tslib_1.__decorate([
479
556
  core_1.Input(),
480
557
  tslib_1.__metadata("design:type", String)
481
- ], ColorPickerComponent.prototype, "view", void 0);
558
+ ], ColorPickerComponent.prototype, "activeView", void 0);
482
559
  tslib_1.__decorate([
483
560
  core_1.Input(),
484
561
  tslib_1.__metadata("design:type", Boolean)
@@ -519,11 +596,23 @@ var ColorPickerComponent = /** @class */ (function () {
519
596
  core_1.Input(),
520
597
  tslib_1.__metadata("design:type", Object)
521
598
  ], ColorPickerComponent.prototype, "iconClass", void 0);
599
+ tslib_1.__decorate([
600
+ core_1.Input(),
601
+ tslib_1.__metadata("design:type", Boolean)
602
+ ], ColorPickerComponent.prototype, "clearButton", void 0);
522
603
  tslib_1.__decorate([
523
604
  core_1.Input(),
524
605
  tslib_1.__metadata("design:type", Number),
525
606
  tslib_1.__metadata("design:paramtypes", [Number])
526
607
  ], ColorPickerComponent.prototype, "tabindex", null);
608
+ tslib_1.__decorate([
609
+ core_1.Input(),
610
+ tslib_1.__metadata("design:type", Boolean)
611
+ ], ColorPickerComponent.prototype, "preview", void 0);
612
+ tslib_1.__decorate([
613
+ core_1.Input(),
614
+ tslib_1.__metadata("design:type", String)
615
+ ], ColorPickerComponent.prototype, "actionsLayout", void 0);
527
616
  tslib_1.__decorate([
528
617
  core_1.Output(),
529
618
  tslib_1.__metadata("design:type", core_1.EventEmitter)
@@ -544,10 +633,18 @@ var ColorPickerComponent = /** @class */ (function () {
544
633
  core_1.Output('blur'),
545
634
  tslib_1.__metadata("design:type", core_1.EventEmitter)
546
635
  ], ColorPickerComponent.prototype, "onBlur", void 0);
636
+ tslib_1.__decorate([
637
+ core_1.Output(),
638
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
639
+ ], ColorPickerComponent.prototype, "cancel", void 0);
547
640
  tslib_1.__decorate([
548
641
  core_1.Output(),
549
642
  tslib_1.__metadata("design:type", core_1.EventEmitter)
550
643
  ], ColorPickerComponent.prototype, "activeColorClick", void 0);
644
+ tslib_1.__decorate([
645
+ core_1.Output(),
646
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
647
+ ], ColorPickerComponent.prototype, "activeViewChange", void 0);
551
648
  tslib_1.__decorate([
552
649
  core_1.ViewChild('container', { read: core_1.ViewContainerRef, static: true }),
553
650
  tslib_1.__metadata("design:type", core_1.ViewContainerRef)
@@ -561,15 +658,12 @@ var ColorPickerComponent = /** @class */ (function () {
561
658
  tslib_1.__metadata("design:type", core_1.TemplateRef)
562
659
  ], ColorPickerComponent.prototype, "popupTemplate", void 0);
563
660
  tslib_1.__decorate([
564
- core_1.ViewChild('palette', { read: core_1.ElementRef, static: false }),
565
- tslib_1.__metadata("design:type", core_1.ElementRef)
566
- ], ColorPickerComponent.prototype, "palette", void 0);
567
- tslib_1.__decorate([
568
- core_1.ViewChild('colorGradient', { static: false }),
569
- tslib_1.__metadata("design:type", color_gradient_component_1.ColorGradientComponent)
570
- ], ColorPickerComponent.prototype, "colorGradient", void 0);
661
+ core_1.ViewChild('flatColorPicker', { static: false }),
662
+ tslib_1.__metadata("design:type", flatcolorpicker_component_1.FlatColorPickerComponent)
663
+ ], ColorPickerComponent.prototype, "flatColorPicker", void 0);
571
664
  ColorPickerComponent = ColorPickerComponent_1 = tslib_1.__decorate([
572
665
  core_1.Component({
666
+ exportAs: 'kendoColorPicker',
573
667
  selector: 'kendo-colorpicker',
574
668
  providers: [{
575
669
  multi: true,
@@ -589,7 +683,7 @@ var ColorPickerComponent = /** @class */ (function () {
589
683
  useValue: 'kendo.colorpicker'
590
684
  }
591
685
  ],
592
- template: "\n <ng-container kendoColorPickerLocalizedMessages\n i18n-colorGradient=\"kendo.colorpicker.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty.\"\n colorGradientNoColor=\"Colorgradient no color chosen\"\n i18n-colorGradient=\"kendo.colorpalette.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty.\"\n colorPaletteNoColor=\"Colorpalette no color chosen\"\n i18n-colorGradientHandle=\"kendo.colorpicker.colorGradientHandle|The title for the gradient color drag handle chooser.\"\n colorGradientHandle=\"Choose color\"\n i18n-clearButton=\"kendo.colorpicker.clearButton|The title for the clear button.\"\n clearButton=\"Clear value\"\n i18n-hueSliderHandle=\"kendo.colorpicker.hueSliderHandle|The title for the hue slider handle.\"\n hueSliderHandle=\"Set hue\"\n i18n-opacitySliderHandle=\"kendo.colorpicker.opacitySliderHandle|The title for the opacity slider handle.\"\n opacitySliderHandle=\"Set opacity\"\n i18n-hexInputPlaceholder=\"kendo.colorpicker.hexInputPlaceholder|The placeholder for the HEX color input.\"\n hexInputPlaceholder=\"HEX Color\"\n i18n-redInputPlaceholder=\"kendo.colorpicker.redInputPlaceholder|The placeholder for the red color input.\"\n redInputPlaceholder=\"Red\"\n i18n-greenInputPlaceholder=\"kendo.colorpicker.greenInputPlaceholder|The placeholder for the green color input.\"\n greenInputPlaceholder=\"Green\"\n i18n-blueInputPlaceholder=\"kendo.colorpicker.blueInputPlaceholder|The placeholder for the blue color input.\"\n blueInputPlaceholder=\"Blue\"\n i18n-alphaInputPlaceholder=\"kendo.colorpicker.alphaInputPlaceholder|The placeholder for the alpha input.\"\n alphaInputPlaceholder=\"Alpha\">\n </ng-container>\n <span\n #wrapper\n [ngClass]=\"{\n 'k-picker-wrap': true,\n 'k-state-disabled': this.disabled,\n 'k-state-focused': this.isFocused\n }\"\n role=\"listbox\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-readonly]=\"readonly\"\n [attr.aria-disabled]=\"disabled\"\n [attr.aria-label]=\"value\"\n [id]=\"focusableId\"\n [attr.tabindex]=\"tabindex\"\n (focus)=\"handleWrapperFocus()\"\n (blur)=\"handleWrapperBlur()\"\n (mousedown)=\"$event.preventDefault()\"\n (keydown)=\"handleWrapperKeyDown($event)\"\n >\n <span *ngIf=\"!iconStyles\" class=\"k-selected-color\" [style.background-color]=\"value\" (click)=\"handleActiveColorClick()\">\n <span class=\"k-icon k-i-line\" *ngIf=\"!value\"></span>\n </span>\n <span *ngIf=\"iconStyles\" class=\"k-tool-icon\" [ngClass]=\"iconStyles\" (click)=\"handleActiveColorClick()\">\n <span class=\"k-selected-color\" [style.background-color]=\"value\"></span>\n </span>\n <span class=\"k-select\" (click)=\"handleWrapperClick()\">\n <span class=\"k-icon k-i-arrow-s\"></span>\n </span>\n </span>\n <ng-template #popupTemplate>\n <kendo-colorgradient #colorGradient\n *ngIf=\"view === 'gradient' || view === 'combo'\"\n [value]=\"value\"\n [format]=\"format\"\n [opacity]=\"gradientSettings.opacity\"\n [clearButton]=\"gradientSettings.clearButton\"\n [delay]=\"gradientSettings.delay\"\n (focusout)=\"handlePopupBlur($event)\"\n (valueChange)=\"handleValueChange($event, false)\"\n (keydown)=\"handlePopupKeyDown($event)\"\n >\n </kendo-colorgradient>\n <kendo-colorpalette\n #palette\n *ngIf=\"view === 'palette' || view === 'combo'\"\n kendoFocusOnDomReady\n [palette]=\"paletteSettings.palette\"\n [columns]=\"paletteSettings.columns\"\n [tileSize]=\"paletteSettings.tileSize\"\n [format]=\"format\"\n [value]=\"value\"\n (blur)=\"handlePopupBlur($event)\"\n (cellSelection)=\"handleValueChange($event, true)\"\n (mousedown)=\"$event.preventDefault()\"\n (keydown)=\"handlePopupKeyDown($event)\"\n >\n </kendo-colorpalette>\n </ng-template>\n <ng-container #container></ng-container>\n "
686
+ template: "\n <ng-container kendoColorPickerLocalizedMessages\n i18n-colorPickerNoColor=\"kendo.colorpicker.colorPickerNoColor|The aria-label applied to the ColorPicker component when the value is empty.\"\n colorPickerNoColor=\"Colorpicker no color chosen\"\n i18n-flatColorPickerNoColor=\"kendo.colorpicker.flatColorPickerNoColor|The aria-label applied to the FlatColorPicker component when the value is empty.\"\n flatColorPickerNoColor=\"Flatcolorpicker no color chosen\"\n i18n-colorGradientNoColor=\"kendo.colorpicker.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty.\"\n colorGradientNoColor=\"Colorgradient no color chosen\"\n i18n-colorPaletteNoColor=\"kendo.colorpicker.colorPaletteNoColor|The aria-label applied to the ColorPalette component when the value is empty.\"\n colorPaletteNoColor=\"Colorpalette no color chosen\"\n i18n-colorGradientHandle=\"kendo.colorpicker.colorGradientHandle|The title for the gradient color drag handle chooser.\"\n colorGradientHandle=\"Choose color\"\n i18n-clearButton=\"kendo.colorpicker.clearButton|The title for the clear button.\"\n clearButton=\"Clear value\"\n i18n-hueSliderHandle=\"kendo.colorpicker.hueSliderHandle|The title for the hue slider handle.\"\n hueSliderHandle=\"Set hue\"\n i18n-opacitySliderHandle=\"kendo.colorpicker.opacitySliderHandle|The title for the opacity slider handle.\"\n opacitySliderHandle=\"Set opacity\"\n i18n-contrastRatio=\"kendo.colorpicker.contrastRatio|The contrast ratio message for the contrast tool.\"\n contrastRatio=\"Contrast ratio\"\n i18n-previewColor=\"kendo.colorpicker.previewColor|The message for the color preview pane.\"\n previewColor=\"Color preview\"\n i18n-revertSelection=\"kendo.colorpicker.revertSelection|The message for the selected color pane.\"\n revertSelection=\"Revert selection\"\n i18n-gradientView=\"kendo.colorpicker.gradientView|The message for the gradient view button.\"\n gradientView=\"Gradient view\"\n i18n-paletteView=\"kendo.colorpicker.paletteView|The message for the palette view button.\"\n paletteView=\"Palette view\"\n i18n-formatButton=\"kendo.colorpicker.formatButton|The message for the input format toggle button.\"\n formatButton=\"Change color format\"\n i18n-applyButton=\"kendo.colorpicker.applyButton|The message for the Apply action button.\"\n applyButton=\"Apply\"\n i18n-cancelButton=\"kendo.colorpicker.cancelButton|The message for the Cancel action button.\"\n cancelButton=\"Cancel\">\n </ng-container>\n <span\n #wrapper\n [ngClass]=\"{\n 'k-picker-wrap': true,\n 'k-state-disabled': this.disabled,\n 'k-state-focused': this.isFocused\n }\"\n role=\"listbox\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-readonly]=\"readonly\"\n [attr.aria-disabled]=\"disabled\"\n [attr.aria-label]=\"colorPickerAriaLabel\"\n [id]=\"focusableId\"\n [attr.tabindex]=\"tabindex\"\n (focus)=\"handleWrapperFocus()\"\n (blur)=\"handleWrapperBlur()\"\n (mousedown)=\"$event.preventDefault()\"\n (keydown)=\"handleWrapperKeyDown($event)\"\n >\n <span *ngIf=\"!iconStyles\" class=\"k-selected-color\" [style.background]=\"value\" (click)=\"handleActiveColorClick()\">\n <span class=\"k-icon k-i-line\" *ngIf=\"!value\"></span>\n </span>\n <span *ngIf=\"iconStyles\" class=\"k-tool-icon\" [ngClass]=\"iconStyles\" (click)=\"handleActiveColorClick()\">\n <span class=\"k-selected-color\" [style.background-color]=\"value\"></span>\n </span>\n <span class=\"k-select\" (click)=\"togglePopup()\">\n <span class=\"k-icon k-i-arrow-s\"></span>\n </span>\n </span>\n <ng-template #popupTemplate>\n <kendo-flatcolorpicker\n #flatColorPicker\n [value]=\"value\"\n [format]=\"format\"\n [views]=\"views\"\n [activeView]=\"activeView\"\n [actionsLayout]=\"actionsLayout\"\n [preview]=\"preview\"\n [gradientSettings]=\"gradientSettings\"\n [paletteSettings]=\"paletteSettings\"\n [clearButton]=\"clearButton\"\n (focusout)=\"handlePopupBlur($event)\"\n (cancel)=\"handleCancelEvent($event)\"\n (valueChange)=\"handleValueChange($event)\"\n (keydown)=\"handlePopupKeyDown($event)\"\n (activeViewChange)=\"activeViewChange.emit($event)\"\n (actionButtonClick)=\"togglePopup()\">\n </kendo-flatcolorpicker>\n </ng-template>\n <ng-container #container></ng-container>\n "
593
687
  }),
594
688
  tslib_1.__metadata("design:paramtypes", [kendo_angular_popup_1.PopupService,
595
689
  core_1.ChangeDetectorRef,
@@ -24,3 +24,15 @@ exports.AAA_RATIO = 7.0;
24
24
  * @hidden
25
25
  */
26
26
  exports.AA_RATIO = 4.5;
27
+ /**
28
+ * @hidden
29
+ */
30
+ exports.DEFAULT_PRESET = 'office';
31
+ /**
32
+ * @hidden
33
+ */
34
+ exports.DEFAULT_ACCESSIBLE_PRESET = 'accessible';
35
+ /**
36
+ * @hidden
37
+ */
38
+ exports.STEP_COUNT = 16;
@@ -5,6 +5,7 @@
5
5
  "use strict";
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  var tslib_1 = require("tslib");
8
+ var constants_1 = require("./constants");
8
9
  var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
9
10
  var core_1 = require("@angular/core");
10
11
  /**
@@ -30,7 +31,8 @@ var ContrastValidationComponent = /** @class */ (function () {
30
31
  });
31
32
  Object.defineProperty(ContrastValidationComponent.prototype, "contrastText", {
32
33
  get: function () {
33
- return this.type + ": " + this.ratio.toFixed(1);
34
+ var ratio = this.type === 'AA' ? constants_1.AA_RATIO : constants_1.AAA_RATIO;
35
+ return this.type + ": " + ratio.toFixed(1);
34
36
  },
35
37
  enumerable: true,
36
38
  configurable: true
@@ -39,18 +41,18 @@ var ContrastValidationComponent = /** @class */ (function () {
39
41
  core_1.Input(),
40
42
  tslib_1.__metadata("design:type", String)
41
43
  ], ContrastValidationComponent.prototype, "type", void 0);
42
- tslib_1.__decorate([
43
- core_1.Input(),
44
- tslib_1.__metadata("design:type", Number)
45
- ], ContrastValidationComponent.prototype, "ratio", void 0);
46
44
  tslib_1.__decorate([
47
45
  core_1.Input(),
48
46
  tslib_1.__metadata("design:type", Boolean)
49
47
  ], ContrastValidationComponent.prototype, "pass", void 0);
48
+ tslib_1.__decorate([
49
+ core_1.Input(),
50
+ tslib_1.__metadata("design:type", String)
51
+ ], ContrastValidationComponent.prototype, "value", void 0);
50
52
  ContrastValidationComponent = tslib_1.__decorate([
51
53
  core_1.Component({
52
54
  selector: '[kendoContrastValidation]',
53
- template: "\n <span>{{contrastText}}</span>\n <span class=\"k-contrast-validation k-text-success\" *ngIf=\"pass\">\n {{passMessage}}\n <span class=\"k-icon k-i-check\"></span>\n </span>\n <span class=\"k-contrast-validation k-text-error\" *ngIf=\"!pass\">\n {{failMessage}}\n <span class=\"k-icon k-i-close\"></span>\n </span>\n "
55
+ template: "\n <span>{{contrastText}}</span>\n <ng-container *ngIf=\"value\">\n <span class=\"k-contrast-validation k-text-success\" *ngIf=\"pass\">\n {{passMessage}}\n <span class=\"k-icon k-i-check\"></span>\n </span>\n <span class=\"k-contrast-validation k-text-error\" *ngIf=\"!pass\">\n {{failMessage}}\n <span class=\"k-icon k-i-close\"></span>\n </span>\n </ng-container>\n "
54
56
  }),
55
57
  tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService])
56
58
  ], ContrastValidationComponent);
@@ -5,8 +5,8 @@
5
5
  "use strict";
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  var tslib_1 = require("tslib");
8
- var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
9
8
  var core_1 = require("@angular/core");
9
+ var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
10
10
  var utils_1 = require("./utils");
11
11
  var constants_1 = require("./constants");
12
12
  /**
@@ -15,8 +15,6 @@ var constants_1 = require("./constants");
15
15
  var ContrastComponent = /** @class */ (function () {
16
16
  function ContrastComponent(localization) {
17
17
  this.localization = localization;
18
- this.aaRatio = constants_1.AA_RATIO;
19
- this.aaaRatio = constants_1.AAA_RATIO;
20
18
  }
21
19
  Object.defineProperty(ContrastComponent.prototype, "formatedRatio", {
22
20
  get: function () {
@@ -25,23 +23,23 @@ var ContrastComponent = /** @class */ (function () {
25
23
  enumerable: true,
26
24
  configurable: true
27
25
  });
28
- Object.defineProperty(ContrastComponent.prototype, "contrastRatioMessage", {
26
+ Object.defineProperty(ContrastComponent.prototype, "contrastRatioText", {
29
27
  get: function () {
30
- return this.localization.get('contrastRatio');
28
+ return this.localization.get('contrastRatio') + ": " + (this.value ? this.formatedRatio : 'n/a');
31
29
  },
32
30
  enumerable: true,
33
31
  configurable: true
34
32
  });
35
33
  Object.defineProperty(ContrastComponent.prototype, "satisfiesAACondition", {
36
34
  get: function () {
37
- return this.contrastRatio >= this.aaRatio;
35
+ return this.contrastRatio >= constants_1.AA_RATIO;
38
36
  },
39
37
  enumerable: true,
40
38
  configurable: true
41
39
  });
42
40
  Object.defineProperty(ContrastComponent.prototype, "satisfiesAAACondition", {
43
41
  get: function () {
44
- return this.contrastRatio >= this.aaaRatio;
42
+ return this.contrastRatio >= constants_1.AAA_RATIO;
45
43
  },
46
44
  enumerable: true,
47
45
  configurable: true
@@ -65,7 +63,7 @@ var ContrastComponent = /** @class */ (function () {
65
63
  ContrastComponent = tslib_1.__decorate([
66
64
  core_1.Component({
67
65
  selector: '[kendoContrastTool]',
68
- template: "\n <div class=\"k-contrast-ratio\">\n <span class=\"k-contrast-ratio-text\">{{contrastRatioMessage}}: {{formatedRatio}}</span>\n <span class=\"k-contrast-validation k-text-success\" *ngIf=\"satisfiesAACondition\">\n <span class=\"k-icon k-i-check\"></span>\n <span class=\"k-icon k-i-check\" *ngIf=\"satisfiesAAACondition\"></span>\n </span>\n <span class=\"k-contrast-validation k-text-error\" *ngIf=\"!satisfiesAACondition\">\n <span class=\"k-icon k-i-close\"></span>\n </span>\n </div>\n <div kendoContrastValidation\n type=\"AA\"\n [ratio]=\"aaaRatio\"\n [pass]=\"satisfiesAACondition\">\n </div>\n <div kendoContrastValidation\n type=\"AAA\"\n [ratio]=\"aaaRatio\"\n [pass]=\"satisfiesAAACondition\">\n </div>\n "
66
+ template: "\n <div class=\"k-contrast-ratio\">\n <span class=\"k-contrast-ratio-text\">{{contrastRatioText}}</span>\n <ng-container *ngIf=\"value\">\n <span class=\"k-contrast-validation k-text-success\" *ngIf=\"satisfiesAACondition\">\n <span class=\"k-icon k-i-check\"></span>\n <span class=\"k-icon k-i-check\" *ngIf=\"satisfiesAAACondition\"></span>\n </span>\n <span class=\"k-contrast-validation k-text-error\" *ngIf=\"!satisfiesAACondition\">\n <span class=\"k-icon k-i-close\"></span>\n </span>\n </ng-container>\n </div>\n <div kendoContrastValidation\n type=\"AA\"\n [value]=\"value\"\n [pass]=\"satisfiesAACondition\">\n </div>\n <div kendoContrastValidation\n type=\"AAA\"\n [value]=\"value\"\n [pass]=\"satisfiesAAACondition\">\n </div>\n "
69
67
  }),
70
68
  tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService])
71
69
  ], ContrastComponent);