@ni/ok-components 0.3.2 → 0.3.3

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.
@@ -926,17 +926,17 @@ class mo extends Ue{}class go extends(On(mo)){constructor(){super(...arguments),
926
926
  let bo=class extends go{constructor(){super(...arguments),this.resize=vo,this.cols=20,this.handleTextInput=()=>{this.value=this.control.value}}readOnlyChanged(){this.proxy instanceof HTMLTextAreaElement&&(this.proxy.readOnly=this.readOnly)}autofocusChanged(){this.proxy instanceof HTMLTextAreaElement&&(this.proxy.autofocus=this.autofocus)}listChanged(){this.proxy instanceof HTMLTextAreaElement&&this.proxy.setAttribute("list",this.list)}maxlengthChanged(){this.proxy instanceof HTMLTextAreaElement&&(this.proxy.maxLength=this.maxlength)}minlengthChanged(){this.proxy instanceof HTMLTextAreaElement&&(this.proxy.minLength=this.minlength)}spellcheckChanged(){this.proxy instanceof HTMLTextAreaElement&&(this.proxy.spellcheck=this.spellcheck)}select(){this.control.select(),this.$emit("select")}handleChange(){this.$emit("change")}validate(){super.validate(this.control)}}
927
927
  t([ft({mode:"boolean"})],bo.prototype,"readOnly",void 0),t([ft],bo.prototype,"resize",void 0),t([ft({mode:"boolean"})],bo.prototype,"autofocus",void 0),t([ft({attribute:"form"})],bo.prototype,"formId",void 0),t([ft],bo.prototype,"list",void 0),t([ft({converter:ut})],bo.prototype,"maxlength",void 0),t([ft({converter:ut})],bo.prototype,"minlength",void 0),t([ft],bo.prototype,"name",void 0),t([ft],bo.prototype,"placeholder",void 0),t([ft({converter:ut,mode:"fromView"})],bo.prototype,"cols",void 0),t([ft({converter:ut,mode:"fromView"})],bo.prototype,"rows",void 0),t([ft({mode:"boolean"})],bo.prototype,"spellcheck",void 0),t([C],bo.prototype,"defaultSlottedNodes",void 0),We(bo,Ki)
928
928
  const yo=Object.freeze({[mn.ArrowUp]:{[Ge.vertical]:-1},[mn.ArrowDown]:{[Ge.vertical]:1},[mn.ArrowLeft]:{[Ge.horizontal]:{[gn.ltr]:-1,[gn.rtl]:1}},[mn.ArrowRight]:{[Ge.horizontal]:{[gn.ltr]:1,[gn.rtl]:-1}}})
929
- let wo=class t extends Ue{constructor(){super(...arguments),this._activeIndex=0,this.direction=gn.ltr,this.orientation=Ge.horizontal}get activeIndex(){return x.track(this,"activeIndex"),this._activeIndex}set activeIndex(t){this.$fastController.isConnected&&(this._activeIndex=vn(0,this.focusableElements.length-1,t),x.notify(this,"activeIndex"))}slottedItemsChanged(){this.$fastController.isConnected&&this.reduceFocusableElements()}mouseDownHandler(t){const e=this.focusableElements?.findIndex(e=>e.contains(t.target))
929
+ let wo=class t extends Ue{constructor(){super(...arguments),this._activeIndex=0,this.direction=gn.ltr,this.focusableElements=[],this.orientation=Ge.horizontal}get activeIndex(){return x.track(this,"activeIndex"),this._activeIndex}set activeIndex(t){this.$fastController.isConnected&&(this._activeIndex=vn(0,this.focusableElements.length>0?this.focusableElements.length-1:0,t),x.notify(this,"activeIndex"))}slottedItemsChanged(){this.$fastController.isConnected&&this.reduceFocusableElements()}mouseDownHandler(t){const e=this.focusableElements.findIndex(e=>e.contains(t.target))
930
930
  return e>-1&&this.activeIndex!==e&&this.setFocusedElement(e),!0}childItemsChanged(t,e){this.$fastController.isConnected&&this.reduceFocusableElements()}connectedCallback(){super.connectedCallback(),this.direction=Sn(this)}focusinHandler(t){const e=t.relatedTarget
931
931
  e&&!this.contains(e)&&this.setFocusedElement()}getDirectionalIncrementer(t){return yo[t]?.[this.orientation]?.[this.direction]??yo[t]?.[this.orientation]??0}keydownHandler(t){const e=t.key
932
932
  if(!(e in mn)||t.defaultPrevented||t.shiftKey)return!0
933
933
  const n=this.getDirectionalIncrementer(e)
934
934
  if(!n)return!t.target.closest("[role=radiogroup]")
935
935
  const i=this.activeIndex+n
936
- return this.focusableElements[i]&&t.preventDefault(),this.setFocusedElement(i),!0}get allSlottedItems(){return[...this.start.assignedElements(),...this.slottedItems,...this.end.assignedElements()]}reduceFocusableElements(){const e=this.focusableElements?.[this.activeIndex]
936
+ return this.focusableElements.length>0&&this.focusableElements[i]&&t.preventDefault(),this.setFocusedElement(i),!0}get allSlottedItems(){return[...this.start.assignedElements(),...this.slottedItems,...this.end.assignedElements()]}reduceFocusableElements(){const e=this.focusableElements[this.activeIndex]
937
937
  this.focusableElements=this.allSlottedItems.reduce(t.reduceFocusableItems,[])
938
938
  const n=this.focusableElements.indexOf(e)
939
- this.activeIndex=Math.max(0,n),this.setFocusableElements()}setFocusedElement(t=this.activeIndex){this.activeIndex=t,this.setFocusableElements(),this.focusableElements[this.activeIndex]&&this.contains(function(t){const e=t.getRootNode()
939
+ this.activeIndex=Math.max(0,n),this.setFocusableElements()}setFocusedElement(t=this.activeIndex){this.activeIndex=t,this.setFocusableElements(),this.focusableElements.length>0&&this.focusableElements[this.activeIndex]&&this.contains(function(t){const e=t.getRootNode()
940
940
  return e instanceof ShadowRoot?e.activeElement:document.activeElement}(this))&&this.focusableElements[this.activeIndex].focus()}static reduceFocusableItems(e,n){const i="radio"===n.getAttribute("role"),o=n.$fastController?.definition.shadowOptions?.delegatesFocus,r=Array.from(n.shadowRoot?.querySelectorAll("*")??[]).some(t=>Bi(t))
941
941
  return n.hasAttribute("disabled")||n.hasAttribute("hidden")||!(Bi(n)||i||o||r)?n.childElementCount?e.concat(Array.from(n.children).reduce(t.reduceFocusableItems,[])):e:(e.push(n),e)}setFocusableElements(){this.$fastController.isConnected&&this.focusableElements.length>0&&this.focusableElements.forEach((t,e)=>{t.tabIndex=this.activeIndex===e?0:-1})}}
942
942
  t([C],wo.prototype,"direction",void 0),t([ft],wo.prototype,"orientation",void 0),t([C],wo.prototype,"slottedItems",void 0),t([C],wo.prototype,"slottedLabel",void 0),t([C],wo.prototype,"childItems",void 0)