@progress/kendo-vue-inputs 3.3.6 → 3.4.1-dev.202206280838
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.
- package/dist/cdn/js/kendo-vue-inputs.js +1 -1
- package/dist/es/colors/ColorContrastLabels.d.ts +49 -0
- package/dist/es/colors/ColorContrastLabels.js +79 -0
- package/dist/es/colors/ColorContrastSvg.d.ts +50 -0
- package/dist/es/colors/ColorContrastSvg.js +108 -0
- package/dist/es/colors/ColorGradient.d.ts +51 -0
- package/dist/es/colors/ColorGradient.js +407 -0
- package/dist/es/colors/ColorInput.d.ts +54 -0
- package/dist/es/colors/ColorInput.js +268 -0
- package/dist/es/colors/FlatColorPicker.d.ts +103 -0
- package/dist/es/colors/FlatColorPicker.js +294 -0
- package/dist/es/colors/HexInput.d.ts +51 -0
- package/dist/es/colors/HexInput.js +71 -0
- package/dist/es/colors/interfaces/ColorGradientChangeEvent.d.ts +9 -0
- package/dist/es/colors/interfaces/ColorGradientChangeEvent.js +0 -0
- package/dist/es/colors/interfaces/ColorGradientProps.d.ts +56 -0
- package/dist/es/colors/interfaces/ColorGradientProps.js +0 -0
- package/dist/es/input-separator/InputSeparator.d.ts +8 -1
- package/dist/es/input-separator/InputSeparator.js +8 -1
- package/dist/es/main.d.ts +1 -0
- package/dist/es/main.js +1 -0
- package/dist/es/messages/index.d.ts +15 -0
- package/dist/es/messages/index.js +15 -0
- package/dist/es/numerictextbox/NumericTextBox.d.ts +4 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/range-slider/RangeSlider.js +2 -2
- package/dist/es/slider/Slider.d.ts +4 -0
- package/dist/npm/colors/ColorContrastLabels.d.ts +49 -0
- package/dist/npm/colors/ColorContrastLabels.js +91 -0
- package/dist/npm/colors/ColorContrastSvg.d.ts +50 -0
- package/dist/npm/colors/ColorContrastSvg.js +119 -0
- package/dist/npm/colors/ColorGradient.d.ts +51 -0
- package/dist/npm/colors/ColorGradient.js +426 -0
- package/dist/npm/colors/ColorInput.d.ts +54 -0
- package/dist/npm/colors/ColorInput.js +283 -0
- package/dist/npm/colors/FlatColorPicker.d.ts +103 -0
- package/dist/npm/colors/FlatColorPicker.js +309 -0
- package/dist/npm/colors/HexInput.d.ts +51 -0
- package/dist/npm/colors/HexInput.js +83 -0
- package/dist/npm/colors/interfaces/ColorGradientChangeEvent.d.ts +9 -0
- package/dist/npm/colors/interfaces/ColorGradientChangeEvent.js +2 -0
- package/dist/npm/colors/interfaces/ColorGradientProps.d.ts +56 -0
- package/dist/npm/colors/interfaces/ColorGradientProps.js +2 -0
- package/dist/npm/input-separator/InputSeparator.d.ts +8 -1
- package/dist/npm/input-separator/InputSeparator.js +8 -1
- package/dist/npm/main.d.ts +1 -0
- package/dist/npm/main.js +1 -0
- package/dist/npm/messages/index.d.ts +15 -0
- package/dist/npm/messages/index.js +16 -1
- package/dist/npm/numerictextbox/NumericTextBox.d.ts +4 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/range-slider/RangeSlider.js +2 -2
- package/dist/npm/slider/Slider.d.ts +4 -0
- package/package.json +11 -11
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
import { parseColor } from './utils/color-parser';
|
|
6
|
+
import { isPresent } from './utils/misc';
|
|
7
|
+
import { Input } from '../input/Input';
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
var HexInputVue2 = {
|
|
13
|
+
name: 'KendoHexInput',
|
|
14
|
+
props: {
|
|
15
|
+
hex: String,
|
|
16
|
+
disabled: Boolean
|
|
17
|
+
},
|
|
18
|
+
data: function data() {
|
|
19
|
+
return {
|
|
20
|
+
hex: this.$props.hex,
|
|
21
|
+
originalHex: this.$props.hex
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
setup: !gh ? undefined : function () {
|
|
26
|
+
var v3 = !!gh;
|
|
27
|
+
return {
|
|
28
|
+
v3: v3
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
render: function render(createElement) {
|
|
33
|
+
var h = gh || createElement;
|
|
34
|
+
return h(Input, {
|
|
35
|
+
value: this.hex,
|
|
36
|
+
attrs: this.v3 ? undefined : {
|
|
37
|
+
value: this.hex,
|
|
38
|
+
disabled: this.$props.disabled
|
|
39
|
+
},
|
|
40
|
+
onChange: this.onChange,
|
|
41
|
+
on: this.v3 ? undefined : {
|
|
42
|
+
"change": this.onChange,
|
|
43
|
+
"blur": this.onBlur
|
|
44
|
+
},
|
|
45
|
+
onBlur: this.onBlur,
|
|
46
|
+
disabled: this.$props.disabled
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
methods: {
|
|
50
|
+
onChange: function onChange(event) {
|
|
51
|
+
var hex = event.target.value;
|
|
52
|
+
var value = parseColor(hex, 'rgba');
|
|
53
|
+
this.hex = hex;
|
|
54
|
+
|
|
55
|
+
if (isPresent(value)) {
|
|
56
|
+
this.$props.onHexChange(hex, value, event);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
onBlur: function onBlur() {
|
|
60
|
+
if (!isPresent(parseColor(this.hex, 'rgba'))) {
|
|
61
|
+
this.hex = this.originalHex;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* @hidden
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
var HexInput = HexInputVue2;
|
|
71
|
+
export { HexInput, HexInputVue2 };
|
|
File without changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ColorGradientChangeEvent } from './ColorGradientChangeEvent';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the props of the [KendoReact ColorGradient component]({% slug overview_colorgradient %}).
|
|
4
|
+
*/
|
|
5
|
+
export interface ColorGradientProps {
|
|
6
|
+
/**
|
|
7
|
+
* The default value of the ColorGradient.
|
|
8
|
+
*/
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The value of the ColorGradient.
|
|
12
|
+
*/
|
|
13
|
+
value?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Determines the event handler that will be fired when the user edits the value.
|
|
16
|
+
*/
|
|
17
|
+
onChange?: (event: ColorGradientChangeEvent) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Represents the focus event.
|
|
20
|
+
*/
|
|
21
|
+
onFocus?: (event: any) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Determines whether the alpha slider and the alpha input will be displayed. Defaults to `true`.
|
|
24
|
+
*/
|
|
25
|
+
opacity?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Enables the color contrast tool.
|
|
28
|
+
* Sets the background color that will be compared to the selected value.
|
|
29
|
+
* The tool will calculate the contrast ratio between two colors.
|
|
30
|
+
* Currently, only the RGBA format is supported.
|
|
31
|
+
*/
|
|
32
|
+
backgroundColor?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Determines whether the ColorGradient is disabled
|
|
35
|
+
* ([more information and example]({% slug disabled_colorgradient %})).
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Sets the `tabIndex` property of the ColorGradient.
|
|
41
|
+
*/
|
|
42
|
+
tabIndex?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Specifies the id of the component.
|
|
45
|
+
*/
|
|
46
|
+
id?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Identifies the element(s) which will describe the component, similar to [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
|
|
49
|
+
* For example these elements could contain error or hint message.
|
|
50
|
+
*/
|
|
51
|
+
ariaDescribedBy?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Identifies the element(s) which will label the component.
|
|
54
|
+
*/
|
|
55
|
+
ariaLabelledBy?: string;
|
|
56
|
+
}
|
|
File without changes
|
|
@@ -13,7 +13,14 @@ export interface InputSeparatorAllMethods extends Vue2type {
|
|
|
13
13
|
*/
|
|
14
14
|
declare let InputSeparatorVue2: ComponentOptions<InputSeparatorAllMethods, DefaultData<{}>, DefaultMethods<InputSeparatorAllMethods>, {}, RecordPropsDefinition<{}>>;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Represents the Kendo UI for Vue InputSeparator component. It can be used as a semarator
|
|
17
|
+
* between horizontal icons in prefi and suffic templates.
|
|
18
|
+
*
|
|
19
|
+
* ```jsx
|
|
20
|
+
* <template>
|
|
21
|
+
* <InputSeparator>
|
|
22
|
+
* </template>
|
|
23
|
+
* ```
|
|
17
24
|
*/
|
|
18
25
|
declare const InputSeparator: DefineComponent<{}, any, {}, {}, {}, {}, {}, {}, string, {}, {}, {}>;
|
|
19
26
|
export { InputSeparator, InputSeparatorVue2 };
|
|
@@ -28,7 +28,14 @@ var InputSeparatorVue2 = {
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Represents the Kendo UI for Vue InputSeparator component. It can be used as a semarator
|
|
32
|
+
* between horizontal icons in prefi and suffic templates.
|
|
33
|
+
*
|
|
34
|
+
* ```jsx
|
|
35
|
+
* <template>
|
|
36
|
+
* <InputSeparator>
|
|
37
|
+
* </template>
|
|
38
|
+
* ```
|
|
32
39
|
*/
|
|
33
40
|
|
|
34
41
|
var InputSeparator = InputSeparatorVue2;
|
package/dist/es/main.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './colors/interfaces/ColorPickerFocusEvent';
|
|
|
10
10
|
export * from './colors/interfaces/ColorPickerPaletteSettings';
|
|
11
11
|
export * from './colors/interfaces/ColorPickerPopupSettings';
|
|
12
12
|
export * from './colors/interfaces/ColorPickerProps';
|
|
13
|
+
export * from './colors/FlatColorPicker';
|
|
13
14
|
export { Switch, SwitchVue2, SwitchProps, SwitchState, SwitchChangeEvent } from './switch/Switch';
|
|
14
15
|
export * from './input-separator/InputSeparator';
|
|
15
16
|
export * from './input/Input';
|
package/dist/es/main.js
CHANGED
|
@@ -8,6 +8,7 @@ export * from './colors/interfaces/ColorPickerFocusEvent';
|
|
|
8
8
|
export * from './colors/interfaces/ColorPickerPaletteSettings';
|
|
9
9
|
export * from './colors/interfaces/ColorPickerPopupSettings';
|
|
10
10
|
export * from './colors/interfaces/ColorPickerProps';
|
|
11
|
+
export * from './colors/FlatColorPicker';
|
|
11
12
|
export { Switch, SwitchVue2 } from './switch/Switch';
|
|
12
13
|
export * from './input-separator/InputSeparator';
|
|
13
14
|
export * from './input/Input';
|
|
@@ -58,6 +58,14 @@ export declare const colorGradientPass = "colorGradient.colorGradientPass";
|
|
|
58
58
|
* @hidden
|
|
59
59
|
*/
|
|
60
60
|
export declare const colorGradientFail = "colorGradient.colorGradientFail";
|
|
61
|
+
/**
|
|
62
|
+
* @hidden
|
|
63
|
+
*/
|
|
64
|
+
export declare const flatColorPickerCancelBtn = "flatColorPicker.cancelBtn";
|
|
65
|
+
/**
|
|
66
|
+
* @hidden
|
|
67
|
+
*/
|
|
68
|
+
export declare const flatColorPickerApplyBtn = "flatColorPicker.applyBtn";
|
|
61
69
|
/**
|
|
62
70
|
* @hidden
|
|
63
71
|
*/
|
|
@@ -74,6 +82,10 @@ export declare const radioButtonValidation = "radioButton.validation";
|
|
|
74
82
|
* @hidden
|
|
75
83
|
*/
|
|
76
84
|
export declare const switchValidation = "switch.validation";
|
|
85
|
+
/**
|
|
86
|
+
* @hidden
|
|
87
|
+
*/
|
|
88
|
+
export declare const colorPickerDropdownButtonAriaLabel = "colorPicker.dropdownButtonAriaLabel";
|
|
77
89
|
/**
|
|
78
90
|
* @hidden
|
|
79
91
|
*/
|
|
@@ -93,8 +105,11 @@ export declare const messages: {
|
|
|
93
105
|
"colorGradient.colorGradientAAALevel": string;
|
|
94
106
|
"colorGradient.colorGradientPass": string;
|
|
95
107
|
"colorGradient.colorGradientFail": string;
|
|
108
|
+
"flatColorPicker.cancelBtn": string;
|
|
109
|
+
"flatColorPicker.applyBtn": string;
|
|
96
110
|
"checkbox.validation": string;
|
|
97
111
|
"checkbox.optionalText": string;
|
|
98
112
|
"radioButton.validation": string;
|
|
99
113
|
"switch.validation": string;
|
|
114
|
+
"colorPicker.dropdownButtonAriaLabel": string;
|
|
100
115
|
};
|
|
@@ -59,6 +59,14 @@ export var colorGradientPass = 'colorGradient.colorGradientPass';
|
|
|
59
59
|
* @hidden
|
|
60
60
|
*/
|
|
61
61
|
export var colorGradientFail = 'colorGradient.colorGradientFail';
|
|
62
|
+
/**
|
|
63
|
+
* @hidden
|
|
64
|
+
*/
|
|
65
|
+
export var flatColorPickerCancelBtn = 'flatColorPicker.cancelBtn';
|
|
66
|
+
/**
|
|
67
|
+
* @hidden
|
|
68
|
+
*/
|
|
69
|
+
export var flatColorPickerApplyBtn = 'flatColorPicker.applyBtn';
|
|
62
70
|
/**
|
|
63
71
|
* @hidden
|
|
64
72
|
*/
|
|
@@ -75,6 +83,10 @@ export var radioButtonValidation = 'radioButton.validation';
|
|
|
75
83
|
* @hidden
|
|
76
84
|
*/
|
|
77
85
|
export var switchValidation = 'switch.validation';
|
|
86
|
+
/**
|
|
87
|
+
* @hidden
|
|
88
|
+
*/
|
|
89
|
+
export var colorPickerDropdownButtonAriaLabel = 'colorPicker.dropdownButtonAriaLabel';
|
|
78
90
|
/**
|
|
79
91
|
* @hidden
|
|
80
92
|
*/
|
|
@@ -94,8 +106,11 @@ export var messages = (_a = {},
|
|
|
94
106
|
_a[colorGradientAAALevel] = 'AAA',
|
|
95
107
|
_a[colorGradientPass] = 'Pass',
|
|
96
108
|
_a[colorGradientFail] = 'Fail',
|
|
109
|
+
_a[flatColorPickerCancelBtn] = 'Cancel',
|
|
110
|
+
_a[flatColorPickerApplyBtn] = 'Apply',
|
|
97
111
|
_a[checkboxValidation] = 'Please check this box if you want to proceed!',
|
|
98
112
|
_a[checkboxOptionalText] = '(Optional)',
|
|
99
113
|
_a[radioButtonValidation] = 'Please select option if you want to proceed!',
|
|
100
114
|
_a[switchValidation] = 'Please turn on if you want to proceed!',
|
|
115
|
+
_a[colorPickerDropdownButtonAriaLabel] = 'Select',
|
|
101
116
|
_a);
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-vue-inputs',
|
|
6
6
|
productName: 'Kendo UI for Vue',
|
|
7
7
|
productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1656404888,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning'
|
|
11
11
|
};
|
|
@@ -188,9 +188,9 @@ var RangeSliderVue2 = {
|
|
|
188
188
|
"aria-describedby": this.$props.ariaDescribedBy
|
|
189
189
|
}, [// @ts-ignore function children
|
|
190
190
|
h(Draggable, {
|
|
191
|
-
onDrag: this.
|
|
191
|
+
onDrag: this.handleTrackDrag,
|
|
192
192
|
on: this.v3 ? undefined : {
|
|
193
|
-
"drag": this.
|
|
193
|
+
"drag": this.handleTrackDrag,
|
|
194
194
|
"press": this.handleTrackPress,
|
|
195
195
|
"release": this.handleTrackRelease
|
|
196
196
|
},
|
|
@@ -13,6 +13,10 @@ export interface SliderChangeEvent {
|
|
|
13
13
|
* The current value of the Slider.
|
|
14
14
|
*/
|
|
15
15
|
value: number;
|
|
16
|
+
/**
|
|
17
|
+
* The native event.
|
|
18
|
+
*/
|
|
19
|
+
event: any;
|
|
16
20
|
}
|
|
17
21
|
/**
|
|
18
22
|
* Represents the props of the [Kendo UI for Vue Slider component]({% slug overview_slider %}).
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from '../additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
import { RGBA } from './models/rgba';
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export interface ColorContrastLabelsProps {
|
|
11
|
+
bgColor: RGBA;
|
|
12
|
+
rgba: RGBA;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export interface ColorContrastLabelsState {
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
export interface ColorContrastLabelsComputed {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
28
|
+
export interface ColorContrastLabelsMethods {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
*/
|
|
34
|
+
export interface ColorContrastLabelsData {
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @hidden
|
|
38
|
+
*/
|
|
39
|
+
export interface ColorContrastLabelsAll extends Vue2type, ColorContrastLabelsMethods, ColorContrastLabelsData, ColorContrastLabelsComputed, ColorContrastLabelsState {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @hidden
|
|
43
|
+
*/
|
|
44
|
+
declare let ColorContrastLabelsVue2: ComponentOptions<ColorContrastLabelsAll, DefaultData<ColorContrastLabelsData>, DefaultMethods<ColorContrastLabelsAll>, ColorContrastLabelsComputed, RecordPropsDefinition<ColorContrastLabelsProps>>;
|
|
45
|
+
/**
|
|
46
|
+
* @hidden
|
|
47
|
+
*/
|
|
48
|
+
declare const ColorContrastLabels: DefineComponent<ColorContrastLabelsProps, any, ColorContrastLabelsData, ColorContrastLabelsComputed, ColorContrastLabelsMethods, {}, {}, {}, string, ColorContrastLabelsProps, ColorContrastLabelsProps, {}>;
|
|
49
|
+
export { ColorContrastLabels, ColorContrastLabelsVue2 };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ColorContrastLabelsVue2 = exports.ColorContrastLabels = void 0; // @ts-ignore
|
|
7
|
+
|
|
8
|
+
var Vue = require("vue");
|
|
9
|
+
|
|
10
|
+
var allVue = Vue;
|
|
11
|
+
var gh = allVue.h;
|
|
12
|
+
|
|
13
|
+
var kendo_vue_intl_1 = require("@progress/kendo-vue-intl");
|
|
14
|
+
|
|
15
|
+
var messages_1 = require("../messages");
|
|
16
|
+
|
|
17
|
+
var color_parser_1 = require("./utils/color-parser");
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
var ColorContrastLabelsVue2 = {
|
|
24
|
+
name: 'KendoColorContrastLabels',
|
|
25
|
+
props: {
|
|
26
|
+
bgColor: Object,
|
|
27
|
+
rgba: Object
|
|
28
|
+
},
|
|
29
|
+
inject: {
|
|
30
|
+
kendoLocalizationService: {
|
|
31
|
+
default: null
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
setup: !gh ? undefined : function () {
|
|
36
|
+
var v3 = !!gh;
|
|
37
|
+
return {
|
|
38
|
+
v3: v3
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
render: function render(createElement) {
|
|
43
|
+
var h = gh || createElement;
|
|
44
|
+
var ls = kendo_vue_intl_1.provideLocalizationService(this);
|
|
45
|
+
var contrastRatioMessage = ls.toLanguageString(messages_1.colorGradientContrastRatio, messages_1.messages[messages_1.colorGradientContrastRatio]);
|
|
46
|
+
var AALevelMessage = ls.toLanguageString(messages_1.colorGradientAALevel, messages_1.messages[messages_1.colorGradientAALevel]);
|
|
47
|
+
var AAALevelMessage = ls.toLanguageString(messages_1.colorGradientAAALevel, messages_1.messages[messages_1.colorGradientAAALevel]);
|
|
48
|
+
var passMessage = ls.toLanguageString(messages_1.colorGradientPass, messages_1.messages[messages_1.colorGradientPass]);
|
|
49
|
+
var failMessage = ls.toLanguageString(messages_1.colorGradientFail, messages_1.messages[messages_1.colorGradientFail]);
|
|
50
|
+
var contrast = color_parser_1.getContrastFromTwoRGBAs(this.$props.rgba, this.$props.bgColor);
|
|
51
|
+
var requiredAAContrast = 4.5.toFixed(1);
|
|
52
|
+
var requiredAAAContrast = 7.0.toFixed(1);
|
|
53
|
+
var contrastText = contrastRatioMessage + ": " + contrast.toFixed(2);
|
|
54
|
+
var aaText = AALevelMessage + ": " + requiredAAContrast;
|
|
55
|
+
var aaaText = AAALevelMessage + ": " + requiredAAAContrast;
|
|
56
|
+
var success = h("span", {
|
|
57
|
+
"class": "k-contrast-validation k-text-success"
|
|
58
|
+
}, [passMessage, " ", h("span", {
|
|
59
|
+
"class": "k-icon k-i-check"
|
|
60
|
+
})]);
|
|
61
|
+
var error = h("span", {
|
|
62
|
+
"class": "k-contrast-validation k-text-error"
|
|
63
|
+
}, [failMessage, " ", h("span", {
|
|
64
|
+
"class": "k-icon k-i-close"
|
|
65
|
+
})]);
|
|
66
|
+
return h("div", {
|
|
67
|
+
"class": "k-vbox k-colorgradient-color-contrast"
|
|
68
|
+
}, [h("div", {
|
|
69
|
+
"class": "k-contrast-ratio"
|
|
70
|
+
}, [h("span", {
|
|
71
|
+
"class": "k-contrast-ratio-text"
|
|
72
|
+
}, [contrastText]), contrast >= 4.5 ? h("span", {
|
|
73
|
+
"class": "k-contrast-validation k-text-success"
|
|
74
|
+
}, [h("span", {
|
|
75
|
+
"class": "k-icon k-i-check"
|
|
76
|
+
}), contrast >= 7 && h("span", {
|
|
77
|
+
"class": "k-icon k-i-check"
|
|
78
|
+
})]) : h("span", {
|
|
79
|
+
"class": "k-contrast-validation k-text-error"
|
|
80
|
+
}, [h("span", {
|
|
81
|
+
"class": "k-icon k-i-close"
|
|
82
|
+
})])]), h("div", [h("span", [aaText]), contrast >= 4.5 ? success : error]), h("div", [h("span", [aaaText]), contrast >= 7 ? success : error])]);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
exports.ColorContrastLabelsVue2 = ColorContrastLabelsVue2;
|
|
86
|
+
/**
|
|
87
|
+
* @hidden
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
var ColorContrastLabels = ColorContrastLabelsVue2;
|
|
91
|
+
exports.ColorContrastLabels = ColorContrastLabels;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from '../additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
import { HSVA } from './models/hsva';
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export interface ColorContrastSvgProps {
|
|
11
|
+
metrics: ClientRect | undefined;
|
|
12
|
+
backgroundColor: string;
|
|
13
|
+
hsva: HSVA;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
export interface ColorContrastSvgState {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
export interface ColorContrastSvgComputed {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
*/
|
|
29
|
+
export interface ColorContrastSvgMethods {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @hidden
|
|
34
|
+
*/
|
|
35
|
+
export interface ColorContrastSvgData {
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @hidden
|
|
39
|
+
*/
|
|
40
|
+
export interface ColorContrastSvgAll extends Vue2type, ColorContrastSvgMethods, ColorContrastSvgData, ColorContrastSvgComputed, ColorContrastSvgState {
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @hidden
|
|
44
|
+
*/
|
|
45
|
+
declare let ColorContrastSvgVue2: ComponentOptions<ColorContrastSvgAll, DefaultData<ColorContrastSvgData>, DefaultMethods<ColorContrastSvgAll>, ColorContrastSvgComputed, RecordPropsDefinition<ColorContrastSvgProps>>;
|
|
46
|
+
/**
|
|
47
|
+
* @hidden
|
|
48
|
+
*/
|
|
49
|
+
declare const ColorContrastSvg: DefineComponent<ColorContrastSvgProps, any, ColorContrastSvgData, ColorContrastSvgComputed, ColorContrastSvgMethods, {}, {}, {}, string, ColorContrastSvgProps, ColorContrastSvgProps, {}>;
|
|
50
|
+
export { ColorContrastSvg, ColorContrastSvgVue2 };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ColorContrastSvgVue2 = exports.ColorContrastSvg = void 0; // @ts-ignore
|
|
7
|
+
|
|
8
|
+
var Vue = require("vue");
|
|
9
|
+
|
|
10
|
+
var allVue = Vue;
|
|
11
|
+
var gh = allVue.h;
|
|
12
|
+
|
|
13
|
+
var svg_calc_1 = require("./utils/svg-calc");
|
|
14
|
+
|
|
15
|
+
var color_parser_1 = require("./utils/color-parser");
|
|
16
|
+
|
|
17
|
+
var AA_CONTRAST = 4.5;
|
|
18
|
+
var AAA_CONTRAST = 7;
|
|
19
|
+
var STEP_COUNT = 16;
|
|
20
|
+
/**
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
var ColorContrastSvgVue2 = {
|
|
25
|
+
name: 'KendoColorContrastSvg',
|
|
26
|
+
props: {
|
|
27
|
+
metrics: Object,
|
|
28
|
+
backgroundColor: String,
|
|
29
|
+
hsva: Object
|
|
30
|
+
},
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
setup: !gh ? undefined : function () {
|
|
33
|
+
var v3 = !!gh;
|
|
34
|
+
return {
|
|
35
|
+
v3: v3
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
render: function render(createElement) {
|
|
40
|
+
var h = gh || createElement;
|
|
41
|
+
|
|
42
|
+
var renderSvgCurveLine = function renderSvgCurveLine() {
|
|
43
|
+
var _this = this;
|
|
44
|
+
|
|
45
|
+
var gradientRectMetrics = this.$props.metrics;
|
|
46
|
+
|
|
47
|
+
var findValue = function findValue(contrast, saturation, low, high, comparer) {
|
|
48
|
+
var mid = (low + high) / 2;
|
|
49
|
+
var hsva = Object.assign({}, _this.$props.hsva, {
|
|
50
|
+
s: saturation / gradientRectMetrics.width,
|
|
51
|
+
v: 1 - mid / gradientRectMetrics.height
|
|
52
|
+
});
|
|
53
|
+
var currentContrast = color_parser_1.getContrastFromTwoRGBAs(color_parser_1.getRGBA(color_parser_1.getColorFromHSV(hsva)), color_parser_1.getRGBA(_this.$props.backgroundColor || ''));
|
|
54
|
+
|
|
55
|
+
if (low + 0.5 > high) {
|
|
56
|
+
if (currentContrast < contrast + 1 && currentContrast > contrast - 1) {
|
|
57
|
+
return mid;
|
|
58
|
+
} else {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (comparer(currentContrast, contrast)) {
|
|
64
|
+
return findValue(contrast, saturation, low, high - (high - low) / 2, comparer);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return findValue(contrast, saturation, low + (high - low) / 2, high, comparer);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
var getPaths = function getPaths(contrast, stepCount, reversed) {
|
|
71
|
+
if (reversed === void 0) {
|
|
72
|
+
reversed = false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
var points = [];
|
|
76
|
+
|
|
77
|
+
for (var i = 0; i <= gradientRectMetrics.width; i += gradientRectMetrics.width / stepCount) {
|
|
78
|
+
var value = findValue(contrast, i, 0, gradientRectMetrics.height, reversed ? function (a, b) {
|
|
79
|
+
return a < b;
|
|
80
|
+
} : function (a, b) {
|
|
81
|
+
return a > b;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
if (value !== null) {
|
|
85
|
+
points.push([i, value]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return points;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
var bezierCommandCalc = svg_calc_1.bezierCommand(svg_calc_1.controlPoint(svg_calc_1.line));
|
|
93
|
+
return svg_calc_1.svgPath(getPaths(AA_CONTRAST, STEP_COUNT), bezierCommandCalc) + svg_calc_1.svgPath(getPaths(AA_CONTRAST, STEP_COUNT, true), bezierCommandCalc) + svg_calc_1.svgPath(getPaths(AAA_CONTRAST, STEP_COUNT), bezierCommandCalc) + svg_calc_1.svgPath(getPaths(AAA_CONTRAST, STEP_COUNT, true), bezierCommandCalc);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return h("svg", {
|
|
97
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
98
|
+
attrs: this.v3 ? undefined : {
|
|
99
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
100
|
+
},
|
|
101
|
+
"class": 'k-color-contrast-svg',
|
|
102
|
+
style: {
|
|
103
|
+
position: 'absolute',
|
|
104
|
+
overflow: 'visible',
|
|
105
|
+
pointerEvents: 'none',
|
|
106
|
+
left: 0,
|
|
107
|
+
top: 0,
|
|
108
|
+
zIndex: 3
|
|
109
|
+
}
|
|
110
|
+
}, [renderSvgCurveLine.call(this)]);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
exports.ColorContrastSvgVue2 = ColorContrastSvgVue2;
|
|
114
|
+
/**
|
|
115
|
+
* @hidden
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
var ColorContrastSvg = ColorContrastSvgVue2;
|
|
119
|
+
exports.ColorContrastSvg = ColorContrastSvg;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from '../additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
import { HSVA } from './models/hsva';
|
|
7
|
+
import { RGBA } from './models/rgba';
|
|
8
|
+
import { ColorGradientProps } from './interfaces/ColorGradientProps';
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export interface ColorGradientState {
|
|
13
|
+
guidId: string;
|
|
14
|
+
gradientWrapper: any;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
export interface ColorGradientComputed {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
export interface ColorGradientMethods {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
export interface ColorGradientData {
|
|
32
|
+
hsva: HSVA;
|
|
33
|
+
backgroundColor: string;
|
|
34
|
+
rgba: RGBA;
|
|
35
|
+
hex: string;
|
|
36
|
+
isFirstRender: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @hidden
|
|
40
|
+
*/
|
|
41
|
+
export interface ColorGradientAll extends Vue2type, ColorGradientMethods, ColorGradientData, ColorGradientComputed, ColorGradientState {
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @hidden
|
|
45
|
+
*/
|
|
46
|
+
declare let ColorGradientVue2: ComponentOptions<ColorGradientAll, DefaultData<ColorGradientData>, DefaultMethods<ColorGradientAll>, ColorGradientComputed, RecordPropsDefinition<ColorGradientProps>>;
|
|
47
|
+
/**
|
|
48
|
+
* @hidden
|
|
49
|
+
*/
|
|
50
|
+
declare const ColorGradient: DefineComponent<ColorGradientProps, any, ColorGradientData, ColorGradientComputed, ColorGradientMethods, {}, {}, {}, string, ColorGradientProps, ColorGradientProps, {}>;
|
|
51
|
+
export { ColorGradient, ColorGradientVue2 };
|