@progress/kendo-angular-inputs 21.4.1 → 22.0.0-develop.1

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 (189) hide show
  1. package/colorpicker/localization/messages.d.ts +1 -1
  2. package/common/radio-checkbox.base.d.ts +1 -1
  3. package/fesm2022/progress-kendo-angular-inputs.mjs +321 -321
  4. package/numerictextbox/localization/messages.d.ts +1 -1
  5. package/otpinput/localization/messages.d.ts +1 -1
  6. package/package.json +17 -25
  7. package/rangeslider/localization/messages.d.ts +1 -1
  8. package/signature/localization/messages.d.ts +1 -1
  9. package/slider/localization/messages.d.ts +1 -1
  10. package/sliders-common/slider-base.d.ts +1 -1
  11. package/switch/localization/messages.d.ts +1 -1
  12. package/text-fields-common/text-fields-base.d.ts +1 -1
  13. package/textbox/localization/messages.d.ts +1 -1
  14. package/esm2022/checkbox/checkbox.component.mjs +0 -227
  15. package/esm2022/checkbox/checkbox.directive.mjs +0 -96
  16. package/esm2022/checkbox/checked-state.mjs +0 -5
  17. package/esm2022/checkbox.module.mjs +0 -42
  18. package/esm2022/colorpicker/adaptiveness/adaptive-close-button.component.mjs +0 -62
  19. package/esm2022/colorpicker/adaptiveness/adaptive-renderer.component.mjs +0 -219
  20. package/esm2022/colorpicker/color-contrast-svg.component.mjs +0 -108
  21. package/esm2022/colorpicker/color-gradient-numeric-label.directive.mjs +0 -37
  22. package/esm2022/colorpicker/color-gradient-text-label.directive.mjs +0 -34
  23. package/esm2022/colorpicker/color-gradient.component.mjs +0 -1110
  24. package/esm2022/colorpicker/color-input.component.mjs +0 -498
  25. package/esm2022/colorpicker/color-palette.component.mjs +0 -629
  26. package/esm2022/colorpicker/colorpicker.component.mjs +0 -1315
  27. package/esm2022/colorpicker/constants.mjs +0 -40
  28. package/esm2022/colorpicker/contrast-validation.component.mjs +0 -83
  29. package/esm2022/colorpicker/contrast.component.mjs +0 -114
  30. package/esm2022/colorpicker/events/active-color-click-event.mjs +0 -55
  31. package/esm2022/colorpicker/events/cancel-event.mjs +0 -18
  32. package/esm2022/colorpicker/events/close-event.mjs +0 -10
  33. package/esm2022/colorpicker/events/kendo-drag-event.mjs +0 -5
  34. package/esm2022/colorpicker/events/open-event.mjs +0 -10
  35. package/esm2022/colorpicker/events.mjs +0 -8
  36. package/esm2022/colorpicker/flatcolorpicker-actions.component.mjs +0 -112
  37. package/esm2022/colorpicker/flatcolorpicker-header.component.mjs +0 -244
  38. package/esm2022/colorpicker/flatcolorpicker.component.mjs +0 -942
  39. package/esm2022/colorpicker/localization/colorgradient-localization.service.mjs +0 -46
  40. package/esm2022/colorpicker/localization/colorpalette-localization.service.mjs +0 -46
  41. package/esm2022/colorpicker/localization/colorpicker-localization.service.mjs +0 -31
  42. package/esm2022/colorpicker/localization/custom-messages.component.mjs +0 -51
  43. package/esm2022/colorpicker/localization/flatcolorpicker-localization.service.mjs +0 -46
  44. package/esm2022/colorpicker/localization/localized-colorpicker-messages.directive.mjs +0 -39
  45. package/esm2022/colorpicker/localization/messages.mjs +0 -201
  46. package/esm2022/colorpicker/models/actions-layout.mjs +0 -5
  47. package/esm2022/colorpicker/models/adaptive-mode.mjs +0 -8
  48. package/esm2022/colorpicker/models/colorpicker-view.mjs +0 -5
  49. package/esm2022/colorpicker/models/gradient-settings.mjs +0 -5
  50. package/esm2022/colorpicker/models/hsva.mjs +0 -5
  51. package/esm2022/colorpicker/models/output-format.mjs +0 -5
  52. package/esm2022/colorpicker/models/palette-presets.mjs +0 -62
  53. package/esm2022/colorpicker/models/palette-settings.mjs +0 -5
  54. package/esm2022/colorpicker/models/popup-settings.mjs +0 -5
  55. package/esm2022/colorpicker/models/rgb.mjs +0 -5
  56. package/esm2022/colorpicker/models/rgba.mjs +0 -5
  57. package/esm2022/colorpicker/models/table-cell.mjs +0 -5
  58. package/esm2022/colorpicker/models/tile-size.mjs +0 -5
  59. package/esm2022/colorpicker/models.mjs +0 -16
  60. package/esm2022/colorpicker/services/color-palette.service.mjs +0 -65
  61. package/esm2022/colorpicker/services/flatcolorpicker.service.mjs +0 -39
  62. package/esm2022/colorpicker/utils/color-parser.mjs +0 -164
  63. package/esm2022/colorpicker/utils/contrast-curve.mjs +0 -85
  64. package/esm2022/colorpicker/utils.mjs +0 -6
  65. package/esm2022/colorpicker.module.mjs +0 -50
  66. package/esm2022/common/dom-utils.mjs +0 -36
  67. package/esm2022/common/formservice.service.mjs +0 -21
  68. package/esm2022/common/math.mjs +0 -65
  69. package/esm2022/common/models/fillmode.mjs +0 -5
  70. package/esm2022/common/models/gutters.mjs +0 -5
  71. package/esm2022/common/models/responsive-breakpoints.mjs +0 -5
  72. package/esm2022/common/models/rounded.mjs +0 -5
  73. package/esm2022/common/models/size.mjs +0 -5
  74. package/esm2022/common/models/styling-classes.mjs +0 -5
  75. package/esm2022/common/models/type.mjs +0 -5
  76. package/esm2022/common/models.mjs +0 -9
  77. package/esm2022/common/radio-checkbox.base.mjs +0 -295
  78. package/esm2022/common/utils.mjs +0 -88
  79. package/esm2022/directives.mjs +0 -430
  80. package/esm2022/form/form.component.mjs +0 -163
  81. package/esm2022/form/formseparator.component.mjs +0 -80
  82. package/esm2022/form/utils.mjs +0 -147
  83. package/esm2022/form.module.mjs +0 -46
  84. package/esm2022/formfield/error.component.mjs +0 -70
  85. package/esm2022/formfield/formfield.component.mjs +0 -353
  86. package/esm2022/formfield/hint.component.mjs +0 -65
  87. package/esm2022/formfield/models/message-align.mjs +0 -5
  88. package/esm2022/formfield/models/orientation.mjs +0 -5
  89. package/esm2022/formfield/models/show-options.mjs +0 -5
  90. package/esm2022/formfield.module.mjs +0 -43
  91. package/esm2022/formfieldset/formfieldset.component.mjs +0 -174
  92. package/esm2022/index.mjs +0 -91
  93. package/esm2022/inputs.module.mjs +0 -91
  94. package/esm2022/maskedtextbox/maskedtextbox.component.mjs +0 -876
  95. package/esm2022/maskedtextbox/masking.service.mjs +0 -189
  96. package/esm2022/maskedtextbox/parsing/combinators.mjs +0 -28
  97. package/esm2022/maskedtextbox/parsing/parsers.mjs +0 -148
  98. package/esm2022/maskedtextbox/parsing/result.mjs +0 -44
  99. package/esm2022/maskedtextbox/parsing/stream.mjs +0 -43
  100. package/esm2022/maskedtextbox.module.mjs +0 -43
  101. package/esm2022/numerictextbox/arrow-direction.mjs +0 -13
  102. package/esm2022/numerictextbox/constants.mjs +0 -28
  103. package/esm2022/numerictextbox/localization/custom-messages.component.mjs +0 -55
  104. package/esm2022/numerictextbox/localization/localized-numerictextbox-messages.directive.mjs +0 -39
  105. package/esm2022/numerictextbox/localization/messages.mjs +0 -33
  106. package/esm2022/numerictextbox/numerictextbox.component.mjs +0 -1314
  107. package/esm2022/numerictextbox/utils.mjs +0 -92
  108. package/esm2022/numerictextbox.module.mjs +0 -46
  109. package/esm2022/otp.module.mjs +0 -44
  110. package/esm2022/otpinput/localization/custom-messages.component.mjs +0 -45
  111. package/esm2022/otpinput/localization/localized-textbox-messages.directive.mjs +0 -39
  112. package/esm2022/otpinput/localization/messages.mjs +0 -34
  113. package/esm2022/otpinput/models/otpinput-type.mjs +0 -5
  114. package/esm2022/otpinput/models/separator-icon.mjs +0 -5
  115. package/esm2022/otpinput/otpinput-separator.component.mjs +0 -93
  116. package/esm2022/otpinput/otpinput.component.mjs +0 -936
  117. package/esm2022/package-metadata.mjs +0 -16
  118. package/esm2022/progress-kendo-angular-inputs.mjs +0 -8
  119. package/esm2022/radiobutton/radiobutton.component.mjs +0 -212
  120. package/esm2022/radiobutton/radiobutton.directive.mjs +0 -81
  121. package/esm2022/radiobutton.module.mjs +0 -43
  122. package/esm2022/rangeslider/localization/custom-messages.component.mjs +0 -53
  123. package/esm2022/rangeslider/localization/localized-rangeslider-messages.directive.mjs +0 -39
  124. package/esm2022/rangeslider/localization/messages.mjs +0 -33
  125. package/esm2022/rangeslider/rangeslider-model.mjs +0 -53
  126. package/esm2022/rangeslider/rangeslider-value.type.mjs +0 -5
  127. package/esm2022/rangeslider/rangeslider.component.mjs +0 -625
  128. package/esm2022/rangeslider.module.mjs +0 -46
  129. package/esm2022/rating/directives/rating-hovered-item.directive.mjs +0 -35
  130. package/esm2022/rating/directives/rating-item.directive.mjs +0 -34
  131. package/esm2022/rating/directives/rating-selected-item.directive.mjs +0 -36
  132. package/esm2022/rating/models/precision.mjs +0 -5
  133. package/esm2022/rating/models/rating-item.interface.mjs +0 -5
  134. package/esm2022/rating/models/selection.mjs +0 -5
  135. package/esm2022/rating/rating.component.mjs +0 -754
  136. package/esm2022/rating.module.mjs +0 -46
  137. package/esm2022/shared/input-separator.component.mjs +0 -55
  138. package/esm2022/shared/input-spacer.component.mjs +0 -56
  139. package/esm2022/shared/shared-events.directive.mjs +0 -102
  140. package/esm2022/shared/utils.mjs +0 -13
  141. package/esm2022/signature/events/close-event.mjs +0 -10
  142. package/esm2022/signature/events/index.mjs +0 -6
  143. package/esm2022/signature/events/open-event.mjs +0 -10
  144. package/esm2022/signature/localization/custom-messages.component.mjs +0 -43
  145. package/esm2022/signature/localization/index.mjs +0 -7
  146. package/esm2022/signature/localization/localized-signature-messages.directive.mjs +0 -39
  147. package/esm2022/signature/localization/messages.mjs +0 -45
  148. package/esm2022/signature/signature.component.mjs +0 -981
  149. package/esm2022/signature.module.mjs +0 -47
  150. package/esm2022/slider/localization/custom-messages.component.mjs +0 -43
  151. package/esm2022/slider/localization/localized-slider-messages.directive.mjs +0 -39
  152. package/esm2022/slider/localization/messages.mjs +0 -39
  153. package/esm2022/slider/slider-model.mjs +0 -32
  154. package/esm2022/slider/slider.component.mjs +0 -671
  155. package/esm2022/slider.module.mjs +0 -48
  156. package/esm2022/sliders-common/label-template.directive.mjs +0 -37
  157. package/esm2022/sliders-common/slider-base.mjs +0 -300
  158. package/esm2022/sliders-common/slider-model.base.mjs +0 -118
  159. package/esm2022/sliders-common/slider-ticks.component.mjs +0 -147
  160. package/esm2022/sliders-common/sliders-util.mjs +0 -206
  161. package/esm2022/sliders-common/title-callback.mjs +0 -5
  162. package/esm2022/switch/events/blur-event.mjs +0 -13
  163. package/esm2022/switch/events/focus-event.mjs +0 -13
  164. package/esm2022/switch/localization/custom-messages.component.mjs +0 -43
  165. package/esm2022/switch/localization/localized-switch-messages.directive.mjs +0 -39
  166. package/esm2022/switch/localization/messages.mjs +0 -33
  167. package/esm2022/switch/switch.component.mjs +0 -585
  168. package/esm2022/switch.module.mjs +0 -44
  169. package/esm2022/text-fields-common/text-fields-base.mjs +0 -150
  170. package/esm2022/textarea/models/adornments-orientation.mjs +0 -5
  171. package/esm2022/textarea/models/flow.mjs +0 -5
  172. package/esm2022/textarea/models/resize.mjs +0 -5
  173. package/esm2022/textarea/models/textarea-settings.mjs +0 -5
  174. package/esm2022/textarea/textarea-prefix.component.mjs +0 -67
  175. package/esm2022/textarea/textarea-suffix.component.mjs +0 -67
  176. package/esm2022/textarea/textarea.component.mjs +0 -740
  177. package/esm2022/textarea/textarea.directive.mjs +0 -288
  178. package/esm2022/textarea.module.mjs +0 -46
  179. package/esm2022/textbox/localization/custom-messages.component.mjs +0 -43
  180. package/esm2022/textbox/localization/localized-textbox-messages.directive.mjs +0 -39
  181. package/esm2022/textbox/localization/messages.mjs +0 -27
  182. package/esm2022/textbox/models/icon-show-options.mjs +0 -5
  183. package/esm2022/textbox/textbox-prefix.directive.mjs +0 -50
  184. package/esm2022/textbox/textbox-suffix.directive.mjs +0 -49
  185. package/esm2022/textbox/textbox.component.mjs +0 -933
  186. package/esm2022/textbox/textbox.directive.mjs +0 -125
  187. package/esm2022/textbox.module.mjs +0 -51
  188. package/esm2022/validators/max.validator.mjs +0 -21
  189. package/esm2022/validators/min.validator.mjs +0 -21
