@progress/kendo-vue-inputs 3.4.3 → 3.4.5-dev.202207300828

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 (102) hide show
  1. package/dist/cdn/js/kendo-vue-inputs.js +1 -1
  2. package/dist/es/checkbox/Checkbox.js +3 -3
  3. package/dist/es/colors/ColorContrastLabels.js +8 -4
  4. package/dist/es/colors/ColorContrastSvg.js +65 -44
  5. package/dist/es/colors/ColorGradient.d.ts +3 -1
  6. package/dist/es/colors/ColorGradient.js +160 -57
  7. package/dist/es/colors/ColorInput.d.ts +3 -0
  8. package/dist/es/colors/ColorInput.js +82 -58
  9. package/dist/es/colors/ColorPalette.js +31 -17
  10. package/dist/es/colors/ColorPicker.d.ts +1 -0
  11. package/dist/es/colors/ColorPicker.js +90 -70
  12. package/dist/es/colors/FlatColorPicker.d.ts +41 -5
  13. package/dist/es/colors/FlatColorPicker.js +307 -110
  14. package/dist/es/colors/HexInput.d.ts +1 -0
  15. package/dist/es/colors/HexInput.js +33 -13
  16. package/dist/es/colors/Picker.js +20 -12
  17. package/dist/es/colors/interfaces/ColorGradientChangeEvent.d.ts +4 -0
  18. package/dist/es/colors/interfaces/ColorGradientProps.d.ts +12 -0
  19. package/dist/es/colors/interfaces/ColorPaletteChangeEvent.d.ts +0 -3
  20. package/dist/es/colors/interfaces/ColorPaletteProps.d.ts +8 -3
  21. package/dist/es/colors/interfaces/ColorPickerActiveColorClick.d.ts +0 -3
  22. package/dist/es/colors/interfaces/ColorPickerBlurEvent.d.ts +0 -3
  23. package/dist/es/colors/interfaces/ColorPickerChangeEvent.d.ts +4 -3
  24. package/dist/es/colors/interfaces/ColorPickerFocusEvent.d.ts +0 -3
  25. package/dist/es/colors/interfaces/ColorPickerPaletteSettings.d.ts +0 -3
  26. package/dist/es/colors/interfaces/ColorPickerPopupSettings.d.ts +0 -3
  27. package/dist/es/colors/interfaces/ColorPickerProps.d.ts +30 -4
  28. package/dist/es/colors/interfaces/ColorPickerView.d.ts +0 -3
  29. package/dist/es/colors/interfaces/FlatColorPickerViewChangeEvent.d.ts +13 -0
  30. package/dist/es/colors/interfaces/FlatColorPickerViewChangeEvent.js +0 -0
  31. package/dist/es/colors/interfaces/PickerProps.d.ts +4 -0
  32. package/dist/es/colors/utils/color-cache.d.ts +13 -0
  33. package/dist/es/colors/utils/color-cache.js +14 -0
  34. package/dist/es/colors/utils/color-parser.d.ts +7 -1
  35. package/dist/es/colors/utils/color-parser.js +11 -2
  36. package/dist/es/input/Input.d.ts +4 -0
  37. package/dist/es/input/Input.js +9 -4
  38. package/dist/es/input-separator/InputSeparator.js +1 -1
  39. package/dist/es/maskedtextbox/MaskedTextBox.js +1 -1
  40. package/dist/es/messages/index.d.ts +45 -0
  41. package/dist/es/messages/index.js +46 -0
  42. package/dist/es/numerictextbox/NumericTextBox.js +4 -1
  43. package/dist/es/numerictextbox/interfaces/NumericTextBoxProps.d.ts +4 -0
  44. package/dist/es/package-metadata.js +1 -1
  45. package/dist/es/radiobutton/RadioButton.js +2 -2
  46. package/dist/es/radiobutton/RadioGroup.js +2 -2
  47. package/dist/es/range-slider/RangeSlider.js +2 -2
  48. package/dist/es/slider/Slider.js +3 -3
  49. package/dist/es/slider/SliderLabel.js +1 -1
  50. package/dist/es/switch/Switch.js +1 -1
  51. package/dist/es/textarea/TextArea.js +1 -1
  52. package/dist/npm/checkbox/Checkbox.js +3 -3
  53. package/dist/npm/colors/ColorContrastLabels.js +8 -4
  54. package/dist/npm/colors/ColorContrastSvg.js +65 -44
  55. package/dist/npm/colors/ColorGradient.d.ts +3 -1
  56. package/dist/npm/colors/ColorGradient.js +161 -56
  57. package/dist/npm/colors/ColorInput.d.ts +3 -0
  58. package/dist/npm/colors/ColorInput.js +82 -57
  59. package/dist/npm/colors/ColorPalette.js +31 -17
  60. package/dist/npm/colors/ColorPicker.d.ts +1 -0
  61. package/dist/npm/colors/ColorPicker.js +91 -71
  62. package/dist/npm/colors/FlatColorPicker.d.ts +41 -5
  63. package/dist/npm/colors/FlatColorPicker.js +307 -107
  64. package/dist/npm/colors/HexInput.d.ts +1 -0
  65. package/dist/npm/colors/HexInput.js +31 -11
  66. package/dist/npm/colors/Picker.js +19 -11
  67. package/dist/npm/colors/interfaces/ColorGradientChangeEvent.d.ts +4 -0
  68. package/dist/npm/colors/interfaces/ColorGradientProps.d.ts +12 -0
  69. package/dist/npm/colors/interfaces/ColorPaletteChangeEvent.d.ts +0 -3
  70. package/dist/npm/colors/interfaces/ColorPaletteProps.d.ts +8 -3
  71. package/dist/npm/colors/interfaces/ColorPickerActiveColorClick.d.ts +0 -3
  72. package/dist/npm/colors/interfaces/ColorPickerBlurEvent.d.ts +0 -3
  73. package/dist/npm/colors/interfaces/ColorPickerChangeEvent.d.ts +4 -3
  74. package/dist/npm/colors/interfaces/ColorPickerFocusEvent.d.ts +0 -3
  75. package/dist/npm/colors/interfaces/ColorPickerPaletteSettings.d.ts +0 -3
  76. package/dist/npm/colors/interfaces/ColorPickerPopupSettings.d.ts +0 -3
  77. package/dist/npm/colors/interfaces/ColorPickerProps.d.ts +30 -4
  78. package/dist/npm/colors/interfaces/ColorPickerView.d.ts +0 -3
  79. package/dist/npm/colors/interfaces/FlatColorPickerViewChangeEvent.d.ts +13 -0
  80. package/dist/npm/colors/interfaces/FlatColorPickerViewChangeEvent.js +2 -0
  81. package/dist/npm/colors/interfaces/PickerProps.d.ts +4 -0
  82. package/dist/npm/colors/utils/color-cache.d.ts +13 -0
  83. package/dist/npm/colors/utils/color-cache.js +15 -1
  84. package/dist/npm/colors/utils/color-parser.d.ts +7 -1
  85. package/dist/npm/colors/utils/color-parser.js +12 -3
  86. package/dist/npm/input/Input.d.ts +4 -0
  87. package/dist/npm/input/Input.js +9 -4
  88. package/dist/npm/input-separator/InputSeparator.js +1 -1
  89. package/dist/npm/maskedtextbox/MaskedTextBox.js +1 -1
  90. package/dist/npm/messages/index.d.ts +45 -0
  91. package/dist/npm/messages/index.js +47 -1
  92. package/dist/npm/numerictextbox/NumericTextBox.js +4 -1
  93. package/dist/npm/numerictextbox/interfaces/NumericTextBoxProps.d.ts +4 -0
  94. package/dist/npm/package-metadata.js +1 -1
  95. package/dist/npm/radiobutton/RadioButton.js +2 -2
  96. package/dist/npm/radiobutton/RadioGroup.js +2 -2
  97. package/dist/npm/range-slider/RangeSlider.js +2 -2
  98. package/dist/npm/slider/Slider.js +3 -3
  99. package/dist/npm/slider/SliderLabel.js +1 -1
  100. package/dist/npm/switch/Switch.js +1 -1
  101. package/dist/npm/textarea/TextArea.js +1 -1
  102. package/package.json +11 -11
