@progress/kendo-react-inputs 4.14.0-dev.202201141457 → 5.0.0-dev.202201182040
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.js +19 -10
- package/dist/es/checkbox/interfaces/CheckboxProps.d.ts +25 -1
- package/dist/es/colors/ColorInput.js +2 -2
- package/dist/es/colors/ColorPicker.js +37 -25
- package/dist/es/colors/FlatColorPicker.js +3 -3
- package/dist/es/colors/HexInput.js +2 -1
- package/dist/es/colors/interfaces/ColorPickerProps.d.ts +37 -0
- package/dist/es/input/Input.js +1 -1
- package/dist/es/maskedtextbox/MaskedTextBox.d.ts +6 -0
- package/dist/es/maskedtextbox/MaskedTextBox.js +21 -9
- package/dist/es/maskedtextbox/MaskedTextBoxProps.d.ts +37 -0
- package/dist/es/numerictextbox/NumericTextBox.js +27 -30
- package/dist/es/numerictextbox/interfaces/NumericTextBoxProps.d.ts +37 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/radiobutton/RadioButton.js +13 -7
- package/dist/es/radiobutton/interfaces/RadioButtonProps.d.ts +13 -1
- package/dist/es/switch/Switch.d.ts +44 -0
- package/dist/es/switch/Switch.js +27 -19
- package/dist/es/textarea/TextArea.js +26 -16
- package/dist/es/textarea/interfaces/TextAreaProps.d.ts +37 -0
- package/dist/npm/checkbox/Checkbox.js +18 -9
- package/dist/npm/checkbox/interfaces/CheckboxProps.d.ts +25 -1
- package/dist/npm/colors/ColorInput.js +2 -2
- package/dist/npm/colors/ColorPicker.js +36 -24
- package/dist/npm/colors/FlatColorPicker.js +3 -3
- package/dist/npm/colors/HexInput.js +2 -1
- package/dist/npm/colors/interfaces/ColorPickerProps.d.ts +37 -0
- package/dist/npm/input/Input.js +1 -1
- package/dist/npm/maskedtextbox/MaskedTextBox.d.ts +6 -0
- package/dist/npm/maskedtextbox/MaskedTextBox.js +20 -8
- package/dist/npm/maskedtextbox/MaskedTextBoxProps.d.ts +37 -0
- package/dist/npm/numerictextbox/NumericTextBox.js +26 -29
- package/dist/npm/numerictextbox/interfaces/NumericTextBoxProps.d.ts +37 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/radiobutton/RadioButton.js +12 -6
- package/dist/npm/radiobutton/interfaces/RadioButtonProps.d.ts +13 -1
- package/dist/npm/switch/Switch.d.ts +44 -0
- package/dist/npm/switch/Switch.js +26 -18
- package/dist/npm/textarea/TextArea.js +25 -15
- package/dist/npm/textarea/interfaces/TextAreaProps.d.ts +37 -0
- package/dist/systemjs/kendo-react-inputs.js +1 -1
- package/package.json +16 -16
|
@@ -66,14 +66,14 @@ exports.FlatColorPicker = React.forwardRef(function (props, ref) {
|
|
|
66
66
|
React.createElement("div", { className: "k-coloreditor-header k-hstack" },
|
|
67
67
|
React.createElement("div", { className: "k-coloreditor-header-actions k-hstack" },
|
|
68
68
|
React.createElement(kendo_react_buttons_1.ButtonGroup, null,
|
|
69
|
-
React.createElement(kendo_react_buttons_1.Button, { type: "button", togglable: true,
|
|
69
|
+
React.createElement(kendo_react_buttons_1.Button, { type: "button", togglable: true, fillMode: 'flat', selected: colorGradientView, onClick: function () { return handleViewChange('ColorGradient'); } },
|
|
70
70
|
React.createElement("span", { className: "k-icon k-i-color-canvas" })),
|
|
71
|
-
React.createElement(kendo_react_buttons_1.Button, { type: "button", togglable: true,
|
|
71
|
+
React.createElement(kendo_react_buttons_1.Button, { type: "button", togglable: true, fillMode: 'flat', selected: !colorGradientView, onClick: function () { return handleViewChange('ColorPalette'); } },
|
|
72
72
|
React.createElement("span", { className: "k-icon k-i-palette" })))),
|
|
73
73
|
React.createElement("div", { className: "k-spacer" }),
|
|
74
74
|
React.createElement("div", { className: "k-coloreditor-header-actions k-hstack" },
|
|
75
75
|
(props.showClearButton && defaultProps.showClearButton) &&
|
|
76
|
-
React.createElement(kendo_react_buttons_1.Button, { type: "button",
|
|
76
|
+
React.createElement(kendo_react_buttons_1.Button, { type: "button", fillMode: 'flat', onClick: handleResetColor },
|
|
77
77
|
React.createElement("span", { className: "k-icon k-i-reset-color" })),
|
|
78
78
|
(props.showPreview && defaultProps.showPreview) &&
|
|
79
79
|
React.createElement("div", { className: "k-coloreditor-preview k-vstack" },
|
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
var React = require("react");
|
|
17
17
|
var color_parser_1 = require("./utils/color-parser");
|
|
18
18
|
var misc_1 = require("./utils/misc");
|
|
19
|
+
var Input_1 = require("../input/Input");
|
|
19
20
|
/**
|
|
20
21
|
* @hidden
|
|
21
22
|
*/
|
|
@@ -40,7 +41,7 @@ var HexInput = /** @class */ (function (_super) {
|
|
|
40
41
|
return _this;
|
|
41
42
|
}
|
|
42
43
|
HexInput.prototype.render = function () {
|
|
43
|
-
return (React.createElement(
|
|
44
|
+
return (React.createElement(Input_1.Input, { value: this.state.hex, onChange: this.onChange, onBlur: this.onBlur, disabled: this.props.disabled }));
|
|
44
45
|
};
|
|
45
46
|
HexInput.getDerivedStateFromProps = function (props, state) {
|
|
46
47
|
if (props.hex !== state.originalHex) {
|
|
@@ -108,4 +108,41 @@ export interface ColorPickerProps {
|
|
|
108
108
|
* The event handler that will be fired when the left side of the ColorPicker is clicked.
|
|
109
109
|
*/
|
|
110
110
|
onActiveColorClick?: (event: ColorPickerActiveColorClick) => void;
|
|
111
|
+
/**
|
|
112
|
+
* Configures the `size` of the ColorPicker.
|
|
113
|
+
*
|
|
114
|
+
* The available options are:
|
|
115
|
+
* - small
|
|
116
|
+
* - medium
|
|
117
|
+
* - large
|
|
118
|
+
* - null—Does not set a size `className`.
|
|
119
|
+
*
|
|
120
|
+
* @default `medium`
|
|
121
|
+
*/
|
|
122
|
+
size?: null | 'small' | 'medium' | 'large';
|
|
123
|
+
/**
|
|
124
|
+
* Configures the `roundness` of the ColorPicker.
|
|
125
|
+
*
|
|
126
|
+
* The available options are:
|
|
127
|
+
* - small
|
|
128
|
+
* - medium
|
|
129
|
+
* - large
|
|
130
|
+
* - full
|
|
131
|
+
* - null—Does not set a rounded `className`.
|
|
132
|
+
*
|
|
133
|
+
* @default `medium`
|
|
134
|
+
*/
|
|
135
|
+
rounded?: null | 'small' | 'medium' | 'large' | 'full';
|
|
136
|
+
/**
|
|
137
|
+
* Configures the `fillMode` of the ColorPicker.
|
|
138
|
+
*
|
|
139
|
+
* The available options are:
|
|
140
|
+
* - solid
|
|
141
|
+
* - outline
|
|
142
|
+
* - flat
|
|
143
|
+
* - null—Does not set a fillMode `className`.
|
|
144
|
+
*
|
|
145
|
+
* @default `solid`
|
|
146
|
+
*/
|
|
147
|
+
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
111
148
|
}
|
package/dist/npm/input/Input.js
CHANGED
|
@@ -201,7 +201,7 @@ var InputWithoutContext = /** @class */ (function (_super) {
|
|
|
201
201
|
visited = _a.visited, touched = _a.touched, modified = _a.modified, ariaLabelledBy = _a.ariaLabelledBy, ariaDescribedBy = _a.ariaDescribedBy, validityStyles = _a.validityStyles, style = _a.style, props = __rest(_a, ["className", "label", "id", "validationMessage", "defaultValue", "valid", "visited", "touched", "modified", "ariaLabelledBy", "ariaDescribedBy", "validityStyles", "style"]);
|
|
202
202
|
var inputId = id || this._inputId;
|
|
203
203
|
var isValid = !this.validityStyles || this.validity.valid;
|
|
204
|
-
var inputClassName = kendo_react_common_1.classNames(className, 'k-
|
|
204
|
+
var inputClassName = kendo_react_common_1.classNames(className, 'k-input k-input-md k-rounded-md k-input-solid');
|
|
205
205
|
var textbox = (React.createElement("input", __assign({ "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy }, props, { style: !label
|
|
206
206
|
? style
|
|
207
207
|
: undefined, value: this.value, id: inputId, className: inputClassName, onChange: this.handleChange, onAnimationStart: this.handleAutoFill, ref: function (el) {
|
|
@@ -48,6 +48,9 @@ export declare class MaskedTextBoxWithoutContext extends React.Component<MaskedT
|
|
|
48
48
|
valid: PropTypes.Requireable<boolean>;
|
|
49
49
|
validityStyles: PropTypes.Requireable<boolean>;
|
|
50
50
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
51
|
+
size: PropTypes.Requireable<"small" | "medium" | "large">;
|
|
52
|
+
rounded: PropTypes.Requireable<"small" | "medium" | "large" | "full">;
|
|
53
|
+
fillMode: PropTypes.Requireable<"solid" | "flat" | "outline">;
|
|
51
54
|
};
|
|
52
55
|
/**
|
|
53
56
|
* @hidden
|
|
@@ -62,6 +65,9 @@ export declare class MaskedTextBoxWithoutContext extends React.Component<MaskedT
|
|
|
62
65
|
};
|
|
63
66
|
required: boolean;
|
|
64
67
|
validityStyles: boolean;
|
|
68
|
+
size: "small" | "medium" | "large";
|
|
69
|
+
rounded: "small" | "medium" | "large" | "full";
|
|
70
|
+
fillMode: "solid" | "flat" | "outline";
|
|
65
71
|
};
|
|
66
72
|
/**
|
|
67
73
|
* @hidden
|
|
@@ -280,16 +280,22 @@ var MaskedTextBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
280
280
|
*/
|
|
281
281
|
MaskedTextBoxWithoutContext.prototype.render = function () {
|
|
282
282
|
var _this = this;
|
|
283
|
+
var _a;
|
|
284
|
+
var _b = this.props, _c = _b.size, size = _c === void 0 ? MaskedTextBoxWithoutContext.defaultProps.size : _c, _d = _b.fillMode, fillMode = _d === void 0 ? MaskedTextBoxWithoutContext.defaultProps.fillMode : _d, _e = _b.rounded, rounded = _e === void 0 ? MaskedTextBoxWithoutContext.defaultProps.rounded : _e;
|
|
283
285
|
var inputId = this.props.id || this._inputId;
|
|
284
286
|
var isValid = !this.validityStyles || this.validity.valid;
|
|
285
287
|
var style = this.props.style || {};
|
|
286
|
-
var component = (React.createElement("span", { dir: this.props.dir, className: kendo_react_common_1.classNames('k-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
var component = (React.createElement("span", { dir: this.props.dir, className: kendo_react_common_1.classNames('k-maskedtextbox k-input', (_a = {},
|
|
289
|
+
_a["k-input-" + (kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
|
|
290
|
+
_a["k-input-" + fillMode] = fillMode,
|
|
291
|
+
_a["k-rounded-" + (kendo_react_common_1.kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
|
|
292
|
+
_a['k-valid'] = isValid,
|
|
293
|
+
_a['k-invalid'] = !isValid,
|
|
294
|
+
_a['k-required'] = this.required,
|
|
295
|
+
_a['k-disabled'] = this.props.disabled,
|
|
296
|
+
_a), this.props.className), style: !this.props.label
|
|
291
297
|
? __assign({ width: this.props.width }, style) : style },
|
|
292
|
-
React.createElement("input", { type: "text", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: false, className: "k-
|
|
298
|
+
React.createElement("input", { type: "text", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: false, className: "k-input k-input-inner", value: this.value, id: inputId, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, name: this.props.name, tabIndex: kendo_react_common_1.getTabIndex(this.props.tabIndex, this.props.disabled, true), accessKey: this.props.accessKey, title: this.props.title, disabled: this.props.disabled || undefined, readOnly: this.props.readonly || undefined, placeholder: this.props.placeholder, ref: function (input) { return _this._input = input; }, onChange: this.onChangeHandler, onPaste: this.pasteHandler, onFocus: this.focusHandler, onBlur: this.blurHandler, onDragStart: utils_1.returnFalse, onDrop: utils_1.returnFalse })));
|
|
293
299
|
return this.props.label
|
|
294
300
|
? (React.createElement(kendo_react_labels_1.FloatingLabel, { label: this.props.label, editorId: inputId, editorValue: this.value, editorValid: isValid, editorDisabled: this.props.disabled, editorPlaceholder: this.props.placeholder, children: component, style: { width: this.props.width }, dir: this.props.dir }))
|
|
295
301
|
: component;
|
|
@@ -378,7 +384,10 @@ var MaskedTextBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
378
384
|
required: PropTypes.bool,
|
|
379
385
|
valid: PropTypes.bool,
|
|
380
386
|
validityStyles: PropTypes.bool,
|
|
381
|
-
onChange: PropTypes.func
|
|
387
|
+
onChange: PropTypes.func,
|
|
388
|
+
size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
389
|
+
rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
|
|
390
|
+
fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline'])
|
|
382
391
|
};
|
|
383
392
|
/**
|
|
384
393
|
* @hidden
|
|
@@ -390,7 +399,10 @@ var MaskedTextBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
390
399
|
maskValidation: true,
|
|
391
400
|
rules: utils_1.defaultRules,
|
|
392
401
|
required: false,
|
|
393
|
-
validityStyles: true
|
|
402
|
+
validityStyles: true,
|
|
403
|
+
size: 'medium',
|
|
404
|
+
rounded: 'medium',
|
|
405
|
+
fillMode: 'solid'
|
|
394
406
|
};
|
|
395
407
|
return MaskedTextBoxWithoutContext;
|
|
396
408
|
}(React.Component));
|
|
@@ -149,4 +149,41 @@ export interface MaskedTextBoxProps extends FormComponentProps {
|
|
|
149
149
|
* Fires each time the MaskedTextBox gets blurred.
|
|
150
150
|
*/
|
|
151
151
|
onBlur?: (event: MaskedTextBoxEvent) => void;
|
|
152
|
+
/**
|
|
153
|
+
* Configures the `size` of the MaskedTextBox.
|
|
154
|
+
*
|
|
155
|
+
* The available options are:
|
|
156
|
+
* - small
|
|
157
|
+
* - medium
|
|
158
|
+
* - large
|
|
159
|
+
* - null—Does not set a size `className`.
|
|
160
|
+
*
|
|
161
|
+
* @default `medium`
|
|
162
|
+
*/
|
|
163
|
+
size?: null | 'small' | 'medium' | 'large';
|
|
164
|
+
/**
|
|
165
|
+
* Configures the `roundness` of the MaskedTextBox.
|
|
166
|
+
*
|
|
167
|
+
* The available options are:
|
|
168
|
+
* - small
|
|
169
|
+
* - medium
|
|
170
|
+
* - large
|
|
171
|
+
* - full
|
|
172
|
+
* - null—Does not set a rounded `className`.
|
|
173
|
+
*
|
|
174
|
+
* @default `medium`
|
|
175
|
+
*/
|
|
176
|
+
rounded?: null | 'small' | 'medium' | 'large' | 'full';
|
|
177
|
+
/**
|
|
178
|
+
* Configures the `fillMode` of the MaskedTextBox.
|
|
179
|
+
*
|
|
180
|
+
* The available options are:
|
|
181
|
+
* - solid
|
|
182
|
+
* - outline
|
|
183
|
+
* - flat
|
|
184
|
+
* - null—Does not set a fillMode `className`.
|
|
185
|
+
*
|
|
186
|
+
* @default `solid`
|
|
187
|
+
*/
|
|
188
|
+
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
152
189
|
}
|
|
@@ -9,6 +9,7 @@ var kendo_react_common_2 = require("@progress/kendo-react-common");
|
|
|
9
9
|
var package_metadata_1 = require("../package-metadata");
|
|
10
10
|
var messages_1 = require("../messages");
|
|
11
11
|
var utils_1 = require("./utils");
|
|
12
|
+
var kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
|
|
12
13
|
var VALIDATION_MESSAGE = 'Please enter a valid value!';
|
|
13
14
|
/**
|
|
14
15
|
* Represents the PropsContext of the `NumericTextBox` component.
|
|
@@ -21,6 +22,7 @@ exports.NumericTextBoxPropsContext = kendo_react_common_1.createPropsContext();
|
|
|
21
22
|
* Represents the [KendoReact NumericTextBox component]({% slug overview_numerictextbox %}).
|
|
22
23
|
*/
|
|
23
24
|
exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
25
|
+
var _a;
|
|
24
26
|
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
25
27
|
var props = kendo_react_common_1.usePropsContext(exports.NumericTextBoxPropsContext, directProps);
|
|
26
28
|
var calculatedId = React.useMemo(function () { return kendo_react_common_1.guid(); }, []);
|
|
@@ -28,9 +30,8 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
28
30
|
var intlService = kendo_react_intl_1.useInternationalization();
|
|
29
31
|
var localizationService = kendo_react_intl_1.useLocalization();
|
|
30
32
|
var elementRef = React.useRef(null);
|
|
31
|
-
var elementWrapperRef = React.useRef(null);
|
|
32
33
|
var valueDuringChangeRef = React.useRef();
|
|
33
|
-
var
|
|
34
|
+
var _b = React.useState(false), forceUpdate = _b[0], setForceUpdate = _b[1];
|
|
34
35
|
var stateRef = React.useRef(utils_1.getInitialState());
|
|
35
36
|
var isPasteRef = React.useRef(false);
|
|
36
37
|
var prevLooseValueRef = React.useRef();
|
|
@@ -125,13 +126,6 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
125
126
|
newState.eventValue = rangedValue;
|
|
126
127
|
stateValueRef.current = rangedValue;
|
|
127
128
|
}
|
|
128
|
-
if (newState.valueIsCorrected) {
|
|
129
|
-
var wrapper_1 = elementWrapperRef.current;
|
|
130
|
-
if (wrapper_1 && wrapper_1.className.indexOf('k-state-invalid') === -1) {
|
|
131
|
-
wrapper_1.className += ' k-state-invalid';
|
|
132
|
-
window.setTimeout(function () { return wrapper_1.className = wrapper_1.className.replace(' k-state-invalid', ''); }, 50);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
129
|
var shouldFireEvent = props.value !== newState.eventValue;
|
|
136
130
|
if (shouldFireEvent) {
|
|
137
131
|
kendo_react_common_1.dispatchEvent(props.onChange, event, getImperativeHandle(), { value: newState.eventValue });
|
|
@@ -258,24 +252,21 @@ exports.NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
258
252
|
var isValid = !validityStylesGetter() || validityGetter().valid;
|
|
259
253
|
var numerictextbox = (React.createElement("span", { dir: props.dir, style: !props.label
|
|
260
254
|
? { width: props.width }
|
|
261
|
-
: undefined, className: 'k-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
props.
|
|
269
|
-
props.
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
.toLanguageString(messages_1.numericDecreaseValue, messages_1.messages[messages_1.numericDecreaseValue]), title: localizationService
|
|
277
|
-
.toLanguageString(messages_1.numericDecreaseValue, messages_1.messages[messages_1.numericDecreaseValue]), onClick: onDecrease },
|
|
278
|
-
React.createElement("span", { className: "k-icon k-i-arrow-s" })))))));
|
|
255
|
+
: undefined, className: kendo_react_common_1.classNames('k-input', 'k-numerictextbox', (_a = {},
|
|
256
|
+
_a["k-input-" + (kendo_react_common_1.kendoThemeMaps.sizeMap[props.size] || props.size)] = props.size,
|
|
257
|
+
_a["k-input-" + props.fillMode] = props.fillMode,
|
|
258
|
+
_a["k-rounded-" + (kendo_react_common_1.kendoThemeMaps.roundedMap[props.rounded] || props.rounded)] = props.rounded,
|
|
259
|
+
_a['k-valid'] = isValid,
|
|
260
|
+
_a['k-invalid'] = !isValid,
|
|
261
|
+
_a['k-required'] = props.required,
|
|
262
|
+
_a['k-disabled'] = props.disabled,
|
|
263
|
+
_a), props.className), "aria-disabled": props.disabled ? 'true' : undefined },
|
|
264
|
+
React.createElement("input", { value: looseValue === null ? '' : looseValue, tabIndex: kendo_react_common_1.getTabIndex(props.tabIndex, props.disabled), accessKey: props.accessKey, disabled: props.disabled, title: props.title, "aria-valuemin": props.min, "aria-valuemax": props.max, "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy, placeholder: props.placeholder, spellCheck: false, autoComplete: 'off', autoCorrect: 'off', type: props.inputType || 'tel', className: 'k-input-inner', id: inputId, name: props.name, readOnly: props.readOnly, onChange: onChangeHandler, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onPaste: onPasteHandler, onWheel: onWheelHandler, ref: elementRef }),
|
|
265
|
+
props.children,
|
|
266
|
+
props.spinners &&
|
|
267
|
+
(React.createElement("span", { className: "k-input-spinner k-spin-button", onMouseDown: onMouseDown },
|
|
268
|
+
React.createElement(kendo_react_buttons_1.Button, { icon: 'arrow-n', className: "k-spinner-increase", "aria-label": localizationService.toLanguageString(messages_1.numericIncreaseValue, messages_1.messages[messages_1.numericIncreaseValue]), title: localizationService.toLanguageString(messages_1.numericIncreaseValue, messages_1.messages[messages_1.numericIncreaseValue]), onClick: onIncrease }),
|
|
269
|
+
React.createElement(kendo_react_buttons_1.Button, { className: "k-spinner-decrease", icon: 'arrow-s', "aria-label": localizationService.toLanguageString(messages_1.numericDecreaseValue, messages_1.messages[messages_1.numericDecreaseValue]), title: localizationService.toLanguageString(messages_1.numericDecreaseValue, messages_1.messages[messages_1.numericDecreaseValue]), onClick: onDecrease })))));
|
|
279
270
|
return props.label
|
|
280
271
|
? (React.createElement(kendo_react_labels_1.FloatingLabel, { label: props.label, editorId: inputId, editorValue: looseValue === null ? '' : looseValue, editorValid: isValid, editorDisabled: props.disabled, editorPlaceholder: props.placeholder, children: numerictextbox, style: { width: props.width }, dir: props.dir }))
|
|
281
272
|
: numerictextbox;
|
|
@@ -320,7 +311,10 @@ exports.NumericTextBox.propTypes = {
|
|
|
320
311
|
ariaDescribedBy: PropTypes.string,
|
|
321
312
|
onChange: PropTypes.func,
|
|
322
313
|
onFocus: PropTypes.func,
|
|
323
|
-
onBlur: PropTypes.func
|
|
314
|
+
onBlur: PropTypes.func,
|
|
315
|
+
size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
316
|
+
rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
|
|
317
|
+
fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline'])
|
|
324
318
|
};
|
|
325
319
|
exports.NumericTextBox.displayName = 'KendoNumericTextBox';
|
|
326
320
|
exports.NumericTextBox.defaultProps = {
|
|
@@ -332,5 +326,8 @@ exports.NumericTextBox.defaultProps = {
|
|
|
332
326
|
rangeOnEnter: true,
|
|
333
327
|
onChange: function (_) { return; },
|
|
334
328
|
onFocus: function (_) { return; },
|
|
335
|
-
onBlur: function (_) { return; }
|
|
329
|
+
onBlur: function (_) { return; },
|
|
330
|
+
size: 'medium',
|
|
331
|
+
rounded: 'medium',
|
|
332
|
+
fillMode: 'solid'
|
|
336
333
|
};
|
|
@@ -124,5 +124,42 @@ export interface NumericTextBoxProps extends FormComponentProps {
|
|
|
124
124
|
onBlur?: (event: NumericTextBoxBlurEvent) => void;
|
|
125
125
|
/** @hidden */
|
|
126
126
|
children?: React.ReactNode;
|
|
127
|
+
/**
|
|
128
|
+
* Configures the `size` of the NumericTextBox.
|
|
129
|
+
*
|
|
130
|
+
* The available options are:
|
|
131
|
+
* - small
|
|
132
|
+
* - medium
|
|
133
|
+
* - large
|
|
134
|
+
* - null—Does not set a size `className`.
|
|
135
|
+
*
|
|
136
|
+
* @default `medium`
|
|
137
|
+
*/
|
|
138
|
+
size?: null | 'small' | 'medium' | 'large';
|
|
139
|
+
/**
|
|
140
|
+
* Configures the `roundness` of the NumericTextBox.
|
|
141
|
+
*
|
|
142
|
+
* The available options are:
|
|
143
|
+
* - small
|
|
144
|
+
* - medium
|
|
145
|
+
* - large
|
|
146
|
+
* - full
|
|
147
|
+
* - null—Does not set a rounded `className`.
|
|
148
|
+
*
|
|
149
|
+
* @default `medium`
|
|
150
|
+
*/
|
|
151
|
+
rounded?: null | 'small' | 'medium' | 'large' | 'full';
|
|
152
|
+
/**
|
|
153
|
+
* Configures the `fillMode` of the NumericTextBox.
|
|
154
|
+
*
|
|
155
|
+
* The available options are:
|
|
156
|
+
* - solid
|
|
157
|
+
* - outline
|
|
158
|
+
* - flat
|
|
159
|
+
* - null—Does not set a fillMode `className`.
|
|
160
|
+
*
|
|
161
|
+
* @default `solid`
|
|
162
|
+
*/
|
|
163
|
+
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
127
164
|
}
|
|
128
165
|
export {};
|
|
@@ -7,7 +7,7 @@ exports.packageMetadata = {
|
|
|
7
7
|
name: '@progress/kendo-react-inputs',
|
|
8
8
|
productName: 'KendoReact',
|
|
9
9
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
10
|
-
publishDate:
|
|
10
|
+
publishDate: 1642537025,
|
|
11
11
|
version: '',
|
|
12
12
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
13
13
|
};
|
|
@@ -39,9 +39,10 @@ exports.RadioButtonPropsContext = kendo_react_common_1.createPropsContext();
|
|
|
39
39
|
* Obtaining the `ref` returns an object of type [RadioButtonHandle]({% slug api_inputs_radiobuttonhandle %}).
|
|
40
40
|
*/
|
|
41
41
|
exports.RadioButton = React.forwardRef(function (directProps, target) {
|
|
42
|
+
var _a;
|
|
42
43
|
kendo_react_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
43
44
|
var props = kendo_react_common_1.usePropsContext(exports.RadioButtonPropsContext, directProps);
|
|
44
|
-
var ariaDescribedBy = props.ariaDescribedBy, checked = props.checked, children = props.children, className = props.className, disabled = props.disabled, id = props.id, label = props.label, labelPlacement = props.labelPlacement, name = props.name, style = props.style, tabIndex = props.tabIndex, value = props.value, valid = props.valid, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, others = __rest(props, ["ariaDescribedBy", "checked", "children", "className", "disabled", "id", "label", "labelPlacement", "name", "style", "tabIndex", "value", "valid", "onChange", "onFocus", "onBlur"]);
|
|
45
|
+
var ariaDescribedBy = props.ariaDescribedBy, checked = props.checked, children = props.children, className = props.className, disabled = props.disabled, id = props.id, size = props.size, label = props.label, labelPlacement = props.labelPlacement, name = props.name, style = props.style, tabIndex = props.tabIndex, value = props.value, valid = props.valid, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, others = __rest(props, ["ariaDescribedBy", "checked", "children", "className", "disabled", "id", "size", "label", "labelPlacement", "name", "style", "tabIndex", "value", "valid", "onChange", "onFocus", "onBlur"]);
|
|
45
46
|
var elementRef = React.useRef(null);
|
|
46
47
|
var focusElement = React.useCallback(function () {
|
|
47
48
|
if (elementRef.current) {
|
|
@@ -67,11 +68,11 @@ exports.RadioButton = React.forwardRef(function (directProps, target) {
|
|
|
67
68
|
kendo_react_common_1.dispatchEvent(onBlur, event, getImperativeHandle(), undefined);
|
|
68
69
|
}
|
|
69
70
|
}, [onBlur, disabled]);
|
|
70
|
-
var inputProps = __assign({ type: 'radio', id: id || calculatedId, name: name, className: kendo_react_common_1.classNames({
|
|
71
|
-
|
|
72
|
-
'k-state-invalid'
|
|
73
|
-
'k-invalid'
|
|
74
|
-
|
|
71
|
+
var inputProps = __assign({ type: 'radio', id: id || calculatedId, name: name, className: kendo_react_common_1.classNames('k-radio', (_a = {},
|
|
72
|
+
_a["k-radio-" + (kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
|
|
73
|
+
_a['k-state-invalid'] = valid === false,
|
|
74
|
+
_a['k-invalid'] = valid === false,
|
|
75
|
+
_a), className), ref: elementRef, disabled: disabled, tabIndex: kendo_react_common_1.getTabIndex(tabIndex, disabled), checked: checked, style: style, 'aria-describedby': ariaDescribedBy, value: value, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur }, others);
|
|
75
76
|
var radioButtonLabel = (React.createElement(React.Fragment, null, label !== undefined ? (React.createElement("label", { className: 'k-radio-label', htmlFor: id || calculatedId, style: { userSelect: 'none' }, "aria-label": label }, label)) : null));
|
|
76
77
|
var radio = React.createElement("input", __assign({}, inputProps));
|
|
77
78
|
return (labelPlacement === 'before'
|
|
@@ -89,6 +90,7 @@ exports.RadioButton.propTypes = {
|
|
|
89
90
|
className: PropTypes.string,
|
|
90
91
|
disabled: PropTypes.bool,
|
|
91
92
|
id: PropTypes.string,
|
|
93
|
+
size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
92
94
|
label: PropTypes.string,
|
|
93
95
|
labelPlacement: PropTypes.string,
|
|
94
96
|
name: PropTypes.string,
|
|
@@ -100,4 +102,8 @@ exports.RadioButton.propTypes = {
|
|
|
100
102
|
onFocus: PropTypes.func,
|
|
101
103
|
onBlur: PropTypes.func
|
|
102
104
|
};
|
|
105
|
+
var defaultProps = {
|
|
106
|
+
size: 'medium'
|
|
107
|
+
};
|
|
103
108
|
exports.RadioButton.displayName = 'KendoRadioButton';
|
|
109
|
+
exports.RadioButton.defaultProps = defaultProps;
|
|
@@ -10,7 +10,7 @@ declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
|
10
10
|
* Represents the props of the [KendoReact RadioButton component]({% slug overview_radiobutton %}).
|
|
11
11
|
* Extends the [native input props](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement).
|
|
12
12
|
*/
|
|
13
|
-
export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onFocus' | 'onBlur'> {
|
|
13
|
+
export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'onChange' | 'onFocus' | 'onBlur'> {
|
|
14
14
|
/**
|
|
15
15
|
* Identifies the element(s) which will describe the component, similar to [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
|
|
16
16
|
* For example these elements could contain error or hint message.
|
|
@@ -37,6 +37,18 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
37
37
|
* Sets the `id` of the Radio button.
|
|
38
38
|
*/
|
|
39
39
|
id?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Configures the `size` of the RadioButton.
|
|
42
|
+
*
|
|
43
|
+
* The available options are:
|
|
44
|
+
* - small
|
|
45
|
+
* - medium
|
|
46
|
+
* - large
|
|
47
|
+
* - null—Does not set a size `className`.
|
|
48
|
+
*
|
|
49
|
+
* @default `medium`
|
|
50
|
+
*/
|
|
51
|
+
size?: null | 'small' | 'medium' | 'large';
|
|
40
52
|
/**
|
|
41
53
|
* Sets the label of the Radio button ([see example]({% slug labels_radiobutton %})).
|
|
42
54
|
*/
|
|
@@ -48,6 +48,44 @@ export interface SwitchProps extends ToggleBaseProps, FormComponentProps {
|
|
|
48
48
|
* Sets the `id` of the Switch.
|
|
49
49
|
*/
|
|
50
50
|
id?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Configures the `size` of the Switch.
|
|
53
|
+
*
|
|
54
|
+
* The available options are:
|
|
55
|
+
* - small
|
|
56
|
+
* - medium
|
|
57
|
+
* - large
|
|
58
|
+
* - null—Does not set a size `className`.
|
|
59
|
+
*
|
|
60
|
+
* @default `medium`
|
|
61
|
+
*/
|
|
62
|
+
size?: null | 'small' | 'medium' | 'large';
|
|
63
|
+
/**
|
|
64
|
+
* Configures the `trackRounded` of the Switch.
|
|
65
|
+
*
|
|
66
|
+
* The available options are:
|
|
67
|
+
* - small
|
|
68
|
+
* - medium
|
|
69
|
+
* - large
|
|
70
|
+
* - full
|
|
71
|
+
* - null—Does not set a trackRounded `className`.
|
|
72
|
+
*
|
|
73
|
+
* @default `full`
|
|
74
|
+
*/
|
|
75
|
+
trackRounded?: null | 'small' | 'medium' | 'large' | 'full';
|
|
76
|
+
/**
|
|
77
|
+
* Configures the `thumbRounded` of the Switch.
|
|
78
|
+
*
|
|
79
|
+
* The available options are:
|
|
80
|
+
* - small
|
|
81
|
+
* - medium
|
|
82
|
+
* - large
|
|
83
|
+
* - full
|
|
84
|
+
* - null—Does not set a thumbRounded `className`.
|
|
85
|
+
*
|
|
86
|
+
* @default `full`
|
|
87
|
+
*/
|
|
88
|
+
thumbRounded?: null | 'small' | 'medium' | 'large' | 'full';
|
|
51
89
|
/**
|
|
52
90
|
* Identifies the element(s) which will describe the component, similar to [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
|
|
53
91
|
* For example these elements could contain error or hint message.
|
|
@@ -136,6 +174,9 @@ export declare class SwitchWithoutContext extends React.Component<SwitchProps, S
|
|
|
136
174
|
className: PropTypes.Requireable<string>;
|
|
137
175
|
disabled: PropTypes.Requireable<boolean>;
|
|
138
176
|
defaultChecked: PropTypes.Requireable<boolean>;
|
|
177
|
+
size: PropTypes.Requireable<"small" | "medium" | "large">;
|
|
178
|
+
trackRounded: PropTypes.Requireable<"small" | "medium" | "large" | "full">;
|
|
179
|
+
thumbRounded: PropTypes.Requireable<"small" | "medium" | "large" | "full">;
|
|
139
180
|
dir: PropTypes.Requireable<string>;
|
|
140
181
|
id: PropTypes.Requireable<string>;
|
|
141
182
|
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
@@ -157,6 +198,9 @@ export declare class SwitchWithoutContext extends React.Component<SwitchProps, S
|
|
|
157
198
|
static defaultProps: {
|
|
158
199
|
disabled: boolean;
|
|
159
200
|
defaultChecked: boolean;
|
|
201
|
+
size: "small" | "medium" | "large";
|
|
202
|
+
trackRounded: "small" | "medium" | "large" | "full";
|
|
203
|
+
thumbRounded: "small" | "medium" | "large" | "full";
|
|
160
204
|
offLabel: string;
|
|
161
205
|
onBlur: () => void;
|
|
162
206
|
onFocus: () => void;
|
|
@@ -31,10 +31,6 @@ var kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
|
31
31
|
var messages_1 = require("./../messages");
|
|
32
32
|
var kendo_react_common_2 = require("@progress/kendo-react-common");
|
|
33
33
|
var package_metadata_1 = require("../package-metadata");
|
|
34
|
-
var SWITCH_CONTAINER = 'k-switch-container';
|
|
35
|
-
var SWITCH_HANDLE = 'k-switch-handle';
|
|
36
|
-
var SWITCH_LABEL_ON = 'k-switch-label-on';
|
|
37
|
-
var SWITCH_LABEL_OFF = 'k-switch-label-off';
|
|
38
34
|
/** @hidden */
|
|
39
35
|
var SwitchWithoutContext = /** @class */ (function (_super) {
|
|
40
36
|
__extends(SwitchWithoutContext, _super);
|
|
@@ -236,19 +232,20 @@ var SwitchWithoutContext = /** @class */ (function (_super) {
|
|
|
236
232
|
*/
|
|
237
233
|
SwitchWithoutContext.prototype.render = function () {
|
|
238
234
|
var _this = this;
|
|
235
|
+
var _a, _b, _c;
|
|
239
236
|
var focused = this.state.focused;
|
|
240
|
-
var
|
|
237
|
+
var _d = this.props, dir = _d.dir, disabled = _d.disabled, trackRounded = _d.trackRounded, thumbRounded = _d.thumbRounded, size = _d.size, id = _d.id, offLabel = _d.offLabel, onLabel = _d.onLabel, tabIndex = _d.tabIndex;
|
|
241
238
|
this.dir = dir || (this._wrapper && getComputedStyle(this._wrapper).direction) || undefined;
|
|
242
239
|
var isValid = !this.validityStyles || this.validity.valid;
|
|
243
|
-
var switchClassName = kendo_react_common_1.classNames({
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
'k-switch-on'
|
|
247
|
-
'k-switch-off'
|
|
248
|
-
'k-state-focused'
|
|
249
|
-
'k-state-disabled'
|
|
250
|
-
'k-state-invalid'
|
|
251
|
-
|
|
240
|
+
var switchClassName = kendo_react_common_1.classNames('k-switch', (_a = {},
|
|
241
|
+
_a["k-switch-" + (kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
|
|
242
|
+
_a["k-rounded-" + (kendo_react_common_1.kendoThemeMaps.roundedMap[trackRounded] || trackRounded)] = trackRounded,
|
|
243
|
+
_a['k-switch-on'] = this.value,
|
|
244
|
+
_a['k-switch-off'] = !this.value,
|
|
245
|
+
_a['k-state-focused'] = focused,
|
|
246
|
+
_a['k-state-disabled'] = disabled,
|
|
247
|
+
_a['k-state-invalid'] = !isValid,
|
|
248
|
+
_a), this.props.className);
|
|
252
249
|
var ariaAttributes = {
|
|
253
250
|
'aria-checked': this.value,
|
|
254
251
|
'aria-disabled': disabled || undefined
|
|
@@ -256,13 +253,18 @@ var SwitchWithoutContext = /** @class */ (function (_super) {
|
|
|
256
253
|
return (React.createElement("span", { ref: function (span) {
|
|
257
254
|
_this._wrapper = span;
|
|
258
255
|
}, className: switchClassName, dir: this.dir, onKeyDown: this.handleKeyDown, onClick: this.handleClick, onBlur: this.handleWrapperBlur, onFocus: this.handleWrapperFocus },
|
|
259
|
-
React.createElement("span", __assign({ className:
|
|
256
|
+
React.createElement("span", __assign({ className: kendo_react_common_1.classNames('k-switch-track', (_b = {},
|
|
257
|
+
_b["k-rounded-" + (kendo_react_common_1.kendoThemeMaps.roundedMap[trackRounded] || trackRounded)] = trackRounded,
|
|
258
|
+
_b)), id: id || this._id, role: 'switch' }, ariaAttributes, { "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, ref: function (span) {
|
|
260
259
|
_this._element = span;
|
|
261
260
|
}, tabIndex: kendo_react_common_1.getTabIndex(tabIndex, disabled, undefined), accessKey: this.props.accessKey }),
|
|
262
261
|
this.dummyInput(this.value),
|
|
263
|
-
React.createElement("span", { className:
|
|
264
|
-
React.createElement("span", { className:
|
|
265
|
-
React.createElement("span", { className:
|
|
262
|
+
React.createElement("span", { className: 'k-switch-label-on' }, onLabel),
|
|
263
|
+
React.createElement("span", { className: 'k-switch-label-off' }, offLabel),
|
|
264
|
+
React.createElement("span", { className: 'k-switch-thumb-wrap' },
|
|
265
|
+
React.createElement("span", { className: kendo_react_common_1.classNames('k-switch-thumb', (_c = {},
|
|
266
|
+
_c["k-rounded-" + thumbRounded] = thumbRounded,
|
|
267
|
+
_c)) })))));
|
|
266
268
|
};
|
|
267
269
|
SwitchWithoutContext.displayName = 'Switch';
|
|
268
270
|
/**
|
|
@@ -274,6 +276,9 @@ var SwitchWithoutContext = /** @class */ (function (_super) {
|
|
|
274
276
|
className: PropTypes.string,
|
|
275
277
|
disabled: PropTypes.bool,
|
|
276
278
|
defaultChecked: PropTypes.bool,
|
|
279
|
+
size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
280
|
+
trackRounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
|
|
281
|
+
thumbRounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
|
|
277
282
|
dir: PropTypes.string,
|
|
278
283
|
id: PropTypes.string,
|
|
279
284
|
ariaLabelledBy: PropTypes.string,
|
|
@@ -295,6 +300,9 @@ var SwitchWithoutContext = /** @class */ (function (_super) {
|
|
|
295
300
|
SwitchWithoutContext.defaultProps = {
|
|
296
301
|
disabled: false,
|
|
297
302
|
defaultChecked: false,
|
|
303
|
+
size: 'medium',
|
|
304
|
+
trackRounded: 'full',
|
|
305
|
+
thumbRounded: 'full',
|
|
298
306
|
offLabel: 'OFF',
|
|
299
307
|
onBlur: kendo_react_common_1.noop,
|
|
300
308
|
onFocus: kendo_react_common_1.noop,
|