@progress/kendo-react-inputs 15.1.1-develop.3 → 15.2.0-develop.2
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 +72 -70
- package/colors/ColorContrastLabels.js +1 -1
- package/colors/ColorContrastLabels.mjs +2 -2
- package/colors/ColorGradient.js +1 -1
- package/colors/ColorGradient.mjs +51 -52
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +71 -72
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +203 -195
- package/colors/FlatColorPicker.d.ts +4 -4
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +30 -26
- package/colors/interfaces/ColorPaletteProps.d.ts +7 -0
- package/colors/interfaces/ColorPickerPaletteSettings.d.ts +5 -0
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/maskedtextbox/MaskedTextBox.d.ts +1 -0
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +26 -23
- package/maskedtextbox/MaskedTextBoxProps.d.ts +7 -0
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +2 -2
- package/otpinput/OTPInput.js +1 -1
- package/otpinput/OTPInput.mjs +141 -143
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
- package/radiobutton/RadioButton.js +1 -1
- package/radiobutton/RadioButton.mjs +32 -30
- package/range-slider/RangeSlider.js +11 -11
- package/range-slider/RangeSlider.mjs +54 -54
- package/rating/Rating.d.ts +12 -0
- package/rating/Rating.js +2 -2
- package/rating/Rating.mjs +91 -92
- package/slider/Slider.d.ts +12 -0
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +69 -64
- package/switch/Switch.d.ts +15 -0
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +87 -82
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +11 -12
|
@@ -33,6 +33,7 @@ export declare class MaskedTextBoxWithoutContext extends React.Component<MaskedT
|
|
|
33
33
|
className: PropTypes.Requireable<string>;
|
|
34
34
|
prefix: PropTypes.Requireable<any>;
|
|
35
35
|
suffix: PropTypes.Requireable<any>;
|
|
36
|
+
ariaLabel: PropTypes.Requireable<string>;
|
|
36
37
|
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
37
38
|
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
38
39
|
width: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
@@ -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"),t=require("prop-types"),E=require("./masking.service.js"),h=require("./utils.js"),
|
|
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"),n=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 a=this.value;let d;if(this._isPasted){this._isPasted=!1;const c=a.length-l,v=i.length-c;d=this._service.maskInRange(i.slice(r,v),a,r,l)}else d=this._service.maskInput(i,a,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,a=this.props.selection;(!l&&a||l&&a&&(l.start!==a.start||l.end!==a.end))&&(i=a.start,r=a.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=n.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:a=o.defaultProps.suffix,inputAttributes:d,unstyled:c,className:v}=this.props,m=this.props.id||this._inputId,g=!this.validityStyles||this.validity.valid,b=this.props.style||{},x=c&&c.uMaskedTextBox,[_]=n.useCustomComponent(l),[C]=n.useCustomComponent(a),y=u.createElement("span",{dir:this.props.dir,className:n.classNames("k-input","k-maskedtextbox",{[`k-input-${n.kendoThemeMaps.sizeMap[e]||e}`]:e,[`k-input-${s}`]:s,[`k-rounded-${n.kendoThemeMaps.roundedMap[i]||i}`]:i,"k-invalid":!g,"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:n.classNames(n.uMaskedTextBox.inputInner({c:x})),value:this.value,id:m,"aria-label":this.props.ariaLabel,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-placeholder":this.props.mask,"aria-required":this.props.required,"aria-invalid":g?void 0:"true",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}),u.createElement(C,null));return this.props.label?u.createElement(M.FloatingLabel,{label:this.props.label,editorId:m,editorValue:this.value,editorValid:g,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,ariaLabel:t.string,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(a=>typeof a!="string"||!(r[a]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=n.createPropsContext(),P=n.withIdHOC(n.withPropsContext(k,n.withUnstyledHOC(f)));P.displayName="KendoReactMaskedTextBox";exports.MaskedTextBox=P;exports.MaskedTextBoxPropsContext=k;exports.MaskedTextBoxWithoutContext=f;
|
|
@@ -26,19 +26,19 @@ const n = class n extends p.Component {
|
|
|
26
26
|
const { selectionStart: s, selectionEnd: i } = t.target;
|
|
27
27
|
i !== s && (this._isPasted = !0, this._selection = [s || 0, i || 0]);
|
|
28
28
|
}, this.onChangeHandler = (t) => {
|
|
29
|
-
const s = t.currentTarget, i = s.value,
|
|
29
|
+
const s = t.currentTarget, i = s.value, r = this._selection[0] || 0, l = this._selection[1] || 0;
|
|
30
30
|
if (!this.props.mask) {
|
|
31
31
|
this._isPasted = !1, this._selection = [null, null], this.triggerOnChange(i, t);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const a = this.value;
|
|
35
35
|
let o;
|
|
36
36
|
if (this._isPasted) {
|
|
37
37
|
this._isPasted = !1;
|
|
38
|
-
const d =
|
|
39
|
-
o = this._service.maskInRange(i.slice(
|
|
38
|
+
const d = a.length - l, u = i.length - d;
|
|
39
|
+
o = this._service.maskInRange(i.slice(r, u), a, r, l);
|
|
40
40
|
} else
|
|
41
|
-
o = this._service.maskInput(i,
|
|
41
|
+
o = this._service.maskInput(i, a, s.selectionStart || 0);
|
|
42
42
|
this._selection = [o.selection, o.selection], this.triggerOnChange(o.value, t);
|
|
43
43
|
}, this.focusHandler = (t) => {
|
|
44
44
|
this.state.focused || (this.setState({ focused: !0 }), this.props.onFocus && this.props.onFocus.call(void 0, {
|
|
@@ -97,10 +97,10 @@ const n = class n extends p.Component {
|
|
|
97
97
|
* Represents the validity state into which the MaskedTextBox is set.
|
|
98
98
|
*/
|
|
99
99
|
get validity() {
|
|
100
|
-
const t = this.value, s = this._service.validationValue(t), i = this.props.validationMessage !== void 0,
|
|
100
|
+
const t = this.value, s = this._service.validationValue(t), i = this.props.validationMessage !== void 0, r = this.props.valid !== void 0 ? this.props.valid : (!this.required || !!s) && (!this.props.maskValidation || !this.props.prompt || t.indexOf(this.props.prompt) === -1);
|
|
101
101
|
return {
|
|
102
102
|
customError: i,
|
|
103
|
-
valid:
|
|
103
|
+
valid: r,
|
|
104
104
|
valueMissing: !s
|
|
105
105
|
};
|
|
106
106
|
}
|
|
@@ -127,9 +127,9 @@ const n = class n extends p.Component {
|
|
|
127
127
|
*/
|
|
128
128
|
componentDidUpdate(t, s) {
|
|
129
129
|
if (this.element && this.state.focused && s.focused) {
|
|
130
|
-
let [i,
|
|
131
|
-
const l = t.selection,
|
|
132
|
-
(!l &&
|
|
130
|
+
let [i, r] = this._selection;
|
|
131
|
+
const l = t.selection, a = this.props.selection;
|
|
132
|
+
(!l && a || l && a && (l.start !== a.start || l.end !== a.end)) && (i = a.start, r = a.end), i !== null && r !== null && this.element.setSelectionRange(i, r);
|
|
133
133
|
}
|
|
134
134
|
V(t, this.props) && this.updateService(), this.setValidity();
|
|
135
135
|
}
|
|
@@ -161,13 +161,13 @@ const n = class n extends p.Component {
|
|
|
161
161
|
size: t = n.defaultProps.size,
|
|
162
162
|
fillMode: s = n.defaultProps.fillMode,
|
|
163
163
|
rounded: i = n.defaultProps.rounded,
|
|
164
|
-
autoFocus:
|
|
164
|
+
autoFocus: r = n.defaultProps.autoFocus,
|
|
165
165
|
prefix: l = n.defaultProps.prefix,
|
|
166
|
-
suffix:
|
|
166
|
+
suffix: a = n.defaultProps.suffix,
|
|
167
167
|
inputAttributes: o,
|
|
168
168
|
unstyled: d,
|
|
169
169
|
className: u
|
|
170
|
-
} = this.props,
|
|
170
|
+
} = this.props, f = this.props.id || this._inputId, h = !this.validityStyles || this.validity.valid, v = this.props.style || {}, k = d && d.uMaskedTextBox, [C] = y(l), [x] = y(a), g = /* @__PURE__ */ p.createElement(
|
|
171
171
|
"span",
|
|
172
172
|
{
|
|
173
173
|
dir: this.props.dir,
|
|
@@ -178,7 +178,7 @@ const n = class n extends p.Component {
|
|
|
178
178
|
[`k-input-${_.sizeMap[t] || t}`]: t,
|
|
179
179
|
[`k-input-${s}`]: s,
|
|
180
180
|
[`k-rounded-${_.roundedMap[i] || i}`]: i,
|
|
181
|
-
"k-invalid": !
|
|
181
|
+
"k-invalid": !h,
|
|
182
182
|
"k-disabled": this.props.disabled
|
|
183
183
|
},
|
|
184
184
|
u
|
|
@@ -193,15 +193,17 @@ const n = class n extends p.Component {
|
|
|
193
193
|
autoComplete: "off",
|
|
194
194
|
autoCorrect: "off",
|
|
195
195
|
autoCapitalize: "off",
|
|
196
|
-
autoFocus:
|
|
196
|
+
autoFocus: r,
|
|
197
197
|
spellCheck: !1,
|
|
198
198
|
className: P(H.inputInner({ c: k })),
|
|
199
199
|
value: this.value,
|
|
200
|
-
id:
|
|
200
|
+
id: f,
|
|
201
|
+
"aria-label": this.props.ariaLabel,
|
|
201
202
|
"aria-labelledby": this.props.ariaLabelledBy,
|
|
202
203
|
"aria-describedby": this.props.ariaDescribedBy,
|
|
203
204
|
"aria-placeholder": this.props.mask,
|
|
204
205
|
"aria-required": this.props.required,
|
|
206
|
+
"aria-invalid": h ? void 0 : "true",
|
|
205
207
|
name: this.props.name,
|
|
206
208
|
tabIndex: D(this.props.tabIndex, this.props.disabled, !0),
|
|
207
209
|
accessKey: this.props.accessKey,
|
|
@@ -227,9 +229,9 @@ const n = class n extends p.Component {
|
|
|
227
229
|
q,
|
|
228
230
|
{
|
|
229
231
|
label: this.props.label,
|
|
230
|
-
editorId:
|
|
232
|
+
editorId: f,
|
|
231
233
|
editorValue: this.value,
|
|
232
|
-
editorValid:
|
|
234
|
+
editorValid: h,
|
|
233
235
|
editorDisabled: this.props.disabled,
|
|
234
236
|
editorPlaceholder: this.props.placeholder,
|
|
235
237
|
children: g,
|
|
@@ -282,6 +284,7 @@ n.displayName = "MaskedTextBox", n.propTypes = {
|
|
|
282
284
|
className: e.string,
|
|
283
285
|
prefix: e.any,
|
|
284
286
|
suffix: e.any,
|
|
287
|
+
ariaLabel: e.string,
|
|
285
288
|
ariaLabelledBy: e.string,
|
|
286
289
|
ariaDescribedBy: e.string,
|
|
287
290
|
width: e.oneOfType([e.string, e.number]),
|
|
@@ -295,8 +298,8 @@ n.displayName = "MaskedTextBox", n.propTypes = {
|
|
|
295
298
|
maskValidation: e.bool,
|
|
296
299
|
mask: e.string,
|
|
297
300
|
rules: function(t, s, i) {
|
|
298
|
-
const
|
|
299
|
-
return
|
|
301
|
+
const r = t.rules;
|
|
302
|
+
return r !== void 0 && !Object.entries(r).some((a) => typeof a != "string" || !(r[a] instanceof RegExp)) ? new Error(
|
|
300
303
|
"Invalid prop `" + s + "` supplied to `" + i + "`. Validation failed."
|
|
301
304
|
) : null;
|
|
302
305
|
},
|
|
@@ -330,16 +333,16 @@ n.displayName = "MaskedTextBox", n.propTypes = {
|
|
|
330
333
|
fillMode: void 0,
|
|
331
334
|
autoFocus: !1
|
|
332
335
|
};
|
|
333
|
-
let
|
|
336
|
+
let c = n;
|
|
334
337
|
const B = T(), F = O(
|
|
335
338
|
M(
|
|
336
339
|
B,
|
|
337
|
-
I(
|
|
340
|
+
I(c)
|
|
338
341
|
)
|
|
339
342
|
);
|
|
340
343
|
F.displayName = "KendoReactMaskedTextBox";
|
|
341
344
|
export {
|
|
342
345
|
F as MaskedTextBox,
|
|
343
346
|
B as MaskedTextBoxPropsContext,
|
|
344
|
-
|
|
347
|
+
c as MaskedTextBoxWithoutContext
|
|
345
348
|
};
|
|
@@ -154,6 +154,13 @@ export interface MaskedTextBoxProps extends FormComponentProps {
|
|
|
154
154
|
* This property is related to accessibility.
|
|
155
155
|
*/
|
|
156
156
|
ariaDescribedBy?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Sets the accessible label text of the component.
|
|
159
|
+
*
|
|
160
|
+
* @remarks
|
|
161
|
+
* This property is related to accessibility.
|
|
162
|
+
*/
|
|
163
|
+
ariaLabel?: string;
|
|
157
164
|
/**
|
|
158
165
|
* Identifies the element(s) which will label the component.
|
|
159
166
|
*
|
|
@@ -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 Ye=require("react"),t=require("prop-types"),Ve=require("@progress/kendo-react-intl"),l=require("@progress/kendo-react-common"),ye=require("@progress/kendo-svg-icons"),Je=require("@progress/kendo-react-labels"),g=require("../messages/index.js"),s=require("./utils/index.js"),ke=require("@progress/kendo-react-buttons");function Qe(
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ye=require("react"),t=require("prop-types"),Ve=require("@progress/kendo-react-intl"),l=require("@progress/kendo-react-common"),ye=require("@progress/kendo-svg-icons"),Je=require("@progress/kendo-react-labels"),g=require("../messages/index.js"),s=require("./utils/index.js"),ke=require("@progress/kendo-react-buttons");function Qe(b){const P=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(b){for(const v in b)if(v!=="default"){const M=Object.getOwnPropertyDescriptor(b,v);Object.defineProperty(P,v,M.get?M:{enumerable:!0,get:()=>b[v]})}}return P.default=b,Object.freeze(P)}const n=Qe(Ye),Xe="Please enter a valid value!",Ce=l.createPropsContext(),Z=n.forwardRef((b,P)=>{const v=l.usePropsContext(Ce,b),{className:M,value:h,defaultValue:Se,format:u,width:ee,tabIndex:Ee,accessKey:he,title:xe,placeholder:te,min:f,max:p,dir:I,name:q,label:T,id:ne,ariaDescribedBy:Ie,ariaLabelledBy:Oe,ariaLabel:Le,inputType:Pe,readOnly:C,validationMessage:K,children:Ne,touched:Ze,visited:et,modified:tt,style:re,inputStyle:De,valid:$,step:x=m.step,spinners:U=m.spinners,disabled:c=m.disabled,required:F=m.required,validityStyles:ae=m.validityStyles,prefix:Re=m.prefix,suffix:Be=m.suffix,onChange:O=m.onChange,onFocus:ue=m.onFocus,onBlur:se=m.onBlur,rangeOnEnter:oe=m.rangeOnEnter,size:N=m.size,rounded:W=m.rounded,fillMode:j=m.fillMode,autoFocus:Me=m.autoFocus,inputAttributes:qe,...le}=v,Te=l.useId(),ce=ne||Te,o=Ve.useInternationalization(),z=Ve.useLocalization(),a=n.useRef(null),_=n.useRef(void 0),[Fe,L]=n.useState(!1),d=n.useRef(s.getInitialState()),G=n.useRef(!1),Y=n.useRef(void 0),D=n.useRef(Se),ie=q||ne,R=s.formatValue(d.current.focused&&!c?d.current.currentLooseValue:s.getStateOrPropsValue(h,D.current),u,o);Y.current=R;const[je]=l.useCustomComponent(Re),[ze]=l.useCustomComponent(Be);n.useEffect(()=>{a.current&&a.current.setCustomValidity&&a.current.setCustomValidity(H().valid?"":K||Xe)});const de=n.useCallback(()=>{a.current&&a.current.focus()},[]),A=n.useCallback(()=>_.current!==void 0?_.current:s.getStateOrPropsValue(h,D.current),[h]),me=n.useCallback(()=>q,[q]),w=n.useCallback(()=>F,[F]),H=n.useCallback(()=>{const r=K!==void 0,e=A(),y=$!==void 0?$:!d.current.valueIsOutOfRange&&(!w()||e!=null);return{customError:r,valid:y,valueMissing:e==null}},[K,$,A,w]),J=n.useCallback(()=>ae,[ae]),fe=n.useCallback(()=>v,[v]),S=n.useCallback(()=>{const r={element:a.current,focus:de};return Object.defineProperty(r,"name",{get:me}),Object.defineProperty(r,"value",{get:A}),Object.defineProperty(r,"validity",{get:H}),Object.defineProperty(r,"validityStyles",{get:J}),Object.defineProperty(r,"required",{get:w}),Object.defineProperty(r,"props",{get:fe}),r},[me,A,H,J,w,de,fe]);n.useImperativeHandle(P,S);const pe=n.useRef(null);n.useImperativeHandle(pe,S),l.useWebMcpRegister("numerictextbox",pe,v,v.webMcp);const E=n.useCallback(()=>({eventValue:s.getStateOrPropsValue(h,D.current),prevLooseValue:Y.current,currentLooseValue:a.current.value,selectionStart:a.current.selectionStart,selectionEnd:a.current.selectionEnd,decimalSelect:!1,valueIsCorrected:!1,valueIsOutOfRange:!1,isPaste:G.current,focused:d.current.focused}),[h]),V=n.useCallback((r,e)=>{if(c)return;_.current=e.eventValue,D.current=e.eventValue;const y=s.formatValue(s.rangeValue(e.eventValue,f,p),u,o),i=s.rangeValue(o.parseNumber(y,u),f,p);i!==e.eventValue&&(e.valueIsOutOfRange=!0,e.eventValue=i,D.current=i),h!==e.eventValue&&l.dispatchEvent(O,r,S(),{value:e.eventValue}),_.current=void 0,d.current=e,L(B=>!B)},[h,O,c,L,S]),_e=n.useCallback(r=>{const e=Number(r);if(isNaN(e))return;const y=s.rangeValue(e,f,p),i=s.formatValue(y,u,o),k={...d.current,eventValue:y,currentLooseValue:i,selectionStart:i.length,selectionEnd:i.length},B={target:a.current,currentTarget:a.current};V(B,k)},[f,p,u,o,V]);l.useKendoPaste(a,{fieldName:ie,onValueChange:_e,enabled:!!ie});const Ge=n.useCallback(r=>{const e=E();G.current=!1,V(r,s.sanitizeNumber(e,u,o))},[u,O,o,V,E]),Ae=n.useCallback(r=>{if(C||c)return;let e=E();const y=o.parseNumber(String(e.currentLooseValue),u);if(e.selectionEnd>e.selectionStart&&e.selectionEnd-e.selectionStart===String(e.currentLooseValue).length){const i=o.numberSymbols(),k=i&&r.key===i.minusSign,B=i&&r.key===i.decimal;G.current=!k&&!B;return}switch(r.keyCode){case 38:s.increaseValue(y,e,x,f,p,u,o);break;case 40:s.decreaseValue(y,e,x,f,p,u,o);break;case 13:{if(oe===!1)return;const i=s.formatValue(s.rangeValue(y,f,p),u,o),k=s.rangeValue(o.parseNumber(i,u),f,p);e.eventValue=k,e.currentLooseValue=s.formatValue(k,u,o),e.selectionStart=e.selectionEnd=e.currentLooseValue.length;break}case 110:{const i=a.current,k=o.numberSymbols();i&&(e.currentLooseValue=e.currentLooseValue.slice(0,e.selectionStart)+k.decimal+e.currentLooseValue.slice(e.selectionEnd),e.selectionStart=e.selectionEnd=e.selectionStart+1,e=s.sanitizeNumber(e,u,o));break}default:return}r.preventDefault(),V(r,e)},[u,f,p,x,O,oe,V,E]),we=n.useCallback(()=>{G.current=!0},[]),Q=n.useCallback(r=>{if(C||c)return;const e=E();s.increaseValue(o.parseNumber(String(e.currentLooseValue),u),e,x,f,p,u,o),V(r,e)},[u,f,p,x,O,C,c,V,E]),X=n.useCallback(r=>{if(C||c)return;const e=E();s.decreaseValue(o.parseNumber(String(e.currentLooseValue),u),e,x,f,p,u,o),V(r,e)},[u,f,p,x,O,C,c,V,E]),He=n.useCallback(r=>{const e=l.getActiveElement(document);!document||e!==a.current||!a.current||C||c||(r.nativeEvent.deltaY<0&&Q(r),r.nativeEvent.deltaY>0&&X(r))},[Q,X,c,C]),Ke=n.useCallback(r=>{d.current.currentLooseValue=Y.current,d.current.focused=!0,l.dispatchEvent(ue,r,S(),{}),L(e=>!e)},[ue,L,S]),$e=n.useCallback(r=>{d.current=s.getInitialState(),l.dispatchEvent(se,r,S(),{}),L(e=>!e)},[se,L,S]),Ue=n.useCallback(r=>{if(document&&a.current){const e=l.getActiveElement(document);r.preventDefault(),e!==a.current&&a.current.focus()}},[]);l.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)},[Fe]);const[We,be]=n.useState(I);l.useIsomorphicLayoutEffect(()=>{if(I!==void 0)be(I);else if(a.current&&a.current.parentElement){const r=getComputedStyle(a.current.parentElement).direction;be(r==="rtl"?"rtl":void 0)}},[I]);const ge=!J()||H().valid,ve=n.createElement("span",{dir:I,style:T?re:{width:ee,...re},className:l.classNames("k-input","k-numerictextbox",{[`k-input-${l.kendoThemeMaps.sizeMap[N]||N}`]:N,[`k-input-${j}`]:j,[`k-rounded-${l.kendoThemeMaps.roundedMap[W]||W}`]:W,"k-invalid":!ge,"k-required":F,"k-disabled":c},M),...T?{}:le},n.createElement(je,null),n.createElement("input",{role:"spinbutton",value:R===null?"":R,tabIndex:l.getTabIndex(Ee,c),accessKey:he,disabled:c,title:xe,"aria-valuemin":U?f:void 0,"aria-valuemax":U?p:void 0,"aria-label":Le,"aria-labelledby":Oe,"aria-describedby":Ie,"aria-required":F||void 0,placeholder:te,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:Me,type:Pe||"tel",className:"k-input-inner",id:ce,name:q,readOnly:C,style:De,dir:We,onChange:Ge,onFocus:Ke,onBlur:$e,onKeyDown:Ae,onPaste:we,onWheel:He,ref:a,...qe}),n.createElement(ze,null),Ne,U&&n.createElement("span",{className:"k-input-spinner k-spin-button",onMouseDown:Ue},n.createElement(ke.Button,{tabIndex:-1,type:"button",icon:"chevron-up",svgIcon:ye.chevronUpIcon,fillMode:j,size:N,disabled:c,className:"k-spinner-increase","aria-label":z.toLanguageString(g.numericIncreaseValue,g.messages[g.numericIncreaseValue]),title:z.toLanguageString(g.numericIncreaseValue,g.messages[g.numericIncreaseValue]),onClick:Q}),n.createElement(ke.Button,{tabIndex:-1,type:"button",icon:"chevron-down",svgIcon:ye.chevronDownIcon,fillMode:j,size:N,disabled:c,className:"k-spinner-decrease","aria-label":z.toLanguageString(g.numericDecreaseValue,g.messages[g.numericDecreaseValue]),title:z.toLanguageString(g.numericDecreaseValue,g.messages[g.numericDecreaseValue]),onClick:X})));return T?n.createElement(Je.FloatingLabel,{label:T,editorId:ce,editorValue:R===null?"":R,editorValid:ge,editorDisabled:c,editorPlaceholder:te,children:ve,style:{width:ee},dir:I,...le}):ve});Z.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:b=>null,suffix:b=>null,step:1,spinners:!0,disabled:!1,required:!1,validityStyles:!0,rangeOnEnter:!0,autoFocus:!1,onChange:b=>{},onFocus:b=>{},onBlur:b=>{},size:void 0,rounded:void 0,fillMode:void 0};Z.displayName="KendoNumericTextBox";exports.NumericTextBox=Z;exports.NumericTextBoxPropsContext=Ce;
|
|
@@ -271,7 +271,6 @@ const gt = "Please enter a valid value!", vt = mt(), Oe = n.forwardRef(
|
|
|
271
271
|
},
|
|
272
272
|
Pe
|
|
273
273
|
),
|
|
274
|
-
"aria-disabled": u ? "true" : void 0,
|
|
275
274
|
...F ? {} : ie
|
|
276
275
|
},
|
|
277
276
|
/* @__PURE__ */ n.createElement(We, null),
|
|
@@ -284,7 +283,6 @@ const gt = "Please enter a valid value!", vt = mt(), Oe = n.forwardRef(
|
|
|
284
283
|
accessKey: Fe,
|
|
285
284
|
disabled: u,
|
|
286
285
|
title: Be,
|
|
287
|
-
"aria-disabled": u ? "true" : void 0,
|
|
288
286
|
"aria-valuemin": W ? d : void 0,
|
|
289
287
|
"aria-valuemax": W ? m : void 0,
|
|
290
288
|
"aria-label": ze,
|
|
@@ -324,6 +322,7 @@ const gt = "Please enter a valid value!", vt = mt(), Oe = n.forwardRef(
|
|
|
324
322
|
svgIcon: ft,
|
|
325
323
|
fillMode: M,
|
|
326
324
|
size: I,
|
|
325
|
+
disabled: u,
|
|
327
326
|
className: "k-spinner-increase",
|
|
328
327
|
"aria-label": T.toLanguageString(
|
|
329
328
|
H,
|
|
@@ -344,6 +343,7 @@ const gt = "Please enter a valid value!", vt = mt(), Oe = n.forwardRef(
|
|
|
344
343
|
svgIcon: pt,
|
|
345
344
|
fillMode: M,
|
|
346
345
|
size: I,
|
|
346
|
+
disabled: u,
|
|
347
347
|
className: "k-spinner-decrease",
|
|
348
348
|
"aria-label": T.toLanguageString(
|
|
349
349
|
_,
|
package/otpinput/OTPInput.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 fe=require("react"),M=require("@progress/kendo-react-common"),me=require("./OTPInputCell.js"),he=require("./OTPInputSeparator.js");function be(o){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const f in o)if(f!=="default"){const m=Object.getOwnPropertyDescriptor(o,f);Object.defineProperty(d,f,m.get?m:{enumerable:!0,get:()=>o[f]})}}return d.default=o,Object.freeze(d)}const a=be(fe),ge=4;function Ce(o,d){if(Array.isArray(d)){const C=d.reduce((E,w)=>E+w,0);return C!==o&&console.warn(`[OTPInput] The sum of groupLength values (${C}) must equal length (${o}).`),d}const f=[];let m=o;for(;m>0;)f.push(Math.min(d,m)),m-=d;return f}const L=a.forwardRef((o,d)=>{const{value:f,defaultValue:m,length:C,groupLength:E,separator:w,type:b,placeholder:H,spacing:F,disabled:N,readOnly:_,inputAttributes:G,name:O,required:U,valid:P,size:T,fillMode:W,rounded:J,onChange:$,onFocus:I,onBlur:S,ariaLabel:Q,ariaLabelledBy:X,ariaDescribedBy:Y,id:A,style:Z,dir:B,className:x,touched:ve,visited:ye,modified:ke,validationMessage:_e,...ee}=o,u=C!=null?C:ge,V=f!==void 0,[te,re]=a.useState(()=>(m!=null?m:"").padEnd(u," ").slice(0,u)),l=(V?f:te).padEnd(u," ").slice(0,u),j=a.useRef(l);j.current=l;const[ae,q]=a.useState(null),v=a.useRef(null),y=a.useCallback(e=>{v.current!==null&&clearTimeout(v.current),q(e),v.current=setTimeout(()=>{q(null),v.current=null},300)},[]);a.useEffect(()=>()=>{v.current!==null&&clearTimeout(v.current)},[]);const z=a.useRef(null),R=a.useRef([]),k=a.useRef(null),i=a.useCallback(e=>{var n;const t=Math.max(0,Math.min(e,u-1));(n=R.current[t])==null||n.focus()},[u]),h=a.useCallback((e,t)=>{const n=e.padEnd(u," ").slice(0,u);n!==l&&(j.current=n,V||re(n),$&&$({syntheticEvent:t,nativeEvent:t.nativeEvent,target:k.current,value:n}))},[V,u,$,l]),ne=a.useCallback((e,t,n)=>{const r=n.target.value.slice(-1);if(!r)return;if(b==="number"&&!/^\d$/.test(r)){y(e);const g=l[e]===" "?"":l[e];n.target.value=g,n.target.select();return}const p=j.current.split("");p[e]=r;const s=p.join("");h(s,n),i(e+1)},[l,h,i,b,y]),K=a.useCallback((e,t,n)=>{if(n.preventDefault(),b==="number"&&!/^\d$/.test(t)){y(e),n.target.select();return}const c=l.split("");c[e]=t,h(c.join(""),n),i(e+1)},[b,y,l,h,i]),le=a.useCallback((e,t)=>{var c;if(_)return;const n=B==="rtl";switch(t.key){case"ArrowLeft":{t.preventDefault(),i(n?e+1:e-1);break}case"ArrowRight":{t.preventDefault(),i(n?e-1:e+1);break}case"ArrowUp":case"ArrowDown":{t.preventDefault();break}case"Backspace":{t.preventDefault();const r=l.split("");r[e]=" ",h(r.join(""),t),i(e-1);break}case"Delete":{t.preventDefault();const r=l.split("");r[e]=" ",h(r.join(""),t);break}default:{const{key:r,ctrlKey:p,altKey:s,metaKey:g}=t,D=(c=l[e])!=null?c:" ";r.length===1&&!p&&!s&&!g&&D!==" "&&K(e,r,t);break}}},[l,h,i,B,_,K]),se=a.useCallback((e,t)=>{I&&I({syntheticEvent:t,nativeEvent:t.nativeEvent,target:k.current,cellIndex:e})},[I]),ue=a.useCallback((e,t)=>{},[]),{onFocus:ce,onBlur:oe}=M.useAsyncFocusBlur({onFocus:e=>{},onBlur:e=>{S&&S({syntheticEvent:e,nativeEvent:e.nativeEvent,target:k.current})}}),ie=a.useCallback(e=>{if(e.preventDefault(),_)return;const t=e.clipboardData.getData("text");if(!t)return;const n=R.current.findIndex(s=>s===document.activeElement),c=n>=0?n:0;if(b==="number"&&!/^\d+$/.test(t.trim())){y(c);return}const r=l.split("");for(let s=0;s<t.length&&c+s<u;s++)r[c+s]=t[s];h(r.join(""),e);const p=Math.min(c+t.length,u-1);i(p)},[l,h,i,u,b,y,_]);a.useImperativeHandle(k,()=>({get element(){return z.current},get value(){return l},focus(e){if(e!==void 0)i(e);else{const t=l.indexOf(" ");i(t>=0?t:u-1)}},blur(){R.current.forEach(e=>e==null?void 0:e.blur())}})),a.useImperativeHandle(d,()=>k.current),M.useWebMcpRegister("otpinput",k,o,o.webMcp);const pe=()=>{const e=r=>{var p;return a.createElement(me.OTPInputCell,{key:r,ref:s=>{R.current[r]=s},index:r,totalLength:u,char:(p=l[r])!=null?p:" ",type:b,placeholder:H,disabled:N,readOnly:_,required:U,size:T,fillMode:W,rounded:J,inputAttributes:G,valid:P===!1||ae===r?!1:P,onCellChange:ne,onCellKeyDown:le,onCellFocus:se,onCellBlur:ue,name:O?`${O}-cell-${r}`:`otp-cell-${r}`,id:A?`${A}-cell-${r}`:`otp-cell-${r}`})};if(!E){const r=Array.from({length:u},(p,s)=>e(s));return F===!1?[a.createElement("div",{key:"group",className:"k-input-group"},r)]:r}const t=Ce(u,E);let n=0;const c=[];return t.forEach((r,p)=>{const s=n;p>0&&w!==void 0&&c.push(a.createElement(he.OTPInputSeparator,{key:`sep-${s}`,separator:w}));const g=[];for(let D=0;D<r;D++)g.push(e(n++));F===!1?c.push(a.createElement("div",{key:`group-${s}`,className:"k-input-group"},g)):c.push(...g)}),c},de=M.classNames("k-otp",{"k-disabled":N,"k-invalid":P===!1,[`k-otp-${M.kendoThemeMaps.sizeMap[T]||T}`]:T},x);return a.createElement("div",{ref:z,className:de,role:"group","aria-label":Q,"aria-labelledby":X,"aria-describedby":Y,id:A,style:Z,dir:B,onFocus:ce,onBlur:oe,onPaste:ie,...ee},O&&a.createElement("input",{"aria-hidden":!0,type:"hidden",name:O,value:l.replace(/ /g,"")}),pe())});L.displayName="KendoReactOTPInput";exports.OTPInput=L;
|