@progress/kendo-react-inputs 5.13.0-dev.202304201410 → 5.13.0-dev.202304251043
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-react-inputs.js +1 -1
- package/dist/es/colors/ColorGradient.d.ts +2 -0
- package/dist/es/colors/ColorGradient.js +4 -2
- package/dist/es/colors/ColorInput.d.ts +5 -4
- package/dist/es/colors/ColorInput.js +3 -5
- package/dist/es/colors/FlatColorPicker.d.ts +54 -2
- package/dist/es/colors/FlatColorPicker.js +71 -29
- package/dist/es/colors/interfaces/ColorGradientProps.d.ts +6 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/npm/colors/ColorGradient.d.ts +2 -0
- package/dist/npm/colors/ColorGradient.js +4 -2
- package/dist/npm/colors/ColorInput.d.ts +5 -4
- package/dist/npm/colors/ColorInput.js +3 -5
- package/dist/npm/colors/FlatColorPicker.d.ts +54 -2
- package/dist/npm/colors/FlatColorPicker.js +71 -29
- package/dist/npm/colors/interfaces/ColorGradientProps.d.ts +6 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-react-inputs.js +1 -1
- package/package.json +16 -16
|
@@ -29,6 +29,7 @@ export declare class ColorGradientWithoutContext extends React.Component<ColorGr
|
|
|
29
29
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
30
30
|
opacity: PropTypes.Requireable<boolean>;
|
|
31
31
|
backgroundColor: PropTypes.Requireable<string>;
|
|
32
|
+
format: PropTypes.Requireable<any>;
|
|
32
33
|
disabled: PropTypes.Requireable<boolean>;
|
|
33
34
|
style: PropTypes.Requireable<any>;
|
|
34
35
|
id: PropTypes.Requireable<string>;
|
|
@@ -43,6 +44,7 @@ export declare class ColorGradientWithoutContext extends React.Component<ColorGr
|
|
|
43
44
|
static defaultProps: {
|
|
44
45
|
opacity: boolean;
|
|
45
46
|
role: string;
|
|
47
|
+
format: "rgb" | "hex" | "rgba";
|
|
46
48
|
};
|
|
47
49
|
/**
|
|
48
50
|
* @hidden
|
|
@@ -253,7 +253,7 @@ var ColorGradientWithoutContext = /** @class */ (function (_super) {
|
|
|
253
253
|
React.createElement(Slider, { value: this.state.hsva.h, buttons: false, vertical: true, min: 0, max: 360, step: 5, onChange: this.onHueSliderChange, className: "k-hue-slider k-colorgradient-slider", disabled: this.props.disabled, ariaLabel: lS.toLanguageString(colorGradientHueSliderLabel, messages[colorGradientHueSliderLabel]) }),
|
|
254
254
|
this.props.opacity &&
|
|
255
255
|
React.createElement(Slider, { value: isPresent(this.state.hsva.a) ? this.state.hsva.a * 100 : 100, buttons: false, vertical: true, min: 0, max: 100, step: 1, ariaLabel: lS.toLanguageString(colorGradientAlphaSliderLabel, messages[colorGradientAlphaSliderLabel]), onChange: this.onAlphaSliderChange, className: "k-alpha-slider k-colorgradient-slider", disabled: this.props.disabled, ref: function (el) { return _this.alphaSlider = el; } }))),
|
|
256
|
-
React.createElement(ColorInput, { rgba: this.state.rgba, onRgbaChange: this.onRgbaChange, hex: this.state.hex, onHexChange: this.onHexChange, opacity: this.props.opacity, disabled: this.props.disabled }),
|
|
256
|
+
React.createElement(ColorInput, { rgba: this.state.rgba, onRgbaChange: this.onRgbaChange, hex: this.state.hex, onHexChange: this.onHexChange, opacity: this.props.opacity, disabled: this.props.disabled, defaultInputMode: this.props.format }),
|
|
257
257
|
this.props.backgroundColor && (React.createElement(ColorContrastLabels, { bgColor: getRGBA(this.props.backgroundColor), rgba: this.state.rgba }))));
|
|
258
258
|
};
|
|
259
259
|
ColorGradientWithoutContext.displayName = 'ColorGradient';
|
|
@@ -267,6 +267,7 @@ var ColorGradientWithoutContext = /** @class */ (function (_super) {
|
|
|
267
267
|
onFocus: PropTypes.func,
|
|
268
268
|
opacity: PropTypes.bool,
|
|
269
269
|
backgroundColor: PropTypes.string,
|
|
270
|
+
format: PropTypes.any,
|
|
270
271
|
disabled: PropTypes.bool,
|
|
271
272
|
style: PropTypes.any,
|
|
272
273
|
id: PropTypes.string,
|
|
@@ -280,7 +281,8 @@ var ColorGradientWithoutContext = /** @class */ (function (_super) {
|
|
|
280
281
|
*/
|
|
281
282
|
ColorGradientWithoutContext.defaultProps = {
|
|
282
283
|
opacity: true,
|
|
283
|
-
role: 'textbox'
|
|
284
|
+
role: 'textbox',
|
|
285
|
+
format: 'rgb'
|
|
284
286
|
};
|
|
285
287
|
return ColorGradientWithoutContext;
|
|
286
288
|
}(React.Component));
|
|
@@ -11,14 +11,15 @@ export interface ColorInputProps {
|
|
|
11
11
|
onHexChange: any;
|
|
12
12
|
opacity: boolean;
|
|
13
13
|
disabled?: boolean;
|
|
14
|
+
defaultInputMode?: 'rgba' | 'rgb' | 'hex';
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* @hidden
|
|
17
18
|
*/
|
|
18
|
-
export default class ColorInput extends React.Component<ColorInputProps, {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export default class ColorInput extends React.Component<ColorInputProps, {
|
|
20
|
+
inputMode: string;
|
|
21
|
+
}> {
|
|
22
|
+
constructor(props: ColorInputProps);
|
|
22
23
|
render(): JSX.Element;
|
|
23
24
|
private onRgbaRChange;
|
|
24
25
|
private onRgbaGChange;
|
|
@@ -41,11 +41,8 @@ var modes = ['rgba', 'rgb', 'hex'];
|
|
|
41
41
|
*/
|
|
42
42
|
var ColorInput = /** @class */ (function (_super) {
|
|
43
43
|
__extends(ColorInput, _super);
|
|
44
|
-
function ColorInput() {
|
|
45
|
-
var _this = _super
|
|
46
|
-
_this.state = {
|
|
47
|
-
inputMode: modes[1]
|
|
48
|
-
};
|
|
44
|
+
function ColorInput(props) {
|
|
45
|
+
var _this = _super.call(this, props) || this;
|
|
49
46
|
_this.onRgbaRChange = function (event) {
|
|
50
47
|
_this.dispatchRgbaChange({ r: event.value }, event);
|
|
51
48
|
};
|
|
@@ -58,6 +55,7 @@ var ColorInput = /** @class */ (function (_super) {
|
|
|
58
55
|
_this.onRgbaAChange = function (event) {
|
|
59
56
|
_this.dispatchRgbaChange({ a: event.value }, event);
|
|
60
57
|
};
|
|
58
|
+
_this.state = { inputMode: props.defaultInputMode || modes[1] };
|
|
61
59
|
return _this;
|
|
62
60
|
}
|
|
63
61
|
ColorInput.prototype.render = function () {
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The arguments for the `onChange` FlatColorPicker event.
|
|
4
|
+
*/
|
|
5
|
+
export interface FlatColorPickerChangeEvent {
|
|
6
|
+
/**
|
|
7
|
+
* The current value of the FlatColorPicker.
|
|
8
|
+
*/
|
|
9
|
+
value: string;
|
|
10
|
+
/**
|
|
11
|
+
* A React Synthetic Event.
|
|
12
|
+
*/
|
|
13
|
+
syntheticEvent: React.SyntheticEvent<any>;
|
|
14
|
+
/**
|
|
15
|
+
* A native DOM event.
|
|
16
|
+
*/
|
|
17
|
+
nativeEvent: any;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Represents the properties of [FlatColorPicker]({% slug api_inputs_flatcolorpicker %}) component.
|
|
4
21
|
*/
|
|
5
22
|
export interface FlatColorPickerProps {
|
|
6
23
|
/**
|
|
@@ -19,6 +36,26 @@ export interface FlatColorPickerProps {
|
|
|
19
36
|
* Sets the color value.
|
|
20
37
|
*/
|
|
21
38
|
value?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Sets the default color value.
|
|
41
|
+
*/
|
|
42
|
+
defaultValue?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The event handler that will be fired when the user edits the value.
|
|
45
|
+
*/
|
|
46
|
+
onChange?: (event: FlatColorPickerChangeEvent) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Specifies whether we should display the opacity slider to allow selection of transparency.
|
|
49
|
+
*
|
|
50
|
+
* @default true
|
|
51
|
+
*/
|
|
52
|
+
opacity?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the default input format in the gradient input editor.
|
|
55
|
+
*
|
|
56
|
+
* @default 'rgb'
|
|
57
|
+
*/
|
|
58
|
+
format?: 'hex' | 'rgba' | 'rgb';
|
|
22
59
|
/**
|
|
23
60
|
* Sets the `tabIndex` property of the FlatColorPicker.
|
|
24
61
|
*/
|
|
@@ -72,8 +109,23 @@ export interface FlatColorPickerHandle {
|
|
|
72
109
|
* The focus event callback.
|
|
73
110
|
*/
|
|
74
111
|
focus: () => void;
|
|
112
|
+
/**
|
|
113
|
+
* The current value of the FlatColorPicker.
|
|
114
|
+
*/
|
|
115
|
+
value: string;
|
|
75
116
|
}
|
|
76
117
|
/**
|
|
77
|
-
* Represents the FlatColorPicker component.
|
|
118
|
+
* Represents the [KendoReact FlatColorPicker component]({% slug overview_flatcolorpicker %}).
|
|
119
|
+
* Accepts properties of type [FlatColorPickerProps]({% slug api_inputs_flatcolorpickerprops %}). Obtaining the [FlatColorPickerHandle]({% slug api_inputs_flatcolorpickerhandle %}).
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```jsx
|
|
123
|
+
* class App extends React.Component {
|
|
124
|
+
* render() {
|
|
125
|
+
* return <FlatColorPicker />;
|
|
126
|
+
* }
|
|
127
|
+
* }
|
|
128
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
129
|
+
* ```
|
|
78
130
|
*/
|
|
79
131
|
export declare const FlatColorPicker: React.ForwardRefExoticComponent<FlatColorPickerProps & React.RefAttributes<FlatColorPickerHandle | null>>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import * as PropTypes from 'prop-types';
|
|
3
4
|
import { classNames, validatePackage, getTabIndex } from '@progress/kendo-react-common';
|
|
@@ -7,19 +8,33 @@ import { ColorPalette, ColorGradient } from '../main';
|
|
|
7
8
|
import { packageMetadata } from '../package-metadata';
|
|
8
9
|
import { useLocalization } from '@progress/kendo-react-intl';
|
|
9
10
|
import { messages, flatColorPickerApplyBtn, flatColorPickerCancelBtn, flatColorPickerColorGradientBtn, flatColorPickerColorPaletteBtn, flatColorPickerClearBtn } from '../messages';
|
|
11
|
+
var defaultColor = 'rgba(255, 255, 255, 1)';
|
|
10
12
|
;
|
|
11
13
|
;
|
|
12
14
|
/**
|
|
13
|
-
* Represents the FlatColorPicker component.
|
|
15
|
+
* Represents the [KendoReact FlatColorPicker component]({% slug overview_flatcolorpicker %}).
|
|
16
|
+
* Accepts properties of type [FlatColorPickerProps]({% slug api_inputs_flatcolorpickerprops %}). Obtaining the [FlatColorPickerHandle]({% slug api_inputs_flatcolorpickerhandle %}).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```jsx
|
|
20
|
+
* class App extends React.Component {
|
|
21
|
+
* render() {
|
|
22
|
+
* return <FlatColorPicker />;
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
26
|
+
* ```
|
|
14
27
|
*/
|
|
15
28
|
export var FlatColorPicker = React.forwardRef(function (props, ref) {
|
|
16
29
|
validatePackage(packageMetadata);
|
|
17
30
|
var target = React.useRef(null);
|
|
18
31
|
var flatColorPickerRef = React.useRef(null);
|
|
19
32
|
var colorGradientRef = React.useRef(null);
|
|
20
|
-
var _a =
|
|
21
|
-
var
|
|
22
|
-
var
|
|
33
|
+
var _a = props.defaultValue, defaultValue = _a === void 0 ? defaultColor : _a, _b = props.showButtons, showButtons = _b === void 0 ? true : _b, _c = props.showPreview, showPreview = _c === void 0 ? true : _c, _d = props.showClearButton, showClearButton = _d === void 0 ? true : _d;
|
|
34
|
+
var _e = React.useState((props.view || 'ColorGradient') === 'ColorGradient'), colorGradientView = _e[0], setColorGradientView = _e[1];
|
|
35
|
+
var _f = React.useState(props.value || defaultValue), colorValue = _f[0], setColorValue = _f[1];
|
|
36
|
+
var _g = React.useState(props.value || defaultValue), prevColor = _g[0], setPrevColor = _g[1];
|
|
37
|
+
var value = props.value !== undefined ? props.value : prevColor;
|
|
23
38
|
var localizationService = useLocalization();
|
|
24
39
|
var focus = React.useCallback(function () {
|
|
25
40
|
if (target.current) {
|
|
@@ -29,8 +44,9 @@ export var FlatColorPicker = React.forwardRef(function (props, ref) {
|
|
|
29
44
|
React.useImperativeHandle(target, function () { return ({
|
|
30
45
|
element: flatColorPickerRef.current,
|
|
31
46
|
focus: focus,
|
|
32
|
-
props: props
|
|
33
|
-
|
|
47
|
+
props: props,
|
|
48
|
+
value: value
|
|
49
|
+
}); }, [value, focus, props]);
|
|
34
50
|
React.useImperativeHandle(ref, function () { return target.current; });
|
|
35
51
|
var handleViewChange = React.useCallback(function (viewType) {
|
|
36
52
|
if ((viewType === 'ColorGradient' && !colorGradientView) || (viewType === 'ColorPalette' && colorGradientView)) {
|
|
@@ -38,28 +54,51 @@ export var FlatColorPicker = React.forwardRef(function (props, ref) {
|
|
|
38
54
|
}
|
|
39
55
|
}, [colorGradientView]);
|
|
40
56
|
var handleResetColor = React.useCallback(function () {
|
|
41
|
-
setColorValue(
|
|
42
|
-
}, []);
|
|
57
|
+
setColorValue(defaultValue);
|
|
58
|
+
}, [defaultValue]);
|
|
43
59
|
var handleColorChange = React.useCallback(function (event) {
|
|
44
60
|
setColorValue(event.value);
|
|
45
61
|
}, []);
|
|
46
|
-
var handleApplyBtnClick = React.useCallback(function () {
|
|
62
|
+
var handleApplyBtnClick = React.useCallback(function (event) {
|
|
47
63
|
setPrevColor(colorValue);
|
|
48
|
-
|
|
64
|
+
if (props.onChange) {
|
|
65
|
+
var ev = {
|
|
66
|
+
value: colorValue,
|
|
67
|
+
nativeEvent: event.nativeEvent,
|
|
68
|
+
syntheticEvent: event
|
|
69
|
+
};
|
|
70
|
+
props.onChange.call(undefined, ev);
|
|
71
|
+
}
|
|
72
|
+
}, [colorValue, props.onChange]);
|
|
49
73
|
var handleCancelBtnClick = React.useCallback(function () {
|
|
50
|
-
setPrevColor(
|
|
74
|
+
setPrevColor(defaultColor);
|
|
51
75
|
}, []);
|
|
52
76
|
var handlePrevColorClick = React.useCallback(function () {
|
|
53
77
|
setColorValue(prevColor);
|
|
54
78
|
}, [prevColor]);
|
|
55
|
-
var handleFocus = React.useCallback(function () {
|
|
56
|
-
if (flatColorPickerRef.current) {
|
|
79
|
+
var handleFocus = React.useCallback(function (event) {
|
|
80
|
+
if (flatColorPickerRef.current && event.nativeEvent.target instanceof HTMLInputElement === false) {
|
|
57
81
|
flatColorPickerRef.current.focus();
|
|
58
82
|
}
|
|
59
83
|
}, [flatColorPickerRef]);
|
|
60
|
-
var handleFlatColorPickerBlur = React.useCallback(function () {
|
|
61
|
-
|
|
62
|
-
|
|
84
|
+
var handleFlatColorPickerBlur = React.useCallback(function (event) {
|
|
85
|
+
var _a;
|
|
86
|
+
var blurred = (!event.relatedTarget || !((_a = flatColorPickerRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.relatedTarget)));
|
|
87
|
+
if (!blurred) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (!showButtons) {
|
|
91
|
+
setPrevColor(colorValue);
|
|
92
|
+
}
|
|
93
|
+
if (!showButtons && props.onChange) {
|
|
94
|
+
var ev = {
|
|
95
|
+
value: colorValue,
|
|
96
|
+
nativeEvent: event.nativeEvent,
|
|
97
|
+
syntheticEvent: event
|
|
98
|
+
};
|
|
99
|
+
props.onChange.call(undefined, ev);
|
|
100
|
+
}
|
|
101
|
+
}, [colorValue, showButtons, props.onChange]);
|
|
63
102
|
return (React.createElement("div", { id: props.id, role: 'textbox', "aria-label": props.ariaLabel, "aria-labelledby": props.ariaLabelledBy, "aria-disabled": props.disabled ? 'true' : undefined, style: props.style, ref: flatColorPickerRef, tabIndex: getTabIndex(props.tabIndex, props.disabled), className: classNames('k-flatcolorpicker k-coloreditor', {
|
|
64
103
|
'k-disabled': props.disabled
|
|
65
104
|
}, props.className), onBlur: handleFlatColorPickerBlur },
|
|
@@ -72,35 +111,38 @@ export var FlatColorPicker = React.forwardRef(function (props, ref) {
|
|
|
72
111
|
React.createElement(Button, { type: "button", "aria-label": localizationService.toLanguageString(flatColorPickerColorPaletteBtn, messages[flatColorPickerColorPaletteBtn]), togglable: true, fillMode: 'flat', selected: !colorGradientView, onClick: function () { return handleViewChange('ColorPalette'); }, icon: "palette", svgIcon: paletteIcon }))),
|
|
73
112
|
React.createElement("div", { className: "k-spacer" }),
|
|
74
113
|
React.createElement("div", { className: "k-coloreditor-header-actions k-hstack" },
|
|
75
|
-
|
|
114
|
+
showClearButton &&
|
|
76
115
|
React.createElement(Button, { type: "button", fillMode: 'flat', onClick: handleResetColor, "aria-label": localizationService.toLanguageString(flatColorPickerClearBtn, messages[flatColorPickerClearBtn]), icon: "droplet-slash", svgIcon: dropletSlashIcon }),
|
|
77
|
-
|
|
116
|
+
showPreview &&
|
|
78
117
|
React.createElement("div", { className: "k-coloreditor-preview k-vstack" },
|
|
79
118
|
React.createElement("span", { className: "k-coloreditor-preview-color k-color-preview", style: { background: colorValue } }),
|
|
80
119
|
React.createElement("span", { className: "k-coloreditor-current-color k-color-preview", style: { background: prevColor }, onClick: handlePrevColorClick })))),
|
|
81
120
|
React.createElement("div", { className: "k-coloreditor-views k-vstack" }, colorGradientView
|
|
82
|
-
? React.createElement(ColorGradient, { ref: colorGradientRef, role: "none", tabIndex: -1, ariaLabel: undefined, value: colorValue, onChange: handleColorChange, onFocus: handleFocus })
|
|
121
|
+
? React.createElement(ColorGradient, { ref: colorGradientRef, role: "none", tabIndex: -1, ariaLabel: undefined, value: colorValue, onChange: handleColorChange, onFocus: handleFocus, opacity: props.opacity, format: props.format })
|
|
83
122
|
: React.createElement(ColorPalette, { ariaDisabled: true, ariaLabelledBy: 'required_label', value: colorValue, onChange: handleColorChange, onFocus: handleFocus })),
|
|
84
|
-
|
|
123
|
+
showButtons &&
|
|
85
124
|
React.createElement("div", { className: "k-coloreditor-footer k-actions k-actions-end" },
|
|
86
125
|
React.createElement(Button, { type: "button", className: "k-coloreditor-cancel", onClick: handleCancelBtnClick }, messages[flatColorPickerCancelBtn]),
|
|
87
126
|
React.createElement(Button, { type: "button", className: "k-coloreditor-apply k-primary", onClick: handleApplyBtnClick }, messages[flatColorPickerApplyBtn])))));
|
|
88
127
|
});
|
|
89
128
|
var propTypes = {
|
|
90
129
|
id: PropTypes.string,
|
|
130
|
+
style: PropTypes.any,
|
|
131
|
+
className: PropTypes.string,
|
|
91
132
|
value: PropTypes.string,
|
|
92
|
-
|
|
93
|
-
|
|
133
|
+
defaultValue: PropTypes.string,
|
|
134
|
+
onChange: PropTypes.func,
|
|
135
|
+
opacity: PropTypes.bool,
|
|
136
|
+
format: PropTypes.any,
|
|
137
|
+
tabIndex: PropTypes.number,
|
|
138
|
+
ariaLabel: PropTypes.string,
|
|
139
|
+
ariaLabelledBy: PropTypes.string,
|
|
140
|
+
disabled: PropTypes.bool,
|
|
141
|
+
view: PropTypes.any,
|
|
142
|
+
header: PropTypes.any,
|
|
94
143
|
showClearButton: PropTypes.bool,
|
|
95
144
|
showPreview: PropTypes.bool,
|
|
96
145
|
showButtons: PropTypes.bool
|
|
97
146
|
};
|
|
98
|
-
var defaultProps = {
|
|
99
|
-
showClearButton: true,
|
|
100
|
-
showPreview: true,
|
|
101
|
-
showButtons: true
|
|
102
|
-
};
|
|
103
147
|
FlatColorPicker.displayName = 'KendoFlatColorPicker';
|
|
104
|
-
// TODO: delete casting when @types/react is updated!
|
|
105
148
|
FlatColorPicker.propTypes = propTypes;
|
|
106
|
-
FlatColorPicker.defaultProps = defaultProps;
|
|
@@ -85,4 +85,10 @@ export interface ColorGradientProps {
|
|
|
85
85
|
* Represents the text rendered inside the `hsv` drag handle.
|
|
86
86
|
*/
|
|
87
87
|
ariaValueText?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Sets the default input format in the gradient input editor.
|
|
90
|
+
*
|
|
91
|
+
* @default 'rgb'
|
|
92
|
+
*/
|
|
93
|
+
format?: 'rgba' | 'rgb' | 'hex';
|
|
88
94
|
}
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-react-inputs',
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1682418230,
|
|
9
9
|
version: '',
|
|
10
10
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
11
11
|
};
|
|
@@ -29,6 +29,7 @@ export declare class ColorGradientWithoutContext extends React.Component<ColorGr
|
|
|
29
29
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
30
30
|
opacity: PropTypes.Requireable<boolean>;
|
|
31
31
|
backgroundColor: PropTypes.Requireable<string>;
|
|
32
|
+
format: PropTypes.Requireable<any>;
|
|
32
33
|
disabled: PropTypes.Requireable<boolean>;
|
|
33
34
|
style: PropTypes.Requireable<any>;
|
|
34
35
|
id: PropTypes.Requireable<string>;
|
|
@@ -43,6 +44,7 @@ export declare class ColorGradientWithoutContext extends React.Component<ColorGr
|
|
|
43
44
|
static defaultProps: {
|
|
44
45
|
opacity: boolean;
|
|
45
46
|
role: string;
|
|
47
|
+
format: "rgb" | "hex" | "rgba";
|
|
46
48
|
};
|
|
47
49
|
/**
|
|
48
50
|
* @hidden
|
|
@@ -256,7 +256,7 @@ var ColorGradientWithoutContext = /** @class */ (function (_super) {
|
|
|
256
256
|
React.createElement(main_1.Slider, { value: this.state.hsva.h, buttons: false, vertical: true, min: 0, max: 360, step: 5, onChange: this.onHueSliderChange, className: "k-hue-slider k-colorgradient-slider", disabled: this.props.disabled, ariaLabel: lS.toLanguageString(messages_1.colorGradientHueSliderLabel, messages_1.messages[messages_1.colorGradientHueSliderLabel]) }),
|
|
257
257
|
this.props.opacity &&
|
|
258
258
|
React.createElement(main_1.Slider, { value: (0, misc_1.isPresent)(this.state.hsva.a) ? this.state.hsva.a * 100 : 100, buttons: false, vertical: true, min: 0, max: 100, step: 1, ariaLabel: lS.toLanguageString(messages_1.colorGradientAlphaSliderLabel, messages_1.messages[messages_1.colorGradientAlphaSliderLabel]), onChange: this.onAlphaSliderChange, className: "k-alpha-slider k-colorgradient-slider", disabled: this.props.disabled, ref: function (el) { return _this.alphaSlider = el; } }))),
|
|
259
|
-
React.createElement(ColorInput_1.default, { rgba: this.state.rgba, onRgbaChange: this.onRgbaChange, hex: this.state.hex, onHexChange: this.onHexChange, opacity: this.props.opacity, disabled: this.props.disabled }),
|
|
259
|
+
React.createElement(ColorInput_1.default, { rgba: this.state.rgba, onRgbaChange: this.onRgbaChange, hex: this.state.hex, onHexChange: this.onHexChange, opacity: this.props.opacity, disabled: this.props.disabled, defaultInputMode: this.props.format }),
|
|
260
260
|
this.props.backgroundColor && (React.createElement(ColorContrastLabels_1.ColorContrastLabels, { bgColor: (0, color_parser_1.getRGBA)(this.props.backgroundColor), rgba: this.state.rgba }))));
|
|
261
261
|
};
|
|
262
262
|
ColorGradientWithoutContext.displayName = 'ColorGradient';
|
|
@@ -270,6 +270,7 @@ var ColorGradientWithoutContext = /** @class */ (function (_super) {
|
|
|
270
270
|
onFocus: PropTypes.func,
|
|
271
271
|
opacity: PropTypes.bool,
|
|
272
272
|
backgroundColor: PropTypes.string,
|
|
273
|
+
format: PropTypes.any,
|
|
273
274
|
disabled: PropTypes.bool,
|
|
274
275
|
style: PropTypes.any,
|
|
275
276
|
id: PropTypes.string,
|
|
@@ -283,7 +284,8 @@ var ColorGradientWithoutContext = /** @class */ (function (_super) {
|
|
|
283
284
|
*/
|
|
284
285
|
ColorGradientWithoutContext.defaultProps = {
|
|
285
286
|
opacity: true,
|
|
286
|
-
role: 'textbox'
|
|
287
|
+
role: 'textbox',
|
|
288
|
+
format: 'rgb'
|
|
287
289
|
};
|
|
288
290
|
return ColorGradientWithoutContext;
|
|
289
291
|
}(React.Component));
|
|
@@ -11,14 +11,15 @@ export interface ColorInputProps {
|
|
|
11
11
|
onHexChange: any;
|
|
12
12
|
opacity: boolean;
|
|
13
13
|
disabled?: boolean;
|
|
14
|
+
defaultInputMode?: 'rgba' | 'rgb' | 'hex';
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* @hidden
|
|
17
18
|
*/
|
|
18
|
-
export default class ColorInput extends React.Component<ColorInputProps, {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export default class ColorInput extends React.Component<ColorInputProps, {
|
|
20
|
+
inputMode: string;
|
|
21
|
+
}> {
|
|
22
|
+
constructor(props: ColorInputProps);
|
|
22
23
|
render(): JSX.Element;
|
|
23
24
|
private onRgbaRChange;
|
|
24
25
|
private onRgbaGChange;
|
|
@@ -43,11 +43,8 @@ var modes = ['rgba', 'rgb', 'hex'];
|
|
|
43
43
|
*/
|
|
44
44
|
var ColorInput = /** @class */ (function (_super) {
|
|
45
45
|
__extends(ColorInput, _super);
|
|
46
|
-
function ColorInput() {
|
|
47
|
-
var _this = _super
|
|
48
|
-
_this.state = {
|
|
49
|
-
inputMode: modes[1]
|
|
50
|
-
};
|
|
46
|
+
function ColorInput(props) {
|
|
47
|
+
var _this = _super.call(this, props) || this;
|
|
51
48
|
_this.onRgbaRChange = function (event) {
|
|
52
49
|
_this.dispatchRgbaChange({ r: event.value }, event);
|
|
53
50
|
};
|
|
@@ -60,6 +57,7 @@ var ColorInput = /** @class */ (function (_super) {
|
|
|
60
57
|
_this.onRgbaAChange = function (event) {
|
|
61
58
|
_this.dispatchRgbaChange({ a: event.value }, event);
|
|
62
59
|
};
|
|
60
|
+
_this.state = { inputMode: props.defaultInputMode || modes[1] };
|
|
63
61
|
return _this;
|
|
64
62
|
}
|
|
65
63
|
ColorInput.prototype.render = function () {
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The arguments for the `onChange` FlatColorPicker event.
|
|
4
|
+
*/
|
|
5
|
+
export interface FlatColorPickerChangeEvent {
|
|
6
|
+
/**
|
|
7
|
+
* The current value of the FlatColorPicker.
|
|
8
|
+
*/
|
|
9
|
+
value: string;
|
|
10
|
+
/**
|
|
11
|
+
* A React Synthetic Event.
|
|
12
|
+
*/
|
|
13
|
+
syntheticEvent: React.SyntheticEvent<any>;
|
|
14
|
+
/**
|
|
15
|
+
* A native DOM event.
|
|
16
|
+
*/
|
|
17
|
+
nativeEvent: any;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Represents the properties of [FlatColorPicker]({% slug api_inputs_flatcolorpicker %}) component.
|
|
4
21
|
*/
|
|
5
22
|
export interface FlatColorPickerProps {
|
|
6
23
|
/**
|
|
@@ -19,6 +36,26 @@ export interface FlatColorPickerProps {
|
|
|
19
36
|
* Sets the color value.
|
|
20
37
|
*/
|
|
21
38
|
value?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Sets the default color value.
|
|
41
|
+
*/
|
|
42
|
+
defaultValue?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The event handler that will be fired when the user edits the value.
|
|
45
|
+
*/
|
|
46
|
+
onChange?: (event: FlatColorPickerChangeEvent) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Specifies whether we should display the opacity slider to allow selection of transparency.
|
|
49
|
+
*
|
|
50
|
+
* @default true
|
|
51
|
+
*/
|
|
52
|
+
opacity?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the default input format in the gradient input editor.
|
|
55
|
+
*
|
|
56
|
+
* @default 'rgb'
|
|
57
|
+
*/
|
|
58
|
+
format?: 'hex' | 'rgba' | 'rgb';
|
|
22
59
|
/**
|
|
23
60
|
* Sets the `tabIndex` property of the FlatColorPicker.
|
|
24
61
|
*/
|
|
@@ -72,8 +109,23 @@ export interface FlatColorPickerHandle {
|
|
|
72
109
|
* The focus event callback.
|
|
73
110
|
*/
|
|
74
111
|
focus: () => void;
|
|
112
|
+
/**
|
|
113
|
+
* The current value of the FlatColorPicker.
|
|
114
|
+
*/
|
|
115
|
+
value: string;
|
|
75
116
|
}
|
|
76
117
|
/**
|
|
77
|
-
* Represents the FlatColorPicker component.
|
|
118
|
+
* Represents the [KendoReact FlatColorPicker component]({% slug overview_flatcolorpicker %}).
|
|
119
|
+
* Accepts properties of type [FlatColorPickerProps]({% slug api_inputs_flatcolorpickerprops %}). Obtaining the [FlatColorPickerHandle]({% slug api_inputs_flatcolorpickerhandle %}).
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```jsx
|
|
123
|
+
* class App extends React.Component {
|
|
124
|
+
* render() {
|
|
125
|
+
* return <FlatColorPicker />;
|
|
126
|
+
* }
|
|
127
|
+
* }
|
|
128
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
129
|
+
* ```
|
|
78
130
|
*/
|
|
79
131
|
export declare const FlatColorPicker: React.ForwardRefExoticComponent<FlatColorPickerProps & React.RefAttributes<FlatColorPickerHandle | null>>;
|