@ni/spright-components 5.2.4 → 5.2.5

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.
@@ -3218,6 +3218,10 @@ const Qg="nimble-icon-arrow-expander-down",tv="above",ev="underline",nv="outline
3218
3218
  color: ${md};
3219
3219
  }
3220
3220
 
3221
+ :host([disabled][appearance-readonly]) .label {
3222
+ color: ${fd};
3223
+ }
3224
+
3221
3225
  .control {
3222
3226
  align-items: center;
3223
3227
  cursor: pointer;
@@ -3239,6 +3243,11 @@ const Qg="nimble-icon-arrow-expander-down",tv="above",ev="underline",nv="outline
3239
3243
  border-color: rgba(${dl}, 0.1);
3240
3244
  }
3241
3245
 
3246
+ :host([disabled][appearance-readonly]) .control {
3247
+ color: ${Gc};
3248
+ border-color: rgba(${dl}, 0.3);
3249
+ }
3250
+
3242
3251
  :host([error-visible]) .control,
3243
3252
  :host([error-visible][open]) .control,
3244
3253
  :host([error-visible][disabled]) .control {
@@ -3260,8 +3269,11 @@ const Qg="nimble-icon-arrow-expander-down",tv="above",ev="underline",nv="outline
3260
3269
  padding-left: ${El};
3261
3270
  }
3262
3271
 
3263
- .selected-value[disabled]::placeholder {
3264
- color: ${Zc};
3272
+ :host([disabled][appearance-readonly]) .selected-value {
3273
+ cursor: text;
3274
+ user-select: text;
3275
+ -webkit-user-select: text;
3276
+ padding-right: ${Dl};
3265
3277
  }
3266
3278
 
3267
3279
  .indicator {
@@ -3273,6 +3285,10 @@ const Qg="nimble-icon-arrow-expander-down",tv="above",ev="underline",nv="outline
3273
3285
  align-items: center;
3274
3286
  }
3275
3287
 
3288
+ :host([disabled][appearance-readonly]) .indicator {
3289
+ display: none;
3290
+ }
3291
+
3276
3292
  .indicator slot[name='indicator'] svg {
3277
3293
  width: ${Rl};
3278
3294
  height: ${Rl};
@@ -3374,10 +3390,6 @@ const Qg="nimble-icon-arrow-expander-down",tv="above",ev="underline",nv="outline
3374
3390
  border-bottom-width: ${Tl};
3375
3391
  padding-bottom: 0;
3376
3392
  }
3377
-
3378
- :host([disabled]) .control {
3379
- border-color: rgba(${dl}, 0.1);
3380
- }
3381
3393
  `),fh(nv,Mt`
3382
3394
  .control {
3383
3395
  border-width: ${Tl};
@@ -3426,12 +3438,6 @@ const Qg="nimble-icon-arrow-expander-down",tv="above",ev="underline",nv="outline
3426
3438
  );
3427
3439
  }
3428
3440
 
3429
- :host([disabled]) *,
3430
- :host([disabled]) {
3431
- ${Om}
3432
- color: ${Zc};
3433
- }
3434
-
3435
3441
  .control {
3436
3442
  bottom-border-width: var(--ni-private-bottom-border-width);
3437
3443
  }
@@ -3458,6 +3464,18 @@ const Qg="nimble-icon-arrow-expander-down",tv="above",ev="underline",nv="outline
3458
3464
  outline: none;
3459
3465
  }
3460
3466
 
3467
+ .selected-value::placeholder {
3468
+ color: ${zc};
3469
+ }
3470
+
3471
+ :host([disabled]) .selected-value::placeholder {
3472
+ color: ${Zc};
3473
+ }
3474
+
3475
+ :host([disabled][appearance-readonly]) .selected-value::placeholder {
3476
+ color: ${zc};
3477
+ }
3478
+
3461
3479
  [part='indicator'] {
3462
3480
  display: none;
3463
3481
  }
@@ -3468,6 +3486,10 @@ const Qg="nimble-icon-arrow-expander-down",tv="above",ev="underline",nv="outline
3468
3486
  padding-right: ${Dl};
3469
3487
  }
3470
3488
 
