@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
|
@@ -9,6 +9,13 @@ export interface CheckboxHandle {
|
|
|
9
9
|
value?: string | number | string[] | boolean | null;
|
|
10
10
|
name?: string | null;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Represents the PropsContext of the `Checkbox` component.
|
|
14
|
+
* Used for global configuration of all `Checkbox` instances.
|
|
15
|
+
*
|
|
16
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
17
|
+
*/
|
|
18
|
+
export declare const CheckboxPropsContext: React.Context<(p: CheckboxProps) => CheckboxProps>;
|
|
12
19
|
/**
|
|
13
20
|
* Represents the [KendoReact Checkbox component]({% slug overview_checkbox %}).
|
|
14
21
|
*
|
|
@@ -20,11 +20,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
};
|
|
21
21
|
import * as React from 'react';
|
|
22
22
|
import * as PropTypes from 'prop-types';
|
|
23
|
-
import { Keys, classNames, guid, useDir, getTabIndex, dispatchEvent } from '@progress/kendo-react-common';
|
|
23
|
+
import { Keys, classNames, guid, useDir, getTabIndex, dispatchEvent, createPropsContext, usePropsContext } from '@progress/kendo-react-common';
|
|
24
24
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
25
25
|
import { packageMetadata } from '../package-metadata';
|
|
26
26
|
import { useLocalization } from '@progress/kendo-react-intl';
|
|
27
27
|
import { messages, checkboxValidation, checkboxOptionalText } from './../messages';
|
|
28
|
+
/**
|
|
29
|
+
* Represents the PropsContext of the `Checkbox` component.
|
|
30
|
+
* Used for global configuration of all `Checkbox` instances.
|
|
31
|
+
*
|
|
32
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
33
|
+
*/
|
|
34
|
+
export var CheckboxPropsContext = createPropsContext();
|
|
28
35
|
/**
|
|
29
36
|
* Represents the [KendoReact Checkbox component]({% slug overview_checkbox %}).
|
|
30
37
|
*
|
|
@@ -38,8 +45,9 @@ import { messages, checkboxValidation, checkboxOptionalText } from './../message
|
|
|
38
45
|
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
39
46
|
* ```
|
|
40
47
|
*/
|
|
41
|
-
export var Checkbox = React.forwardRef(function (
|
|
48
|
+
export var Checkbox = React.forwardRef(function (directProps, target) {
|
|
42
49
|
validatePackage(packageMetadata);
|
|
50
|
+
var props = usePropsContext(CheckboxPropsContext, directProps);
|
|
43
51
|
var _a = props, ariaDescribedBy = _a.ariaDescribedBy, ariaLabelledBy = _a.ariaLabelledBy, checked = _a.checked, className = _a.className, children = _a.children, defaultChecked = _a.defaultChecked, disabled = _a.disabled, defaultValue = _a.defaultValue, id = _a.id, label = _a.label, labelPlacement = _a.labelPlacement, name = _a.name, labelOptional = _a.labelOptional, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, tabIndex = _a.tabIndex, value = _a.value, required = _a.required, valid = _a.valid, validationMessage = _a.validationMessage, validityStyles = _a.validityStyles,
|
|
44
52
|
// Removed to support direct use in Form Field component
|
|
45
53
|
visited = _a.visited, touched = _a.touched, modified = _a.modified, others = __rest(_a, ["ariaDescribedBy", "ariaLabelledBy", "checked", "className", "children", "defaultChecked", "disabled", "defaultValue", "id", "label", "labelPlacement", "name", "labelOptional", "onChange", "onFocus", "onBlur", "tabIndex", "value", "required", "valid", "validationMessage", "validityStyles", "visited", "touched", "modified"]);
|
|
@@ -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>>;
|
|
@@ -13,7 +13,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
13
13
|
})();
|
|
14
14
|
import * as React from 'react';
|
|
15
15
|
import * as PropTypes from 'prop-types';
|
|
16
|
-
import { Draggable, guid, classNames, focusFirstFocusableChild, getTabIndex } from '@progress/kendo-react-common';
|
|
16
|
+
import { Draggable, guid, classNames, focusFirstFocusableChild, getTabIndex, createPropsContext, withPropsContext } from '@progress/kendo-react-common';
|
|
17
17
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
18
18
|
import { packageMetadata } from '../package-metadata';
|
|
19
19
|
import { Slider } from './../main';
|
|
@@ -25,22 +25,10 @@ import { ColorContrastLabels } from './ColorContrastLabels';
|
|
|
25
25
|
import { ColorContrastSvg } from './ColorContrastSvg';
|
|
26
26
|
var FORMAT = 'rgba';
|
|
27
27
|
var DEFAULT_SELECTED_COLOR = 'rgba(255, 255, 255, 1)';
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* ```jsx
|
|
33
|
-
* class App extends React.Component {
|
|
34
|
-
* render() {
|
|
35
|
-
* return <ColorGradient />;
|
|
36
|
-
* }
|
|
37
|
-
* }
|
|
38
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
var ColorGradient = /** @class */ (function (_super) {
|
|
42
|
-
__extends(ColorGradient, _super);
|
|
43
|
-
function ColorGradient(props) {
|
|
28
|
+
/** @hidden */
|
|
29
|
+
var ColorGradientWithoutContext = /** @class */ (function (_super) {
|
|
30
|
+
__extends(ColorGradientWithoutContext, _super);
|
|
31
|
+
function ColorGradientWithoutContext(props) {
|
|
44
32
|
var _this = _super.call(this, props) || this;
|
|
45
33
|
/**
|
|
46
34
|
* @hidden
|
|
@@ -129,23 +117,23 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
129
117
|
};
|
|
130
118
|
validatePackage(packageMetadata);
|
|
131
119
|
var value = props.value || props.defaultValue || parseColor(DEFAULT_SELECTED_COLOR, FORMAT);
|
|
132
|
-
_this.state = Object.assign({},
|
|
120
|
+
_this.state = Object.assign({}, ColorGradientWithoutContext.getStateFromValue(value), { isFirstRender: true, guid: guid() });
|
|
133
121
|
return _this;
|
|
134
122
|
}
|
|
135
123
|
/**
|
|
136
124
|
* @hidden
|
|
137
125
|
*/
|
|
138
|
-
|
|
126
|
+
ColorGradientWithoutContext.getDerivedStateFromProps = function (props, state) {
|
|
139
127
|
if (props.value && !state.isFirstRender) {
|
|
140
128
|
// The component is in controlled mode.
|
|
141
|
-
return
|
|
129
|
+
return ColorGradientWithoutContext.getStateFromValue(props.value, state.guid);
|
|
142
130
|
}
|
|
143
131
|
return null;
|
|
144
132
|
};
|
|
145
133
|
/**
|
|
146
134
|
* @hidden
|
|
147
135
|
*/
|
|
148
|
-
|
|
136
|
+
ColorGradientWithoutContext.prototype.componentDidMount = function () {
|
|
149
137
|
this.setAlphaSliderBackground(this.state.backgroundColor);
|
|
150
138
|
if (this.state.isFirstRender) {
|
|
151
139
|
this.setState({ isFirstRender: false });
|
|
@@ -154,13 +142,13 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
154
142
|
/**
|
|
155
143
|
* @hidden
|
|
156
144
|
*/
|
|
157
|
-
|
|
145
|
+
ColorGradientWithoutContext.prototype.componentWillUnmount = function () {
|
|
158
146
|
removeCachedColor(this.state.guid);
|
|
159
147
|
};
|
|
160
148
|
/**
|
|
161
149
|
* @hidden
|
|
162
150
|
*/
|
|
163
|
-
|
|
151
|
+
ColorGradientWithoutContext.prototype.componentDidUpdate = function (_, prevState) {
|
|
164
152
|
if (prevState.backgroundColor !== this.state.backgroundColor) {
|
|
165
153
|
this.setAlphaSliderBackground(this.state.backgroundColor);
|
|
166
154
|
}
|
|
@@ -168,7 +156,7 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
168
156
|
/**
|
|
169
157
|
* @hidden
|
|
170
158
|
*/
|
|
171
|
-
|
|
159
|
+
ColorGradientWithoutContext.prototype.renderRectangleDragHandle = function () {
|
|
172
160
|
var style = {};
|
|
173
161
|
if (!this.state.isFirstRender) {
|
|
174
162
|
var gradientRectMetrics = this.getGradientRectMetrics();
|
|
@@ -182,7 +170,7 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
182
170
|
/**
|
|
183
171
|
* @hidden
|
|
184
172
|
*/
|
|
185
|
-
|
|
173
|
+
ColorGradientWithoutContext.prototype.handleHsvaChange = function (hsva, syntheticEvent, nativeEvent) {
|
|
186
174
|
var value = getColorFromHSV(hsva);
|
|
187
175
|
if (this.isUncontrolled) {
|
|
188
176
|
var hex = parseColor(value, 'hex');
|
|
@@ -196,7 +184,7 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
196
184
|
/**
|
|
197
185
|
* @hidden
|
|
198
186
|
*/
|
|
199
|
-
|
|
187
|
+
ColorGradientWithoutContext.prototype.dispatchChangeEvent = function (value, syntheticEvent, nativeEvent) {
|
|
200
188
|
if (this.props.onChange) {
|
|
201
189
|
this.props.onChange.call(undefined, { syntheticEvent: syntheticEvent, nativeEvent: nativeEvent, target: this, value: value });
|
|
202
190
|
}
|
|
@@ -204,7 +192,7 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
204
192
|
/**
|
|
205
193
|
* @hidden
|
|
206
194
|
*/
|
|
207
|
-
|
|
195
|
+
ColorGradientWithoutContext.getStateFromValue = function (value, componentGuid) {
|
|
208
196
|
if (!isPresent(parseColor(value, 'hex'))) {
|
|
209
197
|
// Validate/sanitize the input.
|
|
210
198
|
value = DEFAULT_SELECTED_COLOR;
|
|
@@ -218,12 +206,12 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
218
206
|
/**
|
|
219
207
|
* @hidden
|
|
220
208
|
*/
|
|
221
|
-
|
|
209
|
+
ColorGradientWithoutContext.prototype.setAlphaSliderBackground = function (backgroundColor) {
|
|
222
210
|
if (this.props.opacity && this.alphaSlider && this.alphaSlider.sliderTrack) {
|
|
223
211
|
this.alphaSlider.sliderTrack.style.background = "linear-gradient(to top, transparent, " + backgroundColor + ")";
|
|
224
212
|
}
|
|
225
213
|
};
|
|
226
|
-
Object.defineProperty(
|
|
214
|
+
Object.defineProperty(ColorGradientWithoutContext.prototype, "isUncontrolled", {
|
|
227
215
|
/**
|
|
228
216
|
* @hidden
|
|
229
217
|
*/
|
|
@@ -236,13 +224,13 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
236
224
|
/**
|
|
237
225
|
* @hidden
|
|
238
226
|
*/
|
|
239
|
-
|
|
227
|
+
ColorGradientWithoutContext.prototype.getGradientRectMetrics = function () {
|
|
240
228
|
return this.gradientWrapper.getBoundingClientRect();
|
|
241
229
|
};
|
|
242
230
|
/**
|
|
243
231
|
* @hidden
|
|
244
232
|
*/
|
|
245
|
-
|
|
233
|
+
ColorGradientWithoutContext.prototype.render = function () {
|
|
246
234
|
var _this = this;
|
|
247
235
|
var className = classNames('k-colorgradient', { 'k-state-disabled': this.props.disabled });
|
|
248
236
|
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: getTabIndex(this.props.tabIndex, this.props.disabled), "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, onFocus: this.onFocus },
|
|
@@ -259,10 +247,11 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
259
247
|
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 }),
|
|
260
248
|
this.props.backgroundColor && (React.createElement(ColorContrastLabels, { bgColor: getRGBA(this.props.backgroundColor), rgba: this.state.rgba }))));
|
|
261
249
|
};
|
|
250
|
+
ColorGradientWithoutContext.displayName = 'ColorGradient';
|
|
262
251
|
/**
|
|
263
252
|
* @hidden
|
|
264
253
|
*/
|
|
265
|
-
|
|
254
|
+
ColorGradientWithoutContext.propTypes = {
|
|
266
255
|
defaultValue: PropTypes.string,
|
|
267
256
|
value: PropTypes.string,
|
|
268
257
|
onChange: PropTypes.func,
|
|
@@ -278,9 +267,35 @@ var ColorGradient = /** @class */ (function (_super) {
|
|
|
278
267
|
/**
|
|
279
268
|
* @hidden
|
|
280
269
|
*/
|
|
281
|
-
|
|
270
|
+
ColorGradientWithoutContext.defaultProps = {
|
|
282
271
|
opacity: true
|
|
283
272
|
};
|
|
284
|
-
return
|
|
273
|
+
return ColorGradientWithoutContext;
|
|
285
274
|
}(React.Component));
|
|
286
|
-
export {
|
|
275
|
+
export { ColorGradientWithoutContext };
|
|
276
|
+
/**
|
|
277
|
+
* Represents the PropsContext of the `ColorGradient` component.
|
|
278
|
+
* Used for global configuration of all `ColorGradient` instances.
|
|
279
|
+
*
|
|
280
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
281
|
+
*/
|
|
282
|
+
export var ColorGradientPropsContext = createPropsContext();
|
|
283
|
+
/* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
|
|
284
|
+
/**
|
|
285
|
+
* Represents the [KendoReact ColorGradient component]({% slug overview_colorgradient %}).
|
|
286
|
+
*
|
|
287
|
+
* Accepts properties of type [ColorGradientProps]({% slug api_inputs_colorgradientprops %}).
|
|
288
|
+
* Obtaining the `ref` returns an object of type [ColorGradientHandle]({% slug api_inputs_colorgradienthandle %}).
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```jsx
|
|
292
|
+
* class App extends React.Component {
|
|
293
|
+
* render() {
|
|
294
|
+
* return <ColorGradient />;
|
|
295
|
+
* }
|
|
296
|
+
* }
|
|
297
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
export var ColorGradient = withPropsContext(ColorGradientPropsContext, ColorGradientWithoutContext);
|
|
301
|
+
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>>;
|
|
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
import * as React from 'react';
|
|
15
15
|
import * as PropTypes from 'prop-types';
|
|
16
16
|
import { ColorPaletteService } from './utils/color-palette.service';
|
|
17
|
-
import { classNames, Keys, dispatchEvent, guid, getTabIndex } from '@progress/kendo-react-common';
|
|
17
|
+
import { classNames, Keys, dispatchEvent, guid, getTabIndex, withPropsContext, createPropsContext } from '@progress/kendo-react-common';
|
|
18
18
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
19
19
|
import { packageMetadata } from '../package-metadata';
|
|
20
20
|
import { PALETTEPRESETS } from './models/palette-presets';
|
|
@@ -32,22 +32,10 @@ export var DEFAULT_COLUMNS_COUNT = 10;
|
|
|
32
32
|
* @hidden
|
|
33
33
|
*/
|
|
34
34
|
export var DEFAULT_PRESET = 'office';
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
* ```jsx
|
|
40
|
-
* class App extends React.Component {
|
|
41
|
-
* render() {
|
|
42
|
-
* return <ColorPalette palette='basic' />;
|
|
43
|
-
* }
|
|
44
|
-
* }
|
|
45
|
-
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
var ColorPalette = /** @class */ (function (_super) {
|
|
49
|
-
__extends(ColorPalette, _super);
|
|
50
|
-
function ColorPalette(props) {
|
|
35
|
+
/** @hidden */
|
|
36
|
+
var ColorPaletteWithoutContext = /** @class */ (function (_super) {
|
|
37
|
+
__extends(ColorPaletteWithoutContext, _super);
|
|
38
|
+
function ColorPaletteWithoutContext(props) {
|
|
51
39
|
var _this = _super.call(this, props) || this;
|
|
52
40
|
/**
|
|
53
41
|
* @hidden
|
|
@@ -112,7 +100,7 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
112
100
|
/**
|
|
113
101
|
* @hidden
|
|
114
102
|
*/
|
|
115
|
-
|
|
103
|
+
ColorPaletteWithoutContext.prototype.render = function () {
|
|
116
104
|
var _this = this;
|
|
117
105
|
var paletteInfo = this.getPaletteInfo();
|
|
118
106
|
var svc = this.paletteService = new ColorPaletteService();
|
|
@@ -135,7 +123,7 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
135
123
|
/**
|
|
136
124
|
* @hidden
|
|
137
125
|
*/
|
|
138
|
-
|
|
126
|
+
ColorPaletteWithoutContext.getDerivedStateFromProps = function (props, state) {
|
|
139
127
|
if (!state.isFirstRender && props.value !== undefined) {
|
|
140
128
|
// The component is in controlled mode.
|
|
141
129
|
if (props.value === '' && state.selectedColor !== undefined) {
|
|
@@ -151,7 +139,7 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
151
139
|
}
|
|
152
140
|
return null;
|
|
153
141
|
};
|
|
154
|
-
|
|
142
|
+
ColorPaletteWithoutContext.prototype.handleCellNavigation = function (horizontalStep, verticalStep) {
|
|
155
143
|
if (this.focusedColorCooridanates) {
|
|
156
144
|
var newCoords = this.paletteService.getNextCell(this.focusedColorCooridanates, horizontalStep, verticalStep);
|
|
157
145
|
this.setState({ focusedColor: this.paletteService.getColorAt(newCoords) });
|
|
@@ -160,30 +148,30 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
160
148
|
this.setState({ focusedColor: this.paletteService.colorRows[0][0] });
|
|
161
149
|
}
|
|
162
150
|
};
|
|
163
|
-
|
|
151
|
+
ColorPaletteWithoutContext.prototype.handleEnter = function (event) {
|
|
164
152
|
if (this.isUncontrolled) {
|
|
165
153
|
this.setState({ selectedColor: this.state.focusedColor });
|
|
166
154
|
}
|
|
167
155
|
this.dispatchChangeEvent(this.state.focusedColor, event);
|
|
168
156
|
};
|
|
169
|
-
|
|
157
|
+
ColorPaletteWithoutContext.prototype.dispatchChangeEvent = function (value, event) {
|
|
170
158
|
dispatchEvent(this.props.onChange, event, this, { value: value, rgbaValue: parseColor(value, 'rgba') });
|
|
171
159
|
};
|
|
172
|
-
Object.defineProperty(
|
|
160
|
+
Object.defineProperty(ColorPaletteWithoutContext.prototype, "focusedColorCooridanates", {
|
|
173
161
|
get: function () {
|
|
174
162
|
return this.state.focusedColor ? this.paletteService.getCellCoordsFor(this.state.focusedColor) : undefined;
|
|
175
163
|
},
|
|
176
164
|
enumerable: true,
|
|
177
165
|
configurable: true
|
|
178
166
|
});
|
|
179
|
-
Object.defineProperty(
|
|
167
|
+
Object.defineProperty(ColorPaletteWithoutContext.prototype, "isUncontrolled", {
|
|
180
168
|
get: function () {
|
|
181
169
|
return this.props.value === undefined;
|
|
182
170
|
},
|
|
183
171
|
enumerable: true,
|
|
184
172
|
configurable: true
|
|
185
173
|
});
|
|
186
|
-
|
|
174
|
+
ColorPaletteWithoutContext.prototype.getPaletteInfo = function () {
|
|
187
175
|
if (typeof this.props.palette === 'string') {
|
|
188
176
|
var preset = PALETTEPRESETS[this.props.palette];
|
|
189
177
|
if (isPresent(preset)) {
|
|
@@ -200,13 +188,13 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
200
188
|
return { colors: this.props.palette || [], columns: this.props.columns || DEFAULT_COLUMNS_COUNT };
|
|
201
189
|
}
|
|
202
190
|
};
|
|
203
|
-
|
|
191
|
+
ColorPaletteWithoutContext.prototype.renderRows = function (rows, selectedCellCoords, focusedCellCoords) {
|
|
204
192
|
var _this = this;
|
|
205
193
|
return rows.map(function (row, i) {
|
|
206
194
|
return React.createElement("tr", { role: "row", key: i }, _this.renderColumns(row, i, selectedCellCoords, focusedCellCoords));
|
|
207
195
|
});
|
|
208
196
|
};
|
|
209
|
-
|
|
197
|
+
ColorPaletteWithoutContext.prototype.renderColumns = function (columns, rowIndex, selectedCellCoords, focusedCellCoords) {
|
|
210
198
|
var _this = this;
|
|
211
199
|
var rowIsSelected = selectedCellCoords !== undefined && selectedCellCoords.row === rowIndex;
|
|
212
200
|
var selectedColumn = selectedCellCoords && selectedCellCoords.col;
|
|
@@ -225,14 +213,15 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
225
213
|
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 }));
|
|
226
214
|
});
|
|
227
215
|
};
|
|
228
|
-
|
|
216
|
+
ColorPaletteWithoutContext.prototype.createCellId = function (cellCoords) {
|
|
229
217
|
return this.guid + "_" + cellCoords.row + "_" + cellCoords.col;
|
|
230
218
|
};
|
|
219
|
+
ColorPaletteWithoutContext.displayName = 'ColorPalette';
|
|
231
220
|
/**
|
|
232
221
|
* @hidden
|
|
233
222
|
*/
|
|
234
|
-
|
|
235
|
-
palette: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.string]),
|
|
223
|
+
ColorPaletteWithoutContext.propTypes = {
|
|
224
|
+
palette: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.string]),
|
|
236
225
|
columns: PropTypes.number,
|
|
237
226
|
tileSize: PropTypes.any,
|
|
238
227
|
defaultValue: PropTypes.string,
|
|
@@ -248,10 +237,35 @@ var ColorPalette = /** @class */ (function (_super) {
|
|
|
248
237
|
/**
|
|
249
238
|
* @hidden
|
|
250
239
|
*/
|
|
251
|
-
|
|
240
|
+
ColorPaletteWithoutContext.defaultProps = {
|
|
252
241
|
palette: DEFAULT_PRESET,
|
|
253
242
|
tileSize: DEFAULT_TILE_SIZE
|
|
254
243
|
};
|
|
255
|
-
return
|
|
244
|
+
return ColorPaletteWithoutContext;
|
|
256
245
|
}(React.Component));
|
|
257
|
-
export {
|
|
246
|
+
export { ColorPaletteWithoutContext };
|
|
247
|
+
/**
|
|
248
|
+
* Represents the PropsContext of the `ColorPalette` component.
|
|
249
|
+
* Used for global configuration of all `ColorPalette` instances.
|
|
250
|
+
*
|
|
251
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
252
|
+
*/
|
|
253
|
+
export var ColorPalettePropsContext = createPropsContext();
|
|
254
|
+
/* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
|
|
255
|
+
/**
|
|
256
|
+
* Represents the [KendoReact ColorPalette component]({% slug overview_colorpalette %}).
|
|
257
|
+
*
|
|
258
|
+
* Accepts properties of type [ColorPaletteProps]({% slug api_inputs_colorpaletteprops %}).
|
|
259
|
+
* Obtaining the `ref` returns an object of type [ColorPaletteHandle]({% slug api_inputs_colorpalettehandle %}).
|
|
260
|
+
*
|
|
261
|
+
* ```jsx
|
|
262
|
+
* class App extends React.Component {
|
|
263
|
+
* render() {
|
|
264
|
+
* return <ColorPalette palette='basic' />;
|
|
265
|
+
* }
|
|
266
|
+
* }
|
|
267
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
export var ColorPalette = withPropsContext(ColorPalettePropsContext, ColorPaletteWithoutContext);
|
|
271
|
+
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
|
*
|
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
import * as PropTypes from 'prop-types';
|
|
14
|
-
import { classNames, Keys, useDir, getTabIndex } from '@progress/kendo-react-common';
|
|
14
|
+
import { classNames, Keys, useDir, getTabIndex, createPropsContext, usePropsContext } from '@progress/kendo-react-common';
|
|
15
15
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
16
16
|
import { packageMetadata } from '../package-metadata';
|
|
17
17
|
import { Picker } from './Picker';
|
|
@@ -36,6 +36,13 @@ var DEFAULT_PALETTE_SETTINGS = {
|
|
|
36
36
|
var isControlled = function (prop) {
|
|
37
37
|
return prop !== undefined;
|
|
38
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Represents the PropsContext of the `ColorPicker` component.
|
|
41
|
+
* Used for global configuration of all `ColorPicker` instances.
|
|
42
|
+
*
|
|
43
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
44
|
+
*/
|
|
45
|
+
export var ColorPickerPropsContext = createPropsContext();
|
|
39
46
|
/**
|
|
40
47
|
* Represents the [KendoReact ColorPicker component]({% slug overview_colorpicker %}).
|
|
41
48
|
*
|
|
@@ -49,8 +56,9 @@ var isControlled = function (prop) {
|
|
|
49
56
|
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
50
57
|
* ```
|
|
51
58
|
*/
|
|
52
|
-
export var ColorPicker = React.forwardRef(function (
|
|
59
|
+
export var ColorPicker = React.forwardRef(function (directProps, target) {
|
|
53
60
|
validatePackage(packageMetadata);
|
|
61
|
+
var props = usePropsContext(ColorPickerPropsContext, directProps);
|
|
54
62
|
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;
|
|
55
63
|
var focusableElementRef = React.useRef(null);
|
|
56
64
|
var gradientRef = React.useRef(null);
|
package/dist/es/input/Input.d.ts
CHANGED
|
@@ -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 {};
|