@progress/kendo-react-inputs 4.13.0-dev.202111291459 → 4.13.0-dev.202111300702
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/checkbox/Checkbox.d.ts +7 -0
- package/dist/es/checkbox/Checkbox.js +10 -2
- package/dist/es/colors/ColorGradient.d.ts +34 -14
- package/dist/es/colors/ColorGradient.js +50 -35
- package/dist/es/colors/ColorPalette.d.ts +33 -14
- package/dist/es/colors/ColorPalette.js +47 -33
- package/dist/es/colors/ColorPicker.d.ts +7 -0
- package/dist/es/colors/ColorPicker.js +10 -2
- package/dist/es/input/Input.d.ts +40 -4
- package/dist/es/input/Input.js +37 -21
- package/dist/es/main.d.ts +6 -6
- package/dist/es/main.js +6 -6
- package/dist/es/maskedtextbox/MaskedTextBox.d.ts +69 -4
- package/dist/es/maskedtextbox/MaskedTextBox.js +42 -27
- package/dist/es/numerictextbox/NumericTextBox.d.ts +7 -0
- package/dist/es/numerictextbox/NumericTextBox.js +10 -2
- package/dist/es/numerictextbox/interfaces/NumericTextBoxProps.d.ts +3 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/radiobutton/RadioButton.d.ts +13 -0
- package/dist/es/radiobutton/RadioButton.js +16 -2
- package/dist/es/radiobutton/RadioGroup.d.ts +13 -0
- package/dist/es/radiobutton/RadioGroup.js +16 -2
- package/dist/es/range-slider/RangeSlider.d.ts +11 -1
- package/dist/es/range-slider/RangeSlider.js +14 -3
- package/dist/es/rating/Rating.d.ts +11 -1
- package/dist/es/rating/Rating.js +14 -3
- package/dist/es/slider/Slider.d.ts +24 -4
- package/dist/es/slider/Slider.js +31 -16
- package/dist/es/switch/Switch.d.ts +40 -4
- package/dist/es/switch/Switch.js +39 -24
- package/dist/es/textarea/TextArea.d.ts +11 -0
- package/dist/es/textarea/TextArea.js +14 -2
- package/dist/es/utils.d.ts +4 -0
- package/dist/es/utils.js +20 -0
- package/dist/npm/checkbox/Checkbox.d.ts +7 -0
- package/dist/npm/checkbox/Checkbox.js +9 -1
- package/dist/npm/colors/ColorGradient.d.ts +34 -14
- package/dist/npm/colors/ColorGradient.js +49 -34
- package/dist/npm/colors/ColorPalette.d.ts +33 -14
- package/dist/npm/colors/ColorPalette.js +46 -32
- package/dist/npm/colors/ColorPicker.d.ts +7 -0
- package/dist/npm/colors/ColorPicker.js +9 -1
- package/dist/npm/input/Input.d.ts +40 -4
- package/dist/npm/input/Input.js +36 -20
- package/dist/npm/main.d.ts +6 -6
- package/dist/npm/main.js +18 -6
- package/dist/npm/maskedtextbox/MaskedTextBox.d.ts +69 -4
- package/dist/npm/maskedtextbox/MaskedTextBox.js +41 -26
- package/dist/npm/numerictextbox/NumericTextBox.d.ts +7 -0
- package/dist/npm/numerictextbox/NumericTextBox.js +9 -1
- package/dist/npm/numerictextbox/interfaces/NumericTextBoxProps.d.ts +3 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/radiobutton/RadioButton.d.ts +13 -0
- package/dist/npm/radiobutton/RadioButton.js +15 -1
- package/dist/npm/radiobutton/RadioGroup.d.ts +13 -0
- package/dist/npm/radiobutton/RadioGroup.js +15 -1
- package/dist/npm/range-slider/RangeSlider.d.ts +11 -1
- package/dist/npm/range-slider/RangeSlider.js +13 -2
- package/dist/npm/rating/Rating.d.ts +11 -1
- package/dist/npm/rating/Rating.js +13 -2
- package/dist/npm/slider/Slider.d.ts +24 -4
- package/dist/npm/slider/Slider.js +30 -15
- package/dist/npm/switch/Switch.d.ts +40 -4
- package/dist/npm/switch/Switch.js +38 -23
- package/dist/npm/textarea/TextArea.d.ts +11 -0
- package/dist/npm/textarea/TextArea.js +13 -1
- package/dist/npm/utils.d.ts +4 -0
- package/dist/npm/utils.js +23 -0
- package/dist/systemjs/kendo-react-inputs.js +1 -1
- package/package.json +16 -11
|
@@ -16,20 +16,9 @@ export interface ColorGradientState {
|
|
|
16
16
|
isFirstRender: boolean;
|
|
17
17
|
guid: string;
|
|
18
18
|
}
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* @example
|
|
23
|
-
* ```jsx
|
|
24
|
-
* class App extends React.Component {
|
|
25
|
-
* render() {
|
|
26
|
-
* return <ColorGradient />;
|
|
27
|
-
* }
|
|
28
|
-
* }
|
|
29
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare class ColorGradient extends React.Component<ColorGradientProps, ColorGradientState> {
|
|
19
|
+
/** @hidden */
|
|
20
|
+
export declare class ColorGradientWithoutContext extends React.Component<ColorGradientProps, ColorGradientState> {
|
|
21
|
+
static displayName: string;
|
|
33
22
|
/**
|
|
34
23
|
* @hidden
|
|
35
24
|
*/
|
|
@@ -158,3 +147,34 @@ export declare class ColorGradient extends React.Component<ColorGradientProps, C
|
|
|
158
147
|
*/
|
|
159
148
|
render(): JSX.Element;
|
|
160
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Represents the PropsContext of the `ColorGradient` component.
|
|
152
|
+
* Used for global configuration of all `ColorGradient` instances.
|
|
153
|
+
*
|
|
154
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
155
|
+
*/
|
|
156
|
+
export declare const ColorGradientPropsContext: React.Context<(p: ColorGradientProps) => ColorGradientProps>;
|
|
157
|
+
/**
|
|
158
|
+
* Represent the `ref` of the ColorGradient component.
|
|
159
|
+
*/
|
|
160
|
+
export interface ColorGradientHandle extends Pick<ColorGradientWithoutContext, keyof ColorGradientWithoutContext> {
|
|
161
|
+
}
|
|
162
|
+
/** @hidden */
|
|
163
|
+
export declare type ColorGradient = ColorGradientHandle;
|
|
164
|
+
/**
|
|
165
|
+
* Represents the [KendoReact ColorGradient component]({% slug overview_colorgradient %}).
|
|
166
|
+
*
|
|
167
|
+
* Accepts properties of type [ColorGradientProps]({% slug api_inputs_colorgradientprops %}).
|
|
168
|
+
* Obtaining the `ref` returns an object of type [ColorGradientHandle]({% slug api_inputs_colorgradienthandle %}).
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```jsx
|
|
172
|
+
* class App extends React.Component {
|
|
173
|
+
* render() {
|
|
174
|
+
* return <ColorGradient />;
|
|
175
|
+
* }
|
|
176
|
+
* }
|
|
177
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
export declare const ColorGradient: React.ForwardRefExoticComponent<ColorGradientProps & React.RefAttributes<any>>;
|
|
@@ -27,22 +27,10 @@ var ColorContrastLabels_1 = require("./ColorContrastLabels");
|
|
|
27
27
|
var ColorContrastSvg_1 = require("./ColorContrastSvg");
|
|
28
28
|
var FORMAT = 'rgba';
|
|
29
29
|
var DEFAULT_SELECTED_COLOR = 'rgba(255, 255, 255, 1)';
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* ```jsx
|
|
35
|
-
* class App extends React.Component {
|
|
36
|
-
* render() {
|
|
37
|
-
* return <ColorGradient />;
|
|
38
|
-
* }
|
|
39
|
-
* }
|
|
40
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
var ColorGradient = /** @class */ (function (_super) {
|
|
44
|
-
__extends(ColorGradient, _super);
|
|
45
|
-
function ColorGradient(props) {
|
|
30
|
+
/** @hidden */
|
|
31
|
+
var ColorGradientWithoutContext = /** @class */ (function (_super) {
|
|
32
|
+
__extends(ColorGradientWithoutContext, _super);
|
|
33
|
+
function ColorGradientWithoutContext(props) {
|
|
46
34
|
var _this = _super.call(this, props) || this;
|
|
47
35
|
/**
|
|
48
36
|
* @hidden
|
|
@@ -131,23 +119,23 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
131
119
|
};
|
|
132
120
|
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
133
121
|
var value = props.value || props.defaultValue || color_parser_1.parseColor(DEFAULT_SELECTED_COLOR, FORMAT);
|
|
134
|
-
_this.state = Object.assign({},
|
|
122
|
+
_this.state = Object.assign({}, ColorGradientWithoutContext.getStateFromValue(value), { isFirstRender: true, guid: kendo_react_common_1.guid() });
|
|
135
123
|
return _this;
|
|
136
124
|
}
|
|
137
125
|
/**
|
|
138
126
|
* @hidden
|
|
139
127
|
*/
|
|
140
|
-
|
|
128
|
+
ColorGradientWithoutContext.getDerivedStateFromProps = function (props, state) {
|
|
141
129
|
if (props.value && !state.isFirstRender) {
|
|
142
130
|
// The component is in controlled mode.
|
|
143
|
-
return
|
|
131
|
+
return ColorGradientWithoutContext.getStateFromValue(props.value, state.guid);
|
|
144
132
|
}
|
|
145
133
|
return null;
|
|
146
134
|
};
|
|
147
135
|
/**
|
|
148
136
|
* @hidden
|
|
149
137
|
*/
|
|
150
|
-
|
|
138
|
+
ColorGradientWithoutContext.prototype.componentDidMount = function () {
|
|
151
139
|
this.setAlphaSliderBackground(this.state.backgroundColor);
|
|
152
140
|
if (this.state.isFirstRender) {
|
|
153
141
|
this.setState({ isFirstRender: false });
|
|
@@ -156,13 +144,13 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
156
144
|
/**
|
|
157
145
|
* @hidden
|
|
158
146
|
*/
|
|
159
|
-
|
|
147
|
+
ColorGradientWithoutContext.prototype.componentWillUnmount = function () {
|
|
160
148
|
color_cache_1.removeCachedColor(this.state.guid);
|
|
161
149
|
};
|
|
162
150
|
/**
|
|
163
151
|
* @hidden
|
|
164
152
|
*/
|
|
165
|
-
|
|
153
|
+
ColorGradientWithoutContext.prototype.componentDidUpdate = function (_, prevState) {
|
|
166
154
|
if (prevState.backgroundColor !== this.state.backgroundColor) {
|
|
167
155
|
this.setAlphaSliderBackground(this.state.backgroundColor);
|
|
168
156
|
}
|
|
@@ -170,7 +158,7 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
170
158
|
/**
|
|
171
159
|
* @hidden
|
|
172
160
|
*/
|
|
173
|
-
|
|
161
|
+
ColorGradientWithoutContext.prototype.renderRectangleDragHandle = function () {
|
|
174
162
|
var style = {};
|
|
175
163
|
if (!this.state.isFirstRender) {
|
|
176
164
|
var gradientRectMetrics = this.getGradientRectMetrics();
|
|
@@ -184,7 +172,7 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
184
172
|
/**
|
|
185
173
|
* @hidden
|
|
186
174
|
*/
|
|
187
|
-
|
|
175
|
+
ColorGradientWithoutContext.prototype.handleHsvaChange = function (hsva, syntheticEvent, nativeEvent) {
|
|
188
176
|
var value = color_parser_1.getColorFromHSV(hsva);
|
|
189
177
|
if (this.isUncontrolled) {
|
|
190
178
|
var hex = color_parser_1.parseColor(value, 'hex');
|
|
@@ -198,7 +186,7 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
198
186
|
/**
|
|
199
187
|
* @hidden
|
|
200
188
|
*/
|
|
201
|
-
|
|
189
|
+
ColorGradientWithoutContext.prototype.dispatchChangeEvent = function (value, syntheticEvent, nativeEvent) {
|
|
202
190
|
if (this.props.onChange) {
|
|
203
191
|
this.props.onChange.call(undefined, { syntheticEvent: syntheticEvent, nativeEvent: nativeEvent, target: this, value: value });
|
|
204
192
|
}
|
|
@@ -206,7 +194,7 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
206
194
|
/**
|
|
207
195
|
* @hidden
|
|
208
196
|
*/
|
|
209
|
-
|
|
197
|
+
ColorGradientWithoutContext.getStateFromValue = function (value, componentGuid) {
|
|
210
198
|
if (!misc_1.isPresent(color_parser_1.parseColor(value, 'hex'))) {
|
|
211
199
|
// Validate/sanitize the input.
|
|
212
200
|
value = DEFAULT_SELECTED_COLOR;
|
|
@@ -220,12 +208,12 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
220
208
|
/**
|
|
221
209
|
* @hidden
|
|
222
210
|
*/
|
|
223
|
-
|
|
211
|
+
ColorGradientWithoutContext.prototype.setAlphaSliderBackground = function (backgroundColor) {
|
|
224
212
|
if (this.props.opacity && this.alphaSlider && this.alphaSlider.sliderTrack) {
|
|
225
213
|
this.alphaSlider.sliderTrack.style.background = "linear-gradient(to top, transparent, " + backgroundColor + ")";
|
|
226
214
|
}
|
|
227
215
|
};
|
|
228
|
-
Object.defineProperty(
|
|
216
|
+
Object.defineProperty(ColorGradientWithoutContext.prototype, "isUncontrolled", {
|
|
229
217
|
/**
|
|
230
218
|
* @hidden
|
|
231
219
|
*/
|
|
@@ -238,13 +226,13 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
238
226
|
/**
|
|
239
227
|
* @hidden
|
|
240
228
|
*/
|
|
241
|
-
|
|
229
|
+
ColorGradientWithoutContext.prototype.getGradientRectMetrics = function () {
|
|
242
230
|
return this.gradientWrapper.getBoundingClientRect();
|
|
243
231
|
};
|
|
244
232
|
/**
|
|
245
233
|
* @hidden
|
|
246
234
|
*/
|
|
247
|
-
|
|
235
|
+
ColorGradientWithoutContext.prototype.render = function () {
|
|
248
236
|
var _this = this;
|
|
249
237
|
var className = kendo_react_common_1.classNames('k-colorgradient', { 'k-state-disabled': this.props.disabled });
|
|
250
238
|
return (React.createElement("div", { id: this.props.id, className: className, "aria-disabled": this.props.disabled ? 'true' : undefined, style: this.props.style, ref: function (el) { return _this.wrapper = el; }, tabIndex: kendo_react_common_1.getTabIndex(this.props.tabIndex, this.props.disabled), "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, onFocus: this.onFocus },
|
|
@@ -261,10 +249,11 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
261
249
|
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 }),
|
|
262
250
|
this.props.backgroundColor && (React.createElement(ColorContrastLabels_1.ColorContrastLabels, { bgColor: color_parser_1.getRGBA(this.props.backgroundColor), rgba: this.state.rgba }))));
|
|
263
251
|
};
|
|
252
|
+
ColorGradientWithoutContext.displayName = 'ColorGradient';
|
|
264
253
|
/**
|
|
265
254
|
* @hidden
|
|
266
255
|
*/
|
|
267
|
-
|
|
256
|
+
ColorGradientWithoutContext.propTypes = {
|
|
268
257
|
defaultValue: PropTypes.string,
|
|
269
258
|
value: PropTypes.string,
|
|
270
259
|
onChange: PropTypes.func,
|
|
@@ -280,9 +269,35 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
280
269
|
/**
|
|
281
270
|
* @hidden
|
|
282
271
|
*/
|
|
283
|
-
|
|
272
|
+
ColorGradientWithoutContext.defaultProps = {
|
|
284
273
|
opacity: true
|
|
285
274
|
};
|
|
286
|
-
return
|
|
275
|
+
return ColorGradientWithoutContext;
|
|
287
276
|
}(React.Component));
|
|
288
|
-
exports.
|
|
277
|
+
exports.ColorGradientWithoutContext = ColorGradientWithoutContext;
|
|
278
|
+
/**
|
|
279
|
+
* Represents the PropsContext of the `ColorGradient` component.
|
|
280
|
+
* Used for global configuration of all `ColorGradient` instances.
|
|
281
|
+
*
|
|
282
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
283
|
+
*/
|
|
284
|
+
exports.ColorGradientPropsContext = kendo_react_common_1.createPropsContext();
|
|
285
|
+
/* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
|
|
286
|
+
/**
|
|
287
|
+
* Represents the [KendoReact ColorGradient component]({% slug overview_colorgradient %}).
|
|
288
|
+
*
|
|
289
|
+
* Accepts properties of type [ColorGradientProps]({% slug api_inputs_colorgradientprops %}).
|
|
290
|
+
* Obtaining the `ref` returns an object of type [ColorGradientHandle]({% slug api_inputs_colorgradienthandle %}).
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```jsx
|
|
294
|
+
* class App extends React.Component {
|
|
295
|
+
* render() {
|
|
296
|
+
* return <ColorGradient />;
|
|
297
|
+
* }
|
|
298
|
+
* }
|
|
299
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
exports.ColorGradient = kendo_react_common_1.withPropsContext(exports.ColorGradientPropsContext, ColorGradientWithoutContext);
|
|
303
|
+
exports.ColorGradient.displayName = 'KendoReactColorGradient';
|
|
@@ -21,20 +21,9 @@ export interface ColorPaletteState {
|
|
|
21
21
|
focusedColor?: string;
|
|
22
22
|
isFirstRender: boolean;
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* @example
|
|
28
|
-
* ```jsx
|
|
29
|
-
* class App extends React.Component {
|
|
30
|
-
* render() {
|
|
31
|
-
* return <ColorPalette palette='basic' />;
|
|
32
|
-
* }
|
|
33
|
-
* }
|
|
34
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare class ColorPalette extends React.Component<ColorPaletteProps, ColorPaletteState> {
|
|
24
|
+
/** @hidden */
|
|
25
|
+
export declare class ColorPaletteWithoutContext extends React.Component<ColorPaletteProps, ColorPaletteState> {
|
|
26
|
+
static displayName: string;
|
|
38
27
|
/**
|
|
39
28
|
* @hidden
|
|
40
29
|
*/
|
|
@@ -98,3 +87,33 @@ export declare class ColorPalette extends React.Component<ColorPaletteProps, Col
|
|
|
98
87
|
private renderColumns;
|
|
99
88
|
private createCellId;
|
|
100
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Represents the PropsContext of the `ColorPalette` component.
|
|
92
|
+
* Used for global configuration of all `ColorPalette` instances.
|
|
93
|
+
*
|
|
94
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
95
|
+
*/
|
|
96
|
+
export declare const ColorPalettePropsContext: React.Context<(p: ColorPaletteProps) => ColorPaletteProps>;
|
|
97
|
+
/**
|
|
98
|
+
* Represent the `ref` of the ColorPalette component.
|
|
99
|
+
*/
|
|
100
|
+
export interface ColorPaletteHandle extends Pick<ColorPaletteWithoutContext, keyof ColorPaletteWithoutContext> {
|
|
101
|
+
}
|
|
102
|
+
/** @hidden */
|
|
103
|
+
export declare type ColorPalette = ColorPaletteHandle;
|
|
104
|
+
/**
|
|
105
|
+
* Represents the [KendoReact ColorPalette component]({% slug overview_colorpalette %}).
|
|
106
|
+
*
|
|
107
|
+
* Accepts properties of type [ColorPaletteProps]({% slug api_inputs_colorpaletteprops %}).
|
|
108
|
+
* Obtaining the `ref` returns an object of type [ColorPaletteHandle]({% slug api_inputs_colorpalettehandle %}).
|
|
109
|
+
*
|
|
110
|
+
* ```jsx
|
|
111
|
+
* class App extends React.Component {
|
|
112
|
+
* render() {
|
|
113
|
+
* return <ColorPalette palette='basic' />;
|
|
114
|
+
* }
|
|
115
|
+
* }
|
|
116
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export declare const ColorPalette: React.ForwardRefExoticComponent<ColorPaletteProps & React.RefAttributes<any>>;
|
|
@@ -34,22 +34,10 @@ exports.DEFAULT_COLUMNS_COUNT = 10;
|
|
|
34
34
|
* @hidden
|
|
35
35
|
*/
|
|
36
36
|
exports.DEFAULT_PRESET = 'office';
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
* ```jsx
|
|
42
|
-
* class App extends React.Component {
|
|
43
|
-
* render() {
|
|
44
|
-
* return <ColorPalette palette='basic' />;
|
|
45
|
-
* }
|
|
46
|
-
* }
|
|
47
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
var ColorPalette = /** @class */ (function (_super) {
|
|
51
|
-
__extends(ColorPalette, _super);
|
|
52
|
-
function ColorPalette(props) {
|
|
37
|
+
/** @hidden */
|
|
38
|
+
var ColorPaletteWithoutContext = /** @class */ (function (_super) {
|
|
39
|
+
__extends(ColorPaletteWithoutContext, _super);
|
|
40
|
+
function ColorPaletteWithoutContext(props) {
|
|
53
41
|
var _this = _super.call(this, props) || this;
|
|
54
42
|
/**
|
|
55
43
|
* @hidden
|
|
@@ -114,7 +102,7 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
114
102
|
/**
|
|
115
103
|
* @hidden
|
|
116
104
|
*/
|
|
117
|
-
|
|
105
|
+
ColorPaletteWithoutContext.prototype.render = function () {
|
|
118
106
|
var _this = this;
|
|
119
107
|
var paletteInfo = this.getPaletteInfo();
|
|
120
108
|
var svc = this.paletteService = new color_palette_service_1.ColorPaletteService();
|
|
@@ -137,7 +125,7 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
137
125
|
/**
|
|
138
126
|
* @hidden
|
|
139
127
|
*/
|
|
140
|
-
|
|
128
|
+
ColorPaletteWithoutContext.getDerivedStateFromProps = function (props, state) {
|
|
141
129
|
if (!state.isFirstRender && props.value !== undefined) {
|
|
142
130
|
// The component is in controlled mode.
|
|
143
131
|
if (props.value === '' && state.selectedColor !== undefined) {
|
|
@@ -153,7 +141,7 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
153
141
|
}
|
|
154
142
|
return null;
|
|
155
143
|
};
|
|
156
|
-
|
|
144
|
+
ColorPaletteWithoutContext.prototype.handleCellNavigation = function (horizontalStep, verticalStep) {
|
|
157
145
|
if (this.focusedColorCooridanates) {
|
|
158
146
|
var newCoords = this.paletteService.getNextCell(this.focusedColorCooridanates, horizontalStep, verticalStep);
|
|
159
147
|
this.setState({ focusedColor: this.paletteService.getColorAt(newCoords) });
|
|
@@ -162,30 +150,30 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
162
150
|
this.setState({ focusedColor: this.paletteService.colorRows[0][0] });
|
|
163
151
|
}
|
|
164
152
|
};
|
|
165
|
-
|
|
153
|
+
ColorPaletteWithoutContext.prototype.handleEnter = function (event) {
|
|
166
154
|
if (this.isUncontrolled) {
|
|
167
155
|
this.setState({ selectedColor: this.state.focusedColor });
|
|
168
156
|
}
|
|
169
157
|
this.dispatchChangeEvent(this.state.focusedColor, event);
|
|
170
158
|
};
|
|
171
|
-
|
|
159
|
+
ColorPaletteWithoutContext.prototype.dispatchChangeEvent = function (value, event) {
|
|
172
160
|
kendo_react_common_1.dispatchEvent(this.props.onChange, event, this, { value: value, rgbaValue: color_parser_1.parseColor(value, 'rgba') });
|
|
173
161
|
};
|
|
174
|
-
Object.defineProperty(
|
|
162
|
+
Object.defineProperty(ColorPaletteWithoutContext.prototype, "focusedColorCooridanates", {
|
|
175
163
|
get: function () {
|
|
176
164
|
return this.state.focusedColor ? this.paletteService.getCellCoordsFor(this.state.focusedColor) : undefined;
|
|
177
165
|
},
|
|
178
166
|
enumerable: true,
|
|
179
167
|
configurable: true
|
|
180
168
|
});
|
|
181
|
-
Object.defineProperty(
|
|
169
|
+
Object.defineProperty(ColorPaletteWithoutContext.prototype, "isUncontrolled", {
|
|
182
170
|
get: function () {
|
|
183
171
|
return this.props.value === undefined;
|
|
184
172
|
},
|
|
185
173
|
enumerable: true,
|
|
186
174
|
configurable: true
|
|
187
175
|
});
|
|
188
|
-
|
|
176
|
+
ColorPaletteWithoutContext.prototype.getPaletteInfo = function () {
|
|
189
177
|
if (typeof this.props.palette === 'string') {
|
|
190
178
|
var preset = palette_presets_1.PALETTEPRESETS[this.props.palette];
|
|
191
179
|
if (misc_1.isPresent(preset)) {
|
|
@@ -202,13 +190,13 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
202
190
|
return { colors: this.props.palette || [], columns: this.props.columns || exports.DEFAULT_COLUMNS_COUNT };
|
|
203
191
|
}
|
|
204
192
|
};
|
|
205
|
-
|
|
193
|
+
ColorPaletteWithoutContext.prototype.renderRows = function (rows, selectedCellCoords, focusedCellCoords) {
|
|
206
194
|
var _this = this;
|
|
207
195
|
return rows.map(function (row, i) {
|
|
208
196
|
return React.createElement("tr", { role: "row", key: i }, _this.renderColumns(row, i, selectedCellCoords, focusedCellCoords));
|
|
209
197
|
});
|
|
210
198
|
};
|
|
211
|
-
|
|
199
|
+
ColorPaletteWithoutContext.prototype.renderColumns = function (columns, rowIndex, selectedCellCoords, focusedCellCoords) {
|
|
212
200
|
var _this = this;
|
|
213
201
|
var rowIsSelected = selectedCellCoords !== undefined && selectedCellCoords.row === rowIndex;
|
|
214
202
|
var selectedColumn = selectedCellCoords && selectedCellCoords.col;
|
|
@@ -227,14 +215,15 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
227
215
|
return (React.createElement("td", { className: className, "aria-label": color, "aria-selected": isSelected ? true : _this.props.disabled ? undefined : false, style: { backgroundColor: color, width: width, height: height, minWidth: width }, onClick: function (event) { return _this.onColorClick(color, event); }, id: _this.createCellId({ row: rowIndex, col: i }), key: i }));
|
|
228
216
|
});
|
|
229
217
|
};
|
|
230
|
-
|
|
218
|
+
ColorPaletteWithoutContext.prototype.createCellId = function (cellCoords) {
|
|
231
219
|
return this.guid + "_" + cellCoords.row + "_" + cellCoords.col;
|
|
232
220
|
};
|
|
221
|
+
ColorPaletteWithoutContext.displayName = 'ColorPalette';
|
|
233
222
|
/**
|
|
234
223
|
* @hidden
|
|
235
224
|
*/
|
|
236
|
-
|
|
237
|
-
palette: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.string]),
|
|
225
|
+
ColorPaletteWithoutContext.propTypes = {
|
|
226
|
+
palette: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.string]),
|
|
238
227
|
columns: PropTypes.number,
|
|
239
228
|
tileSize: PropTypes.any,
|
|
240
229
|
defaultValue: PropTypes.string,
|
|
@@ -250,10 +239,35 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
250
239
|
/**
|
|
251
240
|
* @hidden
|
|
252
241
|
*/
|
|
253
|
-
|
|
242
|
+
ColorPaletteWithoutContext.defaultProps = {
|
|
254
243
|
palette: exports.DEFAULT_PRESET,
|
|
255
244
|
tileSize: exports.DEFAULT_TILE_SIZE
|
|
256
245
|
};
|
|
257
|
-
return
|
|
246
|
+
return ColorPaletteWithoutContext;
|
|
258
247
|
}(React.Component));
|
|
259
|
-
exports.
|
|
248
|
+
exports.ColorPaletteWithoutContext = ColorPaletteWithoutContext;
|
|
249
|
+
/**
|
|
250
|
+
* Represents the PropsContext of the `ColorPalette` component.
|
|
251
|
+
* Used for global configuration of all `ColorPalette` instances.
|
|
252
|
+
*
|
|
253
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
254
|
+
*/
|
|
255
|
+
exports.ColorPalettePropsContext = kendo_react_common_1.createPropsContext();
|
|
256
|
+
/* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
|
|
257
|
+
/**
|
|
258
|
+
* Represents the [KendoReact ColorPalette component]({% slug overview_colorpalette %}).
|
|
259
|
+
*
|
|
260
|
+
* Accepts properties of type [ColorPaletteProps]({% slug api_inputs_colorpaletteprops %}).
|
|
261
|
+
* Obtaining the `ref` returns an object of type [ColorPaletteHandle]({% slug api_inputs_colorpalettehandle %}).
|
|
262
|
+
*
|
|
263
|
+
* ```jsx
|
|
264
|
+
* class App extends React.Component {
|
|
265
|
+
* render() {
|
|
266
|
+
* return <ColorPalette palette='basic' />;
|
|
267
|
+
* }
|
|
268
|
+
* }
|
|
269
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
exports.ColorPalette = kendo_react_common_1.withPropsContext(exports.ColorPalettePropsContext, ColorPaletteWithoutContext);
|
|
273
|
+
exports.ColorPalette.displayName = 'KendoReactColorPalette';
|
|
@@ -6,6 +6,13 @@ import { ColorPickerProps } from './interfaces/ColorPickerProps';
|
|
|
6
6
|
export interface ColorPickerHandle {
|
|
7
7
|
element: HTMLSpanElement | null;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Represents the PropsContext of the `ColorPicker` component.
|
|
11
|
+
* Used for global configuration of all `ColorPicker` instances.
|
|
12
|
+
*
|
|
13
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ColorPickerPropsContext: React.Context<(p: ColorPickerProps) => ColorPickerProps>;
|
|
9
16
|
/**
|
|
10
17
|
* Represents the [KendoReact ColorPicker component]({% slug overview_colorpicker %}).
|
|
11
18
|
*
|
|
@@ -38,6 +38,13 @@ var DEFAULT_PALETTE_SETTINGS = {
|
|
|
38
38
|
var isControlled = function (prop) {
|
|
39
39
|
return prop !== undefined;
|
|
40
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Represents the PropsContext of the `ColorPicker` component.
|
|
43
|
+
* Used for global configuration of all `ColorPicker` instances.
|
|
44
|
+
*
|
|
45
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
46
|
+
*/
|
|
47
|
+
exports.ColorPickerPropsContext = kendo_react_common_1.createPropsContext();
|
|
41
48
|
/**
|
|
42
49
|
* Represents the [KendoReact ColorPicker component]({% slug overview_colorpicker %}).
|
|
43
50
|
*
|
|
@@ -51,8 +58,9 @@ var isControlled = function (prop) {
|
|
|
51
58
|
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
52
59
|
* ```
|
|
53
60
|
*/
|
|
54
|
-
exports.ColorPicker = React.forwardRef(function (
|
|
61
|
+
exports.ColorPicker = React.forwardRef(function (directProps, target) {
|
|
55
62
|
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
63
|
+
var props = kendo_react_common_1.usePropsContext(exports.ColorPickerPropsContext, directProps);
|
|
56
64
|
var popupSettings = props.popupSettings, gradientSettings = props.gradientSettings, paletteSettings = props.paletteSettings, valid = props.valid, disabled = props.disabled, tabIndex = props.tabIndex, view = props.view, icon = props.icon, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onActiveColorClick = props.onActiveColorClick;
|
|
57
65
|
var focusableElementRef = React.useRef(null);
|
|
58
66
|
var gradientRef = React.useRef(null);
|
|
@@ -43,10 +43,9 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
43
43
|
export interface InputState {
|
|
44
44
|
value?: string | string[] | number;
|
|
45
45
|
}
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export declare class Input extends React.Component<InputProps, InputState> implements FormComponent {
|
|
46
|
+
/** @hidden */
|
|
47
|
+
export declare class InputWithoutContext extends React.Component<InputProps, InputState> implements FormComponent {
|
|
48
|
+
static displayName: string;
|
|
50
49
|
/**
|
|
51
50
|
* @hidden
|
|
52
51
|
*/
|
|
@@ -118,4 +117,41 @@ export declare class Input extends React.Component<InputProps, InputState> imple
|
|
|
118
117
|
*/
|
|
119
118
|
private handleAutoFill;
|
|
120
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Represents the PropsContext of the `Input` component.
|
|
122
|
+
* Used for global configuration of all `Input` instances.
|
|
123
|
+
*
|
|
124
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
125
|
+
*/
|
|
126
|
+
export declare const InputPropsContext: React.Context<(p: InputProps) => InputProps>;
|
|
127
|
+
/**
|
|
128
|
+
* Represent the `ref` of the Input component.
|
|
129
|
+
*/
|
|
130
|
+
export interface InputHandle extends Pick<InputWithoutContext, keyof InputWithoutContext> {
|
|
131
|
+
/**
|
|
132
|
+
* Gets the native input element of the Input component.
|
|
133
|
+
*/
|
|
134
|
+
element: HTMLInputElement | null;
|
|
135
|
+
/**
|
|
136
|
+
* Gets the `name` property of the Input.
|
|
137
|
+
*/
|
|
138
|
+
name: string | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Represents the validity state into which the Input is set.
|
|
141
|
+
*/
|
|
142
|
+
validity: FormComponentValidity;
|
|
143
|
+
/**
|
|
144
|
+
* Gets the value of the Input.
|
|
145
|
+
*/
|
|
146
|
+
value: string | string[] | number | undefined;
|
|
147
|
+
}
|
|
148
|
+
/** @hidden */
|
|
149
|
+
export declare type Input = InputHandle;
|
|
150
|
+
/**
|
|
151
|
+
* Represents the [KendoReact Input component]({% slug overview_textbox %}).
|
|
152
|
+
*
|
|
153
|
+
* Accepts properties of type [InputProps]({% slug api_inputs_inputprops %}).
|
|
154
|
+
* Obtaining the `ref` returns an object of type [InputHandle]({% slug api_inputs_inputhandle %}).
|
|
155
|
+
*/
|
|
156
|
+
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<any>>;
|
|
121
157
|
export {};
|