autocomplete-list-min.js revision 109f2c001bf1d522fbb70a1332c1568553706344
YUI.add("autocomplete-list",function(F){var A=F.Node,E=F.Array,G="inputNode",C="visible",D="width",B=F.Base.create("autocompleteList",F.Widget,[F.AutoCompleteBase,F.WidgetPosition,F.WidgetPositionAlign,F.WidgetStack],{CONTENT_TEMPLATE:"<ul/>",ITEM_TEMPLATE:'<li role="option"/>',initializer:function(){this._inputNode=this.get(G);this._events=[];if(!this._inputNode){F.error("No inputNode specified.");}if(!this.get("align.node")){this.set("align.node",this._inputNode);}if(!this.get(D)){this.set(D,this._inputNode.get("clientWidth"));}},destructor:function(){this._unbindInput();while(this._events.length){this._events.pop().detach();}},bindUI:function(){this._bindInput();this._bindList();},renderUI:function(){this._contentBox=this.get("contentBox").set("role","listbox");this._inputNode.addClass(this.getClassName("input")).setAttrs({"aria-autocomplete":"list","aria-owns":this._contentBox.get("id"),role:"combobox"});},syncUI:function(){this._syncResults();this._syncVisibility();},hide:function(){this.set(C,false);},show:function(){this.set(C,true);},_add:function(H){var I=[];E.each(F.Lang.isArray(H)?H:[H],function(J){I.push(this._createItemNode(J));},this);this._contentBox.append(I);},_bindList:function(){this._events.concat([this._inputNode.after("blur",this._afterInputBlur,this),this.after("resultsChange",this._afterResultsChange,this),this.after("visibleChange",this._afterVisibleChange,this)]);},_clear:function(){this._contentBox.setContent("");},_createItemNode:function(H){var I=A.create(this.ITEM_TEMPLATE);I.append(H).addClass(this.getClassName("item"));return I.set("id",F.stamp(I));},_syncResults:function(H){if(!H){H=this.get("results");}this._clear();if(H.length){this._add(H);}},_syncVisibility:function(H){if(H===undefined){H=this.get(C);}this._contentBox.set("aria-hidden",!H);},_afterInputBlur:function(){F.later(20,this,function(){if(!this.get("focused")){this.hide();}});},_afterResultsChange:function(H){this._syncResults(H.newVal);this.set(C,!!H.newVal.length);},_afterVisibleChange:function(H){this._syncVisibility(!!H.newVal);}},{ATTRS:{align:{value:{points:["tl","bl"]}},visible:{value:false}},CSS_PREFIX:F.ClassNameManager.getClassName("aclist")});F.AutoCompleteList=B;},"@VERSION@",{skinnable:true,requires:["autocomplete-base","widget","widget-position","widget-position-align","widget-stack"]});