@progress/kendo-react-inputs 13.4.0-develop.3 → 13.4.0-develop.5
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 +133 -118
- package/checkbox/interfaces/CheckboxProps.d.ts +1 -1
- package/colors/ColorInput.d.ts +1 -1
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +1 -1
- package/colors/FlatColorPicker.d.ts +1 -1
- package/colors/HexInput.d.ts +1 -1
- package/colors/interfaces/ColorGradientProps.d.ts +1 -1
- package/colors/interfaces/ColorPickerProps.d.ts +1 -1
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/input/Input.js +1 -1
- package/input/Input.mjs +120 -101
- package/maskedtextbox/MaskedTextBox.d.ts +7 -1
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +83 -62
- package/maskedtextbox/MaskedTextBoxProps.d.ts +1 -1
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +243 -219
- package/numerictextbox/interfaces/NumericTextBoxProps.d.ts +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +1 -1
- package/signature/interfaces/SignatureProps.d.ts +1 -1
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +109 -90
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +132 -116
- package/textarea/interfaces/TextAreaProps.d.ts +1 -1
- package/textbox/Textbox.d.ts +2 -1
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +77 -62
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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("react"),r=require("prop-types"),i=require("@progress/kendo-react-common"),Z=require("@progress/kendo-react-labels");function $(l){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const u in l)if(u!=="default"){const c=Object.getOwnPropertyDescriptor(l,u);Object.defineProperty(o,u,c.get?c:{enumerable:!0,get:()=>l[u]})}}return o.default=l,Object.freeze(o)}const a=$(Y),P=a.forwardRef((l,o)=>{const c=a.useContext(R).call(void 0,l),[,S]=a.useReducer(t=>t,!0),n=i.applyDefaultProps(c,ee),{className:V,label:f,labelClassName:x,id:w,validationMessage:I,defaultValue:D,valid:k,unstyled:F,visited:te,touched:ae,modified:re,autoFocus:q,ariaLabelledBy:B,ariaDescribedBy:T,validityStyles:E,style:L,ariaLabel:U,...j}=n,K=i.useUnstyled(),y=F||K;y&&y.uInput;const _=i.useId(),[A,G]=a.useState({value:D}),M=w||_,e=a.useRef(null),d=a.useRef(void 0),g=a.useRef(null),N=n.name||n.id,H=()=>{e.current&&e.current.focus()},m=()=>d.current!==void 0?d.current:n.value!==void 0?n.value:A.value,v=()=>{const t={badInput:e.current?e.current.validity.badInput:!1,patternMismatch:e.current?e.current.validity.patternMismatch:!1,rangeOverflow:e.current?e.current.validity.rangeOverflow:!1,rangeUnderflow:e.current?e.current.validity.rangeUnderflow:!1,stepMismatch:e.current?e.current.validity.stepMismatch:!1,tooLong:e.current?e.current.validity.tooLong:!1,typeMismatch:e.current?e.current.validity.typeMismatch:!1,valueMissing:e.current?e.current.validity.valueMissing:!1};return{...t,customError:I!==void 0,valid:k!==void 0?k:e.current?!z(t):!0}};a.useImperativeHandle(g,()=>({element:e.current,props:n,get value(){return m()},name:n.name,get validity(){return v()},focus:H})),a.useImperativeHandle(o,()=>g.current);const z=t=>{let s=!1;for(const p in t)t.hasOwnProperty(p)&&(s=s||!!t[p]);return s},b=!E||v().valid,J=i.classNames("k-input",{"k-invalid":!b,"k-disabled":n.disabled},V),Q=()=>{e.current&&e.current.setCustomValidity&&(v().valid||!E?e.current.classList.remove("k-invalid"):e.current.classList.add("k-invalid"),e.current.setCustomValidity(v().valid?"":I||""))},{onChange:h}=n,C=a.useCallback(t=>{G({value:t.target.value}),d.current=t.target.value,h&&h({syntheticEvent:t,nativeEvent:t.nativeEvent,value:t.target.value,target:g.current}),d.current=void 0},[h]),W=a.useCallback(t=>{const s=t!=null?String(t):"",p={target:e.current,currentTarget:e.current,nativeEvent:new Event("change")};e.current&&(e.current.value=s),C(p)},[C]);i.useKendoPaste(e,{fieldName:N||"",onValueChange:W,enabled:!!N});const X=t=>{if(t.animationName==="autoFillStart"){const s=t.target.parentNode;s&&s.classList.contains("k-empty")&&s.classList.remove("k-empty")}};a.useEffect(()=>{S()},[]),a.useEffect(()=>{Q()});const O=a.createElement("input",{"aria-labelledby":B,"aria-describedby":T,"aria-disabled":n.disabled||void 0,"aria-invalid":!b||void 0,"aria-label":U||void 0,...j,style:f?void 0:L,value:m(),id:M,autoFocus:q,className:J,onChange:C,onAnimationStart:X,ref:e});return f?a.createElement(Z.FloatingLabel,{label:f,labelClassName:x,editorId:M,editorValue:String(m()),editorValid:b,editorDisabled:n.disabled,editorPlaceholder:n.placeholder,children:O,style:L,dir:n.dir,unstyled:y}):O}),R=i.createPropsContext(),ee={defaultValue:"",required:!1,validityStyles:!0,autoFocus:!1};P.displayName="KendoReactInput";P.propTypes={label:r.node,labelClassName:r.string,validationMessage:r.string,required:r.bool,validate:r.bool,id:r.string,ariaLabelledBy:r.string,ariaDescribedBy:r.string,ariaLabel:r.string,autoFocus:r.bool,value:r.oneOfType([r.string,r.number,r.array])};exports.Input=P;exports.InputPropsContext=R;
|
package/input/Input.mjs
CHANGED
|
@@ -5,38 +5,38 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import
|
|
10
|
-
import { createPropsContext as
|
|
11
|
-
import { FloatingLabel as
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
className:
|
|
15
|
-
label:
|
|
8
|
+
import * as a from "react";
|
|
9
|
+
import r from "prop-types";
|
|
10
|
+
import { createPropsContext as Q, applyDefaultProps as W, useUnstyled as X, useId as Y, classNames as Z, useKendoPaste as $ } from "@progress/kendo-react-common";
|
|
11
|
+
import { FloatingLabel as ee } from "@progress/kendo-react-labels";
|
|
12
|
+
const E = a.forwardRef((k, L) => {
|
|
13
|
+
const N = a.useContext(te).call(void 0, k), [, M] = a.useReducer((t) => t, !0), n = W(N, ae), {
|
|
14
|
+
className: V,
|
|
15
|
+
label: u,
|
|
16
16
|
labelClassName: x,
|
|
17
|
-
id:
|
|
18
|
-
validationMessage:
|
|
19
|
-
defaultValue:
|
|
20
|
-
valid:
|
|
21
|
-
unstyled:
|
|
17
|
+
id: R,
|
|
18
|
+
validationMessage: y,
|
|
19
|
+
defaultValue: F,
|
|
20
|
+
valid: g,
|
|
21
|
+
unstyled: w,
|
|
22
22
|
// Removed to support direct use in Form Field component
|
|
23
|
-
visited:
|
|
24
|
-
touched:
|
|
25
|
-
modified:
|
|
26
|
-
autoFocus:
|
|
27
|
-
ariaLabelledBy:
|
|
28
|
-
ariaDescribedBy:
|
|
29
|
-
validityStyles:
|
|
30
|
-
style:
|
|
31
|
-
ariaLabel:
|
|
32
|
-
...
|
|
33
|
-
} = n,
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
value:
|
|
37
|
-
}),
|
|
23
|
+
visited: ne,
|
|
24
|
+
touched: le,
|
|
25
|
+
modified: se,
|
|
26
|
+
autoFocus: B,
|
|
27
|
+
ariaLabelledBy: S,
|
|
28
|
+
ariaDescribedBy: U,
|
|
29
|
+
validityStyles: b,
|
|
30
|
+
style: h,
|
|
31
|
+
ariaLabel: D,
|
|
32
|
+
...O
|
|
33
|
+
} = n, T = X(), c = w || T;
|
|
34
|
+
c && c.uInput;
|
|
35
|
+
const K = Y(), [q, A] = a.useState({
|
|
36
|
+
value: F
|
|
37
|
+
}), C = R || K, e = a.useRef(null), s = a.useRef(void 0), d = a.useRef(null), I = n.name || n.id, G = () => {
|
|
38
38
|
e.current && e.current.focus();
|
|
39
|
-
},
|
|
39
|
+
}, v = () => s.current !== void 0 ? s.current : n.value !== void 0 ? n.value : q.value, i = () => {
|
|
40
40
|
const t = {
|
|
41
41
|
badInput: e.current ? e.current.validity.badInput : !1,
|
|
42
42
|
patternMismatch: e.current ? e.current.validity.patternMismatch : !1,
|
|
@@ -49,112 +49,131 @@ const C = r.forwardRef((I, L) => {
|
|
|
49
49
|
};
|
|
50
50
|
return {
|
|
51
51
|
...t,
|
|
52
|
-
customError:
|
|
53
|
-
valid:
|
|
52
|
+
customError: y !== void 0,
|
|
53
|
+
valid: g !== void 0 ? g : e.current ? !H(t) : !0
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
a.useImperativeHandle(d, () => ({
|
|
57
57
|
element: e.current,
|
|
58
58
|
props: n,
|
|
59
59
|
get value() {
|
|
60
|
-
return
|
|
60
|
+
return v();
|
|
61
61
|
},
|
|
62
62
|
name: n.name,
|
|
63
63
|
get validity() {
|
|
64
|
-
return
|
|
64
|
+
return i();
|
|
65
65
|
},
|
|
66
|
-
focus:
|
|
67
|
-
})),
|
|
68
|
-
const
|
|
69
|
-
let
|
|
70
|
-
for (const
|
|
71
|
-
t.hasOwnProperty(
|
|
72
|
-
return
|
|
73
|
-
},
|
|
66
|
+
focus: G
|
|
67
|
+
})), a.useImperativeHandle(L, () => d.current);
|
|
68
|
+
const H = (t) => {
|
|
69
|
+
let l = !1;
|
|
70
|
+
for (const o in t)
|
|
71
|
+
t.hasOwnProperty(o) && (l = l || !!t[o]);
|
|
72
|
+
return l;
|
|
73
|
+
}, p = !b || i().valid, _ = Z(
|
|
74
74
|
"k-input",
|
|
75
75
|
{
|
|
76
|
-
"k-invalid": !
|
|
76
|
+
"k-invalid": !p,
|
|
77
77
|
"k-disabled": n.disabled
|
|
78
78
|
},
|
|
79
|
-
|
|
80
|
-
),
|
|
81
|
-
e.current && e.current.setCustomValidity && (
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
V
|
|
80
|
+
), j = () => {
|
|
81
|
+
e.current && e.current.setCustomValidity && (i().valid || !b ? e.current.classList.remove("k-invalid") : e.current.classList.add("k-invalid"), e.current.setCustomValidity(i().valid ? "" : y || ""));
|
|
82
|
+
}, { onChange: f } = n, m = a.useCallback(
|
|
83
|
+
(t) => {
|
|
84
|
+
A({
|
|
85
|
+
value: t.target.value
|
|
86
|
+
}), s.current = t.target.value, f && f({
|
|
87
|
+
syntheticEvent: t,
|
|
88
|
+
nativeEvent: t.nativeEvent,
|
|
89
|
+
value: t.target.value,
|
|
90
|
+
target: d.current
|
|
91
|
+
}), s.current = void 0;
|
|
92
|
+
},
|
|
93
|
+
[f]
|
|
94
|
+
), z = a.useCallback(
|
|
95
|
+
(t) => {
|
|
96
|
+
const l = t != null ? String(t) : "", o = {
|
|
97
|
+
target: e.current,
|
|
98
|
+
currentTarget: e.current,
|
|
99
|
+
nativeEvent: new Event("change")
|
|
100
|
+
};
|
|
101
|
+
e.current && (e.current.value = l), m(o);
|
|
102
|
+
},
|
|
103
|
+
[m]
|
|
104
|
+
);
|
|
105
|
+
$(e, {
|
|
106
|
+
fieldName: I || "",
|
|
107
|
+
onValueChange: z,
|
|
108
|
+
enabled: !!I
|
|
109
|
+
});
|
|
110
|
+
const J = (t) => {
|
|
92
111
|
if (t.animationName === "autoFillStart") {
|
|
93
|
-
const
|
|
94
|
-
|
|
112
|
+
const l = t.target.parentNode;
|
|
113
|
+
l && l.classList.contains("k-empty") && l.classList.remove("k-empty");
|
|
95
114
|
}
|
|
96
115
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}, []),
|
|
100
|
-
|
|
116
|
+
a.useEffect(() => {
|
|
117
|
+
M();
|
|
118
|
+
}, []), a.useEffect(() => {
|
|
119
|
+
j();
|
|
101
120
|
});
|
|
102
|
-
const
|
|
121
|
+
const P = /* @__PURE__ */ a.createElement(
|
|
103
122
|
"input",
|
|
104
123
|
{
|
|
105
|
-
"aria-labelledby":
|
|
106
|
-
"aria-describedby":
|
|
124
|
+
"aria-labelledby": S,
|
|
125
|
+
"aria-describedby": U,
|
|
107
126
|
"aria-disabled": n.disabled || void 0,
|
|
108
|
-
"aria-invalid": !
|
|
109
|
-
"aria-label":
|
|
110
|
-
...
|
|
111
|
-
style:
|
|
112
|
-
value:
|
|
113
|
-
id:
|
|
114
|
-
autoFocus:
|
|
115
|
-
className:
|
|
116
|
-
onChange:
|
|
117
|
-
onAnimationStart:
|
|
127
|
+
"aria-invalid": !p || void 0,
|
|
128
|
+
"aria-label": D || void 0,
|
|
129
|
+
...O,
|
|
130
|
+
style: u ? void 0 : h,
|
|
131
|
+
value: v(),
|
|
132
|
+
id: C,
|
|
133
|
+
autoFocus: B,
|
|
134
|
+
className: _,
|
|
135
|
+
onChange: m,
|
|
136
|
+
onAnimationStart: J,
|
|
118
137
|
ref: e
|
|
119
138
|
}
|
|
120
139
|
);
|
|
121
|
-
return
|
|
122
|
-
|
|
140
|
+
return u ? /* @__PURE__ */ a.createElement(
|
|
141
|
+
ee,
|
|
123
142
|
{
|
|
124
|
-
label:
|
|
143
|
+
label: u,
|
|
125
144
|
labelClassName: x,
|
|
126
|
-
editorId:
|
|
127
|
-
editorValue: String(
|
|
128
|
-
editorValid:
|
|
145
|
+
editorId: C,
|
|
146
|
+
editorValue: String(v()),
|
|
147
|
+
editorValid: p,
|
|
129
148
|
editorDisabled: n.disabled,
|
|
130
149
|
editorPlaceholder: n.placeholder,
|
|
131
|
-
children:
|
|
132
|
-
style:
|
|
150
|
+
children: P,
|
|
151
|
+
style: h,
|
|
133
152
|
dir: n.dir,
|
|
134
|
-
unstyled:
|
|
153
|
+
unstyled: c
|
|
135
154
|
}
|
|
136
|
-
) :
|
|
137
|
-
}),
|
|
155
|
+
) : P;
|
|
156
|
+
}), te = Q(), ae = {
|
|
138
157
|
defaultValue: "",
|
|
139
158
|
required: !1,
|
|
140
159
|
validityStyles: !0,
|
|
141
160
|
autoFocus: !1
|
|
142
161
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
label:
|
|
146
|
-
labelClassName:
|
|
147
|
-
validationMessage:
|
|
148
|
-
required:
|
|
149
|
-
validate:
|
|
150
|
-
id:
|
|
151
|
-
ariaLabelledBy:
|
|
152
|
-
ariaDescribedBy:
|
|
153
|
-
ariaLabel:
|
|
154
|
-
autoFocus:
|
|
155
|
-
value:
|
|
162
|
+
E.displayName = "KendoReactInput";
|
|
163
|
+
E.propTypes = {
|
|
164
|
+
label: r.node,
|
|
165
|
+
labelClassName: r.string,
|
|
166
|
+
validationMessage: r.string,
|
|
167
|
+
required: r.bool,
|
|
168
|
+
validate: r.bool,
|
|
169
|
+
id: r.string,
|
|
170
|
+
ariaLabelledBy: r.string,
|
|
171
|
+
ariaDescribedBy: r.string,
|
|
172
|
+
ariaLabel: r.string,
|
|
173
|
+
autoFocus: r.bool,
|
|
174
|
+
value: r.oneOfType([r.string, r.number, r.array])
|
|
156
175
|
};
|
|
157
176
|
export {
|
|
158
|
-
|
|
159
|
-
|
|
177
|
+
E as Input,
|
|
178
|
+
te as InputPropsContext
|
|
160
179
|
};
|
|
@@ -58,7 +58,7 @@ export declare class MaskedTextBoxWithoutContext extends React.Component<MaskedT
|
|
|
58
58
|
validityStyles: PropTypes.Requireable<boolean>;
|
|
59
59
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
60
60
|
size: PropTypes.Requireable<"small" | "medium" | "large" | undefined>;
|
|
61
|
-
rounded: PropTypes.Requireable<"small" | "medium" | "large" | "full" | undefined>;
|
|
61
|
+
rounded: PropTypes.Requireable<"small" | "none" | "medium" | "large" | "full" | undefined>;
|
|
62
62
|
fillMode: PropTypes.Requireable<"flat" | "solid" | "outline" | undefined>;
|
|
63
63
|
autoFocus: PropTypes.Requireable<boolean>;
|
|
64
64
|
inputAttributes: PropTypes.Requireable<object>;
|
|
@@ -92,6 +92,7 @@ export declare class MaskedTextBoxWithoutContext extends React.Component<MaskedT
|
|
|
92
92
|
private _selection;
|
|
93
93
|
private _input;
|
|
94
94
|
private _valueDuringOnChange?;
|
|
95
|
+
private KendoPasteSubscription?;
|
|
95
96
|
/**
|
|
96
97
|
* @hidden
|
|
97
98
|
*/
|
|
@@ -151,6 +152,11 @@ export declare class MaskedTextBoxWithoutContext extends React.Component<MaskedT
|
|
|
151
152
|
* @hidden
|
|
152
153
|
*/
|
|
153
154
|
componentDidMount(): void;
|
|
155
|
+
/**
|
|
156
|
+
* @hidden
|
|
157
|
+
*/
|
|
158
|
+
componentWillUnmount(): void;
|
|
159
|
+
private readonly handleKendoPasteValue;
|
|
154
160
|
/**
|
|
155
161
|
* @hidden
|
|
156
162
|
*/
|
|
@@ -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"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),t=require("prop-types"),E=require("./masking.service.js"),h=require("./utils.js"),a=require("@progress/kendo-react-common"),M=require("@progress/kendo-react-labels");function V(p){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const s in p)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(p,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>p[s]})}}return e.default=p,Object.freeze(e)}const u=V(O),o=class o extends u.Component{constructor(){super(...arguments),this.state={},this._inputId=`k_${this.props.id}`,this._service=new E.MaskingService,this._isPasted=!1,this._selection=[null,null],this._input=null,this.focus=()=>{this._input&&this._input.focus()},this.handleKendoPasteValue=e=>{const s=e!=null?String(e):"",i={target:this._input,currentTarget:this._input,nativeEvent:new Event("change",{bubbles:!0})};this.triggerOnChange(s,i)},this.pasteHandler=e=>{const{selectionStart:s,selectionEnd:i}=e.target;i!==s&&(this._isPasted=!0,this._selection=[s||0,i||0])},this.onChangeHandler=e=>{const s=e.currentTarget,i=s.value,r=this._selection[0]||0,l=this._selection[1]||0;if(!this.props.mask){this._isPasted=!1,this._selection=[null,null],this.triggerOnChange(i,e);return}const n=this.value;let d;if(this._isPasted){this._isPasted=!1;const c=n.length-l,v=i.length-c;d=this._service.maskInRange(i.slice(r,v),n,r,l)}else d=this._service.maskInput(i,n,s.selectionStart||0);this._selection=[d.selection,d.selection],this.triggerOnChange(d.value,e)},this.focusHandler=e=>{this.state.focused||(this.setState({focused:!0}),this.props.onFocus&&this.props.onFocus.call(void 0,{target:this,syntheticEvent:e,nativeEvent:e.nativeEvent}))},this.blurHandler=e=>{this.state.focused&&(this.setState({focused:!1}),this.props.onBlur&&this.props.onBlur.call(void 0,{target:this,syntheticEvent:e,nativeEvent:e.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 e=this.value,s=this._service.validationValue(e),i=this.props.validationMessage!==void 0,r=this.props.valid!==void 0?this.props.valid:(!this.required||!!s)&&(!this.props.maskValidation||!this.props.prompt||e.indexOf(this.props.prompt)===-1);return{customError:i,valid:r,valueMissing:!s}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:o.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get name(){return this.props.name}componentDidUpdate(e,s){if(this.element&&this.state.focused&&s.focused){let[i,r]=this._selection;const l=e.selection,n=this.props.selection;(!l&&n||l&&n&&(l.start!==n.start||l.end!==n.end))&&(i=n.start,r=n.end),i!==null&&r!==null&&this.element.setSelectionRange(i,r)}h.maskingChanged(e,this.props)&&this.updateService(),this.setValidity()}componentDidMount(){this.updateService(),this.setValidity();const e=this.props.name||this.props.id;this.KendoPasteSubscription=a.subscribeToKendoPaste(this._input,{fieldName:e,onValueChange:s=>{this.handleKendoPasteValue(s)}})}componentWillUnmount(){var e;(e=this.KendoPasteSubscription)==null||e.unsubscribe()}render(){const{size:e=o.defaultProps.size,fillMode:s=o.defaultProps.fillMode,rounded:i=o.defaultProps.rounded,autoFocus:r=o.defaultProps.autoFocus,prefix:l=o.defaultProps.prefix,suffix:n=o.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||{},x=c&&c.uMaskedTextBox,[_]=a.useCustomComponent(l),[C]=a.useCustomComponent(n),y=u.createElement("span",{dir:this.props.dir,className:a.classNames("k-input","k-maskedtextbox",{[`k-input-${a.kendoThemeMaps.sizeMap[e]||e}`]:e,[`k-input-${s}`]:s,[`k-rounded-${a.kendoThemeMaps.roundedMap[i]||i}`]:i,"k-invalid":!m,"k-disabled":this.props.disabled},v),style:this.props.label?b:{width:this.props.width,...b}},u.createElement(_,null),u.createElement("input",{type:"text",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",autoFocus:r,spellCheck:!1,className:a.classNames(a.uMaskedTextBox.inputInner({c:x})),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:a.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}),u.createElement(C,null));return this.props.label?u.createElement(M.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(e,s){if(this.setState({value:e}),this.props.onChange){this._valueDuringOnChange=e;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(e){const s=Object.assign({includeLiterals:this.props.includeLiterals,mask:this.props.mask,prompt:this.props.prompt,promptPlaceholder:this.props.promptPlaceholder,rules:this.rules},e);this._service.update(s)}get rules(){return Object.assign({},h.defaultRules,this.props.rules)}};o.displayName="MaskedTextBox",o.propTypes={value:t.string,defaultValue:t.string,placeholder:t.string,title:t.string,dir:t.string,id:t.string,style:t.object,className:t.string,prefix:t.any,suffix:t.any,ariaLabelledBy:t.string,ariaDescribedBy:t.string,width:t.oneOfType([t.string,t.number]),tabIndex:t.number,accessKey:t.string,disabled:t.bool,readonly:t.bool,prompt:t.string,promptPlaceholder:t.string,includeLiterals:t.bool,maskValidation:t.bool,mask:t.string,rules:function(e,s,i){const r=e.rules;return r!==void 0&&!Object.entries(r).some(n=>typeof n!="string"||!(r[n]instanceof RegExp))?new Error("Invalid prop `"+s+"` supplied to `"+i+"`. Validation failed."):null},selection:t.shape({start:t.number.isRequired,end:t.number.isRequired}),name:t.string,label:t.node,validationMessage:t.string,required:t.bool,valid:t.bool,validityStyles:t.bool,onChange:t.func,size:t.oneOf(["small","medium","large"]),rounded:t.oneOf(["small","medium","large","full","none"]),fillMode:t.oneOf(["solid","flat","outline"]),autoFocus:t.bool,inputAttributes:t.object},o.defaultProps={prompt:"_",promptPlaceholder:" ",includeLiterals:!1,maskValidation:!0,rules:h.defaultRules,validityStyles:!0,prefix:e=>null,suffix:e=>null,size:void 0,rounded:void 0,fillMode:void 0,autoFocus:!1};let f=o;const k=a.createPropsContext(),P=a.withIdHOC(a.withPropsContext(k,a.withUnstyledHOC(f)));P.displayName="KendoReactMaskedTextBox";exports.MaskedTextBox=P;exports.MaskedTextBoxPropsContext=k;exports.MaskedTextBoxWithoutContext=f;
|