@ni/nimble-components 31.0.0 → 31.1.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.
@@ -3017,9 +3017,9 @@ const Ng="nimble-icon-arrow-expander-down",Lg="above",Bg="underline",Pg="outline
3017
3017
  :host {
3018
3018
  color: ${id};
3019
3019
  font: ${nd};
3020
- height: ${Bl};
3021
3020
  position: relative;
3022
- justify-content: center;
3021
+ flex-direction: column;
3022
+ justify-content: flex-start;
3023
3023
  ${Vh}
3024
3024
  min-width: ${Yl};
3025
3025
  outline: none;
@@ -3035,7 +3035,7 @@ const Ng="nimble-icon-arrow-expander-down",Lg="above",Bg="underline",Pg="outline
3035
3035
  bottom: calc(${ql} + var(--ni-private-indicator-lines-gap));
3036
3036
  width: 0px;
3037
3037
  height: 0px;
3038
- justify-self: center;
3038
+ align-self: center;
3039
3039
  border-bottom: ${Ml}
3040
3040
  var(--ni-private-focus-indicator-width) solid;
3041
3041
  transition: width ${oh} ease-in;
@@ -3061,7 +3061,7 @@ const Ng="nimble-icon-arrow-expander-down",Lg="above",Bg="underline",Pg="outline
3061
3061
  bottom: calc(-1 * ${ql});
3062
3062
  width: 0px;
3063
3063
  height: 0px;
3064
- justify-self: center;
3064
+ align-self: center;
3065
3065
  border-bottom: ${Ml}
3066
3066
  var(--ni-private-hover-indicator-width) solid;
3067
3067
  transition: width ${oh} ease-in;
@@ -3086,12 +3086,22 @@ const Ng="nimble-icon-arrow-expander-down",Lg="above",Bg="underline",Pg="outline
3086
3086
  width: 0px;
3087
3087
  }
3088
3088
 
