@ni/nimble-components 32.2.5 → 32.2.6
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 +23 -0
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +5 -3
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/select/index.d.ts +3 -0
- package/dist/esm/select/index.js +23 -0
- package/dist/esm/select/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -9378,7 +9378,7 @@ _i.getOrCreate().withPrefix("nimble").register(fO())
|
|
|
9378
9378
|
const mO="nimble-spinner",gO=t=>t instanceof hb,vO=t=>t instanceof gb
|
|
9379
9379
|
let bO=class extends Fi{}
|
|
9380
9380
|
class yO extends(An(bO)){constructor(){super(...arguments),this.proxy=document.createElement("select")}}const wO=t=>!t.visuallyHidden&&!t.disabled&&!t.hidden,xO=t=>!t.visuallyHidden&&!t.hidden
|
|
9381
|
-
class CO extends yO{constructor(){super(...arguments),this.appearance=Vg,this.errorVisible=!1,this.filterMode=Wg.none,this.clearable=!1,this.loadingVisible=!1,this.displayPlaceholder=!1,this.open=!1,this.listboxId=el("listbox-"),this.hasOverflow=!1,this.filteredOptions=[],this.filter="",this.availableViewportHeight=0,this._value="",this.forcedPosition=!1}get collapsible(){return!(this.multiple||"number"==typeof this.size)}get labelContent(){return this.$fastController.isConnected?db(this.labelSlot):""}connectedCallback(){super.connectedCallback(),this.forcedPosition=!!this.positionAttribute,this.open&&this.initializeOpenState()}get value(){return x.track(this,"value"),this._value}set value(t){const e=this._value
|
|
9381
|
+
class CO extends yO{constructor(){super(...arguments),this.appearance=Vg,this.errorVisible=!1,this.filterMode=Wg.none,this.clearable=!1,this.loadingVisible=!1,this.displayPlaceholder=!1,this.open=!1,this.listboxId=el("listbox-"),this.hasOverflow=!1,this.filteredOptions=[],this.filter="",this.availableViewportHeight=0,this._value="",this.forcedPosition=!1,this.selectedOptionObserver=new MutationObserver((()=>{this.updateDisplayValue()}))}get collapsible(){return!(this.multiple||"number"==typeof this.size)}get labelContent(){return this.$fastController.isConnected?db(this.labelSlot):""}connectedCallback(){super.connectedCallback(),this.forcedPosition=!!this.positionAttribute,this.open&&this.initializeOpenState(),this.observeSelectedOptionTextContent()}disconnectedCallback(){super.disconnectedCallback(),this.selectedOptionObserver?.disconnect()}get value(){return x.track(this,"value"),this._value}set value(t){const e=this._value
|
|
9382
9382
|
let n=t
|
|
9383
9383
|
if(this.options?.length){const t=this.options.findIndex((t=>t.value===n)),e=this.options[this.selectedIndex]?.value??null,i=this.options[t]?.value??null;-1!==t&&e===i||(n="",this.selectedIndex=t),n=this.firstSelectedOption?.value??n}e!==n&&(this._value=n,super.valueChanged(e,n),x.notify(this,"value"),this.updateDisplayValue())}get displayValue(){return x.track(this,"displayValue"),this.firstSelectedOption?.text??""}anchoredRegionChanged(t,e){this.anchoredRegion&&this.control&&(this.anchoredRegion.anchorElement=this.control)}controlChanged(t,e){this.anchoredRegion&&this.control&&(this.anchoredRegion.anchorElement=this.control)}slottedOptionsChanged(t,e){const n=this.value
|
|
9384
9384
|
this.options.forEach((t=>{const e=x.getNotifier(t)
|
|
@@ -9473,10 +9473,12 @@ const t=[]
|
|
|
9473
9473
|
for(const e of this.slottedOptions)if(vO(e)){if(e.hidden)continue
|
|
9474
9474
|
const n=this.getGroupOptions(e),i=this.filterMatchesText(e.labelContent)
|
|
9475
9475
|
n.forEach((e=>{e.visuallyHidden=!i&&this.isOptionHiddenOrFilteredOut(e),e.visuallyHidden||t.push(e)}))}else gO(e)&&(e.visuallyHidden=this.isOptionHiddenOrFilteredOut(e),e.visuallyHidden||t.push(e))
|
|
9476
|
-
this.filteredOptions=t}getGroupOptions(t){return Array.from(t.children).filter((t=>gO(t))).map((e=>(t.hidden&&gO(e)&&(e.visuallyHidden=!0),e)))}updateValue(t){this.$fastController.isConnected&&(this.value=this.firstSelectedOption?.value??""),t&&(this.$emit("input"),this.$emit("change",this,{bubbles:!0,composed:void 0}))}clearSelect(){const t=this.getPlaceholderOption()
|
|
9476
|
+
this.filteredOptions=t}getGroupOptions(t){return Array.from(t.children).filter((t=>gO(t))).map((e=>(t.hidden&&gO(e)&&(e.visuallyHidden=!0),e)))}updateValue(t){this.$fastController.isConnected&&(this.value=this.firstSelectedOption?.value??"",this.observeSelectedOptionTextContent()),t&&(this.$emit("input"),this.$emit("change",this,{bubbles:!0,composed:void 0}))}clearSelect(){const t=this.getPlaceholderOption()
|
|
9477
9477
|
this.selectedIndex=t?this.options.indexOf(t):-1}setProxyOptions(){this.proxy instanceof HTMLSelectElement&&this.options&&(this.proxy.options.length=0,this.options.forEach((t=>{const e=t.proxy||(t instanceof HTMLOptionElement?t.cloneNode():null)
|
|
9478
9478
|
e&&this.proxy.options.add(e)})))}filterChanged(){this.filterOptions()}emitFilterInputEvent(){const t={filterText:this.filter}
|
|
9479
|
-
this.$emit("filter-input",t,{bubbles:!0})}initializeOpenState(){this.setActiveOption(this.selectedIndex),this.ariaControls=this.listboxId,this.ariaExpanded="true",this.setPositioning(),this.focusAndScrollOptionIntoView()}
|
|
9479
|
+
this.$emit("filter-input",t,{bubbles:!0})}initializeOpenState(){this.setActiveOption(this.selectedIndex),this.ariaControls=this.listboxId,this.ariaExpanded="true",this.setPositioning(),this.focusAndScrollOptionIntoView()}observeSelectedOptionTextContent(){if(this.selectedOptionObserver?.disconnect(),-1===this.selectedIndex)return
|
|
9480
|
+
const t=this.firstSelectedOption
|
|
9481
|
+
t&&this.selectedOptionObserver?.observe(t,{characterData:!0,subtree:!0,childList:!0})}}t([ft],CO.prototype,"appearance",void 0),t([ft({attribute:"position"})],CO.prototype,"positionAttribute",void 0),t([ft({attribute:"error-text"})],CO.prototype,"errorText",void 0),t([ft({attribute:"error-visible",mode:"boolean"})],CO.prototype,"errorVisible",void 0),t([ft({attribute:"filter-mode"})],CO.prototype,"filterMode",void 0),t([ft({attribute:"clearable",mode:"boolean"})],CO.prototype,"clearable",void 0),t([ft({attribute:"loading-visible",mode:"boolean"})],CO.prototype,"loadingVisible",void 0),t([C],CO.prototype,"displayPlaceholder",void 0),t([ft({attribute:"open",mode:"boolean"})],CO.prototype,"open",void 0),t([C],CO.prototype,"position",void 0),t([C],CO.prototype,"control",void 0),t([C],CO.prototype,"scrollableRegion",void 0),t([C],CO.prototype,"filterInput",void 0),t([C],CO.prototype,"anchoredRegion",void 0),t([C],CO.prototype,"hasOverflow",void 0),t([C],CO.prototype,"filteredOptions",void 0),t([C],CO.prototype,"filter",void 0),t([C],CO.prototype,"availableViewportHeight",void 0),t([k],CO.prototype,"collapsible",null),t([k],CO.prototype,"labelContent",null),t([k],CO.prototype,"displayValue",null)
|
|
9480
9482
|
const kO=CO.compose({baseName:"select",baseClass:ns,template:(t,e)=>Q`
|
|
9481
9483
|
<template
|
|
9482
9484
|
class="${t=>[t.collapsible&&"collapsible",t.collapsible&&t.open&&"open",t.disabled&&"disabled",t.collapsible&&t.position].filter(Boolean).join(" ")}"
|