@progress/kendo-react-inputs 13.3.0-develop.9 → 13.4.0-develop.1
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/checkbox/Checkbox.d.ts +49 -0
- package/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +35 -36
- package/checkbox/interfaces/CheckboxBlurEvent.d.ts +14 -0
- package/checkbox/interfaces/CheckboxChangeEvent.d.ts +18 -0
- package/checkbox/interfaces/CheckboxFocusEvent.d.ts +14 -0
- package/checkbox/interfaces/CheckboxProps.d.ts +148 -0
- package/colors/ColorContrastLabels.d.ts +22 -0
- package/colors/ColorContrastSvg.d.ts +25 -0
- package/colors/ColorGradient.d.ts +215 -0
- package/colors/ColorGradient.js +1 -1
- package/colors/ColorGradient.mjs +20 -19
- package/colors/ColorInput.d.ts +40 -0
- package/colors/ColorInput.js +1 -1
- package/colors/ColorInput.mjs +20 -16
- package/colors/ColorPalette.d.ts +129 -0
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +7 -7
- package/colors/ColorPicker.d.ts +34 -0
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +96 -94
- package/colors/FlatColorPicker.d.ts +189 -0
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +41 -40
- package/colors/HexInput.d.ts +39 -0
- package/colors/HexInput.js +1 -1
- package/colors/HexInput.mjs +2 -1
- package/colors/Picker.d.ts +13 -0
- package/colors/interfaces/ColorGradientChangeEvent.d.ts +18 -0
- package/colors/interfaces/ColorGradientProps.d.ts +160 -0
- package/colors/interfaces/ColorPaletteChangeEvent.d.ts +22 -0
- package/colors/interfaces/ColorPaletteProps.d.ts +116 -0
- package/colors/interfaces/ColorPickerActiveColorClick.d.ts +29 -0
- package/colors/interfaces/ColorPickerBlurEvent.d.ts +20 -0
- package/colors/interfaces/ColorPickerChangeEvent.d.ts +29 -0
- package/colors/interfaces/ColorPickerFocusEvent.d.ts +20 -0
- package/colors/interfaces/ColorPickerGradientSettings.d.ts +29 -0
- package/colors/interfaces/ColorPickerPaletteSettings.d.ts +39 -0
- package/colors/interfaces/ColorPickerPopupSettings.d.ts +21 -0
- package/colors/interfaces/ColorPickerProps.d.ts +242 -0
- package/colors/interfaces/ColorPickerView.d.ts +17 -0
- package/colors/interfaces/PickerPopupSettings.d.ts +29 -0
- package/colors/interfaces/PickerProps.d.ts +57 -0
- package/colors/models/hsva.d.ts +16 -0
- package/colors/models/output-format.d.ts +11 -0
- package/colors/models/palette-presets.d.ts +60 -0
- package/colors/models/rgb.d.ts +15 -0
- package/colors/models/rgba.d.ts +16 -0
- package/colors/models/table-cell.d.ts +14 -0
- package/colors/models/tile-size.d.ts +18 -0
- package/colors/utils/color-cache.d.ts +37 -0
- package/colors/utils/color-palette.service.d.ts +19 -0
- package/colors/utils/color-parser.d.ts +72 -0
- package/colors/utils/color-parser.js +1 -1
- package/colors/utils/color-parser.mjs +1 -1
- package/colors/utils/misc.d.ts +23 -0
- package/colors/utils/svg-calc.d.ts +69 -0
- package/common/AdaptiveMode.d.ts +21 -0
- package/common/SliderTooltip.d.ts +25 -0
- package/common/SwitchController.d.ts +38 -0
- package/common/SwitchModel.d.ts +14 -0
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +72 -5128
- package/index.d.ts +72 -5128
- package/input/Input.d.ts +119 -0
- package/input/Input.js +1 -1
- package/input/Input.mjs +45 -43
- package/input/InputClearValue.d.ts +28 -0
- package/input/InputPrefix.d.ts +30 -0
- package/input/InputSeparator.d.ts +30 -0
- package/input/InputSuffix.d.ts +32 -0
- package/input/InputValidationIcon.d.ts +21 -0
- package/input/interfaces/InputChangeEvent.d.ts +18 -0
- package/interfaces/Direction.d.ts +8 -0
- package/interfaces/ToggleBaseProps.d.ts +24 -0
- package/maskedtextbox/MaskedTextBox.d.ts +224 -0
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +80 -79
- package/maskedtextbox/MaskedTextBoxProps.d.ts +273 -0
- package/maskedtextbox/masking.service.d.ts +48 -0
- package/maskedtextbox/masking.service.mjs +9 -9
- package/maskedtextbox/parsing/combinators.d.ts +16 -0
- package/maskedtextbox/parsing/parsers.d.ts +54 -0
- package/maskedtextbox/parsing/result.d.ts +30 -0
- package/maskedtextbox/parsing/stream.d.ts +29 -0
- package/maskedtextbox/utils.d.ts +23 -0
- package/messages/index.d.ts +177 -0
- package/numerictextbox/NumericTextBox.d.ts +21 -0
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +161 -161
- package/numerictextbox/interfaces/NumericTextBoxBlurEvent.d.ts +14 -0
- package/numerictextbox/interfaces/NumericTextBoxChangeEvent.d.ts +18 -0
- package/numerictextbox/interfaces/NumericTextBoxFocusEvent.d.ts +14 -0
- package/numerictextbox/interfaces/NumericTextBoxHandle.d.ts +46 -0
- package/numerictextbox/interfaces/NumericTextBoxProps.d.ts +212 -0
- package/numerictextbox/interfaces/NumericTextBoxState.d.ts +22 -0
- package/numerictextbox/utils/index.d.ts +126 -0
- package/package-metadata.d.ts +12 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +10 -16
- package/package.json +10 -10
- package/radiobutton/RadioButton.d.ts +36 -0
- package/radiobutton/RadioButton.js +1 -1
- package/radiobutton/RadioButton.mjs +8 -8
- package/radiobutton/RadioGroup.d.ts +36 -0
- package/radiobutton/interfaces/RadioButtonBlurEvent.d.ts +14 -0
- package/radiobutton/interfaces/RadioButtonChangeEvent.d.ts +18 -0
- package/radiobutton/interfaces/RadioButtonFocusEvent.d.ts +14 -0
- package/radiobutton/interfaces/RadioButtonProps.d.ts +107 -0
- package/radiobutton/interfaces/RadioGroupChangeEvent.d.ts +18 -0
- package/radiobutton/interfaces/RadioGroupFocusEvent.d.ts +14 -0
- package/radiobutton/interfaces/RadioGroupProps.d.ts +178 -0
- package/range-slider/RangeSlider.d.ts +152 -0
- package/range-slider/range-raducer.d.ts +46 -0
- package/rating/Rating.d.ts +302 -0
- package/rating/Rating.mjs +3 -3
- package/rating/RatingItem.d.ts +111 -0
- package/rating/models/index.d.ts +91 -0
- package/rating/rating-reducer.d.ts +39 -0
- package/rating/utils/index.d.ts +31 -0
- package/signature/Signature.d.ts +21 -0
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +26 -23
- package/signature/interfaces/SignatureBlurEvent.d.ts +14 -0
- package/signature/interfaces/SignatureChangeEvent.d.ts +18 -0
- package/signature/interfaces/SignatureCloseEvent.d.ts +14 -0
- package/signature/interfaces/SignatureFocusEvent.d.ts +14 -0
- package/signature/interfaces/SignatureHandle.d.ts +49 -0
- package/signature/interfaces/SignatureOpenEvent.d.ts +14 -0
- package/signature/interfaces/SignatureProps.d.ts +324 -0
- package/signature/interfaces/index.d.ts +14 -0
- package/signature/utils/index.d.ts +11 -0
- package/slider/Slider.d.ts +288 -0
- package/slider/Slider.mjs +9 -9
- package/slider/SliderLabel.d.ts +51 -0
- package/switch/Switch.d.ts +397 -0
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +29 -22
- package/textarea/TextArea.d.ts +40 -0
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +41 -41
- package/textarea/interfaces/TextAreaBlurEvent.d.ts +14 -0
- package/textarea/interfaces/TextAreaChangeEvent.d.ts +18 -0
- package/textarea/interfaces/TextAreaFocusEvent.d.ts +14 -0
- package/textarea/interfaces/TextAreaProps.d.ts +199 -0
- package/textbox/Textbox.d.ts +99 -0
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +70 -66
- package/utils.d.ts +11 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { default as PropTypes } from 'prop-types';
|
|
9
|
+
import { MaskedTextBoxProps } from './MaskedTextBoxProps.js';
|
|
10
|
+
import { FormComponent, FormComponentValidity } from '@progress/kendo-react-common';
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
interface MaskedTextBoxState {
|
|
16
|
+
focused?: boolean;
|
|
17
|
+
value?: string;
|
|
18
|
+
}
|
|
19
|
+
/** @hidden */
|
|
20
|
+
export declare class MaskedTextBoxWithoutContext extends React.Component<MaskedTextBoxProps, MaskedTextBoxState> implements FormComponent {
|
|
21
|
+
static displayName: string;
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
static propTypes: {
|
|
26
|
+
value: PropTypes.Requireable<string>;
|
|
27
|
+
defaultValue: PropTypes.Requireable<string>;
|
|
28
|
+
placeholder: PropTypes.Requireable<string>;
|
|
29
|
+
title: PropTypes.Requireable<string>;
|
|
30
|
+
dir: PropTypes.Requireable<string>;
|
|
31
|
+
id: PropTypes.Requireable<string>;
|
|
32
|
+
style: PropTypes.Requireable<object>;
|
|
33
|
+
className: PropTypes.Requireable<string>;
|
|
34
|
+
prefix: PropTypes.Requireable<any>;
|
|
35
|
+
suffix: PropTypes.Requireable<any>;
|
|
36
|
+
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
37
|
+
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
38
|
+
width: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
39
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
40
|
+
accessKey: PropTypes.Requireable<string>;
|
|
41
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
42
|
+
readonly: PropTypes.Requireable<boolean>;
|
|
43
|
+
prompt: PropTypes.Requireable<string>;
|
|
44
|
+
promptPlaceholder: PropTypes.Requireable<string>;
|
|
45
|
+
includeLiterals: PropTypes.Requireable<boolean>;
|
|
46
|
+
maskValidation: PropTypes.Requireable<boolean>;
|
|
47
|
+
mask: PropTypes.Requireable<string>;
|
|
48
|
+
rules: (props: MaskedTextBoxProps, propName: string, componentName: string) => Error | null;
|
|
49
|
+
selection: PropTypes.Requireable<PropTypes.InferProps<{
|
|
50
|
+
start: PropTypes.Validator<number>;
|
|
51
|
+
end: PropTypes.Validator<number>;
|
|
52
|
+
}>>;
|
|
53
|
+
name: PropTypes.Requireable<string>;
|
|
54
|
+
label: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
55
|
+
validationMessage: PropTypes.Requireable<string>;
|
|
56
|
+
required: PropTypes.Requireable<boolean>;
|
|
57
|
+
valid: PropTypes.Requireable<boolean>;
|
|
58
|
+
validityStyles: PropTypes.Requireable<boolean>;
|
|
59
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
60
|
+
size: PropTypes.Requireable<"small" | "medium" | "large" | undefined>;
|
|
61
|
+
rounded: PropTypes.Requireable<"small" | "medium" | "large" | "full" | undefined>;
|
|
62
|
+
fillMode: PropTypes.Requireable<"flat" | "solid" | "outline" | undefined>;
|
|
63
|
+
autoFocus: PropTypes.Requireable<boolean>;
|
|
64
|
+
inputAttributes: PropTypes.Requireable<object>;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* @hidden
|
|
68
|
+
*/
|
|
69
|
+
static defaultProps: {
|
|
70
|
+
prompt: string;
|
|
71
|
+
promptPlaceholder: string;
|
|
72
|
+
includeLiterals: boolean;
|
|
73
|
+
maskValidation: boolean;
|
|
74
|
+
rules: {
|
|
75
|
+
[key: string]: RegExp;
|
|
76
|
+
};
|
|
77
|
+
validityStyles: boolean;
|
|
78
|
+
prefix: (_: any) => null;
|
|
79
|
+
suffix: (_: any) => null;
|
|
80
|
+
size: undefined;
|
|
81
|
+
rounded: undefined;
|
|
82
|
+
fillMode: undefined;
|
|
83
|
+
autoFocus: boolean;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* @hidden
|
|
87
|
+
*/
|
|
88
|
+
state: MaskedTextBoxState;
|
|
89
|
+
private _inputId;
|
|
90
|
+
private _service;
|
|
91
|
+
private _isPasted;
|
|
92
|
+
private _selection;
|
|
93
|
+
private _input;
|
|
94
|
+
private _valueDuringOnChange?;
|
|
95
|
+
/**
|
|
96
|
+
* @hidden
|
|
97
|
+
*/
|
|
98
|
+
focus: () => void;
|
|
99
|
+
/**
|
|
100
|
+
* Gets the element of the MaskedTextBox.
|
|
101
|
+
*
|
|
102
|
+
* @return - An `HTMLInputElement`.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```jsx
|
|
106
|
+
* const App = () => {
|
|
107
|
+
* const [element, setElement] = React.useState(null);
|
|
108
|
+
*
|
|
109
|
+
* return (
|
|
110
|
+
* <div>
|
|
111
|
+
* <MaskedTextBox
|
|
112
|
+
* ref={(component) =>
|
|
113
|
+
* setElement(component ? component.element : null)}
|
|
114
|
+
* />
|
|
115
|
+
* <Button onClick={() => console.log(element)}>console.log the element</Button>
|
|
116
|
+
* </div>
|
|
117
|
+
* );
|
|
118
|
+
* }
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
get element(): HTMLInputElement | null;
|
|
122
|
+
/**
|
|
123
|
+
* Gets the value with the mask of the MaskedTextBox.
|
|
124
|
+
*/
|
|
125
|
+
get value(): string;
|
|
126
|
+
/**
|
|
127
|
+
* Gets the raw value without the mask of the MaskedTextBox.
|
|
128
|
+
*/
|
|
129
|
+
get rawValue(): string;
|
|
130
|
+
/**
|
|
131
|
+
* Represents the validity state into which the MaskedTextBox is set.
|
|
132
|
+
*/
|
|
133
|
+
get validity(): FormComponentValidity;
|
|
134
|
+
/**
|
|
135
|
+
* @hidden
|
|
136
|
+
*/
|
|
137
|
+
protected get validityStyles(): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* @hidden
|
|
140
|
+
*/
|
|
141
|
+
protected get required(): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Gets the `name` property of the MaskedTextBox.
|
|
144
|
+
*/
|
|
145
|
+
get name(): string | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* @hidden
|
|
148
|
+
*/
|
|
149
|
+
componentDidUpdate(prevProps: MaskedTextBoxProps, prevState: MaskedTextBoxState): void;
|
|
150
|
+
/**
|
|
151
|
+
* @hidden
|
|
152
|
+
*/
|
|
153
|
+
componentDidMount(): void;
|
|
154
|
+
/**
|
|
155
|
+
* @hidden
|
|
156
|
+
*/
|
|
157
|
+
render(): React.JSX.Element;
|
|
158
|
+
private pasteHandler;
|
|
159
|
+
private onChangeHandler;
|
|
160
|
+
private focusHandler;
|
|
161
|
+
private blurHandler;
|
|
162
|
+
private triggerOnChange;
|
|
163
|
+
private updateService;
|
|
164
|
+
private get rules();
|
|
165
|
+
private setValidity;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Represents the PropsContext of the `MaskedTextBox` component.
|
|
169
|
+
* Used for global configuration of all `MaskedTextBox` instances.
|
|
170
|
+
*
|
|
171
|
+
* For more information, refer to the [Inputs Props Context](https://www.telerik.com/kendo-react-ui/components/inputs/props-context) article.
|
|
172
|
+
*/
|
|
173
|
+
export declare const MaskedTextBoxPropsContext: React.Context<(p: MaskedTextBoxProps) => MaskedTextBoxProps>;
|
|
174
|
+
/**
|
|
175
|
+
* Represent the `ref` of the MaskedTextBox component.
|
|
176
|
+
*/
|
|
177
|
+
export interface MaskedTextBoxHandle extends Pick<MaskedTextBoxWithoutContext, keyof MaskedTextBoxWithoutContext> {
|
|
178
|
+
/**
|
|
179
|
+
* Gets the element of the MaskedTextBox.
|
|
180
|
+
*
|
|
181
|
+
* ```jsx
|
|
182
|
+
* const App = () => {
|
|
183
|
+
* const [element, setElement] = React.useState(null);
|
|
184
|
+
*
|
|
185
|
+
* return (
|
|
186
|
+
* <div>
|
|
187
|
+
* <MaskedTextBox
|
|
188
|
+
* ref={(component) =>
|
|
189
|
+
* setElement(component ? component.element : null)}
|
|
190
|
+
* />
|
|
191
|
+
* <Button onClick={() => console.log(element)}>console.log the element</Button>
|
|
192
|
+
* </div>
|
|
193
|
+
* );
|
|
194
|
+
* }
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
element: HTMLInputElement | null;
|
|
198
|
+
/**
|
|
199
|
+
* Gets the `name` property of the MaskedTextBox.
|
|
200
|
+
*/
|
|
201
|
+
name: string | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* Gets the raw value without the mask of the MaskedTextBox.
|
|
204
|
+
*/
|
|
205
|
+
rawValue: string;
|
|
206
|
+
/**
|
|
207
|
+
* Represents the validity state into which the MaskedTextBox is set.
|
|
208
|
+
*/
|
|
209
|
+
validity: FormComponentValidity;
|
|
210
|
+
/**
|
|
211
|
+
* Gets the value with the mask of the MaskedTextBox.
|
|
212
|
+
*/
|
|
213
|
+
value: string;
|
|
214
|
+
}
|
|
215
|
+
/** @hidden */
|
|
216
|
+
export type MaskedTextBox = MaskedTextBoxHandle;
|
|
217
|
+
/**
|
|
218
|
+
* Represents the props of the [KendoReact MaskedTextBox component](https://www.telerik.com/kendo-react-ui/components/inputs/maskedtextbox).
|
|
219
|
+
*
|
|
220
|
+
* Accepts properties of type [MaskedTextBoxProps](https://www.telerik.com/kendo-react-ui/components/inputs/api/maskedtextboxprops).
|
|
221
|
+
* Obtaining the `ref` returns an object of type [MaskedTextBoxHandle](https://www.telerik.com/kendo-react-ui/components/inputs/api/maskedtextboxhandle).
|
|
222
|
+
*/
|
|
223
|
+
export declare const MaskedTextBox: React.ForwardRefExoticComponent<MaskedTextBoxProps & React.RefAttributes<any>>;
|
|
224
|
+
export {};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),e=require("prop-types"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),e=require("prop-types"),M=require("./masking.service.js"),h=require("./utils.js"),n=require("@progress/kendo-react-common"),E=require("@progress/kendo-react-labels");function V(u){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const s in u)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(u,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>u[s]})}}return t.default=u,Object.freeze(t)}const p=V(O),l=class l extends p.Component{constructor(){super(...arguments),this.state={},this._inputId=`k_${this.props.id}`,this._service=new M.MaskingService,this._isPasted=!1,this._selection=[null,null],this._input=null,this.focus=()=>{this._input&&this._input.focus()},this.pasteHandler=t=>{const{selectionStart:s,selectionEnd:i}=t.target;i!==s&&(this._isPasted=!0,this._selection=[s||0,i||0])},this.onChangeHandler=t=>{const s=t.currentTarget,i=s.value,a=this._selection[0]||0,o=this._selection[1]||0;if(!this.props.mask){this._isPasted=!1,this._selection=[null,null],this.triggerOnChange(i,t);return}const r=this.value;let d;if(this._isPasted){this._isPasted=!1;const c=r.length-o,v=i.length-c;d=this._service.maskInRange(i.slice(a,v),r,a,o)}else d=this._service.maskInput(i,r,s.selectionStart||0);this._selection=[d.selection,d.selection],this.triggerOnChange(d.value,t)},this.focusHandler=t=>{this.state.focused||(this.setState({focused:!0}),this.props.onFocus&&this.props.onFocus.call(void 0,{target:this,syntheticEvent:t,nativeEvent:t.nativeEvent}))},this.blurHandler=t=>{this.state.focused&&(this.setState({focused:!1}),this.props.onBlur&&this.props.onBlur.call(void 0,{target:this,syntheticEvent:t,nativeEvent:t.nativeEvent}))},this.setValidity=()=>{this.element&&this.element.setCustomValidity(this.validity.valid?"":this.props.validationMessage||"")}}get element(){return this._input}get value(){return this._valueDuringOnChange!==void 0?this._valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value!==void 0?this.state.value:this.props.defaultValue!==void 0?this.props.defaultValue:""}get rawValue(){return this._service.rawValue(this.value)}get validity(){const t=this.value,s=this._service.validationValue(t),i=this.props.validationMessage!==void 0,a=this.props.valid!==void 0?this.props.valid:(!this.required||!!s)&&(!this.props.maskValidation||!this.props.prompt||t.indexOf(this.props.prompt)===-1);return{customError:i,valid:a,valueMissing:!s}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:l.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get name(){return this.props.name}componentDidUpdate(t,s){if(this.element&&this.state.focused&&s.focused){let[i,a]=this._selection;const o=t.selection,r=this.props.selection;(!o&&r||o&&r&&(o.start!==r.start||o.end!==r.end))&&(i=r.start,a=r.end),i!==null&&a!==null&&this.element.setSelectionRange(i,a)}h.maskingChanged(t,this.props)&&this.updateService(),this.setValidity()}componentDidMount(){this.updateService(),this.setValidity()}render(){const{size:t=l.defaultProps.size,fillMode:s=l.defaultProps.fillMode,rounded:i=l.defaultProps.rounded,autoFocus:a=l.defaultProps.autoFocus,prefix:o=l.defaultProps.prefix,suffix:r=l.defaultProps.suffix,inputAttributes:d,unstyled:c,className:v}=this.props,g=this.props.id||this._inputId,m=!this.validityStyles||this.validity.valid,b=this.props.style||{},C=c&&c.uMaskedTextBox,[_]=n.useCustomComponent(o),[P]=n.useCustomComponent(r),y=p.createElement("span",{dir:this.props.dir,className:n.classNames("k-input","k-maskedtextbox",{[`k-input-${n.kendoThemeMaps.sizeMap[t]||t}`]:t,[`k-input-${s}`]:s,[`k-rounded-${n.kendoThemeMaps.roundedMap[i]||i}`]:i,"k-invalid":!m,"k-disabled":this.props.disabled},v),style:this.props.label?b:{width:this.props.width,...b}},p.createElement(_,null),p.createElement("input",{type:"text",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",autoFocus:a,spellCheck:!1,className:n.classNames(n.uMaskedTextBox.inputInner({c:C})),value:this.value,id:g,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-placeholder":this.props.mask,"aria-required":this.props.required,name:this.props.name,tabIndex:n.getTabIndex(this.props.tabIndex,this.props.disabled,!0),accessKey:this.props.accessKey,title:this.props.title,disabled:this.props.disabled||void 0,readOnly:this.props.readonly||void 0,placeholder:this.props.placeholder,ref:S=>{this._input=S},onChange:this.onChangeHandler,onPaste:this.pasteHandler,onFocus:this.focusHandler,onBlur:this.blurHandler,onDragStart:h.returnFalse,onDrop:h.returnFalse,...d}),p.createElement(P,null));return this.props.label?p.createElement(E.FloatingLabel,{label:this.props.label,editorId:g,editorValue:this.value,editorValid:m,editorDisabled:this.props.disabled,editorPlaceholder:this.props.placeholder,children:y,style:{width:this.props.width},dir:this.props.dir}):y}triggerOnChange(t,s){if(this.setState({value:t}),this.props.onChange){this._valueDuringOnChange=t;const i={syntheticEvent:s,nativeEvent:s.nativeEvent,selectionStart:this._selection[0],selectionEnd:this._selection[1],target:this,value:this.value};this.props.onChange.call(void 0,i),this._valueDuringOnChange=void 0}}updateService(t){const s=Object.assign({includeLiterals:this.props.includeLiterals,mask:this.props.mask,prompt:this.props.prompt,promptPlaceholder:this.props.promptPlaceholder,rules:this.rules},t);this._service.update(s)}get rules(){return Object.assign({},h.defaultRules,this.props.rules)}};l.displayName="MaskedTextBox",l.propTypes={value:e.string,defaultValue:e.string,placeholder:e.string,title:e.string,dir:e.string,id:e.string,style:e.object,className:e.string,prefix:e.any,suffix:e.any,ariaLabelledBy:e.string,ariaDescribedBy:e.string,width:e.oneOfType([e.string,e.number]),tabIndex:e.number,accessKey:e.string,disabled:e.bool,readonly:e.bool,prompt:e.string,promptPlaceholder:e.string,includeLiterals:e.bool,maskValidation:e.bool,mask:e.string,rules:function(t,s,i){const a=t.rules;return a!==void 0&&!Object.entries(a).some(r=>typeof r!="string"||!(a[r]instanceof RegExp))?new Error("Invalid prop `"+s+"` supplied to `"+i+"`. Validation failed."):null},selection:e.shape({start:e.number.isRequired,end:e.number.isRequired}),name:e.string,label:e.node,validationMessage:e.string,required:e.bool,valid:e.bool,validityStyles:e.bool,onChange:e.func,size:e.oneOf(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","full"]),fillMode:e.oneOf(["solid","flat","outline"]),autoFocus:e.bool,inputAttributes:e.object},l.defaultProps={prompt:"_",promptPlaceholder:" ",includeLiterals:!1,maskValidation:!0,rules:h.defaultRules,validityStyles:!0,prefix:t=>null,suffix:t=>null,size:void 0,rounded:void 0,fillMode:void 0,autoFocus:!1};let f=l;const k=n.createPropsContext(),x=n.withIdHOC(n.withPropsContext(k,n.withUnstyledHOC(f)));x.displayName="KendoReactMaskedTextBox";exports.MaskedTextBox=x;exports.MaskedTextBoxPropsContext=k;exports.MaskedTextBoxWithoutContext=f;
|
|
@@ -7,31 +7,31 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as p from "react";
|
|
9
9
|
import e from "prop-types";
|
|
10
|
-
import { MaskingService as
|
|
11
|
-
import { defaultRules as
|
|
12
|
-
import {
|
|
13
|
-
import { FloatingLabel as
|
|
14
|
-
const
|
|
10
|
+
import { MaskingService as E } from "./masking.service.mjs";
|
|
11
|
+
import { defaultRules as g, maskingChanged as O, returnFalse as y } from "./utils.mjs";
|
|
12
|
+
import { withIdHOC as V, withPropsContext as M, createPropsContext as I, withUnstyledHOC as w, useCustomComponent as b, classNames as k, kendoThemeMaps as x, getTabIndex as D, uMaskedTextBox as H } from "@progress/kendo-react-common";
|
|
13
|
+
import { FloatingLabel as q } from "@progress/kendo-react-labels";
|
|
14
|
+
const l = class l extends p.Component {
|
|
15
15
|
constructor() {
|
|
16
|
-
super(...arguments), this.state = {}, this._inputId = `k_${this.props.id}`, this._service = new
|
|
16
|
+
super(...arguments), this.state = {}, this._inputId = `k_${this.props.id}`, this._service = new E(), this._isPasted = !1, this._selection = [null, null], this._input = null, this.focus = () => {
|
|
17
17
|
this._input && this._input.focus();
|
|
18
18
|
}, this.pasteHandler = (t) => {
|
|
19
|
-
const { selectionStart:
|
|
20
|
-
|
|
19
|
+
const { selectionStart: i, selectionEnd: s } = t.target;
|
|
20
|
+
s !== i && (this._isPasted = !0, this._selection = [i || 0, s || 0]);
|
|
21
21
|
}, this.onChangeHandler = (t) => {
|
|
22
|
-
const
|
|
22
|
+
const i = t.currentTarget, s = i.value, a = this._selection[0] || 0, o = this._selection[1] || 0;
|
|
23
23
|
if (!this.props.mask) {
|
|
24
|
-
this._isPasted = !1, this._selection = [null, null], this.triggerOnChange(
|
|
24
|
+
this._isPasted = !1, this._selection = [null, null], this.triggerOnChange(s, t);
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
const r = this.value;
|
|
28
28
|
let n;
|
|
29
29
|
if (this._isPasted) {
|
|
30
30
|
this._isPasted = !1;
|
|
31
|
-
const d = r.length - o, u =
|
|
32
|
-
n = this._service.maskInRange(
|
|
31
|
+
const d = r.length - o, u = s.length - d;
|
|
32
|
+
n = this._service.maskInRange(s.slice(a, u), r, a, o);
|
|
33
33
|
} else
|
|
34
|
-
n = this._service.maskInput(
|
|
34
|
+
n = this._service.maskInput(s, r, i.selectionStart || 0);
|
|
35
35
|
this._selection = [n.selection, n.selection], this.triggerOnChange(n.value, t);
|
|
36
36
|
}, this.focusHandler = (t) => {
|
|
37
37
|
this.state.focused || (this.setState({ focused: !0 }), this.props.onFocus && this.props.onFocus.call(void 0, {
|
|
@@ -90,18 +90,18 @@ const a = class a extends p.Component {
|
|
|
90
90
|
* Represents the validity state into which the MaskedTextBox is set.
|
|
91
91
|
*/
|
|
92
92
|
get validity() {
|
|
93
|
-
const t = this.value,
|
|
93
|
+
const t = this.value, i = this._service.validationValue(t), s = this.props.validationMessage !== void 0, a = this.props.valid !== void 0 ? this.props.valid : (!this.required || !!i) && (!this.props.maskValidation || !this.props.prompt || t.indexOf(this.props.prompt) === -1);
|
|
94
94
|
return {
|
|
95
|
-
customError:
|
|
96
|
-
valid:
|
|
97
|
-
valueMissing: !
|
|
95
|
+
customError: s,
|
|
96
|
+
valid: a,
|
|
97
|
+
valueMissing: !i
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* @hidden
|
|
102
102
|
*/
|
|
103
103
|
get validityStyles() {
|
|
104
|
-
return this.props.validityStyles !== void 0 ? this.props.validityStyles :
|
|
104
|
+
return this.props.validityStyles !== void 0 ? this.props.validityStyles : l.defaultProps.validityStyles;
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* @hidden
|
|
@@ -118,13 +118,13 @@ const a = class a extends p.Component {
|
|
|
118
118
|
/**
|
|
119
119
|
* @hidden
|
|
120
120
|
*/
|
|
121
|
-
componentDidUpdate(t,
|
|
122
|
-
if (this.element && this.state.focused &&
|
|
123
|
-
let [
|
|
121
|
+
componentDidUpdate(t, i) {
|
|
122
|
+
if (this.element && this.state.focused && i.focused) {
|
|
123
|
+
let [s, a] = this._selection;
|
|
124
124
|
const o = t.selection, r = this.props.selection;
|
|
125
|
-
(!o && r || o && r && (o.start !== r.start || o.end !== r.end)) && (
|
|
125
|
+
(!o && r || o && r && (o.start !== r.start || o.end !== r.end)) && (s = r.start, a = r.end), s !== null && a !== null && this.element.setSelectionRange(s, a);
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
O(t, this.props) && this.updateService(), this.setValidity();
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
130
|
* @hidden
|
|
@@ -137,33 +137,34 @@ const a = class a extends p.Component {
|
|
|
137
137
|
*/
|
|
138
138
|
render() {
|
|
139
139
|
const {
|
|
140
|
-
size: t =
|
|
141
|
-
fillMode:
|
|
142
|
-
rounded:
|
|
143
|
-
autoFocus:
|
|
144
|
-
prefix: o =
|
|
145
|
-
suffix: r =
|
|
140
|
+
size: t = l.defaultProps.size,
|
|
141
|
+
fillMode: i = l.defaultProps.fillMode,
|
|
142
|
+
rounded: s = l.defaultProps.rounded,
|
|
143
|
+
autoFocus: a = l.defaultProps.autoFocus,
|
|
144
|
+
prefix: o = l.defaultProps.prefix,
|
|
145
|
+
suffix: r = l.defaultProps.suffix,
|
|
146
146
|
inputAttributes: n,
|
|
147
147
|
unstyled: d,
|
|
148
148
|
className: u
|
|
149
|
-
} = this.props, c = this.props.id || this._inputId, f = !this.validityStyles || this.validity.valid, v = this.props.style || {},
|
|
149
|
+
} = this.props, c = this.props.id || this._inputId, f = !this.validityStyles || this.validity.valid, v = this.props.style || {}, _ = d && d.uMaskedTextBox, [C] = b(o), [P] = b(r), m = /* @__PURE__ */ p.createElement(
|
|
150
150
|
"span",
|
|
151
151
|
{
|
|
152
152
|
dir: this.props.dir,
|
|
153
|
-
className:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
153
|
+
className: k(
|
|
154
|
+
"k-input",
|
|
155
|
+
"k-maskedtextbox",
|
|
156
|
+
{
|
|
157
|
+
[`k-input-${x.sizeMap[t] || t}`]: t,
|
|
158
|
+
[`k-input-${i}`]: i,
|
|
159
|
+
[`k-rounded-${x.roundedMap[s] || s}`]: s,
|
|
160
|
+
"k-invalid": !f,
|
|
161
|
+
"k-disabled": this.props.disabled
|
|
162
|
+
},
|
|
162
163
|
u
|
|
163
164
|
),
|
|
164
165
|
style: this.props.label ? v : { width: this.props.width, ...v }
|
|
165
166
|
},
|
|
166
|
-
/* @__PURE__ */ p.createElement(
|
|
167
|
+
/* @__PURE__ */ p.createElement(C, null),
|
|
167
168
|
/* @__PURE__ */ p.createElement(
|
|
168
169
|
"input",
|
|
169
170
|
{
|
|
@@ -171,9 +172,9 @@ const a = class a extends p.Component {
|
|
|
171
172
|
autoComplete: "off",
|
|
172
173
|
autoCorrect: "off",
|
|
173
174
|
autoCapitalize: "off",
|
|
174
|
-
autoFocus:
|
|
175
|
+
autoFocus: a,
|
|
175
176
|
spellCheck: !1,
|
|
176
|
-
className:
|
|
177
|
+
className: k(H.inputInner({ c: _ })),
|
|
177
178
|
value: this.value,
|
|
178
179
|
id: c,
|
|
179
180
|
"aria-labelledby": this.props.ariaLabelledBy,
|
|
@@ -181,28 +182,28 @@ const a = class a extends p.Component {
|
|
|
181
182
|
"aria-placeholder": this.props.mask,
|
|
182
183
|
"aria-required": this.props.required,
|
|
183
184
|
name: this.props.name,
|
|
184
|
-
tabIndex:
|
|
185
|
+
tabIndex: D(this.props.tabIndex, this.props.disabled, !0),
|
|
185
186
|
accessKey: this.props.accessKey,
|
|
186
187
|
title: this.props.title,
|
|
187
188
|
disabled: this.props.disabled || void 0,
|
|
188
189
|
readOnly: this.props.readonly || void 0,
|
|
189
190
|
placeholder: this.props.placeholder,
|
|
190
|
-
ref: (
|
|
191
|
-
this._input =
|
|
191
|
+
ref: (S) => {
|
|
192
|
+
this._input = S;
|
|
192
193
|
},
|
|
193
194
|
onChange: this.onChangeHandler,
|
|
194
195
|
onPaste: this.pasteHandler,
|
|
195
196
|
onFocus: this.focusHandler,
|
|
196
197
|
onBlur: this.blurHandler,
|
|
197
|
-
onDragStart:
|
|
198
|
-
onDrop:
|
|
198
|
+
onDragStart: y,
|
|
199
|
+
onDrop: y,
|
|
199
200
|
...n
|
|
200
201
|
}
|
|
201
202
|
),
|
|
202
|
-
/* @__PURE__ */ p.createElement(
|
|
203
|
+
/* @__PURE__ */ p.createElement(P, null)
|
|
203
204
|
);
|
|
204
205
|
return this.props.label ? /* @__PURE__ */ p.createElement(
|
|
205
|
-
|
|
206
|
+
q,
|
|
206
207
|
{
|
|
207
208
|
label: this.props.label,
|
|
208
209
|
editorId: c,
|
|
@@ -210,30 +211,30 @@ const a = class a extends p.Component {
|
|
|
210
211
|
editorValid: f,
|
|
211
212
|
editorDisabled: this.props.disabled,
|
|
212
213
|
editorPlaceholder: this.props.placeholder,
|
|
213
|
-
children:
|
|
214
|
+
children: m,
|
|
214
215
|
style: { width: this.props.width },
|
|
215
216
|
dir: this.props.dir
|
|
216
217
|
}
|
|
217
|
-
) :
|
|
218
|
+
) : m;
|
|
218
219
|
}
|
|
219
|
-
triggerOnChange(t,
|
|
220
|
+
triggerOnChange(t, i) {
|
|
220
221
|
if (this.setState({
|
|
221
222
|
value: t
|
|
222
223
|
}), this.props.onChange) {
|
|
223
224
|
this._valueDuringOnChange = t;
|
|
224
|
-
const
|
|
225
|
-
syntheticEvent:
|
|
226
|
-
nativeEvent:
|
|
225
|
+
const s = {
|
|
226
|
+
syntheticEvent: i,
|
|
227
|
+
nativeEvent: i.nativeEvent,
|
|
227
228
|
selectionStart: this._selection[0],
|
|
228
229
|
selectionEnd: this._selection[1],
|
|
229
230
|
target: this,
|
|
230
231
|
value: this.value
|
|
231
232
|
};
|
|
232
|
-
this.props.onChange.call(void 0,
|
|
233
|
+
this.props.onChange.call(void 0, s), this._valueDuringOnChange = void 0;
|
|
233
234
|
}
|
|
234
235
|
}
|
|
235
236
|
updateService(t) {
|
|
236
|
-
const
|
|
237
|
+
const i = Object.assign(
|
|
237
238
|
{
|
|
238
239
|
includeLiterals: this.props.includeLiterals,
|
|
239
240
|
mask: this.props.mask,
|
|
@@ -243,13 +244,13 @@ const a = class a extends p.Component {
|
|
|
243
244
|
},
|
|
244
245
|
t
|
|
245
246
|
);
|
|
246
|
-
this._service.update(
|
|
247
|
+
this._service.update(i);
|
|
247
248
|
}
|
|
248
249
|
get rules() {
|
|
249
|
-
return Object.assign({},
|
|
250
|
+
return Object.assign({}, g, this.props.rules);
|
|
250
251
|
}
|
|
251
252
|
};
|
|
252
|
-
|
|
253
|
+
l.displayName = "MaskedTextBox", l.propTypes = {
|
|
253
254
|
value: e.string,
|
|
254
255
|
defaultValue: e.string,
|
|
255
256
|
placeholder: e.string,
|
|
@@ -272,10 +273,10 @@ a.displayName = "MaskedTextBox", a.propTypes = {
|
|
|
272
273
|
includeLiterals: e.bool,
|
|
273
274
|
maskValidation: e.bool,
|
|
274
275
|
mask: e.string,
|
|
275
|
-
rules: function(t,
|
|
276
|
-
const
|
|
277
|
-
return
|
|
278
|
-
"Invalid prop `" +
|
|
276
|
+
rules: function(t, i, s) {
|
|
277
|
+
const a = t.rules;
|
|
278
|
+
return a !== void 0 && !Object.entries(a).some((r) => typeof r != "string" || !(a[r] instanceof RegExp)) ? new Error(
|
|
279
|
+
"Invalid prop `" + i + "` supplied to `" + s + "`. Validation failed."
|
|
279
280
|
) : null;
|
|
280
281
|
},
|
|
281
282
|
selection: e.shape({
|
|
@@ -289,35 +290,35 @@ a.displayName = "MaskedTextBox", a.propTypes = {
|
|
|
289
290
|
valid: e.bool,
|
|
290
291
|
validityStyles: e.bool,
|
|
291
292
|
onChange: e.func,
|
|
292
|
-
size: e.oneOf([
|
|
293
|
-
rounded: e.oneOf([
|
|
294
|
-
fillMode: e.oneOf([
|
|
293
|
+
size: e.oneOf(["small", "medium", "large"]),
|
|
294
|
+
rounded: e.oneOf(["small", "medium", "large", "full"]),
|
|
295
|
+
fillMode: e.oneOf(["solid", "flat", "outline"]),
|
|
295
296
|
autoFocus: e.bool,
|
|
296
297
|
inputAttributes: e.object
|
|
297
|
-
},
|
|
298
|
+
}, l.defaultProps = {
|
|
298
299
|
prompt: "_",
|
|
299
300
|
promptPlaceholder: " ",
|
|
300
301
|
includeLiterals: !1,
|
|
301
302
|
maskValidation: !0,
|
|
302
|
-
rules:
|
|
303
|
+
rules: g,
|
|
303
304
|
validityStyles: !0,
|
|
304
305
|
prefix: (t) => null,
|
|
305
306
|
suffix: (t) => null,
|
|
306
|
-
size:
|
|
307
|
-
rounded:
|
|
308
|
-
fillMode:
|
|
307
|
+
size: void 0,
|
|
308
|
+
rounded: void 0,
|
|
309
|
+
fillMode: void 0,
|
|
309
310
|
autoFocus: !1
|
|
310
311
|
};
|
|
311
|
-
let h =
|
|
312
|
-
const
|
|
312
|
+
let h = l;
|
|
313
|
+
const B = I(), F = V(
|
|
313
314
|
M(
|
|
314
|
-
|
|
315
|
-
|
|
315
|
+
B,
|
|
316
|
+
w(h)
|
|
316
317
|
)
|
|
317
318
|
);
|
|
318
|
-
|
|
319
|
+
F.displayName = "KendoReactMaskedTextBox";
|
|
319
320
|
export {
|
|
320
|
-
|
|
321
|
-
|
|
321
|
+
F as MaskedTextBox,
|
|
322
|
+
B as MaskedTextBoxPropsContext,
|
|
322
323
|
h as MaskedTextBoxWithoutContext
|
|
323
324
|
};
|