@progress/kendo-react-inputs 13.4.0-develop.4 → 14.0.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.js +1 -1
- package/checkbox/Checkbox.mjs +133 -118
- package/colors/ColorPalette.d.ts +20 -81
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +207 -181
- package/colors/interfaces/ColorPaletteChangeEvent.d.ts +2 -2
- package/colors/interfaces/ColorPaletteHandle.d.ts +46 -0
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +2 -1
- package/index.d.ts +2 -1
- package/input/Input.js +1 -1
- package/input/Input.mjs +120 -101
- package/maskedtextbox/MaskedTextBox.d.ts +6 -0
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +82 -61
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +251 -227
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +109 -90
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +131 -115
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +77 -62
|
@@ -5,34 +5,41 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
8
|
+
import * as p from "react";
|
|
9
9
|
import e from "prop-types";
|
|
10
10
|
import { MaskingService as E } from "./masking.service.mjs";
|
|
11
|
-
import { defaultRules as
|
|
12
|
-
import { withIdHOC as
|
|
11
|
+
import { defaultRules as m, maskingChanged as V, returnFalse as b } from "./utils.mjs";
|
|
12
|
+
import { withIdHOC as O, withPropsContext as M, createPropsContext as I, withUnstyledHOC as w, subscribeToKendoPaste as D, useCustomComponent as y, classNames as _, kendoThemeMaps as P, getTabIndex as H, uMaskedTextBox as T } from "@progress/kendo-react-common";
|
|
13
13
|
import { FloatingLabel as q } from "@progress/kendo-react-labels";
|
|
14
|
-
const
|
|
14
|
+
const n = class n extends p.Component {
|
|
15
15
|
constructor() {
|
|
16
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
|
+
}, this.handleKendoPasteValue = (t) => {
|
|
19
|
+
const s = t != null ? String(t) : "", i = {
|
|
20
|
+
target: this._input,
|
|
21
|
+
currentTarget: this._input,
|
|
22
|
+
nativeEvent: new Event("change", { bubbles: !0 })
|
|
23
|
+
};
|
|
24
|
+
this.triggerOnChange(s, i);
|
|
18
25
|
}, this.pasteHandler = (t) => {
|
|
19
|
-
const { selectionStart:
|
|
20
|
-
|
|
26
|
+
const { selectionStart: s, selectionEnd: i } = t.target;
|
|
27
|
+
i !== s && (this._isPasted = !0, this._selection = [s || 0, i || 0]);
|
|
21
28
|
}, this.onChangeHandler = (t) => {
|
|
22
|
-
const
|
|
29
|
+
const s = t.currentTarget, i = s.value, a = this._selection[0] || 0, l = this._selection[1] || 0;
|
|
23
30
|
if (!this.props.mask) {
|
|
24
|
-
this._isPasted = !1, this._selection = [null, null], this.triggerOnChange(
|
|
31
|
+
this._isPasted = !1, this._selection = [null, null], this.triggerOnChange(i, t);
|
|
25
32
|
return;
|
|
26
33
|
}
|
|
27
34
|
const r = this.value;
|
|
28
|
-
let
|
|
35
|
+
let o;
|
|
29
36
|
if (this._isPasted) {
|
|
30
37
|
this._isPasted = !1;
|
|
31
|
-
const
|
|
32
|
-
|
|
38
|
+
const d = r.length - l, u = i.length - d;
|
|
39
|
+
o = this._service.maskInRange(i.slice(a, u), r, a, l);
|
|
33
40
|
} else
|
|
34
|
-
|
|
35
|
-
this._selection = [
|
|
41
|
+
o = this._service.maskInput(i, r, s.selectionStart || 0);
|
|
42
|
+
this._selection = [o.selection, o.selection], this.triggerOnChange(o.value, t);
|
|
36
43
|
}, this.focusHandler = (t) => {
|
|
37
44
|
this.state.focused || (this.setState({ focused: !0 }), this.props.onFocus && this.props.onFocus.call(void 0, {
|
|
38
45
|
target: this,
|
|
@@ -90,18 +97,18 @@ const l = class l extends d.Component {
|
|
|
90
97
|
* Represents the validity state into which the MaskedTextBox is set.
|
|
91
98
|
*/
|
|
92
99
|
get validity() {
|
|
93
|
-
const t = this.value,
|
|
100
|
+
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);
|
|
94
101
|
return {
|
|
95
|
-
customError:
|
|
102
|
+
customError: i,
|
|
96
103
|
valid: a,
|
|
97
|
-
valueMissing: !
|
|
104
|
+
valueMissing: !s
|
|
98
105
|
};
|
|
99
106
|
}
|
|
100
107
|
/**
|
|
101
108
|
* @hidden
|
|
102
109
|
*/
|
|
103
110
|
get validityStyles() {
|
|
104
|
-
return this.props.validityStyles !== void 0 ? this.props.validityStyles :
|
|
111
|
+
return this.props.validityStyles !== void 0 ? this.props.validityStyles : n.defaultProps.validityStyles;
|
|
105
112
|
}
|
|
106
113
|
/**
|
|
107
114
|
* @hidden
|
|
@@ -118,35 +125,49 @@ const l = class l extends d.Component {
|
|
|
118
125
|
/**
|
|
119
126
|
* @hidden
|
|
120
127
|
*/
|
|
121
|
-
componentDidUpdate(t,
|
|
122
|
-
if (this.element && this.state.focused &&
|
|
123
|
-
let [
|
|
124
|
-
const
|
|
125
|
-
(!
|
|
128
|
+
componentDidUpdate(t, s) {
|
|
129
|
+
if (this.element && this.state.focused && s.focused) {
|
|
130
|
+
let [i, a] = this._selection;
|
|
131
|
+
const l = t.selection, r = this.props.selection;
|
|
132
|
+
(!l && r || l && r && (l.start !== r.start || l.end !== r.end)) && (i = r.start, a = r.end), i !== null && a !== null && this.element.setSelectionRange(i, a);
|
|
126
133
|
}
|
|
127
|
-
|
|
134
|
+
V(t, this.props) && this.updateService(), this.setValidity();
|
|
128
135
|
}
|
|
129
136
|
/**
|
|
130
137
|
* @hidden
|
|
131
138
|
*/
|
|
132
139
|
componentDidMount() {
|
|
133
140
|
this.updateService(), this.setValidity();
|
|
141
|
+
const t = this.props.name || this.props.id;
|
|
142
|
+
this.KendoPasteSubscription = D(this._input, {
|
|
143
|
+
fieldName: t,
|
|
144
|
+
onValueChange: (s) => {
|
|
145
|
+
this.handleKendoPasteValue(s);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @hidden
|
|
151
|
+
*/
|
|
152
|
+
componentWillUnmount() {
|
|
153
|
+
var t;
|
|
154
|
+
(t = this.KendoPasteSubscription) == null || t.unsubscribe();
|
|
134
155
|
}
|
|
135
156
|
/**
|
|
136
157
|
* @hidden
|
|
137
158
|
*/
|
|
138
159
|
render() {
|
|
139
160
|
const {
|
|
140
|
-
size: t =
|
|
141
|
-
fillMode:
|
|
142
|
-
rounded:
|
|
143
|
-
autoFocus: a =
|
|
144
|
-
prefix:
|
|
145
|
-
suffix: r =
|
|
146
|
-
inputAttributes:
|
|
147
|
-
unstyled:
|
|
161
|
+
size: t = n.defaultProps.size,
|
|
162
|
+
fillMode: s = n.defaultProps.fillMode,
|
|
163
|
+
rounded: i = n.defaultProps.rounded,
|
|
164
|
+
autoFocus: a = n.defaultProps.autoFocus,
|
|
165
|
+
prefix: l = n.defaultProps.prefix,
|
|
166
|
+
suffix: r = n.defaultProps.suffix,
|
|
167
|
+
inputAttributes: o,
|
|
168
|
+
unstyled: d,
|
|
148
169
|
className: u
|
|
149
|
-
} = this.props, c = this.props.id || this._inputId, f = !this.validityStyles || this.validity.valid, v = this.props.style || {},
|
|
170
|
+
} = this.props, c = this.props.id || this._inputId, f = !this.validityStyles || this.validity.valid, v = this.props.style || {}, k = d && d.uMaskedTextBox, [C] = y(l), [x] = y(r), g = /* @__PURE__ */ p.createElement(
|
|
150
171
|
"span",
|
|
151
172
|
{
|
|
152
173
|
dir: this.props.dir,
|
|
@@ -154,9 +175,9 @@ const l = class l extends d.Component {
|
|
|
154
175
|
"k-input",
|
|
155
176
|
"k-maskedtextbox",
|
|
156
177
|
{
|
|
157
|
-
[`k-input-${
|
|
158
|
-
[`k-input-${
|
|
159
|
-
[`k-rounded-${
|
|
178
|
+
[`k-input-${P.sizeMap[t] || t}`]: t,
|
|
179
|
+
[`k-input-${s}`]: s,
|
|
180
|
+
[`k-rounded-${P.roundedMap[i] || i}`]: i,
|
|
160
181
|
"k-invalid": !f,
|
|
161
182
|
"k-disabled": this.props.disabled
|
|
162
183
|
},
|
|
@@ -164,8 +185,8 @@ const l = class l extends d.Component {
|
|
|
164
185
|
),
|
|
165
186
|
style: this.props.label ? v : { width: this.props.width, ...v }
|
|
166
187
|
},
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ p.createElement(C, null),
|
|
189
|
+
/* @__PURE__ */ p.createElement(
|
|
169
190
|
"input",
|
|
170
191
|
{
|
|
171
192
|
type: "text",
|
|
@@ -174,7 +195,7 @@ const l = class l extends d.Component {
|
|
|
174
195
|
autoCapitalize: "off",
|
|
175
196
|
autoFocus: a,
|
|
176
197
|
spellCheck: !1,
|
|
177
|
-
className: _(
|
|
198
|
+
className: _(T.inputInner({ c: k })),
|
|
178
199
|
value: this.value,
|
|
179
200
|
id: c,
|
|
180
201
|
"aria-labelledby": this.props.ariaLabelledBy,
|
|
@@ -182,7 +203,7 @@ const l = class l extends d.Component {
|
|
|
182
203
|
"aria-placeholder": this.props.mask,
|
|
183
204
|
"aria-required": this.props.required,
|
|
184
205
|
name: this.props.name,
|
|
185
|
-
tabIndex:
|
|
206
|
+
tabIndex: H(this.props.tabIndex, this.props.disabled, !0),
|
|
186
207
|
accessKey: this.props.accessKey,
|
|
187
208
|
title: this.props.title,
|
|
188
209
|
disabled: this.props.disabled || void 0,
|
|
@@ -195,14 +216,14 @@ const l = class l extends d.Component {
|
|
|
195
216
|
onPaste: this.pasteHandler,
|
|
196
217
|
onFocus: this.focusHandler,
|
|
197
218
|
onBlur: this.blurHandler,
|
|
198
|
-
onDragStart:
|
|
199
|
-
onDrop:
|
|
200
|
-
...
|
|
219
|
+
onDragStart: b,
|
|
220
|
+
onDrop: b,
|
|
221
|
+
...o
|
|
201
222
|
}
|
|
202
223
|
),
|
|
203
|
-
/* @__PURE__ */
|
|
224
|
+
/* @__PURE__ */ p.createElement(x, null)
|
|
204
225
|
);
|
|
205
|
-
return this.props.label ? /* @__PURE__ */
|
|
226
|
+
return this.props.label ? /* @__PURE__ */ p.createElement(
|
|
206
227
|
q,
|
|
207
228
|
{
|
|
208
229
|
label: this.props.label,
|
|
@@ -211,30 +232,30 @@ const l = class l extends d.Component {
|
|
|
211
232
|
editorValid: f,
|
|
212
233
|
editorDisabled: this.props.disabled,
|
|
213
234
|
editorPlaceholder: this.props.placeholder,
|
|
214
|
-
children:
|
|
235
|
+
children: g,
|
|
215
236
|
style: { width: this.props.width },
|
|
216
237
|
dir: this.props.dir
|
|
217
238
|
}
|
|
218
|
-
) :
|
|
239
|
+
) : g;
|
|
219
240
|
}
|
|
220
|
-
triggerOnChange(t,
|
|
241
|
+
triggerOnChange(t, s) {
|
|
221
242
|
if (this.setState({
|
|
222
243
|
value: t
|
|
223
244
|
}), this.props.onChange) {
|
|
224
245
|
this._valueDuringOnChange = t;
|
|
225
|
-
const
|
|
226
|
-
syntheticEvent:
|
|
227
|
-
nativeEvent:
|
|
246
|
+
const i = {
|
|
247
|
+
syntheticEvent: s,
|
|
248
|
+
nativeEvent: s.nativeEvent,
|
|
228
249
|
selectionStart: this._selection[0],
|
|
229
250
|
selectionEnd: this._selection[1],
|
|
230
251
|
target: this,
|
|
231
252
|
value: this.value
|
|
232
253
|
};
|
|
233
|
-
this.props.onChange.call(void 0,
|
|
254
|
+
this.props.onChange.call(void 0, i), this._valueDuringOnChange = void 0;
|
|
234
255
|
}
|
|
235
256
|
}
|
|
236
257
|
updateService(t) {
|
|
237
|
-
const
|
|
258
|
+
const s = Object.assign(
|
|
238
259
|
{
|
|
239
260
|
includeLiterals: this.props.includeLiterals,
|
|
240
261
|
mask: this.props.mask,
|
|
@@ -244,13 +265,13 @@ const l = class l extends d.Component {
|
|
|
244
265
|
},
|
|
245
266
|
t
|
|
246
267
|
);
|
|
247
|
-
this._service.update(
|
|
268
|
+
this._service.update(s);
|
|
248
269
|
}
|
|
249
270
|
get rules() {
|
|
250
|
-
return Object.assign({},
|
|
271
|
+
return Object.assign({}, m, this.props.rules);
|
|
251
272
|
}
|
|
252
273
|
};
|
|
253
|
-
|
|
274
|
+
n.displayName = "MaskedTextBox", n.propTypes = {
|
|
254
275
|
value: e.string,
|
|
255
276
|
defaultValue: e.string,
|
|
256
277
|
placeholder: e.string,
|
|
@@ -273,10 +294,10 @@ l.displayName = "MaskedTextBox", l.propTypes = {
|
|
|
273
294
|
includeLiterals: e.bool,
|
|
274
295
|
maskValidation: e.bool,
|
|
275
296
|
mask: e.string,
|
|
276
|
-
rules: function(t,
|
|
297
|
+
rules: function(t, s, i) {
|
|
277
298
|
const a = t.rules;
|
|
278
299
|
return a !== void 0 && !Object.entries(a).some((r) => typeof r != "string" || !(a[r] instanceof RegExp)) ? new Error(
|
|
279
|
-
"Invalid prop `" +
|
|
300
|
+
"Invalid prop `" + s + "` supplied to `" + i + "`. Validation failed."
|
|
280
301
|
) : null;
|
|
281
302
|
},
|
|
282
303
|
selection: e.shape({
|
|
@@ -295,12 +316,12 @@ l.displayName = "MaskedTextBox", l.propTypes = {
|
|
|
295
316
|
fillMode: e.oneOf(["solid", "flat", "outline"]),
|
|
296
317
|
autoFocus: e.bool,
|
|
297
318
|
inputAttributes: e.object
|
|
298
|
-
},
|
|
319
|
+
}, n.defaultProps = {
|
|
299
320
|
prompt: "_",
|
|
300
321
|
promptPlaceholder: " ",
|
|
301
322
|
includeLiterals: !1,
|
|
302
323
|
maskValidation: !0,
|
|
303
|
-
rules:
|
|
324
|
+
rules: m,
|
|
304
325
|
validityStyles: !0,
|
|
305
326
|
prefix: (t) => null,
|
|
306
327
|
suffix: (t) => null,
|
|
@@ -309,8 +330,8 @@ l.displayName = "MaskedTextBox", l.propTypes = {
|
|
|
309
330
|
fillMode: void 0,
|
|
310
331
|
autoFocus: !1
|
|
311
332
|
};
|
|
312
|
-
let h =
|
|
313
|
-
const B = I(), F =
|
|
333
|
+
let h = n;
|
|
334
|
+
const B = I(), F = O(
|
|
314
335
|
M(
|
|
315
336
|
B,
|
|
316
337
|
w(h)
|
|
@@ -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 $e=require("react"),t=require("prop-types"),ge=require("@progress/kendo-react-intl"),i=require("@progress/kendo-react-common"),pe=require("@progress/kendo-svg-icons"),Ue=require("@progress/kendo-react-labels"),p=require("../messages/index.js"),u=require("./utils/index.js"),ve=require("@progress/kendo-react-buttons");function We(g){const L=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(g){for(const k in g)if(k!=="default"){const B=Object.getOwnPropertyDescriptor(g,k);Object.defineProperty(L,k,B.get?B:{enumerable:!0,get:()=>g[k]})}}return L.default=g,Object.freeze(L)}const n=We($e),Ye="Please enter a valid value!",Ve=i.createPropsContext(),Q=n.forwardRef((g,L)=>{const k=i.usePropsContext(Ve,g),{className:B,value:E,defaultValue:ye,format:s,width:X,tabIndex:ke,accessKey:Ce,title:Se,placeholder:Z,min:f,max:b,dir:ee,name:q,label:T,id:te,ariaDescribedBy:Ee,ariaLabelledBy:he,ariaLabel:xe,inputType:Oe,readOnly:C,validationMessage:w,children:Ie,touched:Je,visited:Qe,modified:Xe,style:ne,inputStyle:Le,valid:H,step:h=m.step,spinners:Pe=m.spinners,disabled:l=m.disabled,required:F=m.required,validityStyles:re=m.validityStyles,prefix:Ne=m.prefix,suffix:De=m.suffix,onChange:O=m.onChange,onFocus:ae=m.onFocus,onBlur:se=m.onBlur,rangeOnEnter:ue=m.rangeOnEnter,size:P=m.size,rounded:$=m.rounded,fillMode:M=m.fillMode,autoFocus:Re=m.autoFocus,inputAttributes:Be,...oe}=k,qe=i.useId(),le=te||qe,o=ge.useInternationalization(),j=ge.useLocalization(),a=n.useRef(null),z=n.useRef(void 0),[Te,I]=n.useState(!1),d=n.useRef(u.getInitialState()),A=n.useRef(!1),U=n.useRef(void 0),N=n.useRef(ye),ce=q||te,D=u.formatValue(d.current.focused&&!l?d.current.currentLooseValue:u.getStateOrPropsValue(E,N.current),s,o);U.current=D;const[Fe]=i.useCustomComponent(Ne),[Me]=i.useCustomComponent(De);n.useEffect(()=>{a.current&&a.current.setCustomValidity&&a.current.setCustomValidity(K().valid?"":w||Ye)});const ie=n.useCallback(()=>{a.current&&a.current.focus()},[]),_=n.useCallback(()=>z.current!==void 0?z.current:u.getStateOrPropsValue(E,N.current),[E]),de=n.useCallback(()=>q,[q]),G=n.useCallback(()=>F,[F]),K=n.useCallback(()=>{const r=w!==void 0,e=_(),V=H!==void 0?H:!d.current.valueIsOutOfRange&&(!G()||e!=null);return{customError:r,valid:V,valueMissing:e==null}},[w,H,_,G]),W=n.useCallback(()=>re,[re]),me=n.useCallback(()=>k,[k]),x=n.useCallback(()=>{const r={element:a.current,focus:ie};return Object.defineProperty(r,"name",{get:de}),Object.defineProperty(r,"value",{get:_}),Object.defineProperty(r,"validity",{get:K}),Object.defineProperty(r,"validityStyles",{get:W}),Object.defineProperty(r,"required",{get:G}),Object.defineProperty(r,"props",{get:me}),r},[de,_,K,W,G,ie,me]);n.useImperativeHandle(L,x);const S=n.useCallback(()=>({eventValue:u.getStateOrPropsValue(E,N.current),prevLooseValue:U.current,currentLooseValue:a.current.value,selectionStart:a.current.selectionStart,selectionEnd:a.current.selectionEnd,decimalSelect:!1,valueIsCorrected:!1,valueIsOutOfRange:!1,isPaste:A.current,focused:d.current.focused}),[E]),v=n.useCallback((r,e)=>{if(l)return;z.current=e.eventValue,N.current=e.eventValue;const V=u.formatValue(u.rangeValue(e.eventValue,f,b),s,o),c=u.rangeValue(o.parseNumber(V,s),f,b);c!==e.eventValue&&(e.valueIsOutOfRange=!0,e.eventValue=c,N.current=c),E!==e.eventValue&&i.dispatchEvent(O,r,x(),{value:e.eventValue}),z.current=void 0,d.current=e,I(R=>!R)},[E,O,l,I,x]),je=n.useCallback(r=>{const e=Number(r);if(isNaN(e))return;const V=u.rangeValue(e,f,b),c=u.formatValue(V,s,o),y={...d.current,eventValue:V,currentLooseValue:c,selectionStart:c.length,selectionEnd:c.length},R={target:a.current,currentTarget:a.current};v(R,y)},[f,b,s,o,v]);i.useKendoPaste(a,{fieldName:ce,onValueChange:je,enabled:!!ce});const ze=n.useCallback(r=>{const e=S();A.current=!1,v(r,u.sanitizeNumber(e,s,o))},[s,O,o,v,S]),Ae=n.useCallback(r=>{if(C||l)return;let e=S();const V=o.parseNumber(String(e.currentLooseValue),s);if(e.selectionEnd>e.selectionStart&&e.selectionEnd-e.selectionStart===String(e.currentLooseValue).length){const c=o.numberSymbols(),y=c&&r.key===c.minusSign,R=c&&r.key===c.decimal;A.current=!y&&!R;return}switch(r.keyCode){case 38:u.increaseValue(V,e,h,f,b,s,o);break;case 40:u.decreaseValue(V,e,h,f,b,s,o);break;case 13:{if(ue===!1)return;const c=u.formatValue(u.rangeValue(V,f,b),s,o),y=u.rangeValue(o.parseNumber(c,s),f,b);e.eventValue=y,e.currentLooseValue=u.formatValue(y,s,o),e.selectionStart=e.selectionEnd=e.currentLooseValue.length;break}case 110:{const c=a.current,y=o.numberSymbols();c&&(e.currentLooseValue=e.currentLooseValue.slice(0,e.selectionStart)+y.decimal+e.currentLooseValue.slice(e.selectionEnd),e.selectionStart=e.selectionEnd=e.selectionStart+1,e=u.sanitizeNumber(e,s,o));break}default:return}r.preventDefault(),v(r,e)},[s,f,b,h,O,ue,v,S]),_e=n.useCallback(()=>{A.current=!0},[]),Y=n.useCallback(r=>{if(C||l)return;const e=S();u.increaseValue(o.parseNumber(String(e.currentLooseValue),s),e,h,f,b,s,o),v(r,e)},[s,f,b,h,O,C,l,v,S]),J=n.useCallback(r=>{if(C||l)return;const e=S();u.decreaseValue(o.parseNumber(String(e.currentLooseValue),s),e,h,f,b,s,o),v(r,e)},[s,f,b,h,O,C,l,v,S]),Ge=n.useCallback(r=>{const e=i.getActiveElement(document);!document||e!==a.current||!a.current||C||l||(r.nativeEvent.deltaY<0&&Y(r),r.nativeEvent.deltaY>0&&J(r))},[Y,J,l,C]),Ke=n.useCallback(r=>{d.current.currentLooseValue=U.current,d.current.focused=!0,i.dispatchEvent(ae,r,x(),{}),I(e=>!e)},[ae,I,x]),we=n.useCallback(r=>{d.current=u.getInitialState(),i.dispatchEvent(se,r,x(),{}),I(e=>!e)},[se,I,x]),He=n.useCallback(r=>{if(document&&a.current){const e=i.getActiveElement(document);r.preventDefault(),e!==a.current&&a.current.focus()}},[]);i.useIsomorphicLayoutEffect(()=>{a.current&&a.current.type!=="number"&&d.current.selectionStart!==void 0&&d.current.selectionEnd!==void 0&&(a.current.selectionStart=d.current.selectionStart,a.current.selectionEnd=d.current.selectionEnd,d.current.selectionStart=void 0,d.current.selectionEnd=void 0)},[Te]);const fe=!W()||K().valid,be=n.createElement("span",{dir:ee,style:T?ne:{width:X,...ne},className:i.classNames("k-input","k-numerictextbox",{[`k-input-${i.kendoThemeMaps.sizeMap[P]||P}`]:P,[`k-input-${M}`]:M,[`k-rounded-${i.kendoThemeMaps.roundedMap[$]||$}`]:$,"k-invalid":!fe,"k-required":F,"k-disabled":l},B),"aria-disabled":l?"true":void 0,...T?{}:oe},n.createElement(Fe,null),n.createElement("input",{role:"spinbutton",value:D===null?"":D,tabIndex:i.getTabIndex(ke,l),accessKey:Ce,disabled:l,title:Se,"aria-disabled":l?"true":void 0,"aria-valuemin":f,"aria-valuemax":b,"aria-label":xe,"aria-labelledby":he,"aria-describedby":Ee,"aria-required":F,placeholder:Z,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:Re,type:Oe||"tel",className:"k-input-inner",id:le,name:q,readOnly:C,style:Le,onChange:ze,onFocus:Ke,onBlur:we,onKeyDown:Ae,onPaste:_e,onWheel:Ge,ref:a,...Be}),n.createElement(Me,null),Ie,Pe&&n.createElement("span",{className:"k-input-spinner k-spin-button",onMouseDown:He},n.createElement(ve.Button,{tabIndex:-1,type:"button",icon:"caret-alt-up",svgIcon:pe.caretAltUpIcon,fillMode:M,size:P,className:"k-spinner-increase","aria-label":j.toLanguageString(p.numericIncreaseValue,p.messages[p.numericIncreaseValue]),title:j.toLanguageString(p.numericIncreaseValue,p.messages[p.numericIncreaseValue]),onClick:Y}),n.createElement(ve.Button,{tabIndex:-1,type:"button",icon:"caret-alt-down",svgIcon:pe.caretAltDownIcon,fillMode:M,size:P,className:"k-spinner-decrease","aria-label":j.toLanguageString(p.numericDecreaseValue,p.messages[p.numericDecreaseValue]),title:j.toLanguageString(p.numericDecreaseValue,p.messages[p.numericDecreaseValue]),onClick:J})));return T?n.createElement(Ue.FloatingLabel,{label:T,editorId:le,editorValue:D===null?"":D,editorValid:fe,editorDisabled:l,editorPlaceholder:Z,children:be,style:{width:X},dir:ee,...oe}):be});Q.propTypes={value:t.number,defaultValue:t.number,step:t.number,format:t.oneOfType([t.string,t.shape({style:t.oneOf(["decimal","currency","percent","scientific","accounting"]),currency:t.string,currencyDisplay:t.oneOf(["symbol","code","name"]),useGrouping:t.bool,minimumIntegerDigits:t.number,minimumFractionDigits:t.number,maximumFractionDigits:t.number})]),width:t.oneOfType([t.string,t.number]),tabIndex:t.number,accessKey:t.string,title:t.string,placeholder:t.string,min:t.number,max:t.number,spinners:t.bool,disabled:t.bool,readOnly:t.bool,dir:t.string,name:t.string,label:t.string,validationMessage:t.string,required:t.bool,id:t.string,rangeOnEnter:t.bool,ariaLabelledBy:t.string,ariaDescribedBy:t.string,ariaLabel:t.string,onChange:t.func,onFocus:t.func,onBlur:t.func,size:t.oneOf(["small","medium","large"]),rounded:t.oneOf(["small","medium","large","full","none"]),fillMode:t.oneOf(["solid","flat","outline"]),inputAttributes:t.object};const m={prefix:g=>null,suffix:g=>null,step:1,spinners:!0,disabled:!1,required:!1,validityStyles:!0,rangeOnEnter:!0,autoFocus:!1,onChange:g=>{},onFocus:g=>{},onBlur:g=>{},size:void 0,rounded:void 0,fillMode:void 0};Q.displayName="KendoNumericTextBox";exports.NumericTextBox=Q;exports.NumericTextBoxPropsContext=Ve;
|