3089
+ .label {
3090
+ display: flex;
3091
+ color: ${Sd};
3092
+ font: ${kd};
3093
+ }
3094
+
3095
+ :host([disabled]) .label {
3096
+ color: ${_d};
3097
+ }
3098
+
3089
3099
  .control {
3090
3100
  align-items: center;
3091
3101
  cursor: pointer;
3092
3102
  display: flex;
3093
- min-height: 100%;
3094
3103
  width: 100%;
3104
+ height: ${Bl};
3095
3105
  border: 0px solid rgba(${Cl}, 0.3);
3096
3106
  background-color: transparent;
3097
3107
  padding: ${ql};
@@ -3427,6 +3437,9 @@ const Yg=Kg.compose({baseName:"combobox",baseClass:Zg,template:(t,e)=>Q`
3427
3437
  @focusout="${(t,e)=>t.focusoutHandler(e.event)}"
3428
3438
  @keydown="${(t,e)=>t.keydownHandler(e.event)}"
3429
3439
  >
3440
+ <label part="label" class="label">
3441
+ <slot></slot>
3442
+ </label>
3430
3443
  <div class="control" part="control" ${Ut("controlWrapper")}>
3431
3444
  ${le(0,e)}
3432
3445
  <slot name="control">
@@ -3511,8 +3524,7 @@ const Yg=Kg.compose({baseName:"combobox",baseClass:Zg,template:(t,e)=>Q`
3511
3524
  @keydown="${(t,e)=>t.toggleButtonKeyDownHandler(e.event)}"
3512
3525
  class="dropdown-button"
3513
3526
  part="button"
3514
- aria-haspopup="true"
3515
- aria-expanded="${t=>t.open}"
3527
+ aria-hidden="true"
3516
3528
  tabindex="-1"
3517
3529
  >
3518
3530
  <${Ng}
@@ -9377,7 +9389,8 @@ _i.getOrCreate().withPrefix("nimble").register(hO())
9377
9389
  const uO="nimble-spinner",pO=t=>t instanceof ab,fO=t=>t instanceof ub
9378
9390
  let mO=class extends Fi{}
9379
9391
  class gO extends(An(mO)){constructor(){super(...arguments),this.proxy=document.createElement("select")}}const vO=t=>!t.visuallyHidden&&!t.disabled&&!t.hidden,bO=t=>!t.visuallyHidden&&!t.hidden
9380
- class yO extends gO{constructor(){super(...arguments),this.appearance=Bg,this.errorVisible=!1,this.filterMode=Ug.none,this.clearable=!1,this.loadingVisible=!1,this.displayPlaceholder=!1,this.open=!1,this.listboxId=il("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)}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
9392
+ class yO extends gO{constructor(){super(...arguments),this.appearance=Bg,this.errorVisible=!1,this.filterMode=Ug.none,this.clearable=!1,this.loadingVisible=!1,this.displayPlaceholder=!1,this.open=!1,this.listboxId=il("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(){if(!this.$fastController.isConnected)return""
9393
+ return this.labelSlot.assignedNodes().filter((t=>""!==t.textContent?.trim())).map((t=>t.textContent?.trim())).join(" ")}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
9394
  let n=t
9382
9395
  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
9383
9396
  this.options.forEach((t=>{const e=x.getNotifier(t)
@@ -9475,7 +9488,7 @@ n.forEach((e=>{e.visuallyHidden=!i&&this.isOptionHiddenOrFilteredOut(e),e.visual
9475
9488
  this.filteredOptions=t}getGroupOptions(t){return Array.from(t.children).filter((t=>pO(t))).map((e=>(t.hidden&&pO(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
9489
  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)
9477
9490
  e&&this.proxy.options.add(e)})))}filterChanged(){this.filterOptions()}emitFilterInputEvent(){const t={filterText:this.filter}
9478
- this.$emit("filter-input",t,{bubbles:!0})}initializeOpenState(){this.setActiveOption(this.selectedIndex),this.ariaControls=this.listboxId,this.ariaExpanded="true",this.setPositioning(),this.focusAndScrollOptionIntoView()}}t([ft],yO.prototype,"appearance",void 0),t([ft({attribute:"position"})],yO.prototype,"positionAttribute",void 0),t([ft({attribute:"error-text"})],yO.prototype,"errorText",void 0),t([ft({attribute:"error-visible",mode:"boolean"})],yO.prototype,"errorVisible",void 0),t([ft({attribute:"filter-mode"})],yO.prototype,"filterMode",void 0),t([ft({attribute:"clearable",mode:"boolean"})],yO.prototype,"clearable",void 0),t([ft({attribute:"loading-visible",mode:"boolean"})],yO.prototype,"loadingVisible",void 0),t([C],yO.prototype,"displayPlaceholder",void 0),t([ft({attribute:"open",mode:"boolean"})],yO.prototype,"open",void 0),t([C],yO.prototype,"position",void 0),t([C],yO.prototype,"control",void 0),t([C],yO.prototype,"scrollableRegion",void 0),t([C],yO.prototype,"filterInput",void 0),t([C],yO.prototype,"anchoredRegion",void 0),t([C],yO.prototype,"hasOverflow",void 0),t([C],yO.prototype,"filteredOptions",void 0),t([C],yO.prototype,"filter",void 0),t([C],yO.prototype,"availableViewportHeight",void 0),t([k],yO.prototype,"collapsible",null),t([k],yO.prototype,"displayValue",null)
9491
+ this.$emit("filter-input",t,{bubbles:!0})}initializeOpenState(){this.setActiveOption(this.selectedIndex),this.ariaControls=this.listboxId,this.ariaExpanded="true",this.setPositioning(),this.focusAndScrollOptionIntoView()}}t([ft],yO.prototype,"appearance",void 0),t([ft({attribute:"position"})],yO.prototype,"positionAttribute",void 0),t([ft({attribute:"error-text"})],yO.prototype,"errorText",void 0),t([ft({attribute:"error-visible",mode:"boolean"})],yO.prototype,"errorVisible",void 0),t([ft({attribute:"filter-mode"})],yO.prototype,"filterMode",void 0),t([ft({attribute:"clearable",mode:"boolean"})],yO.prototype,"clearable",void 0),t([ft({attribute:"loading-visible",mode:"boolean"})],yO.prototype,"loadingVisible",void 0),t([C],yO.prototype,"displayPlaceholder",void 0),t([ft({attribute:"open",mode:"boolean"})],yO.prototype,"open",void 0),t([C],yO.prototype,"position",void 0),t([C],yO.prototype,"control",void 0),t([C],yO.prototype,"scrollableRegion",void 0),t([C],yO.prototype,"filterInput",void 0),t([C],yO.prototype,"anchoredRegion",void 0),t([C],yO.prototype,"hasOverflow",void 0),t([C],yO.prototype,"filteredOptions",void 0),t([C],yO.prototype,"filter",void 0),t([C],yO.prototype,"availableViewportHeight",void 0),t([k],yO.prototype,"collapsible",null),t([k],yO.prototype,"labelContent",null),t([k],yO.prototype,"displayValue",null)
9479
9492
  const wO=yO.compose({baseName:"select",baseClass:ns,template:(t,e)=>Q`
9480
9493
  <template
9481
9494
  class="${t=>[t.collapsible&&"collapsible",t.collapsible&&t.open&&"open",t.disabled&&"disabled",t.collapsible&&t.position].filter(Boolean).join(" ")}"
@@ -9484,6 +9497,7 @@ const wO=yO.compose({baseName:"select",baseClass:ns,template:(t,e)=>Q`
9484
9497
  aria-disabled="${t=>t.ariaDisabled}"
9485
9498
  aria-expanded="${t=>t.ariaExpanded}"
9486
9499
  aria-haspopup="${t=>t.collapsible?"listbox":null}"
9500
+ aria-label="${t=>t.labelContent}"
9487
9501
  aria-multiselectable="${t=>t.ariaMultiSelectable}"
9488
9502
  ?open="${t=>t.open}"
9489
9503
  role="combobox"
@@ -9495,6 +9509,9 @@ const wO=yO.compose({baseName:"select",baseClass:ns,template:(t,e)=>Q`
9495
9509
  @keydown="${(t,e)=>t.keydownHandler(e.event)}"
9496
9510
  @mousedown="${(t,e)=>t.mousedownHandler(e.event)}"
9497
9511
  >
9512
+ <label part="label" class="label" aria-hidden="true">
9513
+ <slot ${Ut("labelSlot")}></slot>
9514
+ </label>
9498
9515
  ${Gt((t=>t.collapsible),Q`
9499
9516
  <div
9500
9517
  class="control"