@equinor/roma-ui 0.2.1 → 0.2.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/lib/NumberField/NumberField.d.ts +3 -1
- package/number.js +1 -1
- package/number.mjs +60 -58
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { InputProps } from '@equinor/eds-core-react';
|
|
2
2
|
import { AriaNumberFieldProps } from '@react-types/numberfield';
|
|
3
|
-
export declare const NumberField: import('react').ForwardRefExoticComponent<InputProps & AriaNumberFieldProps &
|
|
3
|
+
export declare const NumberField: import('react').ForwardRefExoticComponent<InputProps & AriaNumberFieldProps & {
|
|
4
|
+
locale?: string;
|
|
5
|
+
} & import('react').RefAttributes<unknown>>;
|
package/number.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=require("react/jsx-runtime"),u=require("react"),de=require("react-aria"),fe=require("@equinor/eds-core-react"),pe=require("./useControlledState-D0L6S_5r.js");function L(r,e=-1/0,t=1/0){return Math.min(Math.max(r,e),t)}function A(r,e){let t=r,i=e.toString(),n=i.indexOf("."),a=n>=0?i.length-n:0;if(a>0){let l=Math.pow(10,a);t=Math.round(t*l)/l}return t}function M(r,e,t,i){e=Number(e),t=Number(t);let n=(r-(isNaN(e)?0:e))%i,a=A(Math.abs(n)*2>=i?r+Math.sign(n)*(i-Math.abs(n)):r-n,i);return isNaN(e)?!isNaN(t)&&a>t&&(a=Math.floor(A(t/i,i))*i):a<e?a=e:!isNaN(t)&&a>t&&(a=e+Math.floor(A((t-e)/i,i))*i),a=A(a,i),a}const ee={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},te={...ee,customError:!0,valid:!1},O={isInvalid:!1,validationDetails:ee,validationErrors:[]},be=u.createContext({}),Y="__formValidationState"+Date.now();function he(r){if(r[Y]){let{realtimeValidation:e,displayValidation:t,updateValidation:i,resetValidation:n,commitValidation:a}=r[Y];return{realtimeValidation:e,displayValidation:t,updateValidation:i,resetValidation:n,commitValidation:a}}return ge(r)}function ge(r){let{isInvalid:e,validationState:t,name:i,value:n,builtinValidation:a,validate:l,validationBehavior:o="aria"}=r;t&&(e||(e=t==="invalid"));let m=e!==void 0?{isInvalid:e,validationErrors:[],validationDetails:te}:null,V=u.useMemo(()=>{if(!l||n==null)return null;let s=$e(l,n);return k(s)},[l,n]);a!=null&&a.validationDetails.valid&&(a=void 0);let h=u.useContext(be),f=u.useMemo(()=>i?Array.isArray(i)?i.flatMap(s=>G(h[s])):G(h[i]):[],[h,i]),[g,$]=u.useState(h),[p,b]=u.useState(!1);h!==g&&($(h),b(!1));let D=u.useMemo(()=>k(p?[]:f),[p,f]),w=u.useRef(O),[x,y]=u.useState(O),v=u.useRef(O),d=()=>{if(!P)return;S(!1);let s=V||a||w.current;q(s,v.current)||(v.current=s,y(s))},[P,S]=u.useState(!1);return u.useEffect(d),{realtimeValidation:m||D||V||a||O,displayValidation:o==="native"?m||D||x:m||D||V||a||x,updateValidation(s){o==="aria"&&!q(x,s)?y(s):w.current=s},resetValidation(){let s=O;q(s,v.current)||(v.current=s,y(s)),o==="native"&&S(!1),b(!0)},commitValidation(){o==="native"&&S(!0),b(!0)}}}function G(r){return r?Array.isArray(r)?r:[r]:[]}function $e(r,e){if(typeof r=="function"){let t=r(e);if(t&&typeof t!="boolean")return G(t)}return[]}function k(r){return r.length?{isInvalid:!0,validationErrors:r,validationDetails:te}:null}function q(r,e){return r===e?!0:!!r&&!!e&&r.isInvalid===e.isInvalid&&r.validationErrors.length===e.validationErrors.length&&r.validationErrors.every((t,i)=>t===e.validationErrors[i])&&Object.entries(r.validationDetails).every(([t,i])=>e.validationDetails[t]===i)}let z=new Map,U=!1;try{U=new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay==="exceptZero"}catch{}let j=!1;try{j=new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style==="unit"}catch{}const ie={degree:{narrow:{default:"°","ja-JP":" 度","zh-TW":"度","sl-SI":" °"}}};class Z{format(e){let t="";if(!U&&this.options.signDisplay!=null?t=ve(this.numberFormatter,this.options.signDisplay,e):t=this.numberFormatter.format(e),this.options.style==="unit"&&!j){var i;let{unit:n,unitDisplay:a="short",locale:l}=this.resolvedOptions();if(!n)return t;let o=(i=ie[n])===null||i===void 0?void 0:i[a];t+=o[l]||o.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange=="function")return this.numberFormatter.formatRange(e,t);if(t<e)throw new RangeError("End date must be >= start date");return`${this.format(e)} – ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts=="function")return this.numberFormatter.formatRangeToParts(e,t);if(t<e)throw new RangeError("End date must be >= start date");let i=this.numberFormatter.formatToParts(e),n=this.numberFormatter.formatToParts(t);return[...i.map(a=>({...a,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...n.map(a=>({...a,source:"endRange"}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!U&&this.options.signDisplay!=null&&(e={...e,signDisplay:this.options.signDisplay}),!j&&this.options.style==="unit"&&(e={...e,style:"unit",unit:this.options.unit,unitDisplay:this.options.unitDisplay}),e}constructor(e,t={}){this.numberFormatter=ye(e,t),this.options=t}}function ye(r,e={}){let{numberingSystem:t}=e;if(t&&r.includes("-nu-")&&(r.includes("-u-")||(r+="-u-"),r+=`-nu-${t}`),e.style==="unit"&&!j){var i;let{unit:l,unitDisplay:o="short"}=e;if(!l)throw new Error('unit option must be provided with style: "unit"');if(!(!((i=ie[l])===null||i===void 0)&&i[o]))throw new Error(`Unsupported unit ${l} with unitDisplay = ${o}`);e={...e,style:"decimal"}}let n=r+(e?Object.entries(e).sort((l,o)=>l[0]<o[0]?-1:1).join():"");if(z.has(n))return z.get(n);let a=new Intl.NumberFormat(r,e);return z.set(n,a),a}function ve(r,e,t){if(e==="auto")return r.format(t);if(e==="never")return r.format(Math.abs(t));{let i=!1;if(e==="always"?i=t>0||Object.is(t,0):e==="exceptZero"&&(Object.is(t,-0)||Object.is(t,0)?t=Math.abs(t):i=t>0),i){let n=r.format(-t),a=r.format(t),l=n.replace(a,"").replace(/\u200e|\u061C/,"");return[...l].length!==1&&console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"),n.replace(a,"!!!").replace(l,"+").replace("!!!",a)}else return r.format(t)}}const Ne=new RegExp("^.*\\(.*\\).*$"),Ve=["latn","arab","hanidec","deva","beng"];class re{parse(e){return W(this.locale,this.options,e).parse(e)}isValidPartialNumber(e,t,i){return W(this.locale,this.options,e).isValidPartialNumber(e,t,i)}getNumberingSystem(e){return W(this.locale,this.options,e).options.numberingSystem}constructor(e,t={}){this.locale=e,this.options=t}}const Q=new Map;function W(r,e,t){let i=J(r,e);if(!r.includes("-nu-")&&!i.isValidPartialNumber(t)){for(let n of Ve)if(n!==i.options.numberingSystem){let a=J(r+(r.includes("-u-")?"-nu-":"-u-nu-")+n,e);if(a.isValidPartialNumber(t))return a}}return i}function J(r,e){let t=r+(e?Object.entries(e).sort((n,a)=>n[0]<a[0]?-1:1).join():""),i=Q.get(t);return i||(i=new Se(r,e),Q.set(t,i)),i}class Se{parse(e){let t=this.sanitize(e);if(this.symbols.group&&(t=T(t,this.symbols.group,"")),this.symbols.decimal&&(t=t.replace(this.symbols.decimal,".")),this.symbols.minusSign&&(t=t.replace(this.symbols.minusSign,"-")),t=t.replace(this.symbols.numeral,this.symbols.index),this.options.style==="percent"){let l=t.indexOf("-");t=t.replace("-",""),t=t.replace("+","");let o=t.indexOf(".");o===-1&&(o=t.length),t=t.replace(".",""),o-2===0?t=`0.${t}`:o-2===-1?t=`0.0${t}`:o-2===-2?t="0.00":t=`${t.slice(0,o-2)}.${t.slice(o-2)}`,l>-1&&(t=`-${t}`)}let i=t?+t:NaN;if(isNaN(i))return NaN;if(this.options.style==="percent"){var n,a;let l={...this.options,style:"decimal",minimumFractionDigits:Math.min(((n=this.options.minimumFractionDigits)!==null&&n!==void 0?n:0)+2,20),maximumFractionDigits:Math.min(((a=this.options.maximumFractionDigits)!==null&&a!==void 0?a:0)+2,20)};return new re(this.locale,l).parse(new Z(this.locale,l).format(i))}return this.options.currencySign==="accounting"&&Ne.test(e)&&(i=-1*i),i}sanitize(e){return e=e.replace(this.symbols.literals,""),this.symbols.minusSign&&(e=e.replace("-",this.symbols.minusSign)),this.options.numberingSystem==="arab"&&(this.symbols.decimal&&(e=e.replace(",",this.symbols.decimal),e=e.replace("،",this.symbols.decimal)),this.symbols.group&&(e=T(e,".",this.symbols.group))),this.options.locale==="fr-FR"&&this.symbols.group&&(e=T(e," ",this.symbols.group),e=T(e,/\u00A0/g,this.symbols.group)),e}isValidPartialNumber(e,t=-1/0,i=1/0){return e=this.sanitize(e),this.symbols.minusSign&&e.startsWith(this.symbols.minusSign)&&t<0?e=e.slice(this.symbols.minusSign.length):this.symbols.plusSign&&e.startsWith(this.symbols.plusSign)&&i>0&&(e=e.slice(this.symbols.plusSign.length)),this.symbols.group&&e.startsWith(this.symbols.group)||this.symbols.decimal&&e.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&(e=T(e,this.symbols.group,"")),e=e.replace(this.symbols.numeral,""),this.symbols.decimal&&(e=e.replace(this.symbols.decimal,"")),e.length===0)}constructor(e,t={}){this.locale=e,t.roundingIncrement!==1&&t.roundingIncrement!=null&&(t.maximumFractionDigits==null&&t.minimumFractionDigits==null?(t.maximumFractionDigits=0,t.minimumFractionDigits=0):t.maximumFractionDigits==null?t.maximumFractionDigits=t.minimumFractionDigits:t.minimumFractionDigits==null&&(t.minimumFractionDigits=t.maximumFractionDigits)),this.formatter=new Intl.NumberFormat(e,t),this.options=this.formatter.resolvedOptions(),this.symbols=we(e,this.formatter,this.options,t);var i,n;this.options.style==="percent"&&(((i=this.options.minimumFractionDigits)!==null&&i!==void 0?i:0)>18||((n=this.options.maximumFractionDigits)!==null&&n!==void 0?n:0)>18)&&console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.")}}const X=new Set(["decimal","fraction","integer","minusSign","plusSign","group"]),De=[0,4,2,1,11,20,3,7,100,21,.1,1.1];function we(r,e,t,i){var n,a,l,o;let m=new Intl.NumberFormat(r,{...t,minimumSignificantDigits:1,maximumSignificantDigits:21,roundingIncrement:1,roundingPriority:"auto",roundingMode:"halfExpand"}),V=m.formatToParts(-10000.111),h=m.formatToParts(10000.111),f=De.map(s=>m.formatToParts(s));var g;let $=(g=(n=V.find(s=>s.type==="minusSign"))===null||n===void 0?void 0:n.value)!==null&&g!==void 0?g:"-",p=(a=h.find(s=>s.type==="plusSign"))===null||a===void 0?void 0:a.value;!p&&((i==null?void 0:i.signDisplay)==="exceptZero"||(i==null?void 0:i.signDisplay)==="always")&&(p="+");let D=(l=new Intl.NumberFormat(r,{...t,minimumFractionDigits:2,maximumFractionDigits:2}).formatToParts(.001).find(s=>s.type==="decimal"))===null||l===void 0?void 0:l.value,w=(o=V.find(s=>s.type==="group"))===null||o===void 0?void 0:o.value,x=V.filter(s=>!X.has(s.type)).map(s=>H(s.value)),y=f.flatMap(s=>s.filter(E=>!X.has(E.type)).map(E=>H(E.value))),v=[...new Set([...x,...y])].sort((s,E)=>E.length-s.length),d=v.length===0?new RegExp("[\\p{White_Space}]","gu"):new RegExp(`${v.join("|")}|[\\p{White_Space}]`,"gu"),P=[...new Intl.NumberFormat(t.locale,{useGrouping:!1}).format(9876543210)].reverse(),S=new Map(P.map((s,E)=>[s,E])),F=new RegExp(`[${P.join("")}]`,"g");return{minusSign:$,plusSign:p,decimal:D,group:w,literals:d,numeral:F,index:s=>String(S.get(s))}}function T(r,e,t){return r.replaceAll?r.replaceAll(e,t):r.split(e).join(t)}function H(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xe(r){let{minValue:e,maxValue:t,step:i,formatOptions:n,value:a,defaultValue:l=NaN,onChange:o,locale:m,isDisabled:V,isReadOnly:h}=r;a===null&&(a=NaN),a!==void 0&&!isNaN(a)&&(i!==void 0&&!isNaN(i)?a=M(a,e,t,i):a=L(a,e,t)),isNaN(l)||(i!==void 0&&!isNaN(i)?l=M(l,e,t,i):l=L(l,e,t));let[f,g]=pe.$458b0a5536c1a7cf$export$40bfa8c7b0832715(a,isNaN(l)?NaN:l,o),[$,p]=u.useState(()=>isNaN(f)?"":new Z(m,n).format(f)),b=u.useMemo(()=>new re(m,n),[m,n]),D=u.useMemo(()=>b.getNumberingSystem($),[b,$]),w=u.useMemo(()=>new Z(m,{...n,numberingSystem:D}),[m,n,D]),x=u.useMemo(()=>w.resolvedOptions(),[w]),y=u.useCallback(c=>isNaN(c)||c===null?"":w.format(c),[w]),v=he({...r,value:f}),d=i!==void 0&&!isNaN(i)?i:1;x.style==="percent"&&(i===void 0||isNaN(i))&&(d=.01);let[P,S]=u.useState(f),[F,I]=u.useState(m),[s,E]=u.useState(n);(!Object.is(f,P)||m!==F||n!==s)&&(p(y(f)),S(f),I(m),E(n));let N=u.useMemo(()=>b.parse($),[b,$]),ae=()=>{if(!$.length){g(NaN),p(a===void 0?"":y(f));return}if(isNaN(N)){p(y(f));return}let c;i===void 0||isNaN(i)?c=L(N,e,t):c=M(N,e,t,i),c=b.parse(y(c)),g(c),p(y(a===void 0?c:f))},B=(c,K=0)=>{let R=N;if(isNaN(R)){let C=isNaN(K)?0:K;return M(C,e,t,d)}else{let C=M(R,e,t,d);return c==="+"&&C>R||c==="-"&&C<R?C:M(_(c,R,d),e,t,d)}},ne=()=>{let c=B("+",e);c===f&&p(y(c)),g(c),v.commitValidation()},se=()=>{let c=B("-",t);c===f&&p(y(c)),g(c),v.commitValidation()},le=()=>{t!=null&&(g(M(t,e,t,d)),v.commitValidation())},oe=()=>{e!=null&&(g(e),v.commitValidation())},ue=u.useMemo(()=>!V&&!h&&(isNaN(N)||t===void 0||isNaN(t)||M(N,e,t,d)>N||_("+",N,d)<=t),[V,h,e,t,d,N]),ce=u.useMemo(()=>!V&&!h&&(isNaN(N)||e===void 0||isNaN(e)||M(N,e,t,d)<N||_("-",N,d)>=e),[V,h,e,t,d,N]);return{...v,validate:c=>b.isValidPartialNumber(c,e,t),increment:ne,incrementToMax:le,decrement:se,decrementToMin:oe,canIncrement:ue,canDecrement:ce,minValue:e,maxValue:t,numberValue:N,setNumberValue:g,setInputValue:p,inputValue:$,commit:ae}}function _(r,e,t){let i=r==="+"?e+t:e-t;if(e%1!==0||t%1!==0){const n=e.toString().split("."),a=t.toString().split("."),l=n[1]&&n[1].length||0,o=a[1]&&a[1].length||0,m=Math.pow(10,Math.max(l,o));e=Math.round(e*m),t=Math.round(t*m),i=r==="+"?e+t:e-t,i/=m}return i}const Pe=u.forwardRef(({placeholder:r,variant:e,disabled:t,type:i,readOnly:n,leftAdornments:a,rightAdornments:l,leftAdornmentsProps:o,rightAdornmentsProps:m,leftAdornmentsWidth:V,rightAdornmentsWidth:h,className:f,style:g,label:$,value:p,...b},D)=>{const x=xe({...b,label:$,value:p,onChange:d=>{b.onChange&&b.onChange(d)},locale:"nb-NO"}),y=u.useRef(null),{inputProps:v}=de.useNumberField({...b,label:$,value:p},x,y);return me.jsx(fe.Input,{placeholder:r,variant:e,disabled:t,type:i,readOnly:n,leftAdornments:a,rightAdornments:l,leftAdornmentsProps:o,rightAdornmentsProps:m,leftAdornmentsWidth:V,rightAdornmentsWidth:h,className:f,style:g,"data-testid":`number-field-${$}`,...v,onKeyDown:d=>{var P;if(d.key==="."){d.preventDefault();const S=d.target;if((P=S.value)!=null&&P.includes(","))return;const F=S.selectionStart||0,I=S.selectionEnd||0;S.value=S.value.substring(0,F)+","+S.value.substring(I)}},ref:D,"aria-label":$})});exports.NumberField=Pe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ce=require("react/jsx-runtime"),u=require("react"),de=require("react-aria"),fe=require("@equinor/eds-core-react"),pe=require("./useControlledState-D0L6S_5r.js");function L(r,e=-1/0,t=1/0){return Math.min(Math.max(r,e),t)}function A(r,e){let t=r,i=e.toString(),n=i.indexOf("."),a=n>=0?i.length-n:0;if(a>0){let l=Math.pow(10,a);t=Math.round(t*l)/l}return t}function M(r,e,t,i){e=Number(e),t=Number(t);let n=(r-(isNaN(e)?0:e))%i,a=A(Math.abs(n)*2>=i?r+Math.sign(n)*(i-Math.abs(n)):r-n,i);return isNaN(e)?!isNaN(t)&&a>t&&(a=Math.floor(A(t/i,i))*i):a<e?a=e:!isNaN(t)&&a>t&&(a=e+Math.floor(A((t-e)/i,i))*i),a=A(a,i),a}const ee={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},te={...ee,customError:!0,valid:!1},O={isInvalid:!1,validationDetails:ee,validationErrors:[]},be=u.createContext({}),Y="__formValidationState"+Date.now();function he(r){if(r[Y]){let{realtimeValidation:e,displayValidation:t,updateValidation:i,resetValidation:n,commitValidation:a}=r[Y];return{realtimeValidation:e,displayValidation:t,updateValidation:i,resetValidation:n,commitValidation:a}}return ge(r)}function ge(r){let{isInvalid:e,validationState:t,name:i,value:n,builtinValidation:a,validate:l,validationBehavior:o="aria"}=r;t&&(e||(e=t==="invalid"));let c=e!==void 0?{isInvalid:e,validationErrors:[],validationDetails:te}:null,V=u.useMemo(()=>{if(!l||n==null)return null;let s=$e(l,n);return k(s)},[l,n]);a!=null&&a.validationDetails.valid&&(a=void 0);let b=u.useContext(be),f=u.useMemo(()=>i?Array.isArray(i)?i.flatMap(s=>G(b[s])):G(b[i]):[],[b,i]),[h,g]=u.useState(b),[p,$]=u.useState(!1);b!==h&&(g(b),$(!1));let D=u.useMemo(()=>k(p?[]:f),[p,f]),w=u.useRef(O),[x,y]=u.useState(O),v=u.useRef(O),d=()=>{if(!P)return;S(!1);let s=V||a||w.current;q(s,v.current)||(v.current=s,y(s))},[P,S]=u.useState(!1);return u.useEffect(d),{realtimeValidation:c||D||V||a||O,displayValidation:o==="native"?c||D||x:c||D||V||a||x,updateValidation(s){o==="aria"&&!q(x,s)?y(s):w.current=s},resetValidation(){let s=O;q(s,v.current)||(v.current=s,y(s)),o==="native"&&S(!1),$(!0)},commitValidation(){o==="native"&&S(!0),$(!0)}}}function G(r){return r?Array.isArray(r)?r:[r]:[]}function $e(r,e){if(typeof r=="function"){let t=r(e);if(t&&typeof t!="boolean")return G(t)}return[]}function k(r){return r.length?{isInvalid:!0,validationErrors:r,validationDetails:te}:null}function q(r,e){return r===e?!0:!!r&&!!e&&r.isInvalid===e.isInvalid&&r.validationErrors.length===e.validationErrors.length&&r.validationErrors.every((t,i)=>t===e.validationErrors[i])&&Object.entries(r.validationDetails).every(([t,i])=>e.validationDetails[t]===i)}let z=new Map,U=!1;try{U=new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay==="exceptZero"}catch{}let j=!1;try{j=new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style==="unit"}catch{}const ie={degree:{narrow:{default:"°","ja-JP":" 度","zh-TW":"度","sl-SI":" °"}}};class Z{format(e){let t="";if(!U&&this.options.signDisplay!=null?t=ve(this.numberFormatter,this.options.signDisplay,e):t=this.numberFormatter.format(e),this.options.style==="unit"&&!j){var i;let{unit:n,unitDisplay:a="short",locale:l}=this.resolvedOptions();if(!n)return t;let o=(i=ie[n])===null||i===void 0?void 0:i[a];t+=o[l]||o.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange=="function")return this.numberFormatter.formatRange(e,t);if(t<e)throw new RangeError("End date must be >= start date");return`${this.format(e)} – ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts=="function")return this.numberFormatter.formatRangeToParts(e,t);if(t<e)throw new RangeError("End date must be >= start date");let i=this.numberFormatter.formatToParts(e),n=this.numberFormatter.formatToParts(t);return[...i.map(a=>({...a,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...n.map(a=>({...a,source:"endRange"}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!U&&this.options.signDisplay!=null&&(e={...e,signDisplay:this.options.signDisplay}),!j&&this.options.style==="unit"&&(e={...e,style:"unit",unit:this.options.unit,unitDisplay:this.options.unitDisplay}),e}constructor(e,t={}){this.numberFormatter=ye(e,t),this.options=t}}function ye(r,e={}){let{numberingSystem:t}=e;if(t&&r.includes("-nu-")&&(r.includes("-u-")||(r+="-u-"),r+=`-nu-${t}`),e.style==="unit"&&!j){var i;let{unit:l,unitDisplay:o="short"}=e;if(!l)throw new Error('unit option must be provided with style: "unit"');if(!(!((i=ie[l])===null||i===void 0)&&i[o]))throw new Error(`Unsupported unit ${l} with unitDisplay = ${o}`);e={...e,style:"decimal"}}let n=r+(e?Object.entries(e).sort((l,o)=>l[0]<o[0]?-1:1).join():"");if(z.has(n))return z.get(n);let a=new Intl.NumberFormat(r,e);return z.set(n,a),a}function ve(r,e,t){if(e==="auto")return r.format(t);if(e==="never")return r.format(Math.abs(t));{let i=!1;if(e==="always"?i=t>0||Object.is(t,0):e==="exceptZero"&&(Object.is(t,-0)||Object.is(t,0)?t=Math.abs(t):i=t>0),i){let n=r.format(-t),a=r.format(t),l=n.replace(a,"").replace(/\u200e|\u061C/,"");return[...l].length!==1&&console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"),n.replace(a,"!!!").replace(l,"+").replace("!!!",a)}else return r.format(t)}}const Ne=new RegExp("^.*\\(.*\\).*$"),Ve=["latn","arab","hanidec","deva","beng"];class re{parse(e){return W(this.locale,this.options,e).parse(e)}isValidPartialNumber(e,t,i){return W(this.locale,this.options,e).isValidPartialNumber(e,t,i)}getNumberingSystem(e){return W(this.locale,this.options,e).options.numberingSystem}constructor(e,t={}){this.locale=e,this.options=t}}const Q=new Map;function W(r,e,t){let i=J(r,e);if(!r.includes("-nu-")&&!i.isValidPartialNumber(t)){for(let n of Ve)if(n!==i.options.numberingSystem){let a=J(r+(r.includes("-u-")?"-nu-":"-u-nu-")+n,e);if(a.isValidPartialNumber(t))return a}}return i}function J(r,e){let t=r+(e?Object.entries(e).sort((n,a)=>n[0]<a[0]?-1:1).join():""),i=Q.get(t);return i||(i=new Se(r,e),Q.set(t,i)),i}class Se{parse(e){let t=this.sanitize(e);if(this.symbols.group&&(t=T(t,this.symbols.group,"")),this.symbols.decimal&&(t=t.replace(this.symbols.decimal,".")),this.symbols.minusSign&&(t=t.replace(this.symbols.minusSign,"-")),t=t.replace(this.symbols.numeral,this.symbols.index),this.options.style==="percent"){let l=t.indexOf("-");t=t.replace("-",""),t=t.replace("+","");let o=t.indexOf(".");o===-1&&(o=t.length),t=t.replace(".",""),o-2===0?t=`0.${t}`:o-2===-1?t=`0.0${t}`:o-2===-2?t="0.00":t=`${t.slice(0,o-2)}.${t.slice(o-2)}`,l>-1&&(t=`-${t}`)}let i=t?+t:NaN;if(isNaN(i))return NaN;if(this.options.style==="percent"){var n,a;let l={...this.options,style:"decimal",minimumFractionDigits:Math.min(((n=this.options.minimumFractionDigits)!==null&&n!==void 0?n:0)+2,20),maximumFractionDigits:Math.min(((a=this.options.maximumFractionDigits)!==null&&a!==void 0?a:0)+2,20)};return new re(this.locale,l).parse(new Z(this.locale,l).format(i))}return this.options.currencySign==="accounting"&&Ne.test(e)&&(i=-1*i),i}sanitize(e){return e=e.replace(this.symbols.literals,""),this.symbols.minusSign&&(e=e.replace("-",this.symbols.minusSign)),this.options.numberingSystem==="arab"&&(this.symbols.decimal&&(e=e.replace(",",this.symbols.decimal),e=e.replace("،",this.symbols.decimal)),this.symbols.group&&(e=T(e,".",this.symbols.group))),this.options.locale==="fr-FR"&&this.symbols.group&&(e=T(e," ",this.symbols.group),e=T(e,/\u00A0/g,this.symbols.group)),e}isValidPartialNumber(e,t=-1/0,i=1/0){return e=this.sanitize(e),this.symbols.minusSign&&e.startsWith(this.symbols.minusSign)&&t<0?e=e.slice(this.symbols.minusSign.length):this.symbols.plusSign&&e.startsWith(this.symbols.plusSign)&&i>0&&(e=e.slice(this.symbols.plusSign.length)),this.symbols.group&&e.startsWith(this.symbols.group)||this.symbols.decimal&&e.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&(e=T(e,this.symbols.group,"")),e=e.replace(this.symbols.numeral,""),this.symbols.decimal&&(e=e.replace(this.symbols.decimal,"")),e.length===0)}constructor(e,t={}){this.locale=e,t.roundingIncrement!==1&&t.roundingIncrement!=null&&(t.maximumFractionDigits==null&&t.minimumFractionDigits==null?(t.maximumFractionDigits=0,t.minimumFractionDigits=0):t.maximumFractionDigits==null?t.maximumFractionDigits=t.minimumFractionDigits:t.minimumFractionDigits==null&&(t.minimumFractionDigits=t.maximumFractionDigits)),this.formatter=new Intl.NumberFormat(e,t),this.options=this.formatter.resolvedOptions(),this.symbols=we(e,this.formatter,this.options,t);var i,n;this.options.style==="percent"&&(((i=this.options.minimumFractionDigits)!==null&&i!==void 0?i:0)>18||((n=this.options.maximumFractionDigits)!==null&&n!==void 0?n:0)>18)&&console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.")}}const X=new Set(["decimal","fraction","integer","minusSign","plusSign","group"]),De=[0,4,2,1,11,20,3,7,100,21,.1,1.1];function we(r,e,t,i){var n,a,l,o;let c=new Intl.NumberFormat(r,{...t,minimumSignificantDigits:1,maximumSignificantDigits:21,roundingIncrement:1,roundingPriority:"auto",roundingMode:"halfExpand"}),V=c.formatToParts(-10000.111),b=c.formatToParts(10000.111),f=De.map(s=>c.formatToParts(s));var h;let g=(h=(n=V.find(s=>s.type==="minusSign"))===null||n===void 0?void 0:n.value)!==null&&h!==void 0?h:"-",p=(a=b.find(s=>s.type==="plusSign"))===null||a===void 0?void 0:a.value;!p&&((i==null?void 0:i.signDisplay)==="exceptZero"||(i==null?void 0:i.signDisplay)==="always")&&(p="+");let D=(l=new Intl.NumberFormat(r,{...t,minimumFractionDigits:2,maximumFractionDigits:2}).formatToParts(.001).find(s=>s.type==="decimal"))===null||l===void 0?void 0:l.value,w=(o=V.find(s=>s.type==="group"))===null||o===void 0?void 0:o.value,x=V.filter(s=>!X.has(s.type)).map(s=>H(s.value)),y=f.flatMap(s=>s.filter(E=>!X.has(E.type)).map(E=>H(E.value))),v=[...new Set([...x,...y])].sort((s,E)=>E.length-s.length),d=v.length===0?new RegExp("[\\p{White_Space}]","gu"):new RegExp(`${v.join("|")}|[\\p{White_Space}]`,"gu"),P=[...new Intl.NumberFormat(t.locale,{useGrouping:!1}).format(9876543210)].reverse(),S=new Map(P.map((s,E)=>[s,E])),F=new RegExp(`[${P.join("")}]`,"g");return{minusSign:g,plusSign:p,decimal:D,group:w,literals:d,numeral:F,index:s=>String(S.get(s))}}function T(r,e,t){return r.replaceAll?r.replaceAll(e,t):r.split(e).join(t)}function H(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xe(r){let{minValue:e,maxValue:t,step:i,formatOptions:n,value:a,defaultValue:l=NaN,onChange:o,locale:c,isDisabled:V,isReadOnly:b}=r;a===null&&(a=NaN),a!==void 0&&!isNaN(a)&&(i!==void 0&&!isNaN(i)?a=M(a,e,t,i):a=L(a,e,t)),isNaN(l)||(i!==void 0&&!isNaN(i)?l=M(l,e,t,i):l=L(l,e,t));let[f,h]=pe.$458b0a5536c1a7cf$export$40bfa8c7b0832715(a,isNaN(l)?NaN:l,o),[g,p]=u.useState(()=>isNaN(f)?"":new Z(c,n).format(f)),$=u.useMemo(()=>new re(c,n),[c,n]),D=u.useMemo(()=>$.getNumberingSystem(g),[$,g]),w=u.useMemo(()=>new Z(c,{...n,numberingSystem:D}),[c,n,D]),x=u.useMemo(()=>w.resolvedOptions(),[w]),y=u.useCallback(m=>isNaN(m)||m===null?"":w.format(m),[w]),v=he({...r,value:f}),d=i!==void 0&&!isNaN(i)?i:1;x.style==="percent"&&(i===void 0||isNaN(i))&&(d=.01);let[P,S]=u.useState(f),[F,I]=u.useState(c),[s,E]=u.useState(n);(!Object.is(f,P)||c!==F||n!==s)&&(p(y(f)),S(f),I(c),E(n));let N=u.useMemo(()=>$.parse(g),[$,g]),ae=()=>{if(!g.length){h(NaN),p(a===void 0?"":y(f));return}if(isNaN(N)){p(y(f));return}let m;i===void 0||isNaN(i)?m=L(N,e,t):m=M(N,e,t,i),m=$.parse(y(m)),h(m),p(y(a===void 0?m:f))},B=(m,K=0)=>{let R=N;if(isNaN(R)){let C=isNaN(K)?0:K;return M(C,e,t,d)}else{let C=M(R,e,t,d);return m==="+"&&C>R||m==="-"&&C<R?C:M(_(m,R,d),e,t,d)}},ne=()=>{let m=B("+",e);m===f&&p(y(m)),h(m),v.commitValidation()},se=()=>{let m=B("-",t);m===f&&p(y(m)),h(m),v.commitValidation()},le=()=>{t!=null&&(h(M(t,e,t,d)),v.commitValidation())},oe=()=>{e!=null&&(h(e),v.commitValidation())},ue=u.useMemo(()=>!V&&!b&&(isNaN(N)||t===void 0||isNaN(t)||M(N,e,t,d)>N||_("+",N,d)<=t),[V,b,e,t,d,N]),me=u.useMemo(()=>!V&&!b&&(isNaN(N)||e===void 0||isNaN(e)||M(N,e,t,d)<N||_("-",N,d)>=e),[V,b,e,t,d,N]);return{...v,validate:m=>$.isValidPartialNumber(m,e,t),increment:ne,incrementToMax:le,decrement:se,decrementToMin:oe,canIncrement:ue,canDecrement:me,minValue:e,maxValue:t,numberValue:N,setNumberValue:h,setInputValue:p,inputValue:g,commit:ae}}function _(r,e,t){let i=r==="+"?e+t:e-t;if(e%1!==0||t%1!==0){const n=e.toString().split("."),a=t.toString().split("."),l=n[1]&&n[1].length||0,o=a[1]&&a[1].length||0,c=Math.pow(10,Math.max(l,o));e=Math.round(e*c),t=Math.round(t*c),i=r==="+"?e+t:e-t,i/=c}return i}const Pe=u.forwardRef(({placeholder:r,variant:e,disabled:t,type:i,readOnly:n,leftAdornments:a,rightAdornments:l,leftAdornmentsProps:o,rightAdornmentsProps:c,leftAdornmentsWidth:V,rightAdornmentsWidth:b,className:f,style:h,label:g,value:p,locale:$,...D},w)=>{$=$??"nb-NO";const x=xe({...D,label:g??"number-field",value:p,onChange:d=>{D.onChange&&D.onChange(d)},locale:$}),y=u.useRef(null),{inputProps:v}=de.useNumberField({...D,isReadOnly:n,isDisabled:t,label:g??"number-field",value:p},x,y);return ce.jsx(fe.Input,{placeholder:r,variant:e,type:i,leftAdornments:a,rightAdornments:l,leftAdornmentsProps:o,rightAdornmentsProps:c,leftAdornmentsWidth:V,rightAdornmentsWidth:b,className:f,style:h,"data-testid":`number-field-${g}`,...v,onKeyDown:d=>{var P;if(d.key==="."){d.preventDefault();const S=d.target;if((P=S.value)!=null&&P.includes(","))return;const F=S.selectionStart||0,I=S.selectionEnd||0;S.value=S.value.substring(0,F)+","+S.value.substring(I)}},ref:w,"aria-label":g})});exports.NumberField=Pe;
|
package/number.mjs
CHANGED
|
@@ -69,11 +69,11 @@ function De(r) {
|
|
|
69
69
|
n
|
|
70
70
|
]);
|
|
71
71
|
a != null && a.validationDetails.valid && (a = void 0);
|
|
72
|
-
let
|
|
73
|
-
|
|
72
|
+
let p = pe(Ve), d = w(() => i ? Array.isArray(i) ? i.flatMap((s) => B(p[s])) : B(p[i]) : [], [
|
|
73
|
+
p,
|
|
74
74
|
i
|
|
75
|
-
]), [
|
|
76
|
-
|
|
75
|
+
]), [b, h] = M(p), [f, g] = M(!1);
|
|
76
|
+
p !== b && (h(p), g(!1));
|
|
77
77
|
let S = w(() => J(f ? [] : d), [
|
|
78
78
|
f,
|
|
79
79
|
d
|
|
@@ -91,10 +91,10 @@ function De(r) {
|
|
|
91
91
|
},
|
|
92
92
|
resetValidation() {
|
|
93
93
|
let s = T;
|
|
94
|
-
_(s, y.current) || (y.current = s, $(s)), o === "native" && V(!1),
|
|
94
|
+
_(s, y.current) || (y.current = s, $(s)), o === "native" && V(!1), g(!0);
|
|
95
95
|
},
|
|
96
96
|
commitValidation() {
|
|
97
|
-
o === "native" && V(!0),
|
|
97
|
+
o === "native" && V(!0), g(!0);
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
100
|
}
|
|
@@ -351,9 +351,9 @@ function Re(r, e, t, i) {
|
|
|
351
351
|
roundingIncrement: 1,
|
|
352
352
|
roundingPriority: "auto",
|
|
353
353
|
roundingMode: "halfExpand"
|
|
354
|
-
}), N = m.formatToParts(-10000.111),
|
|
355
|
-
var
|
|
356
|
-
let
|
|
354
|
+
}), N = m.formatToParts(-10000.111), p = m.formatToParts(10000.111), d = Ie.map((s) => m.formatToParts(s));
|
|
355
|
+
var b;
|
|
356
|
+
let h = (b = (n = N.find((s) => s.type === "minusSign")) === null || n === void 0 ? void 0 : n.value) !== null && b !== void 0 ? b : "-", f = (a = p.find((s) => s.type === "plusSign")) === null || a === void 0 ? void 0 : a.value;
|
|
357
357
|
!f && ((i == null ? void 0 : i.signDisplay) === "exceptZero" || (i == null ? void 0 : i.signDisplay) === "always") && (f = "+");
|
|
358
358
|
let S = (l = new Intl.NumberFormat(r, {
|
|
359
359
|
...t,
|
|
@@ -373,7 +373,7 @@ function Re(r, e, t, i) {
|
|
|
373
373
|
E
|
|
374
374
|
])), I = new RegExp(`[${P.join("")}]`, "g");
|
|
375
375
|
return {
|
|
376
|
-
minusSign:
|
|
376
|
+
minusSign: h,
|
|
377
377
|
plusSign: f,
|
|
378
378
|
decimal: S,
|
|
379
379
|
group: D,
|
|
@@ -388,15 +388,15 @@ function A(r, e, t) {
|
|
|
388
388
|
function te(r) {
|
|
389
389
|
return r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
let { minValue: e, maxValue: t, step: i, formatOptions: n, value: a, defaultValue: l = NaN, onChange: o, locale: m, isDisabled: N, isReadOnly:
|
|
391
|
+
function Oe(r) {
|
|
392
|
+
let { minValue: e, maxValue: t, step: i, formatOptions: n, value: a, defaultValue: l = NaN, onChange: o, locale: m, isDisabled: N, isReadOnly: p } = r;
|
|
393
393
|
a === null && (a = NaN), a !== void 0 && !isNaN(a) && (i !== void 0 && !isNaN(i) ? a = F(a, e, t, i) : a = W(a, e, t)), isNaN(l) || (i !== void 0 && !isNaN(i) ? l = F(l, e, t, i) : l = W(l, e, t));
|
|
394
|
-
let [d,
|
|
394
|
+
let [d, b] = Ne(a, isNaN(l) ? NaN : l, o), [h, f] = M(() => isNaN(d) ? "" : new Y(m, n).format(d)), g = w(() => new ne(m, n), [
|
|
395
395
|
m,
|
|
396
396
|
n
|
|
397
|
-
]), S = w(() =>
|
|
398
|
-
|
|
399
|
-
|
|
397
|
+
]), S = w(() => g.getNumberingSystem(h), [
|
|
398
|
+
g,
|
|
399
|
+
h
|
|
400
400
|
]), D = w(() => new Y(m, {
|
|
401
401
|
...n,
|
|
402
402
|
numberingSystem: S
|
|
@@ -415,12 +415,12 @@ function Ce(r) {
|
|
|
415
415
|
x.style === "percent" && (i === void 0 || isNaN(i)) && (c = 0.01);
|
|
416
416
|
let [P, V] = M(d), [I, R] = M(m), [s, E] = M(n);
|
|
417
417
|
(!Object.is(d, P) || m !== I || n !== s) && (f($(d)), V(d), R(m), E(n));
|
|
418
|
-
let v = w(() =>
|
|
419
|
-
|
|
420
|
-
|
|
418
|
+
let v = w(() => g.parse(h), [
|
|
419
|
+
g,
|
|
420
|
+
h
|
|
421
421
|
]), se = () => {
|
|
422
|
-
if (!
|
|
423
|
-
|
|
422
|
+
if (!h.length) {
|
|
423
|
+
b(NaN), f(a === void 0 ? "" : $(d));
|
|
424
424
|
return;
|
|
425
425
|
}
|
|
426
426
|
if (isNaN(v)) {
|
|
@@ -428,36 +428,36 @@ function Ce(r) {
|
|
|
428
428
|
return;
|
|
429
429
|
}
|
|
430
430
|
let u;
|
|
431
|
-
i === void 0 || isNaN(i) ? u = W(v, e, t) : u = F(v, e, t, i), u =
|
|
431
|
+
i === void 0 || isNaN(i) ? u = W(v, e, t) : u = F(v, e, t, i), u = g.parse($(u)), b(u), f($(a === void 0 ? u : d));
|
|
432
432
|
}, k = (u, Q = 0) => {
|
|
433
|
-
let
|
|
434
|
-
if (isNaN(
|
|
435
|
-
let
|
|
436
|
-
return F(
|
|
433
|
+
let O = v;
|
|
434
|
+
if (isNaN(O)) {
|
|
435
|
+
let C = isNaN(Q) ? 0 : Q;
|
|
436
|
+
return F(C, e, t, c);
|
|
437
437
|
} else {
|
|
438
|
-
let
|
|
439
|
-
return u === "+" &&
|
|
438
|
+
let C = F(O, e, t, c);
|
|
439
|
+
return u === "+" && C > O || u === "-" && C < O ? C : F(U(u, O, c), e, t, c);
|
|
440
440
|
}
|
|
441
441
|
}, le = () => {
|
|
442
442
|
let u = k("+", e);
|
|
443
|
-
u === d && f($(u)),
|
|
443
|
+
u === d && f($(u)), b(u), y.commitValidation();
|
|
444
444
|
}, oe = () => {
|
|
445
445
|
let u = k("-", t);
|
|
446
|
-
u === d && f($(u)),
|
|
446
|
+
u === d && f($(u)), b(u), y.commitValidation();
|
|
447
447
|
}, ue = () => {
|
|
448
|
-
t != null && (
|
|
448
|
+
t != null && (b(F(t, e, t, c)), y.commitValidation());
|
|
449
449
|
}, me = () => {
|
|
450
|
-
e != null && (
|
|
451
|
-
}, ce = w(() => !N && !
|
|
450
|
+
e != null && (b(e), y.commitValidation());
|
|
451
|
+
}, ce = w(() => !N && !p && (isNaN(v) || t === void 0 || isNaN(t) || F(v, e, t, c) > v || U("+", v, c) <= t), [
|
|
452
452
|
N,
|
|
453
|
-
|
|
453
|
+
p,
|
|
454
454
|
e,
|
|
455
455
|
t,
|
|
456
456
|
c,
|
|
457
457
|
v
|
|
458
|
-
]), de = w(() => !N && !
|
|
458
|
+
]), de = w(() => !N && !p && (isNaN(v) || e === void 0 || isNaN(e) || F(v, e, t, c) < v || U("-", v, c) >= e), [
|
|
459
459
|
N,
|
|
460
|
-
|
|
460
|
+
p,
|
|
461
461
|
e,
|
|
462
462
|
t,
|
|
463
463
|
c,
|
|
@@ -465,7 +465,7 @@ function Ce(r) {
|
|
|
465
465
|
]);
|
|
466
466
|
return {
|
|
467
467
|
...y,
|
|
468
|
-
validate: (u) =>
|
|
468
|
+
validate: (u) => g.isValidPartialNumber(u, e, t),
|
|
469
469
|
increment: le,
|
|
470
470
|
incrementToMax: ue,
|
|
471
471
|
decrement: oe,
|
|
@@ -475,9 +475,9 @@ function Ce(r) {
|
|
|
475
475
|
minValue: e,
|
|
476
476
|
maxValue: t,
|
|
477
477
|
numberValue: v,
|
|
478
|
-
setNumberValue:
|
|
478
|
+
setNumberValue: b,
|
|
479
479
|
setInputValue: f,
|
|
480
|
-
inputValue:
|
|
480
|
+
inputValue: h,
|
|
481
481
|
commit: se
|
|
482
482
|
};
|
|
483
483
|
}
|
|
@@ -501,25 +501,29 @@ const _e = $e(
|
|
|
501
501
|
leftAdornmentsProps: o,
|
|
502
502
|
rightAdornmentsProps: m,
|
|
503
503
|
leftAdornmentsWidth: N,
|
|
504
|
-
rightAdornmentsWidth:
|
|
504
|
+
rightAdornmentsWidth: p,
|
|
505
505
|
className: d,
|
|
506
|
-
style:
|
|
507
|
-
label:
|
|
506
|
+
style: b,
|
|
507
|
+
label: h,
|
|
508
508
|
value: f,
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
509
|
+
locale: g,
|
|
510
|
+
...S
|
|
511
|
+
}, D) => {
|
|
512
|
+
g = g ?? "nb-NO";
|
|
513
|
+
const x = Oe({
|
|
514
|
+
...S,
|
|
515
|
+
label: h ?? "number-field",
|
|
514
516
|
value: f,
|
|
515
517
|
onChange: (c) => {
|
|
516
|
-
|
|
518
|
+
S.onChange && S.onChange(c);
|
|
517
519
|
},
|
|
518
|
-
locale:
|
|
520
|
+
locale: g
|
|
519
521
|
}), $ = Z(null), { inputProps: y } = ye(
|
|
520
522
|
{
|
|
521
|
-
...
|
|
522
|
-
|
|
523
|
+
...S,
|
|
524
|
+
isReadOnly: n,
|
|
525
|
+
isDisabled: t,
|
|
526
|
+
label: h ?? "number-field",
|
|
523
527
|
value: f
|
|
524
528
|
},
|
|
525
529
|
x,
|
|
@@ -530,18 +534,16 @@ const _e = $e(
|
|
|
530
534
|
{
|
|
531
535
|
placeholder: r,
|
|
532
536
|
variant: e,
|
|
533
|
-
disabled: t,
|
|
534
537
|
type: i,
|
|
535
|
-
readOnly: n,
|
|
536
538
|
leftAdornments: a,
|
|
537
539
|
rightAdornments: l,
|
|
538
540
|
leftAdornmentsProps: o,
|
|
539
541
|
rightAdornmentsProps: m,
|
|
540
542
|
leftAdornmentsWidth: N,
|
|
541
|
-
rightAdornmentsWidth:
|
|
543
|
+
rightAdornmentsWidth: p,
|
|
542
544
|
className: d,
|
|
543
|
-
style:
|
|
544
|
-
"data-testid": `number-field-${
|
|
545
|
+
style: b,
|
|
546
|
+
"data-testid": `number-field-${h}`,
|
|
545
547
|
...y,
|
|
546
548
|
onKeyDown: (c) => {
|
|
547
549
|
var P;
|
|
@@ -553,8 +555,8 @@ const _e = $e(
|
|
|
553
555
|
V.value = V.value.substring(0, I) + "," + V.value.substring(R);
|
|
554
556
|
}
|
|
555
557
|
},
|
|
556
|
-
ref:
|
|
557
|
-
"aria-label":
|
|
558
|
+
ref: D,
|
|
559
|
+
"aria-label": h
|
|
558
560
|
}
|
|
559
561
|
);
|
|
560
562
|
}
|