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

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 (229) 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/checkbox/checkbox.directive.js +79 -3
  4. package/dist/es/colorpicker/color-contrast-svg.component.js +95 -0
  5. package/dist/es/colorpicker/color-gradient.component.js +109 -81
  6. package/dist/es/colorpicker/color-input.component.js +39 -18
  7. package/dist/es/colorpicker/color-palette.component.js +28 -18
  8. package/dist/es/colorpicker/colorpicker.component.js +279 -80
  9. package/dist/es/colorpicker/constants.js +12 -0
  10. package/dist/es/colorpicker/contrast-validation.component.js +8 -6
  11. package/dist/es/colorpicker/contrast.component.js +6 -8
  12. package/dist/es/colorpicker/{models → events}/active-color-click-event.js +0 -0
  13. package/dist/es/colorpicker/events/cancel-event.js +19 -0
  14. package/dist/es/colorpicker/events/close-event.js +17 -0
  15. package/dist/es/colorpicker/{models → events}/kendo-drag-event.js +0 -0
  16. package/dist/es/colorpicker/events/open-event.js +17 -0
  17. package/dist/es/colorpicker/events.js +8 -0
  18. package/dist/es/colorpicker/flatcolorpicker-actions.component.js +50 -0
  19. package/dist/es/colorpicker/flatcolorpicker-header.component.js +94 -0
  20. package/dist/es/colorpicker/flatcolorpicker.component.js +553 -0
  21. package/dist/es/colorpicker/localization/colorgradient-localization.service.js +7 -7
  22. package/dist/es/colorpicker/localization/colorpalette-localization.service.js +7 -7
  23. package/dist/es/colorpicker/localization/custom-messages.component.js +1 -1
  24. package/dist/es/colorpicker/localization/flatcolorpicker-localization.service.js +34 -0
  25. package/dist/es/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  26. package/dist/es/colorpicker/localization/messages.js +36 -0
  27. package/dist/es/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
  28. package/dist/{es2015/colorpicker/models/color-picker-view.js → es/colorpicker/models/colorpicker-view.js} +0 -0
  29. package/dist/es/colorpicker/{utils → models}/palette-presets.js +0 -0
  30. package/dist/es/colorpicker/models.js +1 -2
  31. package/dist/es/colorpicker/services/flatcolorpicker.service.js +41 -0
  32. package/dist/es/colorpicker/utils/color-parser.js +18 -5
  33. package/dist/es/colorpicker/utils/contrast-curve.js +91 -0
  34. package/dist/es/colorpicker/utils.js +1 -1
  35. package/dist/es/colorpicker.module.js +9 -1
  36. package/dist/es/common/models/fillmode.js +4 -0
  37. package/dist/es/common/models/rounded.js +4 -0
  38. package/dist/es/common/models/size.js +4 -0
  39. package/dist/es/common/models/styling-classes.js +4 -0
  40. package/dist/{es2015/colorpicker/models/kendo-drag-event.js → es/common/models.js} +0 -0
  41. package/dist/es/common/utils.js +37 -0
  42. package/dist/es/index.js +5 -0
  43. package/dist/es/main.js +4 -2
  44. package/dist/es/maskedtextbox/maskedtextbox.component.js +101 -6
  45. package/dist/es/numerictextbox/numerictextbox.component.js +116 -20
  46. package/dist/es/package-metadata.js +1 -1
  47. package/dist/es/radiobutton/radiobutton.directive.js +52 -3
  48. package/dist/es/shared/textarea.directive.js +3 -2
  49. package/dist/es/shared/utils.js +23 -0
  50. package/dist/es/switch/switch.component.js +167 -21
  51. package/dist/es/text-fields-common/text-fields-base.js +1 -1
  52. package/dist/es/textarea/textarea.component.js +101 -5
  53. package/dist/es/textbox/textbox.component.js +111 -12
  54. package/dist/es/textbox/textbox.directive.js +3 -2
  55. package/dist/es/textbox.module.js +0 -3
  56. package/dist/es2015/checkbox/checkbox.directive.d.ts +31 -0
  57. package/dist/es2015/checkbox/checkbox.directive.js +68 -10
  58. package/dist/es2015/colorpicker/color-contrast-svg.component.d.ts +26 -0
  59. package/dist/es2015/colorpicker/color-contrast-svg.component.js +97 -0
  60. package/dist/es2015/colorpicker/color-gradient.component.d.ts +32 -43
  61. package/dist/es2015/colorpicker/color-gradient.component.js +126 -93
  62. package/dist/es2015/colorpicker/color-input.component.d.ts +11 -4
  63. package/dist/es2015/colorpicker/color-input.component.js +52 -32
  64. package/dist/es2015/colorpicker/color-palette.component.d.ts +8 -3
  65. package/dist/es2015/colorpicker/color-palette.component.js +28 -18
  66. package/dist/es2015/colorpicker/colorpicker.component.d.ts +127 -25
  67. package/dist/es2015/colorpicker/colorpicker.component.js +305 -125
  68. package/dist/es2015/colorpicker/constants.d.ts +12 -0
  69. package/dist/es2015/colorpicker/constants.js +12 -0
  70. package/dist/es2015/colorpicker/contrast-validation.component.d.ts +1 -1
  71. package/dist/es2015/colorpicker/contrast-validation.component.js +16 -12
  72. package/dist/es2015/colorpicker/contrast.component.d.ts +1 -3
  73. package/dist/es2015/colorpicker/contrast.component.js +17 -17
  74. package/dist/es2015/colorpicker/{models → events}/active-color-click-event.d.ts +0 -0
  75. package/dist/es2015/colorpicker/{models → events}/active-color-click-event.js +0 -0
  76. package/dist/es2015/colorpicker/events/cancel-event.d.ts +15 -0
  77. package/dist/es2015/colorpicker/events/cancel-event.js +14 -0
  78. package/dist/es2015/colorpicker/events/close-event.d.ts +10 -0
  79. package/dist/es2015/colorpicker/events/close-event.js +10 -0
  80. package/dist/es2015/colorpicker/{models → events}/kendo-drag-event.d.ts +0 -0
  81. package/dist/es2015/colorpicker/events/kendo-drag-event.js +4 -0
  82. package/dist/es2015/colorpicker/events/open-event.d.ts +10 -0
  83. package/dist/es2015/colorpicker/events/open-event.js +10 -0
  84. package/dist/es2015/colorpicker/events.d.ts +8 -0
  85. package/dist/es2015/colorpicker/events.js +8 -0
  86. package/dist/es2015/colorpicker/flatcolorpicker-actions.component.d.ts +18 -0
  87. package/dist/es2015/colorpicker/flatcolorpicker-actions.component.js +60 -0
  88. package/dist/es2015/colorpicker/flatcolorpicker-header.component.d.ts +30 -0
  89. package/dist/es2015/colorpicker/flatcolorpicker-header.component.js +131 -0
  90. package/dist/es2015/colorpicker/flatcolorpicker.component.d.ts +214 -0
  91. package/dist/es2015/colorpicker/flatcolorpicker.component.js +593 -0
  92. package/dist/es2015/colorpicker/localization/colorgradient-localization.service.d.ts +3 -3
  93. package/dist/es2015/colorpicker/localization/colorgradient-localization.service.js +7 -7
  94. package/dist/es2015/colorpicker/localization/colorpalette-localization.service.d.ts +3 -3
  95. package/dist/es2015/colorpicker/localization/colorpalette-localization.service.js +7 -7
  96. package/dist/es2015/colorpicker/localization/custom-messages.component.js +1 -1
  97. package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.d.ts +14 -0
  98. package/dist/es2015/colorpicker/localization/flatcolorpicker-localization.service.js +31 -0
  99. package/dist/es2015/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  100. package/dist/es2015/colorpicker/localization/messages.d.ts +36 -0
  101. package/dist/es2015/colorpicker/localization/messages.js +36 -0
  102. package/dist/es2015/colorpicker/models/actions-layout.d.ts +8 -0
  103. package/dist/es2015/colorpicker/models/actions-layout.js +4 -0
  104. package/dist/es2015/colorpicker/models/colorpicker-view.d.ts +8 -0
  105. package/dist/es2015/colorpicker/models/colorpicker-view.js +4 -0
  106. package/dist/es2015/colorpicker/models/gradient-settings.d.ts +4 -3
  107. package/dist/es2015/colorpicker/models/output-format.d.ts +0 -5
  108. package/dist/es2015/colorpicker/{utils → models}/palette-presets.d.ts +0 -0
  109. package/dist/es2015/colorpicker/{utils → models}/palette-presets.js +0 -0
  110. package/dist/es2015/colorpicker/models/palette-settings.d.ts +2 -3
  111. package/dist/es2015/colorpicker/models/tile-size.d.ts +1 -5
  112. package/dist/es2015/colorpicker/models.d.ts +10 -10
  113. package/dist/es2015/colorpicker/models.js +1 -2
  114. package/dist/es2015/colorpicker/services/flatcolorpicker.service.d.ts +12 -0
  115. package/dist/es2015/colorpicker/services/flatcolorpicker.service.js +38 -0
  116. package/dist/es2015/colorpicker/utils/color-parser.d.ts +8 -2
  117. package/dist/es2015/colorpicker/utils/color-parser.js +15 -5
  118. package/dist/es2015/colorpicker/utils/contrast-curve.d.ts +37 -0
  119. package/dist/es2015/colorpicker/utils/contrast-curve.js +85 -0
  120. package/dist/es2015/colorpicker/utils.d.ts +1 -1
  121. package/dist/es2015/colorpicker/utils.js +1 -1
  122. package/dist/es2015/colorpicker.module.js +9 -1
  123. package/dist/es2015/{colorpicker/models/color-picker-view.d.ts → common/models/fillmode.d.ts} +5 -5
  124. package/dist/es2015/common/models/fillmode.js +4 -0
  125. package/dist/es2015/common/models/rounded.d.ts +23 -0
  126. package/dist/es2015/common/models/rounded.js +4 -0
  127. package/dist/es2015/common/models/size.d.ts +14 -0
  128. package/dist/es2015/common/models/size.js +4 -0
  129. package/dist/es2015/common/models/styling-classes.d.ts +11 -0
  130. package/dist/es2015/common/models/styling-classes.js +4 -0
  131. package/dist/es2015/common/models.d.ts +8 -0
  132. package/dist/es2015/common/models.js +4 -0
  133. package/dist/es2015/common/utils.d.ts +7 -0
  134. package/dist/es2015/common/utils.js +37 -0
  135. package/dist/es2015/index.d.ts +5 -0
  136. package/dist/es2015/index.js +5 -0
  137. package/dist/es2015/index.metadata.json +1 -1
  138. package/dist/es2015/main.d.ts +5 -2
  139. package/dist/es2015/main.js +4 -2
  140. package/dist/es2015/maskedtextbox/maskedtextbox.component.d.ts +39 -1
  141. package/dist/es2015/maskedtextbox/maskedtextbox.component.js +88 -6
  142. package/dist/es2015/numerictextbox/numerictextbox.component.d.ts +39 -2
  143. package/dist/es2015/numerictextbox/numerictextbox.component.js +124 -40
  144. package/dist/es2015/package-metadata.js +1 -1
  145. package/dist/es2015/radiobutton/radiobutton.directive.d.ts +18 -0
  146. package/dist/es2015/radiobutton/radiobutton.directive.js +46 -11
  147. package/dist/es2015/shared/textarea.directive.d.ts +1 -1
  148. package/dist/es2015/shared/textarea.directive.js +3 -2
  149. package/dist/es2015/shared/utils.d.ts +16 -0
  150. package/dist/es2015/shared/utils.js +23 -0
  151. package/dist/es2015/switch/switch.component.d.ts +48 -5
  152. package/dist/es2015/switch/switch.component.js +166 -24
  153. package/dist/es2015/text-fields-common/text-fields-base.js +1 -1
  154. package/dist/es2015/textarea/textarea.component.d.ts +39 -1
  155. package/dist/es2015/textarea/textarea.component.js +89 -5
  156. package/dist/es2015/textbox/textbox.component.d.ts +40 -1
  157. package/dist/es2015/textbox/textbox.component.js +99 -12
  158. package/dist/es2015/textbox/textbox.directive.d.ts +1 -1
  159. package/dist/es2015/textbox/textbox.directive.js +3 -2
  160. package/dist/es2015/textbox.module.js +0 -3
  161. package/dist/fesm2015/index.js +3118 -1477
  162. package/dist/fesm5/index.js +3040 -1387
  163. package/dist/npm/checkbox/checkbox.directive.js +78 -2
  164. package/dist/npm/colorpicker/color-contrast-svg.component.js +97 -0
  165. package/dist/npm/colorpicker/color-gradient.component.js +109 -81
  166. package/dist/npm/colorpicker/color-input.component.js +38 -17
  167. package/dist/npm/colorpicker/color-palette.component.js +29 -19
  168. package/dist/npm/colorpicker/colorpicker.component.js +285 -86
  169. package/dist/npm/colorpicker/constants.js +12 -0
  170. package/dist/npm/colorpicker/contrast-validation.component.js +8 -6
  171. package/dist/npm/colorpicker/contrast.component.js +6 -8
  172. package/dist/npm/colorpicker/{models → events}/active-color-click-event.js +0 -0
  173. package/dist/npm/colorpicker/events/cancel-event.js +21 -0
  174. package/dist/npm/colorpicker/events/close-event.js +19 -0
  175. package/dist/npm/colorpicker/{models → events}/kendo-drag-event.js +0 -0
  176. package/dist/npm/colorpicker/events/open-event.js +19 -0
  177. package/dist/npm/colorpicker/events.js +11 -0
  178. package/dist/npm/colorpicker/flatcolorpicker-actions.component.js +52 -0
  179. package/dist/npm/colorpicker/flatcolorpicker-header.component.js +96 -0
  180. package/dist/npm/colorpicker/flatcolorpicker.component.js +555 -0
  181. package/dist/npm/colorpicker/localization/colorgradient-localization.service.js +7 -7
  182. package/dist/npm/colorpicker/localization/colorpalette-localization.service.js +7 -7
  183. package/dist/npm/colorpicker/localization/custom-messages.component.js +1 -1
  184. package/dist/npm/colorpicker/localization/flatcolorpicker-localization.service.js +36 -0
  185. package/dist/npm/colorpicker/localization/localized-colorpicker-messages.directive.js +1 -1
  186. package/dist/npm/colorpicker/localization/messages.js +36 -0
  187. package/dist/npm/colorpicker/models/{color-picker-view.js → actions-layout.js} +0 -0
  188. package/dist/npm/colorpicker/models/colorpicker-view.js +6 -0
  189. package/dist/npm/colorpicker/{utils → models}/palette-presets.js +0 -0
  190. package/dist/npm/colorpicker/models.js +1 -2
  191. package/dist/npm/colorpicker/services/flatcolorpicker.service.js +43 -0
  192. package/dist/npm/colorpicker/utils/color-parser.js +18 -5
  193. package/dist/npm/colorpicker/utils/contrast-curve.js +93 -0
  194. package/dist/npm/colorpicker/utils.js +1 -1
  195. package/dist/npm/colorpicker.module.js +9 -1
  196. package/dist/npm/common/models/fillmode.js +6 -0
  197. package/dist/npm/common/models/rounded.js +6 -0
  198. package/dist/npm/common/models/size.js +6 -0
  199. package/dist/npm/common/models/styling-classes.js +6 -0
  200. package/dist/npm/common/models.js +6 -0
  201. package/dist/npm/common/utils.js +37 -0
  202. package/dist/npm/index.js +10 -0
  203. package/dist/npm/main.js +7 -4
  204. package/dist/npm/maskedtextbox/maskedtextbox.component.js +100 -5
  205. package/dist/npm/numerictextbox/numerictextbox.component.js +115 -19
  206. package/dist/npm/package-metadata.js +1 -1
  207. package/dist/npm/radiobutton/radiobutton.directive.js +51 -2
  208. package/dist/npm/shared/textarea.directive.js +3 -2
  209. package/dist/npm/shared/utils.js +25 -0
  210. package/dist/npm/switch/switch.component.js +166 -20
  211. package/dist/npm/text-fields-common/text-fields-base.js +1 -1
  212. package/dist/npm/textarea/textarea.component.js +100 -4
  213. package/dist/npm/textbox/textbox.component.js +113 -14
  214. package/dist/npm/textbox/textbox.directive.js +3 -2
  215. package/dist/npm/textbox.module.js +0 -3
  216. package/dist/systemjs/kendo-angular-inputs.js +1 -1
  217. package/package.json +15 -12
  218. package/dist/es/colorpicker/models/preventable-event.js +0 -29
  219. package/dist/es/textbox/floating-label-input-adapter.js +0 -58
  220. package/dist/es/textbox/textbox-container.component.js +0 -224
  221. package/dist/es2015/colorpicker/models/preventable-event.d.ts +0 -21
  222. package/dist/es2015/colorpicker/models/preventable-event.js +0 -27
  223. package/dist/es2015/textbox/floating-label-input-adapter.d.ts +0 -20
  224. package/dist/es2015/textbox/floating-label-input-adapter.js +0 -52
  225. package/dist/es2015/textbox/textbox-container.component.d.ts +0 -59
  226. package/dist/es2015/textbox/textbox-container.component.js +0 -209
  227. package/dist/npm/colorpicker/models/preventable-event.js +0 -31
  228. package/dist/npm/textbox/floating-label-input-adapter.js +0 -60
  229. package/dist/npm/textbox/textbox-container.component.js +0 -226
