@progress/kendo-react-inputs 8.2.0-develop.2 → 8.2.0-develop.20
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.js +1 -1
- package/checkbox/Checkbox.mjs +115 -112
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +28 -1
- package/index.d.ts +28 -1
- package/input/Input.js +1 -1
- package/input/Input.mjs +47 -43
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +61 -57
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +89 -86
- package/package-metadata.mjs +1 -1
- package/package.json +8 -8
- package/range-slider/RangeSlider.js +1 -1
- package/range-slider/RangeSlider.mjs +11 -7
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +112 -111
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +5 -5
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +96 -92
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +54 -50
package/index.d.mts
CHANGED
|
@@ -169,6 +169,10 @@ export declare interface CheckboxProps extends ToggleBaseProps, FormComponentPro
|
|
|
169
169
|
* Defaults to `0`.
|
|
170
170
|
*/
|
|
171
171
|
tabIndex?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the Checkbox. (Defaults to `false`)
|
|
174
|
+
*/
|
|
175
|
+
autoFocus?: boolean;
|
|
172
176
|
/**
|
|
173
177
|
* The event handler that will be fired when the user edits the value.
|
|
174
178
|
*/
|
|
@@ -1319,6 +1323,10 @@ export declare interface InputProps extends Omit_2<React_2.InputHTMLAttributes<H
|
|
|
1319
1323
|
* Defines a string value that labels an interactive element.
|
|
1320
1324
|
*/
|
|
1321
1325
|
ariaLabel?: string;
|
|
1326
|
+
/**
|
|
1327
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the Input. (Defaults to `false`)
|
|
1328
|
+
*/
|
|
1329
|
+
autoFocus?: boolean;
|
|
1322
1330
|
/**
|
|
1323
1331
|
* Triggered after value change.
|
|
1324
1332
|
*/
|
|
@@ -1463,6 +1471,7 @@ export declare class InputWithoutContext extends React_2.Component<InputProps, I
|
|
|
1463
1471
|
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
1464
1472
|
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
1465
1473
|
ariaLabel: PropTypes.Requireable<string>;
|
|
1474
|
+
autoFocus: PropTypes.Requireable<boolean>;
|
|
1466
1475
|
};
|
|
1467
1476
|
/**
|
|
1468
1477
|
* @hidden
|
|
@@ -1471,6 +1480,7 @@ export declare class InputWithoutContext extends React_2.Component<InputProps, I
|
|
|
1471
1480
|
defaultValue: string;
|
|
1472
1481
|
required: boolean;
|
|
1473
1482
|
validityStyles: boolean;
|
|
1483
|
+
autoFocus: boolean;
|
|
1474
1484
|
};
|
|
1475
1485
|
private _input;
|
|
1476
1486
|
private get _inputId();
|
|
@@ -1796,6 +1806,10 @@ export declare interface MaskedTextBoxProps extends FormComponentProps {
|
|
|
1796
1806
|
* @default `solid`
|
|
1797
1807
|
*/
|
|
1798
1808
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
1809
|
+
/**
|
|
1810
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the MaskedTextBox. (Defaults to `false`)
|
|
1811
|
+
*/
|
|
1812
|
+
autoFocus?: boolean;
|
|
1799
1813
|
}
|
|
1800
1814
|
|
|
1801
1815
|
/**
|
|
@@ -1858,6 +1872,7 @@ export declare class MaskedTextBoxWithoutContext extends React_2.Component<Maske
|
|
|
1858
1872
|
size: PropTypes.Requireable<"small" | "large" | "medium" | null | undefined>;
|
|
1859
1873
|
rounded: PropTypes.Requireable<"small" | "large" | "medium" | "full" | null | undefined>;
|
|
1860
1874
|
fillMode: PropTypes.Requireable<"flat" | "solid" | "outline" | null | undefined>;
|
|
1875
|
+
autoFocus: PropTypes.Requireable<boolean>;
|
|
1861
1876
|
};
|
|
1862
1877
|
/**
|
|
1863
1878
|
* @hidden
|
|
@@ -1877,6 +1892,7 @@ export declare class MaskedTextBoxWithoutContext extends React_2.Component<Maske
|
|
|
1877
1892
|
size: "small" | "large" | "medium" | null | undefined;
|
|
1878
1893
|
rounded: "small" | "large" | "medium" | "full" | null | undefined;
|
|
1879
1894
|
fillMode: "flat" | "solid" | "outline" | null | undefined;
|
|
1895
|
+
autoFocus: boolean;
|
|
1880
1896
|
};
|
|
1881
1897
|
/**
|
|
1882
1898
|
* @hidden
|
|
@@ -2229,6 +2245,10 @@ export declare interface NumericTextBoxProps extends FormComponentProps, Omit<(R
|
|
|
2229
2245
|
* Represents the input element `style` HTML attribute.
|
|
2230
2246
|
*/
|
|
2231
2247
|
inputStyle?: React.CSSProperties;
|
|
2248
|
+
/**
|
|
2249
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the NumericTextBox. (Defaults to `false`)
|
|
2250
|
+
*/
|
|
2251
|
+
autoFocus?: boolean;
|
|
2232
2252
|
}
|
|
2233
2253
|
|
|
2234
2254
|
/**
|
|
@@ -3996,7 +4016,6 @@ export declare class SwitchWithoutContext extends React_2.Component<SwitchProps,
|
|
|
3996
4016
|
*
|
|
3997
4017
|
*
|
|
3998
4018
|
* Accepts properties of type [TextAreaProps]({% slug api_inputs_textareaprops %}).
|
|
3999
|
-
* Obtaining the `ref` returns an object of type [TextAreaHandle]({% slug api_inputs_textareahandle %}).
|
|
4000
4019
|
*
|
|
4001
4020
|
* @example
|
|
4002
4021
|
* ```jsx
|
|
@@ -4187,6 +4206,10 @@ export declare interface TextAreaProps extends FormComponentProps, Omit_5<React.
|
|
|
4187
4206
|
* ```
|
|
4188
4207
|
*/
|
|
4189
4208
|
resizable?: 'none' | 'vertical' | 'horizontal' | 'both';
|
|
4209
|
+
/**
|
|
4210
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the TextArea. (Defaults to `false`)
|
|
4211
|
+
*/
|
|
4212
|
+
autoFocus?: boolean;
|
|
4190
4213
|
}
|
|
4191
4214
|
|
|
4192
4215
|
/**
|
|
@@ -4273,6 +4296,10 @@ export declare interface TextBoxProps extends Omit<React_2.InputHTMLAttributes<H
|
|
|
4273
4296
|
* Sets a custom suffix to the TextBox component.
|
|
4274
4297
|
*/
|
|
4275
4298
|
suffix?: CustomComponent<any>;
|
|
4299
|
+
/**
|
|
4300
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the TextBox. (Defaults to `false`)
|
|
4301
|
+
*/
|
|
4302
|
+
autoFocus?: boolean;
|
|
4276
4303
|
}
|
|
4277
4304
|
|
|
4278
4305
|
/**
|
package/index.d.ts
CHANGED
|
@@ -169,6 +169,10 @@ export declare interface CheckboxProps extends ToggleBaseProps, FormComponentPro
|
|
|
169
169
|
* Defaults to `0`.
|
|
170
170
|
*/
|
|
171
171
|
tabIndex?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the Checkbox. (Defaults to `false`)
|
|
174
|
+
*/
|
|
175
|
+
autoFocus?: boolean;
|
|
172
176
|
/**
|
|
173
177
|
* The event handler that will be fired when the user edits the value.
|
|
174
178
|
*/
|
|
@@ -1319,6 +1323,10 @@ export declare interface InputProps extends Omit_2<React_2.InputHTMLAttributes<H
|
|
|
1319
1323
|
* Defines a string value that labels an interactive element.
|
|
1320
1324
|
*/
|
|
1321
1325
|
ariaLabel?: string;
|
|
1326
|
+
/**
|
|
1327
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the Input. (Defaults to `false`)
|
|
1328
|
+
*/
|
|
1329
|
+
autoFocus?: boolean;
|
|
1322
1330
|
/**
|
|
1323
1331
|
* Triggered after value change.
|
|
1324
1332
|
*/
|
|
@@ -1463,6 +1471,7 @@ export declare class InputWithoutContext extends React_2.Component<InputProps, I
|
|
|
1463
1471
|
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
1464
1472
|
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
1465
1473
|
ariaLabel: PropTypes.Requireable<string>;
|
|
1474
|
+
autoFocus: PropTypes.Requireable<boolean>;
|
|
1466
1475
|
};
|
|
1467
1476
|
/**
|
|
1468
1477
|
* @hidden
|
|
@@ -1471,6 +1480,7 @@ export declare class InputWithoutContext extends React_2.Component<InputProps, I
|
|
|
1471
1480
|
defaultValue: string;
|
|
1472
1481
|
required: boolean;
|
|
1473
1482
|
validityStyles: boolean;
|
|
1483
|
+
autoFocus: boolean;
|
|
1474
1484
|
};
|
|
1475
1485
|
private _input;
|
|
1476
1486
|
private get _inputId();
|
|
@@ -1796,6 +1806,10 @@ export declare interface MaskedTextBoxProps extends FormComponentProps {
|
|
|
1796
1806
|
* @default `solid`
|
|
1797
1807
|
*/
|
|
1798
1808
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
1809
|
+
/**
|
|
1810
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the MaskedTextBox. (Defaults to `false`)
|
|
1811
|
+
*/
|
|
1812
|
+
autoFocus?: boolean;
|
|
1799
1813
|
}
|
|
1800
1814
|
|
|
1801
1815
|
/**
|
|
@@ -1858,6 +1872,7 @@ export declare class MaskedTextBoxWithoutContext extends React_2.Component<Maske
|
|
|
1858
1872
|
size: PropTypes.Requireable<"small" | "large" | "medium" | null | undefined>;
|
|
1859
1873
|
rounded: PropTypes.Requireable<"small" | "large" | "medium" | "full" | null | undefined>;
|
|
1860
1874
|
fillMode: PropTypes.Requireable<"flat" | "solid" | "outline" | null | undefined>;
|
|
1875
|
+
autoFocus: PropTypes.Requireable<boolean>;
|
|
1861
1876
|
};
|
|
1862
1877
|
/**
|
|
1863
1878
|
* @hidden
|
|
@@ -1877,6 +1892,7 @@ export declare class MaskedTextBoxWithoutContext extends React_2.Component<Maske
|
|
|
1877
1892
|
size: "small" | "large" | "medium" | null | undefined;
|
|
1878
1893
|
rounded: "small" | "large" | "medium" | "full" | null | undefined;
|
|
1879
1894
|
fillMode: "flat" | "solid" | "outline" | null | undefined;
|
|
1895
|
+
autoFocus: boolean;
|
|
1880
1896
|
};
|
|
1881
1897
|
/**
|
|
1882
1898
|
* @hidden
|
|
@@ -2229,6 +2245,10 @@ export declare interface NumericTextBoxProps extends FormComponentProps, Omit<(R
|
|
|
2229
2245
|
* Represents the input element `style` HTML attribute.
|
|
2230
2246
|
*/
|
|
2231
2247
|
inputStyle?: React.CSSProperties;
|
|
2248
|
+
/**
|
|
2249
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the NumericTextBox. (Defaults to `false`)
|
|
2250
|
+
*/
|
|
2251
|
+
autoFocus?: boolean;
|
|
2232
2252
|
}
|
|
2233
2253
|
|
|
2234
2254
|
/**
|
|
@@ -3996,7 +4016,6 @@ export declare class SwitchWithoutContext extends React_2.Component<SwitchProps,
|
|
|
3996
4016
|
*
|
|
3997
4017
|
*
|
|
3998
4018
|
* Accepts properties of type [TextAreaProps]({% slug api_inputs_textareaprops %}).
|
|
3999
|
-
* Obtaining the `ref` returns an object of type [TextAreaHandle]({% slug api_inputs_textareahandle %}).
|
|
4000
4019
|
*
|
|
4001
4020
|
* @example
|
|
4002
4021
|
* ```jsx
|
|
@@ -4187,6 +4206,10 @@ export declare interface TextAreaProps extends FormComponentProps, Omit_5<React.
|
|
|
4187
4206
|
* ```
|
|
4188
4207
|
*/
|
|
4189
4208
|
resizable?: 'none' | 'vertical' | 'horizontal' | 'both';
|
|
4209
|
+
/**
|
|
4210
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the TextArea. (Defaults to `false`)
|
|
4211
|
+
*/
|
|
4212
|
+
autoFocus?: boolean;
|
|
4190
4213
|
}
|
|
4191
4214
|
|
|
4192
4215
|
/**
|
|
@@ -4273,6 +4296,10 @@ export declare interface TextBoxProps extends Omit<React_2.InputHTMLAttributes<H
|
|
|
4273
4296
|
* Sets a custom suffix to the TextBox component.
|
|
4274
4297
|
*/
|
|
4275
4298
|
suffix?: CustomComponent<any>;
|
|
4299
|
+
/**
|
|
4300
|
+
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the TextBox. (Defaults to `false`)
|
|
4301
|
+
*/
|
|
4302
|
+
autoFocus?: boolean;
|
|
4276
4303
|
}
|
|
4277
4304
|
|
|
4278
4305
|
/**
|
package/input/Input.js
CHANGED
|
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),a=require("prop-types"),n=require("@progress/kendo-react-common"),k=require("@progress/kendo-react-labels"),O=require("../package-metadata.js");function P(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const u=P(S),s=class s extends u.Component{constructor(e){super(e),this._input=null,this.focus=()=>{this._input&&this._input.focus()},this.isInvalid=t=>{let i=!1;for(let r in t)t.hasOwnProperty(r)&&(i=i||!!t[r]);return i},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&(this.validity.valid||!this.validityStyles?this._input.classList.remove("k-invalid"):this._input.classList.add("k-invalid"),this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||""))},this.handleChange=t=>{this.setState({value:t.target.value}),this.valueDuringOnChange=t.target.value,this.props.onChange&&this.props.onChange.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:t.target.value,target:this}),this.valueDuringOnChange=void 0},this.handleAutoFill=t=>{if(t.animationName==="autoFillStart"){let i=t.target.parentNode;i&&i.classList.contains("k-empty")&&i.classList.remove("k-empty")}},n.validatePackage(O.packageMetadata),this.state={value:this.props.defaultValue||s.defaultProps.defaultValue}}get _inputId(){return this.props.id}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}get name(){return this.props.name}get validity(){const e={badInput:this._input?this._input.validity.badInput:!1,patternMismatch:this._input?this._input.validity.patternMismatch:!1,rangeOverflow:this._input?this._input.validity.rangeOverflow:!1,rangeUnderflow:this._input?this._input.validity.rangeUnderflow:!1,stepMismatch:this._input?this._input.validity.stepMismatch:!1,tooLong:this._input?this._input.validity.tooLong:!1,typeMismatch:this._input?this._input.validity.typeMismatch:!1,valueMissing:this._input?this._input.validity.valueMissing:!1};return{...e,customError:this.props.validationMessage!==void 0,valid:this.props.valid!==void 0?this.props.valid:this._input?!this.isInvalid(e):!0}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:s.defaultProps.validityStyles}componentDidMount(){this.forceUpdate()}componentDidUpdate(){this.setValidity()}render(){const{className:e,label:t,labelClassName:i,id:r,validationMessage:I,defaultValue:L,valid:D,visited:N,touched:V,modified:w,autoFocus:f,ariaLabelledBy:m,ariaDescribedBy:b,validityStyles:q,style:p,ariaLabel:_,...o}=this.props,h=r||this._inputId,c=!this.validityStyles||this.validity.valid,C=n.classNames(e,"k-input k-input-md k-rounded-md k-input-solid"),v=u.createElement("input",{"aria-labelledby":m,"aria-describedby":b,"aria-disabled":this.props.disabled||void 0,"aria-invalid":!c||void 0,"aria-label":_||void 0,...o,style:t?void 0:p,value:this.value,id:h,autoFocus:f,className:C,onChange:this.handleChange,onAnimationStart:this.handleAutoFill,ref:M=>{this._input=M}});return t?u.createElement(k.FloatingLabel,{label:t,labelClassName:i,editorId:h,editorValue:String(this.value),editorValid:c,editorDisabled:o.disabled,editorPlaceholder:o.placeholder,children:v,style:p,dir:o.dir}):v}};s.displayName="Input",s.propTypes={label:a.string,labelClassName:a.string,validationMessage:a.string,required:a.bool,validate:a.bool,id:a.string,ariaLabelledBy:a.string,ariaDescribedBy:a.string,ariaLabel:a.string,autoFocus:a.bool},s.defaultProps={defaultValue:"",required:!1,validityStyles:!0,autoFocus:!1};let d=s;const g=n.createPropsContext(),y=n.withIdHOC(n.withPropsContext(g,d));y.displayName="KendoReactInput";exports.Input=y;exports.InputPropsContext=g;exports.InputWithoutContext=d;
|
package/input/Input.mjs
CHANGED
|
@@ -7,19 +7,19 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as r from "react";
|
|
10
|
-
import
|
|
11
|
-
import { validatePackage as
|
|
12
|
-
import { FloatingLabel as
|
|
13
|
-
import { packageMetadata as
|
|
10
|
+
import t from "prop-types";
|
|
11
|
+
import { validatePackage as b, classNames as _, createPropsContext as C, withIdHOC as M, withPropsContext as S } from "@progress/kendo-react-common";
|
|
12
|
+
import { FloatingLabel as L } from "@progress/kendo-react-labels";
|
|
13
|
+
import { packageMetadata as V } from "../package-metadata.mjs";
|
|
14
14
|
const e = class e extends r.Component {
|
|
15
15
|
constructor(s) {
|
|
16
16
|
super(s), this._input = null, this.focus = () => {
|
|
17
17
|
this._input && this._input.focus();
|
|
18
18
|
}, this.isInvalid = (i) => {
|
|
19
|
-
let
|
|
19
|
+
let a = !1;
|
|
20
20
|
for (let l in i)
|
|
21
|
-
i.hasOwnProperty(l) && (
|
|
22
|
-
return
|
|
21
|
+
i.hasOwnProperty(l) && (a = a || !!i[l]);
|
|
22
|
+
return a;
|
|
23
23
|
}, this.setValidity = () => {
|
|
24
24
|
this._input && this._input.setCustomValidity && (this.validity.valid || !this.validityStyles ? this._input.classList.remove("k-invalid") : this._input.classList.add("k-invalid"), this._input.setCustomValidity(
|
|
25
25
|
this.validity.valid ? "" : this.props.validationMessage || ""
|
|
@@ -35,10 +35,10 @@ const e = class e extends r.Component {
|
|
|
35
35
|
}), this.valueDuringOnChange = void 0;
|
|
36
36
|
}, this.handleAutoFill = (i) => {
|
|
37
37
|
if (i.animationName === "autoFillStart") {
|
|
38
|
-
let
|
|
39
|
-
|
|
38
|
+
let a = i.target.parentNode;
|
|
39
|
+
a && a.classList.contains("k-empty") && a.classList.remove("k-empty");
|
|
40
40
|
}
|
|
41
|
-
},
|
|
41
|
+
}, b(V), this.state = {
|
|
42
42
|
value: this.props.defaultValue || e.defaultProps.defaultValue
|
|
43
43
|
};
|
|
44
44
|
}
|
|
@@ -108,46 +108,48 @@ const e = class e extends r.Component {
|
|
|
108
108
|
const {
|
|
109
109
|
className: s,
|
|
110
110
|
label: i,
|
|
111
|
-
labelClassName:
|
|
111
|
+
labelClassName: a,
|
|
112
112
|
id: l,
|
|
113
|
-
validationMessage:
|
|
114
|
-
defaultValue:
|
|
115
|
-
valid:
|
|
113
|
+
validationMessage: P,
|
|
114
|
+
defaultValue: D,
|
|
115
|
+
valid: I,
|
|
116
116
|
// Removed to support direct use in Form Field component
|
|
117
|
-
visited:
|
|
118
|
-
touched:
|
|
119
|
-
modified:
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
visited: O,
|
|
118
|
+
touched: w,
|
|
119
|
+
modified: F,
|
|
120
|
+
autoFocus: v,
|
|
121
|
+
ariaLabelledBy: c,
|
|
122
|
+
ariaDescribedBy: y,
|
|
122
123
|
validityStyles: E,
|
|
123
124
|
style: o,
|
|
124
|
-
ariaLabel:
|
|
125
|
+
ariaLabel: g,
|
|
125
126
|
...n
|
|
126
|
-
} = this.props, p = l || this._inputId, u = !this.validityStyles || this.validity.valid,
|
|
127
|
+
} = this.props, p = l || this._inputId, u = !this.validityStyles || this.validity.valid, m = _(s, "k-input k-input-md k-rounded-md k-input-solid"), h = /* @__PURE__ */ r.createElement(
|
|
127
128
|
"input",
|
|
128
129
|
{
|
|
129
|
-
"aria-labelledby":
|
|
130
|
-
"aria-describedby":
|
|
130
|
+
"aria-labelledby": c,
|
|
131
|
+
"aria-describedby": y,
|
|
131
132
|
"aria-disabled": this.props.disabled || void 0,
|
|
132
133
|
"aria-invalid": !u || void 0,
|
|
133
|
-
"aria-label":
|
|
134
|
+
"aria-label": g || void 0,
|
|
134
135
|
...n,
|
|
135
136
|
style: i ? void 0 : o,
|
|
136
137
|
value: this.value,
|
|
137
138
|
id: p,
|
|
138
|
-
|
|
139
|
+
autoFocus: v,
|
|
140
|
+
className: m,
|
|
139
141
|
onChange: this.handleChange,
|
|
140
142
|
onAnimationStart: this.handleAutoFill,
|
|
141
|
-
ref: (
|
|
142
|
-
this._input =
|
|
143
|
+
ref: (f) => {
|
|
144
|
+
this._input = f;
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
);
|
|
146
148
|
return i ? /* @__PURE__ */ r.createElement(
|
|
147
|
-
|
|
149
|
+
L,
|
|
148
150
|
{
|
|
149
151
|
label: i,
|
|
150
|
-
labelClassName:
|
|
152
|
+
labelClassName: a,
|
|
151
153
|
editorId: p,
|
|
152
154
|
editorValue: String(this.value),
|
|
153
155
|
editorValid: u,
|
|
@@ -161,25 +163,27 @@ const e = class e extends r.Component {
|
|
|
161
163
|
}
|
|
162
164
|
};
|
|
163
165
|
e.displayName = "Input", e.propTypes = {
|
|
164
|
-
label:
|
|
165
|
-
labelClassName:
|
|
166
|
-
validationMessage:
|
|
167
|
-
required:
|
|
168
|
-
validate:
|
|
169
|
-
id:
|
|
170
|
-
ariaLabelledBy:
|
|
171
|
-
ariaDescribedBy:
|
|
172
|
-
ariaLabel:
|
|
166
|
+
label: t.string,
|
|
167
|
+
labelClassName: t.string,
|
|
168
|
+
validationMessage: t.string,
|
|
169
|
+
required: t.bool,
|
|
170
|
+
validate: t.bool,
|
|
171
|
+
id: t.string,
|
|
172
|
+
ariaLabelledBy: t.string,
|
|
173
|
+
ariaDescribedBy: t.string,
|
|
174
|
+
ariaLabel: t.string,
|
|
175
|
+
autoFocus: t.bool
|
|
173
176
|
}, e.defaultProps = {
|
|
174
177
|
defaultValue: "",
|
|
175
178
|
required: !1,
|
|
176
|
-
validityStyles: !0
|
|
179
|
+
validityStyles: !0,
|
|
180
|
+
autoFocus: !1
|
|
177
181
|
};
|
|
178
182
|
let d = e;
|
|
179
|
-
const
|
|
180
|
-
|
|
183
|
+
const k = C(), N = M(S(k, d));
|
|
184
|
+
N.displayName = "KendoReactInput";
|
|
181
185
|
export {
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
N as Input,
|
|
187
|
+
k as InputPropsContext,
|
|
184
188
|
d as InputWithoutContext
|
|
185
189
|
};
|
|
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),e=require("prop-types"),C=require("./masking.service.js"),c=require("./utils.js"),o=require("@progress/kendo-react-common"),_=require("@progress/kendo-react-labels"),S=require("../package-metadata.js");function O(h){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:()=>h[t]})}}return s.default=h,Object.freeze(s)}const u=O(x),l=class l extends u.Component{constructor(s){super(s),this.state={},this._inputId=`k-${this.props.id}`,this._service=new C.MaskingService,this._isPasted=!1,this._selection=[null,null],this._input=null,this.focus=()=>{this._input&&this._input.focus()},this.pasteHandler=t=>{const{selectionStart:i,selectionEnd:r}=t.target;r!==i&&(this._isPasted=!0,this._selection=[i||0,r||0])},this.onChangeHandler=t=>{const i=t.currentTarget,r=i.value,n=this._selection[0]||0,a=this._selection[1]||0;if(!this.props.mask){this._isPasted=!1,this._selection=[null,null],this.triggerOnChange(r,t);return}const p=this.value;let d;if(this._isPasted){this._isPasted=!1;const v=p.length-a,g=r.length-v;d=this._service.maskInRange(r.slice(n,g),p,n,a)}else d=this._service.maskInput(r,p,i.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||"")},o.validatePackage(S.packageMetadata)}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 s=this.value,t=this._service.validationValue(s),i=this.props.validationMessage!==void 0,r=this.props.valid!==void 0?this.props.valid:(!this.required||!!t)&&(!this.props.maskValidation||!this.props.prompt||s.indexOf(this.props.prompt)===-1);return{customError:i,valid:r,valueMissing:!t}}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:l.defaultProps.required}get name(){return this.props.name}componentDidUpdate(s,t){if(this.element&&this.state.focused&&t.focused){let[i,r]=this._selection;const n=s.selection,a=this.props.selection;(!n&&a||n&&a&&(n.start!==a.start||n.end!==a.end))&&(i=a.start,r=a.end),i!==null&&r!==null&&this.element.setSelectionRange(i,r)}c.maskingChanged(s,this.props)&&this.updateService(),this.setValidity()}componentDidMount(){this.updateService(),this.setValidity()}render(){const{size:s=l.defaultProps.size,fillMode:t=l.defaultProps.fillMode,rounded:i=l.defaultProps.rounded,autoFocus:r=l.defaultProps.autoFocus}=this.props,n=this.props.id||this._inputId,a=!this.validityStyles||this.validity.valid,p=this.props.style||{},{prefix:d=l.defaultProps.prefix,suffix:v=l.defaultProps.suffix}=this.props,[g]=o.useCustomComponent(d),[k]=o.useCustomComponent(v),m=u.createElement("span",{dir:this.props.dir,className:o.classNames("k-maskedtextbox k-input",{[`k-input-${o.kendoThemeMaps.sizeMap[s]||s}`]:s,[`k-input-${t}`]:t,[`k-rounded-${o.kendoThemeMaps.roundedMap[i]||i}`]:i,"k-invalid":!a,"k-required":this.required,"k-disabled":this.props.disabled},this.props.className),style:this.props.label?p:{width:this.props.width,...p}},u.createElement(g,null),u.createElement("input",{type:"text",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",autoFocus:r,spellCheck:!1,className:"k-input-inner",value:this.value,id:n,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-placeholder":this.props.mask,name:this.props.name,tabIndex:o.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:P=>this._input=P,onChange:this.onChangeHandler,onPaste:this.pasteHandler,onFocus:this.focusHandler,onBlur:this.blurHandler,onDragStart:c.returnFalse,onDrop:c.returnFalse}),u.createElement(k,null));return this.props.label?u.createElement(_.FloatingLabel,{label:this.props.label,editorId:n,editorValue:this.value,editorValid:a,editorDisabled:this.props.disabled,editorPlaceholder:this.props.placeholder,children:m,style:{width:this.props.width},dir:this.props.dir}):m}triggerOnChange(s,t){if(this.setState({value:s}),this.props.onChange){this._valueDuringOnChange=s;const i={syntheticEvent:t,nativeEvent:t.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(s){const t=Object.assign({includeLiterals:this.props.includeLiterals,mask:this.props.mask,prompt:this.props.prompt,promptPlaceholder:this.props.promptPlaceholder,rules:this.rules},s);this._service.update(t)}get rules(){return Object.assign({},c.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(s,t,i){const r=s.rules;return r!==void 0&&!Object.entries(r).some(a=>typeof a!="string"||!(r[a]instanceof RegExp))?new Error("Invalid prop `"+t+"` supplied to `"+i+"`. Validation failed."):null},selection:e.shape({start:e.number.isRequired,end:e.number.isRequired}),name:e.string,label:e.string,validationMessage:e.string,required:e.bool,valid:e.bool,validityStyles:e.bool,onChange:e.func,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),autoFocus:e.bool},l.defaultProps={prompt:"_",promptPlaceholder:" ",includeLiterals:!1,maskValidation:!0,rules:c.defaultRules,required:!1,validityStyles:!0,prefix:s=>null,suffix:s=>null,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let f=l;const y=o.createPropsContext(),b=o.withIdHOC(o.withPropsContext(y,f));b.displayName="KendoReactMaskedTextBox";exports.MaskedTextBox=b;exports.MaskedTextBoxPropsContext=y;exports.MaskedTextBoxWithoutContext=f;
|