3489
+ :host([disabled][appearance-readonly]) .end-slot-container {
3490
+ display: none;
3491
+ }
3492
+
3471
3493
  .separator {
3472
3494
  display: inline;
3473
3495
  width: 2px;
@@ -3506,7 +3528,7 @@ function cv(t){return Q`
3506
3528
  </label>
3507
3529
  `)
3508
3530
  let hv=class extends Vi{}
3509
- class uv extends(Fn(hv)){constructor(){super(...arguments),this.proxy=document.createElement("input")}}function pv(t){class e extends t{constructor(){super(...arguments),this.requiredVisible=!1}}return ft({attribute:"required-visible",mode:"boolean"})(e.prototype,"requiredVisible"),e}class fv extends(jg(pv(uv))){constructor(){super(...arguments),this.appearance=ev,this.open=!1,this.filteredOptions=[],this.hasOverflow=!1,this.listboxId=kn("listbox-"),this.availableViewportHeight=0,this.valueUpdatedByInput=!1,this._value="",this.filter="",this.forcedPosition=!1}get value(){return x.track(this,"value"),this._value}set value(t){const e=this._value
3531
+ class uv extends(Fn(hv)){constructor(){super(...arguments),this.proxy=document.createElement("input")}}function pv(t){class e extends t{constructor(){super(...arguments),this.requiredVisible=!1}}return ft({attribute:"required-visible",mode:"boolean"})(e.prototype,"requiredVisible"),e}class fv extends(jg(pv(uv))){constructor(){super(...arguments),this.appearance=ev,this.appearanceReadOnly=!1,this.open=!1,this.filteredOptions=[],this.hasOverflow=!1,this.listboxId=kn("listbox-"),this.availableViewportHeight=0,this.valueUpdatedByInput=!1,this._value="",this.filter="",this.forcedPosition=!1}get value(){return x.track(this,"value"),this._value}set value(t){const e=this._value
3510
3532
  let n=t
3511
3533
  if(this.$fastController.isConnected&&this.options){const e=this.findIndexOfValidOption(t),i=this.options[this.selectedIndex]?.text,s=this.options[e]?.text
3512
3534
  i!==s&&(this.selectedIndex=e),n=this.firstSelectedOption?.text||n}e!==n&&(this._value=n,super.valueChanged(e,n),x.notify(this,"value")),this.filter=t,this.filterOptions(),this.selectedIndex=this.findIndexOfValidOption(this.value)}get options(){return x.track(this,"options"),this.filteredOptions&&this.filter?this.filteredOptions:this._options}set options(t){this._options=t,x.notify(this,"options")}get isAutocompleteInline(){return this.autocomplete===ti||this.isAutocompleteBoth}get isAutocompleteList(){return this.autocomplete===ei||this.isAutocompleteBoth}get isAutocompleteBoth(){return this.autocomplete===ni}slottedOptionsChanged(t,e){const n=this.value
@@ -3542,7 +3564,7 @@ const t=this.getBoundingClientRect(),e=window.innerHeight-t.bottom
3542
3564
  this.forcedPosition?this.position=this.positionAttribute:t.top>e?this.position=Yn:this.position=Xn,this.positionAttribute=this.forcedPosition?this.positionAttribute:this.position,this.availableViewportHeight=this.position===Yn?Math.trunc(t.top):Math.trunc(e)}focusAndScrollOptionIntoView(){this.open&&this.contains(document.activeElement)&&(this.control.focus(),this.firstSelectedOption&&requestAnimationFrame((()=>{this.firstSelectedOption?.scrollIntoView({block:"nearest"})})))}openChanged(){this.open?(this.ariaControls=this.listboxId,this.ariaExpanded="true",this.setPositioning(),this.focusAndScrollOptionIntoView(),b.queueUpdate((()=>this.focus()))):(this.ariaControls="",this.ariaExpanded="false"),this.dropdownButton&&(this.dropdownButton.checked=this.open)}placeholderChanged(){this.proxy instanceof HTMLInputElement&&(this.proxy.placeholder=this.placeholder??"")}setSelectedOptions(){this.selectedOptions=this.selectedIndex>-1?[this.options[this.selectedIndex]]:[],this.ariaActiveDescendant=this.firstSelectedOption?.id??"",this.focusAndScrollOptionIntoView()}selectedOptionsChanged(t,e){this.$fastController.isConnected&&this._options.forEach((t=>{t.selected=e.includes(t)}))}positionChanged(t,e){this.positionAttribute=e,this.setPositioning()}regionChanged(t,e){this.region&&this.controlWrapper&&(this.region.anchorElement=this.controlWrapper)}controlWrapperChanged(t,e){this.region&&this.controlWrapper&&(this.region.anchorElement=this.controlWrapper)}ariaLabelChanged(t,e){this.updateInputAriaLabel()}updateValue(t){this.$fastController.isConnected&&(this.value=this.firstSelectedOption?.text||this.control.value,this.control.value=this.value),t&&this.$emit("change")}setInputToSelection(){this.firstSelectedOption&&(this.control.value=this.firstSelectedOption.text,this.control.focus())}setInlineSelection(){this.firstSelectedOption&&(this.setInputToSelection(),this.control.setSelectionRange(this.filter.length,this.control.value.length,"backward"))}clearSelectionRange(){const t=this.control.value.length
3543
3565
  this.control.setSelectionRange(t,t)}syncValue(){const t=this.selectedIndex>-1?this.firstSelectedOption?.text:this.control.value
3544
3566
  this.updateValue(this.value!==t)}updateInputAriaLabel(){const t=this.shadowRoot?.querySelector(".selected-value")
3545
- this.ariaLabel?t?.setAttribute("aria-label",this.ariaLabel):t?.removeAttribute("aria-label")}emitChangeIfValueUpdated(){this.valueUpdatedByInput&&(this.value!==this.valueBeforeTextUpdate&&this.$emit("change"),this.valueUpdatedByInput=!1)}findIndexOfValidOption(t){return this.options.findIndex((e=>!e.disabled&&e.text===t))}}t([ft],fv.prototype,"appearance",void 0),t([ft({attribute:"autocomplete",mode:"fromView"})],fv.prototype,"autocomplete",void 0),t([ft({attribute:"position"})],fv.prototype,"positionAttribute",void 0),t([ft({attribute:"open",mode:"boolean"})],fv.prototype,"open",void 0),t([ft],fv.prototype,"placeholder",void 0),t([C],fv.prototype,"position",void 0),t([C],fv.prototype,"region",void 0),t([C],fv.prototype,"controlWrapper",void 0),t([C],fv.prototype,"control",void 0),t([C],fv.prototype,"listbox",void 0),t([C],fv.prototype,"dropdownButton",void 0),t([C],fv.prototype,"filteredOptions",void 0),t([C],fv.prototype,"hasOverflow",void 0),t([C],fv.prototype,"availableViewportHeight",void 0)
3567
+ this.ariaLabel?t?.setAttribute("aria-label",this.ariaLabel):t?.removeAttribute("aria-label")}emitChangeIfValueUpdated(){this.valueUpdatedByInput&&(this.value!==this.valueBeforeTextUpdate&&this.$emit("change"),this.valueUpdatedByInput=!1)}findIndexOfValidOption(t){return this.options.findIndex((e=>!e.disabled&&e.text===t))}}t([ft],fv.prototype,"appearance",void 0),t([ft({attribute:"appearance-readonly",mode:"boolean"})],fv.prototype,"appearanceReadOnly",void 0),t([ft({attribute:"autocomplete",mode:"fromView"})],fv.prototype,"autocomplete",void 0),t([ft({attribute:"position"})],fv.prototype,"positionAttribute",void 0),t([ft({attribute:"open",mode:"boolean"})],fv.prototype,"open",void 0),t([ft],fv.prototype,"placeholder",void 0),t([C],fv.prototype,"position",void 0),t([C],fv.prototype,"region",void 0),t([C],fv.prototype,"controlWrapper",void 0),t([C],fv.prototype,"control",void 0),t([C],fv.prototype,"listbox",void 0),t([C],fv.prototype,"dropdownButton",void 0),t([C],fv.prototype,"filteredOptions",void 0),t([C],fv.prototype,"hasOverflow",void 0),t([C],fv.prototype,"availableViewportHeight",void 0)
3546
3568
  const mv=fv.compose({baseName:"combobox",baseClass:uv,template:(t,e)=>Q`
3547
3569
  <template
3548
3570
  aria-disabled="${t=>t.ariaDisabled}"
@@ -9328,6 +9350,10 @@ const XT=Mt`
9328
9350
  color: ${Zc};
9329
9351
  }
9330
9352
 
9353
+ :host([disabled][appearance-readonly]) .selected-value.placeholder {
9354
+ color: ${zc};
9355
+ }
9356
+
9331
9357
  .selected-value {
9332
9358
  order: 1;
9333
9359
  }
@@ -9652,7 +9678,7 @@ const iR="nimble-spinner",sR=t=>t instanceof Ib,oR=t=>t instanceof Ab,rR=cv(Q`
9652
9678
  `)
9653
9679
  let aR=class extends Vi{}
9654
9680
  class lR extends(Fn(aR)){constructor(){super(...arguments),this.proxy=document.createElement("select")}}const cR=t=>!t.visuallyHidden&&!t.disabled&&!t.hidden,dR=t=>!t.visuallyHidden&&!t.hidden
9655
- class hR extends(jg(pv(lR))){constructor(){super(...arguments),this.appearance=ev,this.filterMode=rv.none,this.clearable=!1,this.loadingVisible=!1,this.displayPlaceholder=!1,this.open=!1,this.listboxId=kn("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?_b(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
9681
+ class hR extends(jg(pv(lR))){constructor(){super(...arguments),this.appearance=ev,this.appearanceReadOnly=!1,this.filterMode=rv.none,this.clearable=!1,this.loadingVisible=!1,this.displayPlaceholder=!1,this.open=!1,this.listboxId=kn("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?_b(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
9656
9682
  let n=t
9657
9683
  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
9658
9684
  this.options.forEach((t=>{const e=x.getNotifier(t)
@@ -9750,7 +9776,7 @@ this.selectedIndex=t?this.options.indexOf(t):-1}setProxyOptions(){this.proxy ins
9750
9776
  e&&this.proxy.options.add(e)})))}filterChanged(){this.filterOptions()}emitFilterInputEvent(){const t={filterText:this.filter}
9751
9777
  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
9752
9778
  const t=this.firstSelectedOption
9753
- t&&this.selectedOptionObserver?.observe(t,{characterData:!0,subtree:!0,childList:!0})}}t([ft],hR.prototype,"appearance",void 0),t([ft({attribute:"position"})],hR.prototype,"positionAttribute",void 0),t([ft({attribute:"filter-mode"})],hR.prototype,"filterMode",void 0),t([ft({attribute:"clearable",mode:"boolean"})],hR.prototype,"clearable",void 0),t([ft({attribute:"loading-visible",mode:"boolean"})],hR.prototype,"loadingVisible",void 0),t([C],hR.prototype,"displayPlaceholder",void 0),t([ft({attribute:"open",mode:"boolean"})],hR.prototype,"open",void 0),t([C],hR.prototype,"position",void 0),t([C],hR.prototype,"control",void 0),t([C],hR.prototype,"scrollableRegion",void 0),t([C],hR.prototype,"filterInput",void 0),t([C],hR.prototype,"anchoredRegion",void 0),t([C],hR.prototype,"hasOverflow",void 0),t([C],hR.prototype,"filteredOptions",void 0),t([C],hR.prototype,"filter",void 0),t([C],hR.prototype,"availableViewportHeight",void 0),t([k],hR.prototype,"collapsible",null),t([k],hR.prototype,"labelContent",null),t([k],hR.prototype,"displayValue",null)
9779
+ t&&this.selectedOptionObserver?.observe(t,{characterData:!0,subtree:!0,childList:!0})}}t([ft],hR.prototype,"appearance",void 0),t([ft({attribute:"appearance-readonly",mode:"boolean"})],hR.prototype,"appearanceReadOnly",void 0),t([ft({attribute:"position"})],hR.prototype,"positionAttribute",void 0),t([ft({attribute:"filter-mode"})],hR.prototype,"filterMode",void 0),t([ft({attribute:"clearable",mode:"boolean"})],hR.prototype,"clearable",void 0),t([ft({attribute:"loading-visible",mode:"boolean"})],hR.prototype,"loadingVisible",void 0),t([C],hR.prototype,"displayPlaceholder",void 0),t([ft({attribute:"open",mode:"boolean"})],hR.prototype,"open",void 0),t([C],hR.prototype,"position",void 0),t([C],hR.prototype,"control",void 0),t([C],hR.prototype,"scrollableRegion",void 0),t([C],hR.prototype,"filterInput",void 0),t([C],hR.prototype,"anchoredRegion",void 0),t([C],hR.prototype,"hasOverflow",void 0),t([C],hR.prototype,"filteredOptions",void 0),t([C],hR.prototype,"filter",void 0),t([C],hR.prototype,"availableViewportHeight",void 0),t([k],hR.prototype,"collapsible",null),t([k],hR.prototype,"labelContent",null),t([k],hR.prototype,"displayValue",null)
9754
9780
  const uR=hR.compose({baseName:"select",baseClass:ls,template:(t,e)=>Q`
9755
9781
  <template
9756
9782
  class="${t=>[t.collapsible&&"collapsible",t.collapsible&&t.open&&"open",t.disabled&&"disabled",t.collapsible&&t.position].filter(Boolean).join(" ")}"