@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
|
@@ -123,6 +123,16 @@ export interface RangeSliderChangeEvent {
|
|
|
123
123
|
syntheticEvent: React.SyntheticEvent<any> | DraggableDragEvent;
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
|
-
* Represents the RangeSlider component.
|
|
126
|
+
* Represents the PropsContext of the `RangeSlider` component.
|
|
127
|
+
* Used for global configuration of all `RangeSlider` instances.
|
|
128
|
+
*
|
|
129
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
130
|
+
*/
|
|
131
|
+
export declare const RangeSliderPropsContext: React.Context<(p: RangeSliderProps) => RangeSliderProps>;
|
|
132
|
+
/**
|
|
133
|
+
* Represents the [KendoReact RangeSlider component]({% slug overview_rangeslider %}).
|
|
134
|
+
*
|
|
135
|
+
* Accepts properties of type [RangeSliderProps]({% slug api_inputs_rangesliderprops %}).
|
|
136
|
+
* Obtaining the `ref` returns an object of type [RangeSliderHandle]({% slug api_inputs_rangesliderhandle %}).
|
|
127
137
|
*/
|
|
128
138
|
export declare const RangeSlider: React.ForwardRefExoticComponent<RangeSliderProps & React.RefAttributes<RangeSliderHandle>>;
|
|
@@ -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, useDraggable, getTabIndex } from '@progress/kendo-react-common';
|
|
14
|
+
import { classNames, Keys, useDir, useDraggable, getTabIndex, createPropsContext, usePropsContext } from '@progress/kendo-react-common';
|
|
15
15
|
import { messages, sliderDragTitle } from './../messages';
|
|
16
16
|
import { useLocalization } from '@progress/kendo-react-intl';
|
|
17
17
|
import { rangeReducer, RANGE_ACTION } from './range-raducer';
|
|
@@ -32,11 +32,22 @@ var useRange = function (defaultValue, args, callback) {
|
|
|
32
32
|
return [state, handleDispatchAction];
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
|
-
* Represents the RangeSlider component.
|
|
35
|
+
* Represents the PropsContext of the `RangeSlider` component.
|
|
36
|
+
* Used for global configuration of all `RangeSlider` instances.
|
|
37
|
+
*
|
|
38
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
36
39
|
*/
|
|
37
|
-
export var
|
|
40
|
+
export var RangeSliderPropsContext = createPropsContext();
|
|
41
|
+
/**
|
|
42
|
+
* Represents the [KendoReact RangeSlider component]({% slug overview_rangeslider %}).
|
|
43
|
+
*
|
|
44
|
+
* Accepts properties of type [RangeSliderProps]({% slug api_inputs_rangesliderprops %}).
|
|
45
|
+
* Obtaining the `ref` returns an object of type [RangeSliderHandle]({% slug api_inputs_rangesliderhandle %}).
|
|
46
|
+
*/
|
|
47
|
+
export var RangeSlider = React.forwardRef(function (directProps, ref) {
|
|
38
48
|
var _a, _b, _c, _d;
|
|
39
49
|
validatePackage(packageMetadata);
|
|
50
|
+
var props = usePropsContext(RangeSliderPropsContext, directProps);
|
|
40
51
|
var target = React.useRef(null);
|
|
41
52
|
var sliderRef = React.useRef(null);
|
|
42
53
|
var sliderSelectionRef = React.useRef(null);
|
|
@@ -143,6 +143,16 @@ export interface RatingChangeEvent {
|
|
|
143
143
|
syntheticEvent: React.SyntheticEvent<any>;
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
|
-
* Represents the Rating component.
|
|
146
|
+
* Represents the PropsContext of the `Rating` component.
|
|
147
|
+
* Used for global configuration of all `Rating` instances.
|
|
148
|
+
*
|
|
149
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
150
|
+
*/
|
|
151
|
+
export declare const RatingPropsContext: React.Context<(p: RatingProps) => RatingProps>;
|
|
152
|
+
/**
|
|
153
|
+
* Represents the [KendoReact Rating component]({% slug overview_rating %}).
|
|
154
|
+
*
|
|
155
|
+
* Accepts properties of type [RatingProps]({% slug api_inputs_ratingprops %}).
|
|
156
|
+
* Obtaining the `ref` returns an object of type [RatingHandle]({% slug api_inputs_ratinghandle %}).
|
|
147
157
|
*/
|
|
148
158
|
export declare const Rating: React.ForwardRefExoticComponent<RatingProps & React.RefAttributes<RatingHandle>>;
|
package/dist/es/rating/Rating.js
CHANGED
|
@@ -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, useDir, Keys, getTabIndex } from '@progress/kendo-react-common';
|
|
14
|
+
import { classNames, useDir, Keys, getTabIndex, createPropsContext, usePropsContext } from '@progress/kendo-react-common';
|
|
15
15
|
import { RatingItem } from './RatingItem';
|
|
16
16
|
import { ratingReducer, RATING_ACTION } from './rating-reducer';
|
|
17
17
|
import { isSelected, isHalf, calcIsFirstHalf, isCorrectValue, toRound, getRemainder } from './utils';
|
|
@@ -30,10 +30,21 @@ var useRating = function (defaultValue, args, callback) {
|
|
|
30
30
|
return [state, handleDispatchAction];
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
-
* Represents the Rating component.
|
|
33
|
+
* Represents the PropsContext of the `Rating` component.
|
|
34
|
+
* Used for global configuration of all `Rating` instances.
|
|
35
|
+
*
|
|
36
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
34
37
|
*/
|
|
35
|
-
export var
|
|
38
|
+
export var RatingPropsContext = createPropsContext();
|
|
39
|
+
/**
|
|
40
|
+
* Represents the [KendoReact Rating component]({% slug overview_rating %}).
|
|
41
|
+
*
|
|
42
|
+
* Accepts properties of type [RatingProps]({% slug api_inputs_ratingprops %}).
|
|
43
|
+
* Obtaining the `ref` returns an object of type [RatingHandle]({% slug api_inputs_ratinghandle %}).
|
|
44
|
+
*/
|
|
45
|
+
export var Rating = React.forwardRef(function (directProps, ref) {
|
|
36
46
|
var _a, _b, _c, _d;
|
|
47
|
+
var props = usePropsContext(RatingPropsContext, directProps);
|
|
37
48
|
var target = React.useRef(null);
|
|
38
49
|
var ratingRef = React.useRef(null);
|
|
39
50
|
var dir = useDir(ratingRef, props.dir);
|
|
@@ -100,10 +100,9 @@ interface SliderState {
|
|
|
100
100
|
focused: boolean;
|
|
101
101
|
dir?: Direction;
|
|
102
102
|
}
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
export declare class Slider extends React.Component<SliderProps, SliderState> {
|
|
103
|
+
/** @hidden */
|
|
104
|
+
export declare class SliderWithoutContext extends React.Component<SliderProps, SliderState> {
|
|
105
|
+
static displayName: string;
|
|
107
106
|
/**
|
|
108
107
|
* @hidden
|
|
109
108
|
*/
|
|
@@ -164,4 +163,25 @@ export declare class Slider extends React.Component<SliderProps, SliderState> {
|
|
|
164
163
|
private drag;
|
|
165
164
|
private change;
|
|
166
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Represents the PropsContext of the `Slider` component.
|
|
168
|
+
* Used for global configuration of all `Slider` instances.
|
|
169
|
+
*
|
|
170
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
171
|
+
*/
|
|
172
|
+
export declare const SliderPropsContext: React.Context<(p: SliderProps) => SliderProps>;
|
|
173
|
+
/**
|
|
174
|
+
* Represent the `ref` of the Slider component.
|
|
175
|
+
*/
|
|
176
|
+
export interface SliderHandle extends Pick<SliderWithoutContext, keyof SliderWithoutContext> {
|
|
177
|
+
}
|
|
178
|
+
/** @hidden */
|
|
179
|
+
export declare type Slider = SliderHandle;
|
|
180
|
+
/**
|
|
181
|
+
* Represents the [KendoReact Slider component]({% slug overview_slider %}).
|
|
182
|
+
*
|
|
183
|
+
* Accepts properties of type [SliderProps]({% slug api_inputs_sliderprops %}).
|
|
184
|
+
* Obtaining the `ref` returns an object of type [SliderHandle]({% slug api_inputs_sliderhandle %}).
|
|
185
|
+
*/
|
|
186
|
+
export declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<any>>;
|
|
167
187
|
export {};
|
package/dist/es/slider/Slider.js
CHANGED
|
@@ -24,18 +24,16 @@ var __assign = (this && this.__assign) || function () {
|
|
|
24
24
|
};
|
|
25
25
|
import * as React from 'react';
|
|
26
26
|
import * as PropTypes from 'prop-types';
|
|
27
|
-
import { dispatchEvent, Keys, classNames, Draggable, getTabIndex } from '@progress/kendo-react-common';
|
|
27
|
+
import { dispatchEvent, Keys, classNames, Draggable, getTabIndex, createPropsContext, withPropsContext } from '@progress/kendo-react-common';
|
|
28
28
|
import { registerForLocalization, provideLocalizationService } from '@progress/kendo-react-intl';
|
|
29
29
|
import { messages, sliderIncreaseValue, sliderDecreaseValue, sliderDragTitle } from './../messages';
|
|
30
30
|
import { SLIDER_LABEL_ATTRIBUTE } from './SliderLabel';
|
|
31
31
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
32
32
|
import { packageMetadata } from '../package-metadata';
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
__extends(Slider, _super);
|
|
38
|
-
function Slider(props) {
|
|
33
|
+
/** @hidden */
|
|
34
|
+
var SliderWithoutContext = /** @class */ (function (_super) {
|
|
35
|
+
__extends(SliderWithoutContext, _super);
|
|
36
|
+
function SliderWithoutContext(props) {
|
|
39
37
|
var _this = _super.call(this, props) || this;
|
|
40
38
|
/**
|
|
41
39
|
* @hidden
|
|
@@ -145,7 +143,7 @@ var Slider = /** @class */ (function (_super) {
|
|
|
145
143
|
/**
|
|
146
144
|
* @hidden
|
|
147
145
|
*/
|
|
148
|
-
|
|
146
|
+
SliderWithoutContext.getDerivedStateFromProps = function (props, state) {
|
|
149
147
|
var value = props.value !== undefined ? props.value : state.value;
|
|
150
148
|
var min = props.min, max = props.max;
|
|
151
149
|
return value === undefined ? null :
|
|
@@ -154,7 +152,7 @@ var Slider = /** @class */ (function (_super) {
|
|
|
154
152
|
/**
|
|
155
153
|
* @hidden
|
|
156
154
|
*/
|
|
157
|
-
|
|
155
|
+
SliderWithoutContext.prototype.componentDidMount = function () {
|
|
158
156
|
if (!this.state.dir && window && this._element) {
|
|
159
157
|
// Note: getComputedStyle forces reflow
|
|
160
158
|
var direction = window.getComputedStyle(this._element).direction;
|
|
@@ -166,7 +164,7 @@ var Slider = /** @class */ (function (_super) {
|
|
|
166
164
|
/**
|
|
167
165
|
* @hidden
|
|
168
166
|
*/
|
|
169
|
-
|
|
167
|
+
SliderWithoutContext.prototype.render = function () {
|
|
170
168
|
var _this = this;
|
|
171
169
|
var _a, _b;
|
|
172
170
|
var lS = provideLocalizationService(this);
|
|
@@ -213,7 +211,7 @@ var Slider = /** @class */ (function (_super) {
|
|
|
213
211
|
_b.zIndex = 1,
|
|
214
212
|
_b) }))))))));
|
|
215
213
|
};
|
|
216
|
-
Object.defineProperty(
|
|
214
|
+
Object.defineProperty(SliderWithoutContext.prototype, "sliderTrack", {
|
|
217
215
|
/**
|
|
218
216
|
* @hidden
|
|
219
217
|
*/
|
|
@@ -223,15 +221,16 @@ var Slider = /** @class */ (function (_super) {
|
|
|
223
221
|
enumerable: true,
|
|
224
222
|
configurable: true
|
|
225
223
|
});
|
|
226
|
-
|
|
224
|
+
SliderWithoutContext.prototype.change = function (e, value) {
|
|
227
225
|
value = Math.min(Math.max(value, this.props.min), this.props.max);
|
|
228
226
|
this.setState({ value: value });
|
|
229
227
|
dispatchEvent(this.props.onChange, e, this, { value: value });
|
|
230
228
|
};
|
|
229
|
+
SliderWithoutContext.displayName = 'Slider';
|
|
231
230
|
/**
|
|
232
231
|
* @hidden
|
|
233
232
|
*/
|
|
234
|
-
|
|
233
|
+
SliderWithoutContext.propTypes = {
|
|
235
234
|
min: PropTypes.number.isRequired,
|
|
236
235
|
max: PropTypes.number.isRequired,
|
|
237
236
|
value: PropTypes.number,
|
|
@@ -241,7 +240,23 @@ var Slider = /** @class */ (function (_super) {
|
|
|
241
240
|
ariaDescribedBy: PropTypes.string
|
|
242
241
|
// TODO: validation when buttons is set to true, but no step is provided
|
|
243
242
|
};
|
|
244
|
-
return
|
|
243
|
+
return SliderWithoutContext;
|
|
245
244
|
}(React.Component));
|
|
246
|
-
export {
|
|
247
|
-
|
|
245
|
+
export { SliderWithoutContext };
|
|
246
|
+
/**
|
|
247
|
+
* Represents the PropsContext of the `Slider` component.
|
|
248
|
+
* Used for global configuration of all `Slider` instances.
|
|
249
|
+
*
|
|
250
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
251
|
+
*/
|
|
252
|
+
export var SliderPropsContext = createPropsContext();
|
|
253
|
+
/* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
|
|
254
|
+
/**
|
|
255
|
+
* Represents the [KendoReact Slider component]({% slug overview_slider %}).
|
|
256
|
+
*
|
|
257
|
+
* Accepts properties of type [SliderProps]({% slug api_inputs_sliderprops %}).
|
|
258
|
+
* Obtaining the `ref` returns an object of type [SliderHandle]({% slug api_inputs_sliderhandle %}).
|
|
259
|
+
*/
|
|
260
|
+
export var Slider = withPropsContext(SliderPropsContext, SliderWithoutContext);
|
|
261
|
+
Slider.displayName = 'KendoReactSlider';
|
|
262
|
+
registerForLocalization(SliderWithoutContext);
|
|
@@ -93,10 +93,9 @@ export interface SwitchState {
|
|
|
93
93
|
checked: boolean;
|
|
94
94
|
focused: boolean;
|
|
95
95
|
}
|
|
96
|
-
/**
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
export declare class Switch extends React.Component<SwitchProps, SwitchState> implements FormComponent {
|
|
96
|
+
/** @hidden */
|
|
97
|
+
export declare class SwitchWithoutContext extends React.Component<SwitchProps, SwitchState> implements FormComponent {
|
|
98
|
+
static displayName: string;
|
|
100
99
|
/**
|
|
101
100
|
* Gets the value of the Switch.
|
|
102
101
|
*/
|
|
@@ -203,3 +202,40 @@ export declare class Switch extends React.Component<SwitchProps, SwitchState> im
|
|
|
203
202
|
private handleWrapperFocus;
|
|
204
203
|
private handleWrapperBlur;
|
|
205
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Represents the PropsContext of the `Switch` component.
|
|
207
|
+
* Used for global configuration of all `Switch` instances.
|
|
208
|
+
*
|
|
209
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
210
|
+
*/
|
|
211
|
+
export declare const SwitchPropsContext: React.Context<(p: SwitchProps) => SwitchProps>;
|
|
212
|
+
/**
|
|
213
|
+
* Represent the `ref` of the Switch component.
|
|
214
|
+
*/
|
|
215
|
+
export interface SwitchHandle extends Pick<SwitchWithoutContext, keyof SwitchWithoutContext> {
|
|
216
|
+
/**
|
|
217
|
+
* Returns the HTML element of the Switch component.
|
|
218
|
+
*/
|
|
219
|
+
element: HTMLSpanElement | null;
|
|
220
|
+
/**
|
|
221
|
+
* Gets the `name` property of the Switch.
|
|
222
|
+
*/
|
|
223
|
+
name: string | undefined;
|
|
224
|
+
/**
|
|
225
|
+
* Represents the validity state into which the Switch is set.
|
|
226
|
+
*/
|
|
227
|
+
validity: FormComponentValidity;
|
|
228
|
+
/**
|
|
229
|
+
* Gets the value of the Switch.
|
|
230
|
+
*/
|
|
231
|
+
value: boolean;
|
|
232
|
+
}
|
|
233
|
+
/** @hidden */
|
|
234
|
+
export declare type Switch = SwitchHandle;
|
|
235
|
+
/**
|
|
236
|
+
* Represents the [KendoReact Switch component]({% slug overview_switch %}).
|
|
237
|
+
*
|
|
238
|
+
* Accepts properties of type [SwitchProps]({% slug api_inputs_switchprops %}).
|
|
239
|
+
* Obtaining the `ref` returns an object of type [SwitchHandle]({% slug api_inputs_switchhandle %}).
|
|
240
|
+
*/
|
|
241
|
+
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<any>>;
|
package/dist/es/switch/Switch.js
CHANGED
|
@@ -24,7 +24,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
24
24
|
};
|
|
25
25
|
import * as React from 'react';
|
|
26
26
|
import * as PropTypes from 'prop-types';
|
|
27
|
-
import { classNames, guid, noop, Keys, dispatchEvent, getTabIndex } from '@progress/kendo-react-common';
|
|
27
|
+
import { classNames, guid, noop, Keys, dispatchEvent, getTabIndex, createPropsContext, withPropsContext } from '@progress/kendo-react-common';
|
|
28
28
|
import { provideLocalizationService } from '@progress/kendo-react-intl';
|
|
29
29
|
import { messages, switchValidation } from './../messages';
|
|
30
30
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
@@ -33,15 +33,13 @@ var SWITCH_CONTAINER = 'k-switch-container';
|
|
|
33
33
|
var SWITCH_HANDLE = 'k-switch-handle';
|
|
34
34
|
var SWITCH_LABEL_ON = 'k-switch-label-on';
|
|
35
35
|
var SWITCH_LABEL_OFF = 'k-switch-label-off';
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var Switch = /** @class */ (function (_super) {
|
|
40
|
-
__extends(Switch, _super);
|
|
36
|
+
/** @hidden */
|
|
37
|
+
var SwitchWithoutContext = /** @class */ (function (_super) {
|
|
38
|
+
__extends(SwitchWithoutContext, _super);
|
|
41
39
|
/**
|
|
42
40
|
* @hidden
|
|
43
41
|
*/
|
|
44
|
-
function
|
|
42
|
+
function SwitchWithoutContext(props) {
|
|
45
43
|
var _this = _super.call(this, props) || this;
|
|
46
44
|
/**
|
|
47
45
|
* @hidden
|
|
@@ -126,12 +124,12 @@ var Switch = /** @class */ (function (_super) {
|
|
|
126
124
|
};
|
|
127
125
|
validatePackage(packageMetadata);
|
|
128
126
|
_this.state = {
|
|
129
|
-
checked: props.defaultChecked ||
|
|
127
|
+
checked: props.defaultChecked || SwitchWithoutContext.defaultProps.defaultChecked,
|
|
130
128
|
focused: false
|
|
131
129
|
};
|
|
132
130
|
return _this;
|
|
133
131
|
}
|
|
134
|
-
Object.defineProperty(
|
|
132
|
+
Object.defineProperty(SwitchWithoutContext.prototype, "value", {
|
|
135
133
|
/**
|
|
136
134
|
* Gets the value of the Switch.
|
|
137
135
|
*/
|
|
@@ -145,14 +143,14 @@ var Switch = /** @class */ (function (_super) {
|
|
|
145
143
|
enumerable: true,
|
|
146
144
|
configurable: true
|
|
147
145
|
});
|
|
148
|
-
Object.defineProperty(
|
|
146
|
+
Object.defineProperty(SwitchWithoutContext.prototype, "element", {
|
|
149
147
|
get: function () {
|
|
150
148
|
return this._element;
|
|
151
149
|
},
|
|
152
150
|
enumerable: true,
|
|
153
151
|
configurable: true
|
|
154
152
|
});
|
|
155
|
-
Object.defineProperty(
|
|
153
|
+
Object.defineProperty(SwitchWithoutContext.prototype, "actionElement", {
|
|
156
154
|
/**
|
|
157
155
|
* @hidden
|
|
158
156
|
*/
|
|
@@ -162,7 +160,7 @@ var Switch = /** @class */ (function (_super) {
|
|
|
162
160
|
enumerable: true,
|
|
163
161
|
configurable: true
|
|
164
162
|
});
|
|
165
|
-
Object.defineProperty(
|
|
163
|
+
Object.defineProperty(SwitchWithoutContext.prototype, "name", {
|
|
166
164
|
/**
|
|
167
165
|
* Gets the `name` property of the Switch.
|
|
168
166
|
*/
|
|
@@ -172,7 +170,7 @@ var Switch = /** @class */ (function (_super) {
|
|
|
172
170
|
enumerable: true,
|
|
173
171
|
configurable: true
|
|
174
172
|
});
|
|
175
|
-
Object.defineProperty(
|
|
173
|
+
Object.defineProperty(SwitchWithoutContext.prototype, "validity", {
|
|
176
174
|
/**
|
|
177
175
|
* Represents the validity state into which the Switch is set.
|
|
178
176
|
*/
|
|
@@ -193,26 +191,26 @@ var Switch = /** @class */ (function (_super) {
|
|
|
193
191
|
enumerable: true,
|
|
194
192
|
configurable: true
|
|
195
193
|
});
|
|
196
|
-
Object.defineProperty(
|
|
194
|
+
Object.defineProperty(SwitchWithoutContext.prototype, "validityStyles", {
|
|
197
195
|
/**
|
|
198
196
|
* @hidden
|
|
199
197
|
*/
|
|
200
198
|
get: function () {
|
|
201
199
|
return this.props.validityStyles !== undefined
|
|
202
200
|
? this.props.validityStyles
|
|
203
|
-
:
|
|
201
|
+
: SwitchWithoutContext.defaultProps.validityStyles;
|
|
204
202
|
},
|
|
205
203
|
enumerable: true,
|
|
206
204
|
configurable: true
|
|
207
205
|
});
|
|
208
|
-
Object.defineProperty(
|
|
206
|
+
Object.defineProperty(SwitchWithoutContext.prototype, "required", {
|
|
209
207
|
/**
|
|
210
208
|
* @hidden
|
|
211
209
|
*/
|
|
212
210
|
get: function () {
|
|
213
211
|
return this.props.required !== undefined
|
|
214
212
|
? this.props.required
|
|
215
|
-
:
|
|
213
|
+
: SwitchWithoutContext.defaultProps.required;
|
|
216
214
|
},
|
|
217
215
|
enumerable: true,
|
|
218
216
|
configurable: true
|
|
@@ -220,7 +218,7 @@ var Switch = /** @class */ (function (_super) {
|
|
|
220
218
|
/**
|
|
221
219
|
* @hidden
|
|
222
220
|
*/
|
|
223
|
-
|
|
221
|
+
SwitchWithoutContext.prototype.componentDidMount = function () {
|
|
224
222
|
this.setValidity();
|
|
225
223
|
// Due to dynamic dir calculation
|
|
226
224
|
this.forceUpdate();
|
|
@@ -228,13 +226,13 @@ var Switch = /** @class */ (function (_super) {
|
|
|
228
226
|
/**
|
|
229
227
|
* @hidden
|
|
230
228
|
*/
|
|
231
|
-
|
|
229
|
+
SwitchWithoutContext.prototype.componentDidUpdate = function () {
|
|
232
230
|
this.setValidity();
|
|
233
231
|
};
|
|
234
232
|
/**
|
|
235
233
|
* @hidden
|
|
236
234
|
*/
|
|
237
|
-
|
|
235
|
+
SwitchWithoutContext.prototype.render = function () {
|
|
238
236
|
var _this = this;
|
|
239
237
|
var focused = this.state.focused;
|
|
240
238
|
var _a = this.props, dir = _a.dir, disabled = _a.disabled, id = _a.id, offLabel = _a.offLabel, onLabel = _a.onLabel, tabIndex = _a.tabIndex;
|
|
@@ -264,10 +262,11 @@ var Switch = /** @class */ (function (_super) {
|
|
|
264
262
|
React.createElement("span", { className: SWITCH_LABEL_OFF }, offLabel),
|
|
265
263
|
React.createElement("span", { className: SWITCH_HANDLE }))));
|
|
266
264
|
};
|
|
265
|
+
SwitchWithoutContext.displayName = 'Switch';
|
|
267
266
|
/**
|
|
268
267
|
* @hidden
|
|
269
268
|
*/
|
|
270
|
-
|
|
269
|
+
SwitchWithoutContext.propTypes = {
|
|
271
270
|
accessKey: PropTypes.string,
|
|
272
271
|
checked: PropTypes.bool,
|
|
273
272
|
className: PropTypes.string,
|
|
@@ -291,7 +290,7 @@ var Switch = /** @class */ (function (_super) {
|
|
|
291
290
|
/**
|
|
292
291
|
* @hidden
|
|
293
292
|
*/
|
|
294
|
-
|
|
293
|
+
SwitchWithoutContext.defaultProps = {
|
|
295
294
|
disabled: false,
|
|
296
295
|
defaultChecked: false,
|
|
297
296
|
offLabel: 'OFF',
|
|
@@ -301,6 +300,22 @@ var Switch = /** @class */ (function (_super) {
|
|
|
301
300
|
required: false,
|
|
302
301
|
validityStyles: true
|
|
303
302
|
};
|
|
304
|
-
return
|
|
303
|
+
return SwitchWithoutContext;
|
|
305
304
|
}(React.Component));
|
|
306
|
-
export {
|
|
305
|
+
export { SwitchWithoutContext };
|
|
306
|
+
/**
|
|
307
|
+
* Represents the PropsContext of the `Switch` component.
|
|
308
|
+
* Used for global configuration of all `Switch` instances.
|
|
309
|
+
*
|
|
310
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
311
|
+
*/
|
|
312
|
+
export var SwitchPropsContext = createPropsContext();
|
|
313
|
+
/* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
|
|
314
|
+
/**
|
|
315
|
+
* Represents the [KendoReact Switch component]({% slug overview_switch %}).
|
|
316
|
+
*
|
|
317
|
+
* Accepts properties of type [SwitchProps]({% slug api_inputs_switchprops %}).
|
|
318
|
+
* Obtaining the `ref` returns an object of type [SwitchHandle]({% slug api_inputs_switchhandle %}).
|
|
319
|
+
*/
|
|
320
|
+
export var Switch = withPropsContext(SwitchPropsContext, SwitchWithoutContext);
|
|
321
|
+
Switch.displayName = 'KendoReactSwitch';
|
|
@@ -8,9 +8,20 @@ export interface TextAreaHandle {
|
|
|
8
8
|
focus: any;
|
|
9
9
|
name?: string | null;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Represents the PropsContext of the `TextArea` component.
|
|
13
|
+
* Used for global configuration of all `TextArea` instances.
|
|
14
|
+
*
|
|
15
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
16
|
+
*/
|
|
17
|
+
export declare const TextAreaPropsContext: React.Context<(p: TextAreaProps) => TextAreaProps>;
|
|
11
18
|
/**
|
|
12
19
|
* Represents the [KendoReact TextArea component]({% slug overview_textarea %}).
|
|
13
20
|
*
|
|
21
|
+
*
|
|
22
|
+
* Accepts properties of type [TextAreaProps]({% slug api_inputs_textareaprops %}).
|
|
23
|
+
* Obtaining the `ref` returns an object of type [TextAreaHandle]({% slug api_inputs_textareahandle %}).
|
|
24
|
+
*
|
|
14
25
|
* @example
|
|
15
26
|
* ```jsx
|
|
16
27
|
* class App extends React.Component {
|
|
@@ -20,10 +20,21 @@ 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 { guid, classNames, getTabIndex, dispatchEvent, useDir } from '@progress/kendo-react-common';
|
|
23
|
+
import { guid, classNames, getTabIndex, dispatchEvent, useDir, createPropsContext, usePropsContext } from '@progress/kendo-react-common';
|
|
24
|
+
/**
|
|
25
|
+
* Represents the PropsContext of the `TextArea` component.
|
|
26
|
+
* Used for global configuration of all `TextArea` instances.
|
|
27
|
+
*
|
|
28
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
29
|
+
*/
|
|
30
|
+
export var TextAreaPropsContext = createPropsContext();
|
|
24
31
|
/**
|
|
25
32
|
* Represents the [KendoReact TextArea component]({% slug overview_textarea %}).
|
|
26
33
|
*
|
|
34
|
+
*
|
|
35
|
+
* Accepts properties of type [TextAreaProps]({% slug api_inputs_textareaprops %}).
|
|
36
|
+
* Obtaining the `ref` returns an object of type [TextAreaHandle]({% slug api_inputs_textareahandle %}).
|
|
37
|
+
*
|
|
27
38
|
* @example
|
|
28
39
|
* ```jsx
|
|
29
40
|
* class App extends React.Component {
|
|
@@ -34,7 +45,8 @@ import { guid, classNames, getTabIndex, dispatchEvent, useDir } from '@progress/
|
|
|
34
45
|
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
35
46
|
* ```
|
|
36
47
|
*/
|
|
37
|
-
export var TextArea = React.forwardRef(function (
|
|
48
|
+
export var TextArea = React.forwardRef(function (directProps, target) {
|
|
49
|
+
var props = usePropsContext(TextAreaPropsContext, directProps);
|
|
38
50
|
var _a = props, ariaDescribedBy = _a.ariaDescribedBy, ariaLabelledBy = _a.ariaLabelledBy, autoSize = _a.autoSize, className = _a.className, defaultValue = _a.defaultValue, disabled = _a.disabled, readOnly = _a.readOnly, required = _a.required, rows = _a.rows, id = _a.id, name = _a.name, placeholder = _a.placeholder, style = _a.style, tabIndex = _a.tabIndex, value = _a.value, valid = _a.valid, validationMessage = _a.validationMessage, validityStyles = _a.validityStyles, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur,
|
|
39
51
|
// Removed to support direct use in Form Field component
|
|
40
52
|
visited = _a.visited, touched = _a.touched, modified = _a.modified, others = __rest(_a, ["ariaDescribedBy", "ariaLabelledBy", "autoSize", "className", "defaultValue", "disabled", "readOnly", "required", "rows", "id", "name", "placeholder", "style", "tabIndex", "value", "valid", "validationMessage", "validityStyles", "onChange", "onFocus", "onBlur", "visited", "touched", "modified"]);
|
package/dist/es/utils.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Polyfill for PropTypes.null
|
|
2
|
+
/**
|
|
3
|
+
* @hidden
|
|
4
|
+
*/
|
|
5
|
+
export function nullable(subRequirement) {
|
|
6
|
+
var check = function (required, props, key) {
|
|
7
|
+
var rest = [];
|
|
8
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
9
|
+
rest[_i - 3] = arguments[_i];
|
|
10
|
+
}
|
|
11
|
+
if (props[key] === null) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
var sub = required ? subRequirement.isRequired : subRequirement;
|
|
15
|
+
return sub.apply(void 0, [props, key].concat(rest));
|
|
16
|
+
};
|
|
17
|
+
var fn = check.bind(null, false);
|
|
18
|
+
fn.isRequired = check.bind(null, true);
|
|
19
|
+
return fn;
|
|
20
|
+
}
|
|
@@ -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
|
*
|
|
@@ -27,6 +27,13 @@ var kendo_react_common_2 = require("@progress/kendo-react-common");
|
|
|
27
27
|
var package_metadata_1 = require("../package-metadata");
|
|
28
28
|
var kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
29
29
|
var messages_1 = require("./../messages");
|
|
30
|
+
/**
|
|
31
|
+
* Represents the PropsContext of the `Checkbox` component.
|
|
32
|
+
* Used for global configuration of all `Checkbox` instances.
|
|
33
|
+
*
|
|
34
|
+
* For more information, refer to the [Inputs Props Context]({% slug props-context_inputs %}) article.
|
|
35
|
+
*/
|
|
36
|
+
exports.CheckboxPropsContext = kendo_react_common_1.createPropsContext();
|
|
30
37
|
/**
|
|
31
38
|
* Represents the [KendoReact Checkbox component]({% slug overview_checkbox %}).
|
|
32
39
|
*
|
|
@@ -40,8 +47,9 @@ var messages_1 = require("./../messages");
|
|
|
40
47
|
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
41
48
|
* ```
|
|
42
49
|
*/
|
|
43
|
-
exports.Checkbox = React.forwardRef(function (
|
|
50
|
+
exports.Checkbox = React.forwardRef(function (directProps, target) {
|
|
44
51
|
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
52
|
+
var props = kendo_react_common_1.usePropsContext(exports.CheckboxPropsContext, directProps);
|
|
45
53
|
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,
|
|
46
54
|
// Removed to support direct use in Form Field component
|
|
47
55
|
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"]);
|