@progress/kendo-react-inputs 9.5.0 → 10.0.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/index.d.mts CHANGED
@@ -431,6 +431,7 @@ export declare class ColorGradientWithoutContext extends React_2.Component<Color
431
431
  private alphaSlider;
432
432
  private navigation?;
433
433
  private hsvNavigation?;
434
+ private readonly showLicenseWatermark;
434
435
  constructor(props: ColorGradientProps);
435
436
  /**
436
437
  * @hidden
@@ -1998,7 +1999,6 @@ export declare class MaskedTextBoxWithoutContext extends React_2.Component<Maske
1998
1999
  private _selection;
1999
2000
  private _input;
2000
2001
  private _valueDuringOnChange?;
2001
- constructor(props: MaskedTextBoxProps);
2002
2002
  /**
2003
2003
  * @hidden
2004
2004
  */
package/index.d.ts CHANGED
@@ -431,6 +431,7 @@ export declare class ColorGradientWithoutContext extends React_2.Component<Color
431
431
  private alphaSlider;
432
432
  private navigation?;
433
433
  private hsvNavigation?;
434
+ private readonly showLicenseWatermark;
434
435
  constructor(props: ColorGradientProps);
435
436
  /**
436
437
  * @hidden
@@ -1998,7 +1999,6 @@ export declare class MaskedTextBoxWithoutContext extends React_2.Component<Maske
1998
1999
  private _selection;
1999
2000
  private _input;
2000
2001
  private _valueDuringOnChange?;
2001
- constructor(props: MaskedTextBoxProps);
2002
2002
  /**
2003
2003
  * @hidden
2004
2004
  */
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 W=require("react"),a=require("prop-types"),l=require("@progress/kendo-react-common"),X=require("@progress/kendo-react-labels"),Y=require("../package-metadata.js");function Z(s){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const u in s)if(u!=="default"){const c=Object.getOwnPropertyDescriptor(s,u);Object.defineProperty(o,u,c.get?c:{enumerable:!0,get:()=>s[u]})}}return o.default=s,Object.freeze(o)}const r=Z(W),m=r.forwardRef((s,o)=>{const c=r.useContext(O).call(void 0,s);l.validatePackage(Y.packageMetadata);const[,R]=r.useReducer(t=>t,!0),n=l.applyDefaultProps(c,$),{className:N,label:p,labelClassName:x,id:E,validationMessage:h,defaultValue:S,valid:C,unstyled:V,visited:ee,touched:te,modified:ae,autoFocus:q,ariaLabelledBy:w,ariaDescribedBy:D,validityStyles:I,style:P,ariaLabel:F,...U}=n,j=l.useUnstyled(),f=V||j,B=f&&f.uInput,T=l.useId(),[_,A]=r.useState({value:S}),M=E||T,e=r.useRef(null),d=r.useRef(void 0),y=r.useRef(null),G=()=>{e.current&&e.current.focus()},g=()=>d.current!==void 0?d.current:n.value!==void 0?n.value:_.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:h!==void 0,valid:C!==void 0?C:e.current?!H(t):!0}};r.useImperativeHandle(y,()=>({element:e.current,props:n,get value(){return g()},name:n.name,get validity(){return v()},focus:G})),r.useImperativeHandle(o,()=>y.current);const H=t=>{let i=!1;for(const L in t)t.hasOwnProperty(L)&&(i=i||!!t[L]);return i},b=!I||v().valid,z=l.classNames(N,l.uInput.input({c:B,invalid:!b,disabled:n.disabled})),K=()=>{e.current&&e.current.setCustomValidity&&(v().valid||!I?e.current.classList.remove("k-invalid"):e.current.classList.add("k-invalid"),e.current.setCustomValidity(v().valid?"":h||""))},J=t=>{A({value:t.target.value}),d.current=t.target.value,n.onChange&&n.onChange.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:t.target.value,target:y.current}),d.current=void 0},Q=t=>{if(t.animationName==="autoFillStart"){const i=t.target.parentNode;i&&i.classList.contains("k-empty")&&i.classList.remove("k-empty")}};r.useEffect(()=>{R()},[]),r.useEffect(()=>{K()});const k=r.createElement("input",{"aria-labelledby":w,"aria-describedby":D,"aria-disabled":n.disabled||void 0,"aria-invalid":!b||void 0,"aria-label":F||void 0,...U,style:p?void 0:P,value:g(),id:M,autoFocus:q,className:z,onChange:J,onAnimationStart:Q,ref:e});return p?r.createElement(X.FloatingLabel,{label:p,labelClassName:x,editorId:M,editorValue:String(g()),editorValid:b,editorDisabled:n.disabled,editorPlaceholder:n.placeholder,children:k,style:P,dir:n.dir,unstyled:f}):k}),O=l.createPropsContext(),$={defaultValue:"",required:!1,validityStyles:!0,autoFocus:!1};m.displayName="KendoReactInput";m.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,value:a.oneOfType([a.string,a.number,a.array])};exports.Input=m;exports.InputPropsContext=O;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react"),a=require("prop-types"),l=require("@progress/kendo-react-common"),X=require("@progress/kendo-react-labels");function Y(s){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const u in s)if(u!=="default"){const c=Object.getOwnPropertyDescriptor(s,u);Object.defineProperty(o,u,c.get?c:{enumerable:!0,get:()=>s[u]})}}return o.default=s,Object.freeze(o)}const r=Y(W),m=r.forwardRef((s,o)=>{const c=r.useContext(R).call(void 0,s),[,N]=r.useReducer(t=>t,!0),n=l.applyDefaultProps(c,Z),{className:k,label:p,labelClassName:x,id:E,validationMessage:h,defaultValue:S,valid:C,unstyled:V,visited:$,touched:ee,modified:te,autoFocus:w,ariaLabelledBy:D,ariaDescribedBy:q,validityStyles:I,style:P,ariaLabel:F,...U}=n,j=l.useUnstyled(),f=V||j,B=f&&f.uInput,T=l.useId(),[_,A]=r.useState({value:S}),L=E||T,e=r.useRef(null),d=r.useRef(void 0),y=r.useRef(null),G=()=>{e.current&&e.current.focus()},g=()=>d.current!==void 0?d.current:n.value!==void 0?n.value:_.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:h!==void 0,valid:C!==void 0?C:e.current?!H(t):!0}};r.useImperativeHandle(y,()=>({element:e.current,props:n,get value(){return g()},name:n.name,get validity(){return v()},focus:G})),r.useImperativeHandle(o,()=>y.current);const H=t=>{let i=!1;for(const O in t)t.hasOwnProperty(O)&&(i=i||!!t[O]);return i},b=!I||v().valid,z=l.classNames(k,l.uInput.input({c:B,invalid:!b,disabled:n.disabled})),K=()=>{e.current&&e.current.setCustomValidity&&(v().valid||!I?e.current.classList.remove("k-invalid"):e.current.classList.add("k-invalid"),e.current.setCustomValidity(v().valid?"":h||""))},J=t=>{A({value:t.target.value}),d.current=t.target.value,n.onChange&&n.onChange.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:t.target.value,target:y.current}),d.current=void 0},Q=t=>{if(t.animationName==="autoFillStart"){const i=t.target.parentNode;i&&i.classList.contains("k-empty")&&i.classList.remove("k-empty")}};r.useEffect(()=>{N()},[]),r.useEffect(()=>{K()});const M=r.createElement("input",{"aria-labelledby":D,"aria-describedby":q,"aria-disabled":n.disabled||void 0,"aria-invalid":!b||void 0,"aria-label":F||void 0,...U,style:p?void 0:P,value:g(),id:L,autoFocus:w,className:z,onChange:J,onAnimationStart:Q,ref:e});return p?r.createElement(X.FloatingLabel,{label:p,labelClassName:x,editorId:L,editorValue:String(g()),editorValid:b,editorDisabled:n.disabled,editorPlaceholder:n.placeholder,children:M,style:P,dir:n.dir,unstyled:f}):M}),R=l.createPropsContext(),Z={defaultValue:"",required:!1,validityStyles:!0,autoFocus:!1};m.displayName="KendoReactInput";m.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,value:a.oneOfType([a.string,a.number,a.array])};exports.Input=m;exports.InputPropsContext=R;
package/input/Input.mjs CHANGED
@@ -7,37 +7,34 @@
7
7
  */
