Permalink
Browse files

new Button build

  • Loading branch information...
1 parent 345eae9 commit e3d75fa1932398c662c200b6db5db9d9fcd1f071 @derek derek committed Dec 16, 2011
Showing with 2 additions and 2 deletions.
  1. +1 −1 build/button-base/button-base-min.js
  2. +1 −1 build/button-group/button-group-min.js
View
2 build/button-base/button-base-min.js
@@ -1 +1 @@
-YUI.add("button-base",function(c){function a(d){a.superclass.constructor.apply(this,arguments);}function b(d){if(d){return c.ClassNameManager.getClassName(a.NAME,d);}else{return c.ClassNameManager.getClassName(a.NAME);}}c.extend(a,c.Base,{initializer:function(d){this.renderUI(d);this.bindUI();},renderUI:function(d){var e=this.getNode();e.addClass(a.CLASS_NAMES.button);e.set("role","button");if(d.label){this._renderLabel(this.get("label"));}if(d.type){this._renderType(this.get("type"));}if(d.disabled){this._renderDisabled(this.get("disabled"));}if(d.selected){this._renderSelected(this.get("selected"));}},bindUI:function(){var d=this;var e=d.getNode();e.on("mousedown",this._onMouseDown);e.on("mouseup",this._onMouseUp);e.on("focus",this._onFocus);e.on("blur",this._onBlur);d.after("labelChange",function(f){this._renderLabel(this.get("label"));});d.after("typeChange",function(f){this._renderType(this.get("type"));});d.after("disabledChange",function(f){this._renderDisabled(this.get("disabled"));});d.after("selectedChange",function(f){this._renderSelected(this.get("selected"));});},getNode:function(){return this.get("srcNode");},select:function(){this.set("selected",true);},unselect:function(){this.set("selected",false);},enable:function(){this.set("disabled",false);},disable:function(){this.set("disabled",true);},_renderLabel:function(e){var d=this.getNode();d.set(d.test("input")?"value":"text",e);},_renderDisabled:function(d){this.getNode().set("disabled",d).toggleClass(a.CLASS_NAMES.disabled,d);},_renderSelected:function(d){this.getNode().set("aria-selected",d).toggleClass(a.CLASS_NAMES.selected,d);},_renderType:function(f){var d=this;if(f==="toggle"){var e=d.getNode();d._clickHandler=e.on("click",function(){d.set("selected",!d.get("selected"));},d);}else{if(d._clickHandler){d._clickHandler.detach();d._clickHandler=false;}}}},{ATTRS:{srcNode:{writeOnce:"initOnly",setter:c.one,valueFn:function(){return c.Node.create("<button></button>");}},label:{},type:{value:"push"},disabled:{value:false},selected:{value:false}}});a.NAME="button";a.CLASS_NAMES={button:b(),selected:b("selected"),focused:b("focused"),disabled:b("disabled")};a.prototype._onBlur=function(d){d.target.removeClass(a.CLASS_NAMES.focused);};a.prototype._onFocus=function(d){d.target.addClass(a.CLASS_NAMES.focused);};a.prototype._onMouseUp=function(d){d.target.setAttribute("aria-pressed","false");};a.prototype._onMouseDown=function(d){d.target.setAttribute("aria-pressed","true");};c.Button=a;},"@VERSION@",{requires:["yui-base","attribute","node","array-extras"]});
+YUI.add("button-base",function(c){function a(d){a.superclass.constructor.apply(this,arguments);}function b(d){if(d){return c.ClassNameManager.getClassName(a.NAME,d);}else{return c.ClassNameManager.getClassName(a.NAME);}}c.extend(a,c.Base,{initializer:function(d){this.renderUI(d);this.bindUI();},renderUI:function(d){var e=this.getNode();e.addClass(a.CLASS_NAMES.button);e.set("role","button");if(d.label){this._renderLabel(this.get("label"));}if(d.type){this._renderType(this.get("type"));}if(d.disabled){this._renderDisabled(this.get("disabled"));}if(d.selected){this._renderSelected(this.get("selected"));}},bindUI:function(){var d=this;var e=d.getNode();e.on("mousedown",this._onMouseDown);e.on("mouseup",this._onMouseUp);e.on("focus",this._onFocus);e.on("blur",this._onBlur);d.after("labelChange",function(f){this._renderLabel(this.get("label"));});d.after("typeChange",function(f){this._renderType(this.get("type"));});d.after("disabledChange",function(f){this._renderDisabled(this.get("disabled"));});d.after("selectedChange",function(f){this._renderSelected(this.get("selected"));});},getNode:function(){return this.get("srcNode");},select:function(){this.set("selected",true);},unselect:function(){this.set("selected",false);},enable:function(){this.set("disabled",false);},disable:function(){this.set("disabled",true);},_renderLabel:function(e){var d=this.getNode();d.set(d.test("input")?"value":"text",e);},_renderDisabled:function(d){this.getNode().set("disabled",d).toggleClass(a.CLASS_NAMES.disabled,d);},_renderSelected:function(d){this.getNode().set("aria-selected",d).toggleClass(a.CLASS_NAMES.selected,d);},_renderType:function(f){var d=this;if(f==="toggle"){var e=d.getNode();d._clickHandler=e.on("click",function(){d.set("selected",!d.get("selected"));},d);}else{if(d._clickHandler){d._clickHandler.detach();d._clickHandler=false;}}}},{ATTRS:{srcNode:{writeOnce:"initOnly",setter:c.one,valueFn:function(){return c.Node.create("<button></button>");}},label:{},type:{value:"push"},disabled:{value:false},selected:{value:false}}});a.NAME="button";a.CLASS_NAMES={button:b(),selected:b("selected"),focused:b("focused"),disabled:b("disabled")};a.prototype._onBlur=function(d){d.target.removeClass(a.CLASS_NAMES.focused);};a.prototype._onFocus=function(d){d.target.addClass(a.CLASS_NAMES.focused);};a.prototype._onMouseUp=function(d){d.target.setAttribute("aria-pressed","false");};a.prototype._onMouseDown=function(d){d.target.setAttribute("aria-pressed","true");};c.Button=a;},"@VERSION@",{requires:["yui-base","attribute","node","array-extras"]});
View
2 build/button-group/button-group-min.js
@@ -1 +1 @@
-YUI.add("button-group",function(b){var a=function(d){this.buttons=new b.ArrayList();var c={selection:{value:[],getter:function(){var e=[];this.buttons.each(function(f){if(f.get("selected")){e.push(f);}});return e;}},type:{value:"radio",validator:function(e){return b.Array.indexOf(["radio","checkbox"],e);}}};this.addAttrs(c,d);if(d.srcNodes){if(b.Lang.isString(d.srcNodes)){d.srcNodes=b.all(d.srcNodes);}d.buttons=[];d.srcNodes.each(function(e){d.srcNode=e;d.buttons.push(new b.Button(d));});delete d.srcNodes;}if(d.buttons){b.Array.each(d.buttons,function(e){this.addButton(e);},this);}};a.prototype.getButtons=function(){return this.buttons._items;};a.prototype.getSelectedButtons=function(){var c=[],d;d=this.buttons;d.each(function(e){if(e.get("selected")){c.push(e);}});return c;};a.prototype.getSelectedValues=function(){var d,c=[];d=this.getSelectedButtons();b.Array.each(d,function(e){c.push(e.getNode().get("value"));});return c;};a.prototype.addButton=function(c){c.set("type","toggle");if(this.get("type")==="radio"){c.before("selectedChange",this._beforeButtonSelectedChange,this);}c.after("selectedChange",this._afterButtonSelectedChange,this);this.buttons.add(c);};a.prototype._beforeButtonSelectedChange=function(c){if(c.target.get("selected")){c.preventDefault();return false;}else{}};a.prototype._onButtonSelectedChange=function(c){};a.prototype._afterButtonSelectedChange=function(d){var f,c;f=false;c=this.buttons;if(this.get("type")==="radio"){c.each(function(e){if(c.indexOf(d.target)!==c.indexOf(e)){f=true;e.set("selected",false,{propagate:false});}else{}});}else{if(this.get("type")==="checkbox"){f=true;}}if(f){this.fire("selectionChange");}};b.augment(a,b.Attribute);b.ButtonGroup=a;},"@VERSION@",{requires:["button-base"]});
+YUI.add("button-group",function(b){var a=function(d){this.buttons=new b.ArrayList();var c={selection:{value:[],getter:function(){var e=[];this.buttons.each(function(f){if(f.get("selected")){e.push(f);}});return e;}},type:{value:"radio",validator:function(e){return b.Array.indexOf(["radio","checkbox"],e);}}};this.addAttrs(c,d);if(d.srcNodes){if(b.Lang.isString(d.srcNodes)){d.srcNodes=b.all(d.srcNodes);}d.buttons=[];d.srcNodes.each(function(e){d.srcNode=e;d.buttons.push(new b.Button(d));});delete d.srcNodes;}if(d.buttons){b.Array.each(d.buttons,function(e){this.addButton(e);},this);}};a.prototype.getButtons=function(){return this.buttons._items;};a.prototype.getSelectedButtons=function(){var c=[],d;d=this.buttons;d.each(function(e){if(e.get("selected")){c.push(e);}});return c;};a.prototype.getSelectedValues=function(){var d,c=[];d=this.getSelectedButtons();b.Array.each(d,function(e){c.push(e.getNode().get("value"));});return c;};a.prototype.addButton=function(c){c.set("type","toggle");if(this.get("type")==="radio"){c.before("selectedChange",this._beforeButtonSelectedChange,this);}c.after("selectedChange",this._afterButtonSelectedChange,this);this.buttons.add(c);};a.prototype._beforeButtonSelectedChange=function(c){if(c.target.get("selected")){c.preventDefault();return false;}else{}};a.prototype._onButtonSelectedChange=function(c){};a.prototype._afterButtonSelectedChange=function(d){var f,c;f=false;c=this.buttons;if(this.get("type")==="radio"){c.each(function(e){if(c.indexOf(d.target)!==c.indexOf(e)){f=true;e.set("selected",false,{propagate:false});}else{}});}else{if(this.get("type")==="checkbox"){f=true;}}if(f){this.fire("selectionChange");}};b.augment(a,b.Attribute);b.ButtonGroup=a;},"@VERSION@",{requires:["button-base"]});

0 comments on commit e3d75fa

Please sign in to comment.