@@ -6,17 +6,22 @@ import * as tslib_1 from "tslib";
6
6
  import { Component, Input, Output, EventEmitter, ElementRef, HostBinding, ViewChild, Renderer2 } from '@angular/core';
7
7
  import { getRGBA, parseColor, getColorFromRGBA } from './utils';
8
8
  import { isPresent } from '../common/utils';
9
- import { isDocumentAvailable } from '@progress/kendo-angular-common';
10
- import { LocalizationService } from '@progress/kendo-angular-l10n';
9
+ import { guid, isDocumentAvailable } from '@progress/kendo-angular-common';
11
10
  import { Subscription } from 'rxjs';
11
+ import { LocalizationService } from '@progress/kendo-angular-l10n';
12
+ import { NumericTextBoxComponent } from './../numerictextbox/numerictextbox.component';
12
13
  /**
13
14
  * @hidden
14
15
  */
15
16
  let ColorInputComponent = class ColorInputComponent {
16
- constructor(localization, host, renderer) {
17
- this.localization = localization;
17
+ constructor(host, renderer, localizationService) {
18
18
  this.host = host;
19
19
  this.renderer = renderer;
20
+ this.localizationService = localizationService;
21
+ /**
22
+ * The id of the hex input.
23
+ */
24
+ this.focusableId = `k-${guid()}`;
20
25
  /**
21
26
  * Sets whether the alpha slider will be shown.
22
27
  */
@@ -66,11 +71,14 @@ let ColorInputComponent = class ColorInputComponent {
66
71
  }
67
72
  ngOnChanges(changes) {
68
73
  if (isPresent(changes.value) && !this.isFocused) {
69
- this.hex = parseColor(this.value, 'hex');
74
+ this.hex = parseColor(this.value, 'hex', this.opacity);
70
75
  this.rgba = getRGBA(this.value);
71
- this.rgba.a = parseColor(this.value, 'rgba') ? this.rgba.a : 1;
76
+ this.rgba.a = parseColor(this.value, 'rgba', this.opacity) ? this.rgba.a : 1;
72
77
  }
73
78
  }
79
+ get formatButtonTitle() {
80
+ return this.localizationService.get('formatButton');
81
+ }
74
82
  handleRgbaValueChange() {
75
83
  const color = getColorFromRGBA(this.rgba);
76
84
  if (!this.rgbaInputValid || color === this.value) {
@@ -78,12 +86,12 @@ let ColorInputComponent = class ColorInputComponent {
78
86
  }
79
87
  this.value = color;
80
88
  this.rgba = getRGBA(this.value);
81
- this.hex = parseColor(color, 'hex');
89
+ this.hex = parseColor(color, 'hex', this.opacity);
82
90
  this.valueChange.emit(color);
83
91
  }
84
92
  handleHexValueChange(hex) {
85
93
  this.hex = hex;
86
- const color = parseColor(hex, 'rgba');
94
+ const color = parseColor(hex, 'rgba', this.opacity);
87
95
  if (!isPresent(color) || color === this.value) {
88
96
  return;
89
97
  }
@@ -97,10 +105,7 @@ let ColorInputComponent = class ColorInputComponent {
97
105
  }
98
106
  }
99
107
  handleHexInputBlur() {
100
- this.hex = parseColor(this.value, 'hex');
101
- }
102
- textFor(key) {
103
- return this.localization.get(key);
108
+ this.hex = parseColor(this.value, 'hex', this.opacity);
104
109
  }
105
110
  toggleFormatView() {
106
111
  this.formatView = this.formatView === 'hex' ? 'rgba' : 'hex';
@@ -112,6 +117,10 @@ let ColorInputComponent = class ColorInputComponent {
112
117
  this.subscriptions.add(this.renderer.listen(this.toggleFormatButton.nativeElement, 'click', () => this.toggleFormatView()));
113
118
  }
114
119
  };
120
+ tslib_1.__decorate([
121
+ Input(),
122
+ tslib_1.__metadata("design:type", String)
123
+ ], ColorInputComponent.prototype, "focusableId", void 0);
115
124
  tslib_1.__decorate([
116
125
  Input(),
117
126
  tslib_1.__metadata("design:type", String)
@@ -142,9 +151,17 @@ tslib_1.__decorate([
142
151
  tslib_1.__metadata("design:type", Boolean)
143
152
  ], ColorInputComponent.prototype, "colorInputClass", void 0);
144
153
  tslib_1.__decorate([
145
- ViewChild('opacityInput', { read: ElementRef, static: false }),
146
- tslib_1.__metadata("design:type", ElementRef)
154
+ ViewChild('opacityInput', { static: false }),
155
+ tslib_1.__metadata("design:type", NumericTextBoxComponent)
147
156
  ], ColorInputComponent.prototype, "opacityInput", void 0);
157
+ tslib_1.__decorate([
158
+ ViewChild('hexInput', { read: ElementRef, static: false }),
159
+ tslib_1.__metadata("design:type", ElementRef)
160
+ ], ColorInputComponent.prototype, "hexInput", void 0);
161
+ tslib_1.__decorate([
162
+ ViewChild('blueInput', { read: ElementRef, static: false }),
163
+ tslib_1.__metadata("design:type", ElementRef)
164
+ ], ColorInputComponent.prototype, "blueInput", void 0);
148
165
  tslib_1.__decorate([
149
166
  ViewChild('toggleFormatButton', { static: false }),
150
167
  tslib_1.__metadata("design:type", ElementRef)
@@ -154,20 +171,27 @@ ColorInputComponent = tslib_1.__decorate([
154
171
  selector: 'kendo-colorinput',
155
172
  template: `
156
173
  <div class="k-vstack">
157
- <button class="k-colorgradient-toggle-mode k-button k-icon-button k-flat" #toggleFormatButton>
174
+ <button #toggleFormatButton
175
+ class="k-colorgradient-toggle-mode k-button k-button-md k-button-flat k-button-flat-base k-icon-button"
176
+ [attr.aria-label]="formatButtonTitle"
177
+ [attr.title]="formatButtonTitle"
178
+ >
158
179
  <span class="k-button-icon k-icon k-i-arrows-kpi"></span>
159
180
  </button>
160
181
  </div>
161
- <input *ngIf="formatView === 'hex'"
162
- #hexInput
163
- class="k-textbox k-hex-value"
164
- [disabled]="disabled"
165
- [readonly]="readonly"
166
- [value]="hex || ''"
167
- [placeholder]="textFor('hexInputPlaceholder')"
168
- (blur)="handleHexInputBlur()"
169
- (input)="handleHexValueChange(hexInput.value)"
170
- />
182
+ <div *ngIf="formatView === 'hex'" class="k-vstack">
183
+ <input
184
+ #hexInput
185
+ [id]="focusableId"
186
+ class="k-textbox k-hex-value"
187
+ [disabled]="disabled"
188
+ [readonly]="readonly"
189
+ [value]="hex || ''"
190
+ (blur)="handleHexInputBlur()"
191
+ (input)="handleHexValueChange(hexInput.value)"
192
+ />
193
+ <label [for]="focusableId" class="k-colorgradient-input-label">HEX</label>
194
+ </div>
171
195
  <ng-container *ngIf="formatView === 'rgba'">
172
196
  <div class="k-vstack">
173
197
  <kendo-numerictextbox
@@ -176,7 +200,6 @@ ColorInputComponent = tslib_1.__decorate([
176
200
  [readonly]="readonly"
177
201
  [min]="0"
178
202
  [max]="255"
179
- [placeholder]="textFor('redInputPlaceholder')"
180
203
  [(value)]="rgba.r"
181
204
  [autoCorrect]="true"
182
205
  [spinners]="false"
@@ -194,7 +217,6 @@ ColorInputComponent = tslib_1.__decorate([
194
217
  [readonly]="readonly"
195
218
  [min]="0"
196
219
  [max]="255"
197
- [placeholder]="textFor('greenInputPlaceholder')"
198
220
  [(value)]="rgba.g"
199
221
  [autoCorrect]="true"
200
222
  [spinners]="false"
@@ -212,7 +234,6 @@ ColorInputComponent = tslib_1.__decorate([
212
234
  [readonly]="readonly"
213
235
  [min]="0"
214
236
  [max]="255"
215
- [placeholder]="textFor('blueInputPlaceholder')"
216
237
  [(value)]="rgba.b"
217
238
  [autoCorrect]="true"
218
239
  [spinners]="false"
@@ -230,7 +251,6 @@ ColorInputComponent = tslib_1.__decorate([
230
251
  [readonly]="readonly"
231
252
  [min]="0"
232
253
  [max]="1"
233
- [placeholder]="textFor('alphaInputPlaceholder')"
234
254
  [(value)]="rgba.a"
235
255
  [autoCorrect]="true"
236
256
  [spinners]="false"
@@ -245,8 +265,8 @@ ColorInputComponent = tslib_1.__decorate([
245
265
  </ng-container>
246
266
  `
247
267
  }),
248
- tslib_1.__metadata("design:paramtypes", [LocalizationService,
249
- ElementRef,
250
- Renderer2])
268
+ tslib_1.__metadata("design:paramtypes", [ElementRef,
269
+ Renderer2,
270
+ LocalizationService])
251
271
  ], ColorInputComponent);
252
272
  export { ColorInputComponent };
@@ -12,7 +12,7 @@ import { LocalizationService } from '@progress/kendo-angular-l10n';
12
12
  * The ColorPalette is independently used by `kendo-colorpicker` and can be directly added to the page.
13
13
  */
14
14
  export declare class ColorPaletteComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges, ControlValueAccessor {
15
- private host;
15
+ host: ElementRef;
16
16
  private service;
17
17
  private cdr;
18
18
  private renderer;
@@ -132,6 +132,10 @@ export declare class ColorPaletteComponent implements OnInit, AfterViewInit, OnD
132
132
  * @hidden
133
133
  */
134
134
  focusInComponent: boolean;
135
+ /**
136
+ * @hidden
137
+ */
138
+ uniqueId: string;
135
139
  private selection;
136
140
  private _value;
137
141
  private _columns;
@@ -154,7 +158,7 @@ export declare class ColorPaletteComponent implements OnInit, AfterViewInit, OnD
154
158
  /**
155
159
  * @hidden
156
160
  */
157
- handleCellSelection(value: string, cell?: TableCell): void;
161
+ handleCellSelection(value: string, focusedCell?: TableCell): void;
158
162
  /**
159
163
  * @hidden
160
164
  */
@@ -173,13 +177,14 @@ export declare class ColorPaletteComponent implements OnInit, AfterViewInit, OnD
173
177
  setDisabledState(isDisabled: boolean): void;
174
178
  /**
175
179
  * @hidden
176
- * Used by the TextBoxContainer to determine if the component is empty.
180
+ * Used by the FloatingLabel to determine if the component is empty.
177
181
  */
178
182
  isEmpty(): boolean;
179
183
  /**
180
184
  * Clears the color value of the ColorPalette.
181
185
  */
182
186
  reset(): void;
187
+ private handleValueChange;
183
188
  private handleCellFocusOnBlur;
184
189
  private setRows;
185
190
  private handleCellNavigation;
@@ -6,10 +6,11 @@ import * as tslib_1 from "tslib";
6
6
  var ColorPaletteComponent_1;
7
7
  import { Component, Input, EventEmitter, Output, HostBinding, HostListener, forwardRef, ChangeDetectorRef, Renderer2, ElementRef } from '@angular/core';
8
8
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
9
- import { PALETTEPRESETS, parseColor } from './utils';
9
+ import { PALETTEPRESETS } from './models';
10
+ import { parseColor } from './utils';
10
11
  import { isPresent } from '../common/utils';
11
12
  import { ColorPaletteService } from './services/color-palette.service';
12
- import { Keys, KendoInput } from '@progress/kendo-angular-common';
13
+ import { Keys, KendoInput, guid } from '@progress/kendo-angular-common';
13
14
  import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
14
15
  import { ColorPaletteLocalizationService } from './localization/colorpalette-localization.service';
15
16
  const DEFAULT_TILE_SIZE = 24;
@@ -77,6 +78,10 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
77
78
  * @hidden
78
79
  */
79
80
  this.hostClasses = true;
81
+ /**
82
+ * @hidden
83
+ */
84
+ this.uniqueId = guid();
80
85
  this._tabindex = 0;
81
86
  this.notifyNgTouched = () => { };
82
87
  this.notifyNgChanged = () => { };
@@ -127,7 +132,7 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
127
132
  value = PALETTEPRESETS[value].colors;
128
133
  }
129
134
  const colors = (typeof value === 'string') ? value.split(',') : value;
130
- this._palette = colors.map(color => parseColor(color, this.format, false));
135
+ this._palette = colors.map(color => parseColor(color, this.format, false, false));
131
136
  }
132
137
  get palette() {
133
138
  return this._palette;
@@ -230,27 +235,22 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
230
235
  /**
231
236
  * @hidden
232
237
  */
233
- handleCellSelection(value, cell) {
238
+ handleCellSelection(value, focusedCell) {
234
239
  if (this.readonly) {
235
240
  return;
236
241
  }
237
- this.selectedCell = cell;
242
+ this.selectedCell = focusedCell;
238
243
  this.focusedCell = this.selectedCell;
239
244
  this.focusInComponent = true;
240
- const parsedColor = parseColor(value, this.format, false);
245
+ const parsedColor = parseColor(value, this.format, false, false);
241
246
  this.cellSelection.emit(parsedColor);
242
- if (this.value !== parsedColor) {
243
- this.value = parsedColor;
244
- this.valueChange.emit(parsedColor);
245
- this.notifyNgChanged(parsedColor);
246
- this.setHostElementAriaLabel();
247
- }
247
+ this.handleValueChange(parsedColor);
248
248
  if (this.selection !== parsedColor) {
249
249
  this.selection = parsedColor;
250
250
  this.selectionChange.emit(parsedColor);
251
251
  }
252
- if (cell) {
253
- this.activeCellId = `${this.selectedCell.row}-${this.selectedCell.col}`;
252
+ if (focusedCell) {
253
+ this.activeCellId = `k-${this.selectedCell.row}-${this.selectedCell.col}-${this.uniqueId}`;
254
254
  }
255
255
  }
256
256
  /**
@@ -281,7 +281,7 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
281
281
  }
282
282
  /**
283
283
  * @hidden
284
- * Used by the TextBoxContainer to determine if the component is empty.
284
+ * Used by the FloatingLabel to determine if the component is empty.
285
285
  */
286
286
  isEmpty() {
287
287
  return false;
@@ -292,9 +292,18 @@ let ColorPaletteComponent = ColorPaletteComponent_1 = class ColorPaletteComponen
292
292
  reset() {
293
293
  this.focusedCell = null;
294
294
  if (isPresent(this.value)) {
295
- this._value = undefined;
296
- this.notifyNgChanged(undefined);
295
+ this.handleValueChange(undefined);
297
296
  }
297
+ this.selectedCell = undefined;
298
+ }
299
+ handleValueChange(color) {
300
+ if (this.value === color) {
301
+ return;
302
+ }
303
+ this.value = color;
304
+ this.valueChange.emit(color);
305
+ this.notifyNgChanged(color);
306
+ this.setHostElementAriaLabel();
298
307
  }
299
308
  handleCellFocusOnBlur() {
300
309
  this.focusInComponent = false;
@@ -421,6 +430,7 @@ tslib_1.__decorate([
421
430
  ], ColorPaletteComponent.prototype, "handleHostBlur", null);
422
431
  ColorPaletteComponent = ColorPaletteComponent_1 = tslib_1.__decorate([
423
432
  Component({
433
+ exportAs: 'kendoColorPalette',
424
434
  selector: 'kendo-colorpalette',
425
435
  providers: [
426
436
  {
@@ -459,7 +469,7 @@ ColorPaletteComponent = ColorPaletteComponent_1 = tslib_1.__decorate([
459
469
  [attr.aria-selected]="selectedCell?.row === rowIndex && selectedCell?.col === colIndex"
460
470
  [attr.aria-label]="color"
461
471
  class="k-colorpalette-tile"
462
- [id]="rowIndex + '-' + colIndex"
472
+ [id]="'k-' + rowIndex + '-' + colIndex + '-' + uniqueId"
463
473
  [attr.value]="color"
464
474
  (click)="handleCellSelection(color, { row: rowIndex, col: colIndex })"
465
475
  [ngStyle]="{
@@ -2,55 +2,65 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { EventEmitter, OnDestroy, ViewContainerRef, ChangeDetectorRef, NgZone } from '@angular/core';
5
+ import { EventEmitter, ElementRef, OnDestroy, ViewContainerRef, ChangeDetectorRef, NgZone, OnChanges, OnInit, AfterViewInit, Renderer2 } from '@angular/core';
6
6
  import { ControlValueAccessor } from '@angular/forms';
7
7
  import { PopupService } from '@progress/kendo-angular-popup';
8
- import { PopupSettings, PreventableEvent, PaletteSettings, OutputFormat, ActiveColorClickEvent, ColorPickerView, GradientSettings } from './models';
9
8
  import { LocalizationService } from '@progress/kendo-angular-l10n';
9
+ import { PopupSettings, PaletteSettings, OutputFormat, ColorPickerView, GradientSettings, ColorPickerActionsLayout } from './models';
10
+ import { ActiveColorClickEvent, ColorPickerCancelEvent, ColorPickerCloseEvent, ColorPickerOpenEvent } from './events';
11
+ import { InputFillMode, InputRounded, InputSize } from '../common/models';
10
12
  /**
11
13
  * Represents the [Kendo UI ColorPicker component for Angular]({% slug overview_colorpicker %}).
12
- * Designed to replace the `<input type="color">` HTML5 tag which is not widely supported in browsers.
14
+ *
15
+ * The ColorPicker is a powerful tool for choosing colors from Gradient and Palette views
16
+ * which are rendered in its popup. It supports previewing the selected color, reverting it to its previous state or clearing it completely.
13
17
  */
14
- export declare class ColorPickerComponent implements OnDestroy, ControlValueAccessor {
18
+ export declare class ColorPickerComponent implements OnInit, AfterViewInit, OnChanges, OnDestroy, ControlValueAccessor {
19
+ private host;
15
20
  private popupService;
16
21
  private cdr;
17
22
  private localizationService;
18
23
  private ngZone;
19
- /**
20
- * @hidden
21
- */
24
+ private renderer;
22
25
  hostClasses: boolean;
23
- /**
24
- * @hidden
25
- */
26
26
  direction: string;
27
27
  /**
28
28
  * @hidden
29
29
  */
30
30
  focusableId: string;
31
31
  /**
32
- * Sets what view the ColorPicker will render in the popup.
32
+ * Specifies the views that will be rendered in the popup.
33
+ * By default both the gradient and palette views will be rendered.
33
34
  */
34
- view: ColorPickerView;
35
+ views: Array<ColorPickerView>;
36
+ /**
37
+ * Sets the initially active view in the popup. The property supports two-way binding.
38
+ *
39
+ * The supported values are:
40
+ * * `gradient`
41
+ * * `palette`
42
+ */
43
+ activeView: ColorPickerView;
35
44
  /**
36
45
  * Sets the read-only state of the ColorPicker.
46
+ *
47
+ * @default false
37
48
  */
38
49
  readonly: boolean;
39
50
  /**
40
51
  * Sets the disabled state of the ColorPicker.
52
+ *
53
+ * @default false
41
54
  */
42
55
  disabled: boolean;
43
56
  /**
44
57
  * Specifies the output format of the ColorPicker.
45
- * The input value may be in a different format. However, it will be parsed into the output `format`
46
- * after the component processes it.
47
58
  *
48
- * If the `gradient` view is used with the `opacity` option set to true, this setting will be ignored and `rgba` will be used instead.
59
+ * If the input value is in a different format, it will be parsed into the specified output `format`.
49
60
  *
50
61
  * The supported values are:
51
62
  * * `rgba` (default)
52
63
  * * `hex`
53
- * * [name](https://www.w3.org/wiki/CSS/Properties/color/keywords)
54
64
  */
55
65
  format: OutputFormat;
56
66
  /**
@@ -72,6 +82,7 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
72
82
  /**
73
83
  * Defines the name of an [existing icon in the Kendo UI theme]({% slug icons %}).
74
84
  * Provide only the name of the icon without the `k-icon` or the `k-i-` prefixes.
85
+ *
75
86
  * For example, `edit-tools` will be parsed to `k-icon k-i-edit-tools`.
76
87
  */
77
88
  icon: string;
@@ -84,10 +95,74 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
84
95
  iconClass: string | Array<string> | {
85
96
  [key: string]: boolean;
86
97
  };
98
+ /**
99
+ * Specifies whether the ColorPicker should display a 'Clear color' button.
100
+ *
101
+ * @default true
102
+ */
103
+ clearButton: boolean;
87
104
  /**
88
105
  * Specifies the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
106
+ *
107
+ * @default 0
89
108
  */
90
109
  tabindex: number;
110
+ /**
111
+ * Displays `Apply` and `Cancel` action buttons and color preview panes.
112
+ *
113
+ * When enabled, the component value will not change immediately upon
114
+ * color selection, but only after the `Apply` button is clicked.
115
+ *
116
+ * The `Cancel` button reverts the current selection to its
117
+ * previous state i.e. to the current value.
118
+ *
119
+ * @default false
120
+ */
121
+ preview: boolean;
122
+ /**
123
+ * Configures the layout of the `Apply` and `Cancel` action buttons.
124
+ *
125
+ * The possible values are:
126
+ * * `start`
127
+ * * `center`
128
+ * * `end` (default)
129
+ * * `stretch`
130
+ */
131
+ actionsLayout: ColorPickerActionsLayout;
132
+ /**
133
+ * The size property specifies the font size and line height of the ColorPicker
134
+ * ([see example]({% slug appearance_colorpicker %}#toc-size)).
135
+ *
136
+ * The possible values are:
137
+ * * `'small'`
138
+ * * `'medium'` (default)
139
+ * * `'large'`
140
+ * * `null`
141
+ */
142
+ size: InputSize;
143
+ /**
144
+ * The rounded property specifies the border radius of the ColorPicker
145
+ * ([see example]({% slug appearance_colorpicker %}#toc-rounded)).
146
+ *
147
+ * The possible values are:
148
+ * * `'small'`
149
+ * * `'medium'` (default)
150
+ * * `'large'`
151
+ * * `'full'`
152
+ * * `null`
153
+ */
154
+ rounded: InputRounded;
155
+ /**
156
+ * The fillMode property specifies the background and border styles of the ColorPicker
157
+ * ([see example]({% slug appearance_colorpicker %}#toc-fillMode)).
158
+ *
159
+ * The possible values are:
160
+ * * `'flat'`
161
+ * * `'solid'` (default)
162
+ * * `'outline'`
163
+ * * `null`
164
+ */
165
+ fillMode: InputFillMode;
91
166
  /**
92
167
  * Fires each time the value is changed.
93
168
  */
@@ -96,12 +171,12 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
96
171
  * Fires each time the popup is about to open.
97
172
  * This event is preventable. If you cancel it, the popup will remain closed.
98
173
  */
99
- open: EventEmitter<PreventableEvent>;
174
+ open: EventEmitter<ColorPickerOpenEvent>;
100
175
  /**
101
176
  * Fires each time the popup is about to close.
102
177
  * This event is preventable. If you cancel it, the popup will remain open.
103
178
  */
104
- close: EventEmitter<PreventableEvent>;
179
+ close: EventEmitter<ColorPickerCloseEvent>;
105
180
  /**
106
181
  * Fires each time ColorPicker is focused.
107
182
  */
@@ -110,6 +185,12 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
110
185
  * Fires each time the ColorPicker is blurred.
111
186
  */
112
187
  onBlur: EventEmitter<any>;
188
+ /**
189
+ * Fires when the user cancels the current color selection.
190
+ *
191
+ * Fires on preview pane or 'Cancel' button click.
192
+ */
193
+ cancel: EventEmitter<ColorPickerCancelEvent>;
113
194
  /**
114
195
  * Fires each time the left side of the ColorPicker wrapper is clicked.
115
196
  * The event is triggered regardless of whether a ColorPicker icon is set or not.
@@ -117,6 +198,11 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
117
198
  * The [ActiveColorClickEvent]({% slug api_inputs_activecolorclickevent %}) event provides the option to prevent the popup opening.
118
199
  */
119
200
  activeColorClick: EventEmitter<ActiveColorClickEvent>;
201
+ /**
202
+ * Fires each time the view is about to change.
203
+ * Used to provide a two-way binding for the `activeView` property.
204
+ */
205
+ activeViewChange: EventEmitter<string>;
120
206
  /**
121
207
  * Indicates whether the ColorPicker wrapper is focused.
122
208
  */
@@ -139,23 +225,34 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
139
225
  container: ViewContainerRef;
140
226
  private wrapper;
141
227
  private popupTemplate;
142
- private palette;
143
- private colorGradient;
228
+ private flatColorPicker;
144
229
  private popupRef;
145
230
  private _value;
146
231
  private _tabindex;
147
232
  private _popupSettings;
148
233
  private _paletteSettings;
149
234
  private _gradientSettings;
235
+ private _size;
236
+ private _rounded;
237
+ private _fillMode;
150
238
  private dynamicRTLSubscription;
151
- constructor(popupService: PopupService, cdr: ChangeDetectorRef, localizationService: LocalizationService, ngZone: NgZone);
239
+ constructor(host: ElementRef, popupService: PopupService, cdr: ChangeDetectorRef, localizationService: LocalizationService, ngZone: NgZone, renderer: Renderer2);
152
240
  ngOnInit(): void;
241
+ ngAfterViewInit(): void;
153
242
  ngOnChanges(changes: any): void;
154
243
  ngOnDestroy(): void;
155
244
  /**
156
245
  * @hidden
157
246
  */
158
- handleWrapperClick(): void;
247
+ readonly colorPickerAriaLabel: string;
248
+ /**
249
+ * @hidden
250
+ */
251
+ handleCancelEvent(ev: ColorPickerCancelEvent): void;
252
+ /**
253
+ * @hidden
254
+ */
255
+ togglePopup(): void;
159
256
  /**
160
257
  * @hidden
161
258
  */
@@ -177,7 +274,7 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
177
274
  */
178
275
  handleWrapperBlur(): void;
179
276
  /**
180
- * Clears the color value of the ColorPicker.
277
+ * Clears the value of the ColorPicker.
181
278
  */
182
279
  reset(): void;
183
280
  /**
@@ -190,7 +287,7 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
190
287
  /**
191
288
  * @hidden
192
289
  */
193
- handleValueChange(color: string, closePopup: boolean): void;
290
+ handleValueChange(color: string): void;
194
291
  /**
195
292
  * @hidden
196
293
  */
@@ -221,12 +318,17 @@ export declare class ColorPickerComponent implements OnDestroy, ControlValueAcce
221
318
  handlePopupKeyDown(event: any): void;
222
319
  /**
223
320
  * @hidden
224
- * Used by the TextBoxContainer to determine if the component is empty.
321
+ * Used by the FloatingLabel to determine if the component is empty.
225
322
  */
226
323
  isEmpty(): boolean;
324
+ private handleClasses;
325
+ private popupBlurInvalid;
227
326
  private toggleWithEvents;
327
+ private focusFirstElement;
228
328
  private openPopup;
229
329
  private closePopup;
330
+ private readonly firstFocusableElement;
331
+ private readonly lastFocusableElement;
230
332
  private notifyNgTouched;
231
333
  private notifyNgChanged;
232
334
  }