@ni/nimble-components 33.12.0 → 34.0.0
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/all-components-bundle.js +68 -6
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +7 -6
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/number-field/index.d.ts +10 -0
- package/dist/esm/number-field/index.js +43 -0
- package/dist/esm/number-field/index.js.map +1 -1
- package/dist/esm/number-field/template.js +1 -1
- package/dist/esm/number-field/template.js.map +1 -1
- package/dist/esm/number-field/testing/number-field.pageobject.d.ts +23 -0
- package/dist/esm/number-field/testing/number-field.pageobject.js +38 -0
- package/dist/esm/number-field/testing/number-field.pageobject.js.map +1 -0
- package/dist/esm/theme-provider/design-tokens.js +1 -1
- package/dist/esm/theme-provider/design-tokens.js.map +1 -1
- package/package.json +2 -2
|
@@ -871,12 +871,12 @@ const i=Math.min(this.min,this.max)
|
|
|
871
871
|
void 0!==this.min&&this.min!==i&&(this.min=i),this.value=this.getValidValue(this.value)}minChanged(t,e){var n
|
|
872
872
|
this.min=Math.min(e,null!==(n=this.max)&&void 0!==n?n:e)
|
|
873
873
|
const i=Math.max(this.min,this.max)
|
|
874
|
-
void 0!==this.max&&this.max!==i&&(this.max=i),this.value=this.getValidValue(this.value)}get valueAsNumber(){return parseFloat(super.value)}set valueAsNumber(t){this.value=t.toString()}valueChanged(t,e){this.value=this.getValidValue(e),e===this.value&&(this.control&&!this.isUserInput&&
|
|
874
|
+
void 0!==this.max&&this.max!==i&&(this.max=i),this.value=this.getValidValue(this.value)}get valueAsNumber(){return parseFloat(super.value)}set valueAsNumber(t){this.value=t.toString()}valueChanged(t,e){this.value=this.getValidValue(e),e===this.value&&(this.control&&!this.isUserInput&&this.syncValueToInnerControl(),super.valueChanged(t,this.value),void 0===t||this.isUserInput||(this.$emit("input"),this.$emit("change")),this.isUserInput=!1)}validate(){super.validate(this.control)}getValidValue(t){var e,n
|
|
875
875
|
let i=parseFloat(parseFloat(t).toPrecision(12))
|
|
876
876
|
return isNaN(i)?i="":(i=Math.min(i,null!==(e=this.max)&&void 0!==e?e:i),i=Math.max(i,null!==(n=this.min)&&void 0!==n?n:i).toString()),i}stepUp(){const t=parseFloat(this.value),e=isNaN(t)?this.min>0?this.min:this.max<0?this.max:this.min?0:this.step:t+this.step
|
|
877
877
|
this.value=e.toString()}stepDown(){const t=parseFloat(this.value),e=isNaN(t)?this.min>0?this.min:this.max<0?this.max:this.min?0:0-this.step:t-this.step
|
|
878
|
-
this.value=e.toString()}connectedCallback(){super.connectedCallback(),this.proxy.setAttribute("type","number"),this.validate(),this.
|
|
879
|
-
case rn:return this.stepDown(),!1}return!0}handleBlur(){this.control.value=this.value}}
|
|
878
|
+
this.value=e.toString()}connectedCallback(){super.connectedCallback(),this.proxy.setAttribute("type","number"),this.validate(),this.syncValueToInnerControl(),this.autofocus&&b.queueUpdate((()=>{this.focus()}))}select(){this.control.select(),this.$emit("select")}handleTextInput(){this.control.value=this.sanitizeInput(this.control.value),this.isUserInput=!0,this.syncValueFromInnerControl()}handleChange(){this.$emit("change")}handleKeyDown(t){switch(t.key){case cn:return this.stepUp(),!1
|
|
879
|
+
case rn:return this.stepDown(),!1}return!0}handleBlur(){this.syncValueToInnerControl()}sanitizeInput(t){return t.replace(/[^0-9\-+e.]/g,"")}syncValueFromInnerControl(){this.value=this.control.value}syncValueToInnerControl(){this.control.value=this.value}}
|
|
880
880
|
t([ft({attribute:"readonly",mode:"boolean"})],ts.prototype,"readOnly",void 0),t([ft({mode:"boolean"})],ts.prototype,"autofocus",void 0),t([ft({attribute:"hide-step",mode:"boolean"})],ts.prototype,"hideStep",void 0),t([ft],ts.prototype,"placeholder",void 0),t([ft],ts.prototype,"list",void 0),t([ft({converter:ut})],ts.prototype,"maxlength",void 0),t([ft({converter:ut})],ts.prototype,"minlength",void 0),t([ft({converter:ut})],ts.prototype,"size",void 0),t([ft({converter:ut})],ts.prototype,"step",void 0),t([ft({converter:ut})],ts.prototype,"max",void 0),t([ft({converter:ut})],ts.prototype,"min",void 0),t([C],ts.prototype,"defaultSlottedNodes",void 0),Ze(ts,re,Xi)
|
|
881
881
|
let es=class extends je{constructor(){super(...arguments),this.orientation=Ke,this.radioChangeHandler=t=>{const e=t.target
|
|
882
882
|
e.checked&&(this.slottedRadioButtons.forEach((t=>{t!==e&&(t.checked=!1,this.isInsideFoundationToolbar||t.setAttribute("tabindex","-1"))})),this.selectedRadio=e,this.value=e.value,e.setAttribute("tabindex","0"),this.focusedRadio=e),t.stopPropagation()},this.moveToRadioByIndex=(t,e)=>{const n=t[e]
|
|
@@ -1108,7 +1108,7 @@ Di.getOrCreate().withPrefix("nimble").register(il())
|
|
|
1108
1108
|
const sl="nimble-theme-provider"
|
|
1109
1109
|
function ol(t,e){const{r:n,g:i,b:s}=io(t)
|
|
1110
1110
|
return`rgba(${255*n}, ${255*i}, ${255*s}, ${e})`}const rl=ki.create(Ga(qo)).withDefault((t=>eh(ih(t,wo,po,mo)))),al=ki.create(Ga(jo)).withDefault((t=>ih(t,mo,vo,xo)))
|
|
1111
|
-
ki.create(Ga(Go)).withDefault((t=>ih(t,fo,go,xo))),ki.create(Ga(Zo)).withDefault((t=>ih(t,po,bo,xo))),ki.create(Ga(Ko)).withDefault((t=>`linear-gradient(${ih(t,po,Oo,xo)}, ${ih(t,ol(po,0),ol(Oo,0),ol(xo,0))})`)),ki.create(Ga(Wo)).withDefault((t=>ih(t,
|
|
1111
|
+
ki.create(Ga(Go)).withDefault((t=>ih(t,fo,go,xo))),ki.create(Ga(Zo)).withDefault((t=>ih(t,po,bo,xo))),ki.create(Ga(Ko)).withDefault((t=>`linear-gradient(${ih(t,po,Oo,xo)}, ${ih(t,ol(po,0),ol(Oo,0),ol(xo,0))})`)),ki.create(Ga(Wo)).withDefault((t=>ih(t,po,bo,xo)))
|
|
1112
1112
|
const ll=ki.create(Ga(nr)).withDefault((t=>ol(ah(t),.2))),cl=ki.create(Ga(ir)).withDefault((t=>eh(ah(t)))),dl=ki.create(Ga(sr)).withDefault((t=>ol(ah(t),.15))),hl=ki.create(Ga(or)).withDefault((t=>ol(lh(t),.1)))
|
|
1113
1113
|
ki.create(Ga(rr)).withDefault((t=>eh(lh(t)))),ki.create(Ga(ar)).withDefault((t=>ol(function(t){return ih(t,wo,po,mo)}(t),.15)))
|
|
1114
1114
|
const ul=ki.create(Ga(lr)).withDefault((t=>oh(t))),pl=ki.create(Ga(cr)).withDefault((t=>eh(oh(t)))),fl=ki.create(Ga(dr)).withDefault((t=>sh(t))),ml=ki.create(Ga(hr)).withDefault((t=>function(t){return ih(t,So,ao,mo)}(t))),gl=ki.create(Ga(ur)).withDefault((t=>function(t){return ih(t,lo,co,mo)}(t))),vl=ki.create(Ga(pr)).withDefault((t=>function(t){return ih(t,ro,oo,mo)}(t))),bl=ki.create(Ga(fr)).withDefault((t=>ih(t,Co,$o,mo))),yl=ki.create(Ga(mr)).withDefault((t=>ih(t,wo,po,mo))),wl=ki.create(Ga(gr)).withDefault((t=>function(t){switch(el.getValueFor(t)){case Uo.light:return ol(yo,.3)
|
|
@@ -4942,7 +4942,8 @@ const fy="underline",my="outline",gy="block",vy="frameless",by=Mt`
|
|
|
4942
4942
|
>
|
|
4943
4943
|
<slot ${ie("defaultSlottedNodes")}></slot>
|
|
4944
4944
|
</label>`)
|
|
4945
|
-
class wy extends(nv(_v(ts))){constructor(){super(...arguments),this.appearance=fy,this.fullBleed=!1,this.appearanceReadOnly=!1}connectedCallback(){super.connectedCallback(),this.control.setAttribute("role","spinbutton")}}t(
|
|
4945
|
+
class wy extends(nv(_v(ts))){constructor(){super(...arguments),this.appearance=fy,this.fullBleed=!1,this.appearanceReadOnly=!1,this.decimalSeparator=".",this.inputFilterRegExp=this.buildFilterRegExp(this.decimalSeparator),this.langSubscriber={handleChange:()=>this.updateDecimalSeparatorAndInputFilter()}}connectedCallback(){super.connectedCallback(),this.control.setAttribute("role","spinbutton"),this.updateDecimalSeparatorAndInputFilter(),Qa.subscribe(this.langSubscriber,this)}disconnectedCallback(){super.disconnectedCallback(),Qa.unsubscribe(this.langSubscriber,this)}sanitizeInput(t){return t.replace(this.inputFilterRegExp,"")}syncValueFromInnerControl(){this.value="."!==this.decimalSeparator?this.control.value.replace(this.decimalSeparator,"."):this.control.value}syncValueToInnerControl(){this.control.value="."!==this.decimalSeparator?this.value.replace(".",this.decimalSeparator):this.value}updateDecimalSeparatorAndInputFilter(){const t=this.decimalSeparator
|
|
4946
|
+
this.decimalSeparator=this.getSeparatorForLanguange(Qa.getValueFor(this)),this.decimalSeparator!==t&&(this.inputFilterRegExp=this.buildFilterRegExp(this.decimalSeparator),this.control.value=this.control.value.replace(t,this.decimalSeparator))}getSeparatorForLanguange(t){return Intl.NumberFormat(t).formatToParts(1.1).find((t=>"decimal"===t.type)).value}buildFilterRegExp(t){return new RegExp(`[^0-9\\-+e${t}]`,"g")}}t([ft],wy.prototype,"appearance",void 0),t([ft({attribute:"full-bleed",mode:"boolean"})],wy.prototype,"fullBleed",void 0),t([ft({attribute:"appearance-readonly",mode:"boolean"})],wy.prototype,"appearanceReadOnly",void 0)
|
|
4946
4947
|
const xy=wy.compose({baseName:"number-field",baseClass:ts,template:(t,e)=>Q`
|
|
4947
4948
|
<template class="${t=>t.readOnly?"readonly":""}">
|
|
4948
4949
|
${yy}
|
|
@@ -4966,7 +4967,7 @@ const xy=wy.compose({baseName:"number-field",baseClass:ts,template:(t,e)=>Q`
|
|
|
4966
4967
|
?required="${t=>t.required}"
|
|
4967
4968
|
size="${t=>t.size}"
|
|
4968
4969
|
type="text"
|
|
4969
|
-
inputmode="
|
|
4970
|
+
inputmode="text"
|
|
4970
4971
|
min="${t=>t.min}"
|
|
4971
4972
|
max="${t=>t.max}"
|
|
4972
4973
|
step="${t=>t.step}"
|