@@ -25,7 +25,7 @@ var Vue = require("vue");
25
25
 
26
26
  var allVue = Vue;
27
27
  var gh = allVue.h;
28
- var isV3 = allVue.version[0] === '3';
28
+ var isV3 = allVue.version && allVue.version[0] === '3';
29
29
 
30
30
  var kendo_vue_buttons_1 = require("@progress/kendo-vue-buttons");
31
31
 
@@ -35,29 +35,14 @@ var package_metadata_1 = require("../package-metadata");
35
35
 
36
36
  var Picker_1 = require("./Picker");
37
37
 
38
- var ColorPalette_1 = require("./ColorPalette");
38
+ var FlatColorPicker_1 = require("./FlatColorPicker");
39
39
 
40
- var ColorGradient_1 = require("./ColorGradient");
40
+ var color_cache_1 = require("./utils/color-cache");
41
41
  /**
42
42
  * @hidden
43
43
  */
44
44
 
45
45
 
46
- var DEFAULT_GRADIENT_SETTINGS = {
47
- opacity: true
48
- };
49
- /**
50
- * @hidden
51
- */
52
-
53
- var DEFAULT_PALETTE_SETTINGS = {
54
- palette: ColorPalette_1.DEFAULT_PRESET,
55
- tileSize: ColorPalette_1.DEFAULT_TILE_SIZE
56
- };
57
- /**
58
- * @hidden
59
- */
60
-
61
46
  var isControlled = function isControlled(prop) {
62
47
  return prop !== undefined;
63
48
  };
