@progress/kendo-react-inputs 7.4.0-develop.7 → 7.4.0-develop.9
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/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +1 -1
- package/index.d.ts +1 -1
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +321 -278
- package/package-metadata.mjs +1 -1
- package/package.json +8 -8
package/index.d.mts
CHANGED
|
@@ -2056,7 +2056,7 @@ declare type NumericTextBoxInputType = 'tel' | 'text' | 'number';
|
|
|
2056
2056
|
/**
|
|
2057
2057
|
* Represents the props of the [KendoReact NumericTextBox component]({% slug overview_numerictextbox %}).
|
|
2058
2058
|
*/
|
|
2059
|
-
export declare interface NumericTextBoxProps extends FormComponentProps {
|
|
2059
|
+
export declare interface NumericTextBoxProps extends FormComponentProps, Omit<(React.HTMLAttributes<HTMLElement>), 'defaultValue' | 'prefix' | 'onChange' | 'onBlur' | 'onFocus'> {
|
|
2060
2060
|
/**
|
|
2061
2061
|
* Sets a class of the NumericTextBox DOM element.
|
|
2062
2062
|
*/
|
package/index.d.ts
CHANGED
|
@@ -2056,7 +2056,7 @@ declare type NumericTextBoxInputType = 'tel' | 'text' | 'number';
|
|
|
2056
2056
|
/**
|
|
2057
2057
|
* Represents the props of the [KendoReact NumericTextBox component]({% slug overview_numerictextbox %}).
|
|
2058
2058
|
*/
|
|
2059
|
-
export declare interface NumericTextBoxProps extends FormComponentProps {
|
|
2059
|
+
export declare interface NumericTextBoxProps extends FormComponentProps, Omit<(React.HTMLAttributes<HTMLElement>), 'defaultValue' | 'prefix' | 'onChange' | 'onBlur' | 'onFocus'> {
|
|
2060
2060
|
/**
|
|
2061
2061
|
* Sets a class of the NumericTextBox DOM element.
|
|
2062
2062
|
*/
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ge=require("react"),t=require("prop-types"),me=require("@progress/kendo-react-intl"),o=require("@progress/kendo-react-common"),fe=require("@progress/kendo-svg-icons"),Ae=require("@progress/kendo-react-labels"),He=require("../package-metadata.js"),g=require("../messages/index.js"),s=require("./utils/index.js"),be=require("@progress/kendo-react-buttons");function we(d){const h=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const p in d)if(p!=="default"){const D=Object.getOwnPropertyDescriptor(d,p);Object.defineProperty(h,p,D.get?D:{enumerable:!0,get:()=>d[p]})}}return h.default=d,Object.freeze(h)}const n=we(Ge),Ke="Please enter a valid value!",ge=o.createPropsContext(),F=n.forwardRef((d,h)=>{o.validatePackage(He.packageMetadata);const p=o.usePropsContext(ge,d),{className:D,value:V,defaultValue:pe,step:k,format:u,width:J,tabIndex:ve,accessKey:ye,title:Ve,placeholder:Q,min:m,max:f,spinners:ke,disabled:c,dir:X,name:z,label:N,id:Ce,prefix:Se,suffix:Ee,ariaDescribedBy:xe,validityStyles:Z,ariaLabelledBy:Ie,required:_,ariaLabel:Oe,inputType:he,rangeOnEnter:ee,readOnly:C,onChange:I,onFocus:te,onBlur:ne,validationMessage:G,children:Le,size:A,rounded:H,fillMode:re,style:ae,inputStyle:Pe,valid:w,...ue}=p,De=o.useId(),se=Ce||De,l=me.useInternationalization(),R=me.useLocalization(),a=n.useRef(null),B=n.useRef(),[Ne,O]=n.useState(!1),i=n.useRef(s.getInitialState()),M=n.useRef(!1),K=n.useRef(),L=n.useRef(pe),P=s.formatValue(i.current.focused&&!c?i.current.currentLooseValue:s.getStateOrPropsValue(V,L.current),u,l);K.current=P;const[Re]=o.useCustomComponent(Se),[Be]=o.useCustomComponent(Ee);n.useEffect(()=>{a.current&&a.current.setCustomValidity&&a.current.setCustomValidity(j().valid?"":G||Ke)});const le=n.useCallback(()=>{a.current&&a.current.focus()},[]),q=n.useCallback(()=>B.current!==void 0?B.current:s.getStateOrPropsValue(V,L.current),[V]),oe=n.useCallback(()=>z,[z]),T=n.useCallback(()=>_,[_]),j=n.useCallback(()=>{const r=G!==void 0,e=q(),E=w!==void 0?w:!i.current.valueIsOutOfRange&&(!T()||e!=null);return{customError:r,valid:E,valueMissing:e==null}},[G,w,q,T]),$=n.useCallback(()=>Z,[Z]),ce=n.useCallback(()=>p,[p]),S=n.useCallback(()=>{const r={element:a.current,focus:le};return Object.defineProperty(r,"name",{get:oe}),Object.defineProperty(r,"value",{get:q}),Object.defineProperty(r,"validity",{get:j}),Object.defineProperty(r,"validityStyles",{get:$}),Object.defineProperty(r,"required",{get:T}),Object.defineProperty(r,"props",{get:ce}),r},[oe,q,j,$,T,le,ce]);n.useImperativeHandle(h,S);const v=n.useCallback(()=>({eventValue:s.getStateOrPropsValue(V,L.current),prevLooseValue:K.current,currentLooseValue:a.current.value,selectionStart:a.current.selectionStart,selectionEnd:a.current.selectionEnd,decimalSelect:!1,valueIsCorrected:!1,valueIsOutOfRange:!1,isPaste:M.current,focused:i.current.focused}),[V]),y=n.useCallback((r,e)=>{if(c)return;B.current=e.eventValue,L.current=e.eventValue;const E=s.formatValue(s.rangeValue(e.eventValue,m,f),u,l),b=s.rangeValue(l.parseNumber(E,u),m,f);b!==e.eventValue&&(e.valueIsOutOfRange=!0,e.eventValue=b,L.current=b),V!==e.eventValue&&o.dispatchEvent(I,r,S(),{value:e.eventValue}),B.current=void 0,i.current=e,O(Y=>!Y)},[V,I,c,O,S]),Me=n.useCallback(r=>{const e=v();M.current=!1,y(r,s.sanitizeNumber(e,u,l))},[u,I,l,y,v]),qe=n.useCallback(r=>{let e=v();const E=l.parseNumber(String(e.currentLooseValue),u);if(e.selectionEnd>e.selectionStart&&e.selectionEnd-e.selectionStart===String(e.currentLooseValue).length){const b=l.numberSymbols(),x=b&&r.key===b.minusSign,Y=b&&r.key===b.decimal;M.current=!x&&!Y;return}switch(r.keyCode){case 38:s.increaseValue(E,e,k,m,f,u,l);break;case 40:s.decreaseValue(E,e,k,m,f,u,l);break;case 13:{if(ee===!1)return;const b=s.formatValue(s.rangeValue(E,m,f),u,l),x=s.rangeValue(l.parseNumber(b,u),m,f);e.eventValue=x,e.currentLooseValue=s.formatValue(x,u,l),e.selectionStart=e.selectionEnd=e.currentLooseValue.length;break}case 110:{const b=a.current,x=l.numberSymbols();b&&(e.currentLooseValue=e.currentLooseValue.slice(0,e.selectionStart)+x.decimal+e.currentLooseValue.slice(e.selectionEnd),e.selectionStart=e.selectionEnd=e.selectionStart+1,e=s.sanitizeNumber(e,u,l));break}default:return}r.preventDefault(),y(r,e)},[u,m,f,k,I,ee,y,v]),Te=n.useCallback(()=>{M.current=!0},[]),U=n.useCallback(r=>{if(C||c)return;const e=v();s.increaseValue(l.parseNumber(String(e.currentLooseValue),u),e,k,m,f,u,l),y(r,e)},[u,m,f,k,I,C,c,y,v]),W=n.useCallback(r=>{if(C||c)return;const e=v();s.decreaseValue(l.parseNumber(String(e.currentLooseValue),u),e,k,m,f,u,l),y(r,e)},[u,m,f,k,I,C,c,y,v]),je=n.useCallback(r=>{const e=o.getActiveElement(document);!document||e!==a.current||!a.current||C||c||(r.nativeEvent.deltaY<0&&U(r),r.nativeEvent.deltaY>0&&W(r))},[U,W,c,C]),Fe=n.useCallback(r=>{i.current.currentLooseValue=K.current,i.current.focused=!0,o.dispatchEvent(te,r,S(),{}),O(e=>!e)},[te,O,S]),ze=n.useCallback(r=>{i.current=s.getInitialState(),o.dispatchEvent(ne,r,S(),{}),O(e=>!e)},[ne,O,S]),_e=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"&&i.current.selectionStart!==void 0&&i.current.selectionEnd!==void 0&&(a.current.selectionStart=i.current.selectionStart,a.current.selectionEnd=i.current.selectionEnd,i.current.selectionStart=void 0,i.current.selectionEnd=void 0)},[Ne]);const ie=!$()||j().valid,de=n.createElement("span",{dir:X,style:N?ae:{width:J,...ae},className:o.classNames("k-input","k-numerictextbox",{[`k-input-${o.kendoThemeMaps.sizeMap[A]||A}`]:A,[`k-input-${re}`]:re,[`k-rounded-${o.kendoThemeMaps.roundedMap[H]||H}`]:H,"k-invalid":!ie,"k-required":_,"k-disabled":c},D),"aria-disabled":c?"true":void 0,...N?{}:ue},n.createElement(Re,null),n.createElement("input",{role:"spinbutton",value:P===null?"":P,tabIndex:o.getTabIndex(ve,c),accessKey:ye,disabled:c,title:Ve,"aria-disabled":c?"true":void 0,"aria-valuemin":m,"aria-valuemax":f,"aria-label":Oe,"aria-labelledby":Ie,"aria-describedby":xe,placeholder:Q,spellCheck:!1,autoComplete:"off",autoCorrect:"off",type:he||"tel",className:"k-input-inner",id:se,name:z,readOnly:C,style:Pe,onChange:Me,onFocus:Fe,onBlur:ze,onKeyDown:qe,onPaste:Te,onWheel:je,ref:a}),n.createElement(Be,null),Le,ke&&n.createElement("span",{className:"k-input-spinner k-spin-button",onMouseDown:_e},n.createElement(be.Button,{tabIndex:-1,type:"button",icon:"caret-alt-up",svgIcon:fe.caretAltUpIcon,rounded:null,className:"k-spinner-increase","aria-label":R.toLanguageString(g.numericIncreaseValue,g.messages[g.numericIncreaseValue]),title:R.toLanguageString(g.numericIncreaseValue,g.messages[g.numericIncreaseValue]),onClick:U}),n.createElement(be.Button,{tabIndex:-1,type:"button",icon:"caret-alt-down",svgIcon:fe.caretAltDownIcon,rounded:null,className:"k-spinner-decrease","aria-label":R.toLanguageString(g.numericDecreaseValue,g.messages[g.numericDecreaseValue]),title:R.toLanguageString(g.numericDecreaseValue,g.messages[g.numericDecreaseValue]),onClick:W})));return N?n.createElement(Ae.FloatingLabel,{label:N,editorId:se,editorValue:P===null?"":P,editorValid:ie,editorDisabled:c,editorPlaceholder:Q,children:de,style:{width:J},dir:X,...ue}):de});F.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"])};F.displayName="KendoNumericTextBox";F.defaultProps={prefix:d=>null,suffix:d=>null,step:1,spinners:!0,disabled:!1,required:!1,validityStyles:!0,rangeOnEnter:!0,onChange:d=>{},onFocus:d=>{},onBlur:d=>{},size:"medium",rounded:"medium",fillMode:"solid"};exports.NumericTextBox=F;exports.NumericTextBoxPropsContext=ge;
|