8
8
  import * as r from "react";
9
9
  import a from "prop-types";
10
- import { validatePackage as J, applyDefaultProps as Q, useUnstyled as W, useId as X, classNames as Y, uInput as Z, createPropsContext as _ } from "@progress/kendo-react-common";
11
- import { FloatingLabel as $ } from "@progress/kendo-react-labels";
12
- import { packageMetadata as ee } from "../package-metadata.mjs";
10
+ import { applyDefaultProps as J, useUnstyled as Q, useId as W, classNames as X, uInput as Y, createPropsContext as Z } from "@progress/kendo-react-common";
11
+ import { FloatingLabel as _ } from "@progress/kendo-react-labels";
13
12
  const C = r.forwardRef((I, L) => {
14
- const M = r.useContext(te).call(void 0, I);
15
- J(ee);
16
- const [, P] = r.useReducer((t) => t, !0), i = Q(M, ae), {
13
+ const M = r.useContext($).call(void 0, I), [, P] = r.useReducer((t) => t, !0), n = J(M, ee), {
17
14
  className: x,
18
15
  label: o,
19
16
  labelClassName: E,
20
17
  id: N,
21
18
  validationMessage: p,
22
- defaultValue: k,
19
+ defaultValue: R,
23
20
  valid: f,
24
- unstyled: R,
21
+ unstyled: V,
25
22
  // Removed to support direct use in Form Field component
26
- visited: ie,
27
- touched: ne,
28
- modified: se,
29
- autoFocus: V,
23
+ visited: ae,
24
+ touched: re,
25
+ modified: ne,
26
+ autoFocus: k,
30
27
  ariaLabelledBy: w,
31
28
  ariaDescribedBy: F,
32
- validityStyles: m,
33
- style: y,
29
+ validityStyles: y,
30
+ style: m,
34
31
  ariaLabel: U,
35
32
  ...B
36
- } = i, D = W(), u = R || D, O = u && u.uInput, S = X(), [T, q] = r.useState({
37
- value: k
33
+ } = n, D = Q(), u = V || D, O = u && u.uInput, S = W(), [T, q] = r.useState({
34
+ value: R
38
35
  }), g = N || S, e = r.useRef(null), s = r.useRef(void 0), d = r.useRef(null), A = () => {
39
36
  e.current && e.current.focus();
40
- }, c = () => s.current !== void 0 ? s.current : i.value !== void 0 ? i.value : T.value, l = () => {
37
+ }, c = () => s.current !== void 0 ? s.current : n.value !== void 0 ? n.value : T.value, l = () => {
41
38
  const t = {
42
39
  badInput: e.current ? e.current.validity.badInput : !1,
43
40
  patternMismatch: e.current ? e.current.validity.patternMismatch : !1,
@@ -56,34 +53,34 @@ const C = r.forwardRef((I, L) => {
56
53
  };
57
54
  r.useImperativeHandle(d, () => ({
58
55
  element: e.current,
59
- props: i,
56
+ props: n,
60
57
  get value() {
61
58
  return c();
62
59
  },
63
- name: i.name,
60
+ name: n.name,
64
61
  get validity() {
65
62
  return l();
66
63
  },
67
64
  focus: A
68
65
  })), r.useImperativeHandle(L, () => d.current);
69
66
  const G = (t) => {
70
- let n = !1;
67
+ let i = !1;
71
68
  for (const h in t)
72
- t.hasOwnProperty(h) && (n = n || !!t[h]);
73
- return n;
74
- }, v = !m || l().valid, H = Y(
69
+ t.hasOwnProperty(h) && (i = i || !!t[h]);
70
+ return i;
71
+ }, v = !y || l().valid, H = X(
75
72
  x,
76
- Z.input({
73
+ Y.input({
77
74
  c: O,
78
75
  invalid: !v,
79
- disabled: i.disabled
76
+ disabled: n.disabled
80
77
  })
81
78
  ), K = () => {
82
- e.current && e.current.setCustomValidity && (l().valid || !m ? e.current.classList.remove("k-invalid") : e.current.classList.add("k-invalid"), e.current.setCustomValidity(l().valid ? "" : p || ""));
79
+ e.current && e.current.setCustomValidity && (l().valid || !y ? e.current.classList.remove("k-invalid") : e.current.classList.add("k-invalid"), e.current.setCustomValidity(l().valid ? "" : p || ""));
83
80
  }, j = (t) => {
84
81
  q({
85
82
  value: t.target.value
86
- }), s.current = t.target.value, i.onChange && i.onChange.call(void 0, {
83
+ }), s.current = t.target.value, n.onChange && n.onChange.call(void 0, {
87
84
  syntheticEvent: t,
88
85
  nativeEvent: t.nativeEvent,
89
86
  value: t.target.value,
@@ -91,8 +88,8 @@ const C = r.forwardRef((I, L) => {
91
88
  }), s.current = void 0;
92
89
  }, z = (t) => {
93
90
  if (t.animationName === "autoFillStart") {
94
- const n = t.target.parentNode;
95
- n && n.classList.contains("k-empty") && n.classList.remove("k-empty");
91
+ const i = t.target.parentNode;
92
+ i && i.classList.contains("k-empty") && i.classList.remove("k-empty");
96
93
  }
97
94
  };
98
95
  r.useEffect(() => {
@@ -105,14 +102,14 @@ const C = r.forwardRef((I, L) => {
105
102
  {
106
103
  "aria-labelledby": w,
107
104
  "aria-describedby": F,
108
- "aria-disabled": i.disabled || void 0,
105
+ "aria-disabled": n.disabled || void 0,
109
106
  "aria-invalid": !v || void 0,
110
107
  "aria-label": U || void 0,
111
108
  ...B,
112
- style: o ? void 0 : y,
109
+ style: o ? void 0 : m,
113
110
  value: c(),
114
111
  id: g,
115
- autoFocus: V,
112
+ autoFocus: k,
116
113
  className: H,
117
114
  onChange: j,
118
115
  onAnimationStart: z,
@@ -120,22 +117,22 @@ const C = r.forwardRef((I, L) => {
120
117
  }
121
118
  );
122
119
  return o ? /* @__PURE__ */ r.createElement(
123
- $,
120
+ _,
124
121
  {
125
122
  label: o,
126
123
  labelClassName: E,
127
124
  editorId: g,
128
125
  editorValue: String(c()),
129
126
  editorValid: v,
130
- editorDisabled: i.disabled,
131
- editorPlaceholder: i.placeholder,
127
+ editorDisabled: n.disabled,
128
+ editorPlaceholder: n.placeholder,
132
129
  children: b,
133
- style: y,
134
- dir: i.dir,
130
+ style: m,
131
+ dir: n.dir,
135
132
  unstyled: u
136
133
  }
137
134
  ) : b;
138
- }), te = _(), ae = {
135
+ }), $ = Z(), ee = {
139
136
  defaultValue: "",
140
137
  required: !1,
141
138
  validityStyles: !0,
@@ -157,5 +154,5 @@ C.propTypes = {
157
154
  };
158
155
  export {
159
156
  C as Input,
160
- te as InputPropsContext
157
+ $ as InputPropsContext
161
158
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),e=require("prop-types"),M=require("./masking.service.js"),h=require("./utils.js"),n=require("@progress/kendo-react-common"),E=require("@progress/kendo-react-labels"),V=require("../package-metadata.js");function q(p){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const t in p)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(p,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:()=>p[t]})}}return s.default=p,Object.freeze(s)}const u=q(O),l=class l extends u.Component{constructor(s){super(s),this.state={},this._inputId=`k_${this.props.id}`,this._service=new M.MaskingService,this._isPasted=!1,this._selection=[null,null],this._input=null,this.focus=()=>{this._input&&this._input.focus()},this.pasteHandler=t=>{const{selectionStart:i,selectionEnd:a}=t.target;a!==i&&(this._isPasted=!0,this._selection=[i||0,a||0])},this.onChangeHandler=t=>{const i=t.currentTarget,a=i.value,o=this._selection[0]||0,r=this._selection[1]||0;if(!this.props.mask){this._isPasted=!1,this._selection=[null,null],this.triggerOnChange(a,t);return}const c=this.value;let d;if(this._isPasted){this._isPasted=!1;const g=c.length-r,f=a.length-g;d=this._service.maskInRange(a.slice(o,f),c,o,r)}else d=this._service.maskInput(a,c,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||"")},n.validatePackage(V.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,a=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:a,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:!1}get name(){return this.props.name}componentDidUpdate(s,t){if(this.element&&this.state.focused&&t.focused){let[i,a]=this._selection;const o=s.selection,r=this.props.selection;(!o&&r||o&&r&&(o.start!==r.start||o.end!==r.end))&&(i=r.start,a=r.end),i!==null&&a!==null&&this.element.setSelectionRange(i,a)}h.maskingChanged(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:a=l.defaultProps.autoFocus,prefix:o=l.defaultProps.prefix,suffix:r=l.defaultProps.suffix,inputAttributes:c,unstyled:d,className:g}=this.props,f=this.props.id||this._inputId,m=!this.validityStyles||this.validity.valid,b=this.props.style||{},y=d&&d.uMaskedTextBox,[_]=n.useCustomComponent(o),[k]=n.useCustomComponent(r),x=u.createElement("span",{dir:this.props.dir,className:n.classNames(n.uMaskedTextBox.wrapper({c:y,invalid:!m,disabled:this.props.disabled,size:s,fillMode:t,rounded:i}),g),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:a,spellCheck:!1,className:n.classNames(n.uMaskedTextBox.inputInner({c:y})),value:this.value,id:f,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-placeholder":this.props.mask,"aria-required":this.props.required,name:this.props.name,tabIndex:n.getTabIndex(this.props.tabIndex,this.props.disabled,!0),accessKey:this.props.accessKey,title:this.props.title,disabled:this.props.disabled||void 0,readOnly:this.props.readonly||void 0,placeholder:this.props.placeholder,ref:S=>this._input=S,onChange:this.onChangeHandler,onPaste:this.pasteHandler,onFocus:this.focusHandler,onBlur:this.blurHandler,onDragStart:h.returnFalse,onDrop:h.returnFalse,...c}),u.createElement(k,null));return this.props.label?u.createElement(E.FloatingLabel,{label:this.props.label,editorId:f,editorValue:this.value,editorValid:m,editorDisabled:this.props.disabled,editorPlaceholder:this.props.placeholder,children:x,style:{width:this.props.width},dir:this.props.dir}):x}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({},h.defaultRules,this.props.rules)}};l.displayName="MaskedTextBox",l.propTypes={value:e.string,defaultValue:e.string,placeholder:e.string,title:e.string,dir:e.string,id:e.string,style:e.object,className:e.string,prefix:e.any,suffix:e.any,ariaLabelledBy:e.string,ariaDescribedBy:e.string,width:e.oneOfType([e.string,e.number]),tabIndex:e.number,accessKey:e.string,disabled:e.bool,readonly:e.bool,prompt:e.string,promptPlaceholder:e.string,includeLiterals:e.bool,maskValidation:e.bool,mask:e.string,rules:function(s,t,i){const a=s.rules;return a!==void 0&&!Object.entries(a).some(r=>typeof r!="string"||!(a[r]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,inputAttributes:e.object},l.defaultProps={prompt:"_",promptPlaceholder:" ",includeLiterals:!1,maskValidation:!0,rules:h.defaultRules,validityStyles:!0,prefix:s=>null,suffix:s=>null,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let v=l;const C=n.createPropsContext(),P=n.withIdHOC(n.withPropsContext(C,n.withUnstyledHOC(v)));P.displayName="KendoReactMaskedTextBox";exports.MaskedTextBox=P;exports.MaskedTextBoxPropsContext=C;exports.MaskedTextBoxWithoutContext=v;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),e=require("prop-types"),E=require("./masking.service.js"),c=require("./utils.js"),n=require("@progress/kendo-react-common"),M=require("@progress/kendo-react-labels");function V(p){const t=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(t,s,i.get?i:{enumerable:!0,get:()=>p[s]})}}return t.default=p,Object.freeze(t)}const u=V(O),l=class l 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.pasteHandler=t=>{const{selectionStart:s,selectionEnd:i}=t.target;i!==s&&(this._isPasted=!0,this._selection=[s||0,i||0])},this.onChangeHandler=t=>{const s=t.currentTarget,i=s.value,a=this._selection[0]||0,o=this._selection[1]||0;if(!this.props.mask){this._isPasted=!1,this._selection=[null,null],this.triggerOnChange(i,t);return}const r=this.value;let d;if(this._isPasted){this._isPasted=!1;const h=r.length-o,v=i.length-h;d=this._service.maskInRange(i.slice(a,v),r,a,o)}else d=this._service.maskInput(i,r,s.selectionStart||0);this._selection=[d.selection,d.selection],this.triggerOnChange(d.value,t)},this.focusHandler=t=>{this.state.focused||(this.setState({focused:!0}),this.props.onFocus&&this.props.onFocus.call(void 0,{target:this,syntheticEvent:t,nativeEvent:t.nativeEvent}))},this.blurHandler=t=>{this.state.focused&&(this.setState({focused:!1}),this.props.onBlur&&this.props.onBlur.call(void 0,{target:this,syntheticEvent:t,nativeEvent:t.nativeEvent}))},this.setValidity=()=>{this.element&&this.element.setCustomValidity(this.validity.valid?"":this.props.validationMessage||"")}}get element(){return this._input}get value(){return this._valueDuringOnChange!==void 0?this._valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value!==void 0?this.state.value:this.props.defaultValue!==void 0?this.props.defaultValue:""}get rawValue(){return this._service.rawValue(this.value)}get validity(){const t=this.value,s=this._service.validationValue(t),i=this.props.validationMessage!==void 0,a=this.props.valid!==void 0?this.props.valid:(!this.required||!!s)&&(!this.props.maskValidation||!this.props.prompt||t.indexOf(this.props.prompt)===-1);return{customError:i,valid:a,valueMissing:!s}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:l.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get name(){return this.props.name}componentDidUpdate(t,s){if(this.element&&this.state.focused&&s.focused){let[i,a]=this._selection;const o=t.selection,r=this.props.selection;(!o&&r||o&&r&&(o.start!==r.start||o.end!==r.end))&&(i=r.start,a=r.end),i!==null&&a!==null&&this.element.setSelectionRange(i,a)}c.maskingChanged(t,this.props)&&this.updateService(),this.setValidity()}componentDidMount(){this.updateService(),this.setValidity()}render(){const{size:t=l.defaultProps.size,fillMode:s=l.defaultProps.fillMode,rounded:i=l.defaultProps.rounded,autoFocus:a=l.defaultProps.autoFocus,prefix:o=l.defaultProps.prefix,suffix:r=l.defaultProps.suffix,inputAttributes:d,unstyled:h,className:v}=this.props,g=this.props.id||this._inputId,m=!this.validityStyles||this.validity.valid,b=this.props.style||{},y=h&&h.uMaskedTextBox,[P]=n.useCustomComponent(o),[S]=n.useCustomComponent(r),x=u.createElement("span",{dir:this.props.dir,className:n.classNames(n.uMaskedTextBox.wrapper({c:y,invalid:!m,disabled:this.props.disabled,size:t,fillMode:s,rounded:i}),v),style:this.props.label?b:{width:this.props.width,...b}},u.createElement(P,null),u.createElement("input",{type:"text",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",autoFocus:a,spellCheck:!1,className:n.classNames(n.uMaskedTextBox.inputInner({c:y})),value:this.value,id:g,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-placeholder":this.props.mask,"aria-required":this.props.required,name:this.props.name,tabIndex:n.getTabIndex(this.props.tabIndex,this.props.disabled,!0),accessKey:this.props.accessKey,title:this.props.title,disabled:this.props.disabled||void 0,readOnly:this.props.readonly||void 0,placeholder:this.props.placeholder,ref:k=>this._input=k,onChange:this.onChangeHandler,onPaste:this.pasteHandler,onFocus:this.focusHandler,onBlur:this.blurHandler,onDragStart:c.returnFalse,onDrop:c.returnFalse,...d}),u.createElement(S,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:x,style:{width:this.props.width},dir:this.props.dir}):x}triggerOnChange(t,s){if(this.setState({value:t}),this.props.onChange){this._valueDuringOnChange=t;const i={syntheticEvent:s,nativeEvent:s.nativeEvent,selectionStart:this._selection[0],selectionEnd:this._selection[1],target:this,value:this.value};this.props.onChange.call(void 0,i),this._valueDuringOnChange=void 0}}updateService(t){const s=Object.assign({includeLiterals:this.props.includeLiterals,mask:this.props.mask,prompt:this.props.prompt,promptPlaceholder:this.props.promptPlaceholder,rules:this.rules},t);this._service.update(s)}get rules(){return Object.assign({},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(t,s,i){const a=t.rules;return a!==void 0&&!Object.entries(a).some(r=>typeof r!="string"||!(a[r]instanceof RegExp))?new Error("Invalid prop `"+s+"` supplied to `"+i+"`. Validation failed."):null},selection:e.shape({start:e.number.isRequired,end:e.number.isRequired}),name:e.string,label:e.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,inputAttributes:e.object},l.defaultProps={prompt:"_",promptPlaceholder:" ",includeLiterals:!1,maskValidation:!0,rules:c.defaultRules,validityStyles:!0,prefix:t=>null,suffix:t=>null,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let f=l;const C=n.createPropsContext(),_=n.withIdHOC(n.withPropsContext(C,n.withUnstyledHOC(f)));_.displayName="KendoReactMaskedTextBox";exports.MaskedTextBox=_;exports.MaskedTextBoxPropsContext=C;exports.MaskedTextBoxWithoutContext=f;
@@ -7,32 +7,31 @@
7
7
  */
8
8
  import * as p from "react";
9
9
  import e from "prop-types";
10
- import { MaskingService as E } from "./masking.service.mjs";
11
- import { defaultRules as y, maskingChanged as O, returnFalse as b } from "./utils.mjs";
12
- import { validatePackage as V, useCustomComponent as P, classNames as _, uMaskedTextBox as C, getTabIndex as w, createPropsContext as I, withIdHOC as M, withPropsContext as D, withUnstyledHOC as H } from "@progress/kendo-react-common";
13
- import { FloatingLabel as q } from "@progress/kendo-react-labels";
14
- import { packageMetadata as B } from "../package-metadata.mjs";
15
- const l = class l extends p.Component {
16
- constructor(i) {
17
- super(i), this.state = {}, this._inputId = `k_${this.props.id}`, this._service = new E(), this._isPasted = !1, this._selection = [null, null], this._input = null, this.focus = () => {
10
+ import { MaskingService as O } from "./masking.service.mjs";
11
+ import { defaultRules as y, maskingChanged as V, returnFalse as b } from "./utils.mjs";
12
+ import { useCustomComponent as _, classNames as C, uMaskedTextBox as P, getTabIndex as k, createPropsContext as w, withIdHOC as I, withPropsContext as M, withUnstyledHOC as D } from "@progress/kendo-react-common";
13
+ import { FloatingLabel as H } from "@progress/kendo-react-labels";
14
+ const a = class a extends p.Component {
15
+ constructor() {
16
+ super(...arguments), this.state = {}, this._inputId = `k_${this.props.id}`, this._service = new O(), this._isPasted = !1, this._selection = [null, null], this._input = null, this.focus = () => {
18
17
  this._input && this._input.focus();
19
18
  }, this.pasteHandler = (t) => {
20
- const { selectionStart: r, selectionEnd: s } = t.target;
21
- s !== r && (this._isPasted = !0, this._selection = [r || 0, s || 0]);
19
+ const { selectionStart: s, selectionEnd: i } = t.target;
20
+ i !== s && (this._isPasted = !0, this._selection = [s || 0, i || 0]);
22
21
  }, this.onChangeHandler = (t) => {
23
- const r = t.currentTarget, s = r.value, o = this._selection[0] || 0, a = this._selection[1] || 0;
22
+ const s = t.currentTarget, i = s.value, l = this._selection[0] || 0, o = this._selection[1] || 0;
24
23
  if (!this.props.mask) {
25
- this._isPasted = !1, this._selection = [null, null], this.triggerOnChange(s, t);
24
+ this._isPasted = !1, this._selection = [null, null], this.triggerOnChange(i, t);
26
25
  return;
27
26
  }
28
- const d = this.value;
27
+ const r = this.value;
29
28
  let n;
30
29
  if (this._isPasted) {
31
30
  this._isPasted = !1;
32
- const h = d.length - a, u = s.length - h;
33
- n = this._service.maskInRange(s.slice(o, u), d, o, a);
31
+ const d = r.length - o, u = i.length - d;
32
+ n = this._service.maskInRange(i.slice(l, u), r, l, o);
34
33
  } else
35
- n = this._service.maskInput(s, d, r.selectionStart || 0);
34
+ n = this._service.maskInput(i, r, s.selectionStart || 0);
36
35
  this._selection = [n.selection, n.selection], this.triggerOnChange(n.value, t);
37
36
  }, this.focusHandler = (t) => {
38
37
  this.state.focused || (this.setState({ focused: !0 }), this.props.onFocus && this.props.onFocus.call(void 0, {
@@ -48,7 +47,7 @@ const l = class l extends p.Component {
48
47
  }));
49
48
  }, this.setValidity = () => {
50
49
  this.element && this.element.setCustomValidity(this.validity.valid ? "" : this.props.validationMessage || "");
51
- }, V(B);
50
+ };
52
51
  }
53
52
  /**
54
53
  * Gets the element of the MaskedTextBox.
@@ -100,18 +99,18 @@ const l = class l extends p.Component {
100
99
  * Represents the validity state into which the MaskedTextBox is set.
101
100
  */
102
101
  get validity() {
103
- const i = this.value, t = this._service.validationValue(i), r = this.props.validationMessage !== void 0, s = this.props.valid !== void 0 ? this.props.valid : (!this.required || !!t) && (!this.props.maskValidation || !this.props.prompt || i.indexOf(this.props.prompt) === -1);
102
+ const t = this.value, s = this._service.validationValue(t), i = this.props.validationMessage !== void 0, l = this.props.valid !== void 0 ? this.props.valid : (!this.required || !!s) && (!this.props.maskValidation || !this.props.prompt || t.indexOf(this.props.prompt) === -1);
104
103
  return {
105
- customError: r,
106
- valid: s,
107
- valueMissing: !t
104
+ customError: i,
105
+ valid: l,
106
+ valueMissing: !s
108
107
  };
109
108
  }
110
109
  /**
111
110
  * @hidden
112
111
  */
113
112
  get validityStyles() {
114
- return this.props.validityStyles !== void 0 ? this.props.validityStyles : l.defaultProps.validityStyles;
113
+ return this.props.validityStyles !== void 0 ? this.props.validityStyles : a.defaultProps.validityStyles;
115
114
  }
116
115
  /**
117
116
  * @hidden
@@ -128,13 +127,13 @@ const l = class l extends p.Component {
128
127
  /**
129
128
  * @hidden
130
129
  */
131
- componentDidUpdate(i, t) {
132
- if (this.element && this.state.focused && t.focused) {
133
- let [r, s] = this._selection;
134
- const o = i.selection, a = this.props.selection;
135
- (!o && a || o && a && (o.start !== a.start || o.end !== a.end)) && (r = a.start, s = a.end), r !== null && s !== null && this.element.setSelectionRange(r, s);
130
+ componentDidUpdate(t, s) {
131
+ if (this.element && this.state.focused && s.focused) {
132
+ let [i, l] = this._selection;
133
+ const o = t.selection, r = this.props.selection;
134
+ (!o && r || o && r && (o.start !== r.start || o.end !== r.end)) && (i = r.start, l = r.end), i !== null && l !== null && this.element.setSelectionRange(i, l);
136
135
  }
137
- O(i, this.props) && this.updateService(), this.setValidity();
136
+ V(t, this.props) && this.updateService(), this.setValidity();
138
137
  }
139
138
  /**
140
139
  * @hidden
@@ -147,29 +146,29 @@ const l = class l extends p.Component {
147
146
  */
148
147
  render() {
149
148
  const {
150
- size: i = l.defaultProps.size,
151
- fillMode: t = l.defaultProps.fillMode,
152
- rounded: r = l.defaultProps.rounded,
153
- autoFocus: s = l.defaultProps.autoFocus,
154
- prefix: o = l.defaultProps.prefix,
155
- suffix: a = l.defaultProps.suffix,
156
- inputAttributes: d,
157
- unstyled: n,
158
- className: h
159
- } = this.props, u = this.props.id || this._inputId, f = !this.validityStyles || this.validity.valid, v = this.props.style || {}, m = n && n.uMaskedTextBox, [x] = P(o), [S] = P(a), g = /* @__PURE__ */ p.createElement(
149
+ size: t = a.defaultProps.size,
150
+ fillMode: s = a.defaultProps.fillMode,
151
+ rounded: i = a.defaultProps.rounded,
152
+ autoFocus: l = a.defaultProps.autoFocus,
153
+ prefix: o = a.defaultProps.prefix,
154
+ suffix: r = a.defaultProps.suffix,
155
+ inputAttributes: n,
156
+ unstyled: d,
157
+ className: u
158
+ } = this.props, c = this.props.id || this._inputId, f = !this.validityStyles || this.validity.valid, v = this.props.style || {}, m = d && d.uMaskedTextBox, [x] = _(o), [S] = _(r), g = /* @__PURE__ */ p.createElement(
160
159
  "span",
161
160
  {
162
161
  dir: this.props.dir,
163
- className: _(
164
- C.wrapper({
162
+ className: C(
163
+ P.wrapper({
165
164
  c: m,
166
165
  invalid: !f,
167
166
  disabled: this.props.disabled,
168
- size: i,
169
- fillMode: t,
170
- rounded: r
167
+ size: t,
168
+ fillMode: s,
169
+ rounded: i
171
170
  }),
172
- h
171
+ u
173
172
  ),
174
173
  style: this.props.label ? v : { width: this.props.width, ...v }
175
174
  },
@@ -181,39 +180,39 @@ const l = class l extends p.Component {
181
180
  autoComplete: "off",
182
181
  autoCorrect: "off",
183
182
  autoCapitalize: "off",
184
- autoFocus: s,
183
+ autoFocus: l,
185
184
  spellCheck: !1,
186
- className: _(C.inputInner({ c: m })),
185
+ className: C(P.inputInner({ c: m })),
187
186
  value: this.value,
188
- id: u,
187
+ id: c,
189
188
  "aria-labelledby": this.props.ariaLabelledBy,
190
189
  "aria-describedby": this.props.ariaDescribedBy,
191
190
  "aria-placeholder": this.props.mask,
192
191
  "aria-required": this.props.required,
193
192
  name: this.props.name,
194
- tabIndex: w(this.props.tabIndex, this.props.disabled, !0),
193
+ tabIndex: k(this.props.tabIndex, this.props.disabled, !0),
195
194
  accessKey: this.props.accessKey,
196
195
  title: this.props.title,
197
196
  disabled: this.props.disabled || void 0,
198
197
  readOnly: this.props.readonly || void 0,
199
198
  placeholder: this.props.placeholder,
200
- ref: (k) => this._input = k,
199
+ ref: (E) => this._input = E,
201
200
  onChange: this.onChangeHandler,
202
201
  onPaste: this.pasteHandler,
203
202
  onFocus: this.focusHandler,
204
203
  onBlur: this.blurHandler,
205
204
  onDragStart: b,
206
205
  onDrop: b,
207
- ...d
206
+ ...n
208
207
  }
209
208
  ),
210
209
  /* @__PURE__ */ p.createElement(S, null)
211
210
  );
212
211
  return this.props.label ? /* @__PURE__ */ p.createElement(
213
- q,
212
+ H,
214
213
  {
215
214
  label: this.props.label,
216
- editorId: u,
215
+ editorId: c,
217
216
  editorValue: this.value,
218
217
  editorValid: f,
219
218
  editorDisabled: this.props.disabled,
@@ -224,24 +223,24 @@ const l = class l extends p.Component {
224
223
  }
225
224
  ) : g;
226
225
  }
227
- triggerOnChange(i, t) {
226
+ triggerOnChange(t, s) {
228
227
  if (this.setState({
229
- value: i
228
+ value: t
230
229
  }), this.props.onChange) {
231
- this._valueDuringOnChange = i;
232
- const r = {
233
- syntheticEvent: t,
234
- nativeEvent: t.nativeEvent,
230
+ this._valueDuringOnChange = t;
231
+ const i = {
232
+ syntheticEvent: s,
233
+ nativeEvent: s.nativeEvent,
235
234
  selectionStart: this._selection[0],
236
235
  selectionEnd: this._selection[1],
237
236
  target: this,
238
237
  value: this.value
239
238
  };
240
- this.props.onChange.call(void 0, r), this._valueDuringOnChange = void 0;
239
+ this.props.onChange.call(void 0, i), this._valueDuringOnChange = void 0;
241
240
  }
242
241
  }
243
- updateService(i) {
244
- const t = Object.assign(
242
+ updateService(t) {
243
+ const s = Object.assign(
245
244
  {
246
245
  includeLiterals: this.props.includeLiterals,
247
246
  mask: this.props.mask,
@@ -249,15 +248,15 @@ const l = class l extends p.Component {
249
248
  promptPlaceholder: this.props.promptPlaceholder,
250
249
  rules: this.rules
251
250
  },
252
- i
251
+ t
253
252
  );
254
- this._service.update(t);
253
+ this._service.update(s);
255
254
  }
256
255
  get rules() {
257
256
  return Object.assign({}, y, this.props.rules);
258
257
  }
259
258
  };
260
- l.displayName = "MaskedTextBox", l.propTypes = {
259
+ a.displayName = "MaskedTextBox", a.propTypes = {
261
260
  value: e.string,
262
261
  defaultValue: e.string,
263
262
  placeholder: e.string,
@@ -280,10 +279,10 @@ l.displayName = "MaskedTextBox", l.propTypes = {
280
279
  includeLiterals: e.bool,
281
280
  maskValidation: e.bool,
282
281
  mask: e.string,
283
- rules: function(i, t, r) {
284
- const s = i.rules;
285
- return s !== void 0 && !Object.entries(s).some((a) => typeof a != "string" || !(s[a] instanceof RegExp)) ? new Error(
286
- "Invalid prop `" + t + "` supplied to `" + r + "`. Validation failed."
282
+ rules: function(t, s, i) {
283
+ const l = t.rules;
284
+ return l !== void 0 && !Object.entries(l).some((r) => typeof r != "string" || !(l[r] instanceof RegExp)) ? new Error(
285
+ "Invalid prop `" + s + "` supplied to `" + i + "`. Validation failed."
287
286
  ) : null;
288
287
  },
289
288
  selection: e.shape({
@@ -302,30 +301,30 @@ l.displayName = "MaskedTextBox", l.propTypes = {
302
301
  fillMode: e.oneOf([null, "solid", "flat", "outline"]),
303
302
  autoFocus: e.bool,
304
303
  inputAttributes: e.object
305
- }, l.defaultProps = {
304
+ }, a.defaultProps = {
306
305
  prompt: "_",
307
306
  promptPlaceholder: " ",
308
307
  includeLiterals: !1,
309
308
  maskValidation: !0,
310
309
  rules: y,
311
310
  validityStyles: !0,
312
- prefix: (i) => null,
313
- suffix: (i) => null,
311
+ prefix: (t) => null,
312
+ suffix: (t) => null,
314
313
  size: "medium",
315
314
  rounded: "medium",
316
315
  fillMode: "solid",
317
316
  autoFocus: !1
318
317
  };
319
- let c = l;
320
- const F = I(), R = M(
321
- D(
322
- F,
323
- H(c)
318
+ let h = a;
319
+ const q = w(), B = I(
320
+ M(
321
+ q,
322
+ D(h)
324
323
  )
325
324
  );
326
- R.displayName = "KendoReactMaskedTextBox";
325
+ B.displayName = "KendoReactMaskedTextBox";
327
326
  export {
328
- R as MaskedTextBox,
329
- F as MaskedTextBoxPropsContext,
330
- c as MaskedTextBoxWithoutContext
327
+ B as MaskedTextBox,
328
+ q as MaskedTextBoxPropsContext,
329
+ h as MaskedTextBoxWithoutContext
331
330
  };
@@ -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 we=require("react"),t=require("prop-types"),fe=require("@progress/kendo-react-intl"),o=require("@progress/kendo-react-common"),be=require("@progress/kendo-svg-icons"),Ke=require("@progress/kendo-react-labels"),$e=require("../package-metadata.js"),g=require("../messages/index.js"),s=require("./utils/index.js"),pe=require("@progress/kendo-react-buttons");function Ue(m){const L=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const v in m)if(v!=="default"){const N=Object.getOwnPropertyDescriptor(m,v);Object.defineProperty(L,v,N.get?N:{enumerable:!0,get:()=>m[v]})}}return L.default=m,Object.freeze(L)}const n=Ue(we),We="Please enter a valid value!",ge=o.createPropsContext(),Q=n.forwardRef((m,L)=>{o.validatePackage($e.packageMetadata);const v=o.usePropsContext(ge,m),{className:N,value:k,defaultValue:ve,format:u,width:X,tabIndex:ye,accessKey:Ve,title:ke,placeholder:Z,min:f,max:b,dir:ee,name:_,label:R,id:Ce,ariaDescribedBy:Se,ariaLabelledBy:Ee,ariaLabel:xe,inputType:Oe,readOnly:C,validationMessage:G,children:he,touched:Ye,visited:Je,modified:Qe,style:te,inputStyle:Ie,valid:H,step:S=i.step,spinners:Le=i.spinners,disabled:c=i.disabled,required:q=i.required,validityStyles:ne=i.validityStyles,prefix:Pe=i.prefix,suffix:De=i.suffix,onChange:h=i.onChange,onFocus:re=i.onFocus,onBlur:ae=i.onBlur,rangeOnEnter:ue=i.rangeOnEnter,size:w=i.size,rounded:K=i.rounded,fillMode:B=i.fillMode,autoFocus:Ne=i.autoFocus,inputAttributes:Re,...se}=v,qe=o.useId(),le=Ce||qe,l=fe.useInternationalization(),M=fe.useLocalization(),a=n.useRef(null),T=n.useRef(),[Be,I]=n.useState(!1),d=n.useRef(s.getInitialState()),F=n.useRef(!1),$=n.useRef(),P=n.useRef(ve),D=s.formatValue(d.current.focused&&!c?d.current.currentLooseValue:s.getStateOrPropsValue(k,P.current),u,l);$.current=D;const[Me]=o.useCustomComponent(Pe),[Te]=o.useCustomComponent(De);n.useEffect(()=>{a.current&&a.current.setCustomValidity&&a.current.setCustomValidity(A().valid?"":G||We)});const oe=n.useCallback(()=>{a.current&&a.current.focus()},[]),j=n.useCallback(()=>T.current!==void 0?T.current:s.getStateOrPropsValue(k,P.current),[k]),ce=n.useCallback(()=>_,[_]),z=n.useCallback(()=>q,[q]),A=n.useCallback(()=>{const r=G!==void 0,e=j(),x=H!==void 0?H:!d.current.valueIsOutOfRange&&(!z()||e!=null);return{customError:r,valid:x,valueMissing:e==null}},[G,H,j,z]),U=n.useCallback(()=>ne,[ne]),ie=n.useCallback(()=>v,[v]),E=n.useCallback(()=>{const r={element:a.current,focus:oe};return Object.defineProperty(r,"name",{get:ce}),Object.defineProperty(r,"value",{get:j}),Object.defineProperty(r,"validity",{get:A}),Object.defineProperty(r,"validityStyles",{get:U}),Object.defineProperty(r,"required",{get:z}),Object.defineProperty(r,"props",{get:ie}),r},[ce,j,A,U,z,oe,ie]);n.useImperativeHandle(L,E);const y=n.useCallback(()=>({eventValue:s.getStateOrPropsValue(k,P.current),prevLooseValue:$.current,currentLooseValue:a.current.value,selectionStart:a.current.selectionStart,selectionEnd:a.current.selectionEnd,decimalSelect:!1,valueIsCorrected:!1,valueIsOutOfRange:!1,isPaste:F.current,focused:d.current.focused}),[k]),V=n.useCallback((r,e)=>{if(c)return;T.current=e.eventValue,P.current=e.eventValue;const x=s.formatValue(s.rangeValue(e.eventValue,f,b),u,l),p=s.rangeValue(l.parseNumber(x,u),f,b);p!==e.eventValue&&(e.valueIsOutOfRange=!0,e.eventValue=p,P.current=p),k!==e.eventValue&&o.dispatchEvent(h,r,E(),{value:e.eventValue}),T.current=void 0,d.current=e,I(J=>!J)},[k,h,c,I,E]),Fe=n.useCallback(r=>{const e=y();F.current=!1,V(r,s.sanitizeNumber(e,u,l))},[u,h,l,V,y]),je=n.useCallback(r=>{let e=y();const x=l.parseNumber(String(e.currentLooseValue),u);if(e.selectionEnd>e.selectionStart&&e.selectionEnd-e.selectionStart===String(e.currentLooseValue).length){const p=l.numberSymbols(),O=p&&r.key===p.minusSign,J=p&&r.key===p.decimal;F.current=!O&&!J;return}switch(r.keyCode){case 38:s.increaseValue(x,e,S,f,b,u,l);break;case 40:s.decreaseValue(x,e,S,f,b,u,l);break;case 13:{if(ue===!1)return;const p=s.formatValue(s.rangeValue(x,f,b),u,l),O=s.rangeValue(l.parseNumber(p,u),f,b);e.eventValue=O,e.currentLooseValue=s.formatValue(O,u,l),e.selectionStart=e.selectionEnd=e.currentLooseValue.length;break}case 110:{const p=a.current,O=l.numberSymbols();p&&(e.currentLooseValue=e.currentLooseValue.slice(0,e.selectionStart)+O.decimal+e.currentLooseValue.slice(e.selectionEnd),e.selectionStart=e.selectionEnd=e.selectionStart+1,e=s.sanitizeNumber(e,u,l));break}default:return}r.preventDefault(),V(r,e)},[u,f,b,S,h,ue,V,y]),ze=n.useCallback(()=>{F.current=!0},[]),W=n.useCallback(r=>{if(C||c)return;const e=y();s.increaseValue(l.parseNumber(String(e.currentLooseValue),u),e,S,f,b,u,l),V(r,e)},[u,f,b,S,h,C,c,V,y]),Y=n.useCallback(r=>{if(C||c)return;const e=y();s.decreaseValue(l.parseNumber(String(e.currentLooseValue),u),e,S,f,b,u,l),V(r,e)},[u,f,b,S,h,C,c,V,y]),Ae=n.useCallback(r=>{const e=o.getActiveElement(document);!document||e!==a.current||!a.current||C||c||(r.nativeEvent.deltaY<0&&W(r),r.nativeEvent.deltaY>0&&Y(r))},[W,Y,c,C]),_e=n.useCallback(r=>{d.current.currentLooseValue=$.current,d.current.focused=!0,o.dispatchEvent(re,r,E(),{}),I(e=>!e)},[re,I,E]),Ge=n.useCallback(r=>{d.current=s.getInitialState(),o.dispatchEvent(ae,r,E(),{}),I(e=>!e)},[ae,I,E]),He=n.useCallback(r=>{if(document&&a.current){const e=o.getActiveElement(document);r.preventDefault(),e!==a.current&&a.current.focus()}},[]);o.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)},[Be]);const de=!U()||A().valid,me=n.createElement("span",{dir:ee,style:R?te:{width:X,...te},className:o.classNames("k-input","k-numerictextbox",{[`k-input-${o.kendoThemeMaps.sizeMap[w]||w}`]:w,[`k-input-${B}`]:B,[`k-rounded-${o.kendoThemeMaps.roundedMap[K]||K}`]:K,"k-invalid":!de,"k-required":q,"k-disabled":c},N),"aria-disabled":c?"true":void 0,...R?{}:se},n.createElement(Me,null),n.createElement("input",{role:"spinbutton",value:D===null?"":D,tabIndex:o.getTabIndex(ye,c),accessKey:Ve,disabled:c,title:ke,"aria-disabled":c?"true":void 0,"aria-valuemin":f,"aria-valuemax":b,"aria-label":xe,"aria-labelledby":Ee,"aria-describedby":Se,"aria-required":q,placeholder:Z,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:Ne,type:Oe||"tel",className:"k-input-inner",id:le,name:_,readOnly:C,style:Ie,onChange:Fe,onFocus:_e,onBlur:Ge,onKeyDown:je,onPaste:ze,onWheel:Ae,ref:a,...Re}),n.createElement(Te,null),he,Le&&n.createElement("span",{className:"k-input-spinner k-spin-button",onMouseDown:He},n.createElement(pe.Button,{tabIndex:-1,type:"button",icon:"caret-alt-up",svgIcon:be.caretAltUpIcon,rounded:null,fillMode:B,className:"k-spinner-increase","aria-label":M.toLanguageString(g.numericIncreaseValue,g.messages[g.numericIncreaseValue]),title:M.toLanguageString(g.numericIncreaseValue,g.messages[g.numericIncreaseValue]),onClick:W}),n.createElement(pe.Button,{tabIndex:-1,type:"button",icon:"caret-alt-down",svgIcon:be.caretAltDownIcon,rounded:null,fillMode:B,className:"k-spinner-decrease","aria-label":M.toLanguageString(g.numericDecreaseValue,g.messages[g.numericDecreaseValue]),title:M.toLanguageString(g.numericDecreaseValue,g.messages[g.numericDecreaseValue]),onClick:Y})));return R?n.createElement(Ke.FloatingLabel,{label:R,editorId:le,editorValue:D===null?"":D,editorValid:de,editorDisabled:c,editorPlaceholder:Z,children:me,style:{width:X},dir:ee,...se}):me});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([null,"small","medium","large"]),rounded:t.oneOf([null,"small","medium","large","full"]),fillMode:t.oneOf([null,"solid","flat","outline"]),inputAttributes:t.object};const i={prefix:m=>null,suffix:m=>null,step:1,spinners:!0,disabled:!1,required:!1,validityStyles:!0,rangeOnEnter:!0,autoFocus:!1,onChange:m=>{},onFocus:m=>{},onBlur:m=>{},size:"medium",rounded:"medium",fillMode:"solid"};Q.displayName="KendoNumericTextBox";exports.NumericTextBox=Q;exports.NumericTextBoxPropsContext=ge;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const we=require("react"),t=require("prop-types"),fe=require("@progress/kendo-react-intl"),i=require("@progress/kendo-react-common"),be=require("@progress/kendo-svg-icons"),Ke=require("@progress/kendo-react-labels"),g=require("../messages/index.js"),s=require("./utils/index.js"),pe=require("@progress/kendo-react-buttons");function $e(m){const L=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const v in m)if(v!=="default"){const N=Object.getOwnPropertyDescriptor(m,v);Object.defineProperty(L,v,N.get?N:{enumerable:!0,get:()=>m[v]})}}return L.default=m,Object.freeze(L)}const n=$e(we),Ue="Please enter a valid value!",ge=i.createPropsContext(),Q=n.forwardRef((m,L)=>{const v=i.usePropsContext(ge,m),{className:N,value:k,defaultValue:ve,format:u,width:X,tabIndex:ye,accessKey:Ve,title:ke,placeholder:Z,min:f,max:b,dir:ee,name:_,label:R,id:Ce,ariaDescribedBy:Se,ariaLabelledBy:Ee,ariaLabel:xe,inputType:Oe,readOnly:C,validationMessage:G,children:he,touched:We,visited:Ye,modified:Je,style:te,inputStyle:Ie,valid:H,step:S=c.step,spinners:Le=c.spinners,disabled:o=c.disabled,required:B=c.required,validityStyles:ne=c.validityStyles,prefix:Pe=c.prefix,suffix:De=c.suffix,onChange:h=c.onChange,onFocus:re=c.onFocus,onBlur:ae=c.onBlur,rangeOnEnter:ue=c.rangeOnEnter,size:w=c.size,rounded:K=c.rounded,fillMode:q=c.fillMode,autoFocus:Ne=c.autoFocus,inputAttributes:Re,...se}=v,Be=i.useId(),le=Ce||Be,l=fe.useInternationalization(),M=fe.useLocalization(),a=n.useRef(null),T=n.useRef(),[qe,I]=n.useState(!1),d=n.useRef(s.getInitialState()),F=n.useRef(!1),$=n.useRef(),P=n.useRef(ve),D=s.formatValue(d.current.focused&&!o?d.current.currentLooseValue:s.getStateOrPropsValue(k,P.current),u,l);$.current=D;const[Me]=i.useCustomComponent(Pe),[Te]=i.useCustomComponent(De);n.useEffect(()=>{a.current&&a.current.setCustomValidity&&a.current.setCustomValidity(A().valid?"":G||Ue)});const oe=n.useCallback(()=>{a.current&&a.current.focus()},[]),j=n.useCallback(()=>T.current!==void 0?T.current:s.getStateOrPropsValue(k,P.current),[k]),ce=n.useCallback(()=>_,[_]),z=n.useCallback(()=>B,[B]),A=n.useCallback(()=>{const r=G!==void 0,e=j(),x=H!==void 0?H:!d.current.valueIsOutOfRange&&(!z()||e!=null);return{customError:r,valid:x,valueMissing:e==null}},[G,H,j,z]),U=n.useCallback(()=>ne,[ne]),ie=n.useCallback(()=>v,[v]),E=n.useCallback(()=>{const r={element:a.current,focus:oe};return Object.defineProperty(r,"name",{get:ce}),Object.defineProperty(r,"value",{get:j}),Object.defineProperty(r,"validity",{get:A}),Object.defineProperty(r,"validityStyles",{get:U}),Object.defineProperty(r,"required",{get:z}),Object.defineProperty(r,"props",{get:ie}),r},[ce,j,A,U,z,oe,ie]);n.useImperativeHandle(L,E);const y=n.useCallback(()=>({eventValue:s.getStateOrPropsValue(k,P.current),prevLooseValue:$.current,currentLooseValue:a.current.value,selectionStart:a.current.selectionStart,selectionEnd:a.current.selectionEnd,decimalSelect:!1,valueIsCorrected:!1,valueIsOutOfRange:!1,isPaste:F.current,focused:d.current.focused}),[k]),V=n.useCallback((r,e)=>{if(o)return;T.current=e.eventValue,P.current=e.eventValue;const x=s.formatValue(s.rangeValue(e.eventValue,f,b),u,l),p=s.rangeValue(l.parseNumber(x,u),f,b);p!==e.eventValue&&(e.valueIsOutOfRange=!0,e.eventValue=p,P.current=p),k!==e.eventValue&&i.dispatchEvent(h,r,E(),{value:e.eventValue}),T.current=void 0,d.current=e,I(J=>!J)},[k,h,o,I,E]),Fe=n.useCallback(r=>{const e=y();F.current=!1,V(r,s.sanitizeNumber(e,u,l))},[u,h,l,V,y]),je=n.useCallback(r=>{let e=y();const x=l.parseNumber(String(e.currentLooseValue),u);if(e.selectionEnd>e.selectionStart&&e.selectionEnd-e.selectionStart===String(e.currentLooseValue).length){const p=l.numberSymbols(),O=p&&r.key===p.minusSign,J=p&&r.key===p.decimal;F.current=!O&&!J;return}switch(r.keyCode){case 38:s.increaseValue(x,e,S,f,b,u,l);break;case 40:s.decreaseValue(x,e,S,f,b,u,l);break;case 13:{if(ue===!1)return;const p=s.formatValue(s.rangeValue(x,f,b),u,l),O=s.rangeValue(l.parseNumber(p,u),f,b);e.eventValue=O,e.currentLooseValue=s.formatValue(O,u,l),e.selectionStart=e.selectionEnd=e.currentLooseValue.length;break}case 110:{const p=a.current,O=l.numberSymbols();p&&(e.currentLooseValue=e.currentLooseValue.slice(0,e.selectionStart)+O.decimal+e.currentLooseValue.slice(e.selectionEnd),e.selectionStart=e.selectionEnd=e.selectionStart+1,e=s.sanitizeNumber(e,u,l));break}default:return}r.preventDefault(),V(r,e)},[u,f,b,S,h,ue,V,y]),ze=n.useCallback(()=>{F.current=!0},[]),W=n.useCallback(r=>{if(C||o)return;const e=y();s.increaseValue(l.parseNumber(String(e.currentLooseValue),u),e,S,f,b,u,l),V(r,e)},[u,f,b,S,h,C,o,V,y]),Y=n.useCallback(r=>{if(C||o)return;const e=y();s.decreaseValue(l.parseNumber(String(e.currentLooseValue),u),e,S,f,b,u,l),V(r,e)},[u,f,b,S,h,C,o,V,y]),Ae=n.useCallback(r=>{const e=i.getActiveElement(document);!document||e!==a.current||!a.current||C||o||(r.nativeEvent.deltaY<0&&W(r),r.nativeEvent.deltaY>0&&Y(r))},[W,Y,o,C]),_e=n.useCallback(r=>{d.current.currentLooseValue=$.current,d.current.focused=!0,i.dispatchEvent(re,r,E(),{}),I(e=>!e)},[re,I,E]),Ge=n.useCallback(r=>{d.current=s.getInitialState(),i.dispatchEvent(ae,r,E(),{}),I(e=>!e)},[ae,I,E]),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)},[qe]);const de=!U()||A().valid,me=n.createElement("span",{dir:ee,style:R?te:{width:X,...te},className:i.classNames("k-input","k-numerictextbox",{[`k-input-${i.kendoThemeMaps.sizeMap[w]||w}`]:w,[`k-input-${q}`]:q,[`k-rounded-${i.kendoThemeMaps.roundedMap[K]||K}`]:K,"k-invalid":!de,"k-required":B,"k-disabled":o},N),"aria-disabled":o?"true":void 0,...R?{}:se},n.createElement(Me,null),n.createElement("input",{role:"spinbutton",value:D===null?"":D,tabIndex:i.getTabIndex(ye,o),accessKey:Ve,disabled:o,title:ke,"aria-disabled":o?"true":void 0,"aria-valuemin":f,"aria-valuemax":b,"aria-label":xe,"aria-labelledby":Ee,"aria-describedby":Se,"aria-required":B,placeholder:Z,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:Ne,type:Oe||"tel",className:"k-input-inner",id:le,name:_,readOnly:C,style:Ie,onChange:Fe,onFocus:_e,onBlur:Ge,onKeyDown:je,onPaste:ze,onWheel:Ae,ref:a,...Re}),n.createElement(Te,null),he,Le&&n.createElement("span",{className:"k-input-spinner k-spin-button",onMouseDown:He},n.createElement(pe.Button,{tabIndex:-1,type:"button",icon:"caret-alt-up",svgIcon:be.caretAltUpIcon,rounded:null,fillMode:q,className:"k-spinner-increase","aria-label":M.toLanguageString(g.numericIncreaseValue,g.messages[g.numericIncreaseValue]),title:M.toLanguageString(g.numericIncreaseValue,g.messages[g.numericIncreaseValue]),onClick:W}),n.createElement(pe.Button,{tabIndex:-1,type:"button",icon:"caret-alt-down",svgIcon:be.caretAltDownIcon,rounded:null,fillMode:q,className:"k-spinner-decrease","aria-label":M.toLanguageString(g.numericDecreaseValue,g.messages[g.numericDecreaseValue]),title:M.toLanguageString(g.numericDecreaseValue,g.messages[g.numericDecreaseValue]),onClick:Y})));return R?n.createElement(Ke.FloatingLabel,{label:R,editorId:le,editorValue:D===null?"":D,editorValid:de,editorDisabled:o,editorPlaceholder:Z,children:me,style:{width:X},dir:ee,...se}):me});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([null,"small","medium","large"]),rounded:t.oneOf([null,"small","medium","large","full"]),fillMode:t.oneOf([null,"solid","flat","outline"]),inputAttributes:t.object};const c={prefix:m=>null,suffix:m=>null,step:1,spinners:!0,disabled:!1,required:!1,validityStyles:!0,rangeOnEnter:!0,autoFocus:!1,onChange:m=>{},onFocus:m=>{},onBlur:m=>{},size:"medium",rounded:"medium",fillMode:"solid"};Q.displayName="KendoNumericTextBox";exports.NumericTextBox=Q;exports.NumericTextBoxPropsContext=ge;