@@ -68,16 +53,25 @@ var isControlled = function isControlled(prop) {
68
53
 
69
54
  var ColorPickerVue2 = {
70
55
  name: 'KendoColorPicker',
56
+ model: {
57
+ event: 'changemodel'
58
+ },
71
59
  // @ts-ignore
72
60
  emits: {
73
61
  'open': null,
74
62
  'close': null,
63
+ 'changemodel': null,
64
+ 'update:modelValue': null,
65
+ 'update:modelRgbaValue': null,
75
66
  'activecolorclick': null,
76
67
  'focus': null,
77
68
  'blur': null,
78
- 'change': null
69
+ 'change': null,
70
+ 'viewchange': null
79
71
  },
80
72
  props: {
73
+ modelValue: String,
74
+ modelRgbaValue: String,
81
75
  value: {
82
76
  type: String,
83
77
  default: undefined
@@ -88,10 +82,22 @@ var ColorPickerVue2 = {
88
82
  id: String,
89
83
  ariaLabelledBy: String,
90
84
  ariaDescribedBy: String,
85
+ showClearButton: {
86
+ type: Boolean,
87
+ default: true
88
+ },
89
+ showPreview: {
90
+ type: Boolean,
91
+ default: true
92
+ },
93
+ showButtons: {
94
+ type: Boolean,
95
+ default: true
96
+ },
91
97
  paletteSettings: {
92
98
  type: Object,
93
99
  default: function _default() {
94
- return DEFAULT_PALETTE_SETTINGS;
100
+ return color_cache_1.DEFAULT_PALETTE_SETTINGS;
95
101
  }
96
102
  },
97
103
  valid: {
@@ -112,6 +118,12 @@ var ColorPickerVue2 = {
112
118
  }
113
119
  },
114
120
  gradientSettings: {
121
+ type: Object,
122
+ default: function _default() {
123
+ return color_cache_1.DEFAULT_GRADIENT_SETTINGS;
124
+ }
125
+ },
126
+ flatColorPickerSettings: {
115
127
  type: Object,
116
128
  default: function _default() {
117
129
  return {};
@@ -144,10 +156,14 @@ var ColorPickerVue2 = {
144
156
  },
145
157
  view: {
146
158
  type: String,
147
- default: 'palette',
159
+ default: 'combo',
148
160
  validator: function validator(value) {
149
161
  return ['gradient', 'palette', 'combo'].includes(value);
150
162
  }
163
+ },
164
+ selectedView: {
165
+ type: Number,
166
+ default: undefined
151
167
  }
152
168
  },
153
169
  data: function data() {
@@ -165,7 +181,7 @@ var ColorPickerVue2 = {
165
181
  return this.$props.open !== undefined;
166
182
  },
167
183
  computedValue: function computedValue() {
168
- return this.isValueControlled ? this.$props.value : this.currentValue;
184
+ return this.isValueControlled ? this.$props.value : this.$props.modelValue !== undefined ? this.$props.modelValue : this.$props.modelRgbaValue !== undefined ? this.$props.modelRgbaValue : this.currentValue !== undefined ? this.currentValue : this.defaultValue;
169
185
  },
170
186
  computedOpen: function computedOpen() {
171
187
  return this.isOpenControlled ? this.$props.open : this.currentOpen;
@@ -190,6 +206,7 @@ var ColorPickerVue2 = {
190
206
  },
191
207
  created: function created() {
192
208
  kendo_vue_common_1.validatePackage(package_metadata_1.packageMetadata);
209
+ this._popupId = 'popup' + kendo_vue_common_1.guid();
193
210
  this.focusableElementGuid = kendo_vue_common_1.guid();
194
211
  },
195
212
  mounted: function mounted() {
@@ -217,46 +234,43 @@ var ColorPickerVue2 = {
217
234
  disabled = _b.disabled,
218
235
  tabIndex = _b.tabIndex,
219
236
  dir = _b.dir,
220
- view = _b.view;
221
-
222
- var renderGradiente = function renderGradiente() {
223
- return h(ColorGradient_1.ColorGradient, __assign({
224
- tabIndex: 0,
225
- attrs: this.v3 ? undefined : __assign({
226
- tabIndex: 0,
227
- value: this.computedValue || undefined
228
- }, this.gradientSettings),
229
- ref: kendo_vue_common_1.setRef(this, 'gradient'),
230
- value: this.computedValue || undefined,
231
- onChange: this.onGradientChangeHandler,
232
- on: this.v3 ? undefined : {
233
- 'change': this.onGradientChangeHandler,
234
- 'focus': this.onFocusHandler,
235
- 'blur': this.onBlurHandler,
236
- 'keydown': this.onKeyDownHandler
237
- },
238
- onFocus: this.onFocusHandler,
239
- onBlur: this.onBlurHandler,
240
- onKeydown: this.onKeyDownHandler
241
- }, this.gradientSettings));
242
- };
243
-
244
- var renderPalette = function renderPalette() {
245
- return h(ColorPalette_1.ColorPalette, __assign({
237
+ view = _b.view,
238
+ selectedView = _b.selectedView,
239
+ showClearButton = _b.showClearButton,
240
+ showPreview = _b.showPreview,
241
+ showButtons = _b.showButtons,
242
+ popupSettings = _b.popupSettings;
243
+
244
+ var renderFlatColorPicker = function renderFlatColorPicker() {
245
+ return h(FlatColorPicker_1.FlatColorPicker, __assign({
246
246
  onKeydown: this.onKeyDownHandler,
247
247
  on: this.v3 ? undefined : {
248
248
  'keydown': this.onKeyDownHandler,
249
- 'change': this.onPaletteChangeHandler,
250
- 'blur': this.onBlurHandler
249
+ 'change': this.onFlatChangeHandler,
250
+ 'blur': this.onBlurHandler,
251
+ 'viewchange': this.onViewChange
251
252
  },
252
- ref: kendo_vue_common_1.setRef(this, 'palette'),
253
+ ref: kendo_vue_common_1.setRef(this, 'flatcolorpicker'),
254
+ view: view,
255
+ selectedView: selectedView,
256
+ showClearButton: showClearButton,
257
+ showPreview: showPreview,
258
+ showButtons: showButtons,
253
259
  value: this.computedValue || undefined,
254
260
  attrs: this.v3 ? undefined : __assign({
255
- value: this.computedValue || undefined
256
- }, this.paletteSettings),
257
- onChange: this.onPaletteChangeHandler,
258
- onBlur: this.onBlurHandler
259
- }, this.paletteSettings));
261
+ view: view,
262
+ selectedView: selectedView,
263
+ showClearButton: showClearButton,
264
+ showPreview: showPreview,
265
+ showButtons: showButtons,
266
+ value: this.computedValue || undefined,
267
+ paletteSettings: this.paletteSettings,
268
+ gradientSettings: this.gradientSettings
269
+ }, this.flatColorPickerSettings),
270
+ onChange: this.onFlatChangeHandler,
271
+ onBlur: this.onBlurHandler,
272
+ onViewchange: this.onViewChange
273
+ }, this.flatColorPickerSettings));
260
274
  }; // const dir = useDir(focusableElementGuid, props.dir);
261
275
 
262
276
 
@@ -328,18 +342,22 @@ var ColorPickerVue2 = {
328
342
  dir: dir,
329
343
  attrs: this.v3 ? undefined : {
330
344
  dir: dir,
345
+ id: this._popupId,
331
346
  open: this.computedOpen,
332
- popupAnchor: this.focusableElementGuid
347
+ popupAnchor: this.focusableElementGuid,
348
+ popupSettings: __assign({}, popupSettings)
333
349
  },
350
+ id: this._popupId,
334
351
  open: this.computedOpen,
335
352
  onOpen: this.onOpenHandler,
336
353
  on: this.v3 ? undefined : {
337
354
  "open": this.onOpenHandler
338
355
  },
339
- popupAnchor: this.focusableElementGuid
356
+ popupAnchor: this.focusableElementGuid,
357
+ popupSettings: __assign({}, popupSettings)
340
358
  }, this.v3 ? function () {
341
- return [(view === 'combo' || view === 'gradient') && renderGradiente.call(_this2), (view === 'combo' || view === 'palette') && renderPalette.call(_this2)];
342
- } : [(view === 'combo' || view === 'gradient') && renderGradiente.call(_this2), (view === 'combo' || view === 'palette') && renderPalette.call(_this2)])]);
359
+ return [renderFlatColorPicker.call(_this2)];
360
+ } : [renderFlatColorPicker.call(_this2)])]);
343
361
  },
344
362
  methods: {
345
363
  focusElement: function focusElement() {
@@ -406,10 +424,10 @@ var ColorPickerVue2 = {
406
424
  },
407
425
  onOpenHandler: function onOpenHandler() {
408
426
  // Skip content autofocus when in controlled mode
409
- var palette = kendo_vue_common_1.getRef(this, 'palette');
427
+ var flatcolorpicker = kendo_vue_common_1.getRef(this, 'flatcolorpicker');
410
428
 
411
- if (palette) {
412
- palette.focus();
429
+ if (flatcolorpicker) {
430
+ flatcolorpicker.focus();
413
431
  }
414
432
  },
415
433
  onClickHandler: function onClickHandler() {
@@ -422,9 +440,7 @@ var ColorPickerVue2 = {
422
440
  });
423
441
  },
424
442
  isViewFocused: function isViewFocused() {
425
- var _a, _b;
426
-
427
- return !!((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest('.k-colorpalette')) || !!((_b = document.activeElement) === null || _b === void 0 ? void 0 : _b.closest('.k-colorgradient'));
443
+ return !!(document.activeElement && document.activeElement.closest("#" + this._popupId));
428
444
  },
429
445
  onButtonBlur: function onButtonBlur() {
430
446
  this.focused = this.isViewFocused();
@@ -464,8 +480,11 @@ var ColorPickerVue2 = {
464
480
  event: event
465
481
  });
466
482
  },
483
+ onViewChange: function onViewChange(event) {
484
+ this.$emit('viewchange', event);
485
+ },
467
486
  onChangeHandler: function onChangeHandler(event, isPalette) {
468
- var currentValue = isPalette ? event.rgbaValue : event.value;
487
+ var currentValue = event.value;
469
488
 
470
489
  if (!this.isValueControlled) {
471
490
  this.currentValue = currentValue;
@@ -475,15 +494,16 @@ var ColorPickerVue2 = {
475
494
  this.setOpen(false);
476
495
  }
477
496
 
497
+ this.$emit('changemodel', currentValue);
498
+ this.$emit('update:modelRgbaValue', event.rgbaValue);
499
+ this.$emit('update:modelValue', currentValue);
478
500
  this.$emit('change', {
479
501
  value: currentValue,
502
+ rgbaValue: event.rgbaValue,
480
503
  event: event
481
504
  });
482
505
  },
483
- onGradientChangeHandler: function onGradientChangeHandler(event) {
484
- this.onChangeHandler(event, false);
485
- },
486
- onPaletteChangeHandler: function onPaletteChangeHandler(event) {
506
+ onFlatChangeHandler: function onFlatChangeHandler(event) {
487
507
  this.onChangeHandler(event, true);
488
508
  }
489
509
  }
@@ -3,6 +3,10 @@ declare type DefaultData<V> = object | ((this: V) => {});
3
3
  declare type DefaultMethods<V> = {
4
4
  [key: string]: (this: V, ...args: any[]) => any;
5
5
  };
6
+ import { ColorPickerChangeEvent } from '../main';
7
+ import { FlatColorPickerViewChangeEvent } from './interfaces/FlatColorPickerViewChangeEvent';
8
+ import { ColorGradientProps } from './interfaces/ColorGradientProps';
9
+ import { ColorPickerPaletteSettings } from './interfaces/ColorPickerPaletteSettings';
6
10
  /**
7
11
  * Represents the properties of [FlatColorPicker](% slug api_inputs_flatcolorpicker %) component.
8
12
  */
@@ -12,13 +16,21 @@ export interface FlatColorPickerProps {
12
16
  */
13
17
  id?: string;
14
18
  /**
15
- * Sets additional classes to the FlatColorPicker.
19
+ * Sets the color model value.
16
20
  */
17
- className?: string;
21
+ modelValue?: string;
22
+ /**
23
+ * The model rgba value of the FlatColorPicker.
24
+ */
25
+ modelRgbaValue?: string;
18
26
  /**
19
27
  * Sets the color value.
20
28
  */
21
29
  value?: string;
30
+ /**
31
+ * Sets the previous color value.
32
+ */
33
+ prevValue?: string;
22
34
  /**
23
35
  * Sets the `tabIndex` property of the FlatColorPicker.
24
36
  */
@@ -28,13 +40,21 @@ export interface FlatColorPickerProps {
28
40
  */
29
41
  disabled?: boolean;
30
42
  /**
31
- * Sets the FlatColorPicker view. The default is `ColorGradient`.
43
+ * Sets the FlatColorPicker view. The default is `combo`.
32
44
  */
33
- view?: 'ColorGradient' | 'ColorPalette' | string;
45
+ view?: 'combo' | 'gradient' | 'palette' | string;
46
+ /**
47
+ * Sets the FlatColorPicker selected view index. The default is `0`.
48
+ */
49
+ selectedView?: number;
34
50
  /**
35
51
  * Sets custom header component.
36
52
  */
37
53
  header?: any;
54
+ /**
55
+ * Sets custom footer component.
56
+ */
57
+ footer?: any;
38
58
  /**
39
59
  * Specifies whether clear button will be rendered in the header.
40
60
  */
@@ -47,9 +67,25 @@ export interface FlatColorPickerProps {
47
67
  * Specifies whether action buttons will be rendered in the footer.
48
68
  */
49
69
  showButtons?: boolean;
70
+ /**
71
+ * Configures the ColorPalette that is displayed in the ColorPicker popup.
72
+ */
73
+ paletteSettings?: ColorPickerPaletteSettings;
74
+ /**
75
+ * Configures the ColorGradient that is displayed in the ColorPicker popup.
76
+ */
77
+ gradientSettings?: ColorGradientProps;
78
+ /**
79
+ * The event handler that will be fired when the view is changed.
80
+ */
81
+ onViewchange?: (event: FlatColorPickerViewChangeEvent) => void;
82
+ /**
83
+ * The event handler that will be fired when the user edits the value.
84
+ */
85
+ onChange?: (event: ColorPickerChangeEvent) => void;
50
86
  }
51
87
  /**
52
- * Represents the target (element and props) of the FlatColorPicker.
88
+ * @hidden
53
89
  */
54
90
  export interface FlatColorPickerHandle {
55
91
  /**