@progress/kendo-react-inputs 4.14.1-dev.202201181415 → 5.0.1-dev.202201200659
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
|
@@ -20,7 +20,7 @@ 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, createPropsContext, usePropsContext } from '@progress/kendo-react-common';
|
|
23
|
+
import { Keys, classNames, guid, useDir, getTabIndex, dispatchEvent, createPropsContext, usePropsContext, kendoThemeMaps } 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';
|
|
@@ -46,11 +46,12 @@ export var CheckboxPropsContext = createPropsContext();
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
export var Checkbox = React.forwardRef(function (directProps, target) {
|
|
49
|
+
var _a;
|
|
49
50
|
validatePackage(packageMetadata);
|
|
50
51
|
var props = usePropsContext(CheckboxPropsContext, directProps);
|
|
51
|
-
var
|
|
52
|
+
var _b = props, ariaDescribedBy = _b.ariaDescribedBy, ariaLabelledBy = _b.ariaLabelledBy, checked = _b.checked, className = _b.className, children = _b.children, defaultChecked = _b.defaultChecked, disabled = _b.disabled, defaultValue = _b.defaultValue, id = _b.id, size = _b.size, rounded = _b.rounded, label = _b.label, labelPlacement = _b.labelPlacement, name = _b.name, labelOptional = _b.labelOptional, onChange = _b.onChange, onFocus = _b.onFocus, onBlur = _b.onBlur, tabIndex = _b.tabIndex, value = _b.value, required = _b.required, valid = _b.valid, validationMessage = _b.validationMessage, validityStyles = _b.validityStyles,
|
|
52
53
|
// Removed to support direct use in Form Field component
|
|
53
|
-
visited =
|
|
54
|
+
visited = _b.visited, touched = _b.touched, modified = _b.modified, others = __rest(_b, ["ariaDescribedBy", "ariaLabelledBy", "checked", "className", "children", "defaultChecked", "disabled", "defaultValue", "id", "size", "rounded", "label", "labelPlacement", "name", "labelOptional", "onChange", "onFocus", "onBlur", "tabIndex", "value", "required", "valid", "validationMessage", "validityStyles", "visited", "touched", "modified"]);
|
|
54
55
|
var elementRef = React.useRef(null);
|
|
55
56
|
var focusElement = React.useCallback(function () {
|
|
56
57
|
if (elementRef.current) {
|
|
@@ -63,8 +64,8 @@ export var Checkbox = React.forwardRef(function (directProps, target) {
|
|
|
63
64
|
get name() { return elementRef.current && elementRef.current.name; }
|
|
64
65
|
}); }, [focusElement]);
|
|
65
66
|
React.useImperativeHandle(target, getImperativeHandle);
|
|
66
|
-
var
|
|
67
|
-
var
|
|
67
|
+
var _c = React.useState(defaultChecked), stateChecked = _c[0], setStateChecked = _c[1];
|
|
68
|
+
var _d = React.useState(defaultValue), stateValue = _d[0], setStateValue = _d[1];
|
|
68
69
|
var valueIsBoolean = (typeof value === 'boolean' || value === null);
|
|
69
70
|
var isCheckedControlled = checked !== undefined;
|
|
70
71
|
var isValueControlled = valueIsBoolean;
|
|
@@ -141,11 +142,12 @@ export var Checkbox = React.forwardRef(function (directProps, target) {
|
|
|
141
142
|
}, [onBlur, disabled, getImperativeHandle]);
|
|
142
143
|
var dir = useDir(elementRef, props.dir);
|
|
143
144
|
var checkboxClasses = classNames({ 'k-state-disabled': disabled }, className);
|
|
144
|
-
var inputProps = __assign({ type: 'checkbox', className: classNames({
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
'k-state-
|
|
148
|
-
|
|
145
|
+
var inputProps = __assign({ type: 'checkbox', className: classNames('k-checkbox', (_a = {},
|
|
146
|
+
_a["k-checkbox-" + (kendoThemeMaps.sizeMap[size] || size)] = size,
|
|
147
|
+
_a["k-rounded-" + (kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
|
|
148
|
+
_a['k-state-indeterminate'] = indeterminateProp,
|
|
149
|
+
_a['k-state-invalid k-invalid'] = !(isValid || validityStyles !== undefined || validityStyles === true),
|
|
150
|
+
_a)), ref: elementRef, name: name, id: id || calculatedId, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, checked: Boolean(checkedProp), disabled: disabled, tabIndex: getTabIndex(tabIndex, disabled), role: 'checkbox', required: required !== undefined ? required : false, 'aria-checked': currentChecked || checkedProp ?
|
|
149
151
|
true :
|
|
150
152
|
indeterminateProp ?
|
|
151
153
|
'mixed' :
|
|
@@ -173,6 +175,8 @@ Checkbox.propTypes = {
|
|
|
173
175
|
dir: PropTypes.string,
|
|
174
176
|
disabled: PropTypes.bool,
|
|
175
177
|
id: PropTypes.string,
|
|
178
|
+
size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
179
|
+
rounded: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
176
180
|
ariaLabelledBy: PropTypes.string,
|
|
177
181
|
ariaDescribedBy: PropTypes.string,
|
|
178
182
|
label: PropTypes.any,
|
|
@@ -189,4 +193,9 @@ Checkbox.propTypes = {
|
|
|
189
193
|
onFocus: PropTypes.func,
|
|
190
194
|
onBlur: PropTypes.func
|
|
191
195
|
};
|
|
196
|
+
var defaultProps = {
|
|
197
|
+
size: 'medium',
|
|
198
|
+
rounded: 'medium'
|
|
199
|
+
};
|
|
200
|
+
Checkbox.defaultProps = defaultProps;
|
|
192
201
|
Checkbox.displayName = 'KendoCheckbox';
|
|
@@ -12,7 +12,7 @@ declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
|
12
12
|
* Represents the props of the [KendoReact Checkbox component]({% slug overview_checkbox %}).
|
|
13
13
|
* Extends the [native input props](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement).
|
|
14
14
|
*/
|
|
15
|
-
export interface CheckboxProps extends ToggleBaseProps, FormComponentProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'checked' | 'value' | 'onChange' | 'onFocus' | 'onBlur'> {
|
|
15
|
+
export interface CheckboxProps extends ToggleBaseProps, FormComponentProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'checked' | 'value' | 'size' | 'onChange' | 'onFocus' | 'onBlur'> {
|
|
16
16
|
/**
|
|
17
17
|
* Sets the checked state of the Checkbox.
|
|
18
18
|
* Set to null to enable the indeterminate state of the Checkbox ([see example]({% slug overview_checkbox %})).
|
|
@@ -53,6 +53,30 @@ export interface CheckboxProps extends ToggleBaseProps, FormComponentProps, Omit
|
|
|
53
53
|
* Sets the `id` of the Checkbox.
|
|
54
54
|
*/
|
|
55
55
|
id?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Configures the `size` of the Checkbox.
|
|
58
|
+
*
|
|
59
|
+
* The available options are:
|
|
60
|
+
* - small
|
|
61
|
+
* - medium
|
|
62
|
+
* - large
|
|
63
|
+
* - null—Does not set a size `className`.
|
|
64
|
+
*
|
|
65
|
+
* @default `medium`
|
|
66
|
+
*/
|
|
67
|
+
size?: null | 'small' | 'medium' | 'large';
|
|
68
|
+
/**
|
|
69
|
+
* Configures the `rounded` style of the Checkbox.
|
|
70
|
+
*
|
|
71
|
+
* The available options are:
|
|
72
|
+
* - small
|
|
73
|
+
* - medium
|
|
74
|
+
* - large
|
|
75
|
+
* - null—Does not set a rounded `className`.
|
|
76
|
+
*
|
|
77
|
+
* @default `medium`
|
|
78
|
+
*/
|
|
79
|
+
rounded?: null | 'small' | 'medium' | 'large';
|
|
56
80
|
/**
|
|
57
81
|
* 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).
|
|
58
82
|
* For example these elements could contain error or hint message.
|
|
@@ -66,10 +66,10 @@ var ColorInput = /** @class */ (function (_super) {
|
|
|
66
66
|
var aMessage = localizationService.toLanguageString(colorGradientR, messages[colorGradientA]);
|
|
67
67
|
return (React.createElement("div", { className: "k-colorgradient-inputs k-hstack" },
|
|
68
68
|
React.createElement("div", { className: "k-vstack" },
|
|
69
|
-
React.createElement(Button, {
|
|
69
|
+
React.createElement(Button, { fillMode: 'flat', icon: 'arrows-kpi', className: "k-colorgradient-toggle-mode k-icon-button", onClick: this.onToggleModeChange.bind(this) })),
|
|
70
70
|
this.state.inputMode === 'hex' &&
|
|
71
71
|
React.createElement("div", { className: "k-vstack k-flex-1" },
|
|
72
|
-
React.createElement("span", { className: "k-hex-value k-textbox" },
|
|
72
|
+
React.createElement("span", { className: "k-hex-value k-textbox k-input" },
|
|
73
73
|
React.createElement(HexInput, { hex: this.props.hex, onHexChange: this.props.onHexChange, disabled: this.props.disabled })),
|
|
74
74
|
React.createElement(Label, { className: "k-colorgradient-input-label" }, hexMessage)),
|
|
75
75
|
(this.state.inputMode === 'rgb' || this.state.inputMode === 'rgba') &&
|
|
@@ -11,12 +11,13 @@ 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, createPropsContext, usePropsContext } from '@progress/kendo-react-common';
|
|
14
|
+
import { classNames, Keys, useDir, getTabIndex, createPropsContext, usePropsContext, kendoThemeMaps } 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';
|
|
18
18
|
import { ColorGradient } from './ColorGradient';
|
|
19
19
|
import { ColorPalette, DEFAULT_PRESET, DEFAULT_TILE_SIZE } from './ColorPalette';
|
|
20
|
+
import { Button } from '@progress/kendo-react-buttons';
|
|
20
21
|
/**
|
|
21
22
|
* @hidden
|
|
22
23
|
*/
|
|
@@ -57,9 +58,10 @@ export var ColorPickerPropsContext = createPropsContext();
|
|
|
57
58
|
* ```
|
|
58
59
|
*/
|
|
59
60
|
export var ColorPicker = React.forwardRef(function (directProps, target) {
|
|
61
|
+
var _a, _b;
|
|
60
62
|
validatePackage(packageMetadata);
|
|
61
63
|
var props = usePropsContext(ColorPickerPropsContext, directProps);
|
|
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;
|
|
64
|
+
var _c = props.size, size = _c === void 0 ? defaultProps.size : _c, _d = props.rounded, rounded = _d === void 0 ? defaultProps.rounded : _d, _e = props.fillMode, fillMode = _e === void 0 ? defaultProps.fillMode : _e, popupSettings = props.popupSettings, gradientSettings = props.gradientSettings, paletteSettings = props.paletteSettings, valid = props.valid, disabled = props.disabled, tabIndex = props.tabIndex, view = props.view, icon = props.icon, iconClassName = props.iconClassName, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onActiveColorClick = props.onActiveColorClick;
|
|
63
65
|
var focusableElementRef = React.useRef(null);
|
|
64
66
|
var gradientRef = React.useRef(null);
|
|
65
67
|
var paletteRef = React.useRef(null);
|
|
@@ -76,9 +78,9 @@ export var ColorPicker = React.forwardRef(function (directProps, target) {
|
|
|
76
78
|
actionElement: buttonRef.current,
|
|
77
79
|
focus: focusElement
|
|
78
80
|
}); });
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
var
|
|
81
|
+
var _f = React.useState(false), focused = _f[0], setFocused = _f[1];
|
|
82
|
+
var _g = React.useState(props.defaultValue), stateValue = _g[0], setStateValue = _g[1];
|
|
83
|
+
var _h = React.useState(false), stateOpen = _h[0], setStateOpen = _h[1];
|
|
82
84
|
var isValueControlled = isControlled(props.value);
|
|
83
85
|
var isOpenControlled = isControlled(props.open);
|
|
84
86
|
var value = isValueControlled ? props.value : stateValue;
|
|
@@ -190,24 +192,27 @@ export var ColorPicker = React.forwardRef(function (directProps, target) {
|
|
|
190
192
|
}, [isValueControlled, onChange]);
|
|
191
193
|
var onPaletteChangeHandler = React.useCallback(function (event) { return onChangeHandler(event, true); }, [isControlled, onChangeHandler]);
|
|
192
194
|
var dir = useDir(focusableElementRef, props.dir);
|
|
193
|
-
var
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
React.createElement("span", { className: 'k-
|
|
209
|
-
|
|
210
|
-
|
|
195
|
+
var isValid = valid !== false;
|
|
196
|
+
return (React.createElement("span", { id: props.id, "aria-labelledby": props.ariaLabelledBy, "aria-describedby": props.ariaDescribedBy, className: classNames('k-colorpicker', 'k-picker', 'k-icon-picker', (_a = {},
|
|
197
|
+
_a["k-picker-" + (kendoThemeMaps.sizeMap[size] || size)] = size,
|
|
198
|
+
_a["k-picker-" + fillMode] = fillMode,
|
|
199
|
+
_a["k-rounded-" + (kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
|
|
200
|
+
_a['k-valid'] = isValid,
|
|
201
|
+
_a['k-invalid'] = !isValid,
|
|
202
|
+
_a['k-disabled'] = disabled,
|
|
203
|
+
_a['k-focus'] = focused,
|
|
204
|
+
_a)), ref: focusableElementRef, tabIndex: getTabIndex(tabIndex, disabled), title: props.title, onKeyDown: onKeyDownHandler, onFocus: onFocusHandler, onBlur: onBlurHandler, dir: dir },
|
|
205
|
+
React.createElement(Picker, { dir: dir, open: open, onOpen: onOpenHandler, popupAnchor: focusableElementRef.current || undefined, popupSettings: __assign({}, popupSettings), input: (React.createElement("span", { onClick: onActiveColorClickHandler, className: 'k-input-inner' },
|
|
206
|
+
React.createElement("span", { className: classNames('k-value-icon', 'k-color-preview', {
|
|
207
|
+
'k-no-color': !value,
|
|
208
|
+
'k-icon-color-preview': (icon || iconClassName)
|
|
209
|
+
}) },
|
|
210
|
+
(iconClassName || icon) && React.createElement("span", { className: classNames('k-color-preview-icon', iconClassName, (_b = {},
|
|
211
|
+
_b["k-icon k-i-" + icon] = (icon && !iconClassName),
|
|
212
|
+
_b)) }),
|
|
213
|
+
React.createElement("span", { className: "k-color-preview-mask", style: { backgroundColor: value } })))), button: (React.createElement(Button, { type: "button", onClick: onClickHandler, className: "k-input-button", icon: 'arrow-s' })), content: (React.createElement(React.Fragment, null,
|
|
214
|
+
(view === 'combo' || view === 'gradient') && (React.createElement(ColorGradient, __assign({}, gradientSettings, { tabIndex: 0, ref: gradientRef, value: value, onChange: onChangeHandler }))),
|
|
215
|
+
(view === 'combo' || view === 'palette') && (React.createElement(ColorPalette, __assign({}, paletteSettings, { ref: paletteRef, value: value, onChange: onPaletteChangeHandler }))))) })));
|
|
211
216
|
});
|
|
212
217
|
ColorPicker.propTypes = {
|
|
213
218
|
value: PropTypes.string,
|
|
@@ -217,11 +222,18 @@ ColorPicker.propTypes = {
|
|
|
217
222
|
dir: PropTypes.string,
|
|
218
223
|
id: PropTypes.string,
|
|
219
224
|
ariaLabelledBy: PropTypes.string,
|
|
220
|
-
ariaDescribedBy: PropTypes.string
|
|
225
|
+
ariaDescribedBy: PropTypes.string,
|
|
226
|
+
size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
227
|
+
rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
|
|
228
|
+
fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline'])
|
|
221
229
|
};
|
|
222
|
-
|
|
230
|
+
var defaultProps = {
|
|
231
|
+
size: 'medium',
|
|
232
|
+
rounded: 'medium',
|
|
233
|
+
fillMode: 'solid',
|
|
223
234
|
view: 'palette',
|
|
224
235
|
gradientSettings: DEFAULT_GRADIENT_SETTINGS,
|
|
225
236
|
paletteSettings: DEFAULT_PALETTE_SETTINGS
|
|
226
237
|
};
|
|
238
|
+
ColorPicker.defaultProps = defaultProps;
|
|
227
239
|
ColorPicker.displayName = 'KendoColorPicker';
|
|
@@ -64,14 +64,14 @@ export var FlatColorPicker = React.forwardRef(function (props, ref) {
|
|
|
64
64
|
React.createElement("div", { className: "k-coloreditor-header k-hstack" },
|
|
65
65
|
React.createElement("div", { className: "k-coloreditor-header-actions k-hstack" },
|
|
66
66
|
React.createElement(ButtonGroup, null,
|
|
67
|
-
React.createElement(Button, { type: "button", togglable: true,
|
|
67
|
+
React.createElement(Button, { type: "button", togglable: true, fillMode: 'flat', selected: colorGradientView, onClick: function () { return handleViewChange('ColorGradient'); } },
|
|
68
68
|
React.createElement("span", { className: "k-icon k-i-color-canvas" })),
|
|
69
|
-
React.createElement(Button, { type: "button", togglable: true,
|
|
69
|
+
React.createElement(Button, { type: "button", togglable: true, fillMode: 'flat', selected: !colorGradientView, onClick: function () { return handleViewChange('ColorPalette'); } },
|
|
70
70
|
React.createElement("span", { className: "k-icon k-i-palette" })))),
|
|
71
71
|
React.createElement("div", { className: "k-spacer" }),
|
|
72
72
|
React.createElement("div", { className: "k-coloreditor-header-actions k-hstack" },
|
|
73
73
|
(props.showClearButton && defaultProps.showClearButton) &&
|
|
74
|
-
React.createElement(Button, { type: "button",
|
|
74
|
+
React.createElement(Button, { type: "button", fillMode: 'flat', onClick: handleResetColor },
|
|
75
75
|
React.createElement("span", { className: "k-icon k-i-reset-color" })),
|
|
76
76
|
(props.showPreview && defaultProps.showPreview) &&
|
|
77
77
|
React.createElement("div", { className: "k-coloreditor-preview k-vstack" },
|
|
@@ -14,6 +14,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
import * as React from 'react';
|
|
15
15
|
import { parseColor } from './utils/color-parser';
|
|
16
16
|
import { isPresent } from './utils/misc';
|
|
17
|
+
import { Input } from '../input/Input';
|
|
17
18
|
/**
|
|
18
19
|
* @hidden
|
|
19
20
|
*/
|
|
@@ -38,7 +39,7 @@ var HexInput = /** @class */ (function (_super) {
|
|
|
38
39
|
return _this;
|
|
39
40
|
}
|
|
40
41
|
HexInput.prototype.render = function () {
|
|
41
|
-
return (React.createElement(
|
|
42
|
+
return (React.createElement(Input, { value: this.state.hex, onChange: this.onChange, onBlur: this.onBlur, disabled: this.props.disabled }));
|
|
42
43
|
};
|
|
43
44
|
HexInput.getDerivedStateFromProps = function (props, state) {
|
|
44
45
|
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/es/input/Input.js
CHANGED
|
@@ -199,7 +199,7 @@ var InputWithoutContext = /** @class */ (function (_super) {
|
|
|
199
199
|
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"]);
|
|
200
200
|
var inputId = id || this._inputId;
|
|
201
201
|
var isValid = !this.validityStyles || this.validity.valid;
|
|
202
|
-
var inputClassName = classNames(className, 'k-
|
|
202
|
+
var inputClassName = classNames(className, 'k-input k-input-md k-rounded-md k-input-solid');
|
|
203
203
|
var textbox = (React.createElement("input", __assign({ "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy }, props, { style: !label
|
|
204
204
|
? style
|
|
205
205
|
: 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
|
|
@@ -26,7 +26,7 @@ import * as React from 'react';
|
|
|
26
26
|
import * as PropTypes from 'prop-types';
|
|
27
27
|
import { MaskingService } from './masking.service';
|
|
28
28
|
import { defaultRules, maskingChanged, returnFalse } from './utils';
|
|
29
|
-
import { guid, classNames, getTabIndex, withPropsContext, createPropsContext } from '@progress/kendo-react-common';
|
|
29
|
+
import { guid, classNames, getTabIndex, withPropsContext, createPropsContext, kendoThemeMaps } from '@progress/kendo-react-common';
|
|
30
30
|
import { FloatingLabel } from '@progress/kendo-react-labels';
|
|
31
31
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
32
32
|
import { packageMetadata } from '../package-metadata';
|
|
@@ -278,16 +278,22 @@ var MaskedTextBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
278
278
|
*/
|
|
279
279
|
MaskedTextBoxWithoutContext.prototype.render = function () {
|
|
280
280
|
var _this = this;
|
|
281
|
+
var _a;
|
|
282
|
+
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;
|
|
281
283
|
var inputId = this.props.id || this._inputId;
|
|
282
284
|
var isValid = !this.validityStyles || this.validity.valid;
|
|
283
285
|
var style = this.props.style || {};
|
|
284
|
-
var component = (React.createElement("span", { dir: this.props.dir, className: classNames('k-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
286
|
+
var component = (React.createElement("span", { dir: this.props.dir, className: classNames('k-maskedtextbox k-input', (_a = {},
|
|
287
|
+
_a["k-input-" + (kendoThemeMaps.sizeMap[size] || size)] = size,
|
|
288
|
+
_a["k-input-" + fillMode] = fillMode,
|
|
289
|
+
_a["k-rounded-" + (kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
|
|
290
|
+
_a['k-valid'] = isValid,
|
|
291
|
+
_a['k-invalid'] = !isValid,
|
|
292
|
+
_a['k-required'] = this.required,
|
|
293
|
+
_a['k-disabled'] = this.props.disabled,
|
|
294
|
+
_a), this.props.className), style: !this.props.label
|
|
289
295
|
? __assign({ width: this.props.width }, style) : style },
|
|
290
|
-
React.createElement("input", { type: "text", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: false, className: "k-
|
|
296
|
+
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: 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: returnFalse, onDrop: returnFalse })));
|
|
291
297
|
return this.props.label
|
|
292
298
|
? (React.createElement(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 }))
|
|
293
299
|
: component;
|
|
@@ -376,7 +382,10 @@ var MaskedTextBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
376
382
|
required: PropTypes.bool,
|
|
377
383
|
valid: PropTypes.bool,
|
|
378
384
|
validityStyles: PropTypes.bool,
|
|
379
|
-
onChange: PropTypes.func
|
|
385
|
+
onChange: PropTypes.func,
|
|
386
|
+
size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
387
|
+
rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
|
|
388
|
+
fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline'])
|
|
380
389
|
};
|
|
381
390
|
/**
|
|
382
391
|
* @hidden
|
|
@@ -388,7 +397,10 @@ var MaskedTextBoxWithoutContext = /** @class */ (function (_super) {
|
|
|
388
397
|
maskValidation: true,
|
|
389
398
|
rules: defaultRules,
|
|
390
399
|
required: false,
|
|
391
|
-
validityStyles: true
|
|
400
|
+
validityStyles: true,
|
|
401
|
+
size: 'medium',
|
|
402
|
+
rounded: 'medium',
|
|
403
|
+
fillMode: 'solid'
|
|
392
404
|
};
|
|
393
405
|
return MaskedTextBoxWithoutContext;
|
|
394
406
|
}(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
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as PropTypes from 'prop-types';
|
|
3
3
|
import { useInternationalization, useLocalization } from '@progress/kendo-react-intl';
|
|
4
|
-
import { classNames, guid, getTabIndex, dispatchEvent, createPropsContext, usePropsContext } from '@progress/kendo-react-common';
|
|
4
|
+
import { classNames, guid, getTabIndex, dispatchEvent, createPropsContext, usePropsContext, kendoThemeMaps } from '@progress/kendo-react-common';
|
|
5
5
|
import { FloatingLabel } from '@progress/kendo-react-labels';
|
|
6
6
|
import { validatePackage } from '@progress/kendo-react-common';
|
|
7
7
|
import { packageMetadata } from '../package-metadata';
|
|
8
8
|
import { numericIncreaseValue, messages, numericDecreaseValue } from '../messages';
|
|
9
9
|
import { formatValue, sanitizeNumber, rangeValue, increaseValue, decreaseValue, getStateOrPropsValue, getInitialState } from './utils';
|
|
10
|
+
import { Button } from '@progress/kendo-react-buttons';
|
|
10
11
|
var VALIDATION_MESSAGE = 'Please enter a valid value!';
|
|
11
12
|
/**
|
|
12
13
|
* Represents the PropsContext of the `NumericTextBox` component.
|
|
@@ -19,6 +20,7 @@ export var NumericTextBoxPropsContext = createPropsContext();
|
|
|
19
20
|
* Represents the [KendoReact NumericTextBox component]({% slug overview_numerictextbox %}).
|
|
20
21
|
*/
|
|
21
22
|
export var NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
23
|
+
var _a;
|
|
22
24
|
validatePackage(packageMetadata);
|
|
23
25
|
var props = usePropsContext(NumericTextBoxPropsContext, directProps);
|
|
24
26
|
var calculatedId = React.useMemo(function () { return guid(); }, []);
|
|
@@ -26,9 +28,8 @@ export var NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
26
28
|
var intlService = useInternationalization();
|
|
27
29
|
var localizationService = useLocalization();
|
|
28
30
|
var elementRef = React.useRef(null);
|
|
29
|
-
var elementWrapperRef = React.useRef(null);
|
|
30
31
|
var valueDuringChangeRef = React.useRef();
|
|
31
|
-
var
|
|
32
|
+
var _b = React.useState(false), forceUpdate = _b[0], setForceUpdate = _b[1];
|
|
32
33
|
var stateRef = React.useRef(getInitialState());
|
|
33
34
|
var isPasteRef = React.useRef(false);
|
|
34
35
|
var prevLooseValueRef = React.useRef();
|
|
@@ -123,13 +124,6 @@ export var NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
123
124
|
newState.eventValue = rangedValue;
|
|
124
125
|
stateValueRef.current = rangedValue;
|
|
125
126
|
}
|
|
126
|
-
if (newState.valueIsCorrected) {
|
|
127
|
-
var wrapper_1 = elementWrapperRef.current;
|
|
128
|
-
if (wrapper_1 && wrapper_1.className.indexOf('k-state-invalid') === -1) {
|
|
129
|
-
wrapper_1.className += ' k-state-invalid';
|
|
130
|
-
window.setTimeout(function () { return wrapper_1.className = wrapper_1.className.replace(' k-state-invalid', ''); }, 50);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
127
|
var shouldFireEvent = props.value !== newState.eventValue;
|
|
134
128
|
if (shouldFireEvent) {
|
|
135
129
|
dispatchEvent(props.onChange, event, getImperativeHandle(), { value: newState.eventValue });
|
|
@@ -256,24 +250,21 @@ export var NumericTextBox = React.forwardRef(function (directProps, target) {
|
|
|
256
250
|
var isValid = !validityStylesGetter() || validityGetter().valid;
|
|
257
251
|
var numerictextbox = (React.createElement("span", { dir: props.dir, style: !props.label
|
|
258
252
|
? { width: props.width }
|
|
259
|
-
: undefined, className: 'k-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
props.
|
|
267
|
-
props.
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
.toLanguageString(numericDecreaseValue, messages[numericDecreaseValue]), title: localizationService
|
|
275
|
-
.toLanguageString(numericDecreaseValue, messages[numericDecreaseValue]), onClick: onDecrease },
|
|
276
|
-
React.createElement("span", { className: "k-icon k-i-arrow-s" })))))));
|
|
253
|
+
: undefined, className: classNames('k-input', 'k-numerictextbox', (_a = {},
|
|
254
|
+
_a["k-input-" + (kendoThemeMaps.sizeMap[props.size] || props.size)] = props.size,
|
|
255
|
+
_a["k-input-" + props.fillMode] = props.fillMode,
|
|
256
|
+
_a["k-rounded-" + (kendoThemeMaps.roundedMap[props.rounded] || props.rounded)] = props.rounded,
|
|
257
|
+
_a['k-valid'] = isValid,
|
|
258
|
+
_a['k-invalid'] = !isValid,
|
|
259
|
+
_a['k-required'] = props.required,
|
|
260
|
+
_a['k-disabled'] = props.disabled,
|
|
261
|
+
_a), props.className), "aria-disabled": props.disabled ? 'true' : undefined },
|
|
262
|
+
React.createElement("input", { value: looseValue === null ? '' : looseValue, tabIndex: 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 }),
|
|
263
|
+
props.children,
|
|
264
|
+
props.spinners &&
|
|
265
|
+
(React.createElement("span", { className: "k-input-spinner k-spin-button", onMouseDown: onMouseDown },
|
|
266
|
+
React.createElement(Button, { type: "button", icon: 'arrow-n', className: "k-spinner-increase", "aria-label": localizationService.toLanguageString(numericIncreaseValue, messages[numericIncreaseValue]), title: localizationService.toLanguageString(numericIncreaseValue, messages[numericIncreaseValue]), onClick: onIncrease }),
|
|
267
|
+
React.createElement(Button, { type: "button", className: "k-spinner-decrease", icon: 'arrow-s', "aria-label": localizationService.toLanguageString(numericDecreaseValue, messages[numericDecreaseValue]), title: localizationService.toLanguageString(numericDecreaseValue, messages[numericDecreaseValue]), onClick: onDecrease })))));
|
|
277
268
|
return props.label
|
|
278
269
|
? (React.createElement(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 }))
|
|
279
270
|
: numerictextbox;
|
|
@@ -318,7 +309,10 @@ NumericTextBox.propTypes = {
|
|
|
318
309
|
ariaDescribedBy: PropTypes.string,
|
|
319
310
|
onChange: PropTypes.func,
|
|
320
311
|
onFocus: PropTypes.func,
|
|
321
|
-
onBlur: PropTypes.func
|
|
312
|
+
onBlur: PropTypes.func,
|
|
313
|
+
size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
314
|
+
rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
|
|
315
|
+
fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline'])
|
|
322
316
|
};
|
|
323
317
|
NumericTextBox.displayName = 'KendoNumericTextBox';
|
|
324
318
|
NumericTextBox.defaultProps = {
|
|
@@ -330,5 +324,8 @@ NumericTextBox.defaultProps = {
|
|
|
330
324
|
rangeOnEnter: true,
|
|
331
325
|
onChange: function (_) { return; },
|
|
332
326
|
onFocus: function (_) { return; },
|
|
333
|
-
onBlur: function (_) { return; }
|
|
327
|
+
onBlur: function (_) { return; },
|
|
328
|
+
size: 'medium',
|
|
329
|
+
rounded: 'medium',
|
|
330
|
+
fillMode: 'solid'
|
|
334
331
|
};
|
|
@@ -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 {};
|