@@ -1,1110 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /* eslint-disable @typescript-eslint/no-explicit-any */
6
- import { Component, Input, ViewChild, ElementRef, Renderer2, NgZone, Output, EventEmitter, HostBinding, forwardRef, ChangeDetectorRef, Injector, HostListener } from '@angular/core';
7
- import { NgControl, NG_VALUE_ACCESSOR } from '@angular/forms';
8
- import { BehaviorSubject, Subject } from 'rxjs';
9
- import { take, throttleTime } from 'rxjs/operators';
10
- import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
11
- import { DraggableDirective, isChanged, isDocumentAvailable, KendoInput } from '@progress/kendo-angular-common';
12
- import { validatePackage } from '@progress/kendo-licensing';
13
- import { containsFocus, isUntouched } from '../common/dom-utils';
14
- import { parseColor, getHSV, getColorFromHSV, getColorFromHue } from './utils';
15
- import { isPresent, fitIntoBounds, getStylingClasses } from '../common/utils';
16
- import { SliderComponent } from '../slider/slider.component';
17
- import { ColorGradientLocalizationService } from './localization/colorgradient-localization.service';
18
- import { ColorInputComponent } from './color-input.component';
19
- import { DEFAULT_GRADIENT_BACKGROUND_COLOR, DEFAULT_OUTPUT_FORMAT, DRAGHANDLE_MOVE_SPEED, DRAGHANDLE_MOVE_SPEED_SMALL_STEP } from './constants';
20
- import { packageMetadata } from '../package-metadata';
21
- import { dropletSlashIcon } from '@progress/kendo-svg-icons';
22
- import { ContrastComponent } from './contrast.component';
23
- import { ColorContrastSvgComponent } from './color-contrast-svg.component';
24
- import { NgClass } from '@angular/common';
25
- import { LocalizedColorPickerMessagesDirective } from './localization/localized-colorpicker-messages.directive';
26
- import { ButtonComponent } from '@progress/kendo-angular-buttons';
27
- import * as i0 from "@angular/core";
28
- import * as i1 from "@progress/kendo-angular-l10n";
29
- let serial = 0;
30
- const DEFAULT_SIZE = 'medium';
31
- /**
32
- * Represents the Kendo UI ColorGradient component.
33
- *
34
- * The ColorGradientComponent lets you select a color by moving a drag handle over a gradient area. You can use it directly or as part of the `kendo-colorpicker`.
35
- *
36
- * @example
37
- * ```html
38
- * <kendo-colorgradient [(ngModel)]="color"></kendo-colorgradient>
39
- * ```
40
- *
41
- * @remarks
42
- * Supported children components are: {@link ColorPickerMessages}.
43
- */
44
- export class ColorGradientComponent {
45
- host;
46
- ngZone;
47
- renderer;
48
- cdr;
49
- localizationService;
50
- injector;
51
- hostClasses = true;
52
- get readonlyAttribute() {
53
- return this.ariaAttributesEnabled ? this.readonly : undefined;
54
- }
55
- get disabledClass() {
56
- return this.disabled;
57
- }
58
- get gradientId() {
59
- return this.id;
60
- }
61
- direction;
62
- get hostTabindex() {
63
- return this.tabindex?.toString() || '0';
64
- }
65
- get ariaRole() {
66
- return this.ariaAttributesEnabled ? 'textbox' : undefined;
67
- }
68
- get isControlInvalid() {
69
- return this.ariaAttributesEnabled ? (this.control?.invalid)?.toString() : undefined;
70
- }
71
- get isDisabled() {
72
- return this.disabled?.toString() || undefined;
73
- }
74
- /**
75
- * @hidden
76
- */
77
- enterHandler(event) {
78
- if (event.target !== this.host.nativeElement) {
79
- return;
80
- }
81
- this.internalNavigation = true;
82
- this.gradientDragHandle.nativeElement.focus();
83
- }
84
- /**
85
- * @hidden
86
- */
87
- escapeHandler(event) {
88
- if (!this.host.nativeElement.matches(':focus')) {
89
- event.stopImmediatePropagation();
90
- }
91
- this.internalNavigation = false;
92
- this.host.nativeElement.focus();
93
- }
94
- /**
95
- * @hidden
96
- */
97
- focusHandler(ev) {
98
- this.internalNavigation = ev.target !== this.host.nativeElement;
99
- }
100
- /**
101
- * @hidden
102
- */
103
- adaptiveMode = false;
104
- /**
105
- * @hidden
106
- */
107
- id = `k-colorgradient-${serial++}`;
108
- /**
109
- * Shows or hides the alpha slider.
110
- *
111
- * @default true
112
- */
113
- opacity = true;
114
- /**
115
- * Sets the size of the ColorGradient internal elements.
116
- *
117
- * @default 'medium'
118
- */
119
- set size(size) {
120
- const newSize = size || DEFAULT_SIZE;
121
- this.handleClasses(newSize, 'size');
122
- this._size = newSize;
123
- }
124
- get size() {
125
- return this._size;
126
- }
127
- /**
128
- * Disables the ColorGradient. To disable it in reactive forms, see [Forms Support](slug:formssupport_colorgradient#toc-managing-the-colorgradient-disabled-state-in-reactive-forms).
129
- *
130
- * @default false
131
- */
132
- disabled = false;
133
- /**
134
- * Sets the read-only state of the ColorGradient.
135
- *
136
- * @default false
137
- */
138
- readonly = false;
139
- /**
140
- * Shows or hides the **Clear color** button.
141
- *
142
- * @default false
143
- */
144
- clearButton = false;
145
- /**
146
- * Sets the delay (in milliseconds) before the value changes on handle drag.
147
- *
148
- * @default 0
149
- */
150
- delay = 0;
151
- /**
152
- * Sets the value of the selected color.
153
- */
154
- set value(value) {
155
- this._value = parseColor(value, this.format, this.opacity);
156
- }
157
- get value() {
158
- return this._value;
159
- }
160
- /**
161
- * Enables the color contrast tool that checks the contrast ratio of the selected color against a predefined background color. [See example](slug:contrasttool_colorgradient).
162
- */
163
- set contrastTool(value) {
164
- this._contrastTool = parseColor(value, this.format, this.opacity);
165
- }
166
- get contrastTool() {
167
- return this._contrastTool;
168
- }
169
- /**
170
- * Sets the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
171
- *
172
- * @default 0
173
- */
174
- set tabindex(value) {
175
- if (isPresent(value)) {
176
- const tabindex = Number(value);
177
- this._tabindex = !isNaN(tabindex) ? tabindex : 0;
178
- }
179
- else {
180
- // Allows removal of the tabindex attribute
181
- this._tabindex = value;
182
- }
183
- }
184
- get tabindex() {
185
- return !this.disabled ? this._tabindex : undefined;
186
- }
187
- /**
188
- * Sets the output format of the ColorGradient. The input value may be in a different format, but it will be parsed into the output format after the component processes it.
189
- *
190
- * @default 'rgba'
191
- */
192
- format = DEFAULT_OUTPUT_FORMAT;
193
- /**
194
- * Fires when the user selects a new color..
195
- */
196
- valueChange = new EventEmitter();
197
- /**
198
- * @hidden
199
- */
200
- backgroundColor = DEFAULT_GRADIENT_BACKGROUND_COLOR;
201
- /**
202
- * @hidden
203
- *
204
- * Represents the currently selected `hue`, `saturation`, `value`, and `alpha` values.
205
- * The values are initially set in `ngOnInit` or in `ngOnChanges` and are
206
- * updated on moving the drag handle or the sliders.
207
- */
208
- hsva = new BehaviorSubject({});
209
- /**
210
- * Returns `true` if the component or its content is focused.
211
- */
212
- get isFocused() {
213
- if (!(isDocumentAvailable() && isPresent(this.host))) {
214
- return false;
215
- }
216
- return this.host.nativeElement === document.activeElement || this.host.nativeElement.contains(document.activeElement);
217
- }
218
- /**
219
- * @hidden
220
- */
221
- get alphaSliderValue() {
222
- // setting the initial value to undefined to force the slider to recalculate the height of the slider track on the next cdr run
223
- if (!(isPresent(this.hsva.value) && isPresent(this.hsva.value.a))) {
224
- return;
225
- }
226
- return this.hsva.value.a * 100;
227
- }
228
- /**
229
- * Sets the step (in pixels) for moving the gradient drag handle with the arrow keys.
230
- *
231
- * @default 5
232
- */
233
- gradientSliderStep = DRAGHANDLE_MOVE_SPEED;
234
- /**
235
- * Sets the step (in pixels) for moving the gradient drag handle with `Shift+arrow keys`.
236
- *
237
- * @default 2
238
- */
239
- gradientSliderSmallStep = DRAGHANDLE_MOVE_SPEED_SMALL_STEP;
240
- /**
241
- * Controls whether ARIA attributes should be applied to the component.
242
- * When used within FlatColorPicker, this should be set to false to comply with accessibility guidelines.
243
- *
244
- * @default true
245
- * @hidden
246
- */
247
- ariaAttributesEnabled = true;
248
- gradientDragHandle;
249
- inputs;
250
- alphaSlider;
251
- gradientWrapper;
252
- hsvRectangle;
253
- /**
254
- * @hidden
255
- */
256
- internalNavigation = false;
257
- /**
258
- * @hidden
259
- */
260
- dropletSlashIcon = dropletSlashIcon;
261
- _value;
262
- _tabindex = 0;
263
- _contrastTool;
264
- listeners = [];
265
- hueSliderTouched = false;
266
- alphaSliderTouched = false;
267
- _size = 'medium';
268
- updateValues = new Subject();
269
- changeRequestsSubscription;
270
- dynamicRTLSubscription;
271
- hsvHandleCoordinates = { x: 0, y: 0 };
272
- get gradientRect() {
273
- return this.gradientWrapper.nativeElement.getBoundingClientRect();
274
- }
275
- /**
276
- * @hidden
277
- */
278
- get hsvSliderValueText() {
279
- return `X: ${this.hsvHandleCoordinates.x} Y: ${this.hsvHandleCoordinates.y}`;
280
- }
281
- /**
282
- * @hidden
283
- */
284
- get contrastToolVisible() {
285
- return this.contrastTool && this.contrastTool.length > 0;
286
- }
287
- /**
288
- * @hidden
289
- */
290
- get innerTabIndex() {
291
- return this.internalNavigation ? 0 : -1;
292
- }
293
- control;
294
- constructor(host, ngZone, renderer, cdr, localizationService, injector) {
295
- this.host = host;
296
- this.ngZone = ngZone;
297
- this.renderer = renderer;
298
- this.cdr = cdr;
299
- this.localizationService = localizationService;
300
- this.injector = injector;
301
- validatePackage(packageMetadata);
302
- this.dynamicRTLSubscription = localizationService.changes.subscribe(({ rtl }) => {
303
- this.direction = rtl ? 'rtl' : 'ltr';
304
- });
305
- }
306
- ngOnInit() {
307
- this.control = this.injector.get(NgControl, null);
308
- }
309
- ngAfterViewInit() {
310
- const stylingInputs = ['size'];
311
- stylingInputs.forEach(input => {
312
- this.handleClasses(this[input], input);
313
- });
314
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
315
- this.updateUI();
316
- this.cdr.detectChanges();
317
- });
318
- this.addEventListeners();
319
- this.subscribeChanges();
320
- }
321
- ngOnChanges(changes) {
322
- if (isChanged('value', changes) && !this.isFocused) {
323
- this.updateUI();
324
- }
325
- if (isChanged('delay', changes)) {
326
- this.unsubscribeChanges();
327
- this.subscribeChanges();
328
- }
329
- }
330
- ngOnDestroy() {
331
- this.listeners.forEach(removeListener => removeListener());
332
- if (this.dynamicRTLSubscription) {
333
- this.dynamicRTLSubscription.unsubscribe();
334
- }
335
- this.unsubscribeChanges();
336
- }
337
- /**
338
- * Focuses the component.
339
- */
340
- focus() {
341
- if (this.disabled) {
342
- return;
343
- }
344
- this.gradientDragHandle.nativeElement.focus();
345
- }
346
- /**
347
- * @hidden
348
- */
349
- reset() {
350
- this.handleValueChange(undefined);
351
- this.updateUI();
352
- }
353
- /**
354
- * @hidden
355
- */
356
- handleDragPress(args) {
357
- if (this.disabled || this.readonly || !isPresent(args.originalEvent)) {
358
- return;
359
- }
360
- this.focus();
361
- args.originalEvent.preventDefault();
362
- }
363
- /**
364
- * @hidden
365
- */
366
- onHandleDrag(args) {
367
- if (this.disabled || this.readonly) {
368
- return;
369
- }
370
- this.renderer.addClass(this.gradientWrapper.nativeElement, 'k-dragging');
371
- this.changePosition(args);
372
- }
373
- /**
374
- * @hidden
375
- */
376
- onHandleRelease() {
377
- if (this.disabled || this.readonly) {
378
- return;
379
- }
380
- this.renderer.removeClass(this.gradientWrapper.nativeElement, 'k-dragging');
381
- this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
382
- }
383
- /**
384
- * @hidden
385
- */
386
- onKeyboardAction(args) {
387
- if (this.disabled || this.readonly) {
388
- return;
389
- }
390
- if (args.key && args.key.indexOf('Arrow') !== -1) {
391
- args.preventDefault();
392
- const dragHandleElement = this.gradientDragHandle.nativeElement;
393
- this.renderer.addClass(this.gradientWrapper.nativeElement, 'k-dragging');
394
- let keyboardMoveX = 0;
395
- let keyboardMoveY = 0;
396
- const shiftKey = args.shiftKey;
397
- switch (args.key) {
398
- case 'ArrowRight':
399
- keyboardMoveX = shiftKey ? this.gradientSliderSmallStep : this.gradientSliderStep;
400
- break;
401
- case 'ArrowLeft':
402
- keyboardMoveX = shiftKey ? -this.gradientSliderSmallStep : -this.gradientSliderStep;
403
- break;
404
- case 'ArrowUp':
405
- keyboardMoveY = shiftKey ? -this.gradientSliderSmallStep : -this.gradientSliderStep;
406
- break;
407
- case 'ArrowDown':
408
- keyboardMoveY = shiftKey ? this.gradientSliderSmallStep : this.gradientSliderStep;
409
- break;
410
- default: break;
411
- }
412
- const newY = parseInt(dragHandleElement.style.top, 10) + keyboardMoveY;
413
- const newX = parseInt(dragHandleElement.style.left, 10) + keyboardMoveX;
414
- this.renderer.setStyle(dragHandleElement, 'top', `${newY}px`);
415
- this.renderer.setStyle(dragHandleElement, 'left', `${newX}px`);
416
- this.ngZone.run(() => this.moveDragHandle(newX, newY));
417
- }
418
- }
419
- /**
420
- * @hidden
421
- */
422
- changePosition(position) {
423
- if (this.disabled || this.readonly) {
424
- return;
425
- }
426
- this.gradientDragHandle.nativeElement.focus();
427
- const gradientRect = this.gradientRect;
428
- const newX = position.clientX - gradientRect.left;
429
- const newY = position.clientY - gradientRect.top;
430
- this.ngZone.run(() => this.moveDragHandle(newX, newY));
431
- }
432
- /**
433
- * @hidden
434
- */
435
- handleHueSliderChange(hue) {
436
- const hsva = this.hsva.value;
437
- hsva.h = hue;
438
- this.hsva.next(hsva);
439
- this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
440
- this.backgroundColor = getColorFromHue(hue);
441
- this.setBackgroundColor(this.backgroundColor);
442
- this.setAlphaSliderBackground(this.backgroundColor);
443
- this.hueSliderTouched = true;
444
- }
445
- /**
446
- * @hidden
447
- */
448
- handleAlphaSliderChange(alpha) {
449
- const hsva = this.hsva.value;
450
- hsva.a = alpha / 100;
451
- this.hsva.next(hsva);
452
- this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity));
453
- this.alphaSliderTouched = true;
454
- }
455
- /**
456
- * @hidden
457
- */
458
- handleInputsValueChange(color) {
459
- const parsed = parseColor(color, this.format, this.opacity);
460
- if (this.value !== parsed) {
461
- this.handleValueChange(parsed);
462
- this.updateUI();
463
- }
464
- }
465
- /**
466
- * @hidden
467
- */
468
- writeValue(value) {
469
- this.value = value;
470
- if (isPresent(this.gradientWrapper)) {
471
- this.updateUI();
472
- }
473
- this.cdr.markForCheck();
474
- }
475
- /**
476
- * @hidden
477
- */
478
- registerOnChange(fn) {
479
- this.notifyNgChanged = fn;
480
- }
481
- /**
482
- * @hidden
483
- */
484
- registerOnTouched(fn) {
485
- this.notifyNgTouched = fn;
486
- }
487
- /**
488
- * @hidden
489
- */
490
- setDisabledState(isDisabled) {
491
- this.cdr.markForCheck();
492
- this.disabled = isDisabled;
493
- }
494
- /**
495
- * @hidden
496
- */
497
- get colorGradientHandleTitle() {
498
- return this.localizationService.get('colorGradientHandle');
499
- }
500
- /**
501
- * @hidden
502
- */
503
- get colorGradientHandleAriaLabel() {
504
- const parsed = parseColor(this.value, this.format, this.opacity);
505
- return `${this.value ? parsed : this.localizationService.get('colorGradientNoColor')}`;
506
- }
507
- /**
508
- * @hidden
509
- */
510
- get hueSliderTitle() {
511
- return this.localizationService.get('hueSliderHandle');
512
- }
513
- /**
514
- * @hidden
515
- */
516
- get opacitySliderTitle() {
517
- return this.localizationService.get('opacitySliderHandle');
518
- }
519
- /**
520
- * @hidden
521
- */
522
- get clearButtonTitle() {
523
- return this.localizationService.get('clearButton');
524
- }
525
- /**
526
- * @hidden
527
- * Used by the FloatingLabel to determine if the component is empty.
528
- */
529
- isEmpty() {
530
- return false;
531
- }
532
- notifyNgChanged = () => { };
533
- notifyNgTouched = () => { };
534
- moveDragHandle(positionX, positionY) {
535
- const gradientRect = this.gradientRect;
536
- const gradientRectWidth = gradientRect.width;
537
- const gradientRectHeight = gradientRect.height;
538
- const top = fitIntoBounds(positionY, 0, gradientRectHeight);
539
- const left = fitIntoBounds(positionX, 0, gradientRectWidth);
540
- this.setDragHandleElementPosition(top, left);
541
- const hsva = this.hsva.value;
542
- hsva.s = left / gradientRectWidth;
543
- hsva.v = 1 - top / gradientRectHeight;
544
- this.hsva.next(hsva);
545
- this.updateValues.next(getColorFromHSV(this.hsva.value, this.format, this.opacity));
546
- this.setAlphaSliderBackground(getColorFromHSV({ ...this.hsva.value, a: 1 }, this.format, this.opacity));
547
- }
548
- handleValueChange(color) {
549
- if (this.value === color) {
550
- return;
551
- }
552
- this.value = color;
553
- this.valueChange.emit(color);
554
- this.notifyNgChanged(color);
555
- this.setHostElementAriaLabel();
556
- }
557
- setDragHandleElementPosition(top, left) {
558
- const dragHandle = this.gradientDragHandle.nativeElement;
559
- this.hsvHandleCoordinates = { x: left, y: top };
560
- this.renderer.setStyle(dragHandle, 'top', `${top}px`);
561
- this.renderer.setStyle(dragHandle, 'left', `${left}px`);
562
- }
563
- setAlphaSliderBackground(backgroundColor) {
564
- if (!isPresent(this.alphaSlider)) {
565
- return;
566
- }
567
- const sliderTrack = this.alphaSlider.track.nativeElement;
568
- this.renderer.setStyle(sliderTrack, 'background', `linear-gradient(to ${this.adaptiveMode ? 'right' : 'top'}, transparent, ${backgroundColor})`);
569
- }
570
- setHostElementAriaLabel() {
571
- if (!this.ariaAttributesEnabled) {
572
- this.renderer.removeAttribute(this.host.nativeElement, 'aria-label');
573
- return;
574
- }
575
- const parsed = parseColor(this.value, this.format, this.opacity);
576
- this.renderer.setAttribute(this.host.nativeElement, 'aria-label', `${this.value ? parsed : this.localizationService.get('colorGradientNoColor')}`);
577
- }
578
- setBackgroundColor(color) {
579
- this.renderer.setStyle(this.hsvRectangle.nativeElement, 'background', color);
580
- }
581
- updateUI() {
582
- if (!isDocumentAvailable()) {
583
- return;
584
- }
585
- if (this.hueSliderTouched || this.alphaSliderTouched) {
586
- this.hueSliderTouched = false;
587
- this.alphaSliderTouched = false;
588
- return;
589
- }
590
- this.hsva.next(this.value ? getHSV(this.value) : { h: 0, s: 0, v: 1, a: 1 });
591
- const gradientRect = this.gradientRect;
592
- const top = (1 - this.hsva.value.v) * gradientRect.height;
593
- const left = this.hsva.value.s * gradientRect.width;
594
- this.setDragHandleElementPosition(top, left);
595
- this.backgroundColor = getColorFromHue(this.hsva.value.h);
596
- this.setBackgroundColor(this.backgroundColor);
597
- this.setAlphaSliderBackground(this.backgroundColor);
598
- this.setHostElementAriaLabel();
599
- }
600
- addEventListeners() {
601
- this.ngZone.runOutsideAngular(() => {
602
- const focusOutListener = this.renderer.listen(this.host.nativeElement, 'focusout', (event) => {
603
- if (!containsFocus(this.host.nativeElement, event.relatedTarget) && isUntouched(this.host)) {
604
- this.ngZone.run(() => this.notifyNgTouched());
605
- }
606
- });
607
- const keydownListener = this.renderer.listen(this.gradientDragHandle.nativeElement, 'keydown', (event) => {
608
- this.onKeyboardAction(event);
609
- });
610
- const keyupListener = this.renderer.listen(this.gradientDragHandle.nativeElement, 'keyup', () => {
611
- this.renderer.removeClass(this.gradientWrapper.nativeElement, 'k-dragging');
612
- if (!this.readonly && !this.disabled) {
613
- this.ngZone.run(() => this.handleValueChange(getColorFromHSV(this.hsva.value, this.format, this.opacity)));
614
- }
615
- });
616
- const dragHandleFocusInListener = this.renderer.listen(this.gradientDragHandle.nativeElement, 'focusin', () => {
617
- this.renderer.addClass(this.gradientDragHandle.nativeElement, 'k-focus');
618
- });
619
- const dragHandleFocusOutListener = this.renderer.listen(this.gradientDragHandle.nativeElement, 'focusout', () => {
620
- this.renderer.removeClass(this.gradientDragHandle.nativeElement, 'k-focus');
621
- });
622
- this.listeners.push(focusOutListener, keydownListener, keyupListener, dragHandleFocusInListener, dragHandleFocusOutListener);
623
- });
624
- }
625
- subscribeChanges() {
626
- this.changeRequestsSubscription = this.updateValues.pipe(throttleTime(this.delay)).subscribe(value => {
627
- this.handleValueChange(value);
628
- });
629
- }
630
- unsubscribeChanges() {
631
- if (this.changeRequestsSubscription) {
632
- this.changeRequestsSubscription.unsubscribe();
633
- }
634
- }
635
- handleClasses(value, input) {
636
- const elem = this.host.nativeElement;
637
- const classes = getStylingClasses('colorgradient', input, this[input], value);
638
- if (classes.toRemove) {
639
- this.renderer.removeClass(elem, classes.toRemove);
640
- }
641
- if (classes.toAdd) {
642
- this.renderer.addClass(elem, classes.toAdd);
643
- }
644
- }
645
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ColorGradientComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
646
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: ColorGradientComponent, isStandalone: true, selector: "kendo-colorgradient", inputs: { adaptiveMode: "adaptiveMode", id: "id", opacity: "opacity", size: "size", disabled: "disabled", readonly: "readonly", clearButton: "clearButton", delay: "delay", value: "value", contrastTool: "contrastTool", tabindex: "tabindex", format: "format", gradientSliderStep: "gradientSliderStep", gradientSliderSmallStep: "gradientSliderSmallStep", ariaAttributesEnabled: "ariaAttributesEnabled" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "keydown.enter": "enterHandler($event)", "keydown.escape": "escapeHandler($event)", "focusin": "focusHandler($event)" }, properties: { "class.k-colorgradient": "this.hostClasses", "attr.aria-readonly": "this.readonlyAttribute", "class.k-disabled": "this.disabledClass", "attr.id": "this.gradientId", "attr.dir": "this.direction", "attr.tabindex": "this.hostTabindex", "attr.role": "this.ariaRole", "attr.aria-invalid": "this.isControlInvalid", "attr.aria-disabled": "this.isDisabled", "class.k-readonly": "this.readonly" } }, providers: [
647
- {
648
- multi: true,
649
- provide: NG_VALUE_ACCESSOR,
650
- useExisting: forwardRef(() => ColorGradientComponent)
651
- },
652
- {
653
- provide: KendoInput,
654
- useExisting: forwardRef(() => ColorGradientComponent)
655
- },
656
- ColorGradientLocalizationService,
657
- {
658
- provide: LocalizationService,
659
- useExisting: ColorGradientLocalizationService
660
- },
661
- {
662
- provide: L10N_PREFIX,
663
- useValue: 'kendo.colorgradient'
664
- }
665
- ], viewQueries: [{ propertyName: "gradientDragHandle", first: true, predicate: ["gradientDragHandle"], descendants: true }, { propertyName: "inputs", first: true, predicate: ["inputs"], descendants: true }, { propertyName: "alphaSlider", first: true, predicate: ["alphaSlider"], descendants: true }, { propertyName: "gradientWrapper", first: true, predicate: ["gradientWrapper"], descendants: true }, { propertyName: "hsvRectangle", first: true, predicate: ["hsvRectangle"], descendants: true }], exportAs: ["kendoColorGradient"], usesOnChanges: true, ngImport: i0, template: `
666
- <ng-container kendoColorGradientLocalizedMessages
667
- i18n-colorGradientNoColor="kendo.colorgradient.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty."
668
- colorGradientNoColor="Colorgradient no color chosen"
669
- i18n-colorGradientHandle="kendo.colorgradient.colorGradientHandle|The title for the gradient color drag handle chooser."
670
- colorGradientHandle="Choose color"
671
- i18n-clearButton="kendo.colorgradient.clearButton|The title for the clear button."
672
- clearButton="Clear value"
673
- i18n-hueSliderHandle="kendo.colorgradient.hueSliderHandle|The title for the hue slider handle."
674
- hueSliderHandle="Set hue"
675
- i18n-opacitySliderHandle="kendo.colorgradient.opacitySliderHandle|The title for the opacity slider handle."
676
- opacitySliderHandle="Set opacity"
677
- i18n-passContrast="kendo.colorgradient.passContrast|The pass message for the contrast tool."
678
- passContrast="Pass"
679
- i18n-failContrast="kendo.colorgradient.failContrast|The fail message for the contrast tool."
680
- failContrast="Fail"
681
- i18n-contrastRatio="kendo.colorgradient.contrastRatio|The contrast ratio message for the contrast tool."
682
- contrastRatio="Contrast ratio"
683
- i18n-formatButton="kendo.colorgradient.formatButton|The message for the input format toggle button."
684
- formatButton="Change color format"
685
- i18n-redChannelLabel="kendo.colorgradient.redChannelLabel|The label of the NumericTextBox representing the red color channel."
686
- redChannelLabel="Red channel"
687
- i18n-greenChannelLabel="kendo.colorgradient.greenChannelLabel|The label of the NumericTextBox representing the green color channel."
688
- greenChannelLabel="Green channel"
689
- i18n-blueChannelLabel="kendo.colorgradient.blueChannelLabel|The label of the NumericTextBox representing the blue color channel."
690
- blueChannelLabel="Blue channel"
691
- i18n-alphaChannelLabel="kendo.colorgradient.alphaChannelLabel|The label of the NumericTextBox representing the alpha color channel."
692
- alphaChannelLabel="Alpha channel"
693
- i18n-redInputPlaceholder="kendo.colorgradient.redInputPlaceholder|The placeholder for the red color input."
694
- redChannelLabel="R"
695
- i18n-greenInputPlaceholder="kendo.colorgradient.greenInputPlaceholder|The placeholder for the green color input."
696
- greenInputPlaceholder="G"
697
- i18n-blueInputPlaceholder="kendo.colorgradient.blueInputPlaceholder|The placeholder for the blue color input."
698
- blueInputPlaceholder="B"
699
- i18n-hexInputPlaceholder="kendo.colorgradient.hexInputPlaceholder|The placeholder for the HEX color input."
700
- hexInputPlaceholder="HEX">
701
- </ng-container>
702
- <div [ngClass]="{
703
- 'k-colorgradient-canvas': true,
704
- 'k-vstack': adaptiveMode,
705
- 'k-hstack': !adaptiveMode
706
- }">
707
- <div class="k-hsv-rectangle" #hsvRectangle>
708
- <div
709
- #gradientWrapper
710
- kendoDraggable
711
- class="k-hsv-gradient"
712
- (click)="changePosition($event)"
713
- (kendoPress)="handleDragPress($event)"
714
- (kendoDrag)="onHandleDrag($event)"
715
- (kendoRelease)="onHandleRelease()"
716
- [style.touch-action]="'none'">
717
- <div
718
- #gradientDragHandle
719
- class="k-hsv-draghandle k-draghandle"
720
- [tabindex]="innerTabIndex.toString()"
721
- [attr.title]="colorGradientHandleTitle"
722
- [attr.aria-label]="colorGradientHandleTitle + ' ' + colorGradientHandleAriaLabel"
723
- role="slider"
724
- [attr.aria-valuetext]="hsvSliderValueText"
725
- [attr.aria-readonly]="readonly ? readonly : undefined"
726
- [attr.aria-disabled]="disabled ? disabled : undefined"
727
- [attr.aria-orientation]="'undefined'"
728
- [attr.aria-valuenow]="'0'"
729
- (keydown.shift.tab)="$event.preventDefault(); inputs.focusLast();">
730
- </div>
731
- </div>
732
- @if (contrastToolVisible && gradientWrapper) {
733
- <svg kendoColorContrastSvg
734
- class="k-color-contrast-svg"
735
- xmlns="http://www.w3.org/2000/svg"
736
- [wrapper]="gradientWrapper ? gradientWrapper : undefined"
737
- [hsva]="hsva"
738
- [backgroundColor]="contrastTool"
739
- [style]="'position: absolute; overflow: visible; pointer-events: none; left: 0px; top: 0px;'">
740
- </svg>
741
- }
742
- </div>
743
- <div [ngClass]="{
744
- 'k-hsv-controls': true,
745
- 'k-sliders-wrap-clearable': clearButton,
746
- 'k-vstack': adaptiveMode,
747
- 'k-hstack': !adaptiveMode
748
- }">
749
- @if (clearButton) {
750
- <button
751
- kendoButton
752
- class="k-clear-color"
753
- fillMode="flat"
754
- icon="droplet-slash"
755
- [svgIcon]="dropletSlashIcon"
756
- [size]="size"
757
- (click)="reset()"
758
- (keydown.enter)="reset()"
759
- (keydown.space)="reset()"
760
- [attr.aria-label]="clearButtonTitle"
761
- [attr.title]="clearButtonTitle"
762
- [tabindex]="innerTabIndex.toString()"
763
- [style]="'position: absolute; top: 0; left: 50%; transform: translateX(-50%);'"
764
- >
765
- </button>
766
- }
767
- <kendo-slider
768
- [ngClass]="{'k-align-self-end': clearButton}"
769
- [style.height.px]="clearButton ? '140' : null"
770
- class="k-hue-slider k-colorgradient-slider"
771
- [dragHandleTitle]="hueSliderTitle"
772
- [tabindex]="innerTabIndex"
773
- [disabled]="disabled"
774
- [readonly]="readonly"
775
- [showButtons]="false"
776
- tickPlacement="none"
777
- [vertical]="!adaptiveMode"
778
- [min]="0"
779
- [max]="360"
780
- [value]="hsva.value.h"
781
- [smallStep]="5"
782
- [largeStep]="10"
783
- (valueChange)="handleHueSliderChange($event)"
784
- >
785
- </kendo-slider>
786
- @if (opacity) {
787
- <kendo-slider
788
- #alphaSlider
789
- [tabindex]="innerTabIndex"
790
- [ngClass]="{'k-align-self-end': clearButton}"
791
- [style.height.px]="clearButton ? '140' : null"
792
- class="k-alpha-slider k-colorgradient-slider"
793
- [dragHandleTitle]="opacitySliderTitle"
794
- [disabled]="disabled"
795
- [readonly]="readonly"
796
- [showButtons]="false"
797
- tickPlacement="none"
798
- [vertical]="!adaptiveMode"
799
- [min]="0"
800
- [max]="100"
801
- [smallStep]="1"
802
- [largeStep]="10"
803
- [value]="alphaSliderValue"
804
- (valueChange)="handleAlphaSliderChange($event)"
805
- >
806
- </kendo-slider>
807
- }
808
- </div>
809
- </div>
810
- <kendo-colorinput #inputs
811
- [tabindex]="innerTabIndex"
812
- [opacity]="opacity"
813
- [size]="size"
814
- [formatView]="format"
815
- [value]="value"
816
- [disabled]="disabled"
817
- [readonly]="readonly"
818
- (valueChange)="handleInputsValueChange($event)"
819
- (tabOut)="gradientDragHandle.focus()"
820
- >
821
- </kendo-colorinput>
822
- @if (contrastToolVisible) {
823
- <div class="k-colorgradient-color-contrast k-vbox"
824
- kendoContrastTool
825
- [value]="value"
826
- [ratio]="contrastTool">
827
- </div>
828
- }
829
- `, isInline: true, dependencies: [{ kind: "directive", type: LocalizedColorPickerMessagesDirective, selector: "[kendoColorPickerLocalizedMessages], [kendoFlatColorPickerLocalizedMessages], [kendoColorGradientLocalizedMessages], [kendoColorPaletteLocalizedMessages]" }, { kind: "directive", type: DraggableDirective, selector: "[kendoDraggable]", inputs: ["enableDrag"], outputs: ["kendoPress", "kendoDrag", "kendoRelease"] }, { kind: "component", type: ColorContrastSvgComponent, selector: "[kendoColorContrastSvg]", inputs: ["wrapper", "hsva", "backgroundColor"] }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "component", type: SliderComponent, selector: "kendo-slider", inputs: ["focusableId", "dragHandleTitle", "incrementTitle", "animate", "decrementTitle", "showButtons", "value", "tabIndex"], exportAs: ["kendoSlider"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ColorInputComponent, selector: "kendo-colorinput", inputs: ["focusableId", "formatView", "size", "tabindex", "value", "opacity", "disabled", "readonly"], outputs: ["valueChange", "tabOut"] }, { kind: "component", type: ContrastComponent, selector: "[kendoContrastTool]", inputs: ["value", "ratio"] }] });
830
- }
831
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ColorGradientComponent, decorators: [{
832
- type: Component,
833
- args: [{
834
- exportAs: 'kendoColorGradient',
835
- selector: 'kendo-colorgradient',
836
- providers: [
837
- {
838
- multi: true,
839
- provide: NG_VALUE_ACCESSOR,
840
- useExisting: forwardRef(() => ColorGradientComponent)
841
- },
842
- {
843
- provide: KendoInput,
844
- useExisting: forwardRef(() => ColorGradientComponent)
845
- },
846
- ColorGradientLocalizationService,
847
- {
848
- provide: LocalizationService,
849
- useExisting: ColorGradientLocalizationService
850
- },
851
- {
852
- provide: L10N_PREFIX,
853
- useValue: 'kendo.colorgradient'
854
- }
855
- ],
856
- template: `
857
- <ng-container kendoColorGradientLocalizedMessages
858
- i18n-colorGradientNoColor="kendo.colorgradient.colorGradientNoColor|The aria-label applied to the ColorGradient component when the value is empty."
859
- colorGradientNoColor="Colorgradient no color chosen"
860
- i18n-colorGradientHandle="kendo.colorgradient.colorGradientHandle|The title for the gradient color drag handle chooser."
861
- colorGradientHandle="Choose color"
862
- i18n-clearButton="kendo.colorgradient.clearButton|The title for the clear button."
863
- clearButton="Clear value"
864
- i18n-hueSliderHandle="kendo.colorgradient.hueSliderHandle|The title for the hue slider handle."
865
- hueSliderHandle="Set hue"
866
- i18n-opacitySliderHandle="kendo.colorgradient.opacitySliderHandle|The title for the opacity slider handle."
867
- opacitySliderHandle="Set opacity"
868
- i18n-passContrast="kendo.colorgradient.passContrast|The pass message for the contrast tool."
869
- passContrast="Pass"
870
- i18n-failContrast="kendo.colorgradient.failContrast|The fail message for the contrast tool."
871
- failContrast="Fail"
872
- i18n-contrastRatio="kendo.colorgradient.contrastRatio|The contrast ratio message for the contrast tool."
873
- contrastRatio="Contrast ratio"
874
- i18n-formatButton="kendo.colorgradient.formatButton|The message for the input format toggle button."
875
- formatButton="Change color format"
876
- i18n-redChannelLabel="kendo.colorgradient.redChannelLabel|The label of the NumericTextBox representing the red color channel."
877
- redChannelLabel="Red channel"
878
- i18n-greenChannelLabel="kendo.colorgradient.greenChannelLabel|The label of the NumericTextBox representing the green color channel."
879
- greenChannelLabel="Green channel"
880
- i18n-blueChannelLabel="kendo.colorgradient.blueChannelLabel|The label of the NumericTextBox representing the blue color channel."
881
- blueChannelLabel="Blue channel"
882
- i18n-alphaChannelLabel="kendo.colorgradient.alphaChannelLabel|The label of the NumericTextBox representing the alpha color channel."
883
- alphaChannelLabel="Alpha channel"
884
- i18n-redInputPlaceholder="kendo.colorgradient.redInputPlaceholder|The placeholder for the red color input."
885
- redChannelLabel="R"
886
- i18n-greenInputPlaceholder="kendo.colorgradient.greenInputPlaceholder|The placeholder for the green color input."
887
- greenInputPlaceholder="G"
888
- i18n-blueInputPlaceholder="kendo.colorgradient.blueInputPlaceholder|The placeholder for the blue color input."
889
- blueInputPlaceholder="B"
890
- i18n-hexInputPlaceholder="kendo.colorgradient.hexInputPlaceholder|The placeholder for the HEX color input."
891
- hexInputPlaceholder="HEX">
892
- </ng-container>
893
- <div [ngClass]="{
894
- 'k-colorgradient-canvas': true,
895
- 'k-vstack': adaptiveMode,
896
- 'k-hstack': !adaptiveMode
897
- }">
898
- <div class="k-hsv-rectangle" #hsvRectangle>
899
- <div
900
- #gradientWrapper
901
- kendoDraggable
902
- class="k-hsv-gradient"
903
- (click)="changePosition($event)"
904
- (kendoPress)="handleDragPress($event)"
905
- (kendoDrag)="onHandleDrag($event)"
906
- (kendoRelease)="onHandleRelease()"
907
- [style.touch-action]="'none'">
908
- <div
909
- #gradientDragHandle
910
- class="k-hsv-draghandle k-draghandle"
911
- [tabindex]="innerTabIndex.toString()"
912
- [attr.title]="colorGradientHandleTitle"
913
- [attr.aria-label]="colorGradientHandleTitle + ' ' + colorGradientHandleAriaLabel"
914
- role="slider"
915
- [attr.aria-valuetext]="hsvSliderValueText"
916
- [attr.aria-readonly]="readonly ? readonly : undefined"
917
- [attr.aria-disabled]="disabled ? disabled : undefined"
918
- [attr.aria-orientation]="'undefined'"
919
- [attr.aria-valuenow]="'0'"
920
- (keydown.shift.tab)="$event.preventDefault(); inputs.focusLast();">
921
- </div>
922
- </div>
923
- @if (contrastToolVisible && gradientWrapper) {
924
- <svg kendoColorContrastSvg
925
- class="k-color-contrast-svg"
926
- xmlns="http://www.w3.org/2000/svg"
927
- [wrapper]="gradientWrapper ? gradientWrapper : undefined"
928
- [hsva]="hsva"
929
- [backgroundColor]="contrastTool"
930
- [style]="'position: absolute; overflow: visible; pointer-events: none; left: 0px; top: 0px;'">
931
- </svg>
932
- }
933
- </div>
934
- <div [ngClass]="{
935
- 'k-hsv-controls': true,
936
- 'k-sliders-wrap-clearable': clearButton,
937
- 'k-vstack': adaptiveMode,
938
- 'k-hstack': !adaptiveMode
939
- }">
940
- @if (clearButton) {
941
- <button
942
- kendoButton
943
- class="k-clear-color"
944
- fillMode="flat"
945
- icon="droplet-slash"
946
- [svgIcon]="dropletSlashIcon"
947
- [size]="size"
948
- (click)="reset()"
949
- (keydown.enter)="reset()"
950
- (keydown.space)="reset()"
951
- [attr.aria-label]="clearButtonTitle"
952
- [attr.title]="clearButtonTitle"
953
- [tabindex]="innerTabIndex.toString()"
954
- [style]="'position: absolute; top: 0; left: 50%; transform: translateX(-50%);'"
955
- >
956
- </button>
957
- }
958
- <kendo-slider
959
- [ngClass]="{'k-align-self-end': clearButton}"
960
- [style.height.px]="clearButton ? '140' : null"
961
- class="k-hue-slider k-colorgradient-slider"
962
- [dragHandleTitle]="hueSliderTitle"
963
- [tabindex]="innerTabIndex"
964
- [disabled]="disabled"
965
- [readonly]="readonly"
966
- [showButtons]="false"
967
- tickPlacement="none"
968
- [vertical]="!adaptiveMode"
969
- [min]="0"
970
- [max]="360"
971
- [value]="hsva.value.h"
972
- [smallStep]="5"
973
- [largeStep]="10"
974
- (valueChange)="handleHueSliderChange($event)"
975
- >
976
- </kendo-slider>
977
- @if (opacity) {
978
- <kendo-slider
979
- #alphaSlider
980
- [tabindex]="innerTabIndex"
981
- [ngClass]="{'k-align-self-end': clearButton}"
982
- [style.height.px]="clearButton ? '140' : null"
983
- class="k-alpha-slider k-colorgradient-slider"
984
- [dragHandleTitle]="opacitySliderTitle"
985
- [disabled]="disabled"
986
- [readonly]="readonly"
987
- [showButtons]="false"
988
- tickPlacement="none"
989
- [vertical]="!adaptiveMode"
990
- [min]="0"
991
- [max]="100"
992
- [smallStep]="1"
993
- [largeStep]="10"
994
- [value]="alphaSliderValue"
995
- (valueChange)="handleAlphaSliderChange($event)"
996
- >
997
- </kendo-slider>
998
- }
999
- </div>
1000
- </div>
1001
- <kendo-colorinput #inputs
1002
- [tabindex]="innerTabIndex"
1003
- [opacity]="opacity"
1004
- [size]="size"
1005
- [formatView]="format"
1006
- [value]="value"
1007
- [disabled]="disabled"
1008
- [readonly]="readonly"
1009
- (valueChange)="handleInputsValueChange($event)"
1010
- (tabOut)="gradientDragHandle.focus()"
1011
- >
1012
- </kendo-colorinput>
1013
- @if (contrastToolVisible) {
1014
- <div class="k-colorgradient-color-contrast k-vbox"
1015
- kendoContrastTool
1016
- [value]="value"
1017
- [ratio]="contrastTool">
1018
- </div>
1019
- }
1020
- `,
1021
- standalone: true,
1022
- imports: [LocalizedColorPickerMessagesDirective, DraggableDirective, ColorContrastSvgComponent, ButtonComponent, SliderComponent, NgClass, ColorInputComponent, ContrastComponent]
1023
- }]
1024
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }, { type: i0.Injector }], propDecorators: { hostClasses: [{
1025
- type: HostBinding,
1026
- args: ['class.k-colorgradient']
1027
- }], readonlyAttribute: [{
1028
- type: HostBinding,
1029
- args: ['attr.aria-readonly']
1030
- }], disabledClass: [{
1031
- type: HostBinding,
1032
- args: ['class.k-disabled']
1033
- }], gradientId: [{
1034
- type: HostBinding,
1035
- args: ['attr.id']
1036
- }], direction: [{
1037
- type: HostBinding,
1038
- args: ['attr.dir']
1039
- }], hostTabindex: [{
1040
- type: HostBinding,
1041
- args: ['attr.tabindex']
1042
- }], ariaRole: [{
1043
- type: HostBinding,
1044
- args: ['attr.role']
1045
- }], isControlInvalid: [{
1046
- type: HostBinding,
1047
- args: ['attr.aria-invalid']
1048
- }], isDisabled: [{
1049
- type: HostBinding,
1050
- args: ['attr.aria-disabled']
1051
- }], enterHandler: [{
1052
- type: HostListener,
1053
- args: ['keydown.enter', ['$event']]
1054
- }], escapeHandler: [{
1055
- type: HostListener,
1056
- args: ['keydown.escape', ['$event']]
1057
- }], focusHandler: [{
1058
- type: HostListener,
1059
- args: ['focusin', ['$event']]
1060
- }], adaptiveMode: [{
1061
- type: Input
1062
- }], id: [{
1063
- type: Input
1064
- }], opacity: [{
1065
- type: Input
1066
- }], size: [{
1067
- type: Input
1068
- }], disabled: [{
1069
- type: Input
1070
- }], readonly: [{
1071
- type: Input
1072
- }, {
1073
- type: HostBinding,
1074
- args: ['class.k-readonly']
1075
- }], clearButton: [{
1076
- type: Input
1077
- }], delay: [{
1078
- type: Input
1079
- }], value: [{
1080
- type: Input
1081
- }], contrastTool: [{
1082
- type: Input
1083
- }], tabindex: [{
1084
- type: Input
1085
- }], format: [{
1086
- type: Input
1087
- }], valueChange: [{
1088
- type: Output
1089
- }], gradientSliderStep: [{
1090
- type: Input
1091
- }], gradientSliderSmallStep: [{
1092
- type: Input
1093
- }], ariaAttributesEnabled: [{
1094
- type: Input
1095
- }], gradientDragHandle: [{
1096
- type: ViewChild,
1097
- args: ['gradientDragHandle']
1098
- }], inputs: [{
1099
- type: ViewChild,
1100
- args: ['inputs']
1101
- }], alphaSlider: [{
1102
- type: ViewChild,
1103
- args: ['alphaSlider']
1104
- }], gradientWrapper: [{
1105
- type: ViewChild,
1106
- args: ['gradientWrapper']
1107
- }], hsvRectangle: [{
1108
- type: ViewChild,
1109
- args: ['hsvRectangle']
1